One of the most requested features by the projects we talk to at LI.FI is cross-chain contract calls, to execute another transaction after bridging the tokens. We believe it’s a game changer as it allows much more composability across chains. So, now, FINALLY! It’s here! The cross-chain contract calls, and we’re calling them xChain Contract Calls!

What are cross-chain contract calls?

One of the limitations of a multi-chain future is the siloed nature of blockchains and transactions. LI.FI can batch as many transactions as a block allows inside a particular chain, but it wasn’t possible to batch transactions across two different blockchains until now.

To be honest, we’ve been batching cross-chain transactions since Feb this year, but to only a limited capacity. We had this exclusive feature at LI.FI called “destination swaps.” First to the market.

In a normal any-to-any cross-chain swap, to swap AAVE on Polygon to OP on Optimism, we have to swap AAVE to USDC on Polygon, bridge USDC across to Optimism, and swap USDC to OP on Optimism.

In a normal any2any cross-chain swap, converting AAVE on Polygon to OP on Optimism requires the following steps:

  1. Swap AAVE to USDC on Polygon
  2. Bridge USDC to Optimism
  3. Swap USDC for OP

You can’t sign the DEX swap transaction on Optimism from Polygon, so you usually had to switch the RPC and sign another transaction. But with LI.FI, you could do all three things in a single transaction on Polygon!

How? We achieved this by passing the destination swap contract call data through a bridge to execute the final swap for the user, and then sending the swapped tokens to the user. Initially, we achieved this through Connext. Now Stargate also supports the destination swap feature, with many more bridges coming soon.

Introducing LI.FI xChain Contract Calls

We’ve extended that destination swap feature to support contract calls of any kind to be passed through bridges to be executed on the destination chain. It’s now possible to perform any action on the destination chain after bridging, along with swapping.

How does it work?

When you request a route from LI.FI SDK for a cross-chain swap, you can pass the contract call data through the SDK as an extra parameter. If this data is passed, only the bridges that support cross-chain contract calls will be used for bridging. The bridges that support this right now include:

  1. Connext - In prod
  2. Stargate - In prod
  3. Multichain - Soon
  4. deBridge - Yet to integrate
  5. cBridge - Yet to integrate