UNPKG

@biconomy/sdk

Version:

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

43 lines 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createNexusSessionClient = exports.createNexusClient = void 0; exports.createSmartAccountClient = createSmartAccountClient; const toNexusAccount_1 = require("../account/toNexusAccount.js"); const constants_1 = require("../constants/index.js"); const createBicoBundlerClient_1 = require("./createBicoBundlerClient.js"); const erc7579_1 = require("./decorators/erc7579/index.js"); const smartAccount_1 = require("./decorators/smartAccount/index.js"); async function createSmartAccountClient(parameters) { const { account: account_, client: client_, chain = parameters.chain ?? client_?.chain, signer, index = 0n, key = "nexus client", name = "Nexus Client", module, factoryAddress = constants_1.MAINNET_ADDRESS_K1_VALIDATOR_FACTORY_ADDRESS, validatorAddress = constants_1.MAINNET_ADDRESS_K1_VALIDATOR_ADDRESS, bundlerTransport, transport, accountAddress, paymasterContext, attesters, attesterThreshold, useTestBundler = false, ...bundlerConfig } = parameters; if (!chain) throw new Error("Missing chain"); const nexusAccount = account_ ?? (await (0, toNexusAccount_1.toNexusAccount)({ accountAddress, transport, chain, signer, index, module, factoryAddress, validatorAddress, attesters, attesterThreshold, useTestBundler })); const bundler_ = (0, createBicoBundlerClient_1.createBicoBundlerClient)({ ...bundlerConfig, chain, key, name, paymasterContext, account: nexusAccount, transport: bundlerTransport }) .extend((0, erc7579_1.erc7579Actions)()) .extend((0, smartAccount_1.smartAccountActions)()); return bundler_; } exports.createNexusClient = createSmartAccountClient; exports.createNexusSessionClient = createSmartAccountClient; //# sourceMappingURL=createSmartAccountClient.js.map