WDK logoWDK documentation

Wallet EVM 7702 Gasless API Reference

Complete API documentation for @tetherto/wdk-wallet-evm-7702-gasless.

Table of Contents

ExportDescription
WalletManagerEvm7702GaslessDefault export. Manages EIP-7702 gasless EVM wallet accounts.
WalletAccountEvm7702GaslessOwned EIP-7702 gasless account with signing, approval, transfer, and send methods.
WalletAccountReadOnlyEvm7702GaslessRead-only account with balances, quotes, receipts, allowances, and verification.
ConfigurationErrorError thrown for invalid wallet configuration.
Config TypesEvm7702GaslessWalletConfig and related fee-mode types.

WalletManagerEvm7702Gasless

Default export from @tetherto/wdk-wallet-evm-7702-gasless.

import WalletManagerEvm7702Gasless from '@tetherto/wdk-wallet-evm-7702-gasless'

Constructor

new WalletManagerEvm7702Gasless(seed, config)
ParameterTypeDescription
seedstring | Uint8ArrayBIP-39 mnemonic seed phrase or seed bytes.
configEvm7702GaslessWalletConfigWallet configuration with common fields and one fee mode.

Methods

MethodParametersReturnsNotes
getAccount(index?)index?: numberPromise\<WalletAccountEvm7702Gasless\>Defaults to index 0 and derives 0'/0/{index}.
getAccountByPath(path)path: stringPromise\<WalletAccountEvm7702Gasless\>Returns a cached account for the derivation path suffix.
getFeeRates()-Promise\<{ normal: bigint, fast: bigint }\>Uses provider fee data. Throws if no provider is connected.
dispose()-voidInherited from WalletManager; disposes managed accounts.

getFeeRates() returns fee rates in wei. The normal value applies the EVM wallet normal multiplier, and fast applies the EVM wallet fast multiplier to the provider fee.

WalletAccountEvm7702Gasless

Named export for owned EIP-7702 gasless accounts.

import { WalletAccountEvm7702Gasless } from '@tetherto/wdk-wallet-evm-7702-gasless'

Constructors

new WalletAccountEvm7702Gasless(seed, path, config)
new WalletAccountEvm7702Gasless(walletAccountEvm, config)
ParameterTypeDescription
seedstring | Uint8ArrayBIP-39 mnemonic seed phrase or seed bytes.
pathstringEVM derivation path suffix, for example "0'/0/0".
walletAccountEvmWalletAccountEvmExisting EVM account to wrap.
configEvm7702GaslessWalletConfigWallet configuration.

Properties

PropertyTypeDescription
indexnumberDerivation path index from the wrapped EVM account.
pathstringFull derivation path from the wrapped EVM account.
keyPairKeyPairRead-only view of the wrapped EVM account key pair.

Treat the arrays returned through keyPair as read-only. Call dispose() when the account is no longer needed.

Methods

MethodParametersReturnsNotes
getAddress()-Promise\<string\>Inherited read-only method. Returns the EOA address.
getBalance()-Promise\<bigint\>Native token balance in wei.
getTokenBalance(tokenAddress)tokenAddress: stringPromise\<bigint\>ERC-20 balance in base units.
getTokenBalances(tokenAddresses)tokenAddresses: string[]Promise\<Record\<string, bigint\>\>Multiple ERC-20 balances in base units.
getPaymasterTokenBalance()-Promise\<bigint\>Throws ConfigurationError when no paymasterToken is configured.
sign(message)message: stringPromise\<string\>Signs with the wrapped EVM account.
signTypedData(typedData)TypedDataPromise\<string\>Signs EIP-712 typed data.
verify(message, signature)message: string, signature: stringPromise\<boolean\>Verifies a plain message signature.
verifyTypedData(typedData, signature)TypedData, signature: stringPromise\<boolean\>Verifies EIP-712 typed data.
signTransaction(tx, config?)EvmTransaction | EvmTransaction[], partial fee-mode configPromise\<UserOperationV8\>Signs a self-contained UserOperation without broadcasting it.
approve(options)ApproveOptionsPromise\<TransactionResult\>Sends an ERC-20 approval as a UserOperation.
quoteSendTransaction(tx, config?)EvmTransaction | EvmTransaction[] | UserOperationV8, partial fee-mode configPromise\<Omit\<TransactionResult, 'hash'\>\>Returns { fee }; owned accounts cache paymaster-token quotes for up to 2 minutes and validate the nonce before reuse.
sendTransaction(tx, config?)EvmTransaction | EvmTransaction[] | UserOperationV8, partial fee-mode configPromise\<TransactionResult\>Builds and signs an operation, or broadcasts an already-signed UserOperation.
quoteTransfer(options, config?)EvmTransferOptions, partial fee-mode configPromise\<Omit\<TransferResult, 'hash'\>\>Quotes an ERC-20 transfer.
transfer(options, config?)EvmTransferOptions, partial fee-mode configPromise\<TransferResult\>Sends an ERC-20 transfer as a UserOperation.
getAllowance(token, spender)token: string, spender: stringPromise\<bigint\>Reads ERC-20 allowance.
getUserOperationReceipt(hash)hash: stringPromise\<UserOperationReceipt | null\>Reads the raw bundler receipt.
getTransactionReceipt(hash)hash: stringPromise\<EvmTransactionReceipt | null\>Maps a UserOperation hash to an EVM receipt when included.
toReadOnlyAccount()-Promise\<WalletAccountReadOnlyEvm7702Gasless\>Returns a cached read-only account.
dispose()-voidClears quote cache and disposes the wrapped EVM account.

Quote and Send Behavior

  • Sponsored mode returns fee: 0n from quote methods.
  • Paymaster-token mode returns fees in the configured paymaster token's base units.
  • signTransaction() returns a signed UserOperationV8 without broadcasting it. The type comes from abstractionkit and is not re-exported from this package's root.
  • Quoting a signed UserOperation avoids paymaster calls. Sponsorship mode returns fee: 0n; paymaster-token mode derives a native-gas ceiling in wei from its existing gas fields rather than returning the token amount established by the paymaster.
  • Sending a signed UserOperation broadcasts its supplied nonce, authorization, gas fields, and signature unchanged, without rebuilding or signing it.
  • Owned account paymaster-token quotes are cached for up to 2 minutes for the same serialized transaction. Before reusing a cached UserOperation, the account reads the current EntryPoint nonce and re-quotes if it has moved.
  • The cache key contains the transaction but not the per-call fee-mode configuration. Use the same fee-mode and paymaster settings for a quote and its matching sendTransaction() or transfer() call.
  • Unsigned transaction inputs are built and signed before submission. A UserOperationV8 input is broadcast with its supplied signature unchanged.
  • If the account is already delegated to delegationAddress, the send path does not include a new EIP-7702 authorization. A send that needs a fresh authorization rebuilds the UserOperation instead of reusing the cached one.

Nonce Lane Behavior

  • The default EntryPoint lane uses key 0. nonceKey takes precedence over parallel, and different keys have no ordering relationship.
  • A string nonceKey is hashed to a deterministic 192-bit key. Numeric keys must be within the uint192 range; use bigint or string form above JavaScript's safe integer range.
  • Let the first delegation reach the chain before using concurrent lanes. Overlapping operations on the same lane can return hashes even when one can never receive a receipt.
  • A fresh parallel lane creates a permanent EntryPoint nonce slot. Reuse a bounded set of named lanes for sustained workloads.
  • The runtime accepts lane fields in per-call overrides for signing, sending, and transfers, but the beta.3 second-argument declarations omit them. Constructor-level lane fields are correctly typed.

Transfer Fee Cap

transfer() checks transferMaxFee only in paymaster-token mode. It throws when the estimated fee is greater than or equal to the configured cap.

USDT Approval Rule

On Ethereum mainnet, approve() checks the USDT allowance rule. If the current allowance is non-zero and the requested amount is non-zero, the method throws before sending. Send an approval with amount 0 first, then send the new non-zero approval.

WalletAccountReadOnlyEvm7702Gasless

Named export for read-only accounts.

import { WalletAccountReadOnlyEvm7702Gasless } from '@tetherto/wdk-wallet-evm-7702-gasless'

Constructor

new WalletAccountReadOnlyEvm7702Gasless(address, config)
ParameterTypeDescription
addressstringEOA address.
configOmit\<Evm7702GaslessWalletConfig, 'transferMaxFee'\>Read-only configuration.

Methods

MethodParametersReturnsNotes
getAddress()-Promise\<string\>Returns the configured address.
getBalance()-Promise\<bigint\>Native token balance in wei.
getTokenBalance(tokenAddress)tokenAddress: stringPromise\<bigint\>ERC-20 balance in base units.
getTokenBalances(tokenAddresses)tokenAddresses: string[]Promise\<Record\<string, bigint\>\>Multiple ERC-20 balances.
getPaymasterTokenBalance()-Promise\<bigint\>Reads the configured paymaster token balance.
quoteSendTransaction(tx, config?)EvmTransaction | EvmTransaction[], partial fee-mode configPromise\<Omit\<TransactionResult, 'hash'\>\>Quotes without signing or sending.
quoteTransfer(options, config?)EvmTransferOptions, partial fee-mode configPromise\<Omit\<TransferResult, 'hash'\>\>Quotes an ERC-20 transfer.
getAllowance(token, spender)token: string, spender: stringPromise\<bigint\>Reads ERC-20 allowance.
getUserOperationReceipt(hash)hash: stringPromise\<UserOperationReceipt | null\>Reads the raw bundler receipt.
getTransactionReceipt(hash)hash: stringPromise\<EvmTransactionReceipt | null\>Returns null until the UserOperation maps to an EVM transaction.
verify(message, signature)message: string, signature: stringPromise\<boolean\>Verifies a plain message signature.
verifyTypedData(typedData, signature)TypedData, signature: stringPromise\<boolean\>Verifies EIP-712 typed data.

Read-only accounts cannot sign, approve, send, or transfer.

ConfigurationError

import { ConfigurationError } from '@tetherto/wdk-wallet-evm-7702-gasless'

ConfigurationError extends Error and is thrown when wallet configuration is invalid.

Known configuration errors include:

  • missing provider;
  • missing bundlerUrl;
  • missing delegationAddress;
  • missing paymasterToken when isSponsored is absent or false;
  • empty provider array;
  • configured paymasterAddress does not match the paymaster returned by the RPC.

Config Types

Evm7702GaslessWalletCommonConfig

FieldTypeRequiredDescription
providerstring | Eip1193Provider | Array\<string | Eip1193Provider\>YesRPC endpoint, EIP-1193 provider, or provider failover list.
retriesnumberNoAdditional retry attempts for provider arrays. Defaults to 3.
bundlerUrlstringYesERC-4337 bundler endpoint.
paymasterUrlstringNoPaymaster endpoint when different from bundlerUrl.
delegationAddressstringYesSmart-account implementation address used for EIP-7702 delegation.
parallelbooleanNoUses a fresh random nonce lane for each sign, send, or transfer operation unless nonceKey is set.
nonceKeynumber | bigint | stringNoUses a reusable explicit uint192 nonce lane; strings are hashed deterministically.

Evm7702GaslessSponsorshipPolicyConfig

FieldTypeRequiredDescription
isSponsoredtrueYesEnables sponsored fee mode.
sponsorshipPolicyIdstringNoPaymaster sponsorship policy ID.

Evm7702GaslessPaymasterTokenConfig

FieldTypeRequiredDescription
isSponsoredfalseNoOmit or set to false for paymaster-token mode.
paymasterAddressstringNoExpected paymaster contract address.
paymasterToken.addressstringYesERC-20 token used for fee payment.
transferMaxFeenumber | bigintNoMaximum fee for transfer() in token base units.

Evm7702GaslessWalletConfig

type Evm7702GaslessWalletConfig =
  Evm7702GaslessWalletCommonConfig &
  (Evm7702GaslessSponsorshipPolicyConfig | Evm7702GaslessPaymasterTokenConfig)

Exported Types

The package also re-exports EVM wallet types from @tetherto/wdk-wallet-evm, including FeeRates, KeyPair, EvmTransaction, TransactionResult, EvmTransferOptions, TransferResult, EvmTransactionReceipt, ApproveOptions, TypedData, TypedDataDomain, and TypedDataField.

Module-specific exported types include UserOperationReceipt, Eip7702AuthorizationOverride, BuildSponsoredUserOperationOverrides, and SponsoredUserOperation. In beta.3, BuildSponsoredUserOperationOverrides adds optional nonce?: bigint for explicitly selecting the EntryPoint nonce in lower-level builder typing; it does not expose the protected builder as a public method.

On this page