Skip to main content

createMeeClient

Creates a client connected to the Modular Execution Environment for gasless, cross-chain execution.
const meeClient = await createMeeClient(options);

Parameters

ParameterTypeRequiredDescription
accountMultichainSmartAccountYesThe multichain account
apiKeystringNoAPI key for sponsorship
urlstringNoCustom MEE node URL

Returns

MeeClient

Example

import { createMeeClient, toMultichainNexusAccount } from "@biconomy/abstractjs";

const account = await toMultichainNexusAccount({ /* ... */ });
const meeClient = await createMeeClient({ account });

// With API key for sponsorship
const meeClient = await createMeeClient({ 
  account,
  apiKey: "your-api-key"
});

MeeClient Methods

getQuote

Get a quote for executing instructions. Returns cost estimates and payloads to sign.
const quote = await meeClient.getQuote(options);

Parameters

ParameterTypeRequiredDescription
instructionsInstruction[]YesArray of instructions
feeTokenFeeTokenInfoYes*Token to pay gas with
sponsorshipbooleanNoEnable gas sponsorship
delegatebooleanNoEnable EIP-7702 mode
authorizationAuthorizationNoEIP-7702 authorization
lowerBoundTimestampnumberNoEarliest execution time
upperBoundTimestampnumberNoLatest execution time
cleanUpsCleanUp[]NoCleanup instructions
*Not required if sponsorship: true

Returns

type Quote = {
  hash: Hex;
  paymentInfo: {
    tokenAmount: string;
    tokenAddress: Address;
    chainId: number;
  };
  userOps: UserOp[];
  // ... signing payloads
};

Example

const quote = await meeClient.getQuote({
  instructions: [instruction1, instruction2],
  feeToken: {
    address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    chainId: 8453
  }
});

console.log("Fee:", quote.paymentInfo.tokenAmount);

getFusionQuote

Get a quote for Fusion mode (external wallets like MetaMask).
const fusionQuote = await meeClient.getFusionQuote(options);

Parameters

ParameterTypeRequiredDescription
triggerTriggerYesToken pull trigger
instructionsInstruction[]YesArray of instructions
feeTokenFeeTokenInfoYes*Token to pay gas with
sponsorshipbooleanNoEnable gas sponsorship
cleanUpsCleanUp[]NoCleanup instructions
upperBoundTimestampnumberNoLatest execution time
simulationSimulationOptionsNoSimulation config

Example

const fusionQuote = await meeClient.getFusionQuote({
  trigger: {
    chainId: 8453,
    tokenAddress: USDC,
    amount: parseUnits("100", 6)
  },
  instructions: [swap, deposit],
  feeToken: { address: USDC, chainId: 8453 }
});

executeQuote

Execute a quote by signing and submitting it.
const { hash } = await meeClient.executeQuote({ quote });

Parameters

ParameterTypeRequiredDescription
quoteQuoteYesQuote from getQuote

Returns

{ hash: Hex }

executeFusionQuote

Execute a Fusion quote.
const { hash } = await meeClient.executeFusionQuote({ fusionQuote });

Parameters

ParameterTypeRequiredDescription
fusionQuoteFusionQuoteYesQuote from getFusionQuote

waitForSupertransactionReceipt

Wait for a supertransaction to complete.
const receipt = await meeClient.waitForSupertransactionReceipt(options);

Parameters

ParameterTypeRequiredDescription
hashHexYesSupertransaction hash
mode"default" | "fast-block"NoConfirmation mode
confirmationsnumberNoConfirmations to wait for

Returns

type Receipt = {
  transactionStatus: "PENDING" | "MINED_SUCCESS" | "MINED_FAILED" | "EXPIRED";
  userOps: UserOpReceipt[];
  explorerLinks: string[];
};

Example

const { hash } = await meeClient.executeQuote({ quote });

const receipt = await meeClient.waitForSupertransactionReceipt({ 
  hash,
  mode: "default"
});

if (receipt.transactionStatus === "MINED_SUCCESS") {
  console.log("Success!");
}

getSupertransactionReceipt

Get current status without waiting.
const receipt = await meeClient.getSupertransactionReceipt(options);

Parameters

ParameterTypeRequiredDescription
hashHexYesSupertransaction hash
waitForReceiptsbooleanNoWait for on-chain receipts
mode"default" | "fast-block"NoConfirmation mode

Example

// Poll for status
const receipt = await meeClient.getSupertransactionReceipt({ hash });

if (receipt.transactionStatus === "PENDING") {
  console.log("Still processing...");
}

Cleanup Instructions

Return leftover tokens after execution.
const quote = await meeClient.getQuote({
  instructions: [...],
  feeToken: {...},
  cleanUps: [
    {
      chainId: 8453,
      tokenAddress: USDC,
      recipientAddress: userEOA,
      dependsOn: [userOp(2)]  // Optional: wait for specific instruction
    }
  ]
});

CleanUp Parameters

ParameterTypeRequiredDescription
chainIdnumberYesChain to cleanup on
tokenAddressAddressYesToken to return
recipientAddressAddressYesWhere to send tokens
dependsOnUserOpRef[]NoInstructions to wait for
amountbigintNoSpecific amount (default: full balance)