Skip to Content
Connect to Software

API Reference

Complete reference for OneKey’s TON provider methods and types.


Methods

MethodDescription
connect(version?, request?)Connect wallet
restoreConnection()Restore previous session
disconnect()Disconnect wallet
send(message)Send RPC request
listen(callback)Listen for wallet events

Send Methods

MethodDescription
sendTransactionSend TON or interact with contracts
signDataSign arbitrary data cells
disconnectDisconnect via RPC

Types

Account Info

interface AccountInfo { address: string // Raw address (0:<hex>) network: string // Network ID (-239 mainnet, -3 testnet) publicKey: string // Hex public key (no 0x) walletStateInit: string // Base64 encoded state init }

Transaction Request

interface TransactionRequest { valid_until?: number // UNIX timestamp for validity network?: string // Network ID from?: string // Sender address messages: Message[] // Up to 4 messages }

Message

interface Message { address: string // Recipient (raw format) amount: string // Amount in nanotons payload?: string // Base64 BOC for contract calls stateInit?: string // Base64 StateInit for deployment }

Sign Data Request

interface SignDataRequest { schema_crc: number // Schema identifier cell: string // Base64 encoded cell publicKey?: string // Optional specific key }

Sign Data Result

interface SignDataResult { signature: string // Base64 signature timestamp: number // UNIX timestamp (UTC) }

Device Info

interface DeviceInfo { platform: string // 'iphone' | 'android' | 'windows' | 'mac' | 'linux' appName: string // 'onekey' appVersion: string // Wallet version maxProtocolVersion: number // 2 features: string[] // Supported features }

Networks

NetworkNetwork ID
Mainnet-239
Testnet-3

Events

EventDescription
accountChangedAccount changed
disconnectWallet disconnected

Error Codes

CodeDescription
0Unknown error
1Bad request
100Unknown app
300User rejected request
400Method not supported
Last updated on