Skip to content

getFusionQuote

Gets a fusion quote that enables EOA (Externally Owned Account) holders to execute cross-chain transactions based on token triggers. This method is specifically designed to support EOA users who want to perform conditional cross-chain operations without needing to first upgrade to a smart account. The fusion quote includes both the trigger conditions and the instructions to be executed when those conditions are met.

Usage

import { createMeeClient } from "@biconomy/abstractjs";
import { mcUSDC } from "@biconomy/abstractjs";
import { optimism, base } from "viem/chains";
 
const meeClient = createMeeClient({ account: mcNexus });
 
const fusionQuote = await meeClient.getFusionQuote({
  trigger: {
    chainId: optimism.id,
    tokenAddress: mcUSDC.addressOn(optimism.id),
    amount: parseUnits("0.1", 6)
  },
  instructions: [
    mcNexus.build({ ... }),
    mcNexus.build({ ... })
  ],
  feeToken: {
    address: mcUSDC.addressOn(optimism.id),
    chainId: optimism.id
  }
});

Parameters

ParameterTypeRequiredDescription
triggerTriggerYesThe condition that must be met for the transaction to execute
instructionsInstructionLike[]YesArray of instructions to be executed
feeTokenFeeTokenInfoYesToken to be used for paying transaction fees
accountMultichainSmartAccountNoOptional smart account to execute the transaction
pathstringNoPath to the quote endpoint. Defaults to "v1/fusion/quote"

Trigger Object

PropertyTypeRequiredDescription
chainIdnumberYesChain ID where the trigger condition will be monitored
tokenAddressAddressYesAddress of the token to monitor
amountbigintYesAmount of tokens required to trigger the transaction

FeeTokenInfo Object

PropertyTypeRequiredDescription
addressAddressYesAddress of the fee token
chainIdnumberYesChain ID where the fee token is deployed

Response

PropertyTypeDescription
hashHexHash of the fusion transaction
nodeAddressAddress of the MEE node
commitmentHexCommitment hash for the fusion quote
paymentInfoFilledPaymentInfoComplete payment information with token amounts
userOpsMeeFilledUserOpDetails[]Array of user operations with their details
triggerTriggerThe trigger condition for the fusion quote

Example

import { parseUnits } from "viem";
import { optimism, base } from "viem/chains";
import { aave, mcUSDC, mcAaveV3Pool } from "@biconomy/abstractjs";
 
const amountToSupply = parseUnits("0.1", 6);
 
// Example of using getFusionQuote with AAVE protocol
const fusionQuote = await meeClient.getFusionQuote({
  trigger: {
    chainId: optimism.id,
    tokenAddress: mcUSDC.addressOn(optimism.id),
    amount: amountToSupply
  },
  instructions: [
    mcNexus.build({
      type: "intent",
      data: {
        amount: amountToSupply,
        mcToken: mcUSDC,
        toChain: base
      }
    }),
    mcNexus.build({
      type: "approve",
      data: {
        chainId: base.id,
        tokenAddress: mcUSDC.addressOn(base.id),
        amount: amountToSupply,
        spender: aave.pool.addressOn(base.id)
      }
    }),
    mcAaveV3Pool.build({
      type: "supply",
      data: {
        chainId: base.id,
        args: [
          mcUSDC.addressOn(base.id),
          amountToSupply,  // 100 USDC
          mcNexus.addressOn(base.id, true),
          0
        ]
      }
    })
  ],
  feeToken: {
    address: mcUSDC.addressOn(optimism.id),
    chainId: optimism.id
  },
});
 
// Execute the fusion quote
const { hash } = await meeClient.executeFusionQuote({ fusionQuote });
 
// Wait for the transaction receipt
const receipt = await meeClient.waitForSupertransactionReceipt({ hash });

Error Handling

The method will throw an error if:

  • The account is not deployed on required chains
  • The fee token is not supported
  • The chain(s) are not supported by the node
  • The trigger conditions are invalid
  • The API request fails