@t402/wdk-ton
v2.9.0
Published
Server-side TON wallet management with @ton/walletkit for T402
Maintainers
Readme
@t402/wdk-ton
Server-side TON wallet management with @ton/walletkit for T402.
Installation
pnpm add @t402/wdk-tonPeer dependencies:
pnpm add @ton/walletkit @ton/core @ton/cryptoUsage
import { createT402TonWallet, TON_USDT0_JETTON_MASTER } from '@t402/wdk-ton';
const wallet = await createT402TonWallet('word1 word2 ... word24', {
walletVersion: 'v5r1',
network: 'mainnet',
});
// Get wallet info
const info = await wallet.getInfo();
console.log('Address:', info.address);
console.log('Balance:', info.balance);
console.log('Deployed:', info.isDeployed);
// Transfer USDT0
const txHash = await wallet.transferJetton({
jettonMaster: TON_USDT0_JETTON_MASTER,
to: 'UQ...',
amount: 1000000n, // 1 USDT0 (6 decimals)
});API
createT402TonWallet(mnemonic, config?)
Creates a T402TonWallet instance from a BIP-39 mnemonic (12+ words).
T402TonWallet
| Method | Returns | Description |
|--------|---------|-------------|
| getAddress() | Promise<string> | Wallet address (friendly format, cached) |
| getBalance() | Promise<bigint> | TON balance in nanoTON |
| getJettonBalance(master?) | Promise<bigint> | Jetton balance (defaults to USDT0) |
| signMessage(message) | Promise<Uint8Array> | Sign raw bytes |
| sendTransaction(params) | Promise<string> | Send TON, returns tx hash |
| transferJetton(params) | Promise<string> | Transfer Jettons, returns tx hash |
| getSeqno() | Promise<number> | Wallet contract sequence number |
| getInfo() | Promise<T402TonWalletInfo> | Address, balance, deployment status |
| dispose() | void | Clean up resources |
Storage Adapters
InMemoryStorage-- Non-persistent, for testingFileSystemStorage-- Persistent JSON files in a directory
Constants
TON_USDT0_JETTON_MASTER/TON_USDT_JETTON_MASTER-- Jetton master addressesTON_MAINNET_ENDPOINT/TON_TESTNET_ENDPOINT-- API endpointsTON_MAINNET_NETWORK/TON_TESTNET_NETWORK-- CAIP-2 identifiersTON_JETTON_DECIMALS-- 6
Related Packages
@t402/wdk-- Core WDK wallet toolkit@t402/wdk-ton-gasless-- Gasless TON payments via relay@t402/core-- Protocol types and utilities
License
Apache-2.0
Trademark Notice
T402 is an independent open-source project. It is not affiliated with, endorsed by, sponsored by, or in any way officially connected with Tether Operations Limited, Tether Holdings, or any of their affiliates.
"Tether", "USDT", "USDT0", "USDC", and other token names and trademarks referenced are the property of their respective owners and are used nominatively to describe token interoperability or to reference public open-source products (Apache 2.0). Compatibility with Tether's open-source WDK is at the user's option and does not represent a formal partnership.
