UNPKG

@biconomy/abstractjs

Version:

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

35 lines 1.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildMultichainInstructions = exports.GLOBAL_COMPOSABLE_CALLS = void 0; const erc7579_1 = require("../../../clients/decorators/erc7579/index.js"); const smartAccount_1 = require("../../../clients/decorators/smartAccount/index.js"); const decorators_1 = require("../../../modules/validators/ownable/decorators/index.js"); const smartSessions_1 = require("../../../modules/validators/smartSessions/index.js"); exports.GLOBAL_COMPOSABLE_CALLS = { ...erc7579_1.erc7579Calls, ...smartAccount_1.smartAccountCalls, ...decorators_1.ownableCalls, ...smartSessions_1.smartSessionCalls }; const buildMultichainInstructions = async (baseParams, parameters) => { const { currentInstructions = [], account } = baseParams; const { calls: calls_, type, parameters: parametersForType } = parameters; const instructions = await Promise.all(account.deployments.map(async (account) => { let callsPerChain = []; const chainId = account.client.chain?.id; if (!chainId) { throw new Error("Chain ID is not set"); } if (calls_) { callsPerChain = calls_; } else if (type) { callsPerChain = (await exports.GLOBAL_COMPOSABLE_CALLS[type](account, parametersForType)); } return { calls: callsPerChain, chainId }; })); return [...currentInstructions, ...instructions]; }; exports.buildMultichainInstructions = buildMultichainInstructions; exports.default = exports.buildMultichainInstructions; //# sourceMappingURL=buildMultichainInstructions.js.map