Usage
Installation, quick start, and usage examples for @tetherto/wdk-wallet-ton-gasless
Installation
npm install @tetherto/wdk-wallet-ton-gaslessQuick Start
Importing from @tetherto/wdk-wallet-ton-gasless
@tetherto/wdk-wallet-ton-gaslessCreating a New Gasless Wallet
import WalletManagerTonGasless, {
WalletAccountTonGasless,
WalletAccountReadOnlyTonGasless
} from '@tetherto/wdk-wallet-ton-gasless'
// Use a BIP-39 seed phrase (replace with your own secure phrase)
const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'
// Create gasless wallet manager with TON RPC and TON API endpoints, and paymaster token config
const wallet = new WalletManagerTonGasless(seedPhrase, {
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key' // Optional
},
tonApiClient: {
url: 'https://tonapi.io/v3',
secretKey: 'your-ton-api-key' // Optional
},
paymasterToken: {
address: 'EQ...' // Paymaster token contract address
}, // Paymaster Jetton master contract address
transferMaxFee: 10000000 // Maximum fee for transfer operations (in paymaster Jetton base units)
})
// Get a full access account
const account = await wallet.getAccount(0)
// Convert to a read-only account
const readOnlyAccount = await account.toReadOnlyAccount()
