Configuration

Configuration options and settings for @tetherto/wdk-wallet-tron-gasfree

Wallet Configuration

import WalletManagerTronGasfree from '@tetherto/wdk-wallet-tron-gasfree'
import TronWeb from 'tronweb'

// Option 1: Using RPC URL
const config = {
  // Required parameters
  chainId: '728126428', // Blockchain ID
  provider: 'https://api.trongrid.io', // Tron RPC endpoint
  gasFreeProvider: 'https://api.gasfree.com', // Gas-free service URL
  gasFreeApiKey: 'your-api-key', // Gas-free API key
  gasFreeApiSecret: 'your-api-secret', // Gas-free API secret
  serviceProvider: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH', // Service provider address
  verifyingContract: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH', // Verifying contract address
  
  // Optional parameter
  transferMaxFee: 10000000 // Maximum fee in token base units
}

const wallet = new WalletManagerTronGasfree(seedPhrase, config)

// Option 2: Using TronWeb instance
const tronWeb = new TronWeb({ fullHost: 'https://api.trongrid.io' })
const config2 = {
  chainId: '728126428',
  provider: tronWeb,
  gasFreeProvider: 'https://api.gasfree.com',
  gasFreeApiKey: 'your-api-key',
  gasFreeApiSecret: 'your-api-secret',
  serviceProvider: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
  verifyingContract: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH'
}

Account Configuration

Both WalletAccountTronGasfree and WalletAccountReadOnlyTronGasfree share similar configuration requirements:

Configuration Options

Provider

The provider option specifies how to connect to the Tron network.

Type: string | TronWeb Required: Yes

Examples:

Chain ID

The chainId option specifies the blockchain's ID.

Type: string Required: Yes

Example:

Gas-Free Provider

The gasFreeProvider option specifies the URL of the gas-free service.

Type: string Required: Yes

Example:

Gas-Free API Key

The gasFreeApiKey option is your API key for the gas-free service.

Type: string Required: Yes

Example:

Gas-Free API Secret

The gasFreeApiSecret option is your API secret for the gas-free service.

Type: string Required: Yes

Example:

Service Provider

The serviceProvider option is the Tron address of the gas-free service provider.

Type: string Required: Yes

Example:

Verifying Contract

The verifyingContract option is the Tron address of the contract that verifies gas-free transactions.

Type: string Required: Yes

Example:

Transfer Max Fee

The transferMaxFee option sets a maximum limit for transaction fees to prevent unexpectedly high costs.

Type: number Required: No (optional) Unit: Token base units

Example:

Network-Specific Configurations

Tron Mainnet

Tron Nile Testnet


Need Help?