Sui Dapp Integration

This wallet follows the Sui Wallet Standard. Reference for integrating with your dApp via the in-app browser.


🔌 Supported Methods

Method

Description

sui:connect

Request wallet connection

sui:getAccounts

Retrieve connected Sui accounts

sui:disconnect

Disconnect from the wallet

sui:signMessage

Sign a raw message

sui:signTransactionBlock

Sign a transaction block

sui:signAndExecuteTransactionBlock


🧩 Detecting Wallet

const provider = window?.wallet?.features?.['sui:connect'];
if (provider) {
  console.log("Sui wallet is available!");
}

✅ Connect

const accounts = await window.wallet.features['sui:connect'].connect();

Response:

[
  {
    address: "0x123...",
    publicKey: "0xabc..."
  }
]

📂 Get Accounts

const accounts = await window.wallet.features['sui:getAccounts'].getAccounts();

📝 Sign Message

const result = await window.wallet.features['sui:signMessage'].signMessage({
  message: new TextEncoder().encode("hello world"),
});

Response:

{
  signature: "base64-signature",
  message: Uint8Array,
  publicKey: "0xabc..."
}

🔐 Sign Transaction Block

const result = await window.wallet.features['sui:signTransactionBlock'].signTransactionBlock({
  transactionBlock: Uint8Array, // serialized tx block
});

🚀 Sign and Execute Transaction

const result = await window.wallet.features['sui:signAndExecuteTransactionBlock'].signAndExecuteTransactionBlock({
  transactionBlock: Uint8Array,
  options: {
    showInput: true,
    showEffects: true,
    showEvents: false,
  }
});

🛑 Disconnect

await window.wallet.features['sui:disconnect'].disconnect();

⚠️ Error Handling

try {
  const accounts = await window.wallet.features['sui:connect'].connect();
} catch (err) {
  console.error("Connect failed:", err);
}

References

Last updated