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

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 (161) hide show
  1. package/CHANGELOG.md +19 -3
  2. package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +7 -63
  3. package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +1 -1
  4. package/_cjs/account-abstraction/index.js +3 -1
  5. package/_cjs/account-abstraction/index.js.map +1 -1
  6. package/_cjs/account-abstraction/utils/userOperation/getInitCode.js +18 -0
  7. package/_cjs/account-abstraction/utils/userOperation/getInitCode.js.map +1 -0
  8. package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js +29 -108
  9. package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
  10. package/_cjs/account-abstraction/utils/userOperation/getUserOperationTypedData.js +32 -0
  11. package/_cjs/account-abstraction/utils/userOperation/getUserOperationTypedData.js.map +1 -0
  12. package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js +3 -2
  13. package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
  14. package/_cjs/actions/index.js +12 -1
  15. package/_cjs/actions/index.js.map +1 -1
  16. package/_cjs/{experimental/eip5792/actions → actions/wallet}/getCallsStatus.js +3 -3
  17. package/_cjs/actions/wallet/getCallsStatus.js.map +1 -0
  18. package/_cjs/{experimental/eip5792/actions → actions/wallet}/getCapabilities.js +1 -1
  19. package/{_esm/experimental/eip5792/actions → _cjs/actions/wallet}/getCapabilities.js.map +1 -1
  20. package/_cjs/{experimental/eip5792/actions → actions/wallet}/sendCalls.js +6 -6
  21. package/_cjs/actions/wallet/sendCalls.js.map +1 -0
  22. package/_cjs/actions/wallet/showCallsStatus.js.map +1 -0
  23. package/_cjs/{experimental/eip5792/actions → actions/wallet}/waitForCallsStatus.js +5 -5
  24. package/_cjs/actions/wallet/waitForCallsStatus.js.map +1 -0
  25. package/_cjs/chains/definitions/gunz.js +29 -0
  26. package/_cjs/chains/definitions/gunz.js.map +1 -0
  27. package/_cjs/chains/index.js +10 -8
  28. package/_cjs/chains/index.js.map +1 -1
  29. package/_cjs/clients/decorators/wallet.js +10 -0
  30. package/_cjs/clients/decorators/wallet.js.map +1 -1
  31. package/_cjs/constants/abis.js +417 -1
  32. package/_cjs/constants/abis.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/writeContracts.js +1 -1
  36. package/_cjs/experimental/eip5792/actions/writeContracts.js.map +1 -1
  37. package/_cjs/experimental/eip5792/decorators/eip5792.js +5 -5
  38. package/_cjs/experimental/eip5792/decorators/eip5792.js.map +1 -1
  39. package/_cjs/experimental/index.js +6 -7
  40. package/_cjs/experimental/index.js.map +1 -1
  41. package/_cjs/index.js +12 -9
  42. package/_cjs/index.js.map +1 -1
  43. package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +8 -64
  44. package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +1 -1
  45. package/_esm/account-abstraction/index.js +1 -0
  46. package/_esm/account-abstraction/index.js.map +1 -1
  47. package/_esm/account-abstraction/utils/userOperation/getInitCode.js +15 -0
  48. package/_esm/account-abstraction/utils/userOperation/getInitCode.js.map +1 -0
  49. package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js +29 -108
  50. package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
  51. package/_esm/account-abstraction/utils/userOperation/getUserOperationTypedData.js +29 -0
  52. package/_esm/account-abstraction/utils/userOperation/getUserOperationTypedData.js.map +1 -0
  53. package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js +3 -2
  54. package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
  55. package/_esm/actions/index.js +5 -0
  56. package/_esm/actions/index.js.map +1 -1
  57. package/_esm/{experimental/eip5792/actions → actions/wallet}/getCallsStatus.js +5 -5
  58. package/_esm/actions/wallet/getCallsStatus.js.map +1 -0
  59. package/_esm/{experimental/eip5792/actions → actions/wallet}/getCapabilities.js +3 -3
  60. package/_esm/actions/wallet/getCapabilities.js.map +1 -0
  61. package/_esm/{experimental/eip5792/actions → actions/wallet}/sendCalls.js +8 -8
  62. package/_esm/actions/wallet/sendCalls.js.map +1 -0
  63. package/_esm/{experimental/eip5792/actions → actions/wallet}/showCallsStatus.js +2 -2
  64. package/_esm/actions/wallet/showCallsStatus.js.map +1 -0
  65. package/_esm/{experimental/eip5792/actions → actions/wallet}/waitForCallsStatus.js +7 -7
  66. package/_esm/actions/wallet/waitForCallsStatus.js.map +1 -0
  67. package/_esm/chains/definitions/gunz.js +26 -0
  68. package/_esm/chains/definitions/gunz.js.map +1 -0
  69. package/_esm/chains/index.js +1 -0
  70. package/_esm/chains/index.js.map +1 -1
  71. package/_esm/clients/decorators/wallet.js +10 -0
  72. package/_esm/clients/decorators/wallet.js.map +1 -1
  73. package/_esm/constants/abis.js +417 -0
  74. package/_esm/constants/abis.js.map +1 -1
  75. package/_esm/errors/version.js +1 -1
  76. package/_esm/errors/version.js.map +1 -1
  77. package/_esm/experimental/eip5792/actions/writeContracts.js +2 -3
  78. package/_esm/experimental/eip5792/actions/writeContracts.js.map +1 -1
  79. package/_esm/experimental/eip5792/decorators/eip5792.js +6 -5
  80. package/_esm/experimental/eip5792/decorators/eip5792.js.map +1 -1
  81. package/_esm/experimental/index.js +21 -7
  82. package/_esm/experimental/index.js.map +1 -1
  83. package/_esm/index.js +2 -1
  84. package/_esm/index.js.map +1 -1
  85. package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts +1 -1
  86. package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts.map +1 -1
  87. package/_types/account-abstraction/index.d.ts +1 -0
  88. package/_types/account-abstraction/index.d.ts.map +1 -1
  89. package/_types/account-abstraction/utils/userOperation/getInitCode.d.ts +3 -0
  90. package/_types/account-abstraction/utils/userOperation/getInitCode.d.ts.map +1 -0
  91. package/_types/account-abstraction/utils/userOperation/getUserOperationHash.d.ts.map +1 -1
  92. package/_types/account-abstraction/utils/userOperation/getUserOperationTypedData.d.ts +39 -0
  93. package/_types/account-abstraction/utils/userOperation/getUserOperationTypedData.d.ts.map +1 -0
  94. package/_types/account-abstraction/utils/userOperation/toPackedUserOperation.d.ts.map +1 -1
  95. package/_types/actions/index.d.ts +5 -0
  96. package/_types/actions/index.d.ts.map +1 -1
  97. package/_types/{experimental/eip5792/actions → actions/wallet}/getCallsStatus.d.ts +10 -10
  98. package/_types/actions/wallet/getCallsStatus.d.ts.map +1 -0
  99. package/_types/{experimental/eip5792/actions → actions/wallet}/getCapabilities.d.ts +9 -9
  100. package/_types/actions/wallet/getCapabilities.d.ts.map +1 -0
  101. package/_types/{experimental/eip5792/actions → actions/wallet}/sendCalls.d.ts +10 -10
  102. package/_types/actions/wallet/sendCalls.d.ts.map +1 -0
  103. package/_types/{experimental/eip5792/actions → actions/wallet}/showCallsStatus.d.ts +8 -8
  104. package/_types/actions/wallet/showCallsStatus.d.ts.map +1 -0
  105. package/_types/{experimental/eip5792/actions → actions/wallet}/waitForCallsStatus.d.ts +9 -9
  106. package/_types/actions/wallet/waitForCallsStatus.d.ts.map +1 -0
  107. package/_types/chains/definitions/gunz.d.ts +34 -0
  108. package/_types/chains/definitions/gunz.d.ts.map +1 -0
  109. package/_types/chains/index.d.ts +1 -0
  110. package/_types/chains/index.d.ts.map +1 -1
  111. package/_types/clients/decorators/wallet.d.ts +126 -0
  112. package/_types/clients/decorators/wallet.d.ts.map +1 -1
  113. package/_types/constants/abis.d.ts +321 -0
  114. package/_types/constants/abis.d.ts.map +1 -1
  115. package/_types/errors/version.d.ts +1 -1
  116. package/_types/errors/version.d.ts.map +1 -1
  117. package/_types/experimental/eip5792/actions/writeContracts.d.ts +1 -3
  118. package/_types/experimental/eip5792/actions/writeContracts.d.ts.map +1 -1
  119. package/_types/experimental/eip5792/decorators/eip5792.d.ts +5 -5
  120. package/_types/experimental/eip5792/decorators/eip5792.d.ts.map +1 -1
  121. package/_types/experimental/index.d.ts +63 -7
  122. package/_types/experimental/index.d.ts.map +1 -1
  123. package/_types/index.d.ts +7 -1
  124. package/_types/index.d.ts.map +1 -1
  125. package/account-abstraction/accounts/implementations/toSimple7702SmartAccount.ts +8 -73
  126. package/account-abstraction/index.ts +5 -0
  127. package/account-abstraction/utils/userOperation/getInitCode.ts +21 -0
  128. package/account-abstraction/utils/userOperation/getUserOperationHash.ts +36 -128
  129. package/account-abstraction/utils/userOperation/getUserOperationTypedData.ts +49 -0
  130. package/account-abstraction/utils/userOperation/toPackedUserOperation.ts +2 -4
  131. package/actions/index.ts +31 -0
  132. package/{experimental/eip5792/actions → actions/wallet}/getCallsStatus.ts +13 -13
  133. package/{experimental/eip5792/actions → actions/wallet}/getCapabilities.ts +10 -10
  134. package/{experimental/eip5792/actions → actions/wallet}/sendCalls.ts +17 -17
  135. package/{experimental/eip5792/actions → actions/wallet}/showCallsStatus.ts +8 -8
  136. package/{experimental/eip5792/actions → actions/wallet}/waitForCallsStatus.ts +11 -11
  137. package/chains/definitions/gunz.ts +26 -0
  138. package/chains/index.ts +1 -0
  139. package/clients/decorators/wallet.ts +164 -0
  140. package/constants/abis.ts +418 -0
  141. package/errors/version.ts +1 -1
  142. package/experimental/eip5792/actions/writeContracts.ts +8 -8
  143. package/experimental/eip5792/decorators/eip5792.ts +11 -9
  144. package/experimental/index.ts +33 -6
  145. package/index.ts +28 -0
  146. package/package.json +3 -3
  147. package/_cjs/experimental/eip5792/actions/getCallsStatus.js.map +0 -1
  148. package/_cjs/experimental/eip5792/actions/getCapabilities.js.map +0 -1
  149. package/_cjs/experimental/eip5792/actions/sendCalls.js.map +0 -1
  150. package/_cjs/experimental/eip5792/actions/showCallsStatus.js.map +0 -1
  151. package/_cjs/experimental/eip5792/actions/waitForCallsStatus.js.map +0 -1
  152. package/_esm/experimental/eip5792/actions/getCallsStatus.js.map +0 -1
  153. package/_esm/experimental/eip5792/actions/sendCalls.js.map +0 -1
  154. package/_esm/experimental/eip5792/actions/showCallsStatus.js.map +0 -1
  155. package/_esm/experimental/eip5792/actions/waitForCallsStatus.js.map +0 -1
  156. package/_types/experimental/eip5792/actions/getCallsStatus.d.ts.map +0 -1
  157. package/_types/experimental/eip5792/actions/getCapabilities.d.ts.map +0 -1
  158. package/_types/experimental/eip5792/actions/sendCalls.d.ts.map +0 -1
  159. package/_types/experimental/eip5792/actions/showCallsStatus.d.ts.map +0 -1
  160. package/_types/experimental/eip5792/actions/waitForCallsStatus.d.ts.map +0 -1
  161. /package/_cjs/{experimental/eip5792/actions → actions/wallet}/showCallsStatus.js +0 -0
@@ -1,14 +1,14 @@
1
1
  import type { Address } from 'abitype'
2
- import type { Hash } from '../../../types/misc.js'
2
+
3
+ import type { Hash, Hex } from '../../../types/misc.js'
3
4
  import { encodeAbiParameters } from '../../../utils/abi/encodeAbiParameters.js'
4
- import { encodePacked } from '../../../utils/abi/encodePacked.js'
5
- import { concat } from '../../../utils/data/concat.js'
6
- import { pad } from '../../../utils/data/pad.js'
7
- import { numberToHex } from '../../../utils/encoding/toHex.js'
8
5
  import { keccak256 } from '../../../utils/hash/keccak256.js'
9
6
  import { hashTypedData } from '../../../utils/signature/hashTypedData.js'
10
7
  import type { EntryPointVersion } from '../../types/entryPointVersion.js'
11
8
  import type { UserOperation } from '../../types/userOperation.js'
9
+ import { getInitCode } from './getInitCode.js'
10
+ import { getUserOperationTypedData } from './getUserOperationTypedData.js'
11
+ import { toPackedUserOperation } from './toPackedUserOperation.js'
12
12
 
13
13
  export type GetUserOperationHashParameters<
14
14
  entryPointVersion extends EntryPointVersion = EntryPointVersion,
@@ -29,20 +29,36 @@ export function getUserOperationHash<
29
29
  const { chainId, entryPointAddress, entryPointVersion } = parameters
30
30
  const userOperation = parameters.userOperation as UserOperation
31
31
  const {
32
- callData,
32
+ authorization,
33
+ callData = '0x',
33
34
  callGasLimit,
34
- initCode,
35
35
  maxFeePerGas,
36
36
  maxPriorityFeePerGas,
37
37
  nonce,
38
- paymasterAndData,
38
+ paymasterAndData = '0x',
39
39
  preVerificationGas,
40
40
  sender,
41
41
  verificationGasLimit,
42
42
  } = userOperation
43
43
 
44
+ if (entryPointVersion === '0.8')
45
+ return hashTypedData(
46
+ getUserOperationTypedData({
47
+ chainId,
48
+ entryPointAddress,
49
+ userOperation,
50
+ }),
51
+ )
52
+
44
53
  const packedUserOp = (() => {
45
54
  if (entryPointVersion === '0.6') {
55
+ const factory = userOperation.initCode?.slice(0, 42) as Hex
56
+ const factoryData = userOperation.initCode?.slice(42) as Hex | undefined
57
+ const initCode = getInitCode({
58
+ authorization,
59
+ factory,
60
+ factoryData,
61
+ })
46
62
  return encodeAbiParameters(
47
63
  [
48
64
  { type: 'address' },
@@ -59,51 +75,20 @@ export function getUserOperationHash<
59
75
  [
60
76
  sender,
61
77
  nonce,
62
- keccak256(initCode ?? '0x'),
63
- keccak256(callData ?? '0x'),
78
+ keccak256(initCode),
79
+ keccak256(callData),
64
80
  callGasLimit,
65
81
  verificationGasLimit,
66
82
  preVerificationGas,
67
83
  maxFeePerGas,
68
84
  maxPriorityFeePerGas,
69
- keccak256(paymasterAndData ?? '0x'),
85
+ keccak256(paymasterAndData),
70
86
  ],
71
87
  )
72
88
  }
73
89
 
74
90
  if (entryPointVersion === '0.7') {
75
- const accountGasLimits = concat([
76
- pad(numberToHex(userOperation.verificationGasLimit), { size: 16 }),
77
- pad(numberToHex(userOperation.callGasLimit), { size: 16 }),
78
- ])
79
- const callData_hashed = keccak256(callData)
80
- const gasFees = concat([
81
- pad(numberToHex(userOperation.maxPriorityFeePerGas), { size: 16 }),
82
- pad(numberToHex(userOperation.maxFeePerGas), { size: 16 }),
83
- ])
84
- const initCode_hashed = keccak256(
85
- userOperation.factory && userOperation.factoryData
86
- ? concat([userOperation.factory, userOperation.factoryData])
87
- : '0x',
88
- )
89
- const paymasterAndData_hashed = keccak256(
90
- userOperation.paymaster
91
- ? concat([
92
- userOperation.paymaster,
93
- pad(
94
- numberToHex(userOperation.paymasterVerificationGasLimit || 0),
95
- {
96
- size: 16,
97
- },
98
- ),
99
- pad(numberToHex(userOperation.paymasterPostOpGasLimit || 0), {
100
- size: 16,
101
- }),
102
- userOperation.paymasterData || '0x',
103
- ])
104
- : '0x',
105
- )
106
-
91
+ const packedUserOp = toPackedUserOperation(userOperation)
107
92
  return encodeAbiParameters(
108
93
  [
109
94
  { type: 'address' },
@@ -116,98 +101,21 @@ export function getUserOperationHash<
116
101
  { type: 'bytes32' },
117
102
  ],
118
103
  [
119
- sender,
120
- nonce,
121
- initCode_hashed,
122
- callData_hashed,
123
- accountGasLimits,
124
- preVerificationGas,
125
- gasFees,
126
- paymasterAndData_hashed,
104
+ packedUserOp.sender,
105
+ packedUserOp.nonce,
106
+ keccak256(packedUserOp.initCode),
107
+ keccak256(packedUserOp.callData),
108
+ packedUserOp.accountGasLimits,
109
+ packedUserOp.preVerificationGas,
110
+ packedUserOp.gasFees,
111
+ keccak256(packedUserOp.paymasterAndData),
127
112
  ],
128
113
  )
129
114
  }
130
115
 
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
- }
207
116
  throw new Error(`entryPointVersion "${entryPointVersion}" not supported.`)
208
117
  })()
209
118
 
210
- if (entryPointVersion === '0.8') return packedUserOp
211
119
  return keccak256(
212
120
  encodeAbiParameters(
213
121
  [{ type: 'bytes32' }, { type: 'address' }, { type: 'uint256' }],
@@ -0,0 +1,49 @@
1
+ import type { Address } from 'abitype'
2
+
3
+ import type { TypedDataDefinition } from '../../../types/typedData.js'
4
+ import type { UserOperation } from '../../types/userOperation.js'
5
+ import { toPackedUserOperation } from './toPackedUserOperation.js'
6
+
7
+ export type GetUserOperationTypedDataParameters = {
8
+ chainId: number
9
+ entryPointAddress: Address
10
+ userOperation: UserOperation<'0.8'>
11
+ }
12
+
13
+ export type GetUserOperationTypedDataReturnType = TypedDataDefinition<
14
+ typeof types,
15
+ 'PackedUserOperation'
16
+ >
17
+
18
+ const types = {
19
+ PackedUserOperation: [
20
+ { type: 'address', name: 'sender' },
21
+ { type: 'uint256', name: 'nonce' },
22
+ { type: 'bytes', name: 'initCode' },
23
+ { type: 'bytes', name: 'callData' },
24
+ { type: 'bytes32', name: 'accountGasLimits' },
25
+ { type: 'uint256', name: 'preVerificationGas' },
26
+ { type: 'bytes32', name: 'gasFees' },
27
+ { type: 'bytes', name: 'paymasterAndData' },
28
+ ],
29
+ } as const
30
+
31
+ export function getUserOperationTypedData(
32
+ parameters: GetUserOperationTypedDataParameters,
33
+ ): GetUserOperationTypedDataReturnType {
34
+ const { chainId, entryPointAddress, userOperation } = parameters
35
+
36
+ const packedUserOp = toPackedUserOperation(userOperation)
37
+
38
+ return {
39
+ types,
40
+ primaryType: 'PackedUserOperation',
41
+ domain: {
42
+ name: 'ERC4337',
43
+ version: '1',
44
+ chainId,
45
+ verifyingContract: entryPointAddress,
46
+ },
47
+ message: packedUserOp,
48
+ }
49
+ }
@@ -5,6 +5,7 @@ import type {
5
5
  PackedUserOperation,
6
6
  UserOperation,
7
7
  } from '../../types/userOperation.js'
8
+ import { getInitCode } from './getInitCode.js'
8
9
 
9
10
  export function toPackedUserOperation(
10
11
  userOperation: UserOperation,
@@ -12,8 +13,6 @@ export function toPackedUserOperation(
12
13
  const {
13
14
  callGasLimit,
14
15
  callData,
15
- factory,
16
- factoryData,
17
16
  maxPriorityFeePerGas,
18
17
  maxFeePerGas,
19
18
  paymaster,
@@ -29,8 +28,7 @@ export function toPackedUserOperation(
29
28
  pad(numberToHex(verificationGasLimit || 0n), { size: 16 }),
30
29
  pad(numberToHex(callGasLimit || 0n), { size: 16 }),
31
30
  ])
32
- const initCode =
33
- factory && factoryData ? concat([factory, factoryData]) : '0x'
31
+ const initCode = getInitCode(userOperation)
34
32
  const gasFees = concat([
35
33
  pad(numberToHex(maxPriorityFeePerGas || 0n), { size: 16 }),
36
34
  pad(numberToHex(maxFeePerGas || 0n), { size: 16 }),
package/actions/index.ts CHANGED
@@ -316,6 +316,37 @@ export {
316
316
  type GetPermissionsReturnType,
317
317
  getPermissions,
318
318
  } from './wallet/getPermissions.js'
319
+ export {
320
+ type GetCapabilitiesParameters,
321
+ type GetCapabilitiesErrorType,
322
+ type GetCapabilitiesReturnType,
323
+ getCapabilities,
324
+ } from './wallet/getCapabilities.js'
325
+ export {
326
+ type SendCallsErrorType,
327
+ type SendCallsParameters,
328
+ type SendCallsReturnType,
329
+ sendCalls,
330
+ } from './wallet/sendCalls.js'
331
+ export {
332
+ type GetCallsStatusErrorType,
333
+ type GetCallsStatusParameters,
334
+ type GetCallsStatusReturnType,
335
+ getCallsStatus,
336
+ } from './wallet/getCallsStatus.js'
337
+ export {
338
+ type ShowCallsStatusErrorType,
339
+ type ShowCallsStatusParameters,
340
+ type ShowCallsStatusReturnType,
341
+ showCallsStatus,
342
+ } from './wallet/showCallsStatus.js'
343
+ export {
344
+ type WaitForCallsStatusErrorType,
345
+ type WaitForCallsStatusParameters,
346
+ type WaitForCallsStatusReturnType,
347
+ type WaitForCallsStatusTimeoutErrorType,
348
+ waitForCallsStatus,
349
+ } from './wallet/waitForCallsStatus.js'
319
350
  export {
320
351
  type GetProofErrorType,
321
352
  type GetProofParameters,
@@ -1,16 +1,16 @@
1
- import type { Client } from '../../../clients/createClient.js'
2
- import type { Transport } from '../../../clients/transports/createTransport.js'
3
- import type { ErrorType } from '../../../errors/utils.js'
4
- import type { Account } from '../../../types/account.js'
5
- import type { Chain } from '../../../types/chain.js'
1
+ import type { Client } from '../../clients/createClient.js'
2
+ import type { Transport } from '../../clients/transports/createTransport.js'
3
+ import type { ErrorType } from '../../errors/utils.js'
4
+ import type { Account } from '../../types/account.js'
5
+ import type { Chain } from '../../types/chain.js'
6
6
  import type {
7
7
  WalletCapabilities,
8
8
  WalletGetCallsStatusReturnType,
9
- } from '../../../types/eip1193.js'
10
- import type { Prettify } from '../../../types/utils.js'
11
- import type { RequestErrorType } from '../../../utils/buildRequest.js'
12
- import { hexToBigInt, hexToNumber } from '../../../utils/encoding/fromHex.js'
13
- import { receiptStatuses } from '../../../utils/formatters/transactionReceipt.js'
9
+ } from '../../types/eip1193.js'
10
+ import type { Prettify } from '../../types/utils.js'
11
+ import type { RequestErrorType } from '../../utils/buildRequest.js'
12
+ import { hexToBigInt, hexToNumber } from '../../utils/encoding/fromHex.js'
13
+ import { receiptStatuses } from '../../utils/formatters/transactionReceipt.js'
14
14
 
15
15
  export type GetCallsStatusParameters = { id: string }
16
16
 
@@ -34,7 +34,7 @@ export type GetCallsStatusErrorType = RequestErrorType | ErrorType
34
34
  /**
35
35
  * Returns the status of a call batch that was sent via `sendCalls`.
36
36
  *
37
- * - Docs: https://viem.sh/experimental/eip5792/getCallsStatus
37
+ * - Docs: https://viem.sh/docs/actions/wallet/getCallsStatus
38
38
  * - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
39
39
  *
40
40
  * @param client - Client to use
@@ -43,7 +43,7 @@ export type GetCallsStatusErrorType = RequestErrorType | ErrorType
43
43
  * @example
44
44
  * import { createWalletClient, custom } from 'viem'
45
45
  * import { mainnet } from 'viem/chains'
46
- * import { getCallsStatus } from 'viem/experimental'
46
+ * import { getCallsStatus } from 'viem/actions'
47
47
  *
48
48
  * const client = createWalletClient({
49
49
  * chain: mainnet,
@@ -62,7 +62,7 @@ export async function getCallsStatus<
62
62
  atomic = false,
63
63
  chainId,
64
64
  receipts,
65
- version = '1.0',
65
+ version = '2.0.0',
66
66
  ...response
67
67
  } = await client.request({
68
68
  method: 'wallet_getCallsStatus',
@@ -1,16 +1,16 @@
1
1
  import type { Address } from 'abitype'
2
2
 
3
- import { parseAccount } from '../../../accounts/utils/parseAccount.js'
4
- import type { Client } from '../../../clients/createClient.js'
5
- import type { Transport } from '../../../clients/transports/createTransport.js'
6
- import type { ErrorType } from '../../../errors/utils.js'
7
- import type { Account } from '../../../types/account.js'
3
+ import { parseAccount } from '../../accounts/utils/parseAccount.js'
4
+ import type { Client } from '../../clients/createClient.js'
5
+ import type { Transport } from '../../clients/transports/createTransport.js'
6
+ import type { ErrorType } from '../../errors/utils.js'
7
+ import type { Account } from '../../types/account.js'
8
8
  import type {
9
9
  WalletCapabilities,
10
10
  WalletCapabilitiesRecord,
11
- } from '../../../types/eip1193.js'
12
- import type { Prettify } from '../../../types/utils.js'
13
- import type { RequestErrorType } from '../../../utils/buildRequest.js'
11
+ } from '../../types/eip1193.js'
12
+ import type { Prettify } from '../../types/utils.js'
13
+ import type { RequestErrorType } from '../../utils/buildRequest.js'
14
14
 
15
15
  export type GetCapabilitiesParameters<
16
16
  chainId extends number | undefined = undefined,
@@ -32,7 +32,7 @@ export type GetCapabilitiesErrorType = RequestErrorType | ErrorType
32
32
  /**
33
33
  * Extract capabilities that a connected wallet supports (e.g. paymasters, session keys, etc).
34
34
  *
35
- * - Docs: https://viem.sh/experimental/eip5792/getCapabilities
35
+ * - Docs: https://viem.sh/docs/actions/wallet/getCapabilities
36
36
  * - JSON-RPC Methods: [`wallet_getCapabilities`](https://eips.ethereum.org/EIPS/eip-5792)
37
37
  *
38
38
  * @param client - Client to use
@@ -41,7 +41,7 @@ export type GetCapabilitiesErrorType = RequestErrorType | ErrorType
41
41
  * @example
42
42
  * import { createWalletClient, custom } from 'viem'
43
43
  * import { mainnet } from 'viem/chains'
44
- * import { getCapabilities } from 'viem/experimental'
44
+ * import { getCapabilities } from 'viem/actions'
45
45
  *
46
46
  * const client = createWalletClient({
47
47
  * chain: mainnet,
@@ -1,21 +1,21 @@
1
1
  import type { Address, Narrow } from 'abitype'
2
- import { parseAccount } from '../../../accounts/utils/parseAccount.js'
3
- import type { Client } from '../../../clients/createClient.js'
4
- import type { Transport } from '../../../clients/transports/createTransport.js'
5
- import { AccountNotFoundError } from '../../../errors/account.js'
6
- import type { BaseError } from '../../../errors/base.js'
7
- import type { ErrorType } from '../../../errors/utils.js'
8
- import type { Account, GetAccountParameter } from '../../../types/account.js'
9
- import type { Call, Calls } from '../../../types/calls.js'
10
- import type { Chain, DeriveChain } from '../../../types/chain.js'
2
+ import { parseAccount } from '../../accounts/utils/parseAccount.js'
3
+ import type { Client } from '../../clients/createClient.js'
4
+ import type { Transport } from '../../clients/transports/createTransport.js'
5
+ import { AccountNotFoundError } from '../../errors/account.js'
6
+ import type { BaseError } from '../../errors/base.js'
7
+ import type { ErrorType } from '../../errors/utils.js'
8
+ import type { Account, GetAccountParameter } from '../../types/account.js'
9
+ import type { Call, Calls } from '../../types/calls.js'
10
+ import type { Chain, DeriveChain } from '../../types/chain.js'
11
11
  import type {
12
12
  WalletCapabilities,
13
13
  WalletSendCallsParameters,
14
- } from '../../../types/eip1193.js'
15
- import { encodeFunctionData } from '../../../utils/abi/encodeFunctionData.js'
16
- import type { RequestErrorType } from '../../../utils/buildRequest.js'
17
- import { numberToHex } from '../../../utils/encoding/toHex.js'
18
- import { getTransactionError } from '../../../utils/errors/getTransactionError.js'
14
+ } from '../../types/eip1193.js'
15
+ import { encodeFunctionData } from '../../utils/abi/encodeFunctionData.js'
16
+ import type { RequestErrorType } from '../../utils/buildRequest.js'
17
+ import { numberToHex } from '../../utils/encoding/toHex.js'
18
+ import { getTransactionError } from '../../utils/errors/getTransactionError.js'
19
19
 
20
20
  export type SendCallsParameters<
21
21
  chain extends Chain | undefined = Chain | undefined,
@@ -43,7 +43,7 @@ export type SendCallsErrorType = RequestErrorType | ErrorType
43
43
  /**
44
44
  * Requests the connected wallet to send a batch of calls.
45
45
  *
46
- * - Docs: https://viem.sh/experimental/eip5792/sendCalls
46
+ * - Docs: https://viem.sh/docs/actions/wallet/sendCalls
47
47
  * - JSON-RPC Methods: [`wallet_sendCalls`](https://eips.ethereum.org/EIPS/eip-5792)
48
48
  *
49
49
  * @param client - Client to use
@@ -52,7 +52,7 @@ export type SendCallsErrorType = RequestErrorType | ErrorType
52
52
  * @example
53
53
  * import { createWalletClient, custom } from 'viem'
54
54
  * import { mainnet } from 'viem/chains'
55
- * import { sendCalls } from 'viem/experimental'
55
+ * import { sendCalls } from 'viem/actions'
56
56
  *
57
57
  * const client = createWalletClient({
58
58
  * chain: mainnet,
@@ -87,7 +87,7 @@ export async function sendCalls<
87
87
  chain = client.chain,
88
88
  forceAtomic = false,
89
89
  id,
90
- version = '1.0',
90
+ version = '2.0.0',
91
91
  } = parameters
92
92
 
93
93
  if (typeof account_ === 'undefined')
@@ -1,9 +1,9 @@
1
- import type { Client } from '../../../clients/createClient.js'
2
- import type { Transport } from '../../../clients/transports/createTransport.js'
3
- import type { ErrorType } from '../../../errors/utils.js'
4
- import type { Account } from '../../../types/account.js'
5
- import type { Chain } from '../../../types/chain.js'
6
- import type { RequestErrorType } from '../../../utils/buildRequest.js'
1
+ import type { Client } from '../../clients/createClient.js'
2
+ import type { Transport } from '../../clients/transports/createTransport.js'
3
+ import type { ErrorType } from '../../errors/utils.js'
4
+ import type { Account } from '../../types/account.js'
5
+ import type { Chain } from '../../types/chain.js'
6
+ import type { RequestErrorType } from '../../utils/buildRequest.js'
7
7
 
8
8
  export type ShowCallsStatusParameters = { id: string }
9
9
 
@@ -15,7 +15,7 @@ export type ShowCallsStatusErrorType = RequestErrorType | ErrorType
15
15
  * Requests for the wallet to show information about a call batch
16
16
  * that was sent via `sendCalls`.
17
17
  *
18
- * - Docs: https://viem.sh/experimental/eip5792/showCallsStatus
18
+ * - Docs: https://viem.sh/docs/actions/wallet/showCallsStatus
19
19
  * - JSON-RPC Methods: [`wallet_showCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
20
20
  *
21
21
  * @param client - Client to use
@@ -24,7 +24,7 @@ export type ShowCallsStatusErrorType = RequestErrorType | ErrorType
24
24
  * @example
25
25
  * import { createWalletClient, custom } from 'viem'
26
26
  * import { mainnet } from 'viem/chains'
27
- * import { showCallsStatus } from 'viem/experimental'
27
+ * import { showCallsStatus } from 'viem/actions'
28
28
  *
29
29
  * const client = createWalletClient({
30
30
  * chain: mainnet,
@@ -1,12 +1,12 @@
1
- import type { Client } from '../../../clients/createClient.js'
2
- import type { Transport } from '../../../clients/transports/createTransport.js'
3
- import { BaseError } from '../../../errors/base.js'
4
- import type { ErrorType } from '../../../errors/utils.js'
5
- import type { Chain } from '../../../types/chain.js'
6
- import { type ObserveErrorType, observe } from '../../../utils/observe.js'
7
- import { type PollErrorType, poll } from '../../../utils/poll.js'
8
- import { withResolvers } from '../../../utils/promise/withResolvers.js'
9
- import { stringify } from '../../../utils/stringify.js'
1
+ import type { Client } from '../../clients/createClient.js'
2
+ import type { Transport } from '../../clients/transports/createTransport.js'
3
+ import { BaseError } from '../../errors/base.js'
4
+ import type { ErrorType } from '../../errors/utils.js'
5
+ import type { Chain } from '../../types/chain.js'
6
+ import { type ObserveErrorType, observe } from '../../utils/observe.js'
7
+ import { type PollErrorType, poll } from '../../utils/poll.js'
8
+ import { withResolvers } from '../../utils/promise/withResolvers.js'
9
+ import { stringify } from '../../utils/stringify.js'
10
10
  import {
11
11
  type GetCallsStatusErrorType,
12
12
  type GetCallsStatusReturnType,
@@ -50,7 +50,7 @@ export type WaitForCallsStatusErrorType =
50
50
  /**
51
51
  * Waits for the status & receipts of a call bundle that was sent via `sendCalls`.
52
52
  *
53
- * - Docs: https://viem.sh/experimental/eip5792/waitForCallsStatus
53
+ * - Docs: https://viem.sh/docs/actions/wallet/waitForCallsStatus
54
54
  * - JSON-RPC Methods: [`wallet_getCallsStatus`](https://eips.ethereum.org/EIPS/eip-5792)
55
55
  *
56
56
  * @param client - Client to use
@@ -60,7 +60,7 @@ export type WaitForCallsStatusErrorType =
60
60
  * @example
61
61
  * import { createWalletClient, custom } from 'viem'
62
62
  * import { mainnet } from 'viem/chains'
63
- * import { waitForCallsStatus } from 'viem/experimental'
63
+ * import { waitForCallsStatus } from 'viem/actions'
64
64
  *
65
65
  * const client = createWalletClient({
66
66
  * chain: mainnet,
@@ -0,0 +1,26 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const gunz = /*#__PURE__*/ defineChain({
4
+ id: 43_419,
5
+ name: 'Gunz Mainnet',
6
+ nativeCurrency: { name: 'GUN', symbol: 'GUN', decimals: 18 },
7
+ rpcUrls: {
8
+ default: {
9
+ http: [
10
+ 'https://rpc.gunzchain.io/ext/bc/2M47TxWHGnhNtq6pM5zPXdATBtuqubxn5EPFgFmEawCQr9WFML/rpc',
11
+ ],
12
+ },
13
+ },
14
+ blockExplorers: {
15
+ default: {
16
+ name: 'Gunz Explorer',
17
+ url: 'https://gunzscan.io/',
18
+ },
19
+ },
20
+ contracts: {
21
+ multicall3: {
22
+ address: '0xcA11bde05977b3631167028862bE2a173976CA11',
23
+ blockCreated: 70502,
24
+ },
25
+ },
26
+ })
package/chains/index.ts CHANGED
@@ -211,6 +211,7 @@ export { goChain } from './definitions/goChain.js'
211
211
  export { godwoken } from './definitions/godwoken.js'
212
212
  export { goerli } from './definitions/goerli.js'
213
213
  export { gravity } from './definitions/gravity.js'
214
+ export { gunz } from './definitions/gunz.js'
214
215
  export { guruNetwork } from './definitions/guruNetwork.js'
215
216
  export { guruTestnet } from './definitions/guruTestnet.js'
216
217
  export { ham } from './definitions/ham.js'