Get Started
Install and create your first gasless TON wallet.
This guide explains how to install the package, create a gasless wallet, and get your first account.
1. Install the Package
Prerequisites
npm install @tetherto/wdk-wallet-ton-gasless2. Create a Gasless Wallet
You can create a new gasless wallet instance using the WalletManagerTonGasless constructor with a BIP-39 seed phrase, TON client endpoints, and a paymaster token configuration:
import WalletManagerTonGasless, {
WalletAccountTonGasless,
WalletAccountReadOnlyTonGasless
} from '@tetherto/wdk-wallet-ton-gasless'
const seedPhrase = process.env.WDK_SEED_PHRASE
if (!seedPhrase) throw new Error('WDK_SEED_PHRASE is required')
const wallet = new WalletManagerTonGasless(seedPhrase, {
tonClient: {
url: 'https://toncenter.com/api/v2/jsonRPC',
secretKey: 'your-api-key' // Optional
},
tonApiClient: {
url: 'https://tonapi.io',
secretKey: 'your-ton-api-key' // Optional
},
paymasterToken: {
address: 'EQ...' // Paymaster Jetton master contract address
},
transferMaxFee: 10000000 // Optional: maximum fee in paymaster Jetton base units
})Secure the Seed Phrase: Load seed phrases from secure storage; never hardcode or log them. This server-side example uses an environment variable. If the seed phrase is lost, the user will permanently lose access to their funds.
3. Get Your First Account
You can retrieve an account at a given index using wallet.getAccount():
const account = await wallet.getAccount(0)
const address = await account.getAddress()
console.log('Wallet address:', address)4. (optional) Convert to Read-Only
You can convert an owned account to a read-only account using account.toReadOnlyAccount():
const readOnlyAccount = await account.toReadOnlyAccount()Next Steps
With your wallet ready, learn how to manage multiple accounts.