WDK logoWDK documentation

Get Started

Install @tetherto/wdk-wallet-evm-7702-gasless and create an EIP-7702 gasless account.

This guide shows how to install the module, create a sponsored EIP-7702 gasless wallet, and get the account address.

Install

npm install @tetherto/wdk-wallet-evm-7702-gasless

Create a Sponsored Wallet

Replace '<VERIFIED_DELEGATION_ADDRESS>' with a smart-account implementation address that you have verified for the target chain. The EOA delegates execution to this address.

Create a sponsored EIP-7702 gasless wallet
import WalletManagerEvm7702Gasless from '@tetherto/wdk-wallet-evm-7702-gasless'

const wallet = new WalletManagerEvm7702Gasless(seedPhrase, {
  provider: 'https://rpc.mevblocker.io/fast',
  delegationAddress: '<VERIFIED_DELEGATION_ADDRESS>',
  bundlerUrl: 'https://api.pimlico.io/v2/1/rpc?apikey=YOUR_KEY',
  isSponsored: true,
  sponsorshipPolicyId: 'sp_my_policy'
})

const account = await wallet.getAccount(0)
const address = await account.getAddress()

console.log('EOA address:', address)

getAddress() returns the EOA address. The module signs EIP-7702 authorization only when the account is not already delegated to the configured delegationAddress.

Use Paymaster-token Mode

If the user pays gas with an ERC-20 paymaster token, configure paymasterToken instead of isSponsored: true.

Create a paymaster-token wallet
const wallet = new WalletManagerEvm7702Gasless(seedPhrase, {
  provider: 'https://rpc.mevblocker.io/fast',
  delegationAddress: '<VERIFIED_DELEGATION_ADDRESS>',
  bundlerUrl: 'https://api.pimlico.io/v2/1/rpc?apikey=YOUR_KEY',
  paymasterToken: {
    address: '0xdAC17F958D2ee523a2206206994597C13D831ec7'
  },
  transferMaxFee: 100000n // 0.1 USDT when the token has 6 decimals
})

Clean Up

Call dispose() when the account or wallet manager is no longer needed.

Dispose account state
account.dispose()
wallet.dispose()

Next Steps

On this page