import type { GasSpeed } from "@toruslabs/ethereum-controllers"; import type { Abi } from "abitype"; export type { GasSpeed }; /** * Optional gas/fee/nonce overrides for a single tx submission. * * If `gasPrice` is supplied alongside `maxFeePerGas` or `maxPriorityFeePerGas` * the caller is mixing legacy and EIP-1559 fields — that's almost always a * mistake and `ControllerEVMWalletClient.prepareViaController` rejects it. * * Otherwise `TransactionController.prepareTransaction` decides what to keep: * - On EIP-1559 chains, `gasPrice` (without 1559 fields) is promoted to * `maxFeePerGas` and the bare `gasPrice` is stripped. * - On legacy chains, 1559 fields are stripped; only `gasPrice` survives. * * Use `nonce` for explicit replay/ordering control. The supplied value is * passed through to `TransactionParams.nonce`, so the controller treats it * as authoritative and skips the `NonceTracker` lookup. Callers are * responsible for not re-using a confirmed nonce or skipping ahead and * stalling later txs. */ export type EVMTransactionFees = { /** Gas limit for the tx. Maps to TransactionParams.gas. */ gas?: bigint; /** Legacy (pre-EIP-1559) gas price in wei. */ gasPrice?: bigint; /** EIP-1559 max fee per gas in wei. */ maxFeePerGas?: bigint; /** EIP-1559 max priority fee (tip) per gas in wei. */ maxPriorityFeePerGas?: bigint; /** * Explicit nonce. Forwarded as `TransactionParams.nonce`; the controller * uses it verbatim and bypasses `NonceTracker.getNonceLock` for assignment. */ nonce?: number; }; export type EVMTransaction = { to: string; functionName?: string; args?: unknown[]; value?: bigint; abi?: Abi; options?: EVMTransactionOptions; data?: `0x${string}`; } & EVMTransactionFees; export type EVMTransactionOptions = { /** * Gas-fee tier for EIP-1559 chains. Forwarded to * `TransactionController.prepareTransaction({ speed })`, which picks the * matching `low | medium | high` bucket out of `GasFeeController` (or its * fallback estimator). Ignored on legacy chains. Defaults to `medium`. */ speed?: GasSpeed; };