UNPKG

@alchemy/aa-core

Version:

viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts

26 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultUserOpSigner = void 0; const account_js_1 = require("../../errors/account.js"); const client_js_1 = require("../../errors/client.js"); const useroperation_js_1 = require("../../errors/useroperation.js"); const index_js_1 = require("../../utils/index.js"); const defaultUserOpSigner = async (struct, { client, account = client.account }) => { if (!account) { throw new account_js_1.AccountNotFoundError(); } if (!client?.chain) { throw new client_js_1.ChainNotFoundError(); } const resolvedStruct = await (0, index_js_1.resolveProperties)(struct); const request = (0, index_js_1.deepHexlify)(resolvedStruct); if (!(0, index_js_1.isValidRequest)(request)) { throw new useroperation_js_1.InvalidUserOperationError(resolvedStruct); } return { ...resolvedStruct, signature: await account.signUserOperationHash(account.getEntryPoint().getUserOperationHash(request)), }; }; exports.defaultUserOpSigner = defaultUserOpSigner; //# sourceMappingURL=userOpSigner.js.map