WDK logoWDK documentation

Lending Morpho EVM Configuration

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

Community modules are developed and maintained independently by third-party contributors.

Tether and the WDK Team do not endorse or assume responsibility for their code, security, or maintenance. Use your own judgment and proceed at your own risk.

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: 'xaut'
  }
})

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 USD₮ earn and borrow flows.

The package exports frozen preset maps. Use them as the complete registry for the installed package rather than copying a static list into your integration:

Inspect the installed preset registry
import {
  MORPHO_MARKET_PRESETS,
  MORPHO_VAULT_PRESETS
} from '@morpho-org/wdk-protocol-lending-morpho-evm'

console.log(Object.keys(MORPHO_VAULT_PRESETS))
console.log(Object.keys(MORPHO_MARKET_PRESETS))

Selected Tether-family presets from version 1.0.5 are shown below. See the package's released preset source for the pinned registry.

Use built-in presets
const morpho = new MorphoProtocolEvm(account, {
  presets: {
    earn: 'sky-money-usdt-savings',
    borrow: 'xaut'
  }
})
OperationPresetChain IDTarget IDTarget
Earnsky-money-usdt-savings10x23f5E9c35820f4baB695Ac1F19c203cC3f8e1e11sky.money USD₮ Savings
Borrowxaut10xb7843fe78e7e7fd3106a1b939645367967d1f986c2e45edb8932ad1896450877XAU₮ collateral, 77% LLTV

Explicit Targets

Use explicit targets when you want to configure a vault address or market directly instead of selecting it by preset name.

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