Sui Provider API
TokenPocket Extension injects a Sui Provider into the page and supports Sui Wallet Standard. Developers can integrate Sui wallet capabilities through the Provider object or directly through Wallet Standard features.
Provider Injection
The following objects are available on the page:
window.sui
window.tokenpocket.suiTokenPocket also supports Sui Wallet Standard and can be discovered by standard wallet discovery flows.
Quick Start
Connect Wallet
const res = await window.sui.features['standard:connect'].connect();
console.log(res.accounts);Sign a Personal Message
const account = (await window.sui.features['standard:connect'].connect()).accounts[0];
const res =
await window.sui.features['sui:signPersonalMessage'].signPersonalMessage({
account,
message: new TextEncoder().encode('hello tokenpocket'),
});
console.log(res);API List
Sui capabilities are mainly exposed through Wallet Standard features.
standard:connect
Connects the current site to a Sui account.
Notes:
The returned account object includes address, public key, chain information, and supported features.
sui:signTransactionBlock
Signs a TransactionBlock.
sui:signTransaction
Signs a transaction without broadcasting it.
Notes:
The current response is normalized to
bytesandsignature.
sui:signAndExecuteTransactionBlock
Signs and executes a TransactionBlock.
sui:signAndExecuteTransaction
Signs and executes a transaction.
Notes:
The current response is normalized to
bytes,signature,digest, andeffects.
sui:signPersonalMessage
Signs a personal message.
Notes:
Both the raw bytes and a UTF-8 string representation are provided to the wallet confirmation flow.
sui:reportTransactionEffects
Reports transaction effects.
Notes:
The current implementation is callable but does not return additional data.
Wallet Standard
TokenPocket currently supports these Sui Wallet Standard features:
standard:connectstandard:eventssui:signPersonalMessagesui:signTransactionBlocksui:signTransactionsui:signAndExecuteTransactionBlocksui:signAndExecuteTransactionsui:reportTransactionEffects
Official references:
Supported chains:
Integration Example
Error Handling
Use try/catch for all Provider calls.
Common failure cases:
User rejects the connection request.
User rejects signing or execution.
Transaction input is missing or invalid.
The current site is not authorized.
Compatibility Notes
TokenPocket exposes both
window.suiandwindow.tokenpocket.sui.Wallet Standard is recommended for new integrations.
Current chain support is based on
sui:mainnet.