viem 0.0.0-main.20240519T233212 → 0.0.0-main.20240520T005450

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 (78) hide show
  1. package/_cjs/errors/version.js +1 -1
  2. package/_cjs/zksync/actions/getL1Allowance.js +19 -0
  3. package/_cjs/zksync/actions/getL1Allowance.js.map +1 -0
  4. package/_cjs/zksync/actions/getL1Balance.js +23 -0
  5. package/_cjs/zksync/actions/getL1Balance.js.map +1 -0
  6. package/_cjs/zksync/actions/getL1TokenBalance.js +24 -0
  7. package/_cjs/zksync/actions/getL1TokenBalance.js.map +1 -0
  8. package/_cjs/zksync/actions/{getRawBlockTransaction.js → getRawBlockTransactions.js} +1 -1
  9. package/_cjs/zksync/actions/getRawBlockTransactions.js.map +1 -0
  10. package/_cjs/zksync/constants/address.js +4 -1
  11. package/_cjs/zksync/constants/address.js.map +1 -1
  12. package/_cjs/zksync/decorators/publicL1.js +15 -0
  13. package/_cjs/zksync/decorators/publicL1.js.map +1 -0
  14. package/_cjs/zksync/decorators/publicL2.js +2 -2
  15. package/_cjs/zksync/decorators/publicL2.js.map +1 -1
  16. package/_cjs/zksync/errors/token-is-eth.js +17 -0
  17. package/_cjs/zksync/errors/token-is-eth.js.map +1 -0
  18. package/_cjs/zksync/index.js +13 -5
  19. package/_cjs/zksync/index.js.map +1 -1
  20. package/_cjs/zksync/utils/isEth.js +17 -0
  21. package/_cjs/zksync/utils/isEth.js.map +1 -0
  22. package/_esm/errors/version.js +1 -1
  23. package/_esm/zksync/actions/getL1Allowance.js +15 -0
  24. package/_esm/zksync/actions/getL1Allowance.js.map +1 -0
  25. package/_esm/zksync/actions/getL1Balance.js +19 -0
  26. package/_esm/zksync/actions/getL1Balance.js.map +1 -0
  27. package/_esm/zksync/actions/getL1TokenBalance.js +20 -0
  28. package/_esm/zksync/actions/getL1TokenBalance.js.map +1 -0
  29. package/_esm/zksync/actions/{getRawBlockTransaction.js → getRawBlockTransactions.js} +1 -1
  30. package/_esm/zksync/actions/getRawBlockTransactions.js.map +1 -0
  31. package/_esm/zksync/constants/address.js +3 -0
  32. package/_esm/zksync/constants/address.js.map +1 -1
  33. package/_esm/zksync/decorators/publicL1.js +12 -0
  34. package/_esm/zksync/decorators/publicL1.js.map +1 -0
  35. package/_esm/zksync/decorators/publicL2.js +7 -7
  36. package/_esm/zksync/decorators/publicL2.js.map +1 -1
  37. package/_esm/zksync/errors/token-is-eth.js +13 -0
  38. package/_esm/zksync/errors/token-is-eth.js.map +1 -0
  39. package/_esm/zksync/index.js +6 -2
  40. package/_esm/zksync/index.js.map +1 -1
  41. package/_esm/zksync/utils/isEth.js +13 -0
  42. package/_esm/zksync/utils/isEth.js.map +1 -0
  43. package/_types/errors/version.d.ts +1 -1
  44. package/_types/zksync/actions/getL1Allowance.d.ts +17 -0
  45. package/_types/zksync/actions/getL1Allowance.d.ts.map +1 -0
  46. package/_types/zksync/actions/getL1Balance.d.ts +23 -0
  47. package/_types/zksync/actions/getL1Balance.d.ts.map +1 -0
  48. package/_types/zksync/actions/getL1TokenBalance.d.ts +24 -0
  49. package/_types/zksync/actions/getL1TokenBalance.d.ts.map +1 -0
  50. package/_types/zksync/actions/{getRawBlockTransaction.d.ts → getRawBlockTransactions.d.ts} +4 -4
  51. package/_types/zksync/actions/getRawBlockTransactions.d.ts.map +1 -0
  52. package/_types/zksync/constants/address.d.ts +3 -0
  53. package/_types/zksync/constants/address.d.ts.map +1 -1
  54. package/_types/zksync/decorators/publicL1.d.ts +145 -0
  55. package/_types/zksync/decorators/publicL1.d.ts.map +1 -0
  56. package/_types/zksync/decorators/publicL2.d.ts +17 -13
  57. package/_types/zksync/decorators/publicL2.d.ts.map +1 -1
  58. package/_types/zksync/errors/token-is-eth.d.ts +9 -0
  59. package/_types/zksync/errors/token-is-eth.d.ts.map +1 -0
  60. package/_types/zksync/index.d.ts +6 -2
  61. package/_types/zksync/index.d.ts.map +1 -1
  62. package/_types/zksync/utils/isEth.d.ts +3 -0
  63. package/_types/zksync/utils/isEth.d.ts.map +1 -0
  64. package/errors/version.ts +1 -1
  65. package/package.json +1 -1
  66. package/zksync/actions/getL1Allowance.ts +43 -0
  67. package/zksync/actions/getL1Balance.ts +68 -0
  68. package/zksync/actions/getL1TokenBalance.ts +63 -0
  69. package/zksync/actions/{getRawBlockTransaction.ts → getRawBlockTransactions.ts} +5 -5
  70. package/zksync/constants/address.ts +9 -0
  71. package/zksync/decorators/publicL1.ts +180 -0
  72. package/zksync/decorators/publicL2.ts +38 -20
  73. package/zksync/errors/token-is-eth.ts +16 -0
  74. package/zksync/index.ts +27 -4
  75. package/zksync/utils/isEth.ts +20 -0
  76. package/_cjs/zksync/actions/getRawBlockTransaction.js.map +0 -1
  77. package/_esm/zksync/actions/getRawBlockTransaction.js.map +0 -1
  78. package/_types/zksync/actions/getRawBlockTransaction.d.ts.map +0 -1
@@ -0,0 +1,180 @@
1
+ import type { Chain } from '../../chains/index.js'
2
+ import type { Client } from '../../clients/createClient.js'
3
+ import type { Transport } from '../../clients/transports/createTransport.js'
4
+ import type { Account } from '../../types/account.js'
5
+ import {
6
+ type GetL1AllowanceParameters,
7
+ type GetL1AllowanceReturnType,
8
+ getL1Allowance,
9
+ } from '../actions/getL1Allowance.js'
10
+ import {
11
+ type GetL1BalanceParameters,
12
+ type GetL1BalanceReturnType,
13
+ getL1Balance,
14
+ } from '../actions/getL1Balance.js'
15
+ import {
16
+ type GetL1TokenBalanceParameters,
17
+ type GetL1TokenBalanceReturnType,
18
+ getL1TokenBalance,
19
+ } from '../actions/getL1TokenBalance.js'
20
+
21
+ export type PublicActionsL1<
22
+ TAccount extends Account | undefined = Account | undefined,
23
+ > = {
24
+ /**
25
+ * Returns the amount of approved tokens for a specific L1 bridge.
26
+ *
27
+ * - Docs: https://viem.sh/zksync/actions/getL1Allowance
28
+ *
29
+ * @param client - Client to use
30
+ * @param parameters - {@link AllowanceL1Parameters}
31
+ * @returns The amount of approved tokens for a specific L1 bridge. {@link GetL1AllowanceReturnType}
32
+ *
33
+ * @example
34
+ * import { createPublicClient, custom, parseEther } from 'viem'
35
+ * import { base, mainnet } from 'viem/chains'
36
+ * import { publicActionsL1 } from 'viem/zksync'
37
+ *
38
+ * const client = createPublicClient({
39
+ * chain: mainnet,
40
+ * transport: custom(window.ethereum),
41
+ * }).extend(publicActionsL1())
42
+ *
43
+ * const data = await client.getL1Allowance({
44
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
45
+ * token: '0x5C221E77624690fff6dd741493D735a17716c26B'
46
+ * bridgeAddress: '0x84DbCC0B82124bee38e3Ce9a92CdE2f943bab60D',
47
+ * })
48
+ *
49
+ * @example
50
+ * // Account Hoisting
51
+ * import { createWalletClient, http } from 'viem'
52
+ * import { privateKeyToAccount } from 'viem/accounts'
53
+ * import { base, mainnet } from 'viem/chains'
54
+ * import { publicActionsL1 } from 'viem/zksync'
55
+ *
56
+ * const client = createWalletClient({
57
+ * account: privateKeyToAccount('0x…'),
58
+ * chain: mainnet,
59
+ * transport: http(),
60
+ * }).extend(publicActionsL1())
61
+ *
62
+ * const data = await client.getL1Allowance({
63
+ * token: '0x5C221E77624690fff6dd741493D735a17716c26B'
64
+ * bridgeAddress: '0x84DbCC0B82124bee38e3Ce9a92CdE2f943bab60D',
65
+ * })
66
+ */
67
+ getL1Allowance: (
68
+ parameters: GetL1AllowanceParameters<TAccount>,
69
+ ) => Promise<GetL1AllowanceReturnType>
70
+ /**
71
+ * Returns the amount of the ERC20 token the client has on specific address.
72
+ *
73
+ * - Docs: https://viem.sh/zksync/actions/getL1TokenBalance
74
+ *
75
+ * @param client - Client to use
76
+ * @param parameters - {@link GetL1TokenBalanceParameters}
77
+ * @returns The amount of the ERC20 token the client has on specific addresse. {@link GetL1TokenBalanceReturnType}
78
+ *
79
+ * @example
80
+ * import { createPublicClient, custom, parseEther } from 'viem'
81
+ * import { base, mainnet } from 'viem/chains'
82
+ * import { publicActionsL1 } from 'viem/zksync'
83
+ *
84
+ * const client = createPublicClient({
85
+ * chain: mainnet,
86
+ * transport: custom(window.ethereum),
87
+ * }).extend(publicActionsL1())
88
+ *
89
+ * const data = await client.getL1TokenBalance({
90
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
91
+ * token: '0x5C221E77624690fff6dd741493D735a17716c26B'
92
+ * })
93
+ *
94
+ * @example
95
+ * // Account Hoisting
96
+ * import { createWalletClient, http } from 'viem'
97
+ * import { privateKeyToAccount } from 'viem/accounts'
98
+ * import { base, mainnet } from 'viem/chains'
99
+ * import { publicActionsL1 } from 'viem/zksync'
100
+ *
101
+ * const client = createWalletClient({
102
+ * account: privateKeyToAccount('0x…'),
103
+ * chain: mainnet,
104
+ * transport: http(),
105
+ * }).extend(publicActionsL1())
106
+ *
107
+ * const data = await client.getL1TokenBalance({
108
+ * token: '0x5C221E77624690fff6dd741493D735a17716c26B'
109
+ * })
110
+ */
111
+ getL1TokenBalance: (
112
+ parameters: GetL1TokenBalanceParameters<TAccount>,
113
+ ) => Promise<GetL1TokenBalanceReturnType>
114
+ /**
115
+ * Returns the amount of the token held by the account on the L1 network.
116
+ *
117
+ * - Docs: https://viem.sh/zksync/actions/getL1TokenBalance
118
+ *
119
+ * @param client - Client to use
120
+ * @param parameters - {@link BalanceL1Parameters}
121
+ * @returns Returns the amount of the token held by the account on the L1 network. {@link GetL1BalanceReturnType}
122
+ *
123
+ * @example
124
+ * import { createPublicClient, custom, parseEther } from 'viem'
125
+ * import { base, mainnet } from 'viem/chains'
126
+ * import { publicActionsL1 } from 'viem/zksync'
127
+ *
128
+ * const client = createPublicClient({
129
+ * chain: mainnet,
130
+ * transport: custom(window.ethereum),
131
+ * }).extend(publicActionsL1())
132
+ *
133
+ * const data = await client.getL1Balance({
134
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'
135
+ * })
136
+ *
137
+ * const data = await client.getL1Balance({
138
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
139
+ * token: '0x5C221E77624690fff6dd741493D735a17716c26B'
140
+ * })
141
+ *
142
+ * @example
143
+ * // Account Hoisting
144
+ * import { createWalletClient, http } from 'viem'
145
+ * import { privateKeyToAccount } from 'viem/accounts'
146
+ * import { base, mainnet } from 'viem/chains'
147
+ * import { publicActionsL1 } from 'viem/zksync'
148
+ *
149
+ * const client = createWalletClient({
150
+ * account: privateKeyToAccount('0x…'),
151
+ * chain: mainnet,
152
+ * transport: http(),
153
+ * }).extend(publicActionsL1())
154
+ *
155
+ * const data = await client.getL1Balance({})
156
+ *
157
+ * const data = await client.getL1Balance({
158
+ * token: '0x5C221E77624690fff6dd741493D735a17716c26B'
159
+ * })
160
+ */
161
+ getL1Balance: (
162
+ ...parameters: TAccount extends undefined
163
+ ? [GetL1BalanceParameters<TAccount>]
164
+ : [GetL1BalanceParameters<TAccount>] | []
165
+ ) => Promise<GetL1BalanceReturnType>
166
+ }
167
+
168
+ export function publicActionsL1() {
169
+ return <
170
+ TChain extends Chain | undefined = Chain | undefined,
171
+ TAccount extends Account | undefined = Account | undefined,
172
+ >(
173
+ client: Client<Transport, TChain, TAccount>,
174
+ ): PublicActionsL1<TAccount> => ({
175
+ getL1Allowance: (args) => getL1Allowance(client, args),
176
+ getL1TokenBalance: (args) => getL1TokenBalance(client, args),
177
+ // @ts-expect-error
178
+ getL1Balance: (args) => getL1Balance(client, args),
179
+ })
180
+ }
@@ -2,7 +2,6 @@ import type { Address } from 'abitype'
2
2
  import type { Client } from '../../clients/createClient.js'
3
3
  import type { Transport } from '../../clients/transports/createTransport.js'
4
4
  import type { Account } from '../../types/account.js'
5
- import type { Hex } from '../../types/misc.js'
6
5
  import { estimateFee } from '../actions/estimateFee.js'
7
6
  import type {
8
7
  EstimateFeeParameters,
@@ -10,6 +9,7 @@ import type {
10
9
  } from '../actions/estimateFee.js'
11
10
  import {
12
11
  type EstimateGasL1ToL2Parameters,
12
+ type EstimateGasL1ToL2ReturnType,
13
13
  estimateGasL1ToL2,
14
14
  } from '../actions/estimateGasL1ToL2.js'
15
15
  import {
@@ -17,13 +17,19 @@ import {
17
17
  type GetAllBalancesReturnType,
18
18
  getAllBalances,
19
19
  } from '../actions/getAllBalances.js'
20
- import { getBaseTokenL1Address } from '../actions/getBaseTokenL1Address.js'
20
+ import {
21
+ type GetBaseTokenL1AddressReturnType,
22
+ getBaseTokenL1Address,
23
+ } from '../actions/getBaseTokenL1Address.js'
21
24
  import {
22
25
  type GetBlockDetailsParameters,
23
26
  type GetBlockDetailsReturnType,
24
27
  getBlockDetails,
25
28
  } from '../actions/getBlockDetails.js'
26
- import { getBridgehubContractAddress } from '../actions/getBridgehubContractAddress.js'
29
+ import {
30
+ type GetBridgehubContractAddressReturnType,
31
+ getBridgehubContractAddress,
32
+ } from '../actions/getBridgehubContractAddress.js'
27
33
  import {
28
34
  type GetDefaultBridgeAddressesReturnType,
29
35
  getDefaultBridgeAddresses,
@@ -38,20 +44,32 @@ import {
38
44
  type GetL1BatchDetailsReturnType,
39
45
  getL1BatchDetails,
40
46
  } from '../actions/getL1BatchDetails.js'
41
- import { getL1BatchNumber } from '../actions/getL1BatchNumber.js'
42
- import { getL1ChainId } from '../actions/getL1ChainId.js'
47
+ import {
48
+ type GetL1BatchNumberReturnType,
49
+ getL1BatchNumber,
50
+ } from '../actions/getL1BatchNumber.js'
51
+ import {
52
+ type GetL1ChainIdReturnType,
53
+ getL1ChainId,
54
+ } from '../actions/getL1ChainId.js'
43
55
  import {
44
56
  type GetLogProofParameters,
45
57
  type GetLogProofReturnType,
46
58
  getLogProof,
47
59
  } from '../actions/getLogProof.js'
48
- import { getMainContractAddress } from '../actions/getMainContractAddress.js'
49
60
  import {
50
- type GetRawBlockTransactionParameters,
51
- type GetRawBlockTransactionReturnType,
61
+ type GetMainContractAddressReturnType,
62
+ getMainContractAddress,
63
+ } from '../actions/getMainContractAddress.js'
64
+ import {
65
+ type GetRawBlockTransactionsParameters,
66
+ type GetRawBlockTransactionsReturnType,
52
67
  getRawBlockTransactions,
53
- } from '../actions/getRawBlockTransaction.js'
54
- import { getTestnetPaymasterAddress } from '../actions/getTestnetPaymasterAddress.js'
68
+ } from '../actions/getRawBlockTransactions.js'
69
+ import {
70
+ type GetTestnetPaymasterAddressReturnType,
71
+ getTestnetPaymasterAddress,
72
+ } from '../actions/getTestnetPaymasterAddress.js'
55
73
  import {
56
74
  type GetTransactionDetailsParameters,
57
75
  type GetTransactionDetailsReturnType,
@@ -99,7 +117,7 @@ export type PublicActionsL2<
99
117
  *
100
118
  * const address = await client.getTestnetPaymasterAddress();
101
119
  */
102
- getTestnetPaymasterAddress: () => Promise<Address | null>
120
+ getTestnetPaymasterAddress: () => Promise<GetTestnetPaymasterAddressReturnType>
103
121
 
104
122
  /**
105
123
  * Returns the Chain Id of underlying L1 network.
@@ -119,7 +137,7 @@ export type PublicActionsL2<
119
137
  * const chainId = await client.getL1ChainId();
120
138
  */
121
139
 
122
- getL1ChainId: () => Promise<Hex>
140
+ getL1ChainId: () => Promise<GetL1ChainIdReturnType>
123
141
 
124
142
  /**
125
143
  * Returns the address of a Main zkSync Contract.
@@ -138,7 +156,7 @@ export type PublicActionsL2<
138
156
  *
139
157
  * const address = await client.getMainContractAddress();
140
158
  */
141
- getMainContractAddress: () => Promise<Address>
159
+ getMainContractAddress: () => Promise<GetMainContractAddressReturnType>
142
160
 
143
161
  /**
144
162
  * Returns all known balances for a given account.
@@ -166,7 +184,7 @@ export type PublicActionsL2<
166
184
  * Returns data of transactions in a block.
167
185
  *
168
186
  * @returns data of transactions {@link RawBlockTransactions}
169
- * @param args - {@link GetRawBlockTransactionParameters}
187
+ * @param args - {@link GetRawBlockTransactionsParameters}
170
188
  *
171
189
  * @example
172
190
  * import { createPublicClient, http } from 'viem'
@@ -181,8 +199,8 @@ export type PublicActionsL2<
181
199
  * const rawTx = await client.getRawBlockTransaction({number: 1});
182
200
  */
183
201
  getRawBlockTransaction: (
184
- args: GetRawBlockTransactionParameters,
185
- ) => Promise<GetRawBlockTransactionReturnType>
202
+ args: GetRawBlockTransactionsParameters,
203
+ ) => Promise<GetRawBlockTransactionsReturnType>
186
204
 
187
205
  /**
188
206
  * Returns additional zkSync-specific information about the L2 block.
@@ -267,7 +285,7 @@ export type PublicActionsL2<
267
285
  *
268
286
  * const latestNumber = await client.getL1BatchNumber({number: 1});
269
287
  */
270
- getL1BatchNumber: () => Promise<Hex>
288
+ getL1BatchNumber: () => Promise<GetL1BatchNumberReturnType>
271
289
 
272
290
  /**
273
291
  * Given a transaction hash, and an index of the L2 to L1 log produced within the transaction, it returns the proof for the corresponding L2 to L1 log.
@@ -352,7 +370,7 @@ export type PublicActionsL2<
352
370
  */
353
371
  estimateGasL1ToL2: (
354
372
  args: EstimateGasL1ToL2Parameters<TChain, TAccount>,
355
- ) => Promise<bigint>
373
+ ) => Promise<EstimateGasL1ToL2ReturnType>
356
374
 
357
375
  /**
358
376
  * Returns the Bridgehub smart contract address.
@@ -372,7 +390,7 @@ export type PublicActionsL2<
372
390
  *
373
391
  * const address = await client.getBridgehubContractAddress();
374
392
  */
375
- getBridgehubContractAddress: () => Promise<Address>
393
+ getBridgehubContractAddress: () => Promise<GetBridgehubContractAddressReturnType>
376
394
 
377
395
  /**
378
396
  * Returns the address of the base L1 token.
@@ -392,7 +410,7 @@ export type PublicActionsL2<
392
410
  *
393
411
  * const address = await client.getBaseTokenL1Address();
394
412
  */
395
- getBaseTokenL1Address: () => Promise<Address>
413
+ getBaseTokenL1Address: () => Promise<GetBaseTokenL1AddressReturnType>
396
414
  }
397
415
 
398
416
  export function publicActionsL2() {
@@ -0,0 +1,16 @@
1
+ import { BaseError } from '../../errors/base.js'
2
+
3
+ export type TokenIsEthErrorType = TokenIsEthError & {
4
+ name: 'TokenIsEthError'
5
+ }
6
+ export class TokenIsEthError extends BaseError {
7
+ override name = 'TokenIsEthError'
8
+
9
+ constructor() {
10
+ super(
11
+ ['Token is an ETH token.', '', 'ETH token cannot be retrived.'].join(
12
+ '\n',
13
+ ),
14
+ )
15
+ }
16
+ }
package/zksync/index.ts CHANGED
@@ -24,6 +24,18 @@ export {
24
24
  getDefaultBridgeAddresses,
25
25
  } from './actions/getDefaultBridgeAddresses.js'
26
26
  export { getBridgehubContractAddress } from './actions/getBridgehubContractAddress.js'
27
+ export {
28
+ type GetL1AllowanceErrorType,
29
+ type GetL1AllowanceParameters,
30
+ type GetL1AllowanceReturnType,
31
+ getL1Allowance,
32
+ } from './actions/getL1Allowance.js'
33
+ export {
34
+ type GetL1BalanceErrorType,
35
+ type GetL1BalanceParameters,
36
+ type GetL1BalanceReturnType,
37
+ getL1Balance,
38
+ } from './actions/getL1Balance.js'
27
39
  export {
28
40
  type GetL1BatchBlockRangeParameters,
29
41
  type GetL1BatchBlockRangeReturnParameters,
@@ -36,6 +48,12 @@ export {
36
48
  } from './actions/getL1BatchDetails.js'
37
49
  export { getL1BatchNumber } from './actions/getL1BatchNumber.js'
38
50
  export { getL1ChainId } from './actions/getL1ChainId.js'
51
+ export {
52
+ type GetL1TokenBalanceErrorType,
53
+ type GetL1TokenBalanceParameters,
54
+ type GetL1TokenBalanceReturnType,
55
+ getL1TokenBalance,
56
+ } from './actions/getL1TokenBalance.js'
39
57
  export {
40
58
  type GetLogProofReturnType,
41
59
  type GetLogProofParameters,
@@ -43,10 +61,10 @@ export {
43
61
  } from './actions/getLogProof.js'
44
62
  export { getMainContractAddress } from './actions/getMainContractAddress.js'
45
63
  export {
46
- type GetRawBlockTransactionParameters,
47
- type GetRawBlockTransactionReturnType,
64
+ type GetRawBlockTransactionsParameters,
65
+ type GetRawBlockTransactionsReturnType,
48
66
  getRawBlockTransactions,
49
- } from './actions/getRawBlockTransaction.js'
67
+ } from './actions/getRawBlockTransactions.js'
50
68
  export { getTestnetPaymasterAddress } from './actions/getTestnetPaymasterAddress.js'
51
69
  export {
52
70
  type GetTransactionDetailsParameters,
@@ -91,13 +109,18 @@ export {
91
109
  type Eip712WalletActions,
92
110
  } from './decorators/eip712.js'
93
111
 
94
- export { serializeTransaction } from './serializers.js'
112
+ export {
113
+ publicActionsL1,
114
+ type PublicActionsL1,
115
+ } from './decorators/publicL1.js'
95
116
 
96
117
  export {
97
118
  publicActionsL2,
98
119
  type PublicActionsL2,
99
120
  } from './decorators/publicL2.js'
100
121
 
122
+ export { serializeTransaction } from './serializers.js'
123
+
101
124
  export type {
102
125
  ZkSyncBlock,
103
126
  ZkSyncBlockOverrides,
@@ -0,0 +1,20 @@
1
+ import type { Address } from '../../accounts/index.js'
2
+ import {
3
+ ethAddressInContracts,
4
+ l2BaseTokenAddress,
5
+ legacyEthAddress,
6
+ } from '../constants/address.js'
7
+
8
+ export function isEth(token: Address) {
9
+ return (
10
+ token.localeCompare(legacyEthAddress, undefined, {
11
+ sensitivity: 'accent',
12
+ }) === 0 ||
13
+ token.localeCompare(l2BaseTokenAddress, undefined, {
14
+ sensitivity: 'accent',
15
+ }) === 0 ||
16
+ token.localeCompare(ethAddressInContracts, undefined, {
17
+ sensitivity: 'accent',
18
+ }) === 0
19
+ )
20
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRawBlockTransaction.js","sourceRoot":"","sources":["../../../zksync/actions/getRawBlockTransaction.ts"],"names":[],"mappings":";;;AAOA,gEAAyD;AAMlD,KAAK,UAAU,uBAAuB,CAI3C,MAAkE,EAClE,UAA4C;IAE5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,6BAA6B;QACrC,MAAM,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;KAC5B,CAAC,CAAA;IACF,OAAO,IAAA,gCAAa,EAAC,MAAM,CAAqC,CAAA;AAClE,CAAC;AAZD,0DAYC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRawBlockTransaction.js","sourceRoot":"","sources":["../../../zksync/actions/getRawBlockTransaction.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAMzD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAI3C,MAAkE,EAClE,UAA4C;IAE5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,6BAA6B;QACrC,MAAM,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;KAC5B,CAAC,CAAA;IACF,OAAO,aAAa,CAAC,MAAM,CAAqC,CAAA;AAClE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRawBlockTransaction.d.ts","sourceRoot":"","sources":["../../../zksync/actions/getRawBlockTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAGzE,MAAM,MAAM,gCAAgC,GAAG,qBAAqB,CAAA;AAEpE,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,CAAA;AAEzE,wBAAsB,uBAAuB,CAC3C,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,EAEpC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,CAAC,EAClE,UAAU,EAAE,gCAAgC,GAC3C,OAAO,CAAC,gCAAgC,CAAC,CAM3C"}