WDK logoWDK documentation

Lending Morpho EVM Configuration

Configuration options and settings for @morpho-org/wdk-protocol-lending-morpho-evm

Configuration

Installation

Install the Morpho lending module with the EVM wallet module used by the examples and the viem peer dependency:

Install with npm
npm install @morpho-org/wdk-protocol-lending-morpho-evm @tetherto/wdk-wallet-evm viem
Install with pnpm
pnpm add @morpho-org/wdk-protocol-lending-morpho-evm @tetherto/wdk-wallet-evm viem

The package declares Node.js 22.13 or later in its published engine metadata. If you use ERC-4337 smart accounts, also install @tetherto/wdk-wallet-evm-erc-4337.

Service Setup

Create a WDK-compatible EVM wallet account, then pass it to MorphoProtocolEvm with either presets or explicit Morpho targets.

Create MorphoProtocolEvm with presets
import MorphoProtocolEvm from '@morpho-org/wdk-protocol-lending-morpho-evm'
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'

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

const morpho = new MorphoProtocolEvm(account, {
  presets: {
    earn: 'sky-money-usdt-savings',
    borrow: 'wsteth'
  }
})

Constructor

new MorphoProtocolEvm(account, options)

Parameters:

  • account: WalletAccountEvm, WalletAccountReadOnlyEvm, WalletAccountEvmErc4337, or WalletAccountReadOnlyEvmErc4337
  • options: Morpho target configuration

The wallet account must include a provider. Read-only accounts can read positions and quote transactions; mutating methods require a writable account.

Presets

Built-in presets target Ethereum mainnet USDT earn and borrow flows.

Use built-in presets
const morpho = new MorphoProtocolEvm(account, {
  presets: {
    earn: 'steakhouse-prime-instant',
    borrow: 'wbtc'
  }
})

Borrow presets:

PresetChain IDMarket IDCollateralLLTV
susds10x3274643db77a064abd3bc851de77556a4ad2e2f502f4f0c80845fa8f909ecf0bsUSDS96.5%
wsteth10xe7e9694b754c4d4f7e21faf7223f6fa71abaeb10296a4c43a54a7977149687d2wstETH86%
wbtc10xa921ef34e2fc7a27ccc50ae7e4b154e16c9799d3387076c421423ef52ac4df99WBTC86%
xaut10xb7843fe78e7e7fd3106a1b939645367967d1f986c2e45edb8932ad1896450877XAUt77%

Earn presets:

PresetChain IDVault AddressVault
sky-money-usdt-savings10x23f5E9c35820f4baB695Ac1F19c203cC3f8e1e11sky.money USDT Savings V2
steakhouse-prime-instant10xbeef003C68896c7D2c3c60d363e8d71a49Ab2bf9Steakhouse Prime Instant V2

Explicit Targets

Use explicit targets when you need a vault or market outside the built-in presets.

Use explicit Morpho targets
const morpho = new MorphoProtocolEvm(account, {
  chainId: 1,
  earnVaultAddress: '0x23f5E9c35820f4baB695Ac1F19c203cC3f8e1e11',
  borrowMarketId: '0xe7e9694b754c4d4f7e21faf7223f6fa71abaeb10296a4c43a54a7977149687d2'
})

When you use earnVaultAddress, borrowMarketParams, or borrowMarketId directly, pass chainId. The adapter uses it to guard transaction building if a browser wallet switches chains.

Use borrowMarketParams when you already know the full Morpho Blue market configuration:

Use explicit Morpho Blue market params
const morpho = new MorphoProtocolEvm(account, {
  chainId: 1,
  borrowMarketParams: {
    loanToken: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
    collateralToken: 'COLLATERAL_TOKEN_ADDRESS',
    oracle: 'ORACLE_ADDRESS',
    irm: 'INTEREST_RATE_MODEL_ADDRESS',
    lltv: 860000000000000000n
  }
})

InputMarketParams contains loanToken, collateralToken, oracle, irm, and lltv. Confirm explicit market params against Morpho market data before using them in production.

Options

OptionTypeDescription
chainIdnumber | bigintRequired with explicit Morpho targets
earnVaultAddressstringExplicit Morpho Vault V2 address
borrowMarketParamsInputMarketParamsExplicit Morpho Blue market params
borrowMarketIdstringMarket id used to fetch market params on-chain
presets{ earn?: string, borrow?: string }Built-in earn and borrow target names
slippageTolerancebigintMorpho SDK slippage tolerance in WAD precision
supportSignaturebooleanEnables Morpho SDK permit or Permit2 requirements
supportDeploylessbooleanEnables Morpho SDK deployless reads
metadataMetadataOptional Morpho SDK metadata passed to action encoders

Native Amounts

For vault deposits and collateral supply, pass either amount, nativeAmount, or both. nativeAmount follows Morpho SDK semantics and is only valid when the configured vault asset or collateral token is the wrapped native token for the chain.

Supply with native amount
await morpho.supply({
  token: 'WRAPPED_NATIVE_TOKEN_ADDRESS',
  nativeAmount: 1000000000000000n
})

ERC-4337 Config Overrides

When using WalletAccountEvmErc4337, mutating methods and quote helpers accept an optional second config argument for the wallet module's per-call gas payment settings.

Supply with an ERC-4337 config override
await morpho.supply(
  {
    token: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
    amount: 1000000n
  },
  {
    paymasterToken: {
      address: '0xdAC17F958D2ee523a2206206994597C13D831ec7'
    }
  }
)

See the @tetherto/wdk-wallet-evm-erc-4337 configuration docs for paymaster token, sponsorship policy, and native coin override fields.


Need Help?

On this page