@aa-sdk/core 4.0.0-alpha.0 → 4.0.0-alpha.1

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.
Files changed (169) hide show
  1. package/dist/cjs/account/simple.js.map +1 -1
  2. package/dist/cjs/account/smartContractAccount.js +2 -1
  3. package/dist/cjs/account/smartContractAccount.js.map +1 -1
  4. package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +1 -1
  5. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  6. package/dist/cjs/actions/smartAccount/sendTransaction.js.map +1 -1
  7. package/dist/cjs/actions/smartAccount/sendTransactions.js.map +1 -1
  8. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  9. package/dist/cjs/client/bundlerClient.js.map +1 -1
  10. package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
  11. package/dist/cjs/client/decorators/smartAccountClient.js.map +1 -1
  12. package/dist/cjs/client/smartAccountClient.js.map +1 -1
  13. package/dist/cjs/ens/utils.js.map +1 -1
  14. package/dist/cjs/entrypoint/index.js.map +1 -1
  15. package/dist/cjs/errors/account.js.map +1 -1
  16. package/dist/cjs/errors/base.js.map +1 -1
  17. package/dist/cjs/errors/client.js.map +1 -1
  18. package/dist/cjs/errors/entrypoint.js.map +1 -1
  19. package/dist/cjs/errors/signer.js.map +1 -1
  20. package/dist/cjs/errors/transaction.js.map +1 -1
  21. package/dist/cjs/index.d.ts +2 -2
  22. package/dist/cjs/index.js +2 -4
  23. package/dist/cjs/index.js.map +1 -1
  24. package/dist/cjs/logger.js.map +1 -1
  25. package/dist/cjs/middleware/defaults/feeEstimator.d.ts +1 -1
  26. package/dist/cjs/middleware/defaults/feeEstimator.js +17 -15
  27. package/dist/cjs/middleware/defaults/feeEstimator.js.map +1 -1
  28. package/dist/cjs/middleware/defaults/paymasterAndData.js.map +1 -1
  29. package/dist/cjs/middleware/defaults/userOpSigner.js.map +1 -1
  30. package/dist/cjs/signer/local-account.js.map +1 -1
  31. package/dist/cjs/signer/schema.js.map +1 -1
  32. package/dist/cjs/signer/utils.d.ts +1 -9
  33. package/dist/cjs/signer/utils.js +1 -16
  34. package/dist/cjs/signer/utils.js.map +1 -1
  35. package/dist/cjs/signer/wallet-client.js.map +1 -1
  36. package/dist/cjs/utils/index.d.ts +0 -1
  37. package/dist/cjs/utils/index.js +1 -9
  38. package/dist/cjs/utils/index.js.map +1 -1
  39. package/dist/cjs/version.d.ts +1 -1
  40. package/dist/cjs/version.js +1 -1
  41. package/dist/cjs/version.js.map +1 -1
  42. package/dist/esm/account/simple.js.map +1 -1
  43. package/dist/esm/account/smartContractAccount.js +2 -1
  44. package/dist/esm/account/smartContractAccount.js.map +1 -1
  45. package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
  46. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  47. package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
  48. package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
  49. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  50. package/dist/esm/client/bundlerClient.js.map +1 -1
  51. package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
  52. package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
  53. package/dist/esm/client/smartAccountClient.js.map +1 -1
  54. package/dist/esm/ens/utils.js.map +1 -1
  55. package/dist/esm/entrypoint/index.js.map +1 -1
  56. package/dist/esm/errors/account.js.map +1 -1
  57. package/dist/esm/errors/base.js.map +1 -1
  58. package/dist/esm/errors/client.js.map +1 -1
  59. package/dist/esm/errors/entrypoint.js.map +1 -1
  60. package/dist/esm/errors/signer.js.map +1 -1
  61. package/dist/esm/errors/transaction.js.map +1 -1
  62. package/dist/esm/index.d.ts +2 -2
  63. package/dist/esm/index.js +2 -2
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/esm/logger.js.map +1 -1
  66. package/dist/esm/middleware/defaults/feeEstimator.d.ts +1 -1
  67. package/dist/esm/middleware/defaults/feeEstimator.js +17 -15
  68. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
  69. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
  70. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
  71. package/dist/esm/signer/local-account.js.map +1 -1
  72. package/dist/esm/signer/schema.js.map +1 -1
  73. package/dist/esm/signer/utils.d.ts +1 -9
  74. package/dist/esm/signer/utils.js +0 -14
  75. package/dist/esm/signer/utils.js.map +1 -1
  76. package/dist/esm/signer/wallet-client.js.map +1 -1
  77. package/dist/esm/utils/index.d.ts +0 -1
  78. package/dist/esm/utils/index.js +0 -7
  79. package/dist/esm/utils/index.js.map +1 -1
  80. package/dist/esm/version.d.ts +1 -1
  81. package/dist/esm/version.js +1 -1
  82. package/dist/esm/version.js.map +1 -1
  83. package/dist/types/account/smartContractAccount.d.ts +49 -0
  84. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  85. package/dist/types/actions/smartAccount/buildUserOperation.d.ts +23 -0
  86. package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -1
  87. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
  88. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
  89. package/dist/types/actions/smartAccount/sendTransaction.d.ts +24 -0
  90. package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
  91. package/dist/types/actions/smartAccount/sendTransactions.d.ts +23 -0
  92. package/dist/types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
  93. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
  94. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts.map +1 -1
  95. package/dist/types/client/bundlerClient.d.ts +15 -0
  96. package/dist/types/client/bundlerClient.d.ts.map +1 -1
  97. package/dist/types/client/decorators/bundlerClient.d.ts +9 -0
  98. package/dist/types/client/decorators/bundlerClient.d.ts.map +1 -1
  99. package/dist/types/client/decorators/smartAccountClient.d.ts +8 -0
  100. package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
  101. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  102. package/dist/types/ens/utils.d.ts +45 -0
  103. package/dist/types/ens/utils.d.ts.map +1 -1
  104. package/dist/types/entrypoint/index.d.ts +14 -0
  105. package/dist/types/entrypoint/index.d.ts.map +1 -1
  106. package/dist/types/errors/account.d.ts +34 -0
  107. package/dist/types/errors/account.d.ts.map +1 -1
  108. package/dist/types/errors/base.d.ts +5 -0
  109. package/dist/types/errors/base.d.ts.map +1 -1
  110. package/dist/types/errors/client.d.ts +9 -0
  111. package/dist/types/errors/client.d.ts.map +1 -1
  112. package/dist/types/errors/entrypoint.d.ts +6 -0
  113. package/dist/types/errors/entrypoint.d.ts.map +1 -1
  114. package/dist/types/errors/signer.d.ts +3 -0
  115. package/dist/types/errors/signer.d.ts.map +1 -1
  116. package/dist/types/errors/transaction.d.ts +6 -0
  117. package/dist/types/errors/transaction.d.ts.map +1 -1
  118. package/dist/types/index.d.ts +2 -2
  119. package/dist/types/index.d.ts.map +1 -1
  120. package/dist/types/logger.d.ts +3 -0
  121. package/dist/types/logger.d.ts.map +1 -1
  122. package/dist/types/middleware/defaults/feeEstimator.d.ts +21 -1
  123. package/dist/types/middleware/defaults/feeEstimator.d.ts.map +1 -1
  124. package/dist/types/middleware/defaults/paymasterAndData.d.ts +8 -0
  125. package/dist/types/middleware/defaults/paymasterAndData.d.ts.map +1 -1
  126. package/dist/types/middleware/defaults/userOpSigner.d.ts +10 -0
  127. package/dist/types/middleware/defaults/userOpSigner.d.ts.map +1 -1
  128. package/dist/types/signer/local-account.d.ts +3 -0
  129. package/dist/types/signer/local-account.d.ts.map +1 -1
  130. package/dist/types/signer/schema.d.ts +14 -0
  131. package/dist/types/signer/schema.d.ts.map +1 -1
  132. package/dist/types/signer/utils.d.ts +21 -9
  133. package/dist/types/signer/utils.d.ts.map +1 -1
  134. package/dist/types/signer/wallet-client.d.ts +3 -0
  135. package/dist/types/signer/wallet-client.d.ts.map +1 -1
  136. package/dist/types/utils/index.d.ts +54 -1
  137. package/dist/types/utils/index.d.ts.map +1 -1
  138. package/dist/types/version.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/src/account/simple.ts +6 -0
  141. package/src/account/smartContractAccount.ts +120 -15
  142. package/src/actions/smartAccount/buildUserOperation.ts +23 -0
  143. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +22 -0
  144. package/src/actions/smartAccount/sendTransaction.ts +24 -0
  145. package/src/actions/smartAccount/sendTransactions.ts +23 -0
  146. package/src/actions/smartAccount/waitForUserOperationTransacation.ts +24 -0
  147. package/src/client/bundlerClient.ts +32 -0
  148. package/src/client/decorators/bundlerClient.ts +9 -0
  149. package/src/client/decorators/smartAccountClient.ts +8 -0
  150. package/src/client/smartAccountClient.ts +41 -0
  151. package/src/ens/utils.ts +45 -0
  152. package/src/entrypoint/index.ts +30 -62
  153. package/src/errors/account.ts +34 -0
  154. package/src/errors/base.ts +5 -2
  155. package/src/errors/client.ts +9 -0
  156. package/src/errors/entrypoint.ts +6 -0
  157. package/src/errors/signer.ts +3 -0
  158. package/src/errors/transaction.ts +6 -0
  159. package/src/index.ts +1 -5
  160. package/src/logger.ts +3 -0
  161. package/src/middleware/defaults/feeEstimator.ts +24 -4
  162. package/src/middleware/defaults/paymasterAndData.ts +8 -0
  163. package/src/middleware/defaults/userOpSigner.ts +10 -0
  164. package/src/signer/local-account.ts +3 -0
  165. package/src/signer/schema.ts +14 -0
  166. package/src/signer/utils.ts +20 -32
  167. package/src/signer/wallet-client.ts +3 -0
  168. package/src/utils/index.ts +54 -13
  169. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAEtC,MAAa,uBAAwB,SAAQ,mBAAS;IAEpD,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;QAPK;;;;mBAAO,yBAAyB;WAAC;IAQ1C,CAAC;CACF;AAVD,0DAUC;AAED,MAAa,kBAAmB,SAAQ,mBAAS;IAE/C,YAAY,MAAe;QACzB,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAF5B;;;;mBAAO,oBAAoB;WAAC;IAGrC,CAAC;CACF;AALD,gDAKC;AAED,MAAa,kBAAmB,SAAQ,mBAAS;IAE/C;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAFlC;;;;mBAAO,oBAAoB;WAAC;IAGrC,CAAC;CACF;AALD,gDAKC","sourcesContent":["import type { Client } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\nexport class IncompatibleClientError extends BaseError {\n override name = \"IncompatibleClientError\";\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\nexport class InvalidRpcUrlError extends BaseError {\n override name = \"InvalidRpcUrlError\";\n constructor(rpcUrl?: string) {\n super(`Invalid RPC URL ${rpcUrl}`);\n }\n}\n\nexport class ChainNotFoundError extends BaseError {\n override name = \"ChainNotFoundError\";\n constructor() {\n super(\"No chain supplied to the client\");\n }\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/errors/client.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,uBAAwB,SAAQ,mBAAS;IAEpD,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;QAPK;;;;mBAAO,yBAAyB;WAAC;IAQ1C,CAAC;CACF;AAVD,0DAUC;AAKD,MAAa,kBAAmB,SAAQ,mBAAS;IAE/C,YAAY,MAAe;QACzB,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAF5B;;;;mBAAO,oBAAoB;WAAC;IAGrC,CAAC;CACF;AALD,gDAKC;AAKD,MAAa,kBAAmB,SAAQ,mBAAS;IAE/C;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAFlC;;;;mBAAO,oBAAoB;WAAC;IAGrC,CAAC;CACF;AALD,gDAKC","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 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 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 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;AAEtC,MAAa,uBAAwB,SAAQ,mBAAS;IAGpD,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;QARK;;;;mBAAO,yBAAyB;WAAC;IAS1C,CAAC;CACF;AAXD,0DAWC;AAED,MAAa,sBAAuB,SAAQ,mBAAS;IAGnD,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH,2CAA2C,iBAAiB,QAAQ,KAAK,CAAC,IAAI,GAAG,CAClF,CAAC;QALK;;;;mBAAO,wBAAwB;WAAC;IAMzC,CAAC;CACF;AARD,wDAQC","sourcesContent":["import type { Chain } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\nexport class EntryPointNotFoundError extends BaseError {\n override name = \"EntryPointNotFoundError\";\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\nexport class InvalidEntryPointError extends BaseError {\n override name = \"InvalidEntryPointError\";\n\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n `Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`\n );\n }\n}\n"]}
1
+ {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../src/errors/entrypoint.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,uBAAwB,SAAQ,mBAAS;IAGpD,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;QARK;;;;mBAAO,yBAAyB;WAAC;IAS1C,CAAC;CACF;AAXD,0DAWC;AAKD,MAAa,sBAAuB,SAAQ,mBAAS;IAGnD,YAAY,KAAY,EAAE,iBAAsB;QAC9C,KAAK,CACH,2CAA2C,iBAAiB,QAAQ,KAAK,CAAC,IAAI,GAAG,CAClF,CAAC;QALK;;;;mBAAO,wBAAwB;WAAC;IAMzC,CAAC;CACF;AARD,wDAQC","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 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 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;AAEtC,MAAa,sBAAuB,SAAQ,mBAAS;IAEnD,YAAY,UAAmB;QAC7B,KAAK,CACH;YACE,6DAA6D;YAC7D,UAAU,IAAI,gCAAgC;SAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAPK;;;;mBAAO,wBAAwB;WAAC;IAQzC,CAAC;CACF;AAVD,wDAUC","sourcesContent":["import { BaseError } from \"./base.js\";\n\nexport class InvalidSignerTypeError extends BaseError {\n override name = \"InvalidSignerTypeError\";\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
+ {"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../src/errors/signer.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAKtC,MAAa,sBAAuB,SAAQ,mBAAS;IAEnD,YAAY,UAAmB;QAC7B,KAAK,CACH;YACE,6DAA6D;YAC7D,UAAU,IAAI,gCAAgC;SAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAPK;;;;mBAAO,wBAAwB;WAAC;IAQzC,CAAC;CACF;AAVD,wDAUC","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 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;AAEtC,MAAa,8BAA+B,SAAQ,mBAAS;IAE3D;QACE,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAFrD;;;;mBAAO,gCAAgC;WAAC;IAGjD,CAAC;CACF;AALD,wEAKC;AAED,MAAa,4BAA6B,SAAQ,mBAAS;IAEzD,YAAY,IAAS;QACnB,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;QAFxD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AALD,oEAKC","sourcesContent":["import type { Hex } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\nexport class TransactionMissingToParamError extends BaseError {\n override name = \"TransactionMissingToParamError\";\n constructor() {\n super(\"Transaction is missing `to` address set on request\");\n }\n}\n\nexport class FailedToFindTransactionError extends BaseError {\n override name = \"FailedToFindTransactionError\";\n constructor(hash: Hex) {\n super(`Failed to find transaction for user operation ${hash}`);\n }\n}\n"]}
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/errors/transaction.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAKtC,MAAa,8BAA+B,SAAQ,mBAAS;IAE3D;QACE,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAFrD;;;;mBAAO,gCAAgC;WAAC;IAGjD,CAAC;CACF;AALD,wEAKC;AAKD,MAAa,4BAA6B,SAAQ,mBAAS;IAEzD,YAAY,IAAS;QACnB,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;QAFxD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AALD,oEAKC","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 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 constructor(hash: Hex) {\n super(`Failed to find transaction for user operation ${hash}`);\n }\n}\n"]}
@@ -55,9 +55,9 @@ export type * from "./middleware/types.js";
55
55
  export { LocalAccountSigner } from "./signer/local-account.js";
56
56
  export { SignerSchema, isSigner } from "./signer/schema.js";
57
57
  export type { SmartAccountAuthenticator, SmartAccountSigner, } from "./signer/types.js";
58
- export { verifyEIP6492Signature, wrapSignatureWith6492, } from "./signer/utils.js";
58
+ export { wrapSignatureWith6492 } from "./signer/utils.js";
59
59
  export { WalletClientSigner } from "./signer/wallet-client.js";
60
60
  export { split, type SplitTransportParams } from "./transport/split.js";
61
61
  export type * from "./types.js";
62
62
  export type * from "./utils/index.js";
63
- export { AlchemyChainMap, BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, defineReadOnly, filterUndefined, getChain, getDefaultSimpleAccountFactoryAddress, getDefaultUserOperationFeeOptions, isBigNumberish, isMultiplier, isValidRequest, parsePaymasterAndData, pick, resolveProperties, takeBytes, toRecord, } from "./utils/index.js";
63
+ export { AlchemyChainMap, BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, filterUndefined, getChain, getDefaultSimpleAccountFactoryAddress, getDefaultUserOperationFeeOptions, isBigNumberish, isMultiplier, isValidRequest, parsePaymasterAndData, pick, resolveProperties, takeBytes, toRecord, } from "./utils/index.js";
package/dist/cjs/index.js CHANGED
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.convertChainIdToCoinType = exports.createSmartAccountClientFromExisting = exports.createSmartAccountClient = exports.SmartAccountClientOptsSchema = exports.ConnectionConfigSchema = exports.isSmartAccountClient = exports.smartAccountClientActions = exports.bundlerActions = exports.createBundlerClientFromExisting = exports.createBundlerClient = exports.zoraSepolia = exports.zora = exports.sepolia = exports.polygonMumbai = exports.polygonAmoy = exports.polygon = exports.optimismSepolia = exports.optimismGoerli = exports.optimism = exports.mainnet = exports.goerli = exports.fraxtalSepolia = exports.fraxtal = exports.baseSepolia = exports.baseGoerli = exports.base = exports.arbitrumSepolia = exports.arbitrumGoerli = exports.arbitrum = 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.createSimpleSmartAccount = exports.BaseSmartContractAccount = exports.SimpleAccountFactoryAbi = exports.SimpleAccountAbi_v7 = exports.SimpleAccountAbi_v6 = exports.EntryPointAbi_v7 = exports.EntryPointAbi_v6 = exports.chains = void 0;
27
- exports.allEqual = exports.MultiplierSchema = exports.HexSchema = exports.ChainSchema = exports.BigNumberishSchema = exports.BigNumberishRangeSchema = exports.AlchemyChainMap = exports.split = exports.WalletClientSigner = exports.wrapSignatureWith6492 = exports.verifyEIP6492Signature = exports.isSigner = exports.SignerSchema = exports.LocalAccountSigner = exports.noopMiddleware = 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 = 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 = void 0;
28
- exports.toRecord = exports.takeBytes = exports.resolveProperties = exports.pick = exports.parsePaymasterAndData = exports.isValidRequest = exports.isMultiplier = exports.isBigNumberish = exports.getDefaultUserOperationFeeOptions = exports.getDefaultSimpleAccountFactoryAddress = exports.getChain = exports.filterUndefined = exports.defineReadOnly = exports.deepHexlify = exports.concatPaymasterAndData = exports.bypassPaymasterAndDataEmptyHex = exports.bypassPaymasterAndData = exports.bigIntMultiply = exports.bigIntMax = exports.asyncPipe = exports.applyUserOpOverrideOrFeeOption = exports.applyUserOpOverride = exports.applyUserOpFeeOption = void 0;
27
+ exports.applyUserOpFeeOption = exports.allEqual = exports.MultiplierSchema = exports.HexSchema = exports.ChainSchema = exports.BigNumberishSchema = exports.BigNumberishRangeSchema = exports.AlchemyChainMap = exports.split = exports.WalletClientSigner = exports.wrapSignatureWith6492 = exports.isSigner = exports.SignerSchema = exports.LocalAccountSigner = exports.noopMiddleware = 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 = 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 = void 0;
28
+ exports.toRecord = exports.takeBytes = exports.resolveProperties = exports.pick = exports.parsePaymasterAndData = exports.isValidRequest = exports.isMultiplier = exports.isBigNumberish = exports.getDefaultUserOperationFeeOptions = exports.getDefaultSimpleAccountFactoryAddress = exports.getChain = exports.filterUndefined = exports.deepHexlify = exports.concatPaymasterAndData = exports.bypassPaymasterAndDataEmptyHex = exports.bypassPaymasterAndData = exports.bigIntMultiply = exports.bigIntMax = exports.asyncPipe = exports.applyUserOpOverrideOrFeeOption = exports.applyUserOpOverride = void 0;
29
29
  exports.chains = __importStar(require("viem/chains"));
30
30
  var EntryPointAbi_v6_js_1 = require("./abis/EntryPointAbi_v6.js");
31
31
  Object.defineProperty(exports, "EntryPointAbi_v6", { enumerable: true, get: function () { return EntryPointAbi_v6_js_1.EntryPointAbi_v6; } });
@@ -158,7 +158,6 @@ var schema_js_2 = require("./signer/schema.js");
158
158
  Object.defineProperty(exports, "SignerSchema", { enumerable: true, get: function () { return schema_js_2.SignerSchema; } });
159
159
  Object.defineProperty(exports, "isSigner", { enumerable: true, get: function () { return schema_js_2.isSigner; } });
160
160
  var utils_js_2 = require("./signer/utils.js");
161
- Object.defineProperty(exports, "verifyEIP6492Signature", { enumerable: true, get: function () { return utils_js_2.verifyEIP6492Signature; } });
162
161
  Object.defineProperty(exports, "wrapSignatureWith6492", { enumerable: true, get: function () { return utils_js_2.wrapSignatureWith6492; } });
163
162
  var wallet_client_js_1 = require("./signer/wallet-client.js");
164
163
  Object.defineProperty(exports, "WalletClientSigner", { enumerable: true, get: function () { return wallet_client_js_1.WalletClientSigner; } });
@@ -182,7 +181,6 @@ Object.defineProperty(exports, "bypassPaymasterAndData", { enumerable: true, get
182
181
  Object.defineProperty(exports, "bypassPaymasterAndDataEmptyHex", { enumerable: true, get: function () { return index_js_3.bypassPaymasterAndDataEmptyHex; } });
183
182
  Object.defineProperty(exports, "concatPaymasterAndData", { enumerable: true, get: function () { return index_js_3.concatPaymasterAndData; } });
184
183
  Object.defineProperty(exports, "deepHexlify", { enumerable: true, get: function () { return index_js_3.deepHexlify; } });
185
- Object.defineProperty(exports, "defineReadOnly", { enumerable: true, get: function () { return index_js_3.defineReadOnly; } });
186
184
  Object.defineProperty(exports, "filterUndefined", { enumerable: true, get: function () { return index_js_3.filterUndefined; } });
187
185
  Object.defineProperty(exports, "getChain", { enumerable: true, get: function () { return index_js_3.getChain; } });
188
186
  Object.defineProperty(exports, "getDefaultSimpleAccountFactoryAddress", { enumerable: true, get: function () { return index_js_3.getDefaultSimpleAccountFactoryAddress; } });
@@ -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,uHAAA,gBAAgB,OAAA;AACzB,wEAAoE;AAA3D,6HAAA,mBAAmB,OAAA;AAC5B,wEAAoE;AAA3D,6HAAA,mBAAmB,OAAA;AAC5B,gFAA4E;AAAnE,qIAAA,uBAAuB,OAAA;AAChC,6CAA6D;AAApD,mHAAA,wBAAwB,OAAA;AACjC,iDAA+D;AAAtD,qHAAA,wBAAwB,OAAA;AAGjC,6EAK2C;AAJzC,4HAAA,iBAAiB,OAAA;AACjB,mIAAA,wBAAwB,OAAA;AACxB,iJAAA,sCAAsC,OAAA;AACtC,iIAAA,sBAAsB,OAAA;AAMxB,sFAAkF;AAAzE,2HAAA,kBAAkB,OAAA;AAC3B,kGAA8F;AAArF,uIAAA,wBAAwB,OAAA;AACjC,oGAAgG;AAAvF,yIAAA,yBAAyB,OAAA;AAClC,8GAA0G;AAAjG,mJAAA,8BAA8B,OAAA;AACvC,wGAAoG;AAA3F,6IAAA,2BAA2B,OAAA;AACpC,gFAA4E;AAAnE,qHAAA,eAAe,OAAA;AACxB,kFAA8E;AAArE,uHAAA,gBAAgB,OAAA;AACzB,oFAAgF;AAAvE,yHAAA,iBAAiB,OAAA;AAE1B,kHAA6G;AAApG,sJAAA,+BAA+B,OAAA;AACxC,8CAoB2B;AAnBzB,oGAAA,QAAQ,OAAA;AACR,0GAAA,cAAc,OAAA;AACd,2GAAA,eAAe,OAAA;AACf,gGAAA,IAAI,OAAA;AACJ,sGAAA,UAAU,OAAA;AACV,uGAAA,WAAW,OAAA;AACX,mGAAA,OAAO,OAAA;AACP,0GAAA,c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B,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,0GAAA,cAAc,OAAA;AACd,2GAAA,eAAe,OAAA;AACf,oGAAA,QAAQ,OAAA;AACR,iIAAA,qCAAqC,OAAA;AACrC,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 { BaseSmartContractAccount } from \"./account/base.js\";\nexport { createSimpleSmartAccount } from \"./account/simple.js\";\nexport type { SimpleSmartAccount } from \"./account/simple.js\";\nexport type * from \"./account/smartContractAccount.js\";\nexport {\n getAccountAddress,\n isSmartAccountWithSigner,\n parseFactoryAddressFromAccountInitCode,\n toSmartContractAccount,\n} from \"./account/smartContractAccount.js\";\nexport type {\n BaseSmartAccountParams,\n SignTypedDataParams,\n} from \"./account/types.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 {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"./chains/index.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 { 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 {\n verifyEIP6492Signature,\n wrapSignatureWith6492,\n} 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 AlchemyChainMap,\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 defineReadOnly,\n filterUndefined,\n getChain,\n getDefaultSimpleAccountFactoryAddress,\n getDefaultUserOperationFeeOptions,\n isBigNumberish,\n isMultiplier,\n isValidRequest,\n parsePaymasterAndData,\n pick,\n resolveProperties,\n takeBytes,\n toRecord,\n} from \"./utils/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sDAAsC;AAEtC,kEAA8D;AAArD,uHAAA,gBAAgB,OAAA;AACzB,kEAA8D;AAArD,uHAAA,gBAAgB,OAAA;AACzB,wEAAoE;AAA3D,6HAAA,mBAAmB,OAAA;AAC5B,wEAAoE;AAA3D,6HAAA,mBAAmB,OAAA;AAC5B,gFAA4E;AAAnE,qIAAA,uBAAuB,OAAA;AAChC,6CAA6D;AAApD,mHAAA,wBAAwB,OAAA;AACjC,iDAA+D;AAAtD,qHAAA,wBAAwB,OAAA;AAGjC,6EAK2C;AAJzC,4HAAA,iBAAiB,OAAA;AACjB,mIAAA,wBAAwB,OAAA;AACxB,iJAAA,sCAAsC,OAAA;AACtC,iIAAA,sBAAsB,OAAA;AAMxB,sFAAkF;AAAzE,2HAAA,kBAAkB,OAAA;AAC3B,kGAA8F;AAArF,uIAAA,wBAAwB,OAAA;AACjC,oGAAgG;AAAvF,yIAAA,yBAAyB,OAAA;AAClC,8GAA0G;AAAjG,mJAAA,8BAA8B,OAAA;AACvC,wGAAoG;AAA3F,6IAAA,2BAA2B,OAAA;AACpC,gFAA4E;AAAnE,qHAAA,eAAe,OAAA;AACxB,kFAA8E;AAArE,uHAAA,gBAAgB,OAAA;AACzB,oFAAgF;AAAv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AACf,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,oGAAA,QAAQ,OAAA;AACR,iIAAA,qCAAqC,OAAA;AACrC,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 { BaseSmartContractAccount } from \"./account/base.js\";\nexport { createSimpleSmartAccount } from \"./account/simple.js\";\nexport type { SimpleSmartAccount } from \"./account/simple.js\";\nexport type * from \"./account/smartContractAccount.js\";\nexport {\n getAccountAddress,\n isSmartAccountWithSigner,\n parseFactoryAddressFromAccountInitCode,\n toSmartContractAccount,\n} from \"./account/smartContractAccount.js\";\nexport type {\n BaseSmartAccountParams,\n SignTypedDataParams,\n} from \"./account/types.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 {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"./chains/index.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 { 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 AlchemyChainMap,\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 getChain,\n getDefaultSimpleAccountFactoryAddress,\n getDefaultUserOperationFeeOptions,\n isBigNumberish,\n isMultiplier,\n isValidRequest,\n parsePaymasterAndData,\n pick,\n resolveProperties,\n takeBytes,\n toRecord,\n} from \"./utils/index.js\";\n"]}
@@ -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;AAED,MAAa,MAAM;IAIjB,MAAM,CAAC,WAAW,CAAC,QAAkB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,OAAe;QACjC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAW,EAAE,GAAG,IAAW;QACtC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO;QAEjD,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,I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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\nexport class Logger {\n static logLevel: LogLevel = LogLevel.INFO;\n static logFilter?: string;\n\n static setLogLevel(logLevel: LogLevel) {\n this.logLevel = logLevel;\n }\n\n static setLogFilter(pattern: string) {\n this.logFilter = pattern;\n }\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 static warn(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.WARN)) return;\n\n console.warn(msg, ...args);\n }\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 static info(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.INFO)) return;\n\n console.info(msg, ...args);\n }\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
+ {"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;IAIjB,MAAM,CAAC,WAAW,CAAC,QAAkB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,OAAe;QACjC,IAAI,CAAC,S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,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;;AA/CH,wBAgDC;AA/CQ;;;;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 static setLogLevel(logLevel: LogLevel) {\n this.logLevel = logLevel;\n }\n\n static setLogFilter(pattern: string) {\n this.logFilter = pattern;\n }\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 static warn(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.WARN)) return;\n\n console.warn(msg, ...args);\n }\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 static info(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.INFO)) return;\n\n console.info(msg, ...args);\n }\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,3 +1,3 @@
1
1
  import type { MiddlewareClient } from "../actions";
2
2
  import type { ClientMiddlewareFn } from "../types";
3
- export declare const defaultFeeEstimator: <C extends MiddlewareClient>(client: C) => ClientMiddlewareFn;
3
+ export declare function defaultFeeEstimator<C extends MiddlewareClient>(client: C): ClientMiddlewareFn;
@@ -2,20 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultFeeEstimator = void 0;
4
4
  const index_js_1 = require("../../utils/index.js");
5
- const defaultFeeEstimator = (client) => async (struct, { overrides, feeOptions }) => {
6
- const feeData = await client.estimateFeesPerGas();
7
- if (!feeData.maxFeePerGas || feeData.maxPriorityFeePerGas == null) {
8
- throw new Error("feeData is missing maxFeePerGas or maxPriorityFeePerGas");
9
- }
10
- let maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas();
11
- maxPriorityFeePerGas = (0, index_js_1.applyUserOpOverrideOrFeeOption)(maxPriorityFeePerGas, overrides?.maxPriorityFeePerGas, feeOptions?.maxPriorityFeePerGas);
12
- let maxFeePerGas = feeData.maxFeePerGas -
13
- feeData.maxPriorityFeePerGas +
14
- BigInt(maxPriorityFeePerGas);
15
- maxFeePerGas = (0, index_js_1.applyUserOpOverrideOrFeeOption)(maxFeePerGas, overrides?.maxFeePerGas, feeOptions?.maxFeePerGas);
16
- struct.maxFeePerGas = maxFeePerGas;
17
- struct.maxPriorityFeePerGas = maxPriorityFeePerGas;
18
- return struct;
19
- };
5
+ function defaultFeeEstimator(client) {
6
+ return async (struct, { overrides, feeOptions }) => {
7
+ const feeData = await client.estimateFeesPerGas();
8
+ if (!feeData.maxFeePerGas || feeData.maxPriorityFeePerGas == null) {
9
+ throw new Error("feeData is missing maxFeePerGas or maxPriorityFeePerGas");
10
+ }
11
+ let maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas();
12
+ maxPriorityFeePerGas = (0, index_js_1.applyUserOpOverrideOrFeeOption)(maxPriorityFeePerGas, overrides?.maxPriorityFeePerGas, feeOptions?.maxPriorityFeePerGas);
13
+ let maxFeePerGas = feeData.maxFeePerGas -
14
+ feeData.maxPriorityFeePerGas +
15
+ BigInt(maxPriorityFeePerGas);
16
+ maxFeePerGas = (0, index_js_1.applyUserOpOverrideOrFeeOption)(maxFeePerGas, overrides?.maxFeePerGas, feeOptions?.maxFeePerGas);
17
+ struct.maxFeePerGas = maxFeePerGas;
18
+ struct.maxPriorityFeePerGas = maxPriorityFeePerGas;
19
+ return struct;
20
+ };
21
+ }
20
22
  exports.defaultFeeEstimator = defaultFeeEstimator;
21
23
  //# sourceMappingURL=feeEstimator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/feeEstimator.ts"],"names":[],"mappings":";;;AACA,mDAAsE;AAI/D,MAAM,mBAAmB,GAG9B,CAAC,MAAM,EAAE,EAAE,CACX,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IAU1C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAClD,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,oBAAoB,IAAI,IAAI,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,IAAI,oBAAoB,GACtB,MAAM,MAAM,CAAC,4BAA4B,EAAE,CAAC;IAE9C,oBAAoB,GAAG,IAAA,yCAA8B,EACnD,oBAAoB,EACpB,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IAEF,IAAI,YAAY,GACd,OAAO,CAAC,YAAY;QACpB,OAAO,CAAC,oBAAoB;QAC5B,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAE/B,YAAY,GAAG,IAAA,yCAA8B,EAC3C,YAAY,EACZ,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;IAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA5CS,QAAA,mBAAmB,uBA4C5B","sourcesContent":["import type { BigNumberish } from \"../../types\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/index.js\";\nimport type { MiddlewareClient } from \"../actions\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\nexport const defaultFeeEstimator: <C extends MiddlewareClient>(\n client: C\n) => ClientMiddlewareFn =\n (client) =>\n async (struct, { overrides, feeOptions }) => {\n // maxFeePerGas must be at least the sum of maxPriorityFeePerGas and baseFee\n // so we need to accommodate for the fee option applied maxPriorityFeePerGas for the maxFeePerGas\n //\n // Note that if maxFeePerGas is not at least the sum of maxPriorityFeePerGas and required baseFee\n // after applying the fee options, then the transaction will fail\n //\n // Refer to https://docs.alchemy.com/docs/maxpriorityfeepergas-vs-maxfeepergas\n // for more information about maxFeePerGas and maxPriorityFeePerGas\n\n const feeData = await client.estimateFeesPerGas();\n if (!feeData.maxFeePerGas || feeData.maxPriorityFeePerGas == null) {\n throw new Error(\n \"feeData is missing maxFeePerGas or maxPriorityFeePerGas\"\n );\n }\n\n let maxPriorityFeePerGas: BigNumberish =\n await client.estimateMaxPriorityFeePerGas();\n\n maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGas,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas\n );\n\n let maxFeePerGas: BigNumberish =\n feeData.maxFeePerGas -\n feeData.maxPriorityFeePerGas +\n BigInt(maxPriorityFeePerGas);\n\n maxFeePerGas = applyUserOpOverrideOrFeeOption(\n maxFeePerGas,\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas\n );\n\n struct.maxFeePerGas = maxFeePerGas;\n struct.maxPriorityFeePerGas = maxPriorityFeePerGas;\n return struct;\n };\n"]}
1
+ {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/feeEstimator.ts"],"names":[],"mappings":";;;AACA,mDAAsE;AAwBtE,SAAgB,mBAAmB,CACjC,MAAS;IAET,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;QAUjD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,oBAAoB,IAAI,IAAI,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;QACJ,CAAC;QAED,IAAI,oBAAoB,GACtB,MAAM,MAAM,CAAC,4BAA4B,EAAE,CAAC;QAE9C,oBAAoB,GAAG,IAAA,yCAA8B,EACnD,oBAAoB,EACpB,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;QAEF,IAAI,YAAY,GACd,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,oBAAoB;YAC5B,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAE/B,YAAY,GAAG,IAAA,yCAA8B,EAC3C,YAAY,EACZ,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;QAEF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;QACnC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AA5CD,kDA4CC","sourcesContent":["import type { BigNumberish } from \"../../types\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/index.js\";\nimport type { MiddlewareClient } from \"../actions\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Default fee estimator middleware function that estimates the maximum fee per gas and maximum priority fee per gas for a given client and applies the necessary overrides and fee options.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, defaultFeeEstimator, createBundlerClient } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n *\n * // NOTE: this is already provided by the smart account client\n * const client = createSmartAccountClient({\n * feeEstimator: defaultFeeEstimator(bundlerClient),\n * ...otherParams\n * });\n * ```\n *\n * @template {MiddlewareClient} C The type of the client\n * @param {C} client The client to perform the fee estimation\n * @returns {ClientMiddlewareFn} A middleware function that takes in the struct and options, estimates the fees, and updates the struct with the estimated fees\n */\nexport function defaultFeeEstimator<C extends MiddlewareClient>(\n client: C\n): ClientMiddlewareFn {\n return async (struct, { overrides, feeOptions }) => {\n // maxFeePerGas must be at least the sum of maxPriorityFeePerGas and baseFee\n // so we need to accommodate for the fee option applied maxPriorityFeePerGas for the maxFeePerGas\n //\n // Note that if maxFeePerGas is not at least the sum of maxPriorityFeePerGas and required baseFee\n // after applying the fee options, then the transaction will fail\n //\n // Refer to https://docs.alchemy.com/docs/maxpriorityfeepergas-vs-maxfeepergas\n // for more information about maxFeePerGas and maxPriorityFeePerGas\n\n const feeData = await client.estimateFeesPerGas();\n if (!feeData.maxFeePerGas || feeData.maxPriorityFeePerGas == null) {\n throw new Error(\n \"feeData is missing maxFeePerGas or maxPriorityFeePerGas\"\n );\n }\n\n let maxPriorityFeePerGas: BigNumberish =\n await client.estimateMaxPriorityFeePerGas();\n\n maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGas,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas\n );\n\n let maxFeePerGas: BigNumberish =\n feeData.maxFeePerGas -\n feeData.maxPriorityFeePerGas +\n BigInt(maxPriorityFeePerGas);\n\n maxFeePerGas = applyUserOpOverrideOrFeeOption(\n maxFeePerGas,\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas\n );\n\n struct.maxFeePerGas = maxFeePerGas;\n struct.maxPriorityFeePerGas = maxPriorityFeePerGas;\n return struct;\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"paymasterAndData.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/paymasterAndData.ts"],"names":[],"mappings":";;;AAGO,MAAM,uBAAuB,GAAuB,KAAK,EAC9D,MAAM,EACN,EAAE,OAAO,EAAE,EACX,EAAE;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAClC,MAAuC,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACnE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AATW,QAAA,uBAAuB,2BASlC","sourcesContent":["import type { UserOperationStruct } from \"../../types\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\nexport const defaultPaymasterAndData: ClientMiddlewareFn = async (\n struct,\n { account }\n) => {\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.6.0\") {\n (struct as UserOperationStruct<\"0.6.0\">).paymasterAndData = \"0x\";\n }\n return struct;\n};\n"]}
1
+ {"version":3,"file":"paymasterAndData.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/paymasterAndData.ts"],"names":[],"mappings":";;;AAWO,MAAM,uBAAuB,GAAuB,KAAK,EAC9D,MAAM,EACN,EAAE,OAAO,EAAE,EACX,EAAE;IACF,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAClC,MAAuC,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACnE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AATW,QAAA,uBAAuB,2BASlC","sourcesContent":["import type { UserOperationStruct } from \"../../types\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Middleware function that sets the `paymasterAndData` field in the given struct based on the entry point version of the account.\n * This is the default used by `createSmartAccountClient` and is not necessary to be used directly.\n *\n * @param {UserOperationStruct} struct the user operation structure to be modified\n * @param {{ account: Account }} context an object containing the account information\n * @returns {Promise<UserOperationStruct>} a promise that resolves to the modified user operation structure\n */\nexport const defaultPaymasterAndData: ClientMiddlewareFn = async (\n struct,\n { account }\n) => {\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.6.0\") {\n (struct as UserOperationStruct<\"0.6.0\">).paymasterAndData = \"0x\";\n }\n return struct;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"userOpSigner.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/userOpSigner.ts"],"names":[],"mappings":";;;AAAA,wDAA+D;AAC/D,sDAA4D;AAC5D,oEAA0E;AAC1E,mDAI8B;AAGvB,MAAM,mBAAmB,GAAuB,KAAK,EAC1D,MAAM,EACN,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EACpC,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,iCAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,8BAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,IAAA,4BAAiB,EAAC,MAAM,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAA,sBAAW,EAAC,cAAc,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAA,yBAAc,EAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,4CAAyB,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACL,GAAG,cAAc;QACjB,SAAS,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,CACtD;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,mBAAmB,uBAwB9B","sourcesContent":["import { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport { InvalidUserOperationError } from \"../../errors/useroperation.js\";\nimport {\n deepHexlify,\n isValidRequest,\n resolveProperties,\n} from \"../../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\nexport const defaultUserOpSigner: ClientMiddlewareFn = async (\n struct,\n { client, account = client.account }\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client?.chain) {\n throw new ChainNotFoundError();\n }\n\n const resolvedStruct = await resolveProperties(struct);\n const request = deepHexlify(resolvedStruct);\n if (!isValidRequest(request)) {\n throw new InvalidUserOperationError(resolvedStruct);\n }\n\n return {\n ...resolvedStruct,\n signature: await account.signUserOperationHash(\n account.getEntryPoint().getUserOperationHash(request)\n ),\n };\n};\n"]}
1
+ {"version":3,"file":"userOpSigner.js","sourceRoot":"","sources":["../../../../src/middleware/defaults/userOpSigner.ts"],"names":[],"mappings":";;;AAAA,wDAA+D;AAC/D,sDAA4D;AAC5D,oEAA0E;AAC1E,mDAI8B;AAavB,MAAM,mBAAmB,GAAuB,KAAK,EAC1D,MAAM,EACN,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EACpC,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,iCAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,8BAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,IAAA,4BAAiB,EAAC,MAAM,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAA,sBAAW,EAAC,cAAc,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAA,yBAAc,EAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,4CAAyB,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACL,GAAG,cAAc;QACjB,SAAS,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,CACtD;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,mBAAmB,uBAwB9B","sourcesContent":["import { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport { InvalidUserOperationError } from \"../../errors/useroperation.js\";\nimport {\n deepHexlify,\n isValidRequest,\n resolveProperties,\n} from \"../../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account. This function validates the request and adds the signature to it.\n * This is already included in the client returned from `createSmartAccountClient`\n *\n * @param {UserOperationStruct} struct The user operation structure to be signed\n * @param {*} context The middleware context containing the client and account information\n * @param {Client} context.client The client object, which should include account and chain information\n * @param {Account} [context.account] Optional, the account used for signing, defaults to the client's account if not provided\n * @returns {Promise<UserOperationStruct>} A promise that resolves to the signed user operation structure\n */\nexport const defaultUserOpSigner: ClientMiddlewareFn = async (\n struct,\n { client, account = client.account }\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client?.chain) {\n throw new ChainNotFoundError();\n }\n\n const resolvedStruct = await resolveProperties(struct);\n const request = deepHexlify(resolvedStruct);\n if (!isValidRequest(request)) {\n throw new InvalidUserOperationError(resolvedStruct);\n }\n\n return {\n ...resolvedStruct,\n signature: await account.signUserOperationHash(\n account.getEntryPoint().getUserOperationHash(request)\n ),\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":";;;AAUA,4CAAuE;AAGvE,MAAa,kBAAkB;IAO7B,YAAY,KAAQ;QAHpB;;;;;WAAS;QACT;;;;;WAAmB;QAOV;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEO;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QAEO;;;;mBAA2C,KAAK,IAAI,EAAE;gBAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QArBA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;IAC/B,CAAC;IAqBD,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,IAAA,8BAAmB,EAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF;AA7CD,gDA6CC","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { mnemonicToAccount, privateKeyToAccount } from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\n\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message\n ) => {\n return this.inner.signMessage({ message });\n };\n\n readonly signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n readonly getAddress: () => Promise<`0x${string}`> = async () => {\n return this.inner.address;\n };\n\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n}\n"]}
1
+ {"version":3,"file":"local-account.js","sourceRoot":"","sources":["../../../src/signer/local-account.ts"],"names":[],"mappings":";;;AAUA,4CAAuE;AAMvE,MAAa,kBAAkB;IAO7B,YAAY,KAAQ;QAHpB;;;;;WAAS;QACT;;;;;WAAmB;QAOV;;;;mBAAoE,CAC3E,OAAO,EACP,EAAE;gBACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7C,CAAC;WAAC;QAEO;;;;mBAAgB,KAAK,EAI5B,MAAqD,EACvC,EAAE;gBAChB,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;WAAC;QAEO;;;;mBAA2C,KAAK,IAAI,EAAE;gBAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,CAAC;WAAC;QArBA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;IAC/B,CAAC;IAqBD,MAAM,CAAC,uBAAuB,CAC5B,GAAW,EACX,IAAgB;QAEhB,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,yBAAyB,CAC9B,GAAQ;QAER,MAAM,MAAM,GAAG,IAAA,8BAAmB,EAAC,GAAG,CAAC,CAAC;QACxC,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF;AA7CD,gDA6CC","sourcesContent":["import {\n type HDAccount,\n type HDOptions,\n type Hex,\n type LocalAccount,\n type PrivateKeyAccount,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { mnemonicToAccount, privateKeyToAccount } from \"viem/accounts\";\nimport type { SmartAccountSigner } from \"./types.js\";\n\n/**\n * Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.\n */\nexport class LocalAccountSigner<\n T extends HDAccount | PrivateKeyAccount | LocalAccount\n> implements SmartAccountSigner<T>\n{\n inner: T;\n signerType: string;\n\n constructor(inner: T) {\n this.inner = inner;\n this.signerType = inner.type; // type: \"local\"\n }\n\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = (\n message\n ) => {\n return this.inner.signMessage({ message });\n };\n\n readonly signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n return this.inner.signTypedData(params);\n };\n\n readonly getAddress: () => Promise<`0x${string}`> = async () => {\n return this.inner.address;\n };\n\n static mnemonicToAccountSigner(\n key: string,\n opts?: HDOptions\n ): LocalAccountSigner<HDAccount> {\n const signer = mnemonicToAccount(key, opts);\n return new LocalAccountSigner(signer);\n }\n\n static privateKeyToAccountSigner(\n key: Hex\n ): LocalAccountSigner<PrivateKeyAccount> {\n const signer = privateKeyToAccount(key);\n return new LocalAccountSigner(signer);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/signer/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAGjB,MAAM,QAAQ,GAAG,CAAC,MAAW,EAAgC,EAAE;IACpE,OAAO,CACL,MAAM,IAAI,IAAI;QACd,OAAO,MAAM,KAAK,QAAQ;QAC1B,YAAY,IAAI,MAAM;QACtB,aAAa,IAAI,MAAM;QACvB,eAAe,IAAI,MAAM;QACzB,YAAY,IAAI,MAAM;QACtB,OAAO,IAAI,MAAM,CAClB,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB;AAEW,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAqB,gBAAQ,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { SmartAccountSigner } from \"./types\";\n\nexport const isSigner = (signer: any): signer is SmartAccountSigner => {\n return (\n signer != null &&\n typeof signer === \"object\" &&\n \"signerType\" in signer &&\n \"signMessage\" in signer &&\n \"signTypedData\" in signer &&\n \"getAddress\" in signer &&\n \"inner\" in signer\n );\n};\n\nexport const SignerSchema = z.custom<SmartAccountSigner>(isSigner);\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/signer/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAiBjB,MAAM,QAAQ,GAAG,CAAC,MAAW,EAAgC,EAAE;IACpE,OAAO,CACL,MAAM,IAAI,IAAI;QACd,OAAO,MAAM,KAAK,QAAQ;QAC1B,YAAY,IAAI,MAAM;QACtB,aAAa,IAAI,MAAM;QACvB,eAAe,IAAI,MAAM;QACzB,YAAY,IAAI,MAAM;QACtB,OAAO,IAAI,MAAM,CAClB,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB;AAEW,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAqB,gBAAQ,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { SmartAccountSigner } from \"./types\";\n\n/**\n * Checks if the provided object is a `SmartAccountSigner`.\n *\n * @example\n * ```ts\n * import { isSigner, LocalAccountSigner } from \"@aa-sdk/core\";\n *\n * const signer = new LocalAccountSigner(...);\n * console.log(isSigner(signer)); // true\n * ```\n *\n * @param {any} signer the object to check\n * @returns {boolean} A boolean indicating whether the object is a `SmartAccountSigner`\n */\nexport const isSigner = (signer: any): signer is SmartAccountSigner => {\n return (\n signer != null &&\n typeof signer === \"object\" &&\n \"signerType\" in signer &&\n \"signMessage\" in signer &&\n \"signTypedData\" in signer &&\n \"getAddress\" in signer &&\n \"inner\" in signer\n );\n};\n\nexport const SignerSchema = z.custom<SmartAccountSigner>(isSigner);\n"]}
@@ -1,15 +1,7 @@
1
- import { type Address, type Hash, type Hex, type PublicClient } from "viem";
1
+ import { type Address, type Hash, type Hex } from "viem";
2
2
  export type SignWith6492Params = {
3
3
  factoryAddress: Address;
4
4
  factoryCalldata: Hex;
5
5
  signature: Hash;
6
6
  };
7
- type VerifyEIP6492SignatureParams = {
8
- signer: Address;
9
- hash: Hash;
10
- signature: Hash;
11
- client: PublicClient;
12
- };
13
7
  export declare const wrapSignatureWith6492: ({ factoryAddress, factoryCalldata, signature, }: SignWith6492Params) => Hash;
14
- export declare const verifyEIP6492Signature: ({ signer, hash, signature, client, }: VerifyEIP6492SignatureParams) => Promise<boolean>;
15
- export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyEIP6492Signature = exports.wrapSignatureWith6492 = void 0;
3
+ exports.wrapSignatureWith6492 = void 0;
4
4
  const viem_1 = require("viem");
5
5
  const wrapSignatureWith6492 = ({ factoryAddress, factoryCalldata, signature, }) => {
6
6
  return (0, viem_1.concat)([
@@ -13,19 +13,4 @@ const wrapSignatureWith6492 = ({ factoryAddress, factoryCalldata, signature, })
13
13
  ]);
14
14
  };
15
15
  exports.wrapSignatureWith6492 = wrapSignatureWith6492;
16
- const universalValidatorByteCode = "0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";
17
- const verifyEIP6492Signature = async ({ signer, hash, signature, client, }) => {
18
- const result = await client.call({
19
- data: (0, viem_1.concat)([
20
- universalValidatorByteCode,
21
- (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, bytes32, bytes"), [
22
- signer,
23
- hash,
24
- signature,
25
- ]),
26
- ]),
27
- });
28
- return result.data === "0x01";
29
- };
30
- exports.verifyEIP6492Signature = verifyEIP6492Signature;
31
16
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/signer/utils.ts"],"names":[],"mappings":";;;AAAA,+BAQc;AAeP,MAAM,qBAAqB,GAAG,CAAC,EACpC,cAAc,EACd,eAAe,EACf,SAAS,GACU,EAAQ,EAAE;IAQ7B,OAAO,IAAA,aAAM,EAAC;QACZ,IAAA,0BAAmB,EAAC,IAAA,yBAAkB,EAAC,uBAAuB,CAAC,EAAE;YAC/D,cAAc;YACd,eAAe;YACf,SAAS;SACV,CAAC;QACF,oEAAoE;KACrE,CAAC,CAAC;AACL,CAAC,CAAC;AApBW,QAAA,qBAAqB,yBAoBhC;AAGF,MAAM,0BAA0B,GAC9B,ogHAAogH,CAAC;AAEhgH,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,MAAM,EACN,IAAI,EACJ,SAAS,EACT,MAAM,GACuB,EAAoB,EAAE;IACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC;QAC/B,IAAI,EAAE,IAAA,aAAM,EAAC;YACX,0BAA0B;YAC1B,IAAA,0BAAmB,EAAC,IAAA,yBAAkB,EAAC,yBAAyB,CAAC,EAAE;gBACjE,MAAM;gBACN,IAAI;gBACJ,SAAS;aACV,CAAC;SACH,CAAC;KACH,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC;AAChC,CAAC,CAAC;AAlBW,QAAA,sBAAsB,0BAkBjC","sourcesContent":["import {\n concat,\n encodeAbiParameters,\n parseAbiParameters,\n type Address,\n type Hash,\n type Hex,\n type PublicClient,\n} from \"viem\";\n\nexport type SignWith6492Params = {\n factoryAddress: Address;\n factoryCalldata: Hex;\n signature: Hash;\n};\n\ntype VerifyEIP6492SignatureParams = {\n signer: Address;\n hash: Hash;\n signature: Hash;\n client: PublicClient;\n};\n\nexport const wrapSignatureWith6492 = ({\n factoryAddress,\n factoryCalldata,\n signature,\n}: SignWith6492Params): Hash => {\n // wrap the signature as follows: https://eips.ethereum.org/EIPS/eip-6492\n // concat(\n // abi.encode(\n // (create2Factory, factoryCalldata, originalERC1271Signature),\n // (address, bytes, bytes)),\n // magicBytes\n // )\n return concat([\n encodeAbiParameters(parseAbiParameters(\"address, bytes, bytes\"), [\n factoryAddress,\n factoryCalldata,\n signature,\n ]),\n \"0x6492649264926492649264926492649264926492649264926492649264926492\",\n ]);\n};\n\n// defined in https://github.com/AmbireTech/signature-validator/blob/main/index.ts#L13C17-L13C17\nconst universalValidatorByteCode =\n \"0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572\";\n\nexport const verifyEIP6492Signature = async ({\n signer,\n hash,\n signature,\n client,\n}: VerifyEIP6492SignatureParams): Promise<boolean> => {\n const result = await client.call({\n data: concat([\n universalValidatorByteCode,\n encodeAbiParameters(parseAbiParameters(\"address, bytes32, bytes\"), [\n signer,\n hash,\n signature,\n ]),\n ]),\n });\n\n return result.data === \"0x01\";\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/signer/utils.ts"],"names":[],"mappings":";;;AAAA,+BAOc;AA4BP,MAAM,qBAAqB,GAAG,CAAC,EACpC,cAAc,EACd,eAAe,EACf,SAAS,GACU,EAAQ,EAAE;IAQ7B,OAAO,IAAA,aAAM,EAAC;QACZ,IAAA,0BAAmB,EAAC,IAAA,yBAAkB,EAAC,uBAAuB,CAAC,EAAE;YAC/D,cAAc;YACd,eAAe;YACf,SAAS;SACV,CAAC;QACF,oEAAoE;KACrE,CAAC,CAAC;AACL,CAAC,CAAC;AApBW,QAAA,qBAAqB,yBAoBhC","sourcesContent":["import {\n concat,\n encodeAbiParameters,\n parseAbiParameters,\n type Address,\n type Hash,\n type Hex,\n} from \"viem\";\n\nexport type SignWith6492Params = {\n factoryAddress: Address;\n factoryCalldata: Hex;\n signature: Hash;\n};\n\n/**\n * Wraps a given signature with additional data following the EIP-6492 standard.\n *\n * @example\n * ```ts\n * import { wrapSignatureWith6492 } from \"@aa-sdk/core\";\n *\n * const signature = wrapSignatureWith6492({\n * factoryAddress: \"0x...\",\n * factoryCalldata: \"0x...\",\n * signature: \"0x...\",\n * });\n * ```\n *\n * @param {SignWith6492Params} params The parameters to wrap the signature\n * @param {Hex} params.factoryAddress The address of the factory\n * @param {Hex} params.factoryCalldata The calldata for the factory\n * @param {Hex} params.signature The original signature that needs to be wrapped\n * @returns {Hash} The wrapped signature\n */\nexport const wrapSignatureWith6492 = ({\n factoryAddress,\n factoryCalldata,\n signature,\n}: SignWith6492Params): Hash => {\n // wrap the signature as follows: https://eips.ethereum.org/EIPS/eip-6492\n // concat(\n // abi.encode(\n // (create2Factory, factoryCalldata, originalERC1271Signature),\n // (address, bytes, bytes)),\n // magicBytes\n // )\n return concat([\n encodeAbiParameters(parseAbiParameters(\"address, bytes, bytes\"), [\n factoryAddress,\n factoryCalldata,\n signature,\n ]),\n \"0x6492649264926492649264926492649264926492649264926492649264926492\",\n ]);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":";;;AAAA,+BAOc;AACd,mDAA6D;AAG7D,MAAa,kBAAkB;IAI7B,YAAY,MAAoB,EAAE,UAAkB;QAHpD;;;;;WAAmB;QACnB;;;;;WAAoB;QAUpB;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,IAAA,iBAAU,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAEO;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QAEJ;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;oBAC9B,OAAO;oBACP,GAAG,SAAS;iBACb,CAAC,CAAC;YACL,CAAC;WAAC;QA/BA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,kCAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CA2BF;AArCD,gDAqCC","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signTypedData({\n account,\n ...typedData,\n });\n };\n}\n"]}
1
+ {"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":";;;AAAA,+BAOc;AACd,mDAA6D;AAM7D,MAAa,kBAAkB;IAI7B,YAAY,MAAoB,EAAE,UAAkB;QAHpD;;;;;WAAmB;QACnB;;;;;WAAoB;QAUpB;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,IAAA,iBAAU,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAEO;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QAEJ;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;oBAC9B,OAAO;oBACP,GAAG,SAAS;iBACb,CAAC,CAAC;YACL,CAAC;WAAC;QA/BA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,kCAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CA2BF;AArCD,gDAqCC","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\n/**\n * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.\n */\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signTypedData({\n account,\n ...typedData,\n });\n };\n}\n"]}
@@ -9,7 +9,6 @@ export type Deferrable<T> = {
9
9
  };
10
10
  export declare function resolveProperties<T>(object: Deferrable<T>): Promise<T>;
11
11
  export declare function deepHexlify(obj: any): any;
12
- export declare function defineReadOnly<T, K extends keyof T>(object: T, key: K, value: T[K]): void;
13
12
  export declare function filterUndefined<T>(obj: T): T;
14
13
  export declare function pick(obj: Record<string, unknown>, keys: string | string[]): {};
15
14
  export declare const allEqual: (...params: any[]) => boolean;
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.toRecord = exports.conditionalReturn = exports.allEqual = exports.pick = exports.filterUndefined = exports.defineReadOnly = exports.deepHexlify = exports.resolveProperties = exports.asyncPipe = exports.getChain = exports.AlchemyChainMap = void 0;
29
+ exports.toRecord = exports.conditionalReturn = exports.allEqual = exports.pick = exports.filterUndefined = exports.deepHexlify = exports.resolveProperties = exports.asyncPipe = exports.getChain = exports.AlchemyChainMap = void 0;
30
30
  const viem_1 = require("viem");
31
31
  const chains = __importStar(require("viem/chains"));
32
32
  const alchemyChains = __importStar(require("../chains/index.js"));
@@ -82,14 +82,6 @@ function deepHexlify(obj) {
82
82
  }), {});
83
83
  }
84
84
  exports.deepHexlify = deepHexlify;
85
- function defineReadOnly(object, key, value) {
86
- Object.defineProperty(object, key, {
87
- enumerable: true,
88
- value: value,
89
- writable: false,
90
- });
91
- }
92
- exports.defineReadOnly = defineReadOnly;
93
85
  function filterUndefined(obj) {
94
86
  for (const key in obj) {
95
87
  if (obj[key] == null) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAA6B;AAC7B,oDAAsC;AACtC,kEAAoD;AAIvC,QAAA,eAAe,GAAG,IAAI,GAAG,CACpC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CACnD,CAAC;AASK,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAS,EAAE;IACjD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,uBAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;QAChD,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAC1C,CAAC,CAAC;AAPW,QAAA,QAAQ,YAOnB;AAQK,MAAM,SAAS,GACpB,CAAU,GAAG,GAA2C,EAAE,EAAE,CAC5D,KAAK,EAAE,CAAI,EAAE,CAAK,EAAE,CAAK,EAAE,EAAE;IAC3B,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,EAA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AC9B,8CAA4B;AAE5B,8CAA4B","sourcesContent":["import type { Chain } from \"viem\";\nimport { toHex } from \"viem\";\nimport * as chains from \"viem/chains\";\nimport * as alchemyChains from \"../chains/index.js\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\nexport const AlchemyChainMap = new Map<number, Chain>(\n Object.values(alchemyChains).map((c) => [c.id, c])\n);\n\n/**\n * Utility method for converting a chainId to a {@link Chain} object\n *\n * @param chainId - the chainId to convert\n * @returns a {@link Chain} object for the given chainId\n * @throws if the chainId is not found\n */\nexport const getChain = (chainId: number): Chain => {\n for (const chain of Object.values(chains)) {\n if (chain.id === chainId) {\n return AlchemyChainMap.get(chain.id) ?? chain;\n }\n }\n throw new Error(\"could not find chain\");\n};\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param fns - functions to pipe\n * @returns result of the pipe\n */\nexport const asyncPipe =\n <S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>\n async (s: S, o?: O, f?: F) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, o, f);\n }\n return result;\n };\n\n// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers\nexport type Deferrable<T> = {\n [K in keyof T]: PromiseOrValue<T[K]>;\n};\n\n/**\n * Await all of the properties of a {@link Deferrable} object\n *\n * @param object - a {@link Deferrable} object\n * @returns the object with its properties resolved\n */\nexport async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {\n const promises = Object.keys(object).map((key) => {\n const value = object[key as keyof Deferrable<T>];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return filterUndefined<T>(\n results.reduce((accum, curr) => {\n accum[curr.key as keyof T] = curr.value;\n return accum;\n }, {} as T)\n );\n}\n\n/**\n * Recursively converts all values in an object to hex strings\n *\n * @param obj - obj to deep hexlify\n * @returns object with all of its values hexlified\n */\nexport function deepHexlify(obj: any): any {\n if (typeof obj === \"function\") {\n return undefined;\n }\n if (obj == null || typeof obj === \"string\" || typeof obj === \"boolean\") {\n return obj;\n } else if (typeof obj === \"bigint\") {\n return toHex(obj);\n } else if (obj._isBigNumber != null || typeof obj !== \"object\") {\n return toHex(obj).replace(/^0x0/, \"0x\");\n }\n if (Array.isArray(obj)) {\n return obj.map((member) => deepHexlify(member));\n }\n return Object.keys(obj).reduce(\n (set, key) => ({\n ...set,\n [key]: deepHexlify(obj[key]),\n }),\n {}\n );\n}\n\n// borrowed from ethers.js\nexport function defineReadOnly<T, K extends keyof T>(\n object: T,\n key: K,\n value: T[K]\n): void {\n Object.defineProperty(object, key, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n\nexport function filterUndefined<T>(obj: T): T {\n for (const key in obj) {\n if (obj[key] == null) {\n delete obj[key];\n }\n }\n return obj as T;\n}\n\nexport function pick(obj: Record<string, unknown>, keys: string | string[]) {\n return Object.keys(obj)\n .filter((k) => keys.includes(k))\n .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});\n}\n\n/**\n * Utility method for checking if the passed in values are all equal (strictly)\n *\n * @param params - values to check\n * @returns a boolean indicating if all values are the same\n * @throws if no values are passed in\n */\nexport const allEqual = (...params: any[]): boolean => {\n if (params.length === 0) {\n throw new Error(\"no values passed in\");\n }\n return params.every((v) => v === params[0]);\n};\n\n/**\n * Utility method for checking the condition and return the value if condition holds true, undefined if not.\n *\n * @param condition - condition to check\n * @param value - value to return when condition holds true\n * @returns the value if condition holds true, undefined if not\n */\nexport const conditionalReturn = <T>(\n condition: Promise<boolean>,\n value: () => Promise<T>\n): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));\n\nexport const toRecord = <\n T extends { [K in RecordableKeys<T>]: string | number | symbol },\n K extends RecordableKeys<T>,\n V\n>(\n array: T[],\n selector: K,\n fn: (item: T) => V\n): Record<T[K], V> =>\n array.reduce((acc, item) => {\n acc[item[selector]] = fn(item);\n return acc;\n }, {} as Record<T[K], V>);\n\nexport * from \"./bigint.js\";\nexport * from \"./bytes.js\";\nexport * from \"./defaults.js\";\nexport * from \"./schema.js\";\nexport type * from \"./types.js\";\nexport * from \"./userop.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAA6B;AAC7B,oDAAsC;AACtC,kEAAoD;AAIvC,QAAA,eAAe,GAAG,IAAI,GAAG,CACpC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CACnD,CAAC;AASK,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAS,EAAE;IACjD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,uBAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;QAChD,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAC1C,CAAC,CAAC;AAPW,QAAA,QAAQ,YAOnB;AAQK,MAAM,SAAS,GACpB,CAAU,GAAG,GAA2C,EAAE,EAAE,CAC5D,KAAK,EAAE,CAAI,EAAE,CAAK,EAAE,CAAK,EAAE,EAAE;IAC3B,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARS,QAAA,SAAS,aAQlB;AAaG,KAAK,UAAU,iBAAiB,CAAI,MAAqB;IAC9D,MAAM,QAAQ,GAAG,MAA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AAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB;AASK,MAAM,iBAAiB,GAAG,CAC/B,SAA2B,EAC3B,KAAuB,EACC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAHjE,QAAA,iBAAiB,qBAGgD;AAsBvE,MAAM,QAAQ,GAAG,CAKtB,KAAU,EACV,QAAW,EACX,EAAkB,EACD,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IACzB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAqB,CAAC,CAAC;AAZf,QAAA,QAAQ,YAYO;AAE5B,8CAA4B;AAC5B,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAE5B,8CAA4B","sourcesContent":["import type { Chain } from \"viem\";\nimport { toHex } from \"viem\";\nimport * as chains from \"viem/chains\";\nimport * as alchemyChains from \"../chains/index.js\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\nexport const AlchemyChainMap = new Map<number, Chain>(\n Object.values(alchemyChains).map((c) => [c.id, c])\n);\n\n/**\n * Utility method for converting a chainId to a {@link Chain} object\n *\n * @param chainId - the chainId to convert\n * @returns a {@link Chain} object for the given chainId\n * @throws if the chainId is not found\n */\nexport const getChain = (chainId: number): Chain => {\n for (const chain of Object.values(chains)) {\n if (chain.id === chainId) {\n return AlchemyChainMap.get(chain.id) ?? chain;\n }\n }\n throw new Error(\"could not find chain\");\n};\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param fns - functions to pipe\n * @returns result of the pipe\n */\nexport const asyncPipe =\n <S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>\n async (s: S, o?: O, f?: F) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, o, f);\n }\n return result;\n };\n\n// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers\nexport type Deferrable<T> = {\n [K in keyof T]: PromiseOrValue<T[K]>;\n};\n\n/**\n * Await all of the properties of a {@link Deferrable} object\n *\n * @param object - a {@link Deferrable} object\n * @returns the object with its properties resolved\n */\nexport async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {\n const promises = Object.keys(object).map((key) => {\n const value = object[key as keyof Deferrable<T>];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return filterUndefined<T>(\n results.reduce((accum, curr) => {\n accum[curr.key as keyof T] = curr.value;\n return accum;\n }, {} as T)\n );\n}\n\n/**\n * Recursively converts all values in an object to hex strings\n *\n * @param obj - obj to deep hexlify\n * @returns object with all of its values hexlified\n */\nexport function deepHexlify(obj: any): any {\n if (typeof obj === \"function\") {\n return undefined;\n }\n if (obj == null || typeof obj === \"string\" || typeof obj === \"boolean\") {\n return obj;\n } else if (typeof obj === \"bigint\") {\n return toHex(obj);\n } else if (obj._isBigNumber != null || typeof obj !== \"object\") {\n return toHex(obj).replace(/^0x0/, \"0x\");\n }\n if (Array.isArray(obj)) {\n return obj.map((member) => deepHexlify(member));\n }\n return Object.keys(obj).reduce(\n (set, key) => ({\n ...set,\n [key]: deepHexlify(obj[key]),\n }),\n {}\n );\n}\n\n/**\n * Filters out properties with undefined or null values from the provided object.\n *\n * @example\n * ```ts\n * import { filterUndefined } from \"@aa-sdk/core\";\n *\n * const result = filterUndefined({\n * foo: undefined,\n * bar: null,\n * baz: \"baz\",\n * }); // { baz: \"baz\" }\n * ```\n *\n * @param {T} obj the object from which to remove properties with undefined or null values\n * @returns {T} the object with undefined or null properties removed\n */\nexport function filterUndefined<T>(obj: T): T {\n for (const key in obj) {\n if (obj[key] == null) {\n delete obj[key];\n }\n }\n return obj as T;\n}\n\n/**\n * Picks the specified keys from an object and returns a new object containing only those key-value pairs.\n *\n * @example\n * ```ts\n * import { pick } from \"@aa-sdk/core\";\n *\n * const picked = pick({\n * foo: \"foo\",\n * bar: \"bar\",\n * }, [\"foo\"]); // { foo: \"foo\" }\n * ```\n *\n * @param {Record<string, unknown>} obj The object from which to pick keys\n * @param {string|string[]} keys A single key or an array of keys to pick from the object\n * @returns {Record<string, unknown>} A new object containing only the picked key-value pairs\n */\nexport function pick(obj: Record<string, unknown>, keys: string | string[]) {\n return Object.keys(obj)\n .filter((k) => keys.includes(k))\n .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});\n}\n\n/**\n * Utility method for checking if the passed in values are all equal (strictly)\n *\n * @param params - values to check\n * @returns a boolean indicating if all values are the same\n * @throws if no values are passed in\n */\nexport const allEqual = (...params: any[]): boolean => {\n if (params.length === 0) {\n throw new Error(\"no values passed in\");\n }\n return params.every((v) => v === params[0]);\n};\n\n/**\n * Utility method for checking the condition and return the value if condition holds true, undefined if not.\n *\n * @param condition - condition to check\n * @param value - value to return when condition holds true\n * @returns the value if condition holds true, undefined if not\n */\nexport const conditionalReturn = <T>(\n condition: Promise<boolean>,\n value: () => Promise<T>\n): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));\n\n/**\n * Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function.\n *\n * @example\n * ```ts\n * import { toRecord } from \"@aa-sdk/core\";\n * import { sepolia, mainnet } from \"viem/chains\";\n *\n * const addressesByChain = toRecord(\n * [sepolia, mainnet],\n * \"id\",\n * () => \"0x...\"\n * ); // { [sepolia.id]: \"0x...\", [mainnet.id]: \"0x...\" }\n * ```\n *\n * @param {T[]} array The array of objects to convert to a record\n * @param {K} selector The key used to select the property that will become the record's key\n * @param {(item: T) => V} fn The function that transforms each item in the array into the record's value\n * @returns {Record<T[K], V>} The resulting record object\n */\nexport const toRecord = <\n T extends { [K in RecordableKeys<T>]: string | number | symbol },\n K extends RecordableKeys<T>,\n V\n>(\n array: T[],\n selector: K,\n fn: (item: T) => V\n): Record<T[K], V> =>\n array.reduce((acc, item) => {\n acc[item[selector]] = fn(item);\n return acc;\n }, {} as Record<T[K], V>);\n\nexport * from \"./bigint.js\";\nexport * from \"./bytes.js\";\nexport * from \"./defaults.js\";\nexport * from \"./schema.js\";\nexport type * from \"./types.js\";\nexport * from \"./userop.js\";\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0-alpha.0";
1
+ export declare const VERSION = "4.0.0-alpha.1";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "4.0.0-alpha.0";
4
+ exports.VERSION = "4.0.0-alpha.1";
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-alpha.0\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-alpha.1\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"simple.js","sourceRoot":"","sources":["../../../src/account/simple.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,KAAK,GAKN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAA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C;YAC/D,OAAO,aAAa,CAAC,kBAAkB,EAAE,CAAC;QAC5C,CAAC;QACD,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC;QACtE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAC3B,aAAa,CAAC,WAAW,CACvB,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CACpD;QAEH,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC;QAC9D,cAAc,EAAE,YAAY,CAAC,cAAc;KAC5C,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE;KAC3C,CAAC;AACJ,CAAC","sourcesContent":["import type { Address } from \"abitype\";\nimport {\n concatHex,\n encodeFunctionData,\n isHex,\n type Chain,\n type FallbackTransport,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { SimpleAccountAbi_v6 } from \"../abis/SimpleAccountAbi_v6.js\";\nimport { SimpleAccountAbi_v7 } from \"../abis/SimpleAccountAbi_v7.js\";\nimport { SimpleAccountFactoryAbi } from \"../abis/SimpleAccountFactoryAbi.js\";\nimport { createBundlerClient } from \"../client/bundlerClient.js\";\nimport {\n defaultEntryPointVersion,\n getEntryPoint,\n} from \"../entrypoint/index.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointParameter,\n EntryPointVersion,\n} from \"../entrypoint/types.js\";\nimport { AccountRequiresOwnerError } from \"../errors/account.js\";\nimport type { SmartAccountSigner } from \"../signer/types.js\";\nimport type { BatchUserOperationCallData } from \"../types.js\";\nimport { getDefaultSimpleAccountFactoryAddress } from \"../utils/defaults.js\";\nimport { BaseSmartContractAccount } from \"./base.js\";\nimport { SimpleSmartAccountParamsSchema } from \"./schema.js\";\nimport {\n toSmartContractAccount,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n} from \"./smartContractAccount.js\";\nimport type { SimpleSmartAccountParams } from \"./types.js\";\n\nclass SimpleSmartContractAccount<\n TTransport extends Transport | FallbackTransport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> extends BaseSmartContractAccount<TTransport, TSigner> {\n protected index: bigint;\n protected entryPointVersion: EntryPointVersion;\n\n constructor(params: SimpleSmartAccountParams<TTransport, TSigner>) {\n SimpleSmartAccountParamsSchema().parse(params);\n\n // This is a hack for now, we should kill the SimpleSmart Account when we kill Base Account\n const client = createBundlerClient({\n transport: params.transport as TTransport,\n chain: params.chain,\n });\n\n // @ts-expect-error zod custom type not recognized as required params for signers\n super({ ...params, rpcClient: client });\n this.signer = params.signer as TSigner;\n this.index = params.salt ?? 0n;\n this.entryPointVersion =\n params.entryPointVersion ?? defaultEntryPointVersion;\n }\n\n getDummySignature(): `0x${string}` {\n return \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n }\n\n async encodeExecute(\n target: Hex,\n value: bigint,\n data: Hex\n ): Promise<`0x${string}`> {\n return encodeFunctionData({\n abi:\n this.entryPointVersion === \"0.6.0\"\n ? SimpleAccountAbi_v6\n : SimpleAccountAbi_v7,\n functionName: \"execute\",\n args: [target, value, data],\n });\n }\n\n override async encodeBatchExecute(\n txs: BatchUserOperationCallData\n ): Promise<`0x${string}`> {\n const [targets, datas] = txs.reduce(\n (accum, curr) => {\n accum[0].push(curr.target);\n accum[1].push(curr.data);\n\n return accum;\n },\n [[], []] as [Address[], Hex[]]\n );\n\n return encodeFunctionData({\n abi:\n this.entryPointVersion === \"0.6.0\"\n ? SimpleAccountAbi_v6\n : SimpleAccountAbi_v7,\n functionName: \"executeBatch\",\n args: [targets, datas],\n });\n }\n\n signMessage(msg: Uint8Array | string): Promise<`0x${string}`> {\n return this.signer.signMessage(\n typeof msg === \"string\" && !isHex(msg) ? msg : { raw: msg }\n );\n }\n\n public async getAccountInitCode(): Promise<`0x${string}`> {\n return concatHex([\n this.factoryAddress,\n encodeFunctionData({\n abi: SimpleAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [await this.signer.getAddress(), this.index],\n }),\n ]);\n }\n}\n\nexport type SimpleSmartAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = SmartContractAccountWithSigner<\n \"SimpleAccount\",\n TSigner,\n TEntryPointVersion\n>;\n\nexport type CreateSimpleAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion\n> = Pick<\n ToSmartContractAccountParams<\n \"SimpleAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"chain\" | \"transport\"\n> & {\n signer: TSigner;\n salt?: bigint;\n accountAddress?: Address;\n factoryAddress?: Address;\n initCode?: Hex;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n\nexport async function createSimpleSmartAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion\n>(\n config: CreateSimpleAccountParams<TTransport, TSigner, TEntryPointVersion>\n): Promise<SimpleSmartAccount<TSigner, TEntryPointVersion>>;\n\nexport async function createSimpleSmartAccount({\n chain,\n entryPoint = getEntryPoint(chain),\n factoryAddress = getDefaultSimpleAccountFactoryAddress(\n chain,\n entryPoint.version\n ),\n ...params\n}: CreateSimpleAccountParams): Promise<SimpleSmartAccount> {\n if (!params.signer) throw new AccountRequiresOwnerError(\"SimpleAccount\");\n const simpleAccount = new SimpleSmartContractAccount(\n SimpleSmartAccountParamsSchema().parse({\n chain,\n entryPointAddress: entryPoint.address,\n factoryAddress,\n ...params,\n })\n );\n\n const parsedParams = SimpleSmartAccountParamsSchema().parse({\n chain,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n factoryAddress,\n ...params,\n });\n\n const base = await toSmartContractAccount({\n source: \"SimpleAccount\",\n transport: params.transport,\n chain,\n encodeBatchExecute: simpleAccount.encodeBatchExecute.bind(simpleAccount),\n encodeExecute: (tx) =>\n simpleAccount.encodeExecute.bind(simpleAccount)(\n tx.target,\n tx.value ?? 0n,\n tx.data\n ),\n entryPoint,\n getAccountInitCode: async () => {\n if (parsedParams.initCode) return parsedParams.initCode as Hex;\n return simpleAccount.getAccountInitCode();\n },\n getDummySignature: simpleAccount.getDummySignature.bind(simpleAccount),\n signMessage: ({ message }) =>\n simpleAccount.signMessage(\n typeof message === \"string\" ? message : message.raw\n ),\n // @ts-expect-error these types still represent the same thing, but they are just a little off in there definitions\n signTypedData: simpleAccount.signTypedData.bind(simpleAccount),\n accountAddress: parsedParams.accountAddress,\n });\n\n return {\n ...base,\n getSigner: () => simpleAccount.getSigner(),\n };\n}\n"]}
1
+ {"version":3,"file":"simple.js","sourceRoot":"","sources":["../../../src/account/simple.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,KAAK,GAKN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa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C;IAEH,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE;KAC3C,CAAC;AACJ,CAAC","sourcesContent":["import type { Address } from \"abitype\";\nimport {\n concatHex,\n encodeFunctionData,\n isHex,\n type Chain,\n type FallbackTransport,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { SimpleAccountAbi_v6 } from \"../abis/SimpleAccountAbi_v6.js\";\nimport { SimpleAccountAbi_v7 } from \"../abis/SimpleAccountAbi_v7.js\";\nimport { SimpleAccountFactoryAbi } from \"../abis/SimpleAccountFactoryAbi.js\";\nimport { createBundlerClient } from \"../client/bundlerClient.js\";\nimport {\n defaultEntryPointVersion,\n getEntryPoint,\n} from \"../entrypoint/index.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointParameter,\n EntryPointVersion,\n} from \"../entrypoint/types.js\";\nimport { AccountRequiresOwnerError } from \"../errors/account.js\";\nimport type { SmartAccountSigner } from \"../signer/types.js\";\nimport type { BatchUserOperationCallData } from \"../types.js\";\nimport { getDefaultSimpleAccountFactoryAddress } from \"../utils/defaults.js\";\nimport { BaseSmartContractAccount } from \"./base.js\";\nimport { SimpleSmartAccountParamsSchema } from \"./schema.js\";\nimport {\n toSmartContractAccount,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n} from \"./smartContractAccount.js\";\nimport type { SimpleSmartAccountParams } from \"./types.js\";\n\nclass SimpleSmartContractAccount<\n TTransport extends Transport | FallbackTransport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> extends BaseSmartContractAccount<TTransport, TSigner> {\n protected index: bigint;\n protected entryPointVersion: EntryPointVersion;\n\n constructor(params: SimpleSmartAccountParams<TTransport, TSigner>) {\n SimpleSmartAccountParamsSchema().parse(params);\n\n // This is a hack for now, we should kill the SimpleSmart Account when we kill Base Account\n const client = createBundlerClient({\n transport: params.transport as TTransport,\n chain: params.chain,\n });\n\n // @ts-expect-error zod custom type not recognized as required params for signers\n super({ ...params, rpcClient: client });\n this.signer = params.signer as TSigner;\n this.index = params.salt ?? 0n;\n this.entryPointVersion =\n params.entryPointVersion ?? defaultEntryPointVersion;\n }\n\n getDummySignature(): `0x${string}` {\n return \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n }\n\n async encodeExecute(\n target: Hex,\n value: bigint,\n data: Hex\n ): Promise<`0x${string}`> {\n return encodeFunctionData({\n abi:\n this.entryPointVersion === \"0.6.0\"\n ? SimpleAccountAbi_v6\n : SimpleAccountAbi_v7,\n functionName: \"execute\",\n args: [target, value, data],\n });\n }\n\n override async encodeBatchExecute(\n txs: BatchUserOperationCallData\n ): Promise<`0x${string}`> {\n const [targets, datas] = txs.reduce(\n (accum, curr) => {\n accum[0].push(curr.target);\n accum[1].push(curr.data);\n\n return accum;\n },\n [[], []] as [Address[], Hex[]]\n );\n\n return encodeFunctionData({\n abi:\n this.entryPointVersion === \"0.6.0\"\n ? SimpleAccountAbi_v6\n : SimpleAccountAbi_v7,\n functionName: \"executeBatch\",\n args: [targets, datas],\n });\n }\n\n signMessage(msg: Uint8Array | string): Promise<`0x${string}`> {\n return this.signer.signMessage(\n typeof msg === \"string\" && !isHex(msg) ? msg : { raw: msg }\n );\n }\n\n public async getAccountInitCode(): Promise<`0x${string}`> {\n return concatHex([\n this.factoryAddress,\n encodeFunctionData({\n abi: SimpleAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [await this.signer.getAddress(), this.index],\n }),\n ]);\n }\n}\n\nexport type SimpleSmartAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = SmartContractAccountWithSigner<\n \"SimpleAccount\",\n TSigner,\n TEntryPointVersion\n>;\n\nexport type CreateSimpleAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion\n> = Pick<\n ToSmartContractAccountParams<\n \"SimpleAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"chain\" | \"transport\"\n> & {\n signer: TSigner;\n salt?: bigint;\n accountAddress?: Address;\n factoryAddress?: Address;\n initCode?: Hex;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n\nexport async function createSimpleSmartAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion\n>(\n config: CreateSimpleAccountParams<TTransport, TSigner, TEntryPointVersion>\n): Promise<SimpleSmartAccount<TSigner, TEntryPointVersion>>;\n\n/**\n * Creates a simple smart account using the provided parameters, including chain, entry point, factory address, and additional parameters. This function also ensures that a signer is provided.\n *\n * @param {CreateSimpleAccountParams} config The parameters for creating a simple smart account\n * @returns {Promise<SimpleSmartAccount>} A promise that resolves to a `SimpleSmartAccount` object containing the created account information and methods\n */\nexport async function createSimpleSmartAccount({\n chain,\n entryPoint = getEntryPoint(chain),\n factoryAddress = getDefaultSimpleAccountFactoryAddress(\n chain,\n entryPoint.version\n ),\n ...params\n}: CreateSimpleAccountParams): Promise<SimpleSmartAccount> {\n if (!params.signer) throw new AccountRequiresOwnerError(\"SimpleAccount\");\n const simpleAccount = new SimpleSmartContractAccount(\n SimpleSmartAccountParamsSchema().parse({\n chain,\n entryPointAddress: entryPoint.address,\n factoryAddress,\n ...params,\n })\n );\n\n const parsedParams = SimpleSmartAccountParamsSchema().parse({\n chain,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n factoryAddress,\n ...params,\n });\n\n const base = await toSmartContractAccount({\n source: \"SimpleAccount\",\n transport: params.transport,\n chain,\n encodeBatchExecute: simpleAccount.encodeBatchExecute.bind(simpleAccount),\n encodeExecute: (tx) =>\n simpleAccount.encodeExecute.bind(simpleAccount)(\n tx.target,\n tx.value ?? 0n,\n tx.data\n ),\n entryPoint,\n getAccountInitCode: async () => {\n if (parsedParams.initCode) return parsedParams.initCode as Hex;\n return simpleAccount.getAccountInitCode();\n },\n getDummySignature: simpleAccount.getDummySignature.bind(simpleAccount),\n signMessage: ({ message }) =>\n simpleAccount.signMessage(\n typeof message === \"string\" ? message : message.raw\n ),\n // @ts-expect-error these types still represent the same thing, but they are just a little off in there definitions\n signTypedData: simpleAccount.signTypedData.bind(simpleAccount),\n accountAddress: parsedParams.accountAddress,\n });\n\n return {\n ...base,\n getSigner: () => simpleAccount.getSigner(),\n };\n}\n"]}
@@ -40,7 +40,8 @@ export const getAccountAddress = async ({ client, entryPoint, accountAddress, ge
40
40
  }
41
41
  throw new GetCounterFactualAddressError();
42
42
  };
43
- export async function toSmartContractAccount({ transport, chain, entryPoint, source, accountAddress, getAccountInitCode, signMessage, signTypedData, encodeBatchExecute, encodeExecute, getDummySignature, signUserOperationHash, encodeUpgradeToAndCall, }) {
43
+ export async function toSmartContractAccount(params) {
44
+ const { transport, chain, entryPoint, source, accountAddress, getAccountInitCode, signMessage, signTypedData, encodeBatchExecute, encodeExecute, getDummySignature, signUserOperationHash, encodeUpgradeToAndCall, } = params;
44
45
  const client = createBundlerClient({
45
46
  transport: (opts) => transport({ ...opts, chain, retryCount: 0 }),
46
47
  chain,