WDK logoWDK documentation

Lending Aave EVM Configuration

Configuration options and settings for @tetherto/wdk-protocol-lending-aave-evm

Configuration

Service Setup

import AaveProtocolEvm from '@tetherto/wdk-protocol-lending-aave-evm'
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'

// Create wallet account first
const account = new WalletAccountEvm(seedPhrase, "0'/0/0", {
  provider: 'https://ethereum-rpc.publicnode.com'
})

// Create lending service
const aave = new AaveProtocolEvm(account)

Account Configuration

The constructor accepts IWalletAccount or IWalletAccountReadOnly. The implementation reads account._config.provider and expects an EVM-compatible JSON-RPC URL or EIP-1193 provider. Compatible account wrappers must expose this configuration plus the methods required by the chosen operation. Every write checks for a callable sendTransaction(); quotes call quoteSendTransaction() without requiring write capability. The wider interfaces do not add support for non-EVM chains.

For accounts governed by WDK transaction policies, use wdk.registerProtocol() and the account's protocol getter. Do not pass the governed account proxy directly to this constructor: that proxy hides _config.

import { WalletAccountEvm, WalletAccountReadOnlyEvm } from '@tetherto/wdk-wallet-evm'

// Full access account
const account = new WalletAccountEvm(seedPhrase, "0'/0/0", {
  provider: 'https://ethereum-rpc.publicnode.com'
})

// Read-only account (quotes, reads)
const readOnly = new WalletAccountReadOnlyEvm(await account.getAddress(), {
  provider: 'https://ethereum-rpc.publicnode.com'
})

const aave = new AaveProtocolEvm(account)

ERC‑4337 (Account Abstraction)

Every mutating method and quote helper forwards its optional config argument to the account. The declared gas-payment families match @tetherto/wdk-wallet-evm-erc-4337: paymaster token, sponsorship policy, or native coins. Standard WDK EVM accounts ignore these wallet fields. Fees keep the account's denomination; a token-paymaster quote is not a native-wei quote.

Use the fields that match the gas-payment mode you want for that call. For the full field-level definitions, see the @tetherto/wdk-wallet-evm-erc-4337 configuration docs and Config Override reference.

import { WalletAccountEvmErc4337 } from '@tetherto/wdk-wallet-evm-erc-4337'

const aa = new WalletAccountEvmErc4337(seedPhrase, "0'/0/0", {
  chainId: 1,
  provider: 'https://ethereum-rpc.publicnode.com',
  bundlerUrl: 'YOUR_BUNDLER_URL',
  paymasterUrl: 'YOUR_PAYMASTER_URL',
  paymasterAddress: process.env.PAYMASTER_ADDRESS,
  safeModulesVersion: '0.3.0'
})

const aaveAA = new AaveProtocolEvm(aa)

const result = await aaveAA.supply({ token: '0xdAC17F958D2ee523a2206206994597C13D831ec7', amount: 1000000n }, {
  paymasterToken: {
    address: '0xdAC17F958D2ee523a2206206994597C13D831ec7'
  }
})

safeModulesVersion is required when initializing the smart account. In paymaster-token mode, paymasterAddress identifies the paymaster contract that charges the selected token; set PAYMASTER_ADDRESS to the address for the paymaster service and chain you configure. Do not reuse an address from a different provider or chain.

Supported Override Families

  • Paymaster token mode: paymasterUrl, paymasterAddress, paymasterToken, transferMaxFee
  • Sponsorship policy mode: isSponsored, paymasterUrl, sponsorshipPolicyId
  • Native coin mode: useNativeCoins, transferMaxFee

Network Support

Aave V3 spans multiple EVM chains, including Ethereum, Arbitrum, Optimism, Polygon, Avalanche, BNB, Celo, Gnosis, Linea, Scroll, Soneium, Sonic, ZkSync, and Metis. Ensure the correct RPC and token addresses for the target chain.

// Ethereum Mainnet
const eth = new WalletAccountEvm(seedPhrase, "0'/0/0", {
  provider: 'https://ethereum-rpc.publicnode.com'
})

// Arbitrum
const arb = new WalletAccountEvm(seedPhrase, "0'/0/0", {
  provider: 'https://arb1.arbitrum.io/rpc'
})

Operation Options

Each operation accepts an options object. Before supplying or repaying, confirm the account's token allowance to the Aave Pool for the selected network and send any required approval separately. The lending module does not add approval or allowance-reset transactions. To change an existing nonzero Ethereum USD₮ allowance to another nonzero amount, first approve zero and wait for confirmation, then approve the new amount and wait again. These examples use 1 USD₮ on Ethereum (6 decimals):

const USDT = '0xdAC17F958D2ee523a2206206994597C13D831ec7' // USDt on Ethereum

// Supply
await aave.supply({ token: USDT, amount: 1000000n })

// Withdraw
await aave.withdraw({ token: USDT, amount: 1000000n })

// Borrow
await aave.borrow({ token: USDT, amount: 1000000n })

// Repay
await aave.repay({ token: USDT, amount: 1000000n })

Common Parameters

  • token (string): ERC‑20 token address
  • amount (number | bigint): token amount in base units
  • onBehalfOf (string, optional): another address to act for (supply/borrow/repay)
  • to (string, optional): destination address (withdraw)

Note: amount must be > 0. Addresses must be valid/non‑zero. A provider is required for any write.


Need Help?

On this page