export default class WalletAccountReadOnlyTron extends WalletAccountReadOnly { /** * Creates a new tron read-only wallet account. * * @param {string} address - The account's address. * @param {Omit} [config] - The configuration object. */ constructor(address: string, config?: Omit); /** * The read-only wallet account configuration. * * @protected * @type {Omit} */ protected _config: Omit; /** * The tron web client. * * @protected * @type {TronWeb | undefined} */ protected _tronWeb: TronWeb | undefined; /** * Returns whether a transaction is an already-built tron web transaction * (as returned by `tronWeb.transactionBuilder.*`). * * @protected * @param {TronTransaction} tx - The transaction. * @returns {boolean} True if the transaction is a pre-built tron web transaction. */ protected static _isPrebuiltTransaction(tx: TronTransaction): boolean; /** * Returns whether a transaction is a smart contract call descriptor. * * @protected * @param {TronTransaction} tx - The transaction. * @returns {boolean} True if the transaction is a smart contract call. */ protected static _isSmartContractCall(tx: TronTransaction): boolean; /** * Verifies a message's signature. * * @param {string} message - The original message. * @param {string} signature - The signature to verify (hex-encoded). * @returns {Promise} True if the signature is valid. */ verify(message: string, signature: string): Promise; /** * Returns the account's tronix balance. * * @returns {Promise} The tronix balance (in suns). */ getBalance(): Promise; /** * Returns the account balance for a specific token. * * @param {string} tokenAddress - The smart contract address of the token. * @returns {Promise} The token balance (in base unit). */ getTokenBalance(tokenAddress: string): Promise; /** * Returns the remaining amount of a TRC-20 token that a spender is allowed to spend * on behalf of the account. * * @param {string} tokenAddress - The smart contract address of the token. * @param {string} spender - The spender's address. * @returns {Promise} The allowance (in base unit). */ getAllowance(tokenAddress: string, spender: string): Promise; /** * Quotes the costs of a send transaction operation. * * @param {TronTransaction} tx - The transaction. * @returns {Promise & TronActivationFee>} The transaction's quotes. */ quoteSendTransaction(tx: TronTransaction): Promise & TronActivationFee>; /** * Builds an unsigned tron web transaction from the given transaction. * * @protected * @param {TronTransaction} tx - The transaction. * @returns {Promise} The unsigned tron web transaction. * @throws {Error} If the transaction is invalid. */ protected _buildTransaction(tx: TronTransaction): Promise; /** * Quotes the fee of an already-built tron web transaction. The fee is derived from * the transaction's contract type, so this works for every kind of transaction: * - bandwidth: applies to every transaction (derived from its serialized size); * - energy: only smart contract execution (`TriggerSmartContract`) consumes it; * - activation: only native value transfers to a not-yet-activated recipient. * * @protected * @param {Transaction} transaction - The unsigned tron web transaction. * @returns {Promise & TronActivationFee>} The transaction's quotes. */ protected _quoteTransaction(transaction: Transaction): Promise & TronActivationFee>; /** * Returns whether a transaction is a native value transfer to a not-yet-activated * recipient account (which incurs the account activation fee). * * @protected * @param {string | undefined} type - The transaction's contract type. * @param {{ to_address?: string }} value - The transaction's contract parameter value. * @returns {Promise} True if the transfer activates a new account. */ protected _isActivatingTransfer(type: string | undefined, value: { to_address?: string; }): Promise; /** * Estimates the energy cost of a smart contract call by re-simulating it from the * built transaction's raw call data. * * @protected * @param {EstimateEnergyCostValue} value - The `TriggerSmartContract` parameter value. * @returns {Promise} The energy cost in SUN. */ protected _estimateEnergyCost(value: EstimateEnergyCostValue): Promise; /** * Computes the energy fee (in SUN) needed beyond the account's available staked energy. * * @protected * @param {number} energyUsed - The energy consumed by the call. * @param {number} energyPrice - The energy price (in SUN). * @param {AccountResourceMessage} resources - The sender's resource snapshot. * @returns {bigint} The energy cost in SUN. */ protected _netEnergyCost(energyUsed: number, energyPrice: number, resources: AccountResourceMessage): bigint; /** * Quotes the costs of TRC-20 transfer operation. * TRC-20 transfers do not incur an account activation fee. * * @param {TransferOptions} options - The transfer's options. * @returns {Promise>} The transfer's quotes. */ quoteTransfer(options: TransferOptions): Promise>; /** * Estimates the energy and bandwidth fee of a smart contract call from a * constant contract simulation result. * * @protected * @param {Object} simulation - The result of a `triggerConstantContract` call. * @param {Transaction} simulation.transaction - The simulated transaction. * @param {number} [simulation.energy_used] - The estimated energy consumption. * @returns {Promise} The estimated fee in SUN. */ protected _estimateContractFee({ transaction, energy_used: energyUsed }: { transaction: Transaction; energy_used?: number; }): Promise; /** * Returns a transaction's receipt. * * @deprecated Use {@link getTransaction} instead, which returns a normalized, finality-based receipt. The raw tron receipt remains available on its `receipt` property. * @param {string} hash - The transaction's hash. * @returns {Promise} The receipt, or null if the transaction has not been included in a block yet. */ getTransactionReceipt(hash: string): Promise; /** * Returns a normalized, finality-based receipt for a transaction. * * A transaction included in a block is `confirmed`; once its block has been * solidified (irreversible) it becomes `final`. * * @param {string} hash - The transaction's hash. * @returns {Promise} The normalized receipt. * @throws {ValueError} If the hash is not a valid transaction id. * @throws {NoSuchElementError} If no transaction has been found for the given hash. */ getTransaction(hash: string): Promise; /** * Blocks until a transaction reaches a terminal state (the requested finality target or `dropped`), or times out. * * @param {string} hash - The transaction's hash. * @param {WaitForTransactionOptions} [options] - The wait options. * @returns {Promise} The terminal receipt: the finality target reached (inspect `success` to tell success from revert), or `dropped`. * @throws {TimeoutError} If the target is not reached before the timeout. */ waitForTransaction(hash: string, options?: WaitForTransactionOptions): Promise; /** * Returns whether a committed transaction executed successfully. * * @protected * @param {TronTransactionReceipt} receipt - The native tron receipt. * @returns {boolean} The execution result. */ protected _isTransactionSuccessful(receipt: TronTransactionReceipt): boolean; /** * Returns the number of the latest solidified (irreversible) block, or null when it can't be resolved. * * @protected * @returns {Promise} The solidified block number, or null. */ protected _getSolidifiedBlockNumber(): Promise; /** * Overrides the base default to allow for slower tron inclusion and solidification. * * @type {number} */ get defaultWaitTimeout(): number; /** * Returns the bandwidth cost of a tron web's transaction. * * @protected * @param {Transaction} transaction - The tron web's transaction. * @param {TronBandwidthCostOptions} [options] - Bandwidth calculation options. * @returns {Promise} The bandwidth cost in SUN. */ protected _getBandwidthCost(transaction: Transaction, options?: TronBandwidthCostOptions): Promise; /** * Initializes the tron web provider with optional failover support. * * @param {Omit} config - The read-only wallet account configuration. * @returns {TronWeb | undefined} The initialized tron web provider. */ static initializeProvider(config: Omit): TronWeb | undefined; } export type Transaction = import("tronweb").Types.Transaction; export type TronTransactionReceipt = import("tronweb").Types.TransactionInfo; export type TransactionReceipt = import("@tetherto/wdk-wallet").TransactionReceipt; export type WaitForTransactionOptions = import("@tetherto/wdk-wallet").WaitForTransactionOptions; /** * The tron-specific fields added to a normalized transaction receipt. */ export type TronTransactionDetails = { /** * - The confirmation depth (null when the solidified block can't be resolved). */ confirmations: number | null; /** * - The native tron receipt, or null while the transaction is pending or dropped. */ receipt: TronTransactionReceipt | null; }; export type AccountResourceMessage = import("tronweb").Types.AccountResourceMessage; export type TriggerSmartContractOptions = import("tronweb").Types.TriggerSmartContractOptions; export type ContractFunctionParameter = import("tronweb").Types.ContractFunctionParameter; export type TransactionResult = import("@tetherto/wdk-wallet").TransactionResult; export type TransferOptions = import("@tetherto/wdk-wallet").TransferOptions; export type TransferResult = import("@tetherto/wdk-wallet").TransferResult; export type TronTrxTransfer = { /** * - The transaction's recipient. */ to: string; /** * - The amount of tronixs to send to the recipient (in suns). */ value: number | bigint; }; /** * A smart contract call. */ export type TronSmartContractCall = { /** * - The address of the smart contract to call. */ contractAddress: string; /** * - The function selector to invoke (e.g. 'transfer(address,uint256)'). */ functionSelector: string; /** * - The parameters to pass to the function (default: []). */ parameters?: ContractFunctionParameter[]; /** * - The trigger options (e.g. `feeLimit`, `callValue`). */ options?: TriggerSmartContractOptions; }; export type TronTransaction = TronTrxTransfer | TronSmartContractCall | Transaction; export type TronWalletConfig = { /** * - The url of the tron web provider, or an instance of the {@link TronWeb} class. It's also possible to provide a list of urls or {@link TronWeb} instances instead. In such case, connection errors will cause the wallet to automatically fallback on the next provider in the list. When passing {@link TronWeb} instances, the first one becomes the wallet's primary client; the others contribute only their `fullNode` / `solidityNode` / `eventServer` to the failover pool. */ provider?: string | TronWeb | Array; /** * - If set and if 'provider' is a list of urls or {@link TronWeb} instances, the number of additional retry attempts after the initial call fails. Total attempts = `1 + retries`. For example, `retries: 3` with 4 providers will try each provider once before throwing. If `retries` exceeds the number of providers, the failover will loop back and retry already-failed providers in round-robin order. Default: 3. */ retries?: number; /** * - The maximum fee amount for transfer operations. */ transferMaxFee?: number | bigint; /** * - The maximum fee amount for sendTransaction and signTransaction operations. */ transactionMaxFee?: number | bigint; }; export type TronActivationFee = { /** * - The portion of the fee used for account activation. */ activationFee: bigint; }; export type TronBandwidthCostOptions = { /** * - Whether the transaction activates a new recipient account. */ isActivation?: boolean; /** * - Resource snapshot returned by `getAccountResources` for the sender. */ resources?: AccountResourceMessage; }; /** * The `TriggerSmartContract` parameter value used to estimate a smart contract call's energy cost. */ export type EstimateEnergyCostValue = { /** * - The smart contract address (hex). */ contract_address: string; /** * - The encoded call data. */ data: string; /** * - The caller's address (hex). */ owner_address: string; /** * - The amount of tronixs (in suns) sent along with the call. */ call_value?: number; }; import { WalletAccountReadOnly } from '@tetherto/wdk-wallet'; import { TronWeb } from 'tronweb';