Skip to content

mantle-xyz/mantle-viem

Repository files navigation


Mantle Viem

Viem Extension for Mantle Chain


Features

  • Simplifies cross L1 & L2 interactions
  • Seamless extension to Viem
  • TypeScript ready
  • Test suite running against forked Ethereum network

Overview

// import modules
import { walletActionsL1 } from '@mantleio/viem'
import { mantle } from '@mantleio/viem/chains'
import { createWalletClient, custom } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { mainnet } from 'viem/chains'

// create wallet clients
export const walletClientL1 = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum),
}).extend(walletActionsL1())

// perform an action
const hash = await walletClientL1.depositMNT({
  account,
  request: {
    amount: parseEther('1'),
  },
  targetChain: mantle,
})

Contributing

If you're interested in contributing, please read the contributing docs before submitting a pull request.

License

MIT License