SDK
Getting Started

Getting Started

Installation

To install and save in your package.json dependencies, run the command below using a package manager:

Usage

import { Matrix } from '@morphous/trinity'
 
const calldata = Matrix.deposit(
  morphoMarketAddress,
  txDeadline,
  fromWallet,
  marketAddress,
  token,
  userAddress,
  smartWalletAddress,
  value,
)

Return value

{
  to: string
  data: BytesLike
  etherValue?: BigNumber
}

Execute

import { dsProxyABI, Matrix } from '@morphous/trinity'
import { prepareWriteContract, writeContract } from '@wagmi/core'
 
const calldata = Matrix.deposit(
  morphoMarketAddress,
  txDeadline,
  fromWallet,
  marketAddress,
  token,
  userAddress,
  smartWalletAddress,
  value,
)
 
const config = await prepareWriteContract({
  address: smartWalletAddress,
  abi: dsProxyABI,
  functionName: 'execute',
  args: [calldata.to, calldata.data],
  overrides: {
    value: calldata.etherValue,
  },
})
const data = await writeContract(config)

Return value

{
  hash: `0x${string}`,
  wait: (confirmations?: number) => Promise<TransactionReceipt>,
}
Last updated on December 26, 2022