Cross-Chain Contract Calls

Cross-Chain Contract Calls: This feature enables contract calls across chains, buy NFTs, stake or donate without needing gas on the destination chain!

Destination calls are currently supported on Polygon, Binance, Optimism, Ethereum, Fantom, Avalanche, Arbitrum, Base, Gnosis, and Linea.

To read more about what xChain Contract calls are and how they work, please click here.

With this feature, you can make arbitrary contract calls across blockchains. All you need to do is prepare the callData for the contract call you want to make on the destination chain (e.g. stake KLIMA in the example below). Pass that callData along with information about where you want to pay for it to the endpoint. The response contains information on how many tokens must be submitted to pay for all transfer and swap fees.


About the contract call:

ParameterExplainationExample Data



The chain the contract is deployed on. Can be the chain id or chain key.

137 or POL



The token required to perform the contract interaction (can be something to stake, donate or to be used as payment).




The amount of token required by the contract interaction. The LI.FI API will try and generate a quote that guarantees at least that amount on the destination chain.


toFallbackAddress (optional)

If the call fails, use this address to send the bridged tokens to. If none is specified, the sending address will be used.


contractOutputsToken (optional)

Some contract interactions will output a token (e.g. staking), specify the token address to forward the token to the user. Omit this parameter if no token should be returned to the user.


contractCalls (required)

Array of Contract call data objects.

Contract call data:

ParameterExplainationExample Data

fromAmount (required)

The amount that will feed into this contract call. This is not dependent on how much was bridged or deposited before - it's the expected amount of token available on order to execute the call.


fromTokenAddress (required)

The token that will feed into this contract call. E.g. a ETH staking transaction would expect to have ETH available.


toContractAddress (required)

The address of the contract to interact with.


toContractCallData (required)

The callData to be sent to the contract for the interaction on the destination chain.


toContractGasLimit (required)

The estimated gas used by the destination call. If this value is incorrect, the interaction may fail -- choose this carefully!


toApprovalAddress (optional)

If the approval address is different thant the contract to call, specify that address here.


toTokenAddress (optional)

If the contract outputs a token, specify its address here. (E.g. staking ETH produces stETH)


How does the user want to pay:

ParameterExplainationExample Data



The sending chain. Can be the chain id or chain key.

56 orBSC

fromToken (required)

The token that the user pays with. Can be the address or the symbol.


fromAddress (required)

The wallet that will send the transaction and contains the starting token.


Additional options:

ParameterExplainationExample Data

slippage (optional)

The maximum allowed slippage for the transaction as a decimal value. 0.05 represents 5%.


integrator (optional)

A string containing tracking information about the integrator of the API.


referrer (optional)

A string containing tracking information about the referrer of the integrator.




The percent of the integrator's fee that is taken from every transaction


allowDestinationCall (optional)

Whether swaps or other contract calls should be allowed as part of the destination transaction of a bridge transfer.


allowBridges (optional)

List of bridges that are allowed for this transaction.


denyBridges (optional)

List of bridges that are not allowed for this transaction.


preferBridges (optional)

List of bridges that should be preferred for this transaction.


allowExchanges (optional)

List of exchanges that are allowed for this transaction.

[0x, dodo]

denyExchanges (optional)

List of exchanges that are not allowed for this transaction.


preferExchanges (optional)

List of exchanges that should be preferred for this transaction.


Example: stake KLIMA on Polygon

The example below demonstrates how to stake KLIMA token (KlimaDAO) into sKLIMA (staked KLIMA). The process involves

  • sending some DAI token from Binance Smart Chain (BSC) to Polygon (POL)

  • swapping DAI for KLIMA

  • performing a contract call to the KLIMA staking contract.

The callData will be executed by our executer contract, not by the users wallet, so ensure that the contract does not expect the user to be msg.sender. The staked tokens are sent to the executor which will then forward them to the user if the contractOutputsToken parameter is set.

In the end, the contract will produce the staked KLIMA token sKLIMA which will then be transferred back to the user.

import axios from 'axios';
import { ethers } from 'ethers';

const endpoint = '';

const USDC_ON_ARB = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
const KLIMA_ON_POL = '0x4e78011ce80ee02d2c3e649fb657e45898257815';
const SKLIMA_ON_POL = '0xb0c22d8d350c67420f06f48936654f567c73e8c8';

const KLIMA_STAKING_CONTRACT = '0x4D70a031Fc76DA6a9bC0C922101A05FA95c3A227';

// Full ABI on 
const KLIMA_STAKING_ABI = ['function stake(uint _amount) external'];
const generateKLIMATransaction = async (receivedAmount: string) => {
    const stakeKlimaTx = await new ethers.Contract(
    return stakeKlimaTx;

const getQuote = async (): Promise<any> => {
    // We would like to stake this amount of KLIMA to get sKLIMA
    const stakeAmount = '1000000000';

    const stakeKlimaTx = await generateKLIMATransaction(stakeAmount);

    const quoteRequest = {
        fromChain: 'ARB',
        fromToken: USDC_ON_ARB,
        fromAddress: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',
        toChain: 'POL',
        toToken: KLIMA_ON_POL,
        toAmount: stakeAmount,
        contractCalls: [{
            fromTokenAddress: '0x4e78011Ce80ee02d2c3e649Fb657E45898257815', // KLIMA on POL
            fromAmount: stakeAmount,
            toContractGasLimit: '900000',
            contractOutputsToken: SKLIMA_ON_POL,
    const response = await, quoteRequest);


Once the quote is generated, you can execute it like any other quote as explained here.

Here you can find links to the sending and receiving transactions for the transfer from DAI on BNB Smart Chain to sKLIMA on Polygon via the custom contract call.



Last updated