viem 2.27.2 → 2.28.0-entrypoint-0-8-20250417075822

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 (133) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/_cjs/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
  3. package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +313 -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/getUserOperationHash.js +70 -0
  24. package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
  25. package/_cjs/constants/address.js +2 -1
  26. package/_cjs/constants/address.js.map +1 -1
  27. package/_cjs/errors/version.js +1 -1
  28. package/_cjs/errors/version.js.map +1 -1
  29. package/_esm/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
  30. package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +327 -0
  31. package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +1 -0
  32. package/_esm/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
  33. package/_esm/account-abstraction/accounts/toSmartAccount.js +2 -2
  34. package/_esm/account-abstraction/accounts/toSmartAccount.js.map +1 -1
  35. package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js +7 -1
  36. package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
  37. package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +21 -1
  38. package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
  39. package/_esm/account-abstraction/actions/bundler/sendUserOperation.js +2 -2
  40. package/_esm/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
  41. package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
  42. package/_esm/account-abstraction/constants/abis.js +690 -0
  43. package/_esm/account-abstraction/constants/abis.js.map +1 -1
  44. package/_esm/account-abstraction/constants/address.js +1 -0
  45. package/_esm/account-abstraction/constants/address.js.map +1 -1
  46. package/_esm/account-abstraction/index.js +3 -2
  47. package/_esm/account-abstraction/index.js.map +1 -1
  48. package/_esm/account-abstraction/utils/formatters/userOperationRequest.js +19 -0
  49. package/_esm/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
  50. package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js +70 -0
  51. package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
  52. package/_esm/constants/address.js +1 -0
  53. package/_esm/constants/address.js.map +1 -1
  54. package/_esm/errors/version.js +1 -1
  55. package/_esm/errors/version.js.map +1 -1
  56. package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts +1 -2
  57. package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts.map +1 -1
  58. package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts +311 -0
  59. package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts.map +1 -0
  60. package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts +1 -2
  61. package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts.map +1 -1
  62. package/_types/account-abstraction/accounts/types.d.ts +16 -3
  63. package/_types/account-abstraction/accounts/types.d.ts.map +1 -1
  64. package/_types/account-abstraction/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  65. package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts +23 -6
  66. package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
  67. package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts +1 -1
  68. package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
  69. package/_types/account-abstraction/constants/abis.d.ts +830 -0
  70. package/_types/account-abstraction/constants/abis.d.ts.map +1 -1
  71. package/_types/account-abstraction/constants/address.d.ts +1 -0
  72. package/_types/account-abstraction/constants/address.d.ts.map +1 -1
  73. package/_types/account-abstraction/index.d.ts +3 -2
  74. package/_types/account-abstraction/index.d.ts.map +1 -1
  75. package/_types/account-abstraction/types/entryPointVersion.d.ts +1 -1
  76. package/_types/account-abstraction/types/entryPointVersion.d.ts.map +1 -1
  77. package/_types/account-abstraction/types/rpc.d.ts +6 -3
  78. package/_types/account-abstraction/types/rpc.d.ts.map +1 -1
  79. package/_types/account-abstraction/types/userOperation.d.ts +49 -5
  80. package/_types/account-abstraction/types/userOperation.d.ts.map +1 -1
  81. package/_types/account-abstraction/utils/formatters/userOperationRequest.d.ts.map +1 -1
  82. package/_types/account-abstraction/utils/userOperation/getUserOperationHash.d.ts.map +1 -1
  83. package/_types/celo/chainConfig.d.ts +14 -14
  84. package/_types/celo/formatters.d.ts +7 -7
  85. package/_types/chains/definitions/abstract.d.ts +3 -3
  86. package/_types/chains/definitions/abstractTestnet.d.ts +3 -3
  87. package/_types/chains/definitions/celo.d.ts +14 -14
  88. package/_types/chains/definitions/celoAlfajores.d.ts +14 -14
  89. package/_types/chains/definitions/playfiAlbireo.d.ts +3 -3
  90. package/_types/chains/definitions/sophon.d.ts +3 -3
  91. package/_types/chains/definitions/sophonTestnet.d.ts +3 -3
  92. package/_types/chains/definitions/treasure.d.ts +3 -3
  93. package/_types/chains/definitions/treasureTopaz.d.ts +3 -3
  94. package/_types/chains/definitions/zksync.d.ts +3 -3
  95. package/_types/chains/definitions/zksyncInMemoryNode.d.ts +3 -3
  96. package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts +3 -3
  97. package/_types/chains/definitions/zksyncLocalHyperchain.d.ts +3 -3
  98. package/_types/chains/definitions/zksyncLocalNode.d.ts +3 -3
  99. package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts +3 -3
  100. package/_types/constants/address.d.ts +1 -0
  101. package/_types/constants/address.d.ts.map +1 -1
  102. package/_types/errors/version.d.ts +1 -1
  103. package/_types/errors/version.d.ts.map +1 -1
  104. package/_types/types/authorization.d.ts +1 -1
  105. package/_types/types/authorization.d.ts.map +1 -1
  106. package/_types/types/misc.d.ts +7 -7
  107. package/_types/types/misc.d.ts.map +1 -1
  108. package/_types/utils/formatters/transaction.d.ts +1 -1
  109. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  110. package/_types/zksync/chainConfig.d.ts +3 -3
  111. package/_types/zksync/formatters.d.ts +3 -3
  112. package/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts +1 -2
  113. package/account-abstraction/accounts/implementations/toSimple7702SmartAccount.ts +382 -0
  114. package/account-abstraction/accounts/implementations/toSoladySmartAccount.ts +1 -2
  115. package/account-abstraction/accounts/toSmartAccount.ts +2 -2
  116. package/account-abstraction/accounts/types.ts +26 -2
  117. package/account-abstraction/actions/bundler/estimateUserOperationGas.ts +8 -1
  118. package/account-abstraction/actions/bundler/prepareUserOperation.ts +56 -2
  119. package/account-abstraction/actions/bundler/sendUserOperation.ts +2 -2
  120. package/account-abstraction/actions/paymaster/getPaymasterData.ts +24 -0
  121. package/account-abstraction/constants/abis.ts +691 -0
  122. package/account-abstraction/constants/address.ts +2 -0
  123. package/account-abstraction/index.ts +12 -1
  124. package/account-abstraction/types/entryPointVersion.ts +1 -1
  125. package/account-abstraction/types/rpc.ts +6 -3
  126. package/account-abstraction/types/userOperation.ts +69 -3
  127. package/account-abstraction/utils/formatters/userOperationRequest.ts +21 -0
  128. package/account-abstraction/utils/userOperation/getUserOperationHash.ts +79 -0
  129. package/constants/address.ts +2 -0
  130. package/errors/version.ts +1 -1
  131. package/package.json +1 -1
  132. package/types/authorization.ts +1 -1
  133. package/types/misc.ts +7 -7
@@ -17,6 +17,12 @@ export {
17
17
  type ToSoladySmartAccountReturnType,
18
18
  toSoladySmartAccount,
19
19
  } from './accounts/implementations/toSoladySmartAccount.js'
20
+ export {
21
+ type Simple7702SmartAccountImplementation,
22
+ type ToSimple7702SmartAccountParameters,
23
+ type ToSimple7702SmartAccountReturnType,
24
+ toSimple7702SmartAccount,
25
+ } from './accounts/implementations/toSimple7702SmartAccount.js'
20
26
  export {
21
27
  type ToSmartAccountParameters,
22
28
  type ToSmartAccountReturnType,
@@ -112,10 +118,15 @@ export {
112
118
  createPaymasterClient,
113
119
  } from './clients/createPaymasterClient.js'
114
120
 
115
- export { entryPoint06Abi, entryPoint07Abi } from './constants/abis.js'
121
+ export {
122
+ entryPoint06Abi,
123
+ entryPoint07Abi,
124
+ entryPoint08Abi,
125
+ } from './constants/abis.js'
116
126
  export {
117
127
  entryPoint06Address,
118
128
  entryPoint07Address,
129
+ entryPoint08Address,
119
130
  } from './constants/address.js'
120
131
 
121
132
  export {
@@ -1,7 +1,7 @@
1
1
  import type { SmartAccount } from '../accounts/types.js'
2
2
 
3
3
  /** @link https://github.com/eth-infinitism/account-abstraction/releases */
4
- export type EntryPointVersion = '0.6' | '0.7'
4
+ export type EntryPointVersion = '0.6' | '0.7' | '0.8'
5
5
 
6
6
  export type DeriveEntryPointVersion<account extends SmartAccount | undefined> =
7
7
  account extends SmartAccount
@@ -1,4 +1,5 @@
1
1
  import type { Hex } from '../../types/misc.js'
2
+ import type { RpcAuthorization } from '../../types/rpc.js'
2
3
  import type { EntryPointVersion } from './entryPointVersion.js'
3
4
  import type {
4
5
  EstimateUserOperationGasReturnType,
@@ -14,11 +15,13 @@ export type RpcEstimateUserOperationGasReturnType<
14
15
 
15
16
  export type RpcGetUserOperationByHashReturnType<
16
17
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
17
- > = GetUserOperationByHashReturnType<entryPointVersion, Hex>
18
+ > = GetUserOperationByHashReturnType<entryPointVersion, Hex, Hex>
18
19
 
19
20
  export type RpcUserOperation<
20
21
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
21
- > = UserOperation<entryPointVersion, Hex>
22
+ > = UserOperation<entryPointVersion, Hex, Hex> & {
23
+ eip7702Auth?: RpcAuthorization
24
+ }
22
25
 
23
26
  export type RpcUserOperationReceipt<
24
27
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
@@ -26,4 +29,4 @@ export type RpcUserOperationReceipt<
26
29
 
27
30
  export type RpcUserOperationRequest<
28
31
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
29
- > = UserOperationRequest<entryPointVersion, Hex>
32
+ > = UserOperationRequest<entryPointVersion, Hex, Hex>
@@ -1,4 +1,5 @@
1
1
  import type { Address } from 'abitype'
2
+ import type { SignedAuthorization } from '../../types/authorization.js'
2
3
  import type { Log } from '../../types/log.js'
3
4
  import type { Hash, Hex } from '../../types/misc.js'
4
5
  import type { TransactionReceipt } from '../../types/transaction.js'
@@ -10,6 +11,15 @@ export type EstimateUserOperationGasReturnType<
10
11
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
11
12
  uint256 = bigint,
12
13
  > = OneOf<
14
+ | (entryPointVersion extends '0.8'
15
+ ? {
16
+ preVerificationGas: uint256
17
+ verificationGasLimit: uint256
18
+ callGasLimit: uint256
19
+ paymasterVerificationGasLimit?: uint256 | undefined
20
+ paymasterPostOpGasLimit?: uint256 | undefined
21
+ }
22
+ : never)
13
23
  | (entryPointVersion extends '0.7'
14
24
  ? {
15
25
  preVerificationGas: uint256
@@ -32,12 +42,13 @@ export type EstimateUserOperationGasReturnType<
32
42
  export type GetUserOperationByHashReturnType<
33
43
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
34
44
  uint256 = bigint,
45
+ uint32 = number,
35
46
  > = {
36
47
  blockHash: Hash
37
48
  blockNumber: uint256
38
49
  entryPoint: Address
39
50
  transactionHash: Hash
40
- userOperation: UserOperation<entryPointVersion, uint256>
51
+ userOperation: UserOperation<entryPointVersion, uint256, uint32>
41
52
  }
42
53
 
43
54
  /** @link https://eips.ethereum.org/EIPS/eip-4337#entrypoint-definition */
@@ -66,9 +77,48 @@ export type PackedUserOperation = {
66
77
  export type UserOperation<
67
78
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
68
79
  uint256 = bigint,
80
+ uint32 = number,
69
81
  > = OneOf<
82
+ | (entryPointVersion extends '0.8'
83
+ ? {
84
+ /** Authorization data. */
85
+ authorization?: SignedAuthorization<uint32> | undefined
86
+ /** The data to pass to the `sender` during the main execution call. */
87
+ callData: Hex
88
+ /** The amount of gas to allocate the main execution call */
89
+ callGasLimit: uint256
90
+ /** Account factory. Only for new accounts. */
91
+ factory?: Address | undefined
92
+ /** Data for account factory. */
93
+ factoryData?: Hex | undefined
94
+ /** Maximum fee per gas. */
95
+ maxFeePerGas: uint256
96
+ /** Maximum priority fee per gas. */
97
+ maxPriorityFeePerGas: uint256
98
+ /** Anti-replay parameter. */
99
+ nonce: uint256
100
+ /** Address of paymaster contract. */
101
+ paymaster?: Address | undefined
102
+ /** Data for paymaster. */
103
+ paymasterData?: Hex | undefined
104
+ /** The amount of gas to allocate for the paymaster post-operation code. */
105
+ paymasterPostOpGasLimit?: uint256 | undefined
106
+ /** The amount of gas to allocate for the paymaster validation code. */
107
+ paymasterVerificationGasLimit?: uint256 | undefined
108
+ /** Extra gas to pay the Bundler. */
109
+ preVerificationGas: uint256
110
+ /** The account making the operation. */
111
+ sender: Address
112
+ /** Data passed into the account to verify authorization. */
113
+ signature: Hex
114
+ /** The amount of gas to allocate for the verification step. */
115
+ verificationGasLimit: uint256
116
+ }
117
+ : never)
70
118
  | (entryPointVersion extends '0.7'
71
119
  ? {
120
+ /** Authorization data. */
121
+ authorization?: SignedAuthorization<uint32> | undefined
72
122
  /** The data to pass to the `sender` during the main execution call. */
73
123
  callData: Hex
74
124
  /** The amount of gas to allocate the main execution call */
@@ -103,6 +153,8 @@ export type UserOperation<
103
153
  : never)
104
154
  | (entryPointVersion extends '0.6'
105
155
  ? {
156
+ /** Authorization data. */
157
+ authorization?: SignedAuthorization<uint32> | undefined
106
158
  /** The data to pass to the `sender` during the main execution call. */
107
159
  callData: Hex
108
160
  /** The amount of gas to allocate the main execution call */
@@ -132,10 +184,24 @@ export type UserOperation<
132
184
  export type UserOperationRequest<
133
185
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
134
186
  uint256 = bigint,
187
+ uint32 = number,
135
188
  > = OneOf<
189
+ | (entryPointVersion extends '0.8'
190
+ ? UnionPartialBy<
191
+ UserOperation<'0.8', uint256, uint32>,
192
+ // We are able to calculate these via `prepareUserOperation`.
193
+ | keyof EstimateUserOperationGasReturnType<'0.8'>
194
+ | 'callData'
195
+ | 'maxFeePerGas'
196
+ | 'maxPriorityFeePerGas'
197
+ | 'nonce'
198
+ | 'sender'
199
+ | 'signature'
200
+ >
201
+ : never)
136
202
  | (entryPointVersion extends '0.7'
137
203
  ? UnionPartialBy<
138
- UserOperation<'0.7', uint256>,
204
+ UserOperation<'0.7', uint256, uint32>,
139
205
  // We are able to calculate these via `prepareUserOperation`.
140
206
  | keyof EstimateUserOperationGasReturnType<'0.7'>
141
207
  | 'callData'
@@ -148,7 +214,7 @@ export type UserOperationRequest<
148
214
  : never)
149
215
  | (entryPointVersion extends '0.6'
150
216
  ? UnionPartialBy<
151
- UserOperation<'0.6', uint256>,
217
+ UserOperation<'0.6', uint256, uint32>,
152
218
  // We are able to calculate these via `prepareUserOperation`.
153
219
  | keyof EstimateUserOperationGasReturnType<'0.6'>
154
220
  | 'callData'
@@ -1,6 +1,8 @@
1
1
  import type { ErrorType } from '../../../errors/utils.js'
2
+ import type { SignedAuthorization } from '../../../types/authorization.js'
2
3
  import type { ExactPartial } from '../../../types/utils.js'
3
4
  import { numberToHex } from '../../../utils/encoding/toHex.js'
5
+ import { pad } from '../../../utils/index.js'
4
6
  import type { RpcUserOperation } from '../../types/rpc.js'
5
7
  import type { UserOperation } from '../../types/userOperation.js'
6
8
 
@@ -48,6 +50,25 @@ export function formatUserOperationRequest(
48
50
  rpcRequest.signature = request.signature
49
51
  if (typeof request.verificationGasLimit !== 'undefined')
50
52
  rpcRequest.verificationGasLimit = numberToHex(request.verificationGasLimit)
53
+ if (typeof request.authorization !== 'undefined')
54
+ rpcRequest.eip7702Auth = formatAuthorization(request.authorization)
51
55
 
52
56
  return rpcRequest
53
57
  }
58
+
59
+ function formatAuthorization(authorization: SignedAuthorization) {
60
+ return {
61
+ address: authorization.address,
62
+ chainId: numberToHex(authorization.chainId),
63
+ nonce: numberToHex(authorization.nonce),
64
+ r: authorization.r
65
+ ? numberToHex(BigInt(authorization.r), { size: 32 })
66
+ : pad('0x', { size: 32 }),
67
+ s: authorization.s
68
+ ? numberToHex(BigInt(authorization.s), { size: 32 })
69
+ : pad('0x', { size: 32 }),
70
+ yParity: authorization.yParity
71
+ ? numberToHex(authorization.yParity, { size: 1 })
72
+ : pad('0x', { size: 32 }),
73
+ }
74
+ }
@@ -1,10 +1,12 @@
1
1
  import type { Address } from 'abitype'
2
2
  import type { Hash } from '../../../types/misc.js'
3
3
  import { encodeAbiParameters } from '../../../utils/abi/encodeAbiParameters.js'
4
+ import { encodePacked } from '../../../utils/abi/encodePacked.js'
4
5
  import { concat } from '../../../utils/data/concat.js'
5
6
  import { pad } from '../../../utils/data/pad.js'
6
7
  import { numberToHex } from '../../../utils/encoding/toHex.js'
7
8
  import { keccak256 } from '../../../utils/hash/keccak256.js'
9
+ import { hashTypedData } from '../../../utils/signature/hashTypedData.js'
8
10
  import type { EntryPointVersion } from '../../types/entryPointVersion.js'
9
11
  import type { UserOperation } from '../../types/userOperation.js'
10
12
 
@@ -126,9 +128,86 @@ export function getUserOperationHash<
126
128
  )
127
129
  }
128
130
 
131
+ if (entryPointVersion === '0.8') {
132
+ const isEip7702 =
133
+ userOperation.factory &&
134
+ userOperation.factory === '0x7702' &&
135
+ userOperation.authorization
136
+
137
+ const delegation = isEip7702
138
+ ? userOperation.authorization?.address
139
+ : undefined
140
+
141
+ const initCode = delegation
142
+ ? userOperation.factoryData
143
+ ? encodePacked(
144
+ ['address', 'bytes'],
145
+ [delegation, userOperation.factoryData],
146
+ )
147
+ : encodePacked(['address'], [delegation])
148
+ : userOperation.factory && userOperation.factoryData
149
+ ? concat([userOperation.factory, userOperation.factoryData])
150
+ : '0x'
151
+
152
+ const accountGasLimits = concat([
153
+ pad(numberToHex(verificationGasLimit), { size: 16 }),
154
+ pad(numberToHex(callGasLimit), { size: 16 }),
155
+ ])
156
+
157
+ const gasFees = concat([
158
+ pad(numberToHex(maxPriorityFeePerGas), { size: 16 }),
159
+ pad(numberToHex(maxFeePerGas), { size: 16 }),
160
+ ])
161
+
162
+ const paymasterAndData = userOperation.paymaster
163
+ ? concat([
164
+ userOperation.paymaster,
165
+ pad(numberToHex(userOperation.paymasterVerificationGasLimit || 0), {
166
+ size: 16,
167
+ }),
168
+ pad(numberToHex(userOperation.paymasterPostOpGasLimit || 0), {
169
+ size: 16,
170
+ }),
171
+ userOperation.paymasterData || '0x',
172
+ ])
173
+ : '0x'
174
+
175
+ return hashTypedData({
176
+ types: {
177
+ PackedUserOperation: [
178
+ { type: 'address', name: 'sender' },
179
+ { type: 'uint256', name: 'nonce' },
180
+ { type: 'bytes', name: 'initCode' },
181
+ { type: 'bytes', name: 'callData' },
182
+ { type: 'bytes32', name: 'accountGasLimits' },
183
+ { type: 'uint256', name: 'preVerificationGas' },
184
+ { type: 'bytes32', name: 'gasFees' },
185
+ { type: 'bytes', name: 'paymasterAndData' },
186
+ ],
187
+ },
188
+ primaryType: 'PackedUserOperation',
189
+ domain: {
190
+ name: 'ERC4337',
191
+ version: '1',
192
+ chainId,
193
+ verifyingContract: entryPointAddress,
194
+ },
195
+ message: {
196
+ sender,
197
+ nonce,
198
+ initCode,
199
+ callData,
200
+ accountGasLimits,
201
+ preVerificationGas,
202
+ gasFees,
203
+ paymasterAndData,
204
+ },
205
+ })
206
+ }
129
207
  throw new Error(`entryPointVersion "${entryPointVersion}" not supported.`)
130
208
  })()
131
209
 
210
+ if (entryPointVersion === '0.8') return packedUserOp
132
211
  return keccak256(
133
212
  encodeAbiParameters(
134
213
  [{ type: 'bytes32' }, { type: 'address' }, { type: 'uint256' }],
@@ -2,6 +2,8 @@ export const entryPoint06Address =
2
2
  '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789' as const
3
3
  export const entryPoint07Address =
4
4
  '0x0000000071727De22E5E9d8BAf0edAc6f37da032' as const
5
+ export const entryPoint08Address =
6
+ '0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108' as const
5
7
 
6
8
  export const ethAddress = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' as const
7
9
 
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.27.2'
1
+ export const version = '2.28.0-entrypoint-0-8-20250417075822'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.27.2",
4
+ "version": "2.28.0-entrypoint-0-8-20250417075822",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -9,7 +9,7 @@ export type Authorization<uint32 = number, signed extends boolean = false> = {
9
9
  chainId: uint32
10
10
  /** Nonce of the EOA to delegate to. */
11
11
  nonce: uint32
12
- } & (signed extends true ? Signature : ExactPartial<Signature>)
12
+ } & (signed extends true ? Signature<uint32> : ExactPartial<Signature<uint32>>)
13
13
 
14
14
  export type AuthorizationList<
15
15
  uint32 = number,
package/types/misc.ts CHANGED
@@ -10,26 +10,26 @@ export type SignableMessage =
10
10
  /** Raw data representation of the message. */
11
11
  raw: Hex | ByteArray
12
12
  }
13
- export type SignatureLegacy = {
13
+ export type SignatureLegacy<bigintType = bigint> = {
14
14
  r: Hex
15
15
  s: Hex
16
- v: bigint
16
+ v: bigintType
17
17
  }
18
- export type Signature = OneOf<
18
+ export type Signature<numberType = number, bigintType = bigint> = OneOf<
19
19
  | SignatureLegacy
20
20
  | {
21
21
  r: Hex
22
22
  s: Hex
23
23
  /** @deprecated use `yParity`. */
24
- v: bigint
25
- yParity?: number | undefined
24
+ v: bigintType
25
+ yParity?: numberType | undefined
26
26
  }
27
27
  | {
28
28
  r: Hex
29
29
  s: Hex
30
30
  /** @deprecated use `yParity`. */
31
- v?: bigint | undefined
32
- yParity: number
31
+ v?: bigintType | undefined
32
+ yParity: numberType
33
33
  }
34
34
  >
35
35
  export type CompactSignature = {