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
| Method | Details |
|---|---|
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
| Network | Identifier |
|---|---|
| Testnet | sui:testnet |
| development Network | sui:devnet |
Events
| Event | Callback inputs | Details |
|---|---|---|
accountChanged | { address, publicKey } | null | Selected account changed |
networkChange | network: string | null | Network updated |
connect | address: string | Connected |
disconnect | - | Connection closed |
error code
| Code | Details |
|---|---|
| 4001 | User rejected the request |
| 4100 | Authorization required |
| -32603 | Provider internal failure |