Set destination details like the desired token and chain for your walletAddress. Additionally, configure contract details for cross-chain calls.

Here are the methods and attributes to configure destination details using the client object from AarcFundKitModal Class.

You can also configure destination details in config object

NameTypeDescription
updateDestinationToken(address?: string, chainId?: number, amount?: number) => voidUpdates the destination token, chainId and amount if provided
updateDestinationWalletAddress(address: string) => voidUpdates the destination wallet address
updateDestinationChainId(chainId: number) => voidUpdates the chain ID for the destination
updateDestinationContract(contract: FKConfig[“destination”][“contract”]) => voidUpdates the contract information of the destination
updateRequestedAmountnumber | undefinedUpdates the requested amount for the transaction
updateRequestedAmountInUSDnumber | undefinedUpdates the requested amount in USD

Example (Using AarcFundKitModal Functions)

import React from 'react';
import {
    AarcFundKitModal,
    FKConfig
} from "@aarc-xyz/fundkit-web-sdk"

const config: FKConfig = {
    appName: "Dapp Name",
    // remaining config...
}

const aarcModalRef = new AarcFundKitModal(config)
const aarcModal = aarcModalRef.current;

export default function Home() {

  const updateDestination = async () => {
    aarcModal.updateDestinationToken(
      "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
      42161,
      10
    )
    
    aarcModal.updateDestinationWalletAddress("3o2Xo9TTVwTfB4pd88zk9VeWHd416nqR8jxxeC9cxmiE")
  };

  return (
    <button onClick={updateDestination}>
      Update Destination
    </button>
  );
}

Example (Using config)

  const config: FKConfig = {
    appName: "Aarc",
    // remaining config...
    destination: {
      chainId: polygon.id,
      walletAddress: "0xeDa8Dec60B6C2055B61939dDA41E9173Bab372b2", //wallet address of the destination
      requestedAmount: 1,
      tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", //token to be transferred. If undefined, the user will be prompted to select a token
      contract: { //contract to be interacted with. If undefined, the transaction will be a simple transfer
        contractAddress: "YOUR_CONTRACT_ADDRESS",
        contractName: "Aave",
        contractPayload: "YOUR_CONTRACT_PAYLOAD",
        contractGasLimit: "2000000",
      }, // Use this when want to call a contract on destination chain
    },
    // remaining config... 
  }