Destination

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) => void

Updates the destination token, chainId and amount if provided

updateDestinationWalletAddress

(address: string) => void

Updates the destination wallet address

updateDestinationChainId

(chainId: number) => void

Updates the chain ID for the destination

updateDestinationContract

(contract: FKConfig["destination"]["contract"]) => void

Updates the contract information of the destination

updateRequestedAmount

number | undefined

Updates the requested amount for the transaction

updateRequestedAmountInUSD

number | undefined

Updates 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 aarcModal = new AarcFundKitModal(config)
aarcModal.init()

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",
      requestedAmount: 1,
      tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
      contract: {
        contractAddress: "YOUR Contract Address",
        contractName: "Aave",
        contractPayload: "YOUR_CONTRACT_PAYLOAD",
        contractGasLimit: "2000000",
      }, // Use this when want to call a contract on destiantion chain
    },
    // remaining config... 
  }

Last updated