import { InterfaceAbi, TransactionLike, Provider as EvmProvider, ContractRunner as EvmRunner, TransactionRequest as EvmTransactionRequest } from "ethers"; import { TronWeb as TronProvider } from "tronweb"; import type { Types } from "tronweb"; import BigNumber from "bignumber.js"; import { PromiseCallback } from "./helper"; import { TransactionReceiptError } from "./errors"; export { TransactionRequest as EvmTransactionRequest, TransactionResponse as EvmTransactionResponse, ContractRunner as EvmRunner, Provider as EvmProvider, Signer as EvmSigner, } from "ethers"; export type TronTransactionRequest = Types.Transaction; export type TronTransactionResponse = Types.SignedTransaction; export type TronTransactionInfo = Types.TransactionInfo; export { TronWeb as TronProvider } from "tronweb"; export { TronWeb as TronSigner } from "tronweb"; export type ContractParamter = Types.ContractParamter; export type TransactionContract = Types.TransactionContract; export type TronContractCallOptions = Types.TriggerSmartContractOptions; export type EvmContractCallOptions = Omit; export type ChainType = "tron" | "evm"; export interface ContractCallArgs { address: string; abi?: InterfaceAbi; method: string; args?: Array; } export type MultiCallArgs = Omit & { key: string; }; export interface ContractSendArgs extends ContractCallArgs { options?: Chain extends "tron" ? TronContractCallOptions : EvmContractCallOptions; } export interface SendOptions { estimateFee?: boolean; } export interface Call { /** * your contract method name */ methodName: string; /** * Method parameters you want it to pass in */ methodParameters: any[]; } export interface ContractCall { /** * Reference to this contract call context */ key: string; /** * The contract address */ address: string; /** * The abi for the contract */ abi: InterfaceAbi; /** * All the calls you want to do for this contract */ call: Call; /** * Store any context or state in here so you don't need * to look back over arrays once you got the result back. */ context?: TContext | undefined; } export interface CallReturnContext extends Call { returnValue: any; /** * This stats if it could decode the result or not */ decoded: boolean; /** * If this context was successful, this will always be try * if you dont use the try aggregate logic */ success: boolean; } export interface ContractCallResults { results: { [key: string]: ContractCallReturnContext; }; blockNumber: BigNumber; } export interface ContractCallReturnContext { originalContractCallContext: ContractCall; callReturnContext: CallReturnContext; } export interface AggregateCall { contractCallIndex: number; target: string; encodedData: string; } export interface AggregateContractResponse { blockNumber: BigNumber; returnData: string[]; } export interface AggregateResponse { blockNumber: BigNumber; results: Array<{ contractCallIndex: number; methodResult: any; }>; } export interface SendTransaction { (tx: Chain extends "tron" ? TronTransactionRequest : EvmTransactionRequest, provider: Chain extends "tron" ? TronProvider : EvmProvider, chain: Chain): Promise; } export type EvmSendTransaction = SendTransaction<"evm">; export type TronSendTransaction = SendTransaction<"tron">; export declare const CONTRACT_SUCCESS = "SUCCESS"; export interface FastTransactionResult { txID: string; signature: string[]; ret?: { contractRet: string; }[]; raw_data: { contract: TransactionContract[]; ref_block_bytes: string; ref_block_hash: string; expiration: number; timestamp: number; data?: unknown; fee_limit?: unknown; }; raw_data_hex: string; } export interface SimpleTransactionResult { blockNumber?: BigInt; txId: string; } export declare enum CheckTransactionType { Fast = "fast", Final = "final" } export type TransactionOption = { check?: CheckTransactionType; success?: (transactionInfo: SimpleTransactionResult) => void; error?: (error: TransactionReceiptError) => void; }; export interface ContractCallback { success: (value: T) => Promise | void; error?: (error: any) => void; } export interface ContractQuery { query: MultiCallArgs; callback?: ContractCallback; } export type ContractQueryCallback = PromiseCallback; export type ContractQueryTrigger = ContractQueryCallback | boolean; export interface TronFormatValue { address?: "base58" | "checksum" | "hex"; uint?: "bigint" | "bignumber"; } export interface EvmFormatValue { address?: "checksum" | "hex"; uint?: "bigint" | "bignumber"; } export interface SetTronFee { (args: { provider: TronProvider; options?: SendOptions; }): Promise<{ feeLimit?: bigint; }>; } export type SetEvmFee = { (args: { provider: EvmProvider; tx: EvmTransactionRequest; options?: SendOptions; }): Promise<{ maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint; gasLimit?: bigint; type?: 2 | 3 | 4; } | { gasPrice?: bigint; gasLimit?: bigint; type?: 0 | 1; }>; }; export type ContractHelperOptions = { chain: Chain; provider: Chain extends "tron" ? TronProvider : EvmRunner; multicallV2Address: string; multicallLazyQueryTimeout?: number; multicallMaxLazyCallsLength?: number; checkTransaction?: CheckTransactionType; simulateBeforeSend?: boolean; formatValue?: Chain extends "tron" ? TronFormatValue : EvmFormatValue; feeCalculation?: Chain extends "tron" ? SetTronFee : SetEvmFee; }; //# sourceMappingURL=types.d.ts.map