Skip to main content

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

MethodDetails
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

MethodDetails
sendTransactionSend TON or interact with the contract
signDataSign any data cell
disconnectDisconnect 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

NetworkNetwork ID
Mainnet-239
Testnet-3

Events

EventDetails
accountChangedSelected account changed
disconnectWallet session closed

error code

CodeDetails
0unknown error
1Request payload error
100Unrecognized application
300User rejected the request
400Action is unavailable