@t402/wdk-ton-gasless
v2.9.0
Published
Gasless USDT0 payments on TON with Tether WDK
Maintainers
Readme
@t402/wdk-ton-gasless
Gasless USDT0 payments on TON using the WDK's gasless relay.
Installation
pnpm add @t402/wdk-ton-gaslessUsage
import { createTonGaslessClient } from '@t402/wdk-ton-gasless';
const client = await createTonGaslessClient({
wdkInstance: myTonGaslessWallet, // from @tetherto/wdk-wallet-ton-gasless
});
// Check balance
const balance = await client.getBalance();
console.log('USDT0:', client.getFormattedBalance(balance));
// Execute gasless payment (no TON needed for gas)
const result = await client.pay({
to: 'UQ...',
amount: 1000000n, // 1 USDT0 (6 decimals)
});
console.log('Transaction:', result.txHash);
console.log('Gasless:', result.sponsored); // trueAPI
createTonGaslessClient(config)
Creates a TonGaslessClient from a TonGaslessConfig.
TonGaslessClient
| Method | Returns | Description |
|--------|---------|-------------|
| pay(params) | Promise<TonGaslessPaymentResult> | Execute a gasless Jetton transfer |
| getBalance(token?) | Promise<bigint> | Get USDT0 or USDT balance |
| getFormattedBalance(balance, decimals?) | string | Human-readable balance (e.g. "1.5") |
| getAddress() | Promise<string> | Wallet address |
| canSponsor(params) | Promise<boolean> | Check if gasless transfer is available |
Adapter Layer
The package auto-detects the upstream @tetherto/wdk-wallet-ton-gasless interface and adapts alternative method signatures:
adaptTonGaslessWallet(instance)-- Wrap any compatible WDK instanceisUpstreamTonGaslessWallet(instance)-- Type guard for upstream interfacetryLoadUpstreamModule()-- Dynamically load the upstream module
Constants
TON_USDT0_JETTON_MASTER/TON_USDT_JETTON_MASTER-- Jetton master addressesTON_JETTON_DECIMALS-- 6JETTON_ADDRESSES-- Token address lookup mapgetJettonAddress(token)-- Resolve token type to address
Related Packages
@t402/wdk-ton-- Server-side TON wallet management@t402/wdk-- Core WDK wallet toolkit@t402/wdk-tron-gasfree-- Gas-free TRON payments
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.
