viem 2.9.27 → 2.9.29
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 +16 -0
- package/_cjs/actions/public/verifyHash.js +2 -2
- package/_cjs/actions/public/verifyHash.js.map +1 -1
- package/_cjs/actions/public/verifyMessage.js +2 -2
- package/_cjs/actions/public/verifyMessage.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +7 -5
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/chains/definitions/areonNetwork.js.map +1 -1
- package/_cjs/chains/definitions/areonNetworkTestnet.js.map +1 -1
- package/_cjs/chains/definitions/cyber.js +2 -2
- package/_cjs/chains/definitions/cyber.js.map +1 -1
- package/_cjs/chains/definitions/darwinia.js.map +1 -1
- package/_cjs/chains/definitions/immutableZkEvmTestnet.js.map +1 -1
- package/_cjs/chains/definitions/reyaNetwork.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/experimental/eip5792/actions/sendCalls.js +2 -2
- package/_cjs/experimental/eip5792/actions/sendCalls.js.map +1 -1
- package/_cjs/utils/abi/parseEventLogs.js +4 -4
- package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
- package/_cjs/utils/encoding/toRlp.js +2 -2
- package/_cjs/utils/encoding/toRlp.js.map +1 -1
- package/_cjs/utils/rpc/http.js +6 -2
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/signature/recoverTransactionAddress.js +6 -8
- package/_cjs/utils/signature/recoverTransactionAddress.js.map +1 -1
- package/_cjs/utils/signature/signatureToCompactSignature.js +4 -3
- package/_cjs/utils/signature/signatureToCompactSignature.js.map +1 -1
- package/_cjs/utils/signature/signatureToHex.js +7 -7
- package/_cjs/utils/signature/signatureToHex.js.map +1 -1
- package/_cjs/utils/transaction/parseTransaction.js +1 -1
- package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
- package/_cjs/zksync/utils/assertEip712Request.js +2 -2
- package/_cjs/zksync/utils/assertEip712Request.js.map +1 -1
- package/_esm/actions/public/verifyHash.js +1 -1
- package/_esm/actions/public/verifyHash.js.map +1 -1
- package/_esm/actions/public/verifyMessage.js +1 -1
- package/_esm/actions/public/verifyMessage.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +3 -1
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/celo/fees.js +0 -1
- package/_esm/celo/fees.js.map +1 -1
- package/_esm/chains/definitions/areonNetwork.js +1 -1
- package/_esm/chains/definitions/areonNetwork.js.map +1 -1
- package/_esm/chains/definitions/areonNetworkTestnet.js +1 -1
- package/_esm/chains/definitions/areonNetworkTestnet.js.map +1 -1
- package/_esm/chains/definitions/cyber.js +2 -2
- package/_esm/chains/definitions/cyber.js.map +1 -1
- package/_esm/chains/definitions/darwinia.js +1 -1
- package/_esm/chains/definitions/darwinia.js.map +1 -1
- package/_esm/chains/definitions/immutableZkEvmTestnet.js +1 -1
- package/_esm/chains/definitions/immutableZkEvmTestnet.js.map +1 -1
- package/_esm/chains/definitions/reyaNetwork.js +1 -1
- package/_esm/chains/definitions/reyaNetwork.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/experimental/eip5792/actions/sendCalls.js +1 -1
- package/_esm/experimental/eip5792/actions/sendCalls.js.map +1 -1
- package/_esm/utils/abi/parseEventLogs.js +1 -1
- package/_esm/utils/abi/parseEventLogs.js.map +1 -1
- package/_esm/utils/encoding/toRlp.js +1 -1
- package/_esm/utils/encoding/toRlp.js.map +1 -1
- package/_esm/utils/rpc/http.js +6 -2
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/signature/recoverTransactionAddress.js +6 -8
- package/_esm/utils/signature/recoverTransactionAddress.js.map +1 -1
- package/_esm/utils/signature/signatureToCompactSignature.js +2 -1
- package/_esm/utils/signature/signatureToCompactSignature.js.map +1 -1
- package/_esm/utils/signature/signatureToHex.js +7 -8
- package/_esm/utils/signature/signatureToHex.js.map +1 -1
- package/_esm/utils/transaction/parseTransaction.js +1 -1
- package/_esm/utils/transaction/parseTransaction.js.map +1 -1
- package/_esm/zksync/utils/assertEip712Request.js +1 -1
- package/_esm/zksync/utils/assertEip712Request.js.map +1 -1
- package/_types/actions/public/verifyHash.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/celo/fees.d.ts +1 -1
- package/_types/celo/fees.d.ts.map +1 -1
- package/_types/chains/definitions/cyber.d.ts +2 -2
- package/_types/errors/version.d.ts +1 -1
- package/_types/utils/abi/parseEventLogs.d.ts +1 -1
- package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
- package/_types/utils/encoding/toRlp.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/signature/recoverTransactionAddress.d.ts +1 -1
- package/_types/utils/signature/recoverTransactionAddress.d.ts.map +1 -1
- package/_types/utils/signature/signatureToCompactSignature.d.ts +2 -1
- package/_types/utils/signature/signatureToCompactSignature.d.ts.map +1 -1
- package/_types/utils/signature/signatureToHex.d.ts +1 -1
- package/_types/utils/signature/signatureToHex.d.ts.map +1 -1
- package/_types/zksync/utils/assertEip712Request.d.ts +1 -1
- package/_types/zksync/utils/assertEip712Request.d.ts.map +1 -1
- package/actions/public/verifyHash.ts +1 -1
- package/actions/public/verifyMessage.ts +1 -1
- package/actions/public/watchEvent.ts +6 -6
- package/celo/fees.ts +5 -5
- package/chains/definitions/areonNetwork.ts +1 -1
- package/chains/definitions/areonNetworkTestnet.ts +1 -1
- package/chains/definitions/cyber.ts +2 -2
- package/chains/definitions/darwinia.ts +1 -1
- package/chains/definitions/immutableZkEvmTestnet.ts +1 -1
- package/chains/definitions/reyaNetwork.ts +1 -1
- package/errors/version.ts +1 -1
- package/experimental/eip5792/actions/sendCalls.ts +1 -1
- package/package.json +1 -1
- package/utils/abi/parseEventLogs.ts +3 -3
- package/utils/encoding/toRlp.ts +1 -1
- package/utils/rpc/http.ts +7 -6
- package/utils/signature/recoverTransactionAddress.ts +7 -12
- package/utils/signature/signatureToCompactSignature.ts +2 -6
- package/utils/signature/signatureToHex.ts +6 -6
- package/utils/transaction/parseTransaction.ts +1 -1
- package/zksync/utils/assertEip712Request.ts +4 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"assertEip712Request.d.ts","sourceRoot":"","sources":["../../../zksync/utils/assertEip712Request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"assertEip712Request.d.ts","sourceRoot":"","sources":["../../../zksync/utils/assertEip712Request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,0CAA0C,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAA;AAI9E,MAAM,MAAM,6BAA6B,GAAG,YAAY,CACtD,yBAAyB,CAAC,OAAO,MAAM,CAAC,CACzC,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,sBAAsB,GAAG,SAAS,CAAA;AAE7E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,6BAA6B,QAItE"}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import type { Address } from 'abitype'
|
2
2
|
|
3
|
-
import { signatureToHex } from '../../accounts/index.js'
|
4
3
|
import type { Client } from '../../clients/createClient.js'
|
5
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
6
5
|
import { universalSignatureValidatorAbi } from '../../constants/abis.js'
|
@@ -20,6 +19,7 @@ import {
|
|
20
19
|
import { type IsHexErrorType, isHex } from '../../utils/data/isHex.js'
|
21
20
|
import { type ToHexErrorType, bytesToHex } from '../../utils/encoding/toHex.js'
|
22
21
|
import { getAction } from '../../utils/getAction.js'
|
22
|
+
import { signatureToHex } from '../../utils/signature/signatureToHex.js'
|
23
23
|
import { type CallErrorType, type CallParameters, call } from './call.js'
|
24
24
|
|
25
25
|
export type VerifyHashParameters = Pick<
|
@@ -10,7 +10,7 @@ import type {
|
|
10
10
|
SignableMessage,
|
11
11
|
Signature,
|
12
12
|
} from '../../types/misc.js'
|
13
|
-
import { hashMessage } from '../../utils/
|
13
|
+
import { hashMessage } from '../../utils/signature/hashMessage.js'
|
14
14
|
import type { HashMessageErrorType } from '../../utils/signature/hashMessage.js'
|
15
15
|
import {
|
16
16
|
type VerifyHashErrorType,
|
@@ -11,7 +11,10 @@ import type { Filter } from '../../types/filter.js'
|
|
11
11
|
import type { Log } from '../../types/log.js'
|
12
12
|
import type { LogTopic } from '../../types/misc.js'
|
13
13
|
import type { GetPollOptions } from '../../types/transport.js'
|
14
|
-
import
|
14
|
+
import {
|
15
|
+
type EncodeEventTopicsParameters,
|
16
|
+
encodeEventTopics,
|
17
|
+
} from '../../utils/abi/encodeEventTopics.js'
|
15
18
|
import { type ObserveErrorType, observe } from '../../utils/observe.js'
|
16
19
|
import { poll } from '../../utils/poll.js'
|
17
20
|
import { type StringifyErrorType, stringify } from '../../utils/stringify.js'
|
@@ -23,12 +26,9 @@ import {
|
|
23
26
|
import { InvalidInputRpcError } from '../../errors/rpc.js'
|
24
27
|
import type { ErrorType } from '../../errors/utils.js'
|
25
28
|
import type { BlockNumber } from '../../types/block.js'
|
29
|
+
import { decodeEventLog } from '../../utils/abi/decodeEventLog.js'
|
30
|
+
import { formatLog } from '../../utils/formatters/log.js'
|
26
31
|
import { getAction } from '../../utils/getAction.js'
|
27
|
-
import {
|
28
|
-
decodeEventLog,
|
29
|
-
encodeEventTopics,
|
30
|
-
formatLog,
|
31
|
-
} from '../../utils/index.js'
|
32
32
|
import {
|
33
33
|
type CreateEventFilterParameters,
|
34
34
|
createEventFilter,
|
package/celo/fees.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { Client } from '../clients/createClient.js'
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
import type {
|
3
|
+
Address,
|
4
|
+
ChainEstimateFeesPerGasFnParameters,
|
5
|
+
ChainFees,
|
6
|
+
Hex,
|
7
7
|
} from '../index.js'
|
8
8
|
|
9
9
|
import { formatters } from './formatters.js'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
2
|
|
3
|
-
export const areonNetwork = defineChain({
|
3
|
+
export const areonNetwork = /*#__PURE__*/ defineChain({
|
4
4
|
id: 463,
|
5
5
|
name: 'Areon Network',
|
6
6
|
nativeCurrency: { decimals: 18, name: 'AREA', symbol: 'AREA' },
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
2
|
|
3
|
-
export const areonNetworkTestnet = defineChain({
|
3
|
+
export const areonNetworkTestnet = /*#__PURE__*/ defineChain({
|
4
4
|
id: 462,
|
5
5
|
name: 'Areon Network Testnet',
|
6
6
|
nativeCurrency: { decimals: 18, name: 'TAREA', symbol: 'TAREA' },
|
@@ -18,8 +18,8 @@ export const cyber = /*#__PURE__*/ defineChain({
|
|
18
18
|
},
|
19
19
|
contracts: {
|
20
20
|
multicall3: {
|
21
|
-
address: '
|
22
|
-
blockCreated:
|
21
|
+
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
22
|
+
blockCreated: 0,
|
23
23
|
},
|
24
24
|
},
|
25
25
|
})
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.9.
|
1
|
+
export const version = '2.9.29'
|
@@ -15,7 +15,7 @@ import type { OneOf } from '../../../types/utils.js'
|
|
15
15
|
import { parseAccount } from '../../../utils/accounts.js'
|
16
16
|
import type { RequestErrorType } from '../../../utils/buildRequest.js'
|
17
17
|
import { numberToHex } from '../../../utils/encoding/toHex.js'
|
18
|
-
import { getTransactionError } from '../../../utils/
|
18
|
+
import { getTransactionError } from '../../../utils/errors/getTransactionError.js'
|
19
19
|
|
20
20
|
export type SendCallsParameters<
|
21
21
|
chain extends Chain | undefined = Chain | undefined,
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
import type { Abi } from 'abitype'
|
2
|
-
import type { ErrorType } from '../../errors/utils.js'
|
3
2
|
import {
|
4
3
|
AbiEventSignatureNotFoundError,
|
5
4
|
DecodeLogDataMismatch,
|
6
5
|
DecodeLogTopicsMismatch,
|
7
|
-
|
8
|
-
} from '../../
|
6
|
+
} from '../../errors/abi.js'
|
7
|
+
import type { ErrorType } from '../../errors/utils.js'
|
9
8
|
import type { ContractEventName } from '../../types/contract.js'
|
10
9
|
import type { Log } from '../../types/log.js'
|
10
|
+
import type { RpcLog } from '../../types/rpc.js'
|
11
11
|
import {
|
12
12
|
type DecodeEventLogErrorType,
|
13
13
|
decodeEventLog,
|
package/utils/encoding/toRlp.ts
CHANGED
package/utils/rpc/http.ts
CHANGED
@@ -63,16 +63,17 @@ export function getHttpRpcClient(
|
|
63
63
|
async request(params) {
|
64
64
|
const {
|
65
65
|
body,
|
66
|
-
fetchOptions = {},
|
67
66
|
onRequest = options.onRequest,
|
68
67
|
onResponse = options.onResponse,
|
69
68
|
timeout = options.timeout ?? 10_000,
|
70
69
|
} = params
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
70
|
+
|
71
|
+
const fetchOptions = {
|
72
|
+
...(options.fetchOptions ?? {}),
|
73
|
+
...(params.fetchOptions ?? {}),
|
74
|
+
}
|
75
|
+
|
76
|
+
const { headers, method, signal: signal_ } = fetchOptions
|
76
77
|
|
77
78
|
try {
|
78
79
|
const response = await withTimeout(
|
@@ -12,10 +12,7 @@ import {
|
|
12
12
|
type RecoverAddressErrorType,
|
13
13
|
recoverAddress,
|
14
14
|
} from './recoverAddress.js'
|
15
|
-
import {
|
16
|
-
type SignatureToHexErrorType,
|
17
|
-
signatureToHex,
|
18
|
-
} from './signatureToHex.js'
|
15
|
+
import type { SignatureToHexErrorType } from './signatureToHex.js'
|
19
16
|
|
20
17
|
export type RecoverTransactionAddressParameters = {
|
21
18
|
serializedTransaction: TransactionSerialized
|
@@ -38,14 +35,12 @@ export async function recoverTransactionAddress(
|
|
38
35
|
|
39
36
|
const transaction = parseTransaction(serializedTransaction)
|
40
37
|
|
41
|
-
const signature =
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
yParity: transaction.yParity!,
|
48
|
-
})
|
38
|
+
const signature = signature_ ?? {
|
39
|
+
r: transaction.r!,
|
40
|
+
s: transaction.s!,
|
41
|
+
v: transaction.v!,
|
42
|
+
yParity: transaction.yParity!,
|
43
|
+
}
|
49
44
|
|
50
45
|
const serialized = serializeTransaction({
|
51
46
|
...transaction,
|
@@ -1,11 +1,7 @@
|
|
1
1
|
import type { ErrorType } from '../../errors/utils.js'
|
2
2
|
import type { CompactSignature, Signature } from '../../types/misc.js'
|
3
|
-
import {
|
4
|
-
|
5
|
-
type HexToBytesErrorType,
|
6
|
-
bytesToHex,
|
7
|
-
hexToBytes,
|
8
|
-
} from '../index.js'
|
3
|
+
import { type HexToBytesErrorType, hexToBytes } from '../encoding/toBytes.js'
|
4
|
+
import { type BytesToHexErrorType, bytesToHex } from '../encoding/toHex.js'
|
9
5
|
|
10
6
|
export type SignatureToCompactSignatureErrorType =
|
11
7
|
| HexToBytesErrorType
|
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
type HexToBigIntErrorType,
|
7
7
|
hexToBigInt,
|
8
8
|
} from '../../utils/encoding/fromHex.js'
|
9
|
-
import {
|
9
|
+
import type { ToHexErrorType } from '../../utils/encoding/toHex.js'
|
10
10
|
|
11
11
|
export type SignatureToHexErrorType =
|
12
12
|
| HexToBigIntErrorType
|
@@ -28,13 +28,13 @@ export type SignatureToHexErrorType =
|
|
28
28
|
* // "0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c"
|
29
29
|
*/
|
30
30
|
export function signatureToHex({ r, s, v, yParity }: Signature): Hex {
|
31
|
-
const
|
32
|
-
if (
|
33
|
-
if (v ===
|
34
|
-
throw new Error('Invalid v value')
|
31
|
+
const yParity_ = (() => {
|
32
|
+
if (yParity === 0 || yParity === 1) return yParity
|
33
|
+
if (v && (v === 27n || v === 28n || v >= 35n)) return v % 2n === 0n ? 1 : 0
|
34
|
+
throw new Error('Invalid `v` or `yParity` value')
|
35
35
|
})()
|
36
36
|
return `0x${new secp256k1.Signature(
|
37
37
|
hexToBigInt(r),
|
38
38
|
hexToBigInt(s),
|
39
|
-
).toCompactHex()}${
|
39
|
+
).toCompactHex()}${yParity_ === 0 ? '1b' : '1c'}`
|
40
40
|
}
|
@@ -422,10 +422,10 @@ function parseTransactionLegacy(
|
|
422
422
|
if (chainId > 0) transaction.chainId = chainId
|
423
423
|
else if (v !== 27n && v !== 28n) throw new InvalidLegacyVError({ v })
|
424
424
|
|
425
|
-
delete transaction.yParity
|
426
425
|
transaction.v = v
|
427
426
|
transaction.s = s as Hex
|
428
427
|
transaction.r = r as Hex
|
428
|
+
transaction.yParity = v % 2n === 0n ? 1 : 0
|
429
429
|
|
430
430
|
return transaction
|
431
431
|
}
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import type { ErrorType } from '../../errors/utils.js'
|
2
|
-
import { type AssertRequestErrorType, assertRequest } from '../../index.js'
|
3
2
|
import type { ExactPartial } from '../../types/utils.js'
|
3
|
+
import {
|
4
|
+
type AssertRequestErrorType,
|
5
|
+
assertRequest,
|
6
|
+
} from '../../utils/transaction/assertRequest.js'
|
4
7
|
import type { zkSync } from '../../zksync/chains.js'
|
5
8
|
import type { SendTransactionParameters } from '../actions/sendTransaction.js'
|
6
9
|
import { InvalidEip712TransactionError } from '../errors/transaction.js'
|