UNPKG

@biconomy/abstractjs

Version:

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

50 lines 2.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMmDtkQuote = exports.DEFAULT_VERIFICATION_GAS_LIMIT_FOR_MM_DTK = void 0; const resolveInstructions_1 = require("../../../account/utils/resolveInstructions.js"); const getFusionQuote_1 = require("./getFusionQuote.js"); const getQuote_1 = require("./getQuote.js"); exports.DEFAULT_VERIFICATION_GAS_LIMIT_FOR_MM_DTK = 200000n; const getMmDtkQuote = async (client, parameters) => { const { account: account_ = client.account, trigger, cleanUps, instructions, gasLimit, verificationGasLimit, delegatorSmartAccount, ...rest } = parameters; const resolvedInstructions = await (0, resolveInstructions_1.resolveInstructions)(instructions); const sender = delegatorSmartAccount.address; const scaAddress = account_.addressOn(trigger.chainId, true); const recipient = trigger.recipientAddress || scaAddress; const { triggerGasLimit, triggerAmount, batchedInstructions } = await (0, getFusionQuote_1.prepareInstructions)(client, { resolvedInstructions, trigger, sender, scaAddress, recipient, account: account_ }); const quote = await (0, getQuote_1.getQuote)(client, { path: "quote-permit", eoa: sender, instructions: batchedInstructions, gasLimit: gasLimit || triggerGasLimit, verificationGasLimit: verificationGasLimit || exports.DEFAULT_VERIFICATION_GAS_LIMIT_FOR_MM_DTK, ...(cleanUps ? { cleanUps } : {}), ...rest }); let fees = trigger.useMaxAvailableFunds ? 0n : BigInt(quote.paymentInfo.tokenWeiAmount); if (rest.sponsorship) { fees = 0n; } const amount = triggerAmount + fees; return { quote, trigger: { tokenAddress: trigger.tokenAddress, chainId: trigger.chainId, amount, gasLimit: triggerGasLimit } }; }; exports.getMmDtkQuote = getMmDtkQuote; exports.default = exports.getMmDtkQuote; //# sourceMappingURL=getMmDtkQuote.js.map