/** * EVM Transaction Types */ /** * Gas configuration for EVM transactions */ export interface EVMGasConfig { gasLimit?: number | null maxFeePerGas?: number | null maxPriorityFeePerGas?: number | null } /** * EVM transaction parameters ready for sending (viem format) */ export interface EVMTransactionParams { from?: string to?: string data?: string value?: bigint gasLimit?: bigint maxFeePerGas?: bigint maxPriorityFeePerGas?: bigint } /** * Request for native EVM token transfer (ETH, BNB, MATIC, etc.) */ export interface EVMNativeTransferRequest { to: string amount: bigint from: string gasConfig?: EVMGasConfig } /** * Request for EVM smart contract interaction */ export interface EVMContractCallRequest { contractAddress: string // eslint-disable-next-line @typescript-eslint/no-explicit-any abi: any[] // ethers.InterfaceAbi functionName: string args: unknown[] from: string value?: bigint // For payable functions (in wei) gasConfig?: EVMGasConfig } /** * Request for EVM transaction call data */ export interface EVMDataTransferRequest { from: string to: string data: string value?: bigint // For payable functions (in wei) chainId: string gasConfig?: EVMGasConfig } /** * Request for batch EVM transactions (EIP-5792) */ export interface EVMBatchTransactionRequest { version: string from: string chainId: string atomicRequired: boolean calls: ( | EVMNativeTransferRequest | EVMContractCallRequest | EVMDataTransferRequest )[] } /** * EVM wallet capabilities */ export interface EVMCapabilities { alternateGasFees?: EVMCapability atomic?: EVMCapability paymasterService?: EVMCapability } export type EVMCapability = { status: EVMCapabilityStatus } export type EVMCapabilityStatus = 'supported' | 'ready' | 'unsupported' /** * Solana Transaction Types */ /** * Request for native SOL transfer */ export interface SolanaNativeTransferRequest { from: string to: string amount: bigint blockhash: string } /** * Request for SPL token transfer */ export interface SolanaTokenTransferRequest extends SolanaNativeTransferRequest { tokenMint: string tokenDecimals: number tokenProgram?: string } /** * Request for Solana transfers with instructions */ export interface SolanaGenericTransferRequest { feePayer: string blockhash: string instructions: SolanaTransactionInstruction[] states?: SolanaAddressLookupTable[] additionalRequests?: ( | SolanaNativeTransferRequest | SolanaTokenTransferRequest )[] } export interface SolanaAddressLookupTable { deactivationSlot: bigint lastExtendedSlot: number lastExtendedStartIndex: number key: string authority?: string addresses: string[] } export interface SolanaTransactionInstruction { programId: string accounts: SolanaAccountMeta[] data: string } export interface SolanaAccountMeta { shouldFillPubkey: boolean pubKey: string | null isWritable: boolean isSigner: boolean } /** * Tron Transaction Types */ /** * Request for native TRX transfer */ export interface TronNativeTransferRequest { from: string // sender address (base58) to: string // recipient address (base58) // amount in SUN (1 TRX = 1,000,000 SUN). `bigint` avoids the float-precision // loss of `number` above 2^53; native amounts are serialized to the node as a // JSON number, so they must still be within the safe-integer range. amount: number | bigint } /** * Request for TRC20 token transfer */ export interface TronTRC20TransferRequest { from: string // sender address (base58) to: string // recipient address (base58) // amount in the token's base units. `bigint` carries full precision — TRC20 // amounts are ABI-encoded as a 256-bit word, never as a JSON number, so they // are not bound by the safe-integer range. amount: number | bigint contractAddress: string // TRC20 contract address (base58) } /** * Request to broadcast a pre-encoded Tron `TriggerSmartContract` call verbatim. * * Used for bridging deposits where the provider (Relay) returns fully-formed * calldata that MUST be broadcast byte-for-byte: it carries a trailing tag (the * Relay request id appended after the ABI `transfer` args) that ties the deposit * to the quote. Re-encoding a plain `transfer(to, amount)` — as * {@link TronTRC20TransferRequest} does — would drop that tag and the deposit * could never be matched/filled. Unlike the TRC20 request, the connector does * NOT derive the calldata here; it forwards `data` unchanged and verifies the * node-built transaction reproduces it exactly before signing. * * NOTE: despite the general "contract call" name, the connector currently only * supports calldata whose 4-byte selector is TRC20 `transfer(address,uint256)` * (`a9059cbb`). Any other selector is rejected — arbitrary contract calls can't * be faithfully reproduced through the node's `triggersmartcontract` endpoint. */ export interface TronContractCallRequest { from: string // sender / owner address (base58 or hex) contractAddress: string // target contract address (base58 or hex) // Full ABI calldata incl. the 4-byte selector, hex (with or without `0x`). // Forwarded to the node verbatim — never re-encoded. data: string } export type TronTransactionRequest = | TronNativeTransferRequest | TronTRC20TransferRequest | TronContractCallRequest /** * Common Transaction Types */ /** * Logical parameters for a TON Jetton (TEP-74) transfer. * * On TON, token transfers work differently from EVM: instead of calling a single * token contract, the message is sent to the sender's Jetton wallet contract, * which routes tokens to the recipient's Jetton wallet on-chain. * * Use with buildJettonTransferPayload and buildTonNativeRequestFromJettonTransfer * in @meshconnect/uwc-ton-connector to produce a TonNativeTransferRequest. * * @see https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md * @see https://docs.ton.org/standard/tokens/jettons/transfer */ export interface TonJettonTransferParams { /** Recipient's TON address (not their Jetton wallet — routing happens on-chain). */ destination: string /** Token amount in base units. Account for decimals (e.g. USDT 6 decimals: "1000000" = 1 USDT). */ amount: string /** Address for excess TON gas refund. Should be the sender's address. */ responseDestination: string /** * Nanotons forwarded with a transfer_notification to the recipient's contract. * "0" (default): no notification — tokens transfer silently. Wallet apps still show it. * \> "0": recipient contract is notified (needed for DEX swaps, payment triggers). */ forwardTonAmount?: string /** Text comment for the recipient. Only delivered when forwardTonAmount > 0. */ forwardComment?: string /** 64-bit query id for correlating request/response (default 0). Must be 0 to 2^64-1. */ queryId?: string } /** TON native transfer request — also used for Jetton transfers (with payload carrying the TEP-74 Cell). */ export interface TonNativeTransferRequest { /** Destination address. For native: recipient. For Jetton: sender's Jetton wallet contract. */ to: string /** Nanotons as string. For native: transfer amount. For Jetton: gas attached to the message. */ amount: string /** Sender's TON address. */ from: string /** Base64-encoded BOC. For Jetton transfers, this carries the TEP-74 transfer Cell. */ payload?: string /** Base64-encoded BOC for deploying a contract alongside the transfer. */ stateInit?: string /** Bit flags for message handling (e.g. 128 = send entire balance). */ sendMode?: number /** Unix timestamp (seconds) after which the transaction expires. Defaults to now + 5 min. */ validUntil?: number } /** Transaction identifier returned by the connector (e.g. hex hash on EVM, base58 signature on Solana). */ export type TransactionResult = string /** * Result of a batch transaction */ export interface BatchTransactionResult { id: string status: number atomic: boolean receipts: Array<{ transactionHash: TransactionResult }> } /** * Generic transaction request that can be either EVM or Solana */ export type TransactionRequest = | EthereumTransactionRequest | SolanaTransactionRequest | TronTransactionRequest | TonNativeTransferRequest export type EthereumTransactionRequest = | EVMNativeTransferRequest | EVMContractCallRequest | EVMBatchTransactionRequest | EVMDataTransferRequest export type SolanaTransactionRequest = | SolanaNativeTransferRequest | SolanaTokenTransferRequest | SolanaGenericTransferRequest