viem 2.21.47 → 2.21.49
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +34 -0
- package/_cjs/accounts/index.js +2 -1
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/utils/sign.js +8 -1
- package/_cjs/accounts/utils/sign.js.map +1 -1
- package/_cjs/actions/public/simulateContract.js.map +1 -1
- package/_cjs/chains/definitions/bitgert.js +6 -0
- package/_cjs/chains/definitions/bitgert.js.map +1 -1
- package/_cjs/chains/definitions/disChain.js +25 -0
- package/_cjs/chains/definitions/disChain.js.map +1 -0
- package/_cjs/chains/definitions/energy.js +22 -0
- package/_cjs/chains/definitions/energy.js.map +1 -0
- package/_cjs/chains/definitions/guruNetwork.js +32 -0
- package/_cjs/chains/definitions/guruNetwork.js.map +1 -0
- package/_cjs/chains/definitions/guruTestnet.js +2 -2
- package/_cjs/chains/definitions/guruTestnet.js.map +1 -1
- package/_cjs/chains/definitions/iSunCoin.js +25 -0
- package/_cjs/chains/definitions/iSunCoin.js.map +1 -0
- package/_cjs/chains/definitions/mchVerse.js +23 -0
- package/_cjs/chains/definitions/mchVerse.js.map +1 -0
- package/_cjs/chains/definitions/metadium.js +24 -0
- package/_cjs/chains/definitions/metadium.js.map +1 -0
- package/_cjs/chains/definitions/sixProtocol.js +26 -0
- package/_cjs/chains/definitions/sixProtocol.js.map +1 -0
- package/_cjs/chains/definitions/vanar.js +22 -0
- package/_cjs/chains/definitions/vanar.js.map +1 -0
- package/_cjs/chains/index.js +24 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/zksync/formatters.js +3 -1
- package/_cjs/zksync/formatters.js.map +1 -1
- package/_cjs/zksync/index.js +3 -1
- package/_cjs/zksync/index.js.map +1 -1
- package/_cjs/zksync/utils/parseEip712Transaction.js +48 -0
- package/_cjs/zksync/utils/parseEip712Transaction.js.map +1 -0
- package/_esm/accounts/index.js +1 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/utils/sign.js +10 -1
- package/_esm/accounts/utils/sign.js.map +1 -1
- package/_esm/actions/public/simulateContract.js.map +1 -1
- package/_esm/chains/definitions/bitgert.js +6 -0
- package/_esm/chains/definitions/bitgert.js.map +1 -1
- package/_esm/chains/definitions/disChain.js +22 -0
- package/_esm/chains/definitions/disChain.js.map +1 -0
- package/_esm/chains/definitions/energy.js +19 -0
- package/_esm/chains/definitions/energy.js.map +1 -0
- package/_esm/chains/definitions/guruNetwork.js +29 -0
- package/_esm/chains/definitions/guruNetwork.js.map +1 -0
- package/_esm/chains/definitions/guruTestnet.js +2 -2
- package/_esm/chains/definitions/guruTestnet.js.map +1 -1
- package/_esm/chains/definitions/iSunCoin.js +22 -0
- package/_esm/chains/definitions/iSunCoin.js.map +1 -0
- package/_esm/chains/definitions/mchVerse.js +20 -0
- package/_esm/chains/definitions/mchVerse.js.map +1 -0
- package/_esm/chains/definitions/metadium.js +21 -0
- package/_esm/chains/definitions/metadium.js.map +1 -0
- package/_esm/chains/definitions/sixProtocol.js +23 -0
- package/_esm/chains/definitions/sixProtocol.js.map +1 -0
- package/_esm/chains/definitions/vanar.js +19 -0
- package/_esm/chains/definitions/vanar.js.map +1 -0
- package/_esm/chains/index.js +8 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/zksync/formatters.js +3 -1
- package/_esm/zksync/formatters.js.map +1 -1
- package/_esm/zksync/index.js +1 -0
- package/_esm/zksync/index.js.map +1 -1
- package/_esm/zksync/utils/parseEip712Transaction.js +45 -0
- package/_esm/zksync/utils/parseEip712Transaction.js.map +1 -0
- package/_types/accounts/index.d.ts +1 -1
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/utils/sign.d.ts +4 -0
- package/_types/accounts/utils/sign.d.ts.map +1 -1
- package/_types/actions/public/simulateContract.d.ts +6 -6
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/chains/definitions/bitgert.d.ts +6 -10
- package/_types/chains/definitions/bitgert.d.ts.map +1 -1
- package/_types/chains/definitions/disChain.d.ts +37 -0
- package/_types/chains/definitions/disChain.d.ts.map +1 -0
- package/_types/chains/definitions/energy.d.ts +37 -0
- package/_types/chains/definitions/energy.d.ts.map +1 -0
- package/_types/chains/definitions/guruNetwork.d.ts +33 -0
- package/_types/chains/definitions/guruNetwork.d.ts.map +1 -0
- package/_types/chains/definitions/guruTestnet.d.ts +2 -2
- package/_types/chains/definitions/guruTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/iSunCoin.d.ts +37 -0
- package/_types/chains/definitions/iSunCoin.d.ts.map +1 -0
- package/_types/chains/definitions/mchVerse.d.ts +38 -0
- package/_types/chains/definitions/mchVerse.d.ts.map +1 -0
- package/_types/chains/definitions/metadium.d.ts +37 -0
- package/_types/chains/definitions/metadium.d.ts.map +1 -0
- package/_types/chains/definitions/sixProtocol.d.ts +37 -0
- package/_types/chains/definitions/sixProtocol.d.ts.map +1 -0
- package/_types/chains/definitions/vanar.d.ts +37 -0
- package/_types/chains/definitions/vanar.d.ts.map +1 -0
- package/_types/chains/index.d.ts +8 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/types/account.d.ts +1 -1
- package/_types/types/account.d.ts.map +1 -1
- package/_types/zksync/formatters.d.ts.map +1 -1
- package/_types/zksync/index.d.ts +1 -0
- package/_types/zksync/index.d.ts.map +1 -1
- package/_types/zksync/types/log.d.ts +1 -1
- package/_types/zksync/types/log.d.ts.map +1 -1
- package/_types/zksync/utils/parseEip712Transaction.d.ts +4 -0
- package/_types/zksync/utils/parseEip712Transaction.d.ts.map +1 -0
- package/accounts/index.ts +1 -0
- package/accounts/utils/sign.ts +15 -1
- package/actions/public/simulateContract.ts +9 -7
- package/chains/definitions/bitgert.ts +6 -0
- package/chains/definitions/disChain.ts +22 -0
- package/chains/definitions/energy.ts +19 -0
- package/chains/definitions/guruNetwork.ts +29 -0
- package/chains/definitions/guruTestnet.ts +2 -2
- package/chains/definitions/iSunCoin.ts +22 -0
- package/chains/definitions/mchVerse.ts +20 -0
- package/chains/definitions/metadium.ts +21 -0
- package/chains/definitions/sixProtocol.ts +23 -0
- package/chains/definitions/vanar.ts +19 -0
- package/chains/index.ts +8 -0
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/types/account.ts +2 -1
- package/zksync/formatters.ts +3 -1
- package/zksync/index.ts +1 -0
- package/zksync/types/log.ts +1 -1
- package/zksync/utils/parseEip712Transaction.ts +57 -0
package/chains/index.ts
CHANGED
@@ -103,6 +103,7 @@ export { defichainEvmTestnet } from './definitions/defichainEvmTestnet.js'
|
|
103
103
|
export { degen } from './definitions/degen.js'
|
104
104
|
export { dfk } from './definitions/dfk.js'
|
105
105
|
export { diode } from './definitions/diode.js'
|
106
|
+
export { disChain } from './definitions/disChain.js'
|
106
107
|
export { dodochainTestnet } from './definitions/dodochainTestnet.js'
|
107
108
|
export { dogechain } from './definitions/dogechain.js'
|
108
109
|
export { dosChain } from './definitions/dosChain.js'
|
@@ -122,6 +123,7 @@ export { elastosTestnet } from './definitions/elastosTestnet.js'
|
|
122
123
|
export { electroneum } from './definitions/electroneum.js'
|
123
124
|
export { electroneumTestnet } from './definitions/electroneumTestnet.js'
|
124
125
|
export { elysiumTestnet } from './definitions/elysiumTestnet.js'
|
126
|
+
export { energy } from './definitions/energy.js'
|
125
127
|
export { enuls } from './definitions/enuls.js'
|
126
128
|
export { eon } from './definitions/eon.js'
|
127
129
|
export { eos } from './definitions/eos.js'
|
@@ -171,6 +173,7 @@ export { goChain } from './definitions/goChain.js'
|
|
171
173
|
export { godwoken } from './definitions/godwoken.js'
|
172
174
|
export { goerli } from './definitions/goerli.js'
|
173
175
|
export { gravity } from './definitions/gravity.js'
|
176
|
+
export { guruNetwork } from './definitions/guruNetwork.js'
|
174
177
|
export { guruTestnet } from './definitions/guruTestnet.js'
|
175
178
|
export { ham } from './definitions/ham.js'
|
176
179
|
export { haqqMainnet } from './definitions/haqqMainnet.js'
|
@@ -196,6 +199,7 @@ export { iota } from './definitions/iota.js'
|
|
196
199
|
export { iotaTestnet } from './definitions/iotaTestnet.js'
|
197
200
|
export { iotex } from './definitions/iotex.js'
|
198
201
|
export { iotexTestnet } from './definitions/iotexTestnet.js'
|
202
|
+
export { iSunCoin } from './definitions/iSunCoin.js'
|
199
203
|
export { jbc } from './definitions/jbc.js'
|
200
204
|
export { jbcTestnet } from './definitions/jbcTestnet.js'
|
201
205
|
export { karura } from './definitions/karura.js'
|
@@ -245,11 +249,13 @@ export { mantleTestnet } from './definitions/mantleTestnet.js'
|
|
245
249
|
export { mapProtocol } from './definitions/mapProtocol.js'
|
246
250
|
export { matchain } from './definitions/matchain.js'
|
247
251
|
export { matchainTestnet } from './definitions/matchainTestnet.js'
|
252
|
+
export { mchVerse } from './definitions/mchVerse.js'
|
248
253
|
export { mekong } from './definitions/mekong.js'
|
249
254
|
export { meld } from './definitions/meld.js'
|
250
255
|
export { merlin } from './definitions/merlin.js'
|
251
256
|
export { metachain } from './definitions/metachain.js'
|
252
257
|
export { metachainIstanbul } from './definitions/metachainIstanbul.js'
|
258
|
+
export { metadium } from './definitions/metadium.js'
|
253
259
|
export { metalL2 } from './definitions/metalL2.js'
|
254
260
|
export { meter } from './definitions/meter.js'
|
255
261
|
export { meterTestnet } from './definitions/meterTestnet.js'
|
@@ -348,6 +354,7 @@ export { shimmer } from './definitions/shimmer.js'
|
|
348
354
|
export { shimmerTestnet } from './definitions/shimmerTestnet.js'
|
349
355
|
export { silicon } from './definitions/silicon.js'
|
350
356
|
export { siliconSepolia } from './definitions/siliconSepolia.js'
|
357
|
+
export { sixProtocol } from './definitions/sixProtocol.js'
|
351
358
|
export { skaleBlockBrawlers } from './definitions/skale/brawl.js'
|
352
359
|
export { skaleCalypso } from './definitions/skale/calypso.js'
|
353
360
|
export { skaleCalypsoTestnet } from './definitions/skale/calypsoTestnet.js'
|
@@ -409,6 +416,7 @@ export { unique } from './definitions/unique.js'
|
|
409
416
|
export { uniqueOpal } from './definitions/uniqueOpal.js'
|
410
417
|
export { uniqueQuartz } from './definitions/uniqueQuartz.js'
|
411
418
|
export { unreal } from './definitions/unreal.js'
|
419
|
+
export { vanar } from './definitions/vanar.js'
|
412
420
|
export { vechain } from './definitions/vechain.js'
|
413
421
|
export { velas } from './definitions/velas.js'
|
414
422
|
export { viction } from './definitions/viction.js'
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.21.
|
1
|
+
export const version = '2.21.49'
|
package/package.json
CHANGED
package/types/account.ts
CHANGED
@@ -30,9 +30,10 @@ export type GetAccountParameter<
|
|
30
30
|
>
|
31
31
|
|
32
32
|
export type ParseAccount<
|
33
|
-
accountOrAddress extends Account | Address | undefined =
|
33
|
+
accountOrAddress extends Account | Address | null | undefined =
|
34
34
|
| Account
|
35
35
|
| Address
|
36
|
+
| null
|
36
37
|
| undefined,
|
37
38
|
> = accountOrAddress extends Address
|
38
39
|
? Prettify<JsonRpcAccount<accountOrAddress>>
|
package/zksync/formatters.ts
CHANGED
@@ -81,7 +81,9 @@ export const formatters = {
|
|
81
81
|
return {
|
82
82
|
blockNumber: hexToBigInt(l2ToL1Log.blockHash),
|
83
83
|
blockHash: l2ToL1Log.blockHash,
|
84
|
-
l1BatchNumber:
|
84
|
+
l1BatchNumber: l2ToL1Log.l1BatchNumber
|
85
|
+
? hexToBigInt(l2ToL1Log.l1BatchNumber)
|
86
|
+
: null,
|
85
87
|
transactionIndex: hexToBigInt(l2ToL1Log.transactionIndex),
|
86
88
|
shardId: hexToBigInt(l2ToL1Log.shardId),
|
87
89
|
isService: l2ToL1Log.isService,
|
package/zksync/index.ts
CHANGED
package/zksync/types/log.ts
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
import { BaseError } from '../../errors/base.js'
|
2
|
+
import type { Hex } from '../../types/misc.js'
|
3
|
+
import {
|
4
|
+
fromHex,
|
5
|
+
fromRlp,
|
6
|
+
hexToBigInt,
|
7
|
+
hexToNumber,
|
8
|
+
} from '../../utils/index.js'
|
9
|
+
import type { ZksyncTransactionSerializableEIP712 } from '../types/transaction.js'
|
10
|
+
|
11
|
+
export function parseEip712Transaction(
|
12
|
+
transaction: Hex,
|
13
|
+
): ZksyncTransactionSerializableEIP712 {
|
14
|
+
const payload = fromHex(transaction, 'bytes')
|
15
|
+
if (payload[0] !== 113) throw new BaseError('transaction type must be eip712')
|
16
|
+
|
17
|
+
function validHex(value: Hex): Hex {
|
18
|
+
if (!value || value === '0x') return '0x0'
|
19
|
+
return value
|
20
|
+
}
|
21
|
+
|
22
|
+
function parsePaymasterArray(arr: Hex[]) {
|
23
|
+
if (arr.length === 0) return undefined
|
24
|
+
if (arr.length !== 2)
|
25
|
+
throw new BaseError(
|
26
|
+
`Invalid paymaster parameters, expected to have length of 2, found ${arr.length}!`,
|
27
|
+
)
|
28
|
+
|
29
|
+
return {
|
30
|
+
paymaster: arr[0],
|
31
|
+
paymasterInput: arr[1],
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
const raw = fromRlp(payload.slice(1)) as Hex[]
|
36
|
+
const paymasterParams = parsePaymasterArray(raw[15] as unknown as Hex[])
|
37
|
+
return {
|
38
|
+
type: 'eip712',
|
39
|
+
nonce: hexToNumber(validHex(raw[0])),
|
40
|
+
maxPriorityFeePerGas: hexToBigInt(validHex(raw[1])),
|
41
|
+
maxFeePerGas: hexToBigInt(validHex(raw[2])),
|
42
|
+
gas: hexToBigInt(validHex(raw[3])),
|
43
|
+
to: raw[4],
|
44
|
+
value: hexToBigInt(validHex(raw[5])),
|
45
|
+
data: raw[6],
|
46
|
+
v: hexToBigInt(validHex(raw[7])),
|
47
|
+
r: raw[8],
|
48
|
+
s: raw[9],
|
49
|
+
chainId: hexToNumber(validHex(raw[10])),
|
50
|
+
from: raw[11],
|
51
|
+
gasPerPubdata: hexToBigInt(validHex(raw[12])),
|
52
|
+
factoryDeps: raw[13] as unknown as Hex[],
|
53
|
+
customSignature: raw[14],
|
54
|
+
paymaster: paymasterParams?.paymaster,
|
55
|
+
paymasterInput: paymasterParams?.paymasterInput,
|
56
|
+
}
|
57
|
+
}
|