viem 2.27.1 → 2.27.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/_cjs/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
- package/_cjs/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
- package/_cjs/account-abstraction/accounts/toSmartAccount.js +2 -2
- package/_cjs/account-abstraction/accounts/toSmartAccount.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js +1 -7
- package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js +1 -21
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js +2 -2
- package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_cjs/account-abstraction/constants/abis.js +1 -691
- package/_cjs/account-abstraction/constants/abis.js.map +1 -1
- package/_cjs/account-abstraction/constants/address.js +1 -2
- package/_cjs/account-abstraction/constants/address.js.map +1 -1
- package/_cjs/account-abstraction/index.js +2 -6
- package/_cjs/account-abstraction/index.js.map +1 -1
- package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js +0 -19
- package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js +0 -70
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
- package/_cjs/chains/definitions/gunz.js +29 -0
- package/_cjs/chains/definitions/gunz.js.map +1 -0
- package/_cjs/chains/index.js +10 -8
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/constants/address.js +1 -2
- package/_cjs/constants/address.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
- package/_esm/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
- package/_esm/account-abstraction/accounts/toSmartAccount.js +2 -2
- package/_esm/account-abstraction/accounts/toSmartAccount.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js +1 -7
- package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +1 -21
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/sendUserOperation.js +2 -2
- package/_esm/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_esm/account-abstraction/constants/abis.js +0 -690
- package/_esm/account-abstraction/constants/abis.js.map +1 -1
- package/_esm/account-abstraction/constants/address.js +0 -1
- package/_esm/account-abstraction/constants/address.js.map +1 -1
- package/_esm/account-abstraction/index.js +2 -3
- package/_esm/account-abstraction/index.js.map +1 -1
- package/_esm/account-abstraction/utils/formatters/userOperationRequest.js +0 -19
- package/_esm/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js +0 -70
- package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
- package/_esm/chains/definitions/gunz.js +26 -0
- package/_esm/chains/definitions/gunz.js.map +1 -0
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/constants/address.js +0 -1
- package/_esm/constants/address.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts +2 -1
- package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts.map +1 -1
- package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts +2 -1
- package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts.map +1 -1
- package/_types/account-abstraction/accounts/types.d.ts +3 -16
- package/_types/account-abstraction/accounts/types.d.ts.map +1 -1
- package/_types/account-abstraction/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts +6 -23
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
- package/_types/account-abstraction/constants/abis.d.ts +0 -830
- package/_types/account-abstraction/constants/abis.d.ts.map +1 -1
- package/_types/account-abstraction/constants/address.d.ts +0 -1
- package/_types/account-abstraction/constants/address.d.ts.map +1 -1
- package/_types/account-abstraction/index.d.ts +2 -3
- package/_types/account-abstraction/index.d.ts.map +1 -1
- package/_types/account-abstraction/types/entryPointVersion.d.ts +1 -1
- package/_types/account-abstraction/types/entryPointVersion.d.ts.map +1 -1
- package/_types/account-abstraction/types/rpc.d.ts +3 -6
- package/_types/account-abstraction/types/rpc.d.ts.map +1 -1
- package/_types/account-abstraction/types/userOperation.d.ts +5 -49
- package/_types/account-abstraction/types/userOperation.d.ts.map +1 -1
- package/_types/account-abstraction/utils/formatters/userOperationRequest.d.ts.map +1 -1
- package/_types/account-abstraction/utils/userOperation/getUserOperationHash.d.ts.map +1 -1
- package/_types/celo/chainConfig.d.ts +14 -14
- package/_types/celo/formatters.d.ts +7 -7
- package/_types/chains/definitions/abstract.d.ts +3 -3
- package/_types/chains/definitions/abstractTestnet.d.ts +3 -3
- package/_types/chains/definitions/celo.d.ts +14 -14
- package/_types/chains/definitions/celoAlfajores.d.ts +14 -14
- package/_types/chains/definitions/gunz.d.ts +34 -0
- package/_types/chains/definitions/gunz.d.ts.map +1 -0
- package/_types/chains/definitions/playfiAlbireo.d.ts +3 -3
- package/_types/chains/definitions/sophon.d.ts +3 -3
- package/_types/chains/definitions/sophonTestnet.d.ts +3 -3
- package/_types/chains/definitions/treasure.d.ts +3 -3
- package/_types/chains/definitions/treasureTopaz.d.ts +3 -3
- package/_types/chains/definitions/zksync.d.ts +3 -3
- package/_types/chains/definitions/zksyncInMemoryNode.d.ts +3 -3
- package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts +3 -3
- package/_types/chains/definitions/zksyncLocalHyperchain.d.ts +3 -3
- package/_types/chains/definitions/zksyncLocalNode.d.ts +3 -3
- package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts +3 -3
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/constants/address.d.ts +0 -1
- package/_types/constants/address.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/types/authorization.d.ts +1 -1
- package/_types/types/authorization.d.ts.map +1 -1
- package/_types/types/misc.d.ts +7 -7
- package/_types/types/misc.d.ts.map +1 -1
- package/_types/utils/formatters/transaction.d.ts +1 -1
- package/_types/utils/formatters/transactionRequest.d.ts +1 -1
- package/_types/zksync/chainConfig.d.ts +3 -3
- package/_types/zksync/formatters.d.ts +3 -3
- package/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts +2 -1
- package/account-abstraction/accounts/implementations/toSoladySmartAccount.ts +2 -1
- package/account-abstraction/accounts/toSmartAccount.ts +2 -2
- package/account-abstraction/accounts/types.ts +2 -26
- package/account-abstraction/actions/bundler/estimateUserOperationGas.ts +1 -8
- package/account-abstraction/actions/bundler/prepareUserOperation.ts +2 -56
- package/account-abstraction/actions/bundler/sendUserOperation.ts +2 -2
- package/account-abstraction/actions/paymaster/getPaymasterData.ts +0 -24
- package/account-abstraction/constants/abis.ts +0 -691
- package/account-abstraction/constants/address.ts +0 -2
- package/account-abstraction/index.ts +1 -12
- package/account-abstraction/types/entryPointVersion.ts +1 -1
- package/account-abstraction/types/rpc.ts +3 -6
- package/account-abstraction/types/userOperation.ts +3 -69
- package/account-abstraction/utils/formatters/userOperationRequest.ts +0 -21
- package/account-abstraction/utils/userOperation/getUserOperationHash.ts +0 -79
- package/chains/definitions/gunz.ts +26 -0
- package/chains/index.ts +1 -0
- package/constants/address.ts +0 -2
- package/errors/version.ts +1 -1
- package/package.json +3 -3
- package/types/authorization.ts +1 -1
- package/types/misc.ts +7 -7
- package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +0 -313
- package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +0 -1
- package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +0 -327
- package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +0 -1
- package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts +0 -311
- package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts.map +0 -1
- package/account-abstraction/accounts/implementations/toSimple7702SmartAccount.ts +0 -382
@@ -17,12 +17,6 @@ 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'
|
26
20
|
export {
|
27
21
|
type ToSmartAccountParameters,
|
28
22
|
type ToSmartAccountReturnType,
|
@@ -118,15 +112,10 @@ export {
|
|
118
112
|
createPaymasterClient,
|
119
113
|
} from './clients/createPaymasterClient.js'
|
120
114
|
|
121
|
-
export {
|
122
|
-
entryPoint06Abi,
|
123
|
-
entryPoint07Abi,
|
124
|
-
entryPoint08Abi,
|
125
|
-
} from './constants/abis.js'
|
115
|
+
export { entryPoint06Abi, entryPoint07Abi } from './constants/abis.js'
|
126
116
|
export {
|
127
117
|
entryPoint06Address,
|
128
118
|
entryPoint07Address,
|
129
|
-
entryPoint08Address,
|
130
119
|
} from './constants/address.js'
|
131
120
|
|
132
121
|
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'
|
5
5
|
|
6
6
|
export type DeriveEntryPointVersion<account extends SmartAccount | undefined> =
|
7
7
|
account extends SmartAccount
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { Hex } from '../../types/misc.js'
|
2
|
-
import type { RpcAuthorization } from '../../types/rpc.js'
|
3
2
|
import type { EntryPointVersion } from './entryPointVersion.js'
|
4
3
|
import type {
|
5
4
|
EstimateUserOperationGasReturnType,
|
@@ -15,13 +14,11 @@ export type RpcEstimateUserOperationGasReturnType<
|
|
15
14
|
|
16
15
|
export type RpcGetUserOperationByHashReturnType<
|
17
16
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
18
|
-
> = GetUserOperationByHashReturnType<entryPointVersion, Hex
|
17
|
+
> = GetUserOperationByHashReturnType<entryPointVersion, Hex>
|
19
18
|
|
20
19
|
export type RpcUserOperation<
|
21
20
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
22
|
-
> = UserOperation<entryPointVersion, Hex
|
23
|
-
eip7702Auth?: RpcAuthorization
|
24
|
-
}
|
21
|
+
> = UserOperation<entryPointVersion, Hex>
|
25
22
|
|
26
23
|
export type RpcUserOperationReceipt<
|
27
24
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
@@ -29,4 +26,4 @@ export type RpcUserOperationReceipt<
|
|
29
26
|
|
30
27
|
export type RpcUserOperationRequest<
|
31
28
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
32
|
-
> = UserOperationRequest<entryPointVersion, Hex
|
29
|
+
> = UserOperationRequest<entryPointVersion, Hex>
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { Address } from 'abitype'
|
2
|
-
import type { SignedAuthorization } from '../../types/authorization.js'
|
3
2
|
import type { Log } from '../../types/log.js'
|
4
3
|
import type { Hash, Hex } from '../../types/misc.js'
|
5
4
|
import type { TransactionReceipt } from '../../types/transaction.js'
|
@@ -11,15 +10,6 @@ export type EstimateUserOperationGasReturnType<
|
|
11
10
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
12
11
|
uint256 = bigint,
|
13
12
|
> = 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)
|
23
13
|
| (entryPointVersion extends '0.7'
|
24
14
|
? {
|
25
15
|
preVerificationGas: uint256
|
@@ -42,13 +32,12 @@ export type EstimateUserOperationGasReturnType<
|
|
42
32
|
export type GetUserOperationByHashReturnType<
|
43
33
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
44
34
|
uint256 = bigint,
|
45
|
-
uint32 = number,
|
46
35
|
> = {
|
47
36
|
blockHash: Hash
|
48
37
|
blockNumber: uint256
|
49
38
|
entryPoint: Address
|
50
39
|
transactionHash: Hash
|
51
|
-
userOperation: UserOperation<entryPointVersion, uint256
|
40
|
+
userOperation: UserOperation<entryPointVersion, uint256>
|
52
41
|
}
|
53
42
|
|
54
43
|
/** @link https://eips.ethereum.org/EIPS/eip-4337#entrypoint-definition */
|
@@ -77,48 +66,9 @@ export type PackedUserOperation = {
|
|
77
66
|
export type UserOperation<
|
78
67
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
79
68
|
uint256 = bigint,
|
80
|
-
uint32 = number,
|
81
69
|
> = 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)
|
118
70
|
| (entryPointVersion extends '0.7'
|
119
71
|
? {
|
120
|
-
/** Authorization data. */
|
121
|
-
authorization?: SignedAuthorization<uint32> | undefined
|
122
72
|
/** The data to pass to the `sender` during the main execution call. */
|
123
73
|
callData: Hex
|
124
74
|
/** The amount of gas to allocate the main execution call */
|
@@ -153,8 +103,6 @@ export type UserOperation<
|
|
153
103
|
: never)
|
154
104
|
| (entryPointVersion extends '0.6'
|
155
105
|
? {
|
156
|
-
/** Authorization data. */
|
157
|
-
authorization?: SignedAuthorization<uint32> | undefined
|
158
106
|
/** The data to pass to the `sender` during the main execution call. */
|
159
107
|
callData: Hex
|
160
108
|
/** The amount of gas to allocate the main execution call */
|
@@ -184,24 +132,10 @@ export type UserOperation<
|
|
184
132
|
export type UserOperationRequest<
|
185
133
|
entryPointVersion extends EntryPointVersion = EntryPointVersion,
|
186
134
|
uint256 = bigint,
|
187
|
-
uint32 = number,
|
188
135
|
> = 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)
|
202
136
|
| (entryPointVersion extends '0.7'
|
203
137
|
? UnionPartialBy<
|
204
|
-
UserOperation<'0.7', uint256
|
138
|
+
UserOperation<'0.7', uint256>,
|
205
139
|
// We are able to calculate these via `prepareUserOperation`.
|
206
140
|
| keyof EstimateUserOperationGasReturnType<'0.7'>
|
207
141
|
| 'callData'
|
@@ -214,7 +148,7 @@ export type UserOperationRequest<
|
|
214
148
|
: never)
|
215
149
|
| (entryPointVersion extends '0.6'
|
216
150
|
? UnionPartialBy<
|
217
|
-
UserOperation<'0.6', uint256
|
151
|
+
UserOperation<'0.6', uint256>,
|
218
152
|
// We are able to calculate these via `prepareUserOperation`.
|
219
153
|
| keyof EstimateUserOperationGasReturnType<'0.6'>
|
220
154
|
| 'callData'
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import type { ErrorType } from '../../../errors/utils.js'
|
2
|
-
import type { SignedAuthorization } from '../../../types/authorization.js'
|
3
2
|
import type { ExactPartial } from '../../../types/utils.js'
|
4
3
|
import { numberToHex } from '../../../utils/encoding/toHex.js'
|
5
|
-
import { pad } from '../../../utils/index.js'
|
6
4
|
import type { RpcUserOperation } from '../../types/rpc.js'
|
7
5
|
import type { UserOperation } from '../../types/userOperation.js'
|
8
6
|
|
@@ -50,25 +48,6 @@ export function formatUserOperationRequest(
|
|
50
48
|
rpcRequest.signature = request.signature
|
51
49
|
if (typeof request.verificationGasLimit !== 'undefined')
|
52
50
|
rpcRequest.verificationGasLimit = numberToHex(request.verificationGasLimit)
|
53
|
-
if (typeof request.authorization !== 'undefined')
|
54
|
-
rpcRequest.eip7702Auth = formatAuthorization(request.authorization)
|
55
51
|
|
56
52
|
return rpcRequest
|
57
53
|
}
|
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,12 +1,10 @@
|
|
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'
|
5
4
|
import { concat } from '../../../utils/data/concat.js'
|
6
5
|
import { pad } from '../../../utils/data/pad.js'
|
7
6
|
import { numberToHex } from '../../../utils/encoding/toHex.js'
|
8
7
|
import { keccak256 } from '../../../utils/hash/keccak256.js'
|
9
|
-
import { hashTypedData } from '../../../utils/signature/hashTypedData.js'
|
10
8
|
import type { EntryPointVersion } from '../../types/entryPointVersion.js'
|
11
9
|
import type { UserOperation } from '../../types/userOperation.js'
|
12
10
|
|
@@ -128,86 +126,9 @@ export function getUserOperationHash<
|
|
128
126
|
)
|
129
127
|
}
|
130
128
|
|
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
129
|
throw new Error(`entryPointVersion "${entryPointVersion}" not supported.`)
|
208
130
|
})()
|
209
131
|
|
210
|
-
if (entryPointVersion === '0.8') return packedUserOp
|
211
132
|
return keccak256(
|
212
133
|
encodeAbiParameters(
|
213
134
|
[{ type: 'bytes32' }, { type: 'address' }, { type: 'uint256' }],
|
@@ -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'
|
package/constants/address.ts
CHANGED
@@ -2,8 +2,6 @@ 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
|
7
5
|
|
8
6
|
export const ethAddress = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' as const
|
9
7
|
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.27.
|
1
|
+
export const version = '2.27.3'
|
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.
|
4
|
+
"version": "2.27.3",
|
5
5
|
"main": "./_cjs/index.js",
|
6
6
|
"module": "./_esm/index.js",
|
7
7
|
"types": "./_types/index.d.ts",
|
@@ -174,8 +174,8 @@
|
|
174
174
|
}
|
175
175
|
},
|
176
176
|
"dependencies": {
|
177
|
-
"@noble/curves": "1.8.
|
178
|
-
"@noble/hashes": "1.7.
|
177
|
+
"@noble/curves": "1.8.2",
|
178
|
+
"@noble/hashes": "1.7.2",
|
179
179
|
"@scure/bip32": "1.6.2",
|
180
180
|
"@scure/bip39": "1.5.4",
|
181
181
|
"abitype": "1.0.8",
|
package/types/authorization.ts
CHANGED
@@ -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
|
12
|
+
} & (signed extends true ? Signature : ExactPartial<Signature>)
|
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 = {
|
14
14
|
r: Hex
|
15
15
|
s: Hex
|
16
|
-
v:
|
16
|
+
v: bigint
|
17
17
|
}
|
18
|
-
export type Signature
|
18
|
+
export type Signature = OneOf<
|
19
19
|
| SignatureLegacy
|
20
20
|
| {
|
21
21
|
r: Hex
|
22
22
|
s: Hex
|
23
23
|
/** @deprecated use `yParity`. */
|
24
|
-
v:
|
25
|
-
yParity?:
|
24
|
+
v: bigint
|
25
|
+
yParity?: number | undefined
|
26
26
|
}
|
27
27
|
| {
|
28
28
|
r: Hex
|
29
29
|
s: Hex
|
30
30
|
/** @deprecated use `yParity`. */
|
31
|
-
v?:
|
32
|
-
yParity:
|
31
|
+
v?: bigint | undefined
|
32
|
+
yParity: number
|
33
33
|
}
|
34
34
|
>
|
35
35
|
export type CompactSignature = {
|