UNPKG

@biconomy/abstractjs

Version:

SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.

55 lines 1.85 kB
import executeSignedQuote from "./executeSignedQuote.js"; import signFusionQuote, {} from "./signFusionQuote.js"; /** * Convenience method that combines signFusionQuote and executeSignedQuote into a single operation. * This function automatically handles the signing process (either permit or on-chain) and executes * the transaction in one step. * * @param client - The Mee client instance * @param parameters - Parameters for the fusion quote execution * @param parameters.fusionQuote - The fusion quote to execute * @param [parameters.account] - Optional account to use for signing * * @returns Promise resolving to the transaction hash * * @example * ```typescript * const result = await executeFusionQuote(meeClient, { * fusionQuote: { * quote: quotePayload, * trigger: { * tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC * chainId: 1, * amount: "1000000" // 1 USDC * } * }, * account: smartAccount // Optional * }); * // Returns: * // { * // hash: "0x123..." // Supertransaction hash * // } * ``` * * @throws Will throw an error if: * - The quote format is invalid * - The signing process fails * - The execution fails * - The token information cannot be retrieved */ export const executeFusionQuote = async (client, parameters) => { const signedFusionQuote = await signFusionQuote(client, parameters); let trigger = undefined; // If there is no call ? It is always TokenTrigger if (parameters.fusionQuote.trigger && !parameters.fusionQuote.trigger.call) { trigger = parameters.fusionQuote.trigger; } return executeSignedQuote(client, { signedQuote: { ...signedFusionQuote, trigger } }); }; export default executeFusionQuote; //# sourceMappingURL=executeFusionQuote.js.map