/** Convert hex address to Tron base58 format. Returns as-is if already base58. */ export declare function tronFromHex(hex: string): string; /** Convert Tron base58 address to 0x-prefixed hex. Returns as-is if already hex. */ export declare function tronToHex(addr: string): string; /** Check if a network name or chainId belongs to Tron (case-insensitive). */ export declare function isTronNetwork(networkOrChainId: string | number): boolean; export interface TronAddress { hex: string; base58: string; } /** * TronClient — encapsulates tronWeb instance, provides high-level contract operations. * * Usage: * // From hardhat runtime (recommended in tasks) * let client = TronClient.fromHre(hre); * * // Manual — with rpc and private key * let client = new TronClient("https://api.trongrid.io", "your_private_key"); * * // Read-only — no private key * let client = new TronClient("https://api.trongrid.io"); * * // Contract interaction * let gw = await client.getContract(artifacts, "Gateway", addr); * let wtoken = await gw.wToken().call(); // read * await gw.setWtoken(client.toHex(wtoken)).sendAndWait(); // write + wait * * // Deploy * let { hex, base58 } = await client.deploy(artifacts, "Gateway"); * let { proxy, implementation } = await client.deployProxy(artifacts, "Gateway", [admin]); * * // Upgrade * await client.upgradeProxy(artifacts, "Gateway", proxyAddr); */ export declare class TronClient { private tronWeb; private connected; /** * Create a TronClient with explicit rpcUrl. * @param rpcUrl - Tron full host URL (e.g. "https://api.trongrid.io") * @param privateKey - optional, omit for read-only operations */ constructor(rpcUrl: string, privateKey?: string); /** * Create TronClient from hardhat runtime environment. * Reads rpcUrl and privateKey from hre.network.config. Verifies RPC connectivity. */ static fromHre(hre: any): TronClient; /** Verify RPC is reachable. Uses getNowBlock which is widely supported. */ private _checkConnection; /** Lazy connection check — called before first contract operation. */ private _ensureConnected; /** Get the default operator address in base58 format. */ get defaultAddress(): string; /** Convert Tron base58 address to 0x hex. */ toHex(addr: string): string; /** Convert 0x hex to Tron base58 address. */ fromHex(hex: string): string; /** * Get a contract instance. Write methods have .sendAndWait() attached. * @param artifacts - hardhat artifacts (hre.artifacts) * @param contractName - contract name (e.g. "Gateway") * @param addr - contract address (base58 or hex) */ getContract(artifacts: any, contractName: string, addr: string): Promise; /** * Deploy contract. If salt is provided, uses CREATE2 factory. * @param artifacts - hardhat artifacts * @param contractName - contract name to deploy * @param args - constructor arguments * @param salt - optional CREATE2 salt for deterministic address * @param feeLimit - Tron fee limit (default 15 TRX) */ deploy(artifacts: any, contractName: string, args?: any[], salt?: string, feeLimit?: number): Promise; /** * Deploy implementation + ERC1967 proxy. If salt is provided, proxy uses factory. * @param artifacts - hardhat artifacts * @param contractName - implementation contract name * @param initArgs - initialize() function arguments * @param salt - optional CREATE2 salt for proxy * @param feeLimit - Tron fee limit */ deployProxy(artifacts: any, contractName: string, initArgs?: any[], salt?: string, feeLimit?: number): Promise<{ proxy: TronAddress; implementation: TronAddress; }>; /** * Upgrade a UUPS proxy to a new implementation. * @param artifacts - hardhat artifacts * @param contractName - new implementation contract name * @param proxyAddr - proxy address to upgrade * @param feeLimit - Tron fee limit */ upgradeProxy(artifacts: any, contractName: string, proxyAddr: string, feeLimit?: number): Promise; /** * Wait for a transaction to be confirmed on-chain. * @param txId - transaction hash from .send() */ waitForTx(txId: string, retries?: number, interval?: number): Promise; /** Wrap contract methods — adds .sendAndWait() to write methods. */ private _wrapContract; } /** @internal Deploy contract on Tron. If salt is provided, uses CREATE2 factory. */ export declare function tronDeploy(tronWeb: any, artifacts: any, contractName: string, args?: any[], salt?: string, feeLimit?: number): Promise; /** @internal Deploy implementation + ERC1967 proxy on Tron. */ export declare function tronDeployProxy(tronWeb: any, artifacts: any, contractName: string, initArgs?: any[], salt?: string, feeLimit?: number): Promise<{ proxy: TronAddress; implementation: TronAddress; }>; /** @internal Upgrade a UUPS proxy to a new implementation on Tron. */ export declare function tronUpgradeProxy(tronWeb: any, artifacts: any, contractName: string, proxyAddr: string, feeLimit?: number): Promise; /** * Send a tron contract call and wait for on-chain confirmation. * @param methodCall - tronweb contract method call (e.g. contract.setWtoken(addr)) * @param tronWeb - tronweb instance for querying tx status * @param opts - send options (feeLimit, callValue, etc.) */ export declare function sendAndWait(methodCall: any, tronWeb: any, opts?: Record): Promise; /** * Wait for a Tron transaction to be confirmed on-chain. * @param tronWeb - tronweb instance * @param txId - transaction hash returned by .send() * @param retries - max poll attempts (default 20) * @param interval - poll interval in ms (default 3000) */ export declare function waitForTx(tronWeb: any, txId: string, retries?: number, interval?: number): Promise;