UNPKG

@biconomy/abstractjs

Version:

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

31 lines 1.37 kB
import { erc7579Calls } from "../../../clients/decorators/erc7579/index.js"; import { smartAccountCalls } from "../../../clients/decorators/smartAccount/index.js"; import { ownableCalls } from "../../../modules/validators/ownable/decorators/index.js"; import { smartSessionCalls } from "../../../modules/validators/smartSessions/index.js"; export const GLOBAL_COMPOSABLE_CALLS = { ...erc7579Calls, ...smartAccountCalls, ...ownableCalls, ...smartSessionCalls }; export 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 GLOBAL_COMPOSABLE_CALLS[type](account, parametersForType)); } return { calls: callsPerChain, chainId }; })); return [...currentInstructions, ...instructions]; }; export default buildMultichainInstructions; //# sourceMappingURL=buildMultichainInstructions.js.map