@aa-sdk/core 4.0.0-alpha.5 → 4.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/account/smartContractAccount.d.ts +9 -3
- package/dist/cjs/account/smartContractAccount.js +11 -6
- package/dist/cjs/account/smartContractAccount.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/cjs/client/bundlerClient.js.map +1 -1
- package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
- package/dist/cjs/client/isSmartAccountClient.js.map +1 -1
- package/dist/cjs/client/types.d.ts +2 -7
- package/dist/cjs/client/types.js.map +1 -1
- package/dist/cjs/errors/account.js.map +1 -1
- package/dist/cjs/errors/client.js.map +1 -1
- package/dist/cjs/errors/entrypoint.js.map +1 -1
- package/dist/cjs/errors/signer.js.map +1 -1
- package/dist/cjs/errors/transaction.js.map +1 -1
- package/dist/cjs/errors/useroperation.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -5
- package/dist/cjs/index.js +6 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger.js.map +1 -1
- package/dist/cjs/middleware/actions.js +2 -18
- package/dist/cjs/middleware/actions.js.map +1 -1
- package/dist/cjs/middleware/defaults/gasEstimator.js +3 -2
- package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/cjs/middleware/erc7677middleware.d.ts +40 -0
- package/dist/cjs/middleware/erc7677middleware.js +77 -0
- package/dist/cjs/middleware/erc7677middleware.js.map +1 -0
- package/dist/cjs/middleware/noopMiddleware.d.ts +2 -1
- package/dist/cjs/middleware/noopMiddleware.js.map +1 -1
- package/dist/cjs/middleware/types.d.ts +3 -2
- package/dist/cjs/middleware/types.js.map +1 -1
- package/dist/cjs/signer/local-account.d.ts +46 -46
- package/dist/cjs/signer/local-account.js.map +1 -1
- package/dist/cjs/signer/wallet-client.d.ts +46 -46
- package/dist/cjs/signer/wallet-client.js.map +1 -1
- package/dist/cjs/transport/split.js.map +1 -1
- package/dist/cjs/utils/bigint.js.map +1 -1
- package/dist/cjs/utils/bytes.js.map +1 -1
- package/dist/cjs/utils/defaults.d.ts +1 -3
- package/dist/cjs/utils/defaults.js +1 -41
- package/dist/cjs/utils/defaults.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/types.js.map +1 -1
- package/dist/cjs/utils/userop.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/account/smartContractAccount.d.ts +9 -3
- package/dist/esm/account/smartContractAccount.js +6 -1
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/esm/client/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
- package/dist/esm/client/isSmartAccountClient.js.map +1 -1
- package/dist/esm/client/types.d.ts +2 -7
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/errors/account.js.map +1 -1
- package/dist/esm/errors/client.js.map +1 -1
- package/dist/esm/errors/entrypoint.js.map +1 -1
- package/dist/esm/errors/signer.js.map +1 -1
- package/dist/esm/errors/transaction.js.map +1 -1
- package/dist/esm/errors/useroperation.js.map +1 -1
- package/dist/esm/index.d.ts +3 -5
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/middleware/actions.js +3 -18
- package/dist/esm/middleware/actions.js.map +1 -1
- package/dist/esm/middleware/defaults/gasEstimator.js +3 -2
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.d.ts +40 -0
- package/dist/esm/middleware/erc7677middleware.js +73 -0
- package/dist/esm/middleware/erc7677middleware.js.map +1 -0
- package/dist/esm/middleware/noopMiddleware.d.ts +2 -1
- package/dist/esm/middleware/noopMiddleware.js.map +1 -1
- package/dist/esm/middleware/types.d.ts +3 -2
- package/dist/esm/middleware/types.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +46 -46
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +46 -46
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/transport/split.js.map +1 -1
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/bytes.js.map +1 -1
- package/dist/esm/utils/defaults.d.ts +1 -3
- package/dist/esm/utils/defaults.js +1 -40
- package/dist/esm/utils/defaults.js.map +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/esm/utils/userop.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/account/smartContractAccount.d.ts +17 -11
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +33 -33
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +43 -59
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +18 -18
- package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +3 -3
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +3 -4
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -14
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +0 -7
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts +17 -3
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/dist/types/client/bundlerClient.d.ts +2 -2
- package/dist/types/client/decorators/bundlerClient.d.ts +8 -8
- package/dist/types/client/isSmartAccountClient.d.ts +4 -4
- package/dist/types/client/types.d.ts +2 -7
- package/dist/types/client/types.d.ts.map +1 -1
- package/dist/types/errors/account.d.ts +53 -4
- package/dist/types/errors/account.d.ts.map +1 -1
- package/dist/types/errors/client.d.ts +15 -0
- package/dist/types/errors/client.d.ts.map +1 -1
- package/dist/types/errors/entrypoint.d.ts +12 -0
- package/dist/types/errors/entrypoint.d.ts.map +1 -1
- package/dist/types/errors/signer.d.ts +5 -0
- package/dist/types/errors/signer.d.ts.map +1 -1
- package/dist/types/errors/transaction.d.ts +8 -1
- package/dist/types/errors/transaction.d.ts.map +1 -1
- package/dist/types/errors/useroperation.d.ts +5 -5
- package/dist/types/errors/useroperation.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logger.d.ts +88 -0
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/middleware/actions.d.ts +3 -3
- package/dist/types/middleware/actions.d.ts.map +1 -1
- package/dist/types/middleware/defaults/gasEstimator.d.ts +2 -2
- package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
- package/dist/types/middleware/erc7677middleware.d.ts +62 -0
- package/dist/types/middleware/erc7677middleware.d.ts.map +1 -0
- package/dist/types/middleware/noopMiddleware.d.ts +4 -4
- package/dist/types/middleware/noopMiddleware.d.ts.map +1 -1
- package/dist/types/middleware/types.d.ts +3 -2
- package/dist/types/middleware/types.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +139 -47
- package/dist/types/signer/local-account.d.ts.map +1 -1
- package/dist/types/signer/wallet-client.d.ts +135 -46
- package/dist/types/signer/wallet-client.d.ts.map +1 -1
- package/dist/types/transport/split.d.ts +2 -2
- package/dist/types/utils/bigint.d.ts +14 -14
- package/dist/types/utils/bigint.d.ts.map +1 -1
- package/dist/types/utils/bytes.d.ts +5 -5
- package/dist/types/utils/defaults.d.ts +1 -11
- package/dist/types/utils/defaults.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +12 -12
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/utils/userop.d.ts +33 -33
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -2
- package/src/account/smartContractAccount.ts +19 -12
- package/src/actions/smartAccount/buildUserOperationFromTx.ts +35 -35
- package/src/actions/smartAccount/buildUserOperationFromTxs.ts +44 -60
- package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +19 -19
- package/src/actions/smartAccount/estimateUserOperationGas.ts +3 -3
- package/src/actions/smartAccount/internal/initUserOperation.ts +3 -4
- package/src/actions/smartAccount/internal/runMiddlewareStack.ts +0 -22
- package/src/actions/smartAccount/internal/sendUserOperation.ts +0 -7
- package/src/actions/smartAccount/sendUserOperation.ts +17 -3
- package/src/client/bundlerClient.ts +2 -2
- package/src/client/decorators/bundlerClient.ts +8 -8
- package/src/client/isSmartAccountClient.ts +4 -4
- package/src/client/types.ts +2 -15
- package/src/errors/account.ts +64 -4
- package/src/errors/client.ts +18 -0
- package/src/errors/entrypoint.ts +12 -0
- package/src/errors/signer.ts +6 -0
- package/src/errors/transaction.ts +10 -1
- package/src/errors/useroperation.ts +5 -6
- package/src/index.ts +2 -8
- package/src/logger.ts +88 -0
- package/src/middleware/actions.ts +6 -27
- package/src/middleware/defaults/gasEstimator.ts +8 -5
- package/src/middleware/erc7677middleware.ts +201 -0
- package/src/middleware/noopMiddleware.ts +6 -4
- package/src/middleware/types.ts +16 -7
- package/src/signer/local-account.ts +94 -2
- package/src/signer/wallet-client.ts +89 -0
- package/src/transport/split.ts +2 -2
- package/src/utils/bigint.ts +15 -15
- package/src/utils/bytes.ts +5 -5
- package/src/utils/defaults.ts +2 -74
- package/src/utils/index.ts +12 -12
- package/src/utils/types.ts +2 -2
- package/src/utils/userop.ts +33 -33
- package/src/version.ts +1 -1
- package/dist/cjs/account/base.d.ts +0 -49
- package/dist/cjs/account/base.js +0 -257
- package/dist/cjs/account/base.js.map +0 -1
- package/dist/cjs/account/schema.d.ts +0 -100
- package/dist/cjs/account/schema.js +0 -43
- package/dist/cjs/account/schema.js.map +0 -1
- package/dist/cjs/account/simple.d.ts +0 -14
- package/dist/cjs/account/simple.js +0 -119
- package/dist/cjs/account/simple.js.map +0 -1
- package/dist/cjs/account/types.d.ts +0 -30
- package/dist/cjs/account/types.js +0 -3
- package/dist/cjs/account/types.js.map +0 -1
- package/dist/esm/account/base.d.ts +0 -49
- package/dist/esm/account/base.js +0 -253
- package/dist/esm/account/base.js.map +0 -1
- package/dist/esm/account/schema.d.ts +0 -100
- package/dist/esm/account/schema.js +0 -35
- package/dist/esm/account/schema.js.map +0 -1
- package/dist/esm/account/simple.d.ts +0 -14
- package/dist/esm/account/simple.js +0 -115
- package/dist/esm/account/simple.js.map +0 -1
- package/dist/esm/account/types.d.ts +0 -30
- package/dist/esm/account/types.js +0 -2
- package/dist/esm/account/types.js.map +0 -1
- package/dist/types/account/base.d.ts +0 -128
- package/dist/types/account/base.d.ts.map +0 -1
- package/dist/types/account/schema.d.ts +0 -101
- package/dist/types/account/schema.d.ts.map +0 -1
- package/dist/types/account/simple.d.ts +0 -15
- package/dist/types/account/simple.d.ts.map +0 -1
- package/dist/types/account/types.d.ts +0 -144
- package/dist/types/account/types.d.ts.map +0 -1
- package/src/account/base.ts +0 -415
- package/src/account/schema.ts +0 -51
- package/src/account/simple.ts +0 -221
- package/src/account/types.ts +0 -184
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,uBAAwB,SAAQ,mBAAS;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,uBAAwB,SAAQ,mBAAS;IAUpD,YAAY,cAAsB,EAAE,MAAc,EAAE,MAAc;QAChE,KAAK,CACH;YACE,mBAAmB,MAAM,CAAC,IAAI,cAAc,cAAc,GAAG;YAC7D,qEAAqE,MAAM,IAAI;SAChF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAfK;;;;mBAAO,yBAAyB;WAAC;IAgB1C,CAAC;CACF;AAlBD,0DAkBC;AAKD,MAAa,kBAAmB,SAAQ,mBAAS;IAQ/C,YAAY,MAAe;QACzB,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAR5B;;;;mBAAO,oBAAoB;WAAC;IASrC,CAAC;CACF;AAXD,gDAWC;AAKD,MAAa,kBAAmB,SAAQ,mBAAS;IAM/C;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QANlC;;;;mBAAO,oBAAoB;WAAC;IAOrC,CAAC;CACF;AATD,gDASC","sourcesContent":["import type { Client } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when a client is not compatible with the expected client type for a specific method. The error message provides guidance on how to create a compatible client.\n */\nexport class IncompatibleClientError extends BaseError {\n override name = \"IncompatibleClientError\";\n\n /**\n * Throws an error when the client type does not match the expected client type.\n *\n * @param {string} expectedClient The expected type of the client.\n * @param {string} method The method that was called.\n * @param {Client} client The client instance.\n */\n constructor(expectedClient: string, method: string, client: Client) {\n super(\n [\n `Client of type (${client.type}) is not a ${expectedClient}.`,\n `Create one with \\`createSmartAccountClient\\` first before using \\`${method}\\``,\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Represents an error that occurs when an invalid RPC URL is provided. This class extends the `BaseError` class and includes the invalid URL in the error message.\n */\nexport class InvalidRpcUrlError extends BaseError {\n override name = \"InvalidRpcUrlError\";\n\n /**\n * Creates an instance of an error with a message indicating an invalid RPC URL.\n *\n * @param {string} [rpcUrl] The invalid RPC URL that caused the error\n */\n constructor(rpcUrl?: string) {\n super(`Invalid RPC URL ${rpcUrl}`);\n }\n}\n\n/**\n * Error class representing a \"Chain Not Found\" error, typically thrown when no chain is supplied to the client.\n */\nexport class ChainNotFoundError extends BaseError {\n override name = \"ChainNotFoundError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that no chain was supplied to the client.\n */\n constructor() {\n super(\"No chain supplied to the client\");\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../src/errors/entrypoint.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,uBAAwB,SAAQ,mBAAS;
|
|
1
|
+
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../src/errors/entrypoint.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,uBAAwB,SAAQ,mBAAS;IASpD,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH;YACE,2BAA2B,iBAAiB,eAAe,KAAK,CAAC,IAAI,GAAG;YACxE,qBAAqB;SACtB,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAdK;;;;mBAAO,yBAAyB;WAAC;IAe1C,CAAC;CACF;AAjBD,0DAiBC;AAKD,MAAa,sBAAuB,SAAQ,mBAAS;IASnD,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH,2CAA2C,iBAAiB,QAAQ,KAAK,CAAC,IAAI,GAAG,CAClF,CAAC;QAXK;;;;mBAAO,wBAAwB;WAAC;IAYzC,CAAC;CACF;AAdD,wDAcC","sourcesContent":["import type { Chain } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an entry point is not found for a specific chain and entry point version. This error indicates that a default entry point does not exist for the given chain and version, and suggests providing an override.\n */\nexport class EntryPointNotFoundError extends BaseError {\n override name = \"EntryPointNotFoundError\";\n\n /**\n * Constructs an error message indicating that no default entry point exists for the given chain and entry point version.\n *\n * @param {Chain} chain The blockchain network for which the entry point is being queried\n * @param {any} entryPointVersion The version of the entry point for which no default exists\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n [\n `No default entry point v${entryPointVersion} exists for ${chain.name}.`,\n `Supply an override.`,\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Represents an error thrown when an invalid entry point version is encountered for a specific chain. This error extends the `BaseError` class.\n */\nexport class InvalidEntryPointError extends BaseError {\n override name = \"InvalidEntryPointError\";\n\n /**\n * Constructs an error indicating an invalid entry point version for a specific chain.\n *\n * @param {Chain} chain The chain object containing information about the blockchain\n * @param {any} entryPointVersion The entry point version that is invalid\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n `Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../src/errors/signer.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAKtC,MAAa,sBAAuB,SAAQ,mBAAS;
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../src/errors/signer.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAKtC,MAAa,sBAAuB,SAAQ,mBAAS;IAQnD,YAAY,UAAmB;QAC7B,KAAK,CACH;YACE,6DAA6D;YAC7D,UAAU,IAAI,gCAAgC;SAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAbK;;;;mBAAO,wBAAwB;WAAC;IAczC,CAAC;CACF;AAhBD,wDAgBC","sourcesContent":["import { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an invalid signer type is provided to the SmartAccountSigner.\n */\nexport class InvalidSignerTypeError extends BaseError {\n override name = \"InvalidSignerTypeError\";\n\n /**\n * Constructs an error message when an invalid signer type is passed to SmartAccountSigner.\n *\n * @param {string} [signerType] An optional parameter specifying the signer type. If not provided, a default error message will be used.\n */\n constructor(signerType?: string) {\n super(\n [\n \"Invalid signer type parameter passed to SmartAccountSigner.\",\n signerType ?? \"A signerType must be provided.\",\n ].join(\"\\n\")\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/errors/transaction.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,8BAA+B,SAAQ,mBAAS;
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/errors/transaction.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,8BAA+B,SAAQ,mBAAS;IAKvD;QACF,KAAK,CAAC,oDAAoD,CAAC,CAAC;QALrD;;;;mBAAO,gCAAgC;WAAC;IAMjD,CAAC;CACF;AARD,wEAQC;AAKD,MAAa,4BAA6B,SAAQ,mBAAS;IAQzD,YAAY,IAAS;QACnB,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;QARxD;;;;mBAAO,8BAA8B;WAAC;IAS/C,CAAC;CACF;AAXD,oEAWC","sourcesContent":["import type { Hex } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Error thrown when a transaction is missing the `to` address parameter. This class extends the `BaseError` class.\n */\nexport class TransactionMissingToParamError extends BaseError {\n override name = \"TransactionMissingToParamError\";\n\n /**\n * Throws an error indicating that a transaction is missing the `to` address in the request.\n */ constructor() {\n super(\"Transaction is missing `to` address set on request\");\n }\n}\n\n/**\n * Represents an error that occurs when a transaction cannot be found for a given user operation. This error extends from `BaseError`. The `hash` of the transaction is provided to indicate which transaction could not be found.\n */\nexport class FailedToFindTransactionError extends BaseError {\n override name = \"FailedToFindTransactionError\";\n\n /**\n * Constructs a new error message indicating a failure to find the transaction for the specified user operation hash.\n *\n * @param {Hex} hash The hexadecimal value representing the user operation hash.\n */\n constructor(hash: Hex) {\n super(`Failed to find transaction for user operation ${hash}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useroperation.js","sourceRoot":"","sources":["../../../src/errors/useroperation.ts"],"names":[],"mappings":";;;AACA,uCAAsC;
|
|
1
|
+
{"version":3,"file":"useroperation.js","sourceRoot":"","sources":["../../../src/errors/useroperation.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAQtC,MAAa,yBAA0B,SAAQ,mBAAS;IAYtD,YAAY,EAAuB;QACjC,KAAK,CACH,yFAAyF,IAAI,CAAC,SAAS,CACrG,EAAE,EACF,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,OAAO,KAAK,KAAK,QAAQ;YACvB,CAAC,CAAC;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;aACxB;YACH,CAAC,CAAC,KAAK,EACX,CAAC,CACF,EAAE,CACJ,CAAC;QArBK;;;;mBAAO,2BAA2B;WAAC;IAsB5C,CAAC;CACF;AA3BD,8DA2BC;AAQD,MAAa,yBAA0B,SAAQ,mBAAS;IAKtD,YAAmB,OAA6B,EAAE,KAAY;QAC5D,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAD/C;;;;mBAAO,OAAO;WAAsB;IAEhD,CAAC;CACF;AARD,8DAQC","sourcesContent":["import type { UserOperationRequest, UserOperationStruct } from \"../types.js\";\nimport { BaseError } from \"./base.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n/**\n * Thrown when a UserOperationStruct is not a valid request\n *\n * extends viem BaseError\n */\nexport class InvalidUserOperationError extends BaseError {\n /**\n * @inheritdoc\n */\n override name = \"InvalidUserOperationError\";\n /**\n * Creates an instance of InvalidUserOperationError.\n *\n * InvalidUserOperationError constructor\n *\n * @param {UserOperationStruct} uo the invalid user operation struct\n */\n constructor(uo: UserOperationStruct) {\n super(\n `Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(\n uo,\n (_key, value) =>\n typeof value === \"bigint\"\n ? {\n type: \"bigint\",\n value: value.toString(),\n }\n : value,\n 2\n )}`\n );\n }\n}\n\n/**\n * Error thrown when waiting for user operation request to be mined.\n *\n * Includes the internal error as well as the request that failed. This request\n * can then be used with dropAndReplaceUserOperation to retry the operation.\n */\nexport class WaitForUserOperationError extends BaseError {\n /**\n * @param {UserOperationRequest} request the user operation request that failed\n * @param {Error} error the underlying error that caused the failure\n */\n constructor(public request: UserOperationRequest, error: Error) {\n super(`Failed to find User Operation: ${error.message}`);\n }\n}\n"]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -6,12 +6,8 @@ export { EntryPointAbi_v7 } from "./abis/EntryPointAbi_v7.js";
|
|
|
6
6
|
export { SimpleAccountAbi_v6 } from "./abis/SimpleAccountAbi_v6.js";
|
|
7
7
|
export { SimpleAccountAbi_v7 } from "./abis/SimpleAccountAbi_v7.js";
|
|
8
8
|
export { SimpleAccountFactoryAbi } from "./abis/SimpleAccountFactoryAbi.js";
|
|
9
|
-
export { BaseSmartContractAccount } from "./account/base.js";
|
|
10
|
-
export { createSimpleSmartAccount } from "./account/simple.js";
|
|
11
|
-
export type { SimpleSmartAccount } from "./account/simple.js";
|
|
12
9
|
export type * from "./account/smartContractAccount.js";
|
|
13
10
|
export { getAccountAddress, isSmartAccountWithSigner, parseFactoryAddressFromAccountInitCode, toSmartContractAccount, } from "./account/smartContractAccount.js";
|
|
14
|
-
export type { BaseSmartAccountParams, SignTypedDataParams, } from "./account/types.js";
|
|
15
11
|
export { buildUserOperation } from "./actions/smartAccount/buildUserOperation.js";
|
|
16
12
|
export { buildUserOperationFromTx } from "./actions/smartAccount/buildUserOperationFromTx.js";
|
|
17
13
|
export { buildUserOperationFromTxs } from "./actions/smartAccount/buildUserOperationFromTxs.js";
|
|
@@ -49,6 +45,8 @@ export { defaultFeeEstimator } from "./middleware/defaults/feeEstimator.js";
|
|
|
49
45
|
export { defaultGasEstimator } from "./middleware/defaults/gasEstimator.js";
|
|
50
46
|
export { defaultPaymasterAndData } from "./middleware/defaults/paymasterAndData.js";
|
|
51
47
|
export { defaultUserOpSigner } from "./middleware/defaults/userOpSigner.js";
|
|
48
|
+
export type * from "./middleware/erc7677middleware.js";
|
|
49
|
+
export { erc7677Middleware } from "./middleware/erc7677middleware.js";
|
|
52
50
|
export { noopMiddleware } from "./middleware/noopMiddleware.js";
|
|
53
51
|
export type * from "./middleware/types.js";
|
|
54
52
|
export { LocalAccountSigner } from "./signer/local-account.js";
|
|
@@ -59,4 +57,4 @@ export { WalletClientSigner } from "./signer/wallet-client.js";
|
|
|
59
57
|
export { split, type SplitTransportParams } from "./transport/split.js";
|
|
60
58
|
export type * from "./types.js";
|
|
61
59
|
export type * from "./utils/index.js";
|
|
62
|
-
export { BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, filterUndefined,
|
|
60
|
+
export { BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, filterUndefined, getDefaultUserOperationFeeOptions, isBigNumberish, isMultiplier, isValidRequest, parsePaymasterAndData, pick, resolveProperties, takeBytes, toRecord, } from "./utils/index.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ChainNotFoundError = exports.BaseError = exports.UpgradesNotSupportedError = exports.UpgradeToAndCallNotSupportedError = exports.SmartAccountWithSignerRequiredError = exports.SignTransactionNotSupportedError = exports.IncorrectAccountType = exports.GetCounterFactualAddressError = exports.FailedToGetStorageSlotError = exports.DefaultFactoryNotDefinedError = exports.BatchExecutionNotSupportedError = exports.AccountRequiresOwnerError = exports.AccountNotFoundError = exports.isEntryPointVersion = exports.getEntryPoint = exports.entryPointRegistry = exports.defaultEntryPointVersion = exports.convertCoinTypeToChainId = exports.convertCoinTypeToChain = exports.convertChainIdToCoinType = exports.createSmartAccountClientFromExisting = exports.createSmartAccountClient = exports.SmartAccountClientOptsSchema = exports.ConnectionConfigSchema = exports.isSmartAccountClient = exports.smartAccountClientActions = exports.bundlerActions = exports.createBundlerClientFromExisting = exports.createBundlerClient = exports.waitForUserOperationTransaction = exports.sendUserOperation = exports.sendTransactions = exports.sendTransaction = exports.dropAndReplaceUserOperation = exports.checkGasSponsorshipEligibility = exports.buildUserOperationFromTxs = exports.buildUserOperationFromTx = exports.buildUserOperation = exports.toSmartContractAccount = exports.parseFactoryAddressFromAccountInitCode = exports.isSmartAccountWithSigner = exports.getAccountAddress = exports.
|
|
27
|
-
exports.toRecord = exports.takeBytes = exports.resolveProperties = exports.pick = exports.parsePaymasterAndData = exports.isValidRequest = exports.isMultiplier = exports.isBigNumberish = exports.getDefaultUserOperationFeeOptions = exports.
|
|
26
|
+
exports.InvalidRpcUrlError = exports.IncompatibleClientError = exports.ChainNotFoundError = exports.BaseError = exports.UpgradesNotSupportedError = exports.UpgradeToAndCallNotSupportedError = exports.SmartAccountWithSignerRequiredError = exports.SignTransactionNotSupportedError = exports.IncorrectAccountType = exports.GetCounterFactualAddressError = exports.FailedToGetStorageSlotError = exports.DefaultFactoryNotDefinedError = exports.BatchExecutionNotSupportedError = exports.AccountRequiresOwnerError = exports.AccountNotFoundError = exports.isEntryPointVersion = exports.getEntryPoint = exports.entryPointRegistry = exports.defaultEntryPointVersion = exports.convertCoinTypeToChainId = exports.convertCoinTypeToChain = exports.convertChainIdToCoinType = exports.createSmartAccountClientFromExisting = exports.createSmartAccountClient = exports.SmartAccountClientOptsSchema = exports.ConnectionConfigSchema = exports.isSmartAccountClient = exports.smartAccountClientActions = exports.bundlerActions = exports.createBundlerClientFromExisting = exports.createBundlerClient = exports.waitForUserOperationTransaction = exports.sendUserOperation = exports.sendTransactions = exports.sendTransaction = exports.dropAndReplaceUserOperation = exports.checkGasSponsorshipEligibility = exports.buildUserOperationFromTxs = exports.buildUserOperationFromTx = exports.buildUserOperation = exports.toSmartContractAccount = exports.parseFactoryAddressFromAccountInitCode = exports.isSmartAccountWithSigner = exports.getAccountAddress = exports.SimpleAccountFactoryAbi = exports.SimpleAccountAbi_v7 = exports.SimpleAccountAbi_v6 = exports.EntryPointAbi_v7 = exports.EntryPointAbi_v6 = exports.chains = void 0;
|
|
27
|
+
exports.toRecord = exports.takeBytes = exports.resolveProperties = exports.pick = exports.parsePaymasterAndData = exports.isValidRequest = exports.isMultiplier = exports.isBigNumberish = exports.getDefaultUserOperationFeeOptions = exports.filterUndefined = exports.deepHexlify = exports.concatPaymasterAndData = exports.bypassPaymasterAndDataEmptyHex = exports.bypassPaymasterAndData = exports.bigIntMultiply = exports.bigIntMax = exports.asyncPipe = exports.applyUserOpOverrideOrFeeOption = exports.applyUserOpOverride = exports.applyUserOpFeeOption = exports.allEqual = exports.MultiplierSchema = exports.HexSchema = exports.ChainSchema = exports.BigNumberishSchema = exports.BigNumberishRangeSchema = exports.split = exports.WalletClientSigner = exports.wrapSignatureWith6492 = exports.isSigner = exports.SignerSchema = exports.LocalAccountSigner = exports.noopMiddleware = exports.erc7677Middleware = exports.defaultUserOpSigner = exports.defaultPaymasterAndData = exports.defaultGasEstimator = exports.defaultFeeEstimator = exports.middlewareActions = exports.Logger = exports.LogLevel = exports.WaitForUserOperationError = exports.InvalidUserOperationError = exports.TransactionMissingToParamError = exports.FailedToFindTransactionError = exports.InvalidSignerTypeError = exports.InvalidEntryPointError = exports.EntryPointNotFoundError = void 0;
|
|
28
28
|
exports.chains = __importStar(require("viem/chains"));
|
|
29
29
|
var EntryPointAbi_v6_js_1 = require("./abis/EntryPointAbi_v6.js");
|
|
30
30
|
Object.defineProperty(exports, "EntryPointAbi_v6", { enumerable: true, get: function () { return EntryPointAbi_v6_js_1.EntryPointAbi_v6; } });
|
|
@@ -36,10 +36,6 @@ var SimpleAccountAbi_v7_js_1 = require("./abis/SimpleAccountAbi_v7.js");
|
|
|
36
36
|
Object.defineProperty(exports, "SimpleAccountAbi_v7", { enumerable: true, get: function () { return SimpleAccountAbi_v7_js_1.SimpleAccountAbi_v7; } });
|
|
37
37
|
var SimpleAccountFactoryAbi_js_1 = require("./abis/SimpleAccountFactoryAbi.js");
|
|
38
38
|
Object.defineProperty(exports, "SimpleAccountFactoryAbi", { enumerable: true, get: function () { return SimpleAccountFactoryAbi_js_1.SimpleAccountFactoryAbi; } });
|
|
39
|
-
var base_js_1 = require("./account/base.js");
|
|
40
|
-
Object.defineProperty(exports, "BaseSmartContractAccount", { enumerable: true, get: function () { return base_js_1.BaseSmartContractAccount; } });
|
|
41
|
-
var simple_js_1 = require("./account/simple.js");
|
|
42
|
-
Object.defineProperty(exports, "createSimpleSmartAccount", { enumerable: true, get: function () { return simple_js_1.createSimpleSmartAccount; } });
|
|
43
39
|
var smartContractAccount_js_1 = require("./account/smartContractAccount.js");
|
|
44
40
|
Object.defineProperty(exports, "getAccountAddress", { enumerable: true, get: function () { return smartContractAccount_js_1.getAccountAddress; } });
|
|
45
41
|
Object.defineProperty(exports, "isSmartAccountWithSigner", { enumerable: true, get: function () { return smartContractAccount_js_1.isSmartAccountWithSigner; } });
|
|
@@ -99,8 +95,8 @@ Object.defineProperty(exports, "SignTransactionNotSupportedError", { enumerable:
|
|
|
99
95
|
Object.defineProperty(exports, "SmartAccountWithSignerRequiredError", { enumerable: true, get: function () { return account_js_1.SmartAccountWithSignerRequiredError; } });
|
|
100
96
|
Object.defineProperty(exports, "UpgradeToAndCallNotSupportedError", { enumerable: true, get: function () { return account_js_1.UpgradeToAndCallNotSupportedError; } });
|
|
101
97
|
Object.defineProperty(exports, "UpgradesNotSupportedError", { enumerable: true, get: function () { return account_js_1.UpgradesNotSupportedError; } });
|
|
102
|
-
var
|
|
103
|
-
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return
|
|
98
|
+
var base_js_1 = require("./errors/base.js");
|
|
99
|
+
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return base_js_1.BaseError; } });
|
|
104
100
|
var client_js_1 = require("./errors/client.js");
|
|
105
101
|
Object.defineProperty(exports, "ChainNotFoundError", { enumerable: true, get: function () { return client_js_1.ChainNotFoundError; } });
|
|
106
102
|
Object.defineProperty(exports, "IncompatibleClientError", { enumerable: true, get: function () { return client_js_1.IncompatibleClientError; } });
|
|
@@ -129,6 +125,8 @@ var paymasterAndData_js_1 = require("./middleware/defaults/paymasterAndData.js")
|
|
|
129
125
|
Object.defineProperty(exports, "defaultPaymasterAndData", { enumerable: true, get: function () { return paymasterAndData_js_1.defaultPaymasterAndData; } });
|
|
130
126
|
var userOpSigner_js_1 = require("./middleware/defaults/userOpSigner.js");
|
|
131
127
|
Object.defineProperty(exports, "defaultUserOpSigner", { enumerable: true, get: function () { return userOpSigner_js_1.defaultUserOpSigner; } });
|
|
128
|
+
var erc7677middleware_js_1 = require("./middleware/erc7677middleware.js");
|
|
129
|
+
Object.defineProperty(exports, "erc7677Middleware", { enumerable: true, get: function () { return erc7677middleware_js_1.erc7677Middleware; } });
|
|
132
130
|
var noopMiddleware_js_1 = require("./middleware/noopMiddleware.js");
|
|
133
131
|
Object.defineProperty(exports, "noopMiddleware", { enumerable: true, get: function () { return noopMiddleware_js_1.noopMiddleware; } });
|
|
134
132
|
var local_account_js_1 = require("./signer/local-account.js");
|
|
@@ -160,7 +158,6 @@ Object.defineProperty(exports, "bypassPaymasterAndDataEmptyHex", { enumerable: t
|
|
|
160
158
|
Object.defineProperty(exports, "concatPaymasterAndData", { enumerable: true, get: function () { return index_js_2.concatPaymasterAndData; } });
|
|
161
159
|
Object.defineProperty(exports, "deepHexlify", { enumerable: true, get: function () { return index_js_2.deepHexlify; } });
|
|
162
160
|
Object.defineProperty(exports, "filterUndefined", { enumerable: true, get: function () { return index_js_2.filterUndefined; } });
|
|
163
|
-
Object.defineProperty(exports, "getDefaultSimpleAccountFactoryAddress", { enumerable: true, get: function () { return index_js_2.getDefaultSimpleAccountFactoryAddress; } });
|
|
164
161
|
Object.defineProperty(exports, "getDefaultUserOperationFeeOptions", { enumerable: true, get: function () { return index_js_2.getDefaultUserOperationFeeOptions; } });
|
|
165
162
|
Object.defineProperty(exports, "isBigNumberish", { enumerable: true, get: function () { return index_js_2.isBigNumberish; } });
|
|
166
163
|
Object.defineProperty(exports, "isMultiplier", { enumerable: true, get: function () { return index_js_2.isMultiplier; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sDAAsC;AAEtC,kEAA8D;AAArD,uHAAA,gBAAgB,OAAA;AACzB,kEAA8D;AAArD,uHA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4E;AAAnE,sHAAA,mBAAmB,OAAA;AAC5B,iFAAoF;AAA3E,8HAAA,uBAAuB,OAAA;AAChC,yEAA4E;AAAnE,sHAAA,mBAAmB,OAAA;AAE5B,0EAAsE;AAA7D,yHAAA,iBAAiB,OAAA;AAC1B,oEAAgE;AAAvD,mHAAA,cAAc,OAAA;AAEvB,8DAA+D;AAAtD,sHAAA,kBAAkB,OAAA;AAC3B,gDAA4D;AAAnD,yGAAA,YAAY,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAK/B,8CAA0D;AAAjD,iHAAA,qBAAqB,OAAA;AAC9B,8DAA+D;AAAtD,sHAAA,kBAAkB,OAAA;AAC3B,iDAAwE;AAA/D,iGAAA,KAAK,OAAA;AAGd,6CA2B0B;AA1BxB,mHAAA,uBAAuB,OAAA;AACvB,8GAAA,kBAAkB,OAAA;AAClB,uGAAA,WAAW,OAAA;AACX,qGAAA,SAAS,OAAA;AACT,4GAAA,gBAAgB,OAAA;AAChB,oGAAA,QAAQ,OAAA;AACR,gHAAA,oBAAoB,OAAA;AACpB,+GAAA,mBAAmB,OAAA;AACnB,0HAAA,8BAA8B,OAAA;AAC9B,qGAAA,SAAS,OAAA;AACT,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,kHAAA,sBAAsB,OAAA;AACtB,0HAAA,8BAA8B,OAAA;AAC9B,kHAAA,sBAAsB,OAAA;AACtB,uGAAA,WAAW,OAAA;AACX,2GAAA,eAAe,OAAA;AACf,6HAAA,iCAAiC,OAAA;AACjC,0GAAA,cAAc,OAAA;AACd,wGAAA,YAAY,OAAA;AACZ,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AACrB,gGAAA,IAAI,OAAA;AACJ,6GAAA,iBAAiB,OAAA;AACjB,qGAAA,SAAS,OAAA;AACT,oGAAA,QAAQ,OAAA","sourcesContent":["export type { Abi } from \"abitype\";\nexport type { Address, HttpTransport } from \"viem\";\nexport * as chains from \"viem/chains\";\n\nexport { EntryPointAbi_v6 } from \"./abis/EntryPointAbi_v6.js\";\nexport { EntryPointAbi_v7 } from \"./abis/EntryPointAbi_v7.js\";\nexport { SimpleAccountAbi_v6 } from \"./abis/SimpleAccountAbi_v6.js\";\nexport { SimpleAccountAbi_v7 } from \"./abis/SimpleAccountAbi_v7.js\";\nexport { SimpleAccountFactoryAbi } from \"./abis/SimpleAccountFactoryAbi.js\";\nexport type * from \"./account/smartContractAccount.js\";\nexport {\n getAccountAddress,\n isSmartAccountWithSigner,\n parseFactoryAddressFromAccountInitCode,\n toSmartContractAccount,\n} from \"./account/smartContractAccount.js\";\nexport { buildUserOperation } from \"./actions/smartAccount/buildUserOperation.js\";\nexport { buildUserOperationFromTx } from \"./actions/smartAccount/buildUserOperationFromTx.js\";\nexport { buildUserOperationFromTxs } from \"./actions/smartAccount/buildUserOperationFromTxs.js\";\nexport { checkGasSponsorshipEligibility } from \"./actions/smartAccount/checkGasSponsorshipEligibility.js\";\nexport { dropAndReplaceUserOperation } from \"./actions/smartAccount/dropAndReplaceUserOperation.js\";\nexport { sendTransaction } from \"./actions/smartAccount/sendTransaction.js\";\nexport { sendTransactions } from \"./actions/smartAccount/sendTransactions.js\";\nexport { sendUserOperation } from \"./actions/smartAccount/sendUserOperation.js\";\nexport type * from \"./actions/smartAccount/types.js\";\nexport { waitForUserOperationTransaction } from \"./actions/smartAccount/waitForUserOperationTransacation.js\";\nexport type * from \"./client/bundlerClient.js\";\nexport {\n createBundlerClient,\n createBundlerClientFromExisting,\n} from \"./client/bundlerClient.js\";\nexport type * from \"./client/decorators/bundlerClient.js\";\nexport { bundlerActions } from \"./client/decorators/bundlerClient.js\";\nexport type * from \"./client/decorators/smartAccountClient.js\";\nexport { smartAccountClientActions } from \"./client/decorators/smartAccountClient.js\";\nexport { isSmartAccountClient } from \"./client/isSmartAccountClient.js\";\nexport {\n ConnectionConfigSchema,\n SmartAccountClientOptsSchema,\n} from \"./client/schema.js\";\nexport type * from \"./client/smartAccountClient.js\";\nexport {\n createSmartAccountClient,\n createSmartAccountClientFromExisting,\n} from \"./client/smartAccountClient.js\";\nexport type * from \"./client/types.js\";\nexport {\n convertChainIdToCoinType,\n convertCoinTypeToChain,\n convertCoinTypeToChainId,\n} from \"./ens/utils.js\";\nexport {\n defaultEntryPointVersion,\n entryPointRegistry,\n getEntryPoint,\n isEntryPointVersion,\n} from \"./entrypoint/index.js\";\nexport type * from \"./entrypoint/types.js\";\nexport {\n AccountNotFoundError,\n AccountRequiresOwnerError,\n BatchExecutionNotSupportedError,\n DefaultFactoryNotDefinedError,\n FailedToGetStorageSlotError,\n GetCounterFactualAddressError,\n IncorrectAccountType,\n SignTransactionNotSupportedError,\n SmartAccountWithSignerRequiredError,\n UpgradeToAndCallNotSupportedError,\n UpgradesNotSupportedError,\n} from \"./errors/account.js\";\nexport { BaseError } from \"./errors/base.js\";\nexport {\n ChainNotFoundError,\n IncompatibleClientError,\n InvalidRpcUrlError,\n} from \"./errors/client.js\";\nexport {\n EntryPointNotFoundError,\n InvalidEntryPointError,\n} from \"./errors/entrypoint.js\";\nexport { InvalidSignerTypeError } from \"./errors/signer.js\";\nexport {\n FailedToFindTransactionError,\n TransactionMissingToParamError,\n} from \"./errors/transaction.js\";\nexport {\n InvalidUserOperationError,\n WaitForUserOperationError,\n} from \"./errors/useroperation.js\";\nexport { LogLevel, Logger } from \"./logger.js\";\nexport { middlewareActions } from \"./middleware/actions.js\";\nexport { defaultFeeEstimator } from \"./middleware/defaults/feeEstimator.js\";\nexport { defaultGasEstimator } from \"./middleware/defaults/gasEstimator.js\";\nexport { defaultPaymasterAndData } from \"./middleware/defaults/paymasterAndData.js\";\nexport { defaultUserOpSigner } from \"./middleware/defaults/userOpSigner.js\";\nexport type * from \"./middleware/erc7677middleware.js\";\nexport { erc7677Middleware } from \"./middleware/erc7677middleware.js\";\nexport { noopMiddleware } from \"./middleware/noopMiddleware.js\";\nexport type * from \"./middleware/types.js\";\nexport { LocalAccountSigner } from \"./signer/local-account.js\";\nexport { SignerSchema, isSigner } from \"./signer/schema.js\";\nexport type {\n SmartAccountAuthenticator,\n SmartAccountSigner,\n} from \"./signer/types.js\";\nexport { wrapSignatureWith6492 } from \"./signer/utils.js\";\nexport { WalletClientSigner } from \"./signer/wallet-client.js\";\nexport { split, type SplitTransportParams } from \"./transport/split.js\";\nexport type * from \"./types.js\";\nexport type * from \"./utils/index.js\";\nexport {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n ChainSchema,\n HexSchema,\n MultiplierSchema,\n allEqual,\n applyUserOpFeeOption,\n applyUserOpOverride,\n applyUserOpOverrideOrFeeOption,\n asyncPipe,\n bigIntMax,\n bigIntMultiply,\n bypassPaymasterAndData,\n bypassPaymasterAndDataEmptyHex,\n concatPaymasterAndData,\n deepHexlify,\n filterUndefined,\n getDefaultUserOperationFeeOptions,\n isBigNumberish,\n isMultiplier,\n isValidRequest,\n parsePaymasterAndData,\n pick,\n resolveProperties,\n takeBytes,\n toRecord,\n} from \"./utils/index.js\";\n"]}
|
package/dist/cjs/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,6CAAW,CAAA;IACX,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;IACT,uCAAQ,CAAA;AACV,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB;AAKD,MAAa,MAAM;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,6CAAW,CAAA;IACX,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;IACT,uCAAQ,CAAA;AACV,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB;AAK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,CAAC;YAAE,OAAO;QAEnD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,GAAW,EAAE,KAAe;QACnD,IAAI,IAAI,CAAC,QAAQ,GAAG,KAAK;YAAE,OAAO,KAAK,CAAC;QACxC,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;QAElE,OAAO,IAAI,CAAC;IACd,CAAC;;AAvIH,wBAwIC;AAvIQ;;;;WAAqB,QAAQ,CAAC,IAAI;GAAC","sourcesContent":["export enum LogLevel {\n VERBOSE = 5,\n DEBUG = 4,\n INFO = 3,\n WARN = 2,\n ERROR = 1,\n NONE = 0,\n}\n\n/**\n * Logger class provides static methods for logging at different levels such as error, warn, debug, info, and verbose. This class allows setting log levels and log filters to control the logging behavior.\n */\nexport class Logger {\n static logLevel: LogLevel = LogLevel.INFO;\n static logFilter?: string;\n\n /**\n * Sets the log level for logging purposes.\n *\n * @example\n * ```ts\n * import { Logger, LogLevel } from \"@aa-sdk/core\";\n * Logger.setLogLevel(LogLevel.DEBUG);\n * ```\n *\n * @param {LogLevel} logLevel The desired log level\n */\n static setLogLevel(logLevel: LogLevel) {\n this.logLevel = logLevel;\n }\n\n /**\n * Sets the log filter pattern.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.setLogFilter(\"error\");\n * ```\n *\n * @param {string} pattern The pattern to set as the log filter\n */\n static setLogFilter(pattern: string) {\n this.logFilter = pattern;\n }\n\n /**\n * Logs an error message to the console if the logging condition is met.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.error(\"An error occurred while processing the request\");\n * ```\n *\n * @param {string} msg The primary error message to be logged\n * @param {...any[]} args Additional arguments to be logged along with the error message\n */\n static error(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.ERROR)) return;\n\n console.error(msg, ...args);\n }\n\n /**\n * Logs a warning message if the logging conditions are met.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.warn(\"Careful...\");\n * ```\n *\n * @param {string} msg The message to log as a warning\n * @param {...any[]} args Additional parameters to log along with the message\n */\n static warn(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.WARN)) return;\n\n console.warn(msg, ...args);\n }\n\n /**\n * Logs a debug message to the console if the log level allows it.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.debug(\"Something is happening\");\n * ```\n *\n * @param {string} msg The message to log\n * @param {...any[]} args Additional arguments to pass to the console.debug method\n */\n static debug(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.DEBUG)) return;\n\n console.debug(msg, ...args);\n }\n\n /**\n * Logs an informational message to the console if the logging level is set to INFO.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.info(\"Something is happening\");\n * ```\n *\n * @param {string} msg the message to log\n * @param {...any[]} args additional arguments to log alongside the message\n */\n static info(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.INFO)) return;\n\n console.info(msg, ...args);\n }\n\n /**\n * Logs a message with additional arguments if the logging level permits it.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.verbose(\"Something is happening\");\n * ```\n *\n * @param {string} msg The message to log\n * @param {...any[]} args Additional arguments to be logged\n */\n static verbose(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.VERBOSE)) return;\n\n console.log(msg, ...args);\n }\n\n private static shouldLog(msg: string, level: LogLevel) {\n if (this.logLevel < level) return false;\n if (this.logFilter && !msg.includes(this.logFilter)) return false;\n\n return true;\n }\n}\n"]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.middlewareActions = void 0;
|
|
4
|
-
const viem_1 = require("viem");
|
|
5
|
-
const userop_js_1 = require("../utils/userop.js");
|
|
6
4
|
const feeEstimator_js_1 = require("./defaults/feeEstimator.js");
|
|
7
5
|
const gasEstimator_js_1 = require("./defaults/gasEstimator.js");
|
|
8
6
|
const paymasterAndData_js_1 = require("./defaults/paymasterAndData.js");
|
|
@@ -11,24 +9,10 @@ const noopMiddleware_js_1 = require("./noopMiddleware.js");
|
|
|
11
9
|
const middlewareActions = (overrides) => (client) => ({
|
|
12
10
|
middleware: {
|
|
13
11
|
customMiddleware: overrides.customMiddleware ?? noopMiddleware_js_1.noopMiddleware,
|
|
14
|
-
dummyPaymasterAndData: overrides.
|
|
15
|
-
? async (struct, { account }) => {
|
|
16
|
-
const data = overrides.paymasterAndData.dummyPaymasterAndData();
|
|
17
|
-
const paymasterOverrides = account.getEntryPoint().version === "0.7.0"
|
|
18
|
-
? (0, viem_1.isHex)(data)
|
|
19
|
-
? (0, userop_js_1.parsePaymasterAndData)(data)
|
|
20
|
-
: data
|
|
21
|
-
: {
|
|
22
|
-
paymasterAndData: (0, viem_1.isHex)(data)
|
|
23
|
-
? data
|
|
24
|
-
: (0, userop_js_1.concatPaymasterAndData)(data),
|
|
25
|
-
};
|
|
26
|
-
return { ...struct, ...paymasterOverrides };
|
|
27
|
-
}
|
|
28
|
-
: paymasterAndData_js_1.defaultPaymasterAndData,
|
|
12
|
+
dummyPaymasterAndData: overrides.dummyPaymasterAndData ?? paymasterAndData_js_1.defaultPaymasterAndData,
|
|
29
13
|
feeEstimator: overrides.feeEstimator ?? (0, feeEstimator_js_1.defaultFeeEstimator)(client),
|
|
30
14
|
gasEstimator: overrides.gasEstimator ?? (0, gasEstimator_js_1.defaultGasEstimator)(client),
|
|
31
|
-
paymasterAndData: overrides.paymasterAndData
|
|
15
|
+
paymasterAndData: overrides.paymasterAndData ?? paymasterAndData_js_1.defaultPaymasterAndData,
|
|
32
16
|
userOperationSimulator: overrides.userOperationSimulator ?? noopMiddleware_js_1.noopMiddleware,
|
|
33
17
|
signUserOperation: overrides.signUserOperation ?? userOpSigner_js_1.defaultUserOpSigner,
|
|
34
18
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/middleware/actions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/middleware/actions.ts"],"names":[],"mappings":";;;AAaA,gEAAiE;AACjE,gEAAiE;AACjE,wEAAyE;AACzE,gEAAiE;AACjE,2DAAqD;AA+B9C,MAAM,iBAAiB,GAC5B,CAAC,SAAiC,EAAE,EAAE,CACtC,CAOE,MAAsD,EACpB,EAAE,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,IAAI,kCAAc;QAC9D,qBAAqB,EACnB,SAAS,CAAC,qBAAqB,IAAI,6CAAuB;QAC5D,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,IAAA,qCAAmB,EAAC,MAAM,CAAC;QACnE,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,IAAA,qCAAmB,EAAC,MAAM,CAAC;QACnE,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,IAAI,6CAAuB;QACvE,sBAAsB,EACpB,SAAS,CAAC,sBAAsB,IAAI,kCAAc;QACpD,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,IAAI,qCAAmB;KACtE;CACF,CAAC,CAAC;AAtBQ,QAAA,iBAAiB,qBAsBzB","sourcesContent":["import {\n type Chain,\n type Client,\n type PublicActions,\n type PublicRpcSchema,\n type Transport,\n} from \"viem\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type {\n BundlerActions,\n BundlerRpcSchema,\n} from \"../client/decorators/bundlerClient.js\";\nimport type { ClientMiddlewareConfig } from \"../client/types.js\";\nimport { defaultFeeEstimator } from \"./defaults/feeEstimator.js\";\nimport { defaultGasEstimator } from \"./defaults/gasEstimator.js\";\nimport { defaultPaymasterAndData } from \"./defaults/paymasterAndData.js\";\nimport { defaultUserOpSigner } from \"./defaults/userOpSigner.js\";\nimport { noopMiddleware } from \"./noopMiddleware.js\";\nimport type { ClientMiddleware } from \"./types.js\";\n\n/**\n * Middleware client type\n *\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n */\nexport type MiddlewareClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = Client<\n TTransport,\n TChain,\n TAccount,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n PublicActions & BundlerActions\n>;\n\n/**\n * function that takes in ClientMiddlewareConfig used during client initiation\n * and returns the middleware actions object that the smart account client extends with\n *\n * @param {ClientMiddlewareConfig} overrides config used during client initiation for overriding default middlewares\n * @returns {(client: MiddlewareClient<TTransport, TChain, TAccount>) => { middleware: ClientMiddleware }} middleware actions object\n */\nexport const middlewareActions =\n (overrides: ClientMiddlewareConfig) =>\n <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n >(\n client: MiddlewareClient<TTransport, TChain, TAccount>\n ): { middleware: ClientMiddleware } => ({\n middleware: {\n customMiddleware: overrides.customMiddleware ?? noopMiddleware,\n dummyPaymasterAndData:\n overrides.dummyPaymasterAndData ?? defaultPaymasterAndData,\n feeEstimator: overrides.feeEstimator ?? defaultFeeEstimator(client),\n gasEstimator: overrides.gasEstimator ?? defaultGasEstimator(client),\n paymasterAndData: overrides.paymasterAndData ?? defaultPaymasterAndData,\n userOperationSimulator:\n overrides.userOperationSimulator ?? noopMiddleware,\n signUserOperation: overrides.signUserOperation ?? defaultUserOpSigner,\n },\n });\n"]}
|
|
@@ -17,8 +17,9 @@ const defaultGasEstimator = (client) => async (struct, { account, overrides, fee
|
|
|
17
17
|
const paymasterVerificationGasLimit = (0, userop_js_1.applyUserOpOverrideOrFeeOption)(estimates.paymasterVerificationGasLimit, overrides
|
|
18
18
|
?.paymasterVerificationGasLimit, feeOptions
|
|
19
19
|
?.paymasterVerificationGasLimit);
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const uo_v7 = struct;
|
|
21
|
+
uo_v7.paymasterVerificationGasLimit = paymasterVerificationGasLimit;
|
|
22
|
+
uo_v7.paymasterPostOpGasLimit = uo_v7.paymasterPostOpGasLimit ?? "0x0";
|
|
22
23
|
}
|
|
23
24
|
return struct;
|
|
24
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/gasEstimator.ts"],"names":[],"mappings":";;;AAKA,mDAAsE;AACtE,qDAAuE;AAYhE,MAAM,mBAAmB,GAG9B,CAAC,
|
|
1
|
+
{"version":3,"file":"gasEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/gasEstimator.ts"],"names":[],"mappings":";;;AAKA,mDAAsE;AACtE,qDAAuE;AAYhE,MAAM,mBAAmB,GAG9B,CAAC,MAAwB,EAAsB,EAAE,CACjD,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,IAAA,sBAAW,EAAC,MAAM,IAAA,4BAAiB,EAAC,MAAM,CAAC,CAAC,CAAC;IAE7D,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,wBAAwB,CACrD,OAAO,EACP,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,EAC/B,SAAS,EAAE,aAAa,CACzB,CAAC;IAEF,MAAM,YAAY,GAAG,IAAA,0CAA8B,EACjD,SAAS,CAAC,YAAY,EACtB,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;IACF,MAAM,oBAAoB,GAAG,IAAA,0CAA8B,EACzD,SAAS,CAAC,oBAAoB,EAC9B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,0CAA8B,EACvD,SAAS,CAAC,kBAAkB,EAC5B,SAAS,EAAE,kBAAkB,EAC7B,UAAU,EAAE,kBAAkB,CAC/B,CAAC;IAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,MAAM,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAE/C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,MAAM,6BAA6B,GAAG,IAAA,0CAA8B,EAClE,SAAS,CAAC,6BAA6B,EACtC,SAA6C;YAC5C,EAAE,6BAA6B,EAChC,UAA+C;YAC9C,EAAE,6BAA6B,CAClC,CAAC;QACF,MAAM,KAAK,GAAG,MAAsC,CAAC;QAErD,KAAK,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;QAEpE,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC,uBAAuB,IAAI,KAAK,CAAC;IACzE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlDS,QAAA,mBAAmB,uBAkD5B","sourcesContent":["import type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../types.js\";\nimport { deepHexlify, resolveProperties } from \"../../utils/index.js\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/userop.js\";\nimport type { MiddlewareClient } from \"../actions.js\";\nimport type { ClientMiddlewareFn } from \"../types.js\";\n\n/**\n * Description default gas estimator middleware for `SmartAccountClient`\n * You can override this middleware with your custom gas estimator middleware\n * by passing it to the client constructor\n *\n * @param {MiddlewareClient} client smart account client instance to apply the middleware to\n * @returns {ClientMiddlewareFn} middleware execution function used to estimate gas for user operations\n */\nexport const defaultGasEstimator: <C extends MiddlewareClient>(\n client: C\n) => ClientMiddlewareFn =\n (client: MiddlewareClient): ClientMiddlewareFn =>\n async (struct, { account, overrides, feeOptions }) => {\n const request = deepHexlify(await resolveProperties(struct));\n\n const estimates = await client.estimateUserOperationGas(\n request,\n account.getEntryPoint().address,\n overrides?.stateOverride\n );\n\n const callGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.callGasLimit,\n overrides?.callGasLimit,\n feeOptions?.callGasLimit\n );\n const verificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.verificationGasLimit,\n overrides?.verificationGasLimit,\n feeOptions?.verificationGasLimit\n );\n const preVerificationGas = applyUserOpOverrideOrFeeOption(\n estimates.preVerificationGas,\n overrides?.preVerificationGas,\n feeOptions?.preVerificationGas\n );\n\n struct.callGasLimit = callGasLimit;\n struct.verificationGasLimit = verificationGasLimit;\n struct.preVerificationGas = preVerificationGas;\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.7.0\") {\n const paymasterVerificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.paymasterVerificationGasLimit,\n (overrides as UserOperationOverrides<\"0.7.0\">)\n ?.paymasterVerificationGasLimit,\n (feeOptions as UserOperationFeeOptions<\"0.7.0\">)\n ?.paymasterVerificationGasLimit\n );\n const uo_v7 = struct as UserOperationStruct<\"0.7.0\">;\n\n uo_v7.paymasterVerificationGasLimit = paymasterVerificationGasLimit;\n\n uo_v7.paymasterPostOpGasLimit = uo_v7.paymasterPostOpGasLimit ?? \"0x0\";\n }\n\n return struct;\n };\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Address, type Chain, type Client, type Hex, type Transport } from "viem";
|
|
2
|
+
import type { ClientMiddlewareConfig } from "../client/types";
|
|
3
|
+
import type { EntryPointVersion } from "../entrypoint/types";
|
|
4
|
+
import type { UserOperationFeeOptions, UserOperationOverrides, UserOperationRequest, UserOperationStruct } from "../types";
|
|
5
|
+
import { type Deferrable } from "../utils/index.js";
|
|
6
|
+
export type Erc7677RpcSchema = [
|
|
7
|
+
{
|
|
8
|
+
Method: "pm_getPaymasterStubData";
|
|
9
|
+
Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];
|
|
10
|
+
ReturnType: {
|
|
11
|
+
sponsor?: {
|
|
12
|
+
name: string;
|
|
13
|
+
icon?: string;
|
|
14
|
+
};
|
|
15
|
+
paymaster?: Address;
|
|
16
|
+
paymasterData?: Hex;
|
|
17
|
+
paymasterVerificationGasLimit?: Hex;
|
|
18
|
+
paymasterPostOpGasLimit?: Hex;
|
|
19
|
+
paymasterAndData?: Hex;
|
|
20
|
+
isFinal?: boolean;
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
Method: "pm_getPaymasterData";
|
|
25
|
+
Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];
|
|
26
|
+
ReturnType: {
|
|
27
|
+
paymaster?: Address;
|
|
28
|
+
paymasterData?: Hex;
|
|
29
|
+
paymasterAndData?: Hex;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
export type Erc7677Client<T extends Transport = Transport> = Client<T, Chain, undefined, Erc7677RpcSchema>;
|
|
34
|
+
export type Erc7677MiddlewareParams<TContext extends Record<string, any> | undefined = Record<string, any> | undefined, TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
|
|
35
|
+
context?: ((struct: Deferrable<UserOperationStruct<TEntryPointVersion>>, args: {
|
|
36
|
+
overrides?: UserOperationOverrides<TEntryPointVersion>;
|
|
37
|
+
feeOptions?: UserOperationFeeOptions;
|
|
38
|
+
}) => Promise<TContext>) | TContext;
|
|
39
|
+
};
|
|
40
|
+
export declare function erc7677Middleware<TContext extends Record<string, any> | undefined = Record<string, any> | undefined>(params?: Erc7677MiddlewareParams<TContext>): Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.erc7677Middleware = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const client_js_1 = require("../errors/client.js");
|
|
6
|
+
const index_js_1 = require("../utils/index.js");
|
|
7
|
+
function erc7677Middleware(params) {
|
|
8
|
+
const dummyPaymasterAndData = async (uo, { client, account, feeOptions, overrides }) => {
|
|
9
|
+
const userOp = (0, index_js_1.deepHexlify)(await (0, index_js_1.resolveProperties)(uo));
|
|
10
|
+
userOp.maxFeePerGas = "0x0";
|
|
11
|
+
userOp.maxPriorityFeePerGas = "0x0";
|
|
12
|
+
userOp.callGasLimit = "0x0";
|
|
13
|
+
userOp.verificationGasLimit = "0x0";
|
|
14
|
+
userOp.preVerificationGas = "0x0";
|
|
15
|
+
const entrypoint = account.getEntryPoint();
|
|
16
|
+
if (entrypoint.version === "0.7.0") {
|
|
17
|
+
userOp.paymasterVerificationGasLimit = "0x0";
|
|
18
|
+
userOp.paymasterPostOpGasLimit = "0x0";
|
|
19
|
+
}
|
|
20
|
+
const context = (typeof params?.context === "function"
|
|
21
|
+
? await params?.context(userOp, { overrides, feeOptions })
|
|
22
|
+
: params?.context) ?? {};
|
|
23
|
+
if (!client.chain) {
|
|
24
|
+
throw new client_js_1.ChainNotFoundError();
|
|
25
|
+
}
|
|
26
|
+
const erc7677client = client;
|
|
27
|
+
const { paymaster, paymasterAndData, paymasterData, paymasterPostOpGasLimit, paymasterVerificationGasLimit, } = await erc7677client.request({
|
|
28
|
+
method: "pm_getPaymasterStubData",
|
|
29
|
+
params: [userOp, entrypoint.address, (0, viem_1.toHex)(client.chain.id), context],
|
|
30
|
+
});
|
|
31
|
+
if (entrypoint.version === "0.6.0") {
|
|
32
|
+
return {
|
|
33
|
+
...uo,
|
|
34
|
+
paymasterAndData,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...uo,
|
|
39
|
+
paymaster,
|
|
40
|
+
paymasterData,
|
|
41
|
+
paymasterPostOpGasLimit,
|
|
42
|
+
paymasterVerificationGasLimit,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const paymasterAndData = async (uo, { client, account, feeOptions, overrides }) => {
|
|
46
|
+
const userOp = (0, index_js_1.deepHexlify)(await (0, index_js_1.resolveProperties)(uo));
|
|
47
|
+
const context = (typeof params?.context === "function"
|
|
48
|
+
? await params?.context(userOp, { overrides, feeOptions })
|
|
49
|
+
: params?.context) ?? {};
|
|
50
|
+
if (!client.chain) {
|
|
51
|
+
throw new client_js_1.ChainNotFoundError();
|
|
52
|
+
}
|
|
53
|
+
const erc7677client = client;
|
|
54
|
+
const entrypoint = account.getEntryPoint();
|
|
55
|
+
const { paymaster, paymasterAndData, paymasterData } = await erc7677client.request({
|
|
56
|
+
method: "pm_getPaymasterData",
|
|
57
|
+
params: [userOp, entrypoint.address, (0, viem_1.toHex)(client.chain.id), context],
|
|
58
|
+
});
|
|
59
|
+
if (entrypoint.version === "0.6.0") {
|
|
60
|
+
return {
|
|
61
|
+
...uo,
|
|
62
|
+
paymasterAndData,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
...uo,
|
|
67
|
+
paymaster,
|
|
68
|
+
paymasterData,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
dummyPaymasterAndData,
|
|
73
|
+
paymasterAndData,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
exports.erc7677Middleware = erc7677Middleware;
|
|
77
|
+
//# sourceMappingURL=erc7677middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7677middleware.js","sourceRoot":"","sources":["../../../src/middleware/erc7677middleware.ts"],"names":[],"mappings":";;;AAAA,+BAOc;AAGd,mDAAyD;AAOzD,gDAI2B;AAyE3B,SAAgB,iBAAiB,CAK/B,MAA0C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AK,OAAO,EAAE,CAAC;YACnC,OAAO;gBACL,GAAG,EAAE;gBACL,gBAAgB;aACjB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,GAAG,EAAE;YACL,SAAS;YACT,aAAa;SACd,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,qBAAqB;QACrB,gBAAgB;KACjB,CAAC;AACJ,CAAC;AA1GD,8CA0GC","sourcesContent":["import {\n toHex,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];\n ReturnType: {\n sponsor?: { name: string; icon?: string }; // Sponsor info\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData\n };\n },\n {\n Method: \"pm_getPaymasterData\";\n Parameters: [UserOperationRequest, Address, Hex, Record<string, any>];\n ReturnType: {\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n };\n }\n];\n\nexport type Erc7677Client<T extends Transport = Transport> = Client<\n T,\n Chain,\n undefined,\n Erc7677RpcSchema\n>;\n\nexport type Erc7677MiddlewareParams<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n context?:\n | ((\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n feeOptions?: UserOperationFeeOptions;\n }\n ) => Promise<TContext>)\n | TContext;\n};\n\n/**\n * Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.\n * This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, erc7677Middleware } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context\n * ...erc7677Middleware(),\n * })\n * ```\n *\n * @param {Erc7677MiddlewareParams<TContext>} params Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data\n */\nexport function erc7677Middleware<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined\n>(\n params?: Erc7677MiddlewareParams<TContext>\n): Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\"> {\n const dummyPaymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n\n // Those values will be set after fee estimation.\n userOp.maxFeePerGas = \"0x0\";\n userOp.maxPriorityFeePerGas = \"0x0\";\n userOp.callGasLimit = \"0x0\";\n userOp.verificationGasLimit = \"0x0\";\n userOp.preVerificationGas = \"0x0\";\n\n const entrypoint = account.getEntryPoint();\n\n if (entrypoint.version === \"0.7.0\") {\n userOp.paymasterVerificationGasLimit = \"0x0\";\n userOp.paymasterPostOpGasLimit = \"0x0\";\n }\n\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n // TODO: probably need to handle the sponsor and isFinal fields\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterStubData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n };\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides }\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n\n const entrypoint = account.getEntryPoint();\n const { paymaster, paymasterAndData, paymasterData } =\n await erc7677client.request({\n method: \"pm_getPaymasterData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n };\n };\n\n return {\n dummyPaymasterAndData,\n paymasterAndData,\n };\n}\n"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { UserOperationContext } from "../actions/smartAccount/types";
|
|
1
2
|
import type { ClientMiddlewareFn } from "./types";
|
|
2
|
-
export declare const noopMiddleware: ClientMiddlewareFn
|
|
3
|
+
export declare const noopMiddleware: ClientMiddlewareFn<UserOperationContext | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noopMiddleware.js","sourceRoot":"","sources":["../../../src/middleware/noopMiddleware.ts"],"names":[],"mappings":";;;AASO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"noopMiddleware.js","sourceRoot":"","sources":["../../../src/middleware/noopMiddleware.ts"],"names":[],"mappings":";;;AASO,MAAM,cAAc,GAEvB,KAAK,EAAE,IAAI,EAAE,EAAE;IACjB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB","sourcesContent":["import type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\n/**\n * Noop middleware that does nothing and passes the arguments through\n *\n * @param {Deferrable<UserOperationStruct<TEntryPointVersion>>} args the client middleware arguments passed to the middleware\n * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} the arguments passed to the middleware and returned as is without modification\n */\nexport const noopMiddleware: ClientMiddlewareFn<\n UserOperationContext | undefined\n> = async (args) => {\n return args;\n};\n"]}
|
|
@@ -3,13 +3,14 @@ import type { UserOperationContext } from "../actions/smartAccount/types";
|
|
|
3
3
|
import type { UserOperationFeeOptions, UserOperationOverrides, UserOperationStruct } from "../types";
|
|
4
4
|
import type { Deferrable } from "../utils";
|
|
5
5
|
import type { MiddlewareClient } from "./actions";
|
|
6
|
-
export type
|
|
6
|
+
export type ClientMiddlewareArgs<TAccount extends SmartContractAccount, C extends MiddlewareClient, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = {
|
|
7
7
|
overrides?: UserOperationOverrides<TEntryPointVersion>;
|
|
8
8
|
context?: TContext;
|
|
9
9
|
feeOptions?: UserOperationFeeOptions;
|
|
10
10
|
account: TAccount;
|
|
11
11
|
client: C;
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export type ClientMiddlewareFn<TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = <TAccount extends SmartContractAccount, C extends MiddlewareClient, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(struct: Deferrable<UserOperationStruct<TEntryPointVersion>>, args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;
|
|
13
14
|
export type ClientMiddleware<TContext extends UserOperationContext | undefined = UserOperationContext | undefined> = {
|
|
14
15
|
dummyPaymasterAndData: ClientMiddlewareFn<TContext>;
|
|
15
16
|
feeEstimator: ClientMiddlewareFn<TContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args:
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/middleware/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../account/smartContractAccount\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../types\";\nimport type { Deferrable } from \"../utils\";\nimport type { MiddlewareClient } from \"./actions\";\n\nexport type ClientMiddlewareArgs<\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n context?: TContext;\n feeOptions?: UserOperationFeeOptions;\n account: TAccount;\n client: C;\n};\n\n// [!region ClientMiddlewareFn]\nexport type ClientMiddlewareFn<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = <\n TAccount extends SmartContractAccount,\n C extends MiddlewareClient,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>\n) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;\n// [!endregion ClientMiddlewareFn]\n\n// [!region ClientMiddleware]\nexport type ClientMiddleware<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n dummyPaymasterAndData: ClientMiddlewareFn<TContext>;\n feeEstimator: ClientMiddlewareFn<TContext>;\n gasEstimator: ClientMiddlewareFn<TContext>;\n customMiddleware: ClientMiddlewareFn<TContext>;\n paymasterAndData: ClientMiddlewareFn<TContext>;\n userOperationSimulator: ClientMiddlewareFn<TContext>;\n signUserOperation: ClientMiddlewareFn<TContext>;\n};\n// [!endregion ClientMiddleware]\n"]}
|