API Notes
This guide lists the methods, request types, events and error codes of UKey Wallet TON Connect Provider. Before sending transaction or signature data, please confirm that the session is connected and using the correct network.
Methods
| Method | Details |
|---|---|
connect(version?, request?) | Connect wallet |
restoreConnection() | Restore previous session |
disconnect() | Disconnect wallet |
send(message) | Send RPC request |
listen(callback) | Listen for wallet events |
Send method
| Method | Details |
|---|---|
sendTransaction | Send TON or interact with the contract |
signData | Sign any data cell |
disconnect | Disconnect via RPC |
Types
Account information
interface AccountInfo {
address: string; // 原始地址格式,例如 0:<hex>
network: string; // 网络编号:-239 主网,-3 测试网
publicKey: string; // Hexadecimal public key (without the 0x prefix)
walletStateInit: string; // Note: Base64 encoded state initialization
}
Transaction request
interface TransactionRequest {
valid_until?: number; // Note: Validity UNIX timestamp
network?: string; // Note: Network ID
from?: string; // Note: sender address
messages: Message[]; // Note: Max 4 messages
}
information
interface Message {
address: string; // 接收方的原始地址格式
amount: string; // amount value in nanotons
payload?: string; // Note: Base64 BOC of contract calls
stateInit?: string; // Note: Base64 StateInit for deployment
}
Sign data request
interface SignDataRequest {
schema_crc: number; // Note: Schema identifier
cell: string; // Note: Base64 encoded cell
publicKey?: string; // Note: optional specific key
}
Sign data results
interface SignDataResult {
signature: string; // Note: Base64 signature
timestamp: number; // UTC 时间戳(UNIX)
}
Device information
interface DeviceInfo {
platform: string; // allowed values: 'iphone' | 'android' | 'windows' | 'mac' | 'linux'
appName: string; // sample app name: 'ukey'
appVersion: string; // Note: wallet version
maxProtocolVersion: number; // Reference value: 2
features: string[]; // Note: Supported features
}
network
| Network | Network ID |
|---|---|
| Mainnet | -239 |
| Testnet | -3 |
Events
| Event | Details |
|---|---|
accountChanged | Selected account changed |
disconnect | Wallet session closed |
error code
| Code | Details |
|---|---|
| 0 | unknown error |
| 1 | Request payload error |
| 100 | Unrecognized application |
| 300 | User rejected the request |
| 400 | Action is unavailable |