viem 2.27.3 → 2.28.0-canary-20250421235327

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 (163) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
  3. package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +257 -0
  4. package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +1 -0
  5. package/_cjs/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
  6. package/_cjs/account-abstraction/accounts/toSmartAccount.js +2 -2
  7. package/_cjs/account-abstraction/accounts/toSmartAccount.js.map +1 -1
  8. package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js +7 -1
  9. package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
  10. package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js +21 -1
  11. package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
  12. package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js +2 -2
  13. package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
  14. package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
  15. package/_cjs/account-abstraction/constants/abis.js +691 -1
  16. package/_cjs/account-abstraction/constants/abis.js.map +1 -1
  17. package/_cjs/account-abstraction/constants/address.js +2 -1
  18. package/_cjs/account-abstraction/constants/address.js.map +1 -1
  19. package/_cjs/account-abstraction/index.js +6 -2
  20. package/_cjs/account-abstraction/index.js.map +1 -1
  21. package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js +19 -0
  22. package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
  23. package/_cjs/account-abstraction/utils/userOperation/getInitCode.js +18 -0
  24. package/_cjs/account-abstraction/utils/userOperation/getInitCode.js.map +1 -0
  25. package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js +30 -39
  26. package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
  27. package/_cjs/account-abstraction/utils/userOperation/getUserOperationTypedData.js +31 -0
  28. package/_cjs/account-abstraction/utils/userOperation/getUserOperationTypedData.js.map +1 -0
  29. package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js +3 -2
  30. package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
  31. package/_cjs/constants/address.js +2 -1
  32. package/_cjs/constants/address.js.map +1 -1
  33. package/_cjs/errors/version.js +1 -1
  34. package/_cjs/errors/version.js.map +1 -1
  35. package/_cjs/experimental/eip5792/actions/getCallsStatus.js +1 -1
  36. package/_cjs/experimental/eip5792/actions/getCallsStatus.js.map +1 -1
  37. package/_cjs/experimental/eip5792/actions/sendCalls.js +1 -1
  38. package/_cjs/experimental/eip5792/actions/sendCalls.js.map +1 -1
  39. package/_esm/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
  40. package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +271 -0
  41. package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +1 -0
  42. package/_esm/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
  43. package/_esm/account-abstraction/accounts/toSmartAccount.js +2 -2
  44. package/_esm/account-abstraction/accounts/toSmartAccount.js.map +1 -1
  45. package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js +7 -1
  46. package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
  47. package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +21 -1
  48. package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
  49. package/_esm/account-abstraction/actions/bundler/sendUserOperation.js +2 -2
  50. package/_esm/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
  51. package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
  52. package/_esm/account-abstraction/constants/abis.js +690 -0
  53. package/_esm/account-abstraction/constants/abis.js.map +1 -1
  54. package/_esm/account-abstraction/constants/address.js +1 -0
  55. package/_esm/account-abstraction/constants/address.js.map +1 -1
  56. package/_esm/account-abstraction/index.js +3 -2
  57. package/_esm/account-abstraction/index.js.map +1 -1
  58. package/_esm/account-abstraction/utils/formatters/userOperationRequest.js +19 -0
  59. package/_esm/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
  60. package/_esm/account-abstraction/utils/userOperation/getInitCode.js +15 -0
  61. package/_esm/account-abstraction/utils/userOperation/getInitCode.js.map +1 -0
  62. package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js +30 -39
  63. package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
  64. package/_esm/account-abstraction/utils/userOperation/getUserOperationTypedData.js +28 -0
  65. package/_esm/account-abstraction/utils/userOperation/getUserOperationTypedData.js.map +1 -0
  66. package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js +3 -2
  67. package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
  68. package/_esm/constants/address.js +1 -0
  69. package/_esm/constants/address.js.map +1 -1
  70. package/_esm/errors/version.js +1 -1
  71. package/_esm/errors/version.js.map +1 -1
  72. package/_esm/experimental/eip5792/actions/getCallsStatus.js +1 -1
  73. package/_esm/experimental/eip5792/actions/getCallsStatus.js.map +1 -1
  74. package/_esm/experimental/eip5792/actions/sendCalls.js +1 -1
  75. package/_esm/experimental/eip5792/actions/sendCalls.js.map +1 -1
  76. package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts +1 -2
  77. package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts.map +1 -1
  78. package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts +311 -0
  79. package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts.map +1 -0
  80. package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts +1 -2
  81. package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts.map +1 -1
  82. package/_types/account-abstraction/accounts/types.d.ts +16 -3
  83. package/_types/account-abstraction/accounts/types.d.ts.map +1 -1
  84. package/_types/account-abstraction/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  85. package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts +23 -6
  86. package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
  87. package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts +1 -1
  88. package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
  89. package/_types/account-abstraction/constants/abis.d.ts +830 -0
  90. package/_types/account-abstraction/constants/abis.d.ts.map +1 -1
  91. package/_types/account-abstraction/constants/address.d.ts +1 -0
  92. package/_types/account-abstraction/constants/address.d.ts.map +1 -1
  93. package/_types/account-abstraction/index.d.ts +3 -2
  94. package/_types/account-abstraction/index.d.ts.map +1 -1
  95. package/_types/account-abstraction/types/entryPointVersion.d.ts +1 -1
  96. package/_types/account-abstraction/types/entryPointVersion.d.ts.map +1 -1
  97. package/_types/account-abstraction/types/rpc.d.ts +6 -3
  98. package/_types/account-abstraction/types/rpc.d.ts.map +1 -1
  99. package/_types/account-abstraction/types/userOperation.d.ts +49 -5
  100. package/_types/account-abstraction/types/userOperation.d.ts.map +1 -1
  101. package/_types/account-abstraction/utils/formatters/userOperationRequest.d.ts.map +1 -1
  102. package/_types/account-abstraction/utils/userOperation/getInitCode.d.ts +3 -0
  103. package/_types/account-abstraction/utils/userOperation/getInitCode.d.ts.map +1 -0
  104. package/_types/account-abstraction/utils/userOperation/getUserOperationHash.d.ts.map +1 -1
  105. package/_types/account-abstraction/utils/userOperation/getUserOperationTypedData.d.ts +45 -0
  106. package/_types/account-abstraction/utils/userOperation/getUserOperationTypedData.d.ts.map +1 -0
  107. package/_types/account-abstraction/utils/userOperation/toPackedUserOperation.d.ts.map +1 -1
  108. package/_types/celo/chainConfig.d.ts +14 -14
  109. package/_types/celo/formatters.d.ts +7 -7
  110. package/_types/chains/definitions/abstract.d.ts +3 -3
  111. package/_types/chains/definitions/abstractTestnet.d.ts +3 -3
  112. package/_types/chains/definitions/celo.d.ts +14 -14
  113. package/_types/chains/definitions/celoAlfajores.d.ts +14 -14
  114. package/_types/chains/definitions/playfiAlbireo.d.ts +3 -3
  115. package/_types/chains/definitions/sophon.d.ts +3 -3
  116. package/_types/chains/definitions/sophonTestnet.d.ts +3 -3
  117. package/_types/chains/definitions/treasure.d.ts +3 -3
  118. package/_types/chains/definitions/treasureTopaz.d.ts +3 -3
  119. package/_types/chains/definitions/zksync.d.ts +3 -3
  120. package/_types/chains/definitions/zksyncInMemoryNode.d.ts +3 -3
  121. package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts +3 -3
  122. package/_types/chains/definitions/zksyncLocalHyperchain.d.ts +3 -3
  123. package/_types/chains/definitions/zksyncLocalNode.d.ts +3 -3
  124. package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts +3 -3
  125. package/_types/constants/address.d.ts +1 -0
  126. package/_types/constants/address.d.ts.map +1 -1
  127. package/_types/errors/version.d.ts +1 -1
  128. package/_types/errors/version.d.ts.map +1 -1
  129. package/_types/types/authorization.d.ts +1 -1
  130. package/_types/types/authorization.d.ts.map +1 -1
  131. package/_types/types/misc.d.ts +7 -7
  132. package/_types/types/misc.d.ts.map +1 -1
  133. package/_types/utils/formatters/transaction.d.ts +1 -1
  134. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  135. package/_types/zksync/chainConfig.d.ts +3 -3
  136. package/_types/zksync/formatters.d.ts +3 -3
  137. package/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts +1 -2
  138. package/account-abstraction/accounts/implementations/toSimple7702SmartAccount.ts +317 -0
  139. package/account-abstraction/accounts/implementations/toSoladySmartAccount.ts +1 -2
  140. package/account-abstraction/accounts/toSmartAccount.ts +2 -2
  141. package/account-abstraction/accounts/types.ts +26 -2
  142. package/account-abstraction/actions/bundler/estimateUserOperationGas.ts +8 -1
  143. package/account-abstraction/actions/bundler/prepareUserOperation.ts +56 -2
  144. package/account-abstraction/actions/bundler/sendUserOperation.ts +2 -2
  145. package/account-abstraction/actions/paymaster/getPaymasterData.ts +24 -0
  146. package/account-abstraction/constants/abis.ts +691 -0
  147. package/account-abstraction/constants/address.ts +2 -0
  148. package/account-abstraction/index.ts +12 -1
  149. package/account-abstraction/types/entryPointVersion.ts +1 -1
  150. package/account-abstraction/types/rpc.ts +6 -3
  151. package/account-abstraction/types/userOperation.ts +69 -3
  152. package/account-abstraction/utils/formatters/userOperationRequest.ts +21 -0
  153. package/account-abstraction/utils/userOperation/getInitCode.ts +21 -0
  154. package/account-abstraction/utils/userOperation/getUserOperationHash.ts +37 -50
  155. package/account-abstraction/utils/userOperation/getUserOperationTypedData.ts +42 -0
  156. package/account-abstraction/utils/userOperation/toPackedUserOperation.ts +2 -4
  157. package/constants/address.ts +2 -0
  158. package/errors/version.ts +1 -1
  159. package/experimental/eip5792/actions/getCallsStatus.ts +1 -1
  160. package/experimental/eip5792/actions/sendCalls.ts +1 -1
  161. package/package.json +1 -1
  162. package/types/authorization.ts +1 -1
  163. package/types/misc.ts +7 -7
@@ -304,10 +304,10 @@ export declare const zksyncSepoliaTestnet: {
304
304
  maxPriorityFeePerGas?: undefined | undefined;
305
305
  blobs?: undefined;
306
306
  accessList?: undefined;
307
- authorizationList?: undefined;
308
307
  blobVersionedHashes?: undefined;
309
308
  kzg?: undefined;
310
309
  sidecars?: undefined;
310
+ authorizationList?: undefined;
311
311
  eip712Meta?: undefined | undefined;
312
312
  } | {
313
313
  data?: `0x${string}` | undefined;
@@ -323,10 +323,10 @@ export declare const zksyncSepoliaTestnet: {
323
323
  maxPriorityFeePerGas?: undefined | undefined;
324
324
  accessList?: import("../../index.js").AccessList | undefined;
325
325
  blobs?: undefined;
326
- authorizationList?: undefined;
327
326
  blobVersionedHashes?: undefined;
328
327
  kzg?: undefined;
329
328
  sidecars?: undefined;
329
+ authorizationList?: undefined;
330
330
  eip712Meta?: undefined | undefined;
331
331
  } | {
332
332
  data?: `0x${string}` | undefined;
@@ -342,10 +342,10 @@ export declare const zksyncSepoliaTestnet: {
342
342
  maxPriorityFeePerGas?: `0x${string}` | undefined;
343
343
  accessList?: import("../../index.js").AccessList | undefined;
344
344
  blobs?: undefined;
345
- authorizationList?: undefined;
346
345
  blobVersionedHashes?: undefined;
347
346
  kzg?: undefined;
348
347
  sidecars?: undefined;
348
+ authorizationList?: undefined;
349
349
  eip712Meta?: undefined | undefined;
350
350
  } | {
351
351
  type?: "0x3" | undefined;
@@ -1,5 +1,6 @@
1
1
  export declare const entryPoint06Address: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
2
2
  export declare const entryPoint07Address: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
3
+ export declare const entryPoint08Address: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108";
3
4
  export declare const ethAddress: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
4
5
  export declare const zeroAddress: "0x0000000000000000000000000000000000000000";
5
6
  //# sourceMappingURL=address.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../constants/address.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,EAC9B,4CAAqD,CAAA;AACvD,eAAO,MAAM,mBAAmB,EAC9B,4CAAqD,CAAA;AAEvD,eAAO,MAAM,UAAU,EAAG,4CAAqD,CAAA;AAE/E,eAAO,MAAM,WAAW,EAAG,4CAAqD,CAAA"}
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../constants/address.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,EAC9B,4CAAqD,CAAA;AACvD,eAAO,MAAM,mBAAmB,EAC9B,4CAAqD,CAAA;AACvD,eAAO,MAAM,mBAAmB,EAC9B,4CAAqD,CAAA;AAEvD,eAAO,MAAM,UAAU,EAAG,4CAAqD,CAAA;AAE/E,eAAO,MAAM,WAAW,EAAG,4CAAqD,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const version = "2.27.3";
1
+ export declare const version = "2.28.0-canary-20250421235327";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../errors/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAA"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../errors/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,iCAAiC,CAAA"}
@@ -8,7 +8,7 @@ export type Authorization<uint32 = number, signed extends boolean = false> = {
8
8
  chainId: uint32;
9
9
  /** Nonce of the EOA to delegate to. */
10
10
  nonce: uint32;
11
- } & (signed extends true ? Signature : ExactPartial<Signature>);
11
+ } & (signed extends true ? Signature<uint32> : ExactPartial<Signature<uint32>>);
12
12
  export type AuthorizationList<uint32 = number, signed extends boolean = false> = readonly Authorization<uint32, signed>[];
13
13
  export type AuthorizationRequest<uint32 = number> = OneOf<{
14
14
  /** Address of the contract to delegate to. */
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../types/authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAErD,MAAM,MAAM,aAAa,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,SAAS,OAAO,GAAG,KAAK,IAAI;IAC3E,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,uCAAuC;IACvC,KAAK,EA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uB,EAAE,CAAA"}
@@ -7,23 +7,23 @@ export type SignableMessage = string | {
7
7
  /** Raw data representation of the message. */
8
8
  raw: Hex | ByteArray;
9
9
  };
10
- export type SignatureLegacy = {
10
+ export type SignatureLegacy<bigintType = bigint> = {
11
11
  r: Hex;
12
12
  s: Hex;
13
- v: bigint;
13
+ v: bigintType;
14
14
  };
15
- export type Signature = OneOf<SignatureLegacy | {
15
+ export type Signature<numberType = number, bigintType = bigint> = OneOf<SignatureLegacy | {
16
16
  r: Hex;
17
17
  s: Hex;
18
18
  /** @deprecated use `yParity`. */
19
- v: bigint;
20
- yParity?: number | undefined;
19
+ v: bigintType;
20
+ yParity?: numberType | undefined;
21
21
  } | {
22
22
  r: Hex;
23
23
  s: Hex;
24
24
  /** @deprecated use `yParity`. */
25
- v?: bigint | undefined;
26
- yParity: number;
25
+ v?: bigintType | undefined;
26
+ yParity: numberType;
27
27
  }>;
28
28
  export type CompactSignature = {
29
29
  r: Hex;
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../types/misc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAA;AAClC,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAA;AAC/B,MAAM,MAAM,IAAI,GAAG,KAAK,MAAM,EAAE,CAAA;AAChC,MAAM,MAAM,QAAQ,GAAG,GAAG,GAAG,GAAG,EAAE,GAAG,IAAI,CAAA;AACzC,MAAM,MAAM,eAAe,GACvB,MAAM,GACN;IACE,8CAA8C;IAC9C,GAAG,EAAE,GAAG,GAAG,SAAS,CAAA;CACrB,CAAA;AACL,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,GAAG,CAAA;IACN,CAAC,EAAE,GAAG,CAAA;IACN,CAAC,EAAE,MAAM,CAAA;CACV,CAAA;AACD,MAAM,MAAM,SAAS,GAAG,KAA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;IACjC,CAAC,EAAE,UAAU,CAAA;IACb,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CACjC,GACD;IACE,CAAC,EAAE,GAAG,CAAA;IACN,CAAC,EAAE,GAAG,CAAA;IACN,iCAAiC;IACjC,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAC1B,OAAO,EAAE,UAAU,CAAA;CACpB,CACJ,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,EAAE,GAAG,CAAA;IACN,WAAW,EAAE,GAAG,CAAA;CACjB,CAAA"}
@@ -20,7 +20,7 @@ export declare const transactionType: {
20
20
  export type FormatTransactionErrorType = ErrorType;
21
21
  export declare function formatTransaction(transaction: ExactPartial<RpcTransaction>): Transaction;
22
22
  export type DefineTransactionErrorType = DefineFormatterErrorType | ErrorType;
23
- export declare const defineTransaction: <parametersOverride, returnTypeOverride, exclude extends ("type" | "r" | "s" | "v" | "yParity" | "gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "to" | "from" | "gas" | "nonce" | "value" | "blockHash" | "blockNumber" | "hash" | "input" | "transactionIndex" | "accessList" | "authorizationList" | "blobVersionedHashes" | "chainId" | keyof parametersOverride)[] = []>({ exclude, format: overrides, }: {
23
+ export declare const defineTransaction: <parametersOverride, returnTypeOverride, exclude extends ("type" | "r" | "s" | "v" | "yParity" | "gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "to" | "from" | "gas" | "nonce" | "value" | "accessList" | "blobVersionedHashes" | "authorizationList" | "blockHash" | "blockNumber" | "hash" | "input" | "transactionIndex" | "chainId" | keyof parametersOverride)[] = []>({ exclude, format: overrides, }: {
24
24
  exclude?: exclude | undefined;
25
25
  format: (_: parametersOverride) => returnTypeOverride;
26
26
  }) => {
@@ -15,7 +15,7 @@ export declare const rpcTransactionType: {
15
15
  export type FormatTransactionRequestErrorType = ErrorType;
16
16
  export declare function formatTransactionRequest(request: ExactPartial<TransactionRequest>): RpcTransactionRequest;
17
17
  export type DefineTransactionRequestErrorType = DefineFormatterErrorType | ErrorType;
18
- export declare const defineTransactionRequest: <parametersOverride, returnTypeOverride, exclude extends ("type" | "gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "to" | "data" | "from" | "gas" | "nonce" | "value" | "blobs" | "accessList" | "authorizationList" | "blobVersionedHashes" | "kzg" | "sidecars" | keyof parametersOverride)[] = []>({ exclude, format: overrides, }: {
18
+ export declare const defineTransactionRequest: <parametersOverride, returnTypeOverride, exclude extends ("type" | "gasPrice" | "maxFeePerBlobGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "to" | "data" | "from" | "gas" | "nonce" | "value" | "blobs" | "accessList" | "blobVersionedHashes" | "kzg" | "sidecars" | "authorizationList" | keyof parametersOverride)[] = []>({ exclude, format: overrides, }: {
19
19
  exclude?: exclude | undefined;
20
20
  format: (_: parametersOverride) => returnTypeOverride;
21
21
  }) => {
@@ -263,10 +263,10 @@ export declare const chainConfig: {
263
263
  maxPriorityFeePerGas?: undefined | undefined;
264
264
  blobs?: undefined;
265
265
  accessList?: undefined;
266
- authorizationList?: undefined;
267
266
  blobVersionedHashes?: undefined;
268
267
  kzg?: undefined;
269
268
  sidecars?: undefined;
269
+ authorizationList?: undefined;
270
270
  eip712Meta?: undefined | undefined;
271
271
  } | {
272
272
  data?: `0x${string}` | undefined;
@@ -282,10 +282,10 @@ export declare const chainConfig: {
282
282
  maxPriorityFeePerGas?: undefined | undefined;
283
283
  accessList?: import("../index.js").AccessList | undefined;
284
284
  blobs?: undefined;
285
- authorizationList?: undefined;
286
285
  blobVersionedHashes?: undefined;
287
286
  kzg?: undefined;
288
287
  sidecars?: undefined;
288
+ authorizationList?: undefined;
289
289
  eip712Meta?: undefined | undefined;
290
290
  } | {
291
291
  data?: `0x${string}` | undefined;
@@ -301,10 +301,10 @@ export declare const chainConfig: {
301
301
  maxPriorityFeePerGas?: `0x${string}` | undefined;
302
302
  accessList?: import("../index.js").AccessList | undefined;
303
303
  blobs?: undefined;
304
- authorizationList?: undefined;
305
304
  blobVersionedHashes?: undefined;
306
305
  kzg?: undefined;
307
306
  sidecars?: undefined;
307
+ authorizationList?: undefined;
308
308
  eip712Meta?: undefined | undefined;
309
309
  } | {
310
310
  type?: "0x3" | undefined;
@@ -265,10 +265,10 @@ export declare const formatters: {
265
265
  maxPriorityFeePerGas?: undefined | undefined;
266
266
  blobs?: undefined;
267
267
  accessList?: undefined;
268
- authorizationList?: undefined;
269
268
  blobVersionedHashes?: undefined;
270
269
  kzg?: undefined;
271
270
  sidecars?: undefined;
271
+ authorizationList?: undefined;
272
272
  eip712Meta?: undefined | undefined;
273
273
  } | {
274
274
  data?: `0x${string}` | undefined;
@@ -284,10 +284,10 @@ export declare const formatters: {
284
284
  maxPriorityFeePerGas?: undefined | undefined;
285
285
  accessList?: import("../index.js").AccessList | undefined;
286
286
  blobs?: undefined;
287
- authorizationList?: undefined;
288
287
  blobVersionedHashes?: undefined;
289
288
  kzg?: undefined;
290
289
  sidecars?: undefined;
290
+ authorizationList?: undefined;
291
291
  eip712Meta?: undefined | undefined;
292
292
  } | {
293
293
  data?: `0x${string}` | undefined;
@@ -303,10 +303,10 @@ export declare const formatters: {
303
303
  maxPriorityFeePerGas?: `0x${string}` | undefined;
304
304
  accessList?: import("../index.js").AccessList | undefined;
305
305
  blobs?: undefined;
306
- authorizationList?: undefined;
307
306
  blobVersionedHashes?: undefined;
308
307
  kzg?: undefined;
309
308
  sidecars?: undefined;
309
+ authorizationList?: undefined;
310
310
  eip712Meta?: undefined | undefined;
311
311
  } | {
312
312
  type?: "0x3" | undefined;
@@ -4,7 +4,6 @@ import type * as WebAuthnP256 from 'ox/WebAuthnP256'
4
4
 
5
5
  import type { LocalAccount } from '../../../accounts/types.js'
6
6
  import { readContract } from '../../../actions/public/readContract.js'
7
- import type { Client } from '../../../clients/createClient.js'
8
7
  import { entryPoint06Address } from '../../../constants/address.js'
9
8
  import { BaseError } from '../../../errors/base.js'
10
9
  import type { Hash, Hex } from '../../../types/misc.js'
@@ -32,7 +31,7 @@ import type {
32
31
 
33
32
  export type ToCoinbaseSmartAccountParameters = {
34
33
  address?: Address | undefined
35
- client: Client
34
+ client: CoinbaseSmartAccountImplementation['client']
36
35
  ownerIndex?: number | undefined
37
36
  owners: readonly (Address | OneOf<LocalAccount | WebAuthnAccount>)[]
38
37
  nonce?: bigint | undefined
@@ -0,0 +1,317 @@
1
+ import type { Address, TypedData } from 'abitype'
2
+
3
+ import type { PrivateKeyAccount } from '../../../accounts/types.js'
4
+ import { entryPoint08Address } from '../../../constants/address.js'
5
+ import { BaseError } from '../../../errors/base.js'
6
+ import type { TypedDataDefinition } from '../../../types/typedData.js'
7
+ import type { Prettify } from '../../../types/utils.js'
8
+ import { decodeFunctionData } from '../../../utils/abi/decodeFunctionData.js'
9
+ import { encodeFunctionData } from '../../../utils/abi/encodeFunctionData.js'
10
+ import { entryPoint08Abi } from '../../constants/abis.js'
11
+ import { getUserOperationTypedData } from '../../utils/userOperation/getUserOperationTypedData.js'
12
+ import { toSmartAccount } from '../toSmartAccount.js'
13
+ import type { SmartAccount, SmartAccountImplementation } from '../types.js'
14
+
15
+ export type ToSimple7702SmartAccountParameters = {
16
+ client: Simple7702SmartAccountImplementation['client']
17
+ implementation?: Address | undefined
18
+ getNonce?: SmartAccountImplementation['getNonce'] | undefined
19
+ owner: PrivateKeyAccount
20
+ }
21
+
22
+ export type ToSimple7702SmartAccountReturnType = Prettify<
23
+ SmartAccount<Simple7702SmartAccountImplementation>
24
+ >
25
+
26
+ export type Simple7702SmartAccountImplementation = SmartAccountImplementation<
27
+ typeof entryPoint08Abi,
28
+ '0.8',
29
+ { abi: typeof abi; owner: PrivateKeyAccount },
30
+ true
31
+ >
32
+
33
+ /**
34
+ * @description Create a Simple7702 Smart Account – based off [eth-infinitism's `Simple7702Account.sol`](https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/accounts/Simple7702Account.sol).
35
+ *
36
+ * @param parameters - {@link ToSimple7702SmartAccountParameters}
37
+ * @returns Simple7702 Smart Account. {@link ToSimple7702SmartAccountReturnType}
38
+ *
39
+ * @example
40
+ * import { toSimple7702SmartAccount } from 'viem/account-abstraction'
41
+ * import { client } from './client.js'
42
+ *
43
+ * const implementation = toSimple7702SmartAccount({
44
+ * client,
45
+ * owner: '0x...',
46
+ * })
47
+ */
48
+ export async function toSimple7702SmartAccount(
49
+ parameters: ToSimple7702SmartAccountParameters,
50
+ ): Promise<ToSimple7702SmartAccountReturnType> {
51
+ const {
52
+ client,
53
+ implementation = '0xe6Cae83BdE06E4c305530e199D7217f42808555B',
54
+ getNonce,
55
+ owner,
56
+ } = parameters
57
+
58
+ const entryPoint = {
59
+ abi: entryPoint08Abi,
60
+ address: entryPoint08Address,
61
+ version: '0.8',
62
+ } as const
63
+
64
+ return toSmartAccount({
65
+ authorization: { account: owner, address: implementation },
66
+ abi,
67
+ client,
68
+ extend: { abi, owner }, // not removing abi from here as this will be a breaking change
69
+ entryPoint,
70
+ getNonce,
71
+
72
+ async decodeCalls(data) {
73
+ const result = decodeFunctionData({
74
+ abi,
75
+ data,
76
+ })
77
+
78
+ if (result.functionName === 'execute')
79
+ return [
80
+ { to: result.args[0], value: result.args[1], data: result.args[2] },
81
+ ]
82
+ if (result.functionName === 'executeBatch')
83
+ return result.args[0].map((arg) => ({
84
+ to: arg.target,
85
+ value: arg.value,
86
+ data: arg.data,
87
+ }))
88
+ throw new BaseError(`unable to decode calls for "${result.functionName}"`)
89
+ },
90
+
91
+ async encodeCalls(calls) {
92
+ if (calls.length === 1)
93
+ return encodeFunctionData({
94
+ abi,
95
+ functionName: 'execute',
96
+ args: [calls[0].to, calls[0].value ?? 0n, calls[0].data ?? '0x'],
97
+ })
98
+ return encodeFunctionData({
99
+ abi,
100
+ functionName: 'executeBatch',
101
+ args: [
102
+ calls.map((call) => ({
103
+ data: call.data ?? '0x',
104
+ target: call.to,
105
+ value: call.value ?? 0n,
106
+ })),
107
+ ],
108
+ })
109
+ },
110
+
111
+ async getAddress() {
112
+ return owner.address
113
+ },
114
+
115
+ async getFactoryArgs() {
116
+ return { factory: '0x7702', factoryData: '0x' }
117
+ },
118
+
119
+ async getStubSignature() {
120
+ return '0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c'
121
+ },
122
+
123
+ async signMessage(parameters) {
124
+ const { message } = parameters
125
+ return await owner.signMessage({ message })
126
+ },
127
+
128
+ async signTypedData(parameters) {
129
+ const { domain, types, primaryType, message } =
130
+ parameters as TypedDataDefinition<TypedData, string>
131
+ return await owner.signTypedData({
132
+ domain,
133
+ message,
134
+ primaryType,
135
+ types,
136
+ })
137
+ },
138
+
139
+ async signUserOperation(parameters) {
140
+ const { chainId = client.chain!.id, ...userOperation } = parameters
141
+
142
+ const address = await this.getAddress()
143
+ const typedData = getUserOperationTypedData({
144
+ chainId,
145
+ entryPointAddress: entryPoint.address,
146
+ userOperation: {
147
+ ...userOperation,
148
+ sender: address,
149
+ },
150
+ })
151
+ return await owner.signTypedData(typedData)
152
+ },
153
+ })
154
+ }
155
+
156
+ /////////////////////////////////////////////////////////////////////////////////////////////
157
+ // Constants
158
+
159
+ const abi = [
160
+ { inputs: [], name: 'ECDSAInvalidSignature', type: 'error' },
161
+ {
162
+ inputs: [{ internalType: 'uint256', name: 'length', type: 'uint256' }],
163
+ name: 'ECDSAInvalidSignatureLength',
164
+ type: 'error',
165
+ },
166
+ {
167
+ inputs: [{ internalType: 'bytes32', name: 's', type: 'bytes32' }],
168
+ name: 'ECDSAInvalidSignatureS',
169
+ type: 'error',
170
+ },
171
+ {
172
+ inputs: [
173
+ { internalType: 'uint256', name: 'index', type: 'uint256' },
174
+ { internalType: 'bytes', name: 'error', type: 'bytes' },
175
+ ],
176
+ name: 'ExecuteError',
177
+ type: 'error',
178
+ },
179
+ { stateMutability: 'payable', type: 'fallback' },
180
+ {
181
+ inputs: [],
182
+ name: 'entryPoint',
183
+ outputs: [
184
+ { internalType: 'contract IEntryPoint', name: '', type: 'address' },
185
+ ],
186
+ stateMutability: 'pure',
187
+ type: 'function',
188
+ },
189
+ {
190
+ inputs: [
191
+ { internalType: 'address', name: 'target', type: 'address' },
192
+ { internalType: 'uint256', name: 'value', type: 'uint256' },
193
+ { internalType: 'bytes', name: 'data', type: 'bytes' },
194
+ ],
195
+ name: 'execute',
196
+ outputs: [],
197
+ stateMutability: 'nonpayable',
198
+ type: 'function',
199
+ },
200
+ {
201
+ inputs: [
202
+ {
203
+ components: [
204
+ { internalType: 'address', name: 'target', type: 'address' },
205
+ { internalType: 'uint256', name: 'value', type: 'uint256' },
206
+ { internalType: 'bytes', name: 'data', type: 'bytes' },
207
+ ],
208
+ internalType: 'struct BaseAccount.Call[]',
209
+ name: 'calls',
210
+ type: 'tuple[]',
211
+ },
212
+ ],
213
+ name: 'executeBatch',
214
+ outputs: [],
215
+ stateMutability: 'nonpayable',
216
+ type: 'function',
217
+ },
218
+ {
219
+ inputs: [],
220
+ name: 'getNonce',
221
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
222
+ stateMutability: 'view',
223
+ type: 'function',
224
+ },
225
+ {
226
+ inputs: [
227
+ { internalType: 'bytes32', name: 'hash', type: 'bytes32' },
228
+ { internalType: 'bytes', name: 'signature', type: 'bytes' },
229
+ ],
230
+ name: 'isValidSignature',
231
+ outputs: [{ internalType: 'bytes4', name: 'magicValue', type: 'bytes4' }],
232
+ stateMutability: 'view',
233
+ type: 'function',
234
+ },
235
+ {
236
+ inputs: [
237
+ { internalType: 'address', name: '', type: 'address' },
238
+ { internalType: 'address', name: '', type: 'address' },
239
+ { internalType: 'uint256[]', name: '', type: 'uint256[]' },
240
+ { internalType: 'uint256[]', name: '', type: 'uint256[]' },
241
+ { internalType: 'bytes', name: '', type: 'bytes' },
242
+ ],
243
+ name: 'onERC1155BatchReceived',
244
+ outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
245
+ stateMutability: 'nonpayable',
246
+ type: 'function',
247
+ },
248
+ {
249
+ inputs: [
250
+ { internalType: 'address', name: '', type: 'address' },
251
+ { internalType: 'address', name: '', type: 'address' },
252
+ { internalType: 'uint256', name: '', type: 'uint256' },
253
+ { internalType: 'uint256', name: '', type: 'uint256' },
254
+ { internalType: 'bytes', name: '', type: 'bytes' },
255
+ ],
256
+ name: 'onERC1155Received',
257
+ outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
258
+ stateMutability: 'nonpayable',
259
+ type: 'function',
260
+ },
261
+ {
262
+ inputs: [
263
+ { internalType: 'address', name: '', type: 'address' },
264
+ { internalType: 'address', name: '', type: 'address' },
265
+ { internalType: 'uint256', name: '', type: 'uint256' },
266
+ { internalType: 'bytes', name: '', type: 'bytes' },
267
+ ],
268
+ name: 'onERC721Received',
269
+ outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
270
+ stateMutability: 'nonpayable',
271
+ type: 'function',
272
+ },
273
+ {
274
+ inputs: [{ internalType: 'bytes4', name: 'id', type: 'bytes4' }],
275
+ name: 'supportsInterface',
276
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
277
+ stateMutability: 'pure',
278
+ type: 'function',
279
+ },
280
+ {
281
+ inputs: [
282
+ {
283
+ components: [
284
+ { internalType: 'address', name: 'sender', type: 'address' },
285
+ { internalType: 'uint256', name: 'nonce', type: 'uint256' },
286
+ { internalType: 'bytes', name: 'initCode', type: 'bytes' },
287
+ { internalType: 'bytes', name: 'callData', type: 'bytes' },
288
+ {
289
+ internalType: 'bytes32',
290
+ name: 'accountGasLimits',
291
+ type: 'bytes32',
292
+ },
293
+ {
294
+ internalType: 'uint256',
295
+ name: 'preVerificationGas',
296
+ type: 'uint256',
297
+ },
298
+ { internalType: 'bytes32', name: 'gasFees', type: 'bytes32' },
299
+ { internalType: 'bytes', name: 'paymasterAndData', type: 'bytes' },
300
+ { internalType: 'bytes', name: 'signature', type: 'bytes' },
301
+ ],
302
+ internalType: 'struct PackedUserOperation',
303
+ name: 'userOp',
304
+ type: 'tuple',
305
+ },
306
+ { internalType: 'bytes32', name: 'userOpHash', type: 'bytes32' },
307
+ { internalType: 'uint256', name: 'missingAccountFunds', type: 'uint256' },
308
+ ],
309
+ name: 'validateUserOp',
310
+ outputs: [
311
+ { internalType: 'uint256', name: 'validationData', type: 'uint256' },
312
+ ],
313
+ stateMutability: 'nonpayable',
314
+ type: 'function',
315
+ },
316
+ { stateMutability: 'payable', type: 'receive' },
317
+ ] as const
@@ -3,7 +3,6 @@ import type { Abi, Address, TypedData } from 'abitype'
3
3
  import { parseAccount } from '../../../accounts/utils/parseAccount.js'
4
4
  import { readContract } from '../../../actions/public/readContract.js'
5
5
  import { signMessage as signMessage_ } from '../../../actions/wallet/signMessage.js'
6
- import type { Client } from '../../../clients/createClient.js'
7
6
  import { entryPoint07Address } from '../../../constants/address.js'
8
7
  import { BaseError } from '../../../errors/base.js'
9
8
  import { signMessage } from '../../../experimental/erc7739/actions/signMessage.js'
@@ -27,7 +26,7 @@ export type ToSoladySmartAccountParameters<
27
26
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
28
27
  > = {
29
28
  address?: Address | undefined
30
- client: Client
29
+ client: SoladySmartAccountImplementation['client']
31
30
  entryPoint?:
32
31
  | {
33
32
  abi: entryPointAbi
@@ -115,7 +115,7 @@ export async function toSmartAccount<
115
115
  this.getFactoryArgs(),
116
116
  implementation.signMessage(parameters),
117
117
  ])
118
- if (factory && factoryData)
118
+ if (factory && factoryData && factory !== '0x7702')
119
119
  return serializeErc6492Signature({
120
120
  address: factory,
121
121
  data: factoryData,
@@ -128,7 +128,7 @@ export async function toSmartAccount<
128
128
  this.getFactoryArgs(),
129
129
  implementation.signTypedData(parameters),
130
130
  ])
131
- if (factory && factoryData)
131
+ if (factory && factoryData && factory !== '0x7702')
132
132
  return serializeErc6492Signature({
133
133
  address: factory,
134
134
  data: factoryData,
@@ -1,7 +1,14 @@
1
1
  import type { Abi, Address, TypedData } from 'abitype'
2
2
  import type * as WebAuthnP256 from 'ox/WebAuthnP256'
3
3
 
4
+ import type {
5
+ JsonRpcAccount,
6
+ LocalAccount,
7
+ PrivateKeyAccount,
8
+ } from '../../accounts/types.js'
4
9
  import type { Client } from '../../clients/createClient.js'
10
+ import type { Transport } from '../../clients/transports/createTransport.js'
11
+ import type { Chain } from '../../types/chain.js'
5
12
  import type { Hash, Hex, SignableMessage } from '../../types/misc.js'
6
13
  import type { TypedDataDefinition } from '../../types/typedData.js'
7
14
  import type { Assign, ExactPartial, UnionPartialBy } from '../../types/utils.js'
@@ -23,9 +30,14 @@ export type SmartAccountImplementation<
23
30
  entryPointAbi extends Abi | readonly unknown[] = Abi,
24
31
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
25
32
  extend extends object = object,
33
+ eip7702 extends boolean = boolean,
26
34
  > = {
27
35
  /** Client used to retrieve Smart Account data, and perform signing (if owner is a JSON-RPC Account). */
28
- client: Client
36
+ client: Client<
37
+ Transport,
38
+ Chain | undefined,
39
+ JsonRpcAccount | LocalAccount | undefined
40
+ >
29
41
  /** Compatible EntryPoint of the Smart Account. */
30
42
  entryPoint: {
31
43
  /** Compatible EntryPoint ABI. */
@@ -189,7 +201,19 @@ export type SmartAccountImplementation<
189
201
  | undefined
190
202
  }
191
203
  | undefined
192
- }
204
+ } & (eip7702 extends true
205
+ ? {
206
+ /** EIP-7702 authorization properties, if applicable. */
207
+ authorization: {
208
+ /** EOA to delegate to. */
209
+ account: PrivateKeyAccount
210
+ /** Delegation address. */
211
+ address: Address
212
+ }
213
+ }
214
+ : {
215
+ authorization?: undefined
216
+ })
193
217
 
194
218
  export type SmartAccount<
195
219
  implementation extends
@@ -174,7 +174,13 @@ export async function estimateUserOperationGas<
174
174
  'prepareUserOperation',
175
175
  )({
176
176
  ...parameters,
177
- parameters: ['factory', 'nonce', 'paymaster', 'signature'],
177
+ parameters: [
178
+ 'authorization',
179
+ 'factory',
180
+ 'nonce',
181
+ 'paymaster',
182
+ 'signature',
183
+ ],
178
184
  } as unknown as PrepareUserOperationParameters)
179
185
  : parameters
180
186
 
@@ -183,6 +189,7 @@ export async function estimateUserOperationGas<
183
189
  formatUserOperationRequest(request as UserOperation),
184
190
  (entryPointAddress ?? account?.entryPoint?.address)!,
185
191
  ] as const
192
+
186
193
  const result = await client.request({
187
194
  method: 'eth_estimateUserOperationGas',
188
195
  params: rpcStateOverride ? [...params, rpcStateOverride] : [...params],