TON

TON integration via OneKey's TON Connect compatible provider

Integrate TON blockchain using OneKey's TON Connect compatible provider. Access via window.$onekey.tonconnect.

OneKey implements the TON Connect 2.0 protocol, ensuring compatibility with all TON dApps.



Provider Detection

// Detect OneKey TON provider
const provider = window.$onekey?.tonconnect

if (!provider) {
  throw new Error('OneKey TON provider not detected')
}

// Check device and wallet info
console.log('Device:', provider.deviceInfo)
console.log('Wallet:', provider.walletInfo)
console.log('Protocol Version:', provider.protocolVersion) // 2

Quick Start

Connect Wallet

Connect with Manifest

For production apps, provide a manifest URL:

App Manifest Format

Create tonconnect-manifest.json in your app root:

Restore Connection

Restore a previous session:

Disconnect


Transactions

Send Transaction

Send TON using the send method with sendTransaction:

Send Multiple Messages

TON supports up to 4 messages per transaction:

Send with Payload

Include a payload for smart contract interactions:

Send with StateInit

Deploy a contract or initialize state:


Data Signing

Sign Arbitrary Data

Sign data cells for off-chain verification:

Sign Proof (Authentication)

Request proof for authentication during connection:


Event Handling

Listen for Events


API Reference

Methods

Method
Description

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

Method
Description

sendTransaction

Send TON or interact with contracts

signData

Sign arbitrary data cells

disconnect

Disconnect via RPC

Types

Error Codes

Code
Description

0

Unknown error

1

Bad request

100

Unknown app

300

User rejected request

400

Method not supported


Using with TON Connect SDK

For React applications, use the official TON Connect SDK:

OneKey is automatically detected by TON Connect SDK.

Send Transaction with SDK


Address Formats

TON uses different address formats:


Error Handling

Last updated

Was this helpful?