Client
To use the Mantle functionality of Viem, you must extend your existing (or new) Viem Client with Mantle Actions.
Usage
Layer 1 Extensions
import { walletActionsL1 } from '@mantleio/viem'
import { createPublicClient, createWalletClient, http } from 'viem'
import { mainnet } from 'viem/chains'
const walletClient = createWalletClient({
chain: mainnet,
transport: http(),
}).extend(walletActionsL1())
const hash = await walletClient.depositMNT({/* ... */})
Layer 2 Extensions
import { publicActionsL2 } from '@mantleio/viem'
import { mantle } from '@mantleio/viem/chains'
import { createPublicClient, http } from 'viem'
const publicClient = createPublicClient({
chain: mantle,
transport: http(),
}).extend(publicActionsL2())
const args = await publicClient.buildProveWithdrawal({/* ... */})
Extensions
walletActionsL1
A suite of Wallet Actions for suited for development with Layer 1 chains that interact with Layer 2 (Mantle) chain.
import { walletActionsL1 } from '@mantleio/viem'
publicActionsL1
A suite of Public Actions suited for development with Layer 1 chains. These actions provide functionalities specific to public clients operating at the Layer 1 level, enabling them to interact seamlessly with Mantle.
import { publicActionsL1 } from '@mantleio/viem'
walletActionsL2
A suite of Wallet Actions suited for development with Layer 2 (Mantle) chain. These actions are tailored for wallets operating on Layer 2, providing advanced features and integrations necessary for Layer 2 financial operations.
import { walletActionsL2 } from '@mantleio/viem'
publicActionsL2
A suite of Public Actions for suited for development with Layer 2 (Mantle) chain.
import { publicActionsL2 } from '@mantleio/viem'