Usage
Installation, quick start, and usage examples for @tetherto/wdk-wallet-tron-gasfree
Installation
npm install @tetherto/wdk-wallet-tron-gasfreeQuick Start
Importing from wdk-wallet-tron-gasfree
wdk-wallet-tron-gasfreeCreating a New Gas-Free Wallet
import WalletManagerTronGasfree, {
WalletAccountTronGasfree,
WalletAccountReadOnlyTronGasfree
} from '@tetherto/wdk-wallet-tron-gasfree'
// Use a BIP-39 seed phrase (replace with your own secure phrase)
const seedPhrase = 'your twelve word seed phrase here' // Replace with actual seed generation
// Create wallet manager with Tron RPC provider and gas-free service provider
const wallet = new WalletManagerTronGasfree(seedPhrase, {
// Tron network configuration
chainId: '728126428', // Tron chain ID
provider: 'https://api.trongrid.io', // or any other Tron RPC provider
// Gas-free service configuration
gasFreeProvider: 'https://gasfree.provider.url', // Gas-free provider's URL
gasFreeApiKey: 'your-gasfree-api-key', // Gas-free provider's API key
gasFreeApiSecret: 'your-gasfree-api-secret', // Gas-free provider's API secret
serviceProvider: 'T...', // Service provider's address
verifyingContract: 'T...', // Verifying contract's address
// Optional configuration
transferMaxFee: 10000000 // Maximum fee in sun (optional)
})
// Get a full access account
const account = await wallet.getAccount(0)
// Convert to a read-only account
const readOnlyAccount = await account.toReadOnlyAccount()
