Function getFusionQuote

  • Gets a quote using either permit or standard on-chain transaction based on token capabilities. This function automatically determines whether to use permit-based or standard transactions by checking the payment token's permit support.

    Parameters

    • client: {
          account: MultichainSmartAccount;
          extend: (<const client, const extendedHttpClient>(fn) => never);
          info: GetInfoPayload;
          pollingInterval: number;
          request: (<T>(params) => Promise<T>);
      }

      The Mee client instance used for API interactions

      • account: MultichainSmartAccount
      • extend: (<const client, const extendedHttpClient>(fn) => never)

        Extends the client with additional functionality

        Returns

        Extended client with both base and new functionality

          • <const client, const extendedHttpClient>(fn): never
          • Type Parameters

            • const client extends {
                  extend?: undefined;
                  request?: undefined;
              }
            • const extendedHttpClient extends HttpClient

            Parameters

            Returns never

      • info: GetInfoPayload
      • pollingInterval: number
      • request: (<T>(params) => Promise<T>)

        Makes HTTP requests to the Http node

          • <T>(params): Promise<T>
          • Type Parameters

            • T

            Parameters

            • params: RequestParams

            Returns Promise<T>

    • parameters: GetFusionQuoteParams

      Parameters for generating the quote

    Returns Promise<GetFusionQuotePayload>

    Promise resolving to either a permit quote or on-chain quote payload

    Example

    const quote = await getFusionQuote(client, {
    chainId: "1",
    walletProvider: "metamask",
    trigger: {
    chainId: "1",
    paymentToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" // USDC
    },
    instructions: [{
    to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    data: "0x...",
    value: "0"
    }]
    });
    // Returns either GetPermitQuotePayload or GetOnChainQuotePayload
    // depending on USDC's permit support

    Throws

    Will throw an error if:

    • The payment token information cannot be retrieved
    • The quote generation fails
    • The API request fails