viem 2.21.3 → 2.21.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
  3. package/_cjs/accounts/index.js +11 -20
  4. package/_cjs/accounts/index.js.map +1 -1
  5. package/_cjs/accounts/wordlists.js +24 -0
  6. package/_cjs/accounts/wordlists.js.map +1 -0
  7. package/_cjs/chains/definitions/abstractTestnet.js +32 -0
  8. package/_cjs/chains/definitions/abstractTestnet.js.map +1 -1
  9. package/_cjs/chains/definitions/flare.js +1 -1
  10. package/_cjs/chains/definitions/flareTestnet.js +2 -2
  11. package/_cjs/chains/definitions/flareTestnet.js.map +1 -1
  12. package/_cjs/chains/definitions/opBNB.js +19 -0
  13. package/_cjs/chains/definitions/opBNB.js.map +1 -1
  14. package/_cjs/chains/definitions/opBNBTestnet.js +19 -0
  15. package/_cjs/chains/definitions/opBNBTestnet.js.map +1 -1
  16. package/_cjs/chains/definitions/shapeSepolia.js +14 -2
  17. package/_cjs/chains/definitions/shapeSepolia.js.map +1 -1
  18. package/_cjs/chains/definitions/songbird.js +2 -2
  19. package/_cjs/chains/definitions/songbird.js.map +1 -1
  20. package/_cjs/chains/definitions/songbirdTestnet.js +2 -2
  21. package/_cjs/chains/definitions/songbirdTestnet.js.map +1 -1
  22. package/_cjs/errors/version.js +1 -1
  23. package/_cjs/utils/abi/decodeEventLog.js +6 -2
  24. package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
  25. package/_cjs/utils/abi/parseEventLogs.js +3 -5
  26. package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
  27. package/_cjs/utils/lru.js +6 -3
  28. package/_cjs/utils/lru.js.map +1 -1
  29. package/_cjs/utils/rpc/ipc.js +4 -1
  30. package/_cjs/utils/rpc/ipc.js.map +1 -1
  31. package/_cjs/zksync/utils/getEip712Domain.js +1 -0
  32. package/_cjs/zksync/utils/getEip712Domain.js.map +1 -1
  33. package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
  34. package/_esm/accounts/index.js +1 -10
  35. package/_esm/accounts/index.js.map +1 -1
  36. package/_esm/accounts/wordlists.js +12 -0
  37. package/_esm/accounts/wordlists.js.map +1 -0
  38. package/_esm/chains/definitions/abstractTestnet.js +32 -0
  39. package/_esm/chains/definitions/abstractTestnet.js.map +1 -1
  40. package/_esm/chains/definitions/flare.js +1 -1
  41. package/_esm/chains/definitions/flareTestnet.js +2 -2
  42. package/_esm/chains/definitions/flareTestnet.js.map +1 -1
  43. package/_esm/chains/definitions/opBNB.js +19 -0
  44. package/_esm/chains/definitions/opBNB.js.map +1 -1
  45. package/_esm/chains/definitions/opBNBTestnet.js +19 -0
  46. package/_esm/chains/definitions/opBNBTestnet.js.map +1 -1
  47. package/_esm/chains/definitions/shapeSepolia.js +14 -2
  48. package/_esm/chains/definitions/shapeSepolia.js.map +1 -1
  49. package/_esm/chains/definitions/songbird.js +2 -2
  50. package/_esm/chains/definitions/songbird.js.map +1 -1
  51. package/_esm/chains/definitions/songbirdTestnet.js +2 -2
  52. package/_esm/chains/definitions/songbirdTestnet.js.map +1 -1
  53. package/_esm/errors/version.js +1 -1
  54. package/_esm/experimental/eip7702/actions/signAuthorization.js +2 -2
  55. package/_esm/utils/abi/decodeEventLog.js +6 -2
  56. package/_esm/utils/abi/decodeEventLog.js.map +1 -1
  57. package/_esm/utils/abi/parseEventLogs.js +3 -5
  58. package/_esm/utils/abi/parseEventLogs.js.map +1 -1
  59. package/_esm/utils/lru.js +6 -3
  60. package/_esm/utils/lru.js.map +1 -1
  61. package/_esm/utils/rpc/ipc.js +4 -1
  62. package/_esm/utils/rpc/ipc.js.map +1 -1
  63. package/_esm/zksync/utils/getEip712Domain.js +1 -1
  64. package/_esm/zksync/utils/getEip712Domain.js.map +1 -1
  65. package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts +3 -3
  66. package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
  67. package/_types/account-abstraction/actions/paymaster/getPaymasterStubData.d.ts +1 -1
  68. package/_types/account-abstraction/actions/paymaster/getPaymasterStubData.d.ts.map +1 -1
  69. package/_types/accounts/index.d.ts +1 -10
  70. package/_types/accounts/index.d.ts.map +1 -1
  71. package/_types/accounts/wordlists.d.ts +11 -0
  72. package/_types/accounts/wordlists.d.ts.map +1 -0
  73. package/_types/chains/definitions/abstractTestnet.d.ts +21 -6
  74. package/_types/chains/definitions/abstractTestnet.d.ts.map +1 -1
  75. package/_types/chains/definitions/flare.d.ts +1 -1
  76. package/_types/chains/definitions/flareTestnet.d.ts +2 -2
  77. package/_types/chains/definitions/flareTestnet.d.ts.map +1 -1
  78. package/_types/chains/definitions/opBNB.d.ts +34 -1
  79. package/_types/chains/definitions/opBNB.d.ts.map +1 -1
  80. package/_types/chains/definitions/opBNBTestnet.d.ts +34 -1
  81. package/_types/chains/definitions/opBNBTestnet.d.ts.map +1 -1
  82. package/_types/chains/definitions/shapeSepolia.d.ts +261 -15
  83. package/_types/chains/definitions/shapeSepolia.d.ts.map +1 -1
  84. package/_types/chains/definitions/songbird.d.ts +2 -2
  85. package/_types/chains/definitions/songbird.d.ts.map +1 -1
  86. package/_types/chains/definitions/songbirdTestnet.d.ts +2 -2
  87. package/_types/chains/definitions/songbirdTestnet.d.ts.map +1 -1
  88. package/_types/errors/version.d.ts +1 -1
  89. package/_types/experimental/eip7702/actions/signAuthorization.d.ts +2 -2
  90. package/_types/experimental/eip7702/decorators/eip7702.d.ts +2 -2
  91. package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
  92. package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
  93. package/_types/utils/lru.d.ts.map +1 -1
  94. package/_types/utils/rpc/ipc.d.ts.map +1 -1
  95. package/_types/zksync/utils/getEip712Domain.d.ts +2 -1
  96. package/_types/zksync/utils/getEip712Domain.d.ts.map +1 -1
  97. package/account-abstraction/actions/paymaster/getPaymasterData.ts +4 -2
  98. package/account-abstraction/actions/paymaster/getPaymasterStubData.ts +1 -1
  99. package/accounts/index.ts +13 -10
  100. package/accounts/wordlists.ts +11 -0
  101. package/chains/definitions/abstractTestnet.ts +34 -0
  102. package/chains/definitions/flare.ts +1 -1
  103. package/chains/definitions/flareTestnet.ts +2 -2
  104. package/chains/definitions/opBNB.ts +20 -0
  105. package/chains/definitions/opBNBTestnet.ts +20 -0
  106. package/chains/definitions/shapeSepolia.ts +15 -2
  107. package/chains/definitions/songbird.ts +2 -2
  108. package/chains/definitions/songbirdTestnet.ts +2 -2
  109. package/errors/version.ts +1 -1
  110. package/experimental/eip7702/actions/signAuthorization.ts +2 -2
  111. package/experimental/eip7702/decorators/eip7702.ts +2 -2
  112. package/package.json +1 -1
  113. package/utils/abi/decodeEventLog.ts +9 -5
  114. package/utils/abi/parseEventLogs.ts +6 -5
  115. package/utils/lru.ts +5 -3
  116. package/utils/rpc/ipc.ts +4 -1
  117. package/zksync/utils/getEip712Domain.ts +1 -1
@@ -46,6 +46,8 @@ export type GetPaymasterDataParameters = OneOf<
46
46
  | 'sender'
47
47
  | 'preVerificationGas'
48
48
  | 'verificationGasLimit'
49
+ | 'paymasterPostOpGasLimit'
50
+ | 'paymasterVerificationGasLimit'
49
51
  >,
50
52
  | 'callGasLimit'
51
53
  | 'factory'
@@ -67,8 +69,8 @@ export type GetPaymasterDataReturnType = Prettify<
67
69
  | {
68
70
  paymaster: Address
69
71
  paymasterData: Hex
70
- paymasterVerificationGasLimit: bigint
71
- paymasterPostOpGasLimit: bigint
72
+ paymasterPostOpGasLimit?: bigint | undefined
73
+ paymasterVerificationGasLimit?: bigint | undefined
72
74
  }
73
75
  >
74
76
  >
@@ -67,7 +67,7 @@ export type GetPaymasterStubDataReturnType = Prettify<
67
67
  | {
68
68
  paymaster: Address
69
69
  paymasterData: Hex
70
- paymasterVerificationGasLimit: bigint
70
+ paymasterVerificationGasLimit?: bigint | undefined
71
71
  paymasterPostOpGasLimit: bigint
72
72
  }
73
73
  > & {
package/accounts/index.ts CHANGED
@@ -2,16 +2,19 @@ export type { Address } from 'abitype'
2
2
 
3
3
  // biome-ignore lint/performance/noBarrelFile: entrypoint module
4
4
  export { HDKey } from '@scure/bip32'
5
- export { wordlist as czech } from '@scure/bip39/wordlists/czech'
6
- export { wordlist as english } from '@scure/bip39/wordlists/english'
7
- export { wordlist as french } from '@scure/bip39/wordlists/french'
8
- export { wordlist as italian } from '@scure/bip39/wordlists/italian'
9
- export { wordlist as japanese } from '@scure/bip39/wordlists/japanese'
10
- export { wordlist as korean } from '@scure/bip39/wordlists/korean'
11
- export { wordlist as portuguese } from '@scure/bip39/wordlists/portuguese'
12
- export { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese'
13
- export { wordlist as spanish } from '@scure/bip39/wordlists/spanish'
14
- export { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese'
5
+
6
+ export {
7
+ czech,
8
+ english,
9
+ french,
10
+ italian,
11
+ japanese,
12
+ korean,
13
+ portuguese,
14
+ simplifiedChinese,
15
+ spanish,
16
+ traditionalChinese,
17
+ } from './wordlists.js'
15
18
 
16
19
  export {
17
20
  type GenerateMnemonicErrorType,
@@ -0,0 +1,11 @@
1
+ // biome-ignore lint/performance/noBarrelFile:
2
+ export { wordlist as czech } from '@scure/bip39/wordlists/czech'
3
+ export { wordlist as english } from '@scure/bip39/wordlists/english'
4
+ export { wordlist as french } from '@scure/bip39/wordlists/french'
5
+ export { wordlist as italian } from '@scure/bip39/wordlists/italian'
6
+ export { wordlist as japanese } from '@scure/bip39/wordlists/japanese'
7
+ export { wordlist as korean } from '@scure/bip39/wordlists/korean'
8
+ export { wordlist as portuguese } from '@scure/bip39/wordlists/portuguese'
9
+ export { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese'
10
+ export { wordlist as spanish } from '@scure/bip39/wordlists/spanish'
11
+ export { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese'
@@ -1,5 +1,7 @@
1
1
  import { defineChain } from '../../utils/chain/defineChain.js'
2
2
  import { chainConfig } from '../../zksync/chainConfig.js'
3
+ import type { ZksyncTransactionSerializableEIP712 } from '../../zksync/types/transaction.js'
4
+ import { transactionToMessage } from '../../zksync/utils/getEip712Domain.js'
3
5
 
4
6
  export const abstractTestnet = /*#__PURE__*/ defineChain({
5
7
  ...chainConfig,
@@ -20,4 +22,36 @@ export const abstractTestnet = /*#__PURE__*/ defineChain({
20
22
  },
21
23
  },
22
24
  testnet: true,
25
+ custom: {
26
+ getEip712Domain(transaction: ZksyncTransactionSerializableEIP712) {
27
+ const message = transactionToMessage(transaction)
28
+
29
+ return {
30
+ domain: {
31
+ name: 'Abstract', // Use 'Abstract' rather than 'zkSync'
32
+ version: '2',
33
+ chainId: transaction.chainId,
34
+ },
35
+ types: {
36
+ Transaction: [
37
+ { name: 'txType', type: 'uint256' },
38
+ { name: 'from', type: 'uint256' },
39
+ { name: 'to', type: 'uint256' },
40
+ { name: 'gasLimit', type: 'uint256' },
41
+ { name: 'gasPerPubdataByteLimit', type: 'uint256' },
42
+ { name: 'maxFeePerGas', type: 'uint256' },
43
+ { name: 'maxPriorityFeePerGas', type: 'uint256' },
44
+ { name: 'paymaster', type: 'uint256' },
45
+ { name: 'nonce', type: 'uint256' },
46
+ { name: 'value', type: 'uint256' },
47
+ { name: 'data', type: 'bytes' },
48
+ { name: 'factoryDeps', type: 'bytes32[]' },
49
+ { name: 'paymasterInput', type: 'bytes' },
50
+ ],
51
+ },
52
+ primaryType: 'Transaction',
53
+ message: message,
54
+ }
55
+ },
56
+ },
23
57
  })
@@ -5,7 +5,7 @@ export const flare = /*#__PURE__*/ defineChain({
5
5
  name: 'Flare Mainnet',
6
6
  nativeCurrency: {
7
7
  decimals: 18,
8
- name: 'flare',
8
+ name: 'Flare',
9
9
  symbol: 'FLR',
10
10
  },
11
11
  rpcUrls: {
@@ -2,10 +2,10 @@ import { defineChain } from '../../utils/chain/defineChain.js'
2
2
 
3
3
  export const flareTestnet = /*#__PURE__*/ defineChain({
4
4
  id: 114,
5
- name: 'Coston2',
5
+ name: 'Flare Testnet Coston2',
6
6
  nativeCurrency: {
7
7
  decimals: 18,
8
- name: 'coston2flare',
8
+ name: 'Coston2 Flare',
9
9
  symbol: 'C2FLR',
10
10
  },
11
11
  rpcUrls: {
@@ -1,5 +1,8 @@
1
+ import { chainConfig } from '../../op-stack/chainConfig.js'
1
2
  import { defineChain } from '../../utils/chain/defineChain.js'
2
3
 
4
+ const sourceId = 56 // bsc mainnet
5
+
3
6
  export const opBNB = /*#__PURE__*/ defineChain({
4
7
  id: 204,
5
8
  name: 'opBNB',
@@ -18,9 +21,26 @@ export const opBNB = /*#__PURE__*/ defineChain({
18
21
  },
19
22
  },
20
23
  contracts: {
24
+ ...chainConfig.contracts,
21
25
  multicall3: {
22
26
  address: '0xcA11bde05977b3631167028862bE2a173976CA11',
23
27
  blockCreated: 512881,
24
28
  },
29
+ l2OutputOracle: {
30
+ [sourceId]: {
31
+ address: '0x153CAB79f4767E2ff862C94aa49573294B13D169',
32
+ },
33
+ },
34
+ portal: {
35
+ [sourceId]: {
36
+ address: '0x1876EA7702C0ad0C6A2ae6036DE7733edfBca519',
37
+ },
38
+ },
39
+ l1StandardBridge: {
40
+ [sourceId]: {
41
+ address: '0xF05F0e4362859c3331Cb9395CBC201E3Fa6757Ea',
42
+ },
43
+ },
25
44
  },
45
+ sourceId,
26
46
  })
@@ -1,5 +1,8 @@
1
+ import { chainConfig } from '../../op-stack/chainConfig.js'
1
2
  import { defineChain } from '../../utils/chain/defineChain.js'
2
3
 
4
+ const sourceId = 97 // bsc testnet
5
+
3
6
  export const opBNBTestnet = /*#__PURE__*/ defineChain({
4
7
  id: 5611,
5
8
  name: 'opBNB Testnet',
@@ -18,10 +21,27 @@ export const opBNBTestnet = /*#__PURE__*/ defineChain({
18
21
  },
19
22
  },
20
23
  contracts: {
24
+ ...chainConfig.contracts,
21
25
  multicall3: {
22
26
  address: '0xcA11bde05977b3631167028862bE2a173976CA11',
23
27
  blockCreated: 3705108,
24
28
  },
29
+ l2OutputOracle: {
30
+ [sourceId]: {
31
+ address: '0xFf2394Bb843012562f4349C6632a0EcB92fC8810',
32
+ },
33
+ },
34
+ portal: {
35
+ [sourceId]: {
36
+ address: '0x4386C8ABf2009aC0c263462Da568DD9d46e52a31',
37
+ },
38
+ },
39
+ l1StandardBridge: {
40
+ [sourceId]: {
41
+ address: '0x677311Fd2cCc511Bbc0f581E8d9a07B033D5E840',
42
+ },
43
+ },
25
44
  },
26
45
  testnet: true,
46
+ sourceId,
27
47
  })
@@ -1,6 +1,10 @@
1
+ import { chainConfig } from '../../op-stack/chainConfig.js'
1
2
  import { defineChain } from '../../utils/chain/defineChain.js'
2
3
 
4
+ const sourceId = 11_155_111 // sepolia
5
+
3
6
  export const shapeSepolia = /*#__PURE__*/ defineChain({
7
+ ...chainConfig,
4
8
  id: 11_011,
5
9
  name: 'Shape Sepolia Testnet',
6
10
  nativeCurrency: { name: 'Sepolia Ether', symbol: 'ETH', decimals: 18 },
@@ -12,8 +16,17 @@ export const shapeSepolia = /*#__PURE__*/ defineChain({
12
16
  blockExplorers: {
13
17
  default: {
14
18
  name: 'blockscout',
15
- url: 'https://shape-sepolia-explorer.alchemy.com',
16
- apiUrl: 'https://shape-sepolia-explorer.alchemy.com/api/v2',
19
+ url: 'https://explorer-sepolia.shape.network/',
20
+ apiUrl: 'https://explorer-sepolia.shape.network/api/v2',
21
+ },
22
+ },
23
+ contracts: {
24
+ ...chainConfig.contracts,
25
+ multicall3: {
26
+ address: '0xca11bde05977b3631167028862be2a173976ca11',
27
+ blockCreated: 1,
17
28
  },
18
29
  },
30
+ testnet: true,
31
+ sourceId,
19
32
  })
@@ -2,10 +2,10 @@ import { defineChain } from '../../utils/chain/defineChain.js'
2
2
 
3
3
  export const songbird = /*#__PURE__*/ defineChain({
4
4
  id: 19,
5
- name: 'Songbird Mainnet',
5
+ name: 'Songbird Canary-Network',
6
6
  nativeCurrency: {
7
7
  decimals: 18,
8
- name: 'songbird',
8
+ name: 'Songbird',
9
9
  symbol: 'SGB',
10
10
  },
11
11
  rpcUrls: {
@@ -2,10 +2,10 @@ import { defineChain } from '../../utils/chain/defineChain.js'
2
2
 
3
3
  export const songbirdTestnet = /*#__PURE__*/ defineChain({
4
4
  id: 16,
5
- name: 'Coston',
5
+ name: 'Songbird Testnet Coston',
6
6
  nativeCurrency: {
7
7
  decimals: 18,
8
- name: 'costonflare',
8
+ name: 'Coston Flare',
9
9
  symbol: 'CFLR',
10
10
  },
11
11
  rpcUrls: {
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.21.3'
1
+ export const version = '2.21.5'
@@ -62,7 +62,7 @@ export type SignAuthorizationErrorType =
62
62
  * })
63
63
  * const signature = await signAuthorization(client, {
64
64
  * account: privateKeyToAccount('0x..'),
65
- * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
65
+ * contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
66
66
  * })
67
67
  *
68
68
  * @example
@@ -78,7 +78,7 @@ export type SignAuthorizationErrorType =
78
78
  * transport: http(),
79
79
  * })
80
80
  * const signature = await signAuthorization(client, {
81
- * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
81
+ * contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
82
82
  * })
83
83
  */
84
84
  export async function signAuthorization<
@@ -35,7 +35,7 @@ export type Eip7702Actions<
35
35
  *
36
36
  * const signature = await client.signAuthorization({
37
37
  * account: privateKeyToAccount('0x..'),
38
- * authorization: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
38
+ * contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
39
39
  * })
40
40
  *
41
41
  * @example
@@ -52,7 +52,7 @@ export type Eip7702Actions<
52
52
  * }).extend(eip7702Actions())
53
53
  *
54
54
  * const signature = await client.signAuthorization({
55
- * authorization: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
55
+ * contractAddress: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
56
56
  * })
57
57
  */
58
58
  signAuthorization: (
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.21.3",
4
+ "version": "2.21.5",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -116,11 +116,15 @@ export function decodeEventLog<
116
116
  const [signature, ...argTopics] = topics
117
117
  if (!signature) throw new AbiEventSignatureEmptyTopicsError({ docsPath })
118
118
 
119
- const abiItem = abi.find(
120
- (x) =>
121
- x.type === 'event' &&
122
- signature === toEventSelector(formatAbiItem(x) as EventDefinition),
123
- )
119
+ const abiItem = (() => {
120
+ if (abi.length === 1) return abi[0]
121
+ return abi.find(
122
+ (x) =>
123
+ x.type === 'event' &&
124
+ signature === toEventSelector(formatAbiItem(x) as EventDefinition),
125
+ )
126
+ })()
127
+
124
128
  if (!(abiItem && 'name' in abiItem) || abiItem.type !== 'event')
125
129
  throw new AbiEventSignatureNotFoundError(signature, { docsPath })
126
130
 
@@ -13,11 +13,11 @@ import type { RpcLog } from '../../types/rpc.js'
13
13
  import { isAddressEqual } from '../address/isAddressEqual.js'
14
14
  import { toBytes } from '../encoding/toBytes.js'
15
15
  import { keccak256 } from '../hash/keccak256.js'
16
+ import { toEventSelector } from '../hash/toEventSelector.js'
16
17
  import {
17
18
  type DecodeEventLogErrorType,
18
19
  decodeEventLog,
19
20
  } from './decodeEventLog.js'
20
- import { getAbiItem } from './getAbiItem.js'
21
21
 
22
22
  export type ParseEventLogsParameters<
23
23
  abi extends Abi | readonly unknown[] = Abi,
@@ -116,10 +116,11 @@ export function parseEventLogs<
116
116
  return logs
117
117
  .map((log) => {
118
118
  try {
119
- const abiItem = getAbiItem({
120
- abi: abi as Abi,
121
- name: log.topics[0] as string,
122
- }) as AbiEvent
119
+ const abiItem = (abi as Abi).find(
120
+ (abiItem) =>
121
+ abiItem.type === 'event' &&
122
+ log.topics[0] === toEventSelector(abiItem),
123
+ ) as AbiEvent
123
124
  if (!abiItem) return null
124
125
 
125
126
  const event = decodeEventLog({
package/utils/lru.ts CHANGED
@@ -14,7 +14,7 @@ export class LruMap<value = unknown> extends Map<string, value> {
14
14
  override get(key: string) {
15
15
  const value = super.get(key)
16
16
 
17
- if (value !== undefined) {
17
+ if (super.has(key) && value !== undefined) {
18
18
  this.delete(key)
19
19
  super.set(key, value)
20
20
  }
@@ -24,8 +24,10 @@ export class LruMap<value = unknown> extends Map<string, value> {
24
24
 
25
25
  override set(key: string, value: value) {
26
26
  super.set(key, value)
27
- if (this.maxSize && this.size > this.maxSize)
28
- this.delete(this.keys().next().value)
27
+ if (this.maxSize && this.size > this.maxSize) {
28
+ const firstKey = this.keys().next().value
29
+ if (firstKey) this.delete(firstKey)
30
+ }
29
31
  return this
30
32
  }
31
33
  }
package/utils/rpc/ipc.ts CHANGED
@@ -60,7 +60,10 @@ export async function getIpcRpcClient(
60
60
  let lastRemaining = Buffer.alloc(0)
61
61
  function onData(buffer: Buffer) {
62
62
  const [messages, remaining] = extractMessages(
63
- Buffer.concat([lastRemaining, buffer]),
63
+ Buffer.concat([
64
+ Uint8Array.from(lastRemaining),
65
+ Uint8Array.from(buffer),
66
+ ]),
64
67
  )
65
68
  for (const message of messages) {
66
69
  const response = JSON.parse(Buffer.from(message).toString())
@@ -50,7 +50,7 @@ export const getEip712Domain: EIP712DomainFn<
50
50
  //////////////////////////////////////////////////////////////////////////////
51
51
  // Utilities
52
52
 
53
- function transactionToMessage(
53
+ export function transactionToMessage(
54
54
  transaction: ZksyncTransactionSerializableEIP712,
55
55
  ): ZksyncEIP712TransactionSignable {
56
56
  const {