API Reference
Complete API documentation for @tetherto/wdk-wallet-tron
Table of Contents
| Class | Description | Methods |
|---|---|---|
| WalletManagerTron | Main class for managing Tron wallets. Extends WalletManager from @tetherto/wdk-wallet. | Constructor, Methods |
| WalletAccountTron | Individual Tron wallet account implementation. Extends WalletAccountReadOnlyTron and implements IWalletAccount. | Constructor, Methods, Properties |
| WalletAccountReadOnlyTron | Read-only Tron wallet account. Extends WalletAccountReadOnly from @tetherto/wdk-wallet. | Constructor, Methods |
WalletManagerTron
The main class for managing Tron wallets. Extends WalletManager from @tetherto/wdk-wallet.
Fee Rate Constants
const FEE_RATE_NORMAL_MULTIPLIER = 110n
const FEE_RATE_FAST_MULTIPLIER = 200nOne initialized TRON provider is shared by all accounts derived by this manager and their read-only conversions.
Constructor
new WalletManagerTron(seedOrSigner, config?)Parameters:
seedOrSigner(string | Uint8Array | ISignerTron): BIP-39 mnemonic, raw 16–64-byte master seed, or a derivableISignerTronfrom@tetherto/wdk-wallet-tron/signers. A supplied default signer must support derivation.config(TronWalletConfig, optional): Configuration objectprovider(string | TronWeb | Array<string | TronWeb>, optional): Tron RPC endpoint URL, TronWeb instance, or ordered failover listretries(number, optional): Additional failover attempts whenprovideris an array (default: 3)transferMaxFee(number | bigint, optional): Maximum fee amount for TRC20 transfer operations (in sun)transactionMaxFee(number | bigint, optional): Maximum fee amount forsendTransaction()andsignTransaction()operations (in sun)
A seed-backed manager derives accounts through its default signer. Retain any seed your application needs independently of the manager.
Example:
const wallet = new WalletManagerTron(seedPhrase, {
provider: 'https://api.trongrid.io', // Tron RPC endpoint
transferMaxFee: 10000000n, // Maximum TRC20 transfer fee in sun
transactionMaxFee: 10000000n // Maximum send/sign transaction fee in sun
})
// Or with TronWeb instance
const tronWeb = new TronWeb({ fullHost: 'https://api.trongrid.io' })
const wallet2 = new WalletManagerTron(seedPhrase, {
provider: tronWeb,
transferMaxFee: 10000000n,
transactionMaxFee: 10000000n
})
// Or with ordered provider failover
const wallet3 = new WalletManagerTron(seedPhrase, {
provider: [
'https://api.trongrid.io',
'https://secondary-tron-rpc.example'
],
retries: 3
})Methods
| Method | Description | Returns | Throws |
|---|---|---|---|
getAccount(indexOrSignerName?, options?) | Derives an indexed account or returns the account for a named signer | Promise\<WalletAccountTron\> | - |
getAccountByPath(path, options?) | Derives an account at a path relative to the selected signer | Promise\<WalletAccountTron\> | - |
addSigner(name, signer) | Registers a caller-owned ISignerTron | this | ValueError for blank names or DisposalError after disposal |
getSigner(name?) | Returns the default signer or the named signer | ISignerTron | NoSuchElementError if missing |
getFeeRates() | Returns current fee rates from Tron network | Promise\<{normal: bigint, fast: bigint}\> | If no provider |
dispose() | Initiates cleanup of wallet accounts | void | - |
getAccount(index?)
Derives 0'/0/{index} relative to the selected signer. With the default seed-backed signer, derivation starts at m/44'/195'.
Parameters:
indexOrSignerName(number | string, optional): A zero-based index from 0 through 2³¹ − 1 (default: 0), or a registered signer name. A string selects that signer directly without deriving a child.options.signerName(string, optional): Selects a registered root signer for numeric derivation. Omit to use the default signer.
Returns: Promise\<WalletAccountTron\> - The wallet account
Throws: ValueError for an invalid index, NoSuchElementError for an unknown signer, InvalidSignerError when a numeric index selects a non-derivable signer, or DisposalError when the manager is disposed.
Example:
// Get first account (m/44'/195'/0'/0/0)
const account = await wallet.getAccount(0)
// Get second account (m/44'/195'/0'/0/1)
const account1 = await wallet.getAccount(1)getAccountByPath(path)
Derives an account relative to the selected signer.
Parameters:
path(string): Relative BIP-44 path, for example"0'/0/0".options.signerName(string, optional): Selects a registered root signer. Omit to use the default signer.
Returns: Promise\<WalletAccountTron\> - The wallet account
Example:
// Full path: m/44'/195'/0'/0/1
const account = await wallet.getAccountByPath("0'/0/1")getFeeRates()
Returns current fee rates from Tron network chain parameters.
Returns: Promise\<{normal: bigint, fast: bigint}\> - Fee rates in sun
normal: Base fee × 1.1fast: Base fee × 2.0
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const feeRates = await wallet.getFeeRates()
console.log('Normal fee rate:', feeRates.normal, 'sun')
console.log('Fast fee rate:', feeRates.fast, 'sun')dispose()
Disposes the default signer created from a seed, disposes cached accounts that expose a private key at cleanup time, and clears the account cache. Call account.dispose() on any retained account backed by a signer that does not expose private keys, and dispose caller-owned signers separately.
Example:
wallet.dispose()WalletAccountTron
Represents an individual Tron wallet account. Extends WalletAccountReadOnlyTron and implements IWalletAccount.
Constants
const BIP_44_TRON_DERIVATION_PATH_PREFIX = "m/44'/195'"
const BANDWIDTH_PRICE = 1_000nConstructor
new WalletAccountTron(seed, path, config?)
new WalletAccountTron(signer, config?)Parameters:
seed(string | Uint8Array): BIP-39 mnemonic string or a raw 16–64-byte BIP-32 master seed (Uint8Array). Byte input is used directly for derivation.path(string): BIP-44 derivation path (e.g., "0'/0/0")signer(ISignerTron): An account signer. Pass config as the second argument in this form.config(TronWalletConfig, optional): Configuration object. SetshouldWipeSignerOnDisposal: trueto let the account dispose a supplied signer.
A direct account that creates its own signer from a seed or via fromPrivateKey(privateKey, config?) disposes that signer during cleanup.
Throws: ValueError if the mnemonic fails BIP-39 validation or the raw seed length is outside 16–64 bytes
Example:
const account = new WalletAccountTron(seedPhrase, "0'/0/0", {
provider: 'https://api.trongrid.io',
transferMaxFee: 10000000n, // Maximum TRC20 transfer fee in sun
transactionMaxFee: 10000000n // Maximum send/sign transaction fee in sun
})Methods
| Method | Description | Returns | Throws |
|---|---|---|---|
getAddress() | Returns the account's Tron address | Promise\<string\> | - |
sign(message) | Signs a message using the account's private key | Promise\<string\> | DisposalError after account disposal |
verify(message, signature) | Verifies a message signature | Promise\<boolean\> | - |
signTransaction(tx) | Signs a Tron transaction without broadcasting it | Promise\<TronSignedTransaction\> | If no provider, fee exceeds transactionMaxFee, or an unsigned pre-built transaction has inconsistent raw data or a missing or mismatched owner. DisposalError after account disposal |
sendTransaction(tx) | Builds and sends a transaction, or broadcasts a signed transaction | Promise\<{hash: string, fee: bigint, activationFee: bigint}\> | If no provider or fee exceeds transactionMaxFee; unsigned pre-built inputs also require consistent raw data and a matching owner. DisposalError after account disposal |
quoteSendTransaction(tx) | Estimates the fee for an unsigned or signed Tron transaction | Promise\<{fee: bigint, activationFee: bigint}\> | If no provider |
transfer(options) | Transfers TRC20 tokens to another address | Promise\<{hash: string, fee: bigint}\> | If no provider or fee exceeds transferMaxFee. DisposalError after account disposal |
approve(options) | Approves a specific amount of a TRC20 token for a spender | Promise\<TransactionResult & TronActivationFee\> | ProviderRequiredError if no provider or MaximumFeeExceededError if the fee exceeds transactionMaxFee. DisposalError after account disposal |
quoteTransfer(options) | Estimates the fee for a TRC20 transfer | Promise\<{fee: bigint}\> | If no provider |
getBalance() | Returns the native TRX balance (in sun) | Promise\<bigint\> | If no provider |
getTokenBalance(tokenAddress) | Returns the balance of a specific TRC20 token | Promise\<bigint\> | If no provider |
getAllowance(tokenAddress, spender) | Returns the TRC20 allowance a spender can use on behalf of the account | Promise\<bigint\> | If no provider |
getTransaction(hash) | Returns a normalized receipt for a TRON transaction ID | Promise\<TransactionReceipt & TronTransactionDetails\> | If no provider, invalid ID, or transaction not found |
waitForTransaction(hash, options?) | Waits for the requested TRON finality | Promise\<TransactionReceipt & TronTransactionDetails\> | If no provider, invalid ID, or timeout |
getTransactionReceipt(hash) | Deprecated: returns the native TRON receipt | Promise\<TronTransactionReceipt | null\> | If no provider |
toReadOnlyAccount() | Returns a read-only copy of the account | Promise\<WalletAccountReadOnlyTron\> | - |
dispose() | Initiates the account cleanup process | void | - |
getAddress()
Returns the account's Tron address (starts with 'T').
Returns: Promise\<string\> - The account's Tron address
Example:
const address = await account.getAddress()
console.log('Account address:', address) // T...sign(message)
Signs a message using Keccak-256 hash and secp256k1 signature.
Parameters:
message(string): The message to sign (UTF-8 encoded)
Returns: Promise\<string\> - The message signature (hex string)
Example:
const message = 'Hello, Tron!'
const signature = await account.sign(message)
console.log('Signature:', signature)verify(message, signature)
Verifies a message signature using secp256k1.
Parameters:
message(string): The original messagesignature(string): The signature to verify (hex string)
Returns: Promise\<boolean\> - True if signature is valid
Example:
const isValid = await account.verify('Hello, Tron!', signature)
console.log('Signature valid:', isValid)signTransaction(tx)
Signs a Tron transaction and returns the signed transaction object. This method does not broadcast the transaction.
Parameters:
tx(TronTransaction): Native TRX transfer, smart-contract call descriptor, or pre-built TronWeb transaction
Returns: Promise\<TronSignedTransaction\> - Signed Tron transaction object with a signature array
Throws:
ProviderRequiredErrorif no TronWeb provider is configuredMaximumFeeExceededErrorif the fee exceedstransactionMaxFee- Error if an unsigned pre-built transaction's
txIDdoes not match its serialized raw data - Error if a pre-built transaction's first contract omits
owner_addressor names a different account
Example:
const signedTransaction = await account.signTransaction({
to: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
value: 1000000
})
console.log('Signed transaction:', signedTransaction)sendTransaction(tx)
Sends a Tron transaction and returns the result with hash, fee, and activation fee details.
Parameters:
tx(TronTransaction | TronSignedTransaction): Native TRX transfer, smart-contract call descriptor, pre-built unsigned TronWeb transaction, or signed transaction
When tx has a signature, WDK quotes it again, enforces transactionMaxFee, and forwards the exact object to tronWeb.trx.sendRawTransaction(). It does not rebuild the transaction, refresh its reference block or expiration, re-sign it, or repeat the unsigned pre-built raw-data and owner checks.
Returns: Promise\<{hash: string, fee: bigint, activationFee: bigint}\> - Transaction hash, total fee in sun, and the portion used for account activation
Throws:
ProviderRequiredErrorif no TronWeb provider is configuredMaximumFeeExceededErrorif the fee exceedstransactionMaxFee- Error if an unsigned pre-built transaction's
txIDdoes not match its serialized raw data - Error if an unsigned pre-built transaction's first contract omits
owner_addressor names a different account
Example:
const result = await account.sendTransaction({
to: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH', // Tron address
value: 1000000 // 1 TRX in sun
})
console.log('Transaction hash:', result.hash)
console.log('Transaction fee:', result.fee, 'sun')
console.log('Activation fee:', result.activationFee, 'sun')quoteSendTransaction(tx)
Estimates the cost for a Tron transaction. Quotes include bandwidth for every transaction, energy for smart-contract execution, and activation fee for native transfers to inactive recipients.
Parameters:
tx(TronTransaction | TronSignedTransaction): An unsigned transaction input or signed transaction
Returns: Promise\<{fee: bigint, activationFee: bigint}\> - Fee estimate in sun and the portion used for account activation
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const quote = await account.quoteSendTransaction({
to: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
value: 1000000
})
console.log('Estimated fee:', quote.fee, 'sun')
console.log('Activation fee:', quote.activationFee, 'sun')transfer(options)
Transfers TRC20 tokens using smart contract call.
Parameters:
options(TransferOptions): Transfer optionstoken(string): TRC20 contract address (e.g., 'T...')recipient(string): Recipient Tron address (e.g., 'T...')amount(number | bigint): Amount in token's base units
Returns: Promise\<{hash: string, fee: bigint}\> - Transaction hash and fee in sun
Throws:
ProviderRequiredErrorif no TronWeb provider is configuredMaximumFeeExceededErrorif the fee exceedstransferMaxFeeTransferErrorwith reasonTransferErrorReason.INSUFFICIENT_TOKEN_BALANCEif transfer simulation reverts and the token balance is below the amount
Example:
const result = await account.transfer({
token: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', // USDt TRC20
recipient: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
amount: 1000000 // 1 USDt (6 decimals)
})
console.log('Transfer hash:', result.hash)
console.log('Transfer fee:', result.fee, 'sun')approve(options)
Builds the TRC20 approve(address,uint256) call, signs it, broadcasts it, and returns the transaction result. The approval replaces the current allowance for the token and spender; it does not add to it.
Parameters:
options(ApproveOptions): Approval optionstoken(string): TRC20 contract addressspender(string): Address authorized to spend the tokenamount(number | bigint): New allowance in the token's base units
Returns: Promise\<TransactionResult & TronActivationFee\> - Transaction hash, fee in sun, and the portion used for account activation
Throws:
ProviderRequiredErrorif no TronWeb provider is configuredMaximumFeeExceededErrorif the transaction fee exceedstransactionMaxFee
See Approve a bounded allowance for a read-before-change example.
quoteTransfer(options)
Estimates the TRC20 token transfer cost from current chain parameters, account resources, contract energy use, and bandwidth use.
Parameters:
options(TransferOptions): Transfer options (same as transfer)
Returns: Promise\<{fee: bigint}\> - Fee estimate in sun (energy + bandwidth costs)
Throws: ProviderRequiredError if no TronWeb provider is configured. A TransferError with reason TransferErrorReason.INSUFFICIENT_TOKEN_BALANCE is raised if simulation reverts and the token balance is below the amount.
Example:
const quote = await account.quoteTransfer({
token: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
recipient: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
amount: 1000000
})
console.log('Transfer fee estimate:', quote.fee, 'sun')getBalance()
Returns the native TRX balance.
Returns: Promise\<bigint\> - Balance in sun
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const balance = await account.getBalance()
console.log('TRX balance:', balance, 'sun')getTokenBalance(tokenAddress)
Returns the balance of a specific TRC20 token.
Parameters:
tokenAddress(string): The TRC20 contract address (e.g., 'T...')
Returns: Promise\<bigint\> - Token balance in base units
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const tokenBalance = await account.getTokenBalance('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t')
console.log('USDt balance:', tokenBalance) // In 6 decimal unitsgetAllowance(tokenAddress, spender)
Returns the remaining amount of a TRC20 token that spender can spend on behalf of the account.
Parameters:
tokenAddress(string): The TRC20 contract addressspender(string): The address authorized to spend the account's tokens
Returns: Promise\<bigint\> - Allowance in the token's base units
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const allowance = await account.getAllowance(tokenAddress, spenderAddress)
console.log('Current token allowance:', allowance)getTransactionReceipt(hash)
Returns a native TRON receipt if it has been processed. This method is deprecated; use getTransaction() for normalized finality and read its receipt field when you need the native object.
Parameters:
hash(string): The transaction hash
Returns: Promise\<TronTransactionReceipt | null\> - Transaction receipt or null
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const receipt = await account.getTransactionReceipt('0x...')
console.log('Transaction confirmed:', receipt.success)getTransaction(hash)
Returns a normalized receipt for a trimmed 64-hex-character TRON transaction ID; an optional 0x prefix is accepted. A provider result without blockNumber is pending. A block-included transaction is confirmed, becoming final when its block is at or below the latest solidified block.
Included receipts expose success, block, fee, confirmations, and the native receipt. If the solidified block cannot be resolved, the transaction remains confirmed and confirmations is null. success is false when the top-level result is FAILED or the contract result is not SUCCESS.
Throws: ValueError for an invalid transaction ID and NoSuchElementError when the provider returns no transaction.
const transaction = await account.getTransaction(result.hash)
console.log(transaction.finality) // 'pending', 'confirmed', or 'final'
console.log(transaction.confirmations) // number or nullwaitForTransaction(hash, options?)
Polls until the requested finality is reached or the wait times out. Defaults are target: 'confirmed', interval: 4000, timeout: 90000, and maxPollErrors: 3. An unknown transaction is retried until timeout; this implementation does not currently emit dropped receipts.
const transaction = await account.waitForTransaction(result.hash, {
target: 'final',
timeout: 180000
})toReadOnlyAccount()
Creates a read-only copy of the account using the same initialized TRON provider.
Returns: Promise\<WalletAccountReadOnlyTron\> - Read-only account instance
Example:
const readOnlyAccount = await account.toReadOnlyAccount()
// Can check balances but cannot send transactions
const balance = await readOnlyAccount.getBalance()dispose()
Disposes the account. It also disposes its signer when it owns the signer or was configured with shouldWipeSignerOnDisposal: true. A signer supplied directly is caller-owned by default.
Example:
account.dispose()Properties
Each account exposes its signer’s full path when available. If you need the numeric index later, retain the index you used to retrieve the account.
| Property | Type | Description |
|---|---|---|
path | string | null | The full BIP-44 path, or null for a non-HD signer |
keyPair | {privateKey: Uint8Array | null, publicKey: Uint8Array} | null | The signer’s key pair, or null if it does not expose one. For bundled signers, privateKey becomes null when the signer is disposed. |
Example:
console.log('Account path:', account.path) // m/44'/195'/0'/0/0The keyPair byte arrays are bound to the wallet account. Treat them as a read-only view: do not mutate, log, display, or expose the private key.
WalletAccountReadOnlyTron
Represents a read-only Tron wallet account that can query balances and estimate fees but cannot send transactions.
Constructor
new WalletAccountReadOnlyTron(address, config?)Parameters:
address(string): The account's Tron addressconfig(Omit<TronWalletConfig, 'transferMaxFee' | 'transactionMaxFee'>, optional): Configuration object without send-only fee caps
Example:
const readOnlyAccount = new WalletAccountReadOnlyTron('TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH', {
provider: 'https://api.trongrid.io'
})Methods
| Method | Description | Returns | Throws |
|---|---|---|---|
getBalance() | Returns the native TRX balance (in sun) | Promise\<bigint\> | If no provider |
getTokenBalance(tokenAddress) | Returns the balance of a specific TRC20 token | Promise\<bigint\> | If no provider |
getAllowance(tokenAddress, spender) | Returns the current TRC20 allowance for a spender | Promise\<bigint\> | If no provider |
quoteSendTransaction(tx) | Estimates the fee for a Tron transaction | Promise\<{fee: bigint, activationFee: bigint}\> | If no provider |
quoteTransfer(options) | Estimates the fee for a TRC20 transfer | Promise\<{fee: bigint}\> | If no provider |
verify(message, signature) | Verifies a message signature | Promise\<boolean\> | - |
getTransaction(hash) | Returns a normalized receipt for a TRON transaction ID | Promise\<TransactionReceipt & TronTransactionDetails\> | If no provider, invalid ID, or transaction not found |
waitForTransaction(hash, options?) | Waits for the requested TRON finality | Promise\<TransactionReceipt & TronTransactionDetails\> | If no provider, invalid ID, or timeout |
getTransactionReceipt(hash) | Deprecated: returns the native TRON receipt | Promise\<TronTransactionReceipt | null\> | If no provider |
getBalance()
Returns the native TRX balance.
Returns: Promise\<bigint\> - Balance in sun
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const balance = await readOnlyAccount.getBalance()
console.log('TRX balance:', balance, 'sun')getTokenBalance(tokenAddress)
Returns the balance of a specific TRC20 token.
Parameters:
tokenAddress(string): The TRC20 contract address
Returns: Promise\<bigint\> - Token balance in base units
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const tokenBalance = await readOnlyAccount.getTokenBalance('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t')
console.log('USDt balance:', tokenBalance)getAllowance(tokenAddress, spender)
Returns the current TRC20 allowance granted by this account to a spender.
Parameters:
tokenAddress(string): The TRC20 contract addressspender(string): The address allowed to spend the token
Returns: Promise\<bigint\> - Allowance in the token's base units
Throws: ProviderRequiredError if no TronWeb provider is configured
Example:
const allowance = await readOnlyAccount.getAllowance(
'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
'TSpenderAddress...'
)
console.log('USDt allowance:', allowance)quoteSendTransaction(tx)
Estimates the cost for a Tron transaction. Quotes include bandwidth for every transaction, energy for smart-contract execution, and activation fee for native transfers to inactive recipients.
Parameters:
tx(TronTransaction): The transaction object
Returns: Promise\<{fee: bigint, activationFee: bigint}\> - Fee estimate in sun and the portion used for account activation
Throws: ProviderRequiredError if no TronWeb provider is configured
quoteTransfer(options)
Estimates the TRC20 token transfer cost from current chain parameters, account resources, contract energy use, and bandwidth use.
Parameters:
options(TransferOptions): Transfer options
Returns: Promise\<{fee: bigint}\> - Fee estimate in sun
Throws: ProviderRequiredError if no TronWeb provider is configured. A TransferError with reason TransferErrorReason.INSUFFICIENT_TOKEN_BALANCE is raised if simulation reverts and the token balance is below the amount.
verify(message, signature)
Verifies a message signature using secp256k1.
Parameters:
message(string): The original messagesignature(string): The signature to verify (hex string)
Returns: Promise\<boolean\> - True if signature is valid
Example:
const readOnlyAccount = new WalletAccountReadOnlyTron('T...', { provider: '...' })
const isValid = await readOnlyAccount.verify(message, signature)
console.log('Signature valid:', isValid)getTransactionReceipt(hash)
Returns a native TRON receipt if it has been processed. This method is deprecated in favor of getTransaction(). The read-only account's getTransaction() and waitForTransaction() use the same ID validation, pending/confirmed/final, 90-second default timeout, confirmation depth, and native receipt semantics documented above.
Parameters:
hash(string): The transaction hash
Returns: Promise\<TronTransactionReceipt | null\> - Transaction receipt or null
Throws: ProviderRequiredError if no TronWeb provider is configured
Types
TronWalletConfig
interface TronWalletConfig {
provider?: string | TronWeb | Array<string | TronWeb>; // RPC, TronWeb, or failover list
retries?: number; // Additional failover attempts, default 3
transferMaxFee?: number | bigint; // Maximum TRC20 transfer fee in sun
transactionMaxFee?: number | bigint; // Maximum sendTransaction/signTransaction fee in sun
}TronTransaction
type TronTransaction = TronTrxTransfer | TronSmartContractCall | Transaction;
interface TronTrxTransfer {
to: string; // Recipient Tron address
value: number | bigint; // Amount in sun (1 TRX = 1,000,000 sun)
}
interface TronSmartContractCall {
contractAddress: string; // Smart contract address to call
functionSelector: string; // Function selector, e.g. 'transfer(address,uint256)'
parameters?: ContractFunctionParameter[];
options?: TriggerSmartContractOptions;
}
type Transaction = import('tronweb').Types.Transaction;ContractFunctionParameter and TriggerSmartContractOptions are TronWeb types used by transactionBuilder.triggerSmartContract(). Pre-built Transaction values are the unsigned transaction objects returned by TronWeb transaction-builder methods.
TransferOptions
interface TransferOptions {
token: string; // TRC20 contract address
recipient: string; // Recipient Tron address
amount: number | bigint; // Amount in token base units
}ApproveOptions
interface ApproveOptions {
token: string; // TRC20 contract address
spender: string; // Address authorized to spend tokens
amount: number | bigint; // New allowance in token base units
}TransactionResult
interface TransactionResult {
hash: string; // Transaction hash
fee: bigint; // Fee paid in sun
}TronSignedTransaction
type TronSignedTransaction = import('tronweb').Types.SignedTransactionThe WDK package re-exports this TronWeb type under the exact name TronSignedTransaction.
TronActivationFee
interface TronActivationFee {
activationFee: bigint; // Portion of the fee used for account activation
}TransferResult
interface TransferResult {
hash: string; // Transaction hash
fee: bigint; // Fee paid in sun
}Constants
// Tron-specific constants
const BIP_44_TRON_DERIVATION_PATH_PREFIX: string = "m/44'/195'";
const BANDWIDTH_PRICE: bigint = 1_000n;
// Fee rate multipliers
const FEE_RATE_NORMAL_MULTIPLIER: bigint = 110n;
const FEE_RATE_FAST_MULTIPLIER: bigint = 200n;Node.js Quickstart
Get started with WDK in a Node.js environment
React Native Quickstart
Build mobile wallets with React Native Expo
WDK Tron Wallet Usage
Get started with WDK's Tron Wallet Usage
WDK Tron Wallet Configuration
Get started with WDK's Tron Wallet Configuration