viem 2.33.0 → 2.33.2
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 +24 -0
- package/_cjs/account-abstraction/index.js +3 -1
- package/_cjs/account-abstraction/index.js.map +1 -1
- package/_cjs/account-abstraction/utils/userOperation/toUserOperation.js +6 -0
- package/_cjs/account-abstraction/utils/userOperation/toUserOperation.js.map +1 -0
- package/_cjs/actions/wallet/waitForCallsStatus.js +12 -2
- package/_cjs/actions/wallet/waitForCallsStatus.js.map +1 -1
- package/_cjs/chains/definitions/arbitrum.js +1 -0
- package/_cjs/chains/definitions/arbitrum.js.map +1 -1
- package/_cjs/chains/definitions/arbitrumSepolia.js +1 -0
- package/_cjs/chains/definitions/arbitrumSepolia.js.map +1 -1
- package/_cjs/chains/definitions/areum.js +29 -0
- package/_cjs/chains/definitions/areum.js.map +1 -0
- package/_cjs/chains/definitions/celoSepolia.js +55 -0
- package/_cjs/chains/definitions/celoSepolia.js.map +1 -0
- package/_cjs/chains/definitions/reddio.js +29 -0
- package/_cjs/chains/definitions/reddio.js.map +1 -0
- package/_cjs/chains/index.js +19 -13
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/calls.js +20 -0
- package/_cjs/errors/calls.js.map +1 -0
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +8 -6
- package/_cjs/index.js.map +1 -1
- package/_cjs/op-stack/abis.js +62 -1
- package/_cjs/op-stack/abis.js.map +1 -1
- package/_cjs/op-stack/actions/getWithdrawalStatus.js +59 -1
- package/_cjs/op-stack/actions/getWithdrawalStatus.js.map +1 -1
- package/_cjs/zksync/actions/getAllBalances.js.map +1 -1
- package/_cjs/zksync/actions/getBaseTokenL1Address.js.map +1 -1
- package/_cjs/zksync/actions/getGasPerPubdata.js +13 -0
- package/_cjs/zksync/actions/getGasPerPubdata.js.map +1 -0
- package/_cjs/zksync/actions/getL1ChainId.js.map +1 -1
- package/_cjs/zksync/actions/getMainContractAddress.js.map +1 -1
- package/_cjs/zksync/actions/getRawBlockTransactions.js.map +1 -1
- package/_cjs/zksync/actions/getTestnetPaymasterAddress.js.map +1 -1
- package/_cjs/zksync/decorators/publicL2.js +2 -0
- package/_cjs/zksync/decorators/publicL2.js.map +1 -1
- package/_cjs/zksync/index.js +4 -2
- package/_cjs/zksync/index.js.map +1 -1
- package/_esm/account-abstraction/index.js +1 -0
- package/_esm/account-abstraction/index.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/toUserOperation.js +3 -0
- package/_esm/account-abstraction/utils/userOperation/toUserOperation.js.map +1 -0
- package/_esm/actions/wallet/waitForCallsStatus.js +13 -2
- package/_esm/actions/wallet/waitForCallsStatus.js.map +1 -1
- package/_esm/chains/definitions/arbitrum.js +1 -0
- package/_esm/chains/definitions/arbitrum.js.map +1 -1
- package/_esm/chains/definitions/arbitrumSepolia.js +1 -0
- package/_esm/chains/definitions/arbitrumSepolia.js.map +1 -1
- package/_esm/chains/definitions/areum.js +26 -0
- package/_esm/chains/definitions/areum.js.map +1 -0
- package/_esm/chains/definitions/celoSepolia.js +53 -0
- package/_esm/chains/definitions/celoSepolia.js.map +1 -0
- package/_esm/chains/definitions/reddio.js +26 -0
- package/_esm/chains/definitions/reddio.js.map +1 -0
- package/_esm/chains/index.js +3 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/calls.js +16 -0
- package/_esm/errors/calls.js.map +1 -0
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/op-stack/abis.js +61 -0
- package/_esm/op-stack/abis.js.map +1 -1
- package/_esm/op-stack/actions/getWithdrawalStatus.js +78 -2
- package/_esm/op-stack/actions/getWithdrawalStatus.js.map +1 -1
- package/_esm/zksync/actions/estimateFee.js +1 -0
- package/_esm/zksync/actions/estimateFee.js.map +1 -1
- package/_esm/zksync/actions/getAllBalances.js +1 -0
- package/_esm/zksync/actions/getAllBalances.js.map +1 -1
- package/_esm/zksync/actions/getBaseTokenL1Address.js +1 -0
- package/_esm/zksync/actions/getBaseTokenL1Address.js.map +1 -1
- package/_esm/zksync/actions/getGasPerPubdata.js +10 -0
- package/_esm/zksync/actions/getGasPerPubdata.js.map +1 -0
- package/_esm/zksync/actions/getL1ChainId.js +1 -0
- package/_esm/zksync/actions/getL1ChainId.js.map +1 -1
- package/_esm/zksync/actions/getMainContractAddress.js +1 -0
- package/_esm/zksync/actions/getMainContractAddress.js.map +1 -1
- package/_esm/zksync/actions/getRawBlockTransactions.js +1 -0
- package/_esm/zksync/actions/getRawBlockTransactions.js.map +1 -1
- package/_esm/zksync/actions/getTestnetPaymasterAddress.js +1 -0
- package/_esm/zksync/actions/getTestnetPaymasterAddress.js.map +1 -1
- package/_esm/zksync/decorators/publicL2.js +2 -0
- package/_esm/zksync/decorators/publicL2.js.map +1 -1
- package/_esm/zksync/index.js +1 -0
- package/_esm/zksync/index.js.map +1 -1
- package/_types/account-abstraction/index.d.ts +1 -0
- package/_types/account-abstraction/index.d.ts.map +1 -1
- package/_types/account-abstraction/utils/userOperation/toUserOperation.d.ts +3 -0
- package/_types/account-abstraction/utils/userOperation/toUserOperation.d.ts.map +1 -0
- package/_types/actions/wallet/waitForCallsStatus.d.ts +17 -0
- package/_types/actions/wallet/waitForCallsStatus.d.ts.map +1 -1
- package/_types/chains/definitions/arbitrum.d.ts +1 -1
- package/_types/chains/definitions/arbitrum.d.ts.map +1 -1
- package/_types/chains/definitions/arbitrumSepolia.d.ts +1 -1
- package/_types/chains/definitions/arbitrumSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/areum.d.ts +37 -0
- package/_types/chains/definitions/areum.d.ts.map +1 -0
- package/_types/chains/definitions/celoSepolia.d.ts +887 -0
- package/_types/chains/definitions/celoSepolia.d.ts.map +1 -0
- package/_types/chains/definitions/reddio.d.ts +37 -0
- package/_types/chains/definitions/reddio.d.ts.map +1 -0
- package/_types/chains/index.d.ts +3 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/calls.d.ts +10 -0
- package/_types/errors/calls.d.ts.map +1 -0
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/abis.d.ts +45 -0
- package/_types/op-stack/abis.d.ts.map +1 -1
- package/_types/op-stack/actions/getWithdrawalStatus.d.ts.map +1 -1
- package/_types/zksync/actions/getAllBalances.d.ts.map +1 -1
- package/_types/zksync/actions/getBaseTokenL1Address.d.ts.map +1 -1
- package/_types/zksync/actions/getGasPerPubdata.d.ts +8 -0
- package/_types/zksync/actions/getGasPerPubdata.d.ts.map +1 -0
- package/_types/zksync/actions/getL1ChainId.d.ts.map +1 -1
- package/_types/zksync/actions/getMainContractAddress.d.ts.map +1 -1
- package/_types/zksync/actions/getRawBlockTransactions.d.ts.map +1 -1
- package/_types/zksync/actions/getTestnetPaymasterAddress.d.ts.map +1 -1
- package/_types/zksync/decorators/publicL2.d.ts +21 -0
- package/_types/zksync/decorators/publicL2.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/eip1193.d.ts +5 -0
- package/_types/zksync/types/eip1193.d.ts.map +1 -1
- package/account-abstraction/index.ts +1 -0
- package/account-abstraction/utils/userOperation/toUserOperation.ts +3 -0
- package/actions/wallet/waitForCallsStatus.ts +37 -2
- package/chains/definitions/arbitrum.ts +1 -0
- package/chains/definitions/arbitrumSepolia.ts +1 -0
- package/chains/definitions/areum.ts +26 -0
- package/chains/definitions/celoSepolia.ts +53 -0
- package/chains/definitions/reddio.ts +26 -0
- package/chains/index.ts +3 -0
- package/errors/calls.ts +17 -0
- package/errors/version.ts +1 -1
- package/index.ts +4 -0
- package/op-stack/abis.ts +62 -0
- package/op-stack/actions/getWithdrawalStatus.ts +117 -21
- package/package.json +9 -3
- package/zksync/actions/estimateFee.ts +1 -1
- package/zksync/actions/getAllBalances.ts +1 -0
- package/zksync/actions/getBaseTokenL1Address.ts +1 -0
- package/zksync/actions/getGasPerPubdata.ts +26 -0
- package/zksync/actions/getL1ChainId.ts +1 -0
- package/zksync/actions/getMainContractAddress.ts +1 -0
- package/zksync/actions/getRawBlockTransactions.ts +1 -0
- package/zksync/actions/getTestnetPaymasterAddress.ts +1 -0
- package/zksync/decorators/publicL2.ts +26 -0
- package/zksync/index.ts +4 -0
- package/zksync/types/eip1193.ts +5 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
import type { Client } from '../../clients/createClient.js'
|
2
|
+
import type { Transport } from '../../clients/transports/createTransport.js'
|
3
|
+
import type { Account } from '../../types/account.js'
|
4
|
+
import { hexToBigInt } from '../../utils/encoding/fromHex.js'
|
5
|
+
import type { ChainEIP712 } from '../types/chain.js'
|
6
|
+
import type { PublicZksyncRpcSchema } from '../types/eip1193.js'
|
7
|
+
|
8
|
+
export type GetGasPerPubdataReturnType = bigint
|
9
|
+
|
10
|
+
export async function getGasPerPubdata<
|
11
|
+
chain extends ChainEIP712 | undefined,
|
12
|
+
account extends Account | undefined,
|
13
|
+
>(
|
14
|
+
client: Client<Transport, chain, account, PublicZksyncRpcSchema>,
|
15
|
+
): Promise<GetGasPerPubdataReturnType> {
|
16
|
+
const result = await client.request(
|
17
|
+
{
|
18
|
+
method: 'zks_gasPerPubdata',
|
19
|
+
},
|
20
|
+
{
|
21
|
+
dedupe: true,
|
22
|
+
},
|
23
|
+
)
|
24
|
+
|
25
|
+
return hexToBigInt(result)
|
26
|
+
}
|
@@ -7,6 +7,7 @@ import type { PublicZksyncRpcSchema } from '../types/eip1193.js'
|
|
7
7
|
|
8
8
|
export type GetL1ChainIdReturnType = Hex
|
9
9
|
|
10
|
+
/* @deprecated Use the `L1_CHAIN_ID()` method on the `L2AssetRouter` contract (deployed on `0x0000000000000000000000000000000000010003` address) */
|
10
11
|
export async function getL1ChainId<
|
11
12
|
chain extends Chain | undefined,
|
12
13
|
account extends Account | undefined,
|
@@ -7,6 +7,7 @@ import type { PublicZksyncRpcSchema } from '../types/eip1193.js'
|
|
7
7
|
|
8
8
|
export type GetMainContractAddressReturnType = Address
|
9
9
|
|
10
|
+
/* @deprecated Use `getBridgeHubContractAddress` and call `getZKChain(chainId)` instead. */
|
10
11
|
export async function getMainContractAddress<
|
11
12
|
chain extends Chain | undefined,
|
12
13
|
account extends Account | undefined,
|
@@ -11,6 +11,7 @@ export type GetRawBlockTransactionsParameters = ZksyncNumberParameter
|
|
11
11
|
|
12
12
|
export type GetRawBlockTransactionsReturnType = ZksyncRawBlockTransactions
|
13
13
|
|
14
|
+
/* @deprecated Use `debug_getRawTransaction` and `debug_getRawTransactions` instead. */
|
14
15
|
export async function getRawBlockTransactions<
|
15
16
|
chain extends Chain | undefined,
|
16
17
|
account extends Account | undefined,
|
@@ -7,6 +7,7 @@ import type { PublicZksyncRpcSchema } from '../types/eip1193.js'
|
|
7
7
|
|
8
8
|
export type GetTestnetPaymasterAddressReturnType = Address | null
|
9
9
|
|
10
|
+
/* @deprecated Check the corresponding ZKsync chain technical documentation to find the testnet paymaster address */
|
10
11
|
export async function getTestnetPaymasterAddress<
|
11
12
|
chain extends Chain | undefined,
|
12
13
|
account extends Account | undefined,
|
@@ -34,6 +34,10 @@ import {
|
|
34
34
|
type GetDefaultBridgeAddressesReturnType,
|
35
35
|
getDefaultBridgeAddresses,
|
36
36
|
} from '../actions/getDefaultBridgeAddresses.js'
|
37
|
+
import {
|
38
|
+
type GetGasPerPubdataReturnType,
|
39
|
+
getGasPerPubdata,
|
40
|
+
} from '../actions/getGasPerPubdata.js'
|
37
41
|
import {
|
38
42
|
type GetL1BatchBlockRangeParameters,
|
39
43
|
type GetL1BatchBlockRangeReturnParameters,
|
@@ -169,6 +173,8 @@ export type PublicActionsL2<
|
|
169
173
|
getMainContractAddress: () => Promise<GetMainContractAddressReturnType>
|
170
174
|
|
171
175
|
/**
|
176
|
+
* @deprecated This method has been removed from the node API.
|
177
|
+
*
|
172
178
|
* Returns all known balances for a given account.
|
173
179
|
*
|
174
180
|
* @returns The balances for a given account. {@link GetAllBalancesReturnType}
|
@@ -471,6 +477,25 @@ export type PublicActionsL2<
|
|
471
477
|
getL1TokenAddress: (
|
472
478
|
args: GetL1TokenAddressParameters,
|
473
479
|
) => Promise<GetL1TokenAddressReturnType>
|
480
|
+
|
481
|
+
/**
|
482
|
+
* Returns the scaled gas per pubdata limit for the currently open batch. Available since node version 28.7.0.
|
483
|
+
*
|
484
|
+
* @returns the scaled gas per pubdata limit for the currently open batch
|
485
|
+
*
|
486
|
+
* @example
|
487
|
+
* import { createPublicClient, http } from 'viem'
|
488
|
+
* import { zksyncLocalNode } from 'viem/chains'
|
489
|
+
* import { publicActionsL2 } from 'viem/zksync'
|
490
|
+
*
|
491
|
+
* const client = createPublicClient({
|
492
|
+
* chain: zksyncLocalNode,
|
493
|
+
* transport: http(),
|
494
|
+
* }).extend(publicActionsL2())
|
495
|
+
*
|
496
|
+
* const gasPerPubdata = await client.getGasPerPubdata();
|
497
|
+
*/
|
498
|
+
getGasPerPubdata: () => Promise<GetGasPerPubdataReturnType>
|
474
499
|
}
|
475
500
|
|
476
501
|
export function publicActionsL2() {
|
@@ -500,6 +525,7 @@ export function publicActionsL2() {
|
|
500
525
|
getBaseTokenL1Address: () => getBaseTokenL1Address(client),
|
501
526
|
getL2TokenAddress: (args) => getL2TokenAddress(client, args),
|
502
527
|
getL1TokenAddress: (args) => getL1TokenAddress(client, args),
|
528
|
+
getGasPerPubdata: () => getGasPerPubdata(client),
|
503
529
|
}
|
504
530
|
}
|
505
531
|
}
|
package/zksync/index.ts
CHANGED
@@ -60,6 +60,10 @@ export {
|
|
60
60
|
getDefaultBridgeAddresses,
|
61
61
|
} from './actions/getDefaultBridgeAddresses.js'
|
62
62
|
export { getBridgehubContractAddress } from './actions/getBridgehubContractAddress.js'
|
63
|
+
export {
|
64
|
+
type GetGasPerPubdataReturnType,
|
65
|
+
getGasPerPubdata,
|
66
|
+
} from './actions/getGasPerPubdata.js'
|
63
67
|
export {
|
64
68
|
type GetL1AllowanceErrorType,
|
65
69
|
type GetL1AllowanceParameters,
|