Skip to main content

API Notes

This guide lists the methods, types, events and error codes of UKey Wallet Sui Provider. Before calling the signature or transaction method, please obtain the account and confirm the current chain.


Methods

MethodDetails
hasPermissions()Check if the site is authorized
requestPermissions()Request user authorization to connect
disconnect()Disconnect wallet
getAccounts()Read connected accounts, including address and publicKey
getActiveChain()Read the current chain ID
isConnected()Check connection status
signAndExecuteTransactionBlock(input)To sign and execute the transaction block, you need to pass in account and chain
signTransactionBlock(input)Only signed transaction blocks need to be passed in account and chain
signAndExecuteTransaction(input)New API, signed and executed using Transaction
signTransaction(input)New API, use Transaction signature only
signMessage(input)Legacy message signature
signPersonalMessage(input)Personal message signature
onAccountChange(callback)Watch account changes
onNetworkChange(callback)Watch Network changes

Types

wallet account

interface WalletAccount {
address: string;
publicKey: Uint8Array;
chains: string[];
features: string[];
}

Sign and execute transaction block input

interface SignAndExecuteTransactionBlockInput {
transactionBlock: TransactionBlock;
options?: {
showEffects?: boolean;
showEvents?: boolean;
showObjectChanges?: boolean;
showBalanceChanges?: boolean;
showInput?: boolean;
showRawInput?: boolean;
};
}

Sign transaction block output

interface SignTransactionBlockOutput {
transactionBlockBytes: string;
signature: string;
}

Sign personal message input

interface SignPersonalMessageInput {
message: Uint8Array;
}

Sign personal message output

interface SignPersonalMessageOutput {
signature: string;
bytes: string;
}

Chain List

NetworkIdentifier
Testnetsui:testnet
development Networksui:devnet

Events

EventCallback inputsDetails
accountChanged{ address, publicKey } | nullSelected account changed
networkChangenetwork: string | nullNetwork updated
connectaddress: stringConnected
disconnect-Connection closed

error code

CodeDetails
4001User rejected the request
4100Authorization required
-32603Provider internal failure