Quick Start

This section provides a quick start guide for common use cases, including checking allowances, setting up wallet clients, providing approvals, signing permits, and creating positions.

  1. Check Token Allowance

const tokenAllowance = await DZapDcaClient.getAllowance({
   account: /* Your account address */,
   chainId: 42161, // arbitrum
   fromToken: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", // USDC
});
  1. Set Up Wallet Client

Use walletClient as per the viem library's requirements.

import { createWalletClient, custom } from 'viem';
import { arbitrum } from 'viem/chains';

const client = createWalletClient({
   chain: arbitrum,
   transport: custom(window.ethereum),
});
  1. Provide Approval

const approvalResponse = await DZapDcaClient.approve({
   account: /* Your account address */,
   chainId: 42161,
   fromToken: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
   walletClient: client,
   amount: maxUint256, // Defaults to max amount
});
  1. Sign Permit

  1. Create a Position

Last updated