viem 2.10.11 → 2.11.0
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 +10 -0
- package/_cjs/celo/formatters.js +1 -10
- package/_cjs/celo/formatters.js.map +1 -1
- package/_cjs/celo/serializers.js +0 -25
- package/_cjs/celo/serializers.js.map +1 -1
- package/_cjs/celo/utils.js +2 -15
- package/_cjs/celo/utils.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/errors/version.js.map +1 -1
- package/_cjs/zksync/actions/estimateFee.js +26 -0
- package/_cjs/zksync/actions/estimateFee.js.map +1 -0
- package/_cjs/zksync/actions/estimateGasL1ToL2.js +20 -0
- package/_cjs/zksync/actions/estimateGasL1ToL2.js.map +1 -0
- package/_cjs/zksync/actions/getAllBalances.js +19 -0
- package/_cjs/zksync/actions/getAllBalances.js.map +1 -0
- package/_cjs/zksync/actions/getBaseTokenL1Address.js +9 -0
- package/_cjs/zksync/actions/getBaseTokenL1Address.js.map +1 -0
- package/_cjs/zksync/actions/getBlockDetails.js +12 -0
- package/_cjs/zksync/actions/getBlockDetails.js.map +1 -0
- package/_cjs/zksync/actions/getBridgehubContractAddress.js +9 -0
- package/_cjs/zksync/actions/getBridgehubContractAddress.js.map +1 -0
- package/_cjs/zksync/actions/getDefaultBridgeAddresses.js +13 -0
- package/_cjs/zksync/actions/getDefaultBridgeAddresses.js.map +1 -0
- package/_cjs/zksync/actions/getL1Allowance.js +19 -0
- package/_cjs/zksync/actions/getL1Allowance.js.map +1 -0
- package/_cjs/zksync/actions/getL1Balance.js +23 -0
- package/_cjs/zksync/actions/getL1Balance.js.map +1 -0
- package/_cjs/zksync/actions/getL1BatchBlockRange.js +13 -0
- package/_cjs/zksync/actions/getL1BatchBlockRange.js.map +1 -0
- package/_cjs/zksync/actions/getL1BatchDetails.js +12 -0
- package/_cjs/zksync/actions/getL1BatchDetails.js.map +1 -0
- package/_cjs/zksync/actions/getL1BatchNumber.js +9 -0
- package/_cjs/zksync/actions/getL1BatchNumber.js.map +1 -0
- package/_cjs/zksync/actions/getL1ChainId.js +9 -0
- package/_cjs/zksync/actions/getL1ChainId.js.map +1 -0
- package/_cjs/zksync/actions/getL1TokenBalance.js +24 -0
- package/_cjs/zksync/actions/getL1TokenBalance.js.map +1 -0
- package/_cjs/zksync/actions/getLogProof.js +12 -0
- package/_cjs/zksync/actions/getLogProof.js.map +1 -0
- package/_cjs/zksync/actions/getMainContractAddress.js +9 -0
- package/_cjs/zksync/actions/getMainContractAddress.js.map +1 -0
- package/_cjs/zksync/actions/getRawBlockTransactions.js +13 -0
- package/_cjs/zksync/actions/getRawBlockTransactions.js.map +1 -0
- package/_cjs/zksync/actions/getTestnetPaymasterAddress.js +9 -0
- package/_cjs/zksync/actions/getTestnetPaymasterAddress.js.map +1 -0
- package/_cjs/zksync/actions/getTransactionDetails.js +12 -0
- package/_cjs/zksync/actions/getTransactionDetails.js.map +1 -0
- package/_cjs/zksync/constants/address.js +4 -1
- package/_cjs/zksync/constants/address.js.map +1 -1
- package/_cjs/zksync/decorators/publicL1.js +15 -0
- package/_cjs/zksync/decorators/publicL1.js.map +1 -0
- package/_cjs/zksync/decorators/publicL2.js +43 -0
- package/_cjs/zksync/decorators/publicL2.js.map +1 -0
- package/_cjs/zksync/errors/token-is-eth.js +17 -0
- package/_cjs/zksync/errors/token-is-eth.js.map +1 -0
- package/_cjs/zksync/index.js +41 -3
- package/_cjs/zksync/index.js.map +1 -1
- package/_cjs/zksync/types/eip1193.js +3 -0
- package/_cjs/zksync/types/eip1193.js.map +1 -0
- package/_cjs/zksync/types/proof.js +3 -0
- package/_cjs/zksync/types/proof.js.map +1 -0
- package/_cjs/zksync/utils/camelCaseKeys.js +17 -0
- package/_cjs/zksync/utils/camelCaseKeys.js.map +1 -0
- package/_cjs/zksync/utils/isEth.js +17 -0
- package/_cjs/zksync/utils/isEth.js.map +1 -0
- package/_cjs/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js +4 -3
- package/_cjs/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js.map +1 -1
- package/_cjs/zksync/utils/paymaster/getGeneralPaymasterInput.js +4 -3
- package/_cjs/zksync/utils/paymaster/getGeneralPaymasterInput.js.map +1 -1
- package/_esm/celo/formatters.js +2 -11
- package/_esm/celo/formatters.js.map +1 -1
- package/_esm/celo/serializers.js +1 -29
- package/_esm/celo/serializers.js.map +1 -1
- package/_esm/celo/utils.js +1 -15
- package/_esm/celo/utils.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/errors/version.js.map +1 -1
- package/_esm/zksync/actions/estimateFee.js +22 -0
- package/_esm/zksync/actions/estimateFee.js.map +1 -0
- package/_esm/zksync/actions/estimateGasL1ToL2.js +16 -0
- package/_esm/zksync/actions/estimateGasL1ToL2.js.map +1 -0
- package/_esm/zksync/actions/getAllBalances.js +15 -0
- package/_esm/zksync/actions/getAllBalances.js.map +1 -0
- package/_esm/zksync/actions/getBaseTokenL1Address.js +5 -0
- package/_esm/zksync/actions/getBaseTokenL1Address.js.map +1 -0
- package/_esm/zksync/actions/getBlockDetails.js +8 -0
- package/_esm/zksync/actions/getBlockDetails.js.map +1 -0
- package/_esm/zksync/actions/getBridgehubContractAddress.js +5 -0
- package/_esm/zksync/actions/getBridgehubContractAddress.js.map +1 -0
- package/_esm/zksync/actions/getDefaultBridgeAddresses.js +9 -0
- package/_esm/zksync/actions/getDefaultBridgeAddresses.js.map +1 -0
- package/_esm/zksync/actions/getL1Allowance.js +15 -0
- package/_esm/zksync/actions/getL1Allowance.js.map +1 -0
- package/_esm/zksync/actions/getL1Balance.js +19 -0
- package/_esm/zksync/actions/getL1Balance.js.map +1 -0
- package/_esm/zksync/actions/getL1BatchBlockRange.js +9 -0
- package/_esm/zksync/actions/getL1BatchBlockRange.js.map +1 -0
- package/_esm/zksync/actions/getL1BatchDetails.js +8 -0
- package/_esm/zksync/actions/getL1BatchDetails.js.map +1 -0
- package/_esm/zksync/actions/getL1BatchNumber.js +5 -0
- package/_esm/zksync/actions/getL1BatchNumber.js.map +1 -0
- package/_esm/zksync/actions/getL1ChainId.js +5 -0
- package/_esm/zksync/actions/getL1ChainId.js.map +1 -0
- package/_esm/zksync/actions/getL1TokenBalance.js +20 -0
- package/_esm/zksync/actions/getL1TokenBalance.js.map +1 -0
- package/_esm/zksync/actions/getLogProof.js +8 -0
- package/_esm/zksync/actions/getLogProof.js.map +1 -0
- package/_esm/zksync/actions/getMainContractAddress.js +5 -0
- package/_esm/zksync/actions/getMainContractAddress.js.map +1 -0
- package/_esm/zksync/actions/getRawBlockTransactions.js +9 -0
- package/_esm/zksync/actions/getRawBlockTransactions.js.map +1 -0
- package/_esm/zksync/actions/getTestnetPaymasterAddress.js +5 -0
- package/_esm/zksync/actions/getTestnetPaymasterAddress.js.map +1 -0
- package/_esm/zksync/actions/getTransactionDetails.js +8 -0
- package/_esm/zksync/actions/getTransactionDetails.js.map +1 -0
- package/_esm/zksync/constants/address.js +3 -0
- package/_esm/zksync/constants/address.js.map +1 -1
- package/_esm/zksync/decorators/publicL1.js +12 -0
- package/_esm/zksync/decorators/publicL1.js.map +1 -0
- package/_esm/zksync/decorators/publicL2.js +39 -0
- package/_esm/zksync/decorators/publicL2.js.map +1 -0
- package/_esm/zksync/errors/token-is-eth.js +13 -0
- package/_esm/zksync/errors/token-is-eth.js.map +1 -0
- package/_esm/zksync/index.js +20 -1
- package/_esm/zksync/index.js.map +1 -1
- package/_esm/zksync/types/eip1193.js +2 -0
- package/_esm/zksync/types/eip1193.js.map +1 -0
- package/_esm/zksync/types/proof.js +2 -0
- package/_esm/zksync/types/proof.js.map +1 -0
- package/_esm/zksync/utils/camelCaseKeys.js +13 -0
- package/_esm/zksync/utils/camelCaseKeys.js.map +1 -0
- package/_esm/zksync/utils/isEth.js +13 -0
- package/_esm/zksync/utils/isEth.js.map +1 -0
- package/_esm/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js +2 -1
- package/_esm/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js.map +1 -1
- package/_esm/zksync/utils/paymaster/getGeneralPaymasterInput.js +2 -1
- package/_esm/zksync/utils/paymaster/getGeneralPaymasterInput.js.map +1 -1
- package/_types/celo/chainConfig.d.ts +58 -526
- package/_types/celo/chainConfig.d.ts.map +1 -1
- package/_types/celo/formatters.d.ts +29 -263
- package/_types/celo/formatters.d.ts.map +1 -1
- package/_types/celo/index.d.ts +1 -1
- package/_types/celo/index.d.ts.map +1 -1
- package/_types/celo/serializers.d.ts +2 -3
- package/_types/celo/serializers.d.ts.map +1 -1
- package/_types/celo/types.d.ts +5 -29
- package/_types/celo/types.d.ts.map +1 -1
- package/_types/celo/utils.d.ts +1 -2
- package/_types/celo/utils.d.ts.map +1 -1
- package/_types/chains/definitions/celo.d.ts +58 -526
- package/_types/chains/definitions/celo.d.ts.map +1 -1
- package/_types/chains/definitions/celoAlfajores.d.ts +58 -526
- package/_types/chains/definitions/celoAlfajores.d.ts.map +1 -1
- package/_types/chains/definitions/lisk.d.ts +8 -8
- package/_types/chains/definitions/playfiAlbireo.d.ts +8 -8
- package/_types/chains/definitions/zkSync.d.ts +8 -8
- package/_types/chains/definitions/zkSyncInMemoryNode.d.ts +8 -8
- package/_types/chains/definitions/zkSyncLocalNode.d.ts +8 -8
- package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts +8 -8
- package/_types/chains/definitions/zkSyncTestnet.d.ts +8 -8
- package/_types/chains/index.d.ts +1 -1
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/errors/version.d.ts.map +1 -1
- package/_types/zksync/actions/estimateFee.d.ts +11 -0
- package/_types/zksync/actions/estimateFee.d.ts.map +1 -0
- package/_types/zksync/actions/estimateGasL1ToL2.d.ts +10 -0
- package/_types/zksync/actions/estimateGasL1ToL2.d.ts.map +1 -0
- package/_types/zksync/actions/getAllBalances.d.ts +12 -0
- package/_types/zksync/actions/getAllBalances.d.ts.map +1 -0
- package/_types/zksync/actions/getBaseTokenL1Address.d.ts +9 -0
- package/_types/zksync/actions/getBaseTokenL1Address.d.ts.map +1 -0
- package/_types/zksync/actions/getBlockDetails.d.ts +10 -0
- package/_types/zksync/actions/getBlockDetails.d.ts.map +1 -0
- package/_types/zksync/actions/getBridgehubContractAddress.d.ts +9 -0
- package/_types/zksync/actions/getBridgehubContractAddress.d.ts.map +1 -0
- package/_types/zksync/actions/getDefaultBridgeAddresses.d.ts +9 -0
- package/_types/zksync/actions/getDefaultBridgeAddresses.d.ts.map +1 -0
- package/_types/zksync/actions/getL1Allowance.d.ts +17 -0
- package/_types/zksync/actions/getL1Allowance.d.ts.map +1 -0
- package/_types/zksync/actions/getL1Balance.d.ts +23 -0
- package/_types/zksync/actions/getL1Balance.d.ts.map +1 -0
- package/_types/zksync/actions/getL1BatchBlockRange.d.ts +11 -0
- package/_types/zksync/actions/getL1BatchBlockRange.d.ts.map +1 -0
- package/_types/zksync/actions/getL1BatchDetails.d.ts +10 -0
- package/_types/zksync/actions/getL1BatchDetails.d.ts.map +1 -0
- package/_types/zksync/actions/getL1BatchNumber.d.ts +9 -0
- package/_types/zksync/actions/getL1BatchNumber.d.ts.map +1 -0
- package/_types/zksync/actions/getL1ChainId.d.ts +9 -0
- package/_types/zksync/actions/getL1ChainId.d.ts.map +1 -0
- package/_types/zksync/actions/getL1TokenBalance.d.ts +24 -0
- package/_types/zksync/actions/getL1TokenBalance.d.ts.map +1 -0
- package/_types/zksync/actions/getLogProof.d.ts +14 -0
- package/_types/zksync/actions/getLogProof.d.ts.map +1 -0
- package/_types/zksync/actions/getMainContractAddress.d.ts +9 -0
- package/_types/zksync/actions/getMainContractAddress.d.ts.map +1 -0
- package/_types/zksync/actions/getRawBlockTransactions.d.ts +11 -0
- package/_types/zksync/actions/getRawBlockTransactions.d.ts.map +1 -0
- package/_types/zksync/actions/getTestnetPaymasterAddress.d.ts +9 -0
- package/_types/zksync/actions/getTestnetPaymasterAddress.d.ts.map +1 -0
- package/_types/zksync/actions/getTransactionDetails.d.ts +13 -0
- package/_types/zksync/actions/getTransactionDetails.d.ts.map +1 -0
- package/_types/zksync/chainConfig.d.ts +8 -8
- package/_types/zksync/constants/address.d.ts +3 -0
- package/_types/zksync/constants/address.d.ts.map +1 -1
- package/_types/zksync/decorators/publicL1.d.ts +145 -0
- package/_types/zksync/decorators/publicL1.d.ts.map +1 -0
- package/_types/zksync/decorators/publicL2.d.ts +322 -0
- package/_types/zksync/decorators/publicL2.d.ts.map +1 -0
- package/_types/zksync/errors/token-is-eth.d.ts +9 -0
- package/_types/zksync/errors/token-is-eth.d.ts.map +1 -0
- package/_types/zksync/formatters.d.ts +8 -8
- package/_types/zksync/index.d.ts +21 -2
- package/_types/zksync/index.d.ts.map +1 -1
- package/_types/zksync/types/block.d.ts +30 -1
- package/_types/zksync/types/block.d.ts.map +1 -1
- package/_types/zksync/types/contract.d.ts +6 -0
- package/_types/zksync/types/contract.d.ts.map +1 -1
- package/_types/zksync/types/eip1193.d.ts +152 -0
- package/_types/zksync/types/eip1193.d.ts.map +1 -0
- package/_types/zksync/types/fee.d.ts +6 -0
- package/_types/zksync/types/fee.d.ts.map +1 -1
- package/_types/zksync/types/proof.d.ts +7 -0
- package/_types/zksync/types/proof.d.ts.map +1 -0
- package/_types/zksync/types/transaction.d.ts +65 -5
- package/_types/zksync/types/transaction.d.ts.map +1 -1
- package/_types/zksync/utils/camelCaseKeys.d.ts +2 -0
- package/_types/zksync/utils/camelCaseKeys.d.ts.map +1 -0
- package/_types/zksync/utils/isEth.d.ts +3 -0
- package/_types/zksync/utils/isEth.d.ts.map +1 -0
- package/_types/zksync/utils/paymaster/getApprovalBasedPaymasterInput.d.ts +1 -1
- package/_types/zksync/utils/paymaster/getApprovalBasedPaymasterInput.d.ts.map +1 -1
- package/_types/zksync/utils/paymaster/getGeneralPaymasterInput.d.ts +1 -1
- package/_types/zksync/utils/paymaster/getGeneralPaymasterInput.d.ts.map +1 -1
- package/celo/formatters.ts +3 -11
- package/celo/index.ts +0 -2
- package/celo/serializers.ts +2 -50
- package/celo/types.ts +3 -38
- package/celo/utils.ts +1 -24
- package/chains/index.ts +0 -2
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/zksync/actions/estimateFee.ts +46 -0
- package/zksync/actions/estimateGasL1ToL2.ts +38 -0
- package/zksync/actions/getAllBalances.ts +33 -0
- package/zksync/actions/getBaseTokenL1Address.ts +18 -0
- package/zksync/actions/getBlockDetails.ts +27 -0
- package/zksync/actions/getBridgehubContractAddress.ts +18 -0
- package/zksync/actions/getDefaultBridgeAddresses.ts +22 -0
- package/zksync/actions/getL1Allowance.ts +43 -0
- package/zksync/actions/getL1Balance.ts +68 -0
- package/zksync/actions/getL1BatchBlockRange.ts +26 -0
- package/zksync/actions/getL1BatchDetails.ts +27 -0
- package/zksync/actions/getL1BatchNumber.ts +18 -0
- package/zksync/actions/getL1ChainId.ts +18 -0
- package/zksync/actions/getL1TokenBalance.ts +63 -0
- package/zksync/actions/getLogProof.ts +28 -0
- package/zksync/actions/getMainContractAddress.ts +18 -0
- package/zksync/actions/getRawBlockTransactions.ts +26 -0
- package/zksync/actions/getTestnetPaymasterAddress.ts +18 -0
- package/zksync/actions/getTransactionDetails.ts +27 -0
- package/zksync/constants/address.ts +9 -0
- package/zksync/decorators/publicL1.ts +180 -0
- package/zksync/decorators/publicL2.ts +443 -0
- package/zksync/errors/token-is-eth.ts +16 -0
- package/zksync/index.ts +85 -6
- package/zksync/types/block.ts +37 -1
- package/zksync/types/contract.ts +8 -0
- package/zksync/types/eip1193.ts +155 -0
- package/zksync/types/fee.ts +7 -0
- package/zksync/types/proof.ts +7 -0
- package/zksync/types/transaction.ts +84 -10
- package/zksync/utils/camelCaseKeys.ts +11 -0
- package/zksync/utils/isEth.ts +20 -0
- package/zksync/utils/paymaster/getApprovalBasedPaymasterInput.ts +5 -2
- package/zksync/utils/paymaster/getGeneralPaymasterInput.ts +5 -2
@@ -0,0 +1,155 @@
|
|
1
|
+
import type { Address } from 'abitype'
|
2
|
+
import type { Hash, Hex } from '../../types/misc.js'
|
3
|
+
import type { ZkSyncBatchDetails, ZkSyncBlockDetails } from './block.js'
|
4
|
+
import type { ZkSyncFee } from './fee.js'
|
5
|
+
import type { MessageProof } from './proof.js'
|
6
|
+
import type {
|
7
|
+
TransactionRequest,
|
8
|
+
ZkSyncTransactionDetails,
|
9
|
+
} from './transaction.js'
|
10
|
+
|
11
|
+
export type CommonDataRawBlockTransaction = {
|
12
|
+
sender: Address
|
13
|
+
maxFeePerGas: Hex
|
14
|
+
gasLimit: Hex
|
15
|
+
gasPerPubdataLimit: Hex
|
16
|
+
ethHash: Hash
|
17
|
+
ethBlock: number
|
18
|
+
canonicalTxHash: Hash
|
19
|
+
toMint: Hex
|
20
|
+
refundRecipient: Address
|
21
|
+
}
|
22
|
+
|
23
|
+
export type RawBlockTransactions = {
|
24
|
+
common_data: {
|
25
|
+
L1?: {
|
26
|
+
serialId: number
|
27
|
+
deadlineBlock: number
|
28
|
+
layer2TipFee: Hex
|
29
|
+
fullFee: Hex
|
30
|
+
opProcessingType: string
|
31
|
+
priorityQueueType: string
|
32
|
+
} & CommonDataRawBlockTransaction
|
33
|
+
L2?: {
|
34
|
+
nonce: number
|
35
|
+
fee: ZkSyncFee<Hex>
|
36
|
+
initiatorAddress: Address
|
37
|
+
signature: Uint8Array
|
38
|
+
transactionType: string
|
39
|
+
input?: {
|
40
|
+
hash: Hash
|
41
|
+
data: Uint8Array
|
42
|
+
}
|
43
|
+
paymasterParams: {
|
44
|
+
paymaster: Address
|
45
|
+
paymasterInput: Uint8Array
|
46
|
+
}
|
47
|
+
}
|
48
|
+
ProtocolUpgrade?: {
|
49
|
+
upgradeId: string
|
50
|
+
} & CommonDataRawBlockTransaction
|
51
|
+
}
|
52
|
+
execute: {
|
53
|
+
calldata: Hash
|
54
|
+
contractAddress: Address
|
55
|
+
factoryDeps?: Hash
|
56
|
+
value: bigint
|
57
|
+
}
|
58
|
+
received_timestamp_ms: number
|
59
|
+
raw_bytes?: string
|
60
|
+
}[]
|
61
|
+
|
62
|
+
export type PublicZkSyncRpcSchema = [
|
63
|
+
{
|
64
|
+
Method: 'zks_estimateFee'
|
65
|
+
Parameters: [TransactionRequest]
|
66
|
+
ReturnType: {
|
67
|
+
gas_limit: Hex
|
68
|
+
gas_per_pubdata_limit: Hex
|
69
|
+
max_fee_per_gas: Hex
|
70
|
+
max_priority_fee_per_gas: Hex
|
71
|
+
}
|
72
|
+
},
|
73
|
+
{
|
74
|
+
Method: 'zks_estimateGasL1ToL2'
|
75
|
+
Parameters: [TransactionRequest]
|
76
|
+
ReturnType: bigint
|
77
|
+
},
|
78
|
+
{
|
79
|
+
Method: 'zks_getBridgeContracts'
|
80
|
+
Parameters?: undefined
|
81
|
+
ReturnType: {
|
82
|
+
l1Erc20DefaultBridge: Address
|
83
|
+
l2Erc20DefaultBridge: Address
|
84
|
+
l1WethBridge: Address
|
85
|
+
l2WethBridge: Address
|
86
|
+
l1SharedDefaultBridge: Address
|
87
|
+
l2SharedDefaultBridge: Address
|
88
|
+
}
|
89
|
+
},
|
90
|
+
{
|
91
|
+
Method: 'zks_getAllAccountBalances'
|
92
|
+
Parameters: [Address]
|
93
|
+
ReturnType: { [key: Address]: Hex }
|
94
|
+
},
|
95
|
+
{
|
96
|
+
Method: 'zks_getTestnetPaymaster'
|
97
|
+
Parameters: undefined
|
98
|
+
ReturnType: Address
|
99
|
+
},
|
100
|
+
{
|
101
|
+
Method: 'zks_L1ChainId'
|
102
|
+
Parameters: undefined
|
103
|
+
ReturnType: Hex
|
104
|
+
},
|
105
|
+
{
|
106
|
+
Method: 'zks_getMainContract'
|
107
|
+
Parameters: undefined
|
108
|
+
ReturnType: Address
|
109
|
+
},
|
110
|
+
{
|
111
|
+
Method: 'zks_L1BatchNumber'
|
112
|
+
Parameters: undefined
|
113
|
+
ReturnType: Hex
|
114
|
+
},
|
115
|
+
{
|
116
|
+
Method: 'zks_getL2ToL1LogProof'
|
117
|
+
Parameters: [Hash, number | undefined]
|
118
|
+
ReturnType: MessageProof
|
119
|
+
},
|
120
|
+
{
|
121
|
+
Method: 'zks_getL1BatchBlockRange'
|
122
|
+
Parameters: [number]
|
123
|
+
ReturnType: [Hex, Hex]
|
124
|
+
},
|
125
|
+
{
|
126
|
+
Method: 'zks_getL1BatchDetails'
|
127
|
+
Parameters: [number]
|
128
|
+
ReturnType: ZkSyncBatchDetails
|
129
|
+
},
|
130
|
+
{
|
131
|
+
Method: 'zks_getRawBlockTransactions'
|
132
|
+
Parameters: [number]
|
133
|
+
ReturnType: RawBlockTransactions
|
134
|
+
},
|
135
|
+
{
|
136
|
+
Method: 'zks_getBlockDetails'
|
137
|
+
Parameters: [number]
|
138
|
+
ReturnType: ZkSyncBlockDetails
|
139
|
+
},
|
140
|
+
{
|
141
|
+
Method: 'zks_getTransactionDetails'
|
142
|
+
Parameters: [Hash]
|
143
|
+
ReturnType: ZkSyncTransactionDetails
|
144
|
+
},
|
145
|
+
{
|
146
|
+
Method: 'zks_getBridgehubContract'
|
147
|
+
Parameters: undefined
|
148
|
+
ReturnType: Address
|
149
|
+
},
|
150
|
+
{
|
151
|
+
Method: 'zks_getBaseTokenL1Address'
|
152
|
+
Parameters: undefined
|
153
|
+
ReturnType: Address
|
154
|
+
},
|
155
|
+
]
|
package/zksync/types/fee.ts
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
export type ZkSyncFee<TQuantity = bigint> = {
|
2
|
+
gasLimit: TQuantity
|
3
|
+
gasPerPubdataLimit: TQuantity
|
4
|
+
maxPriorityFeePerGas: TQuantity
|
5
|
+
maxFeePerGas: TQuantity
|
6
|
+
}
|
7
|
+
|
1
8
|
export type ZkSyncFeeValues<TQuantity = bigint> = {
|
2
9
|
gasPrice: TQuantity
|
3
10
|
maxFeePerGas: TQuantity
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Address } from 'abitype'
|
2
2
|
import type { FeeValuesEIP1559 } from '../../types/fee.js'
|
3
|
-
import type { Hex } from '../../types/misc.js'
|
3
|
+
import type { Hash, Hex } from '../../types/misc.js'
|
4
4
|
import type {
|
5
5
|
Index,
|
6
6
|
Quantity,
|
@@ -22,7 +22,7 @@ import type {
|
|
22
22
|
} from '../../types/transaction.js'
|
23
23
|
import type { ExactPartial, OneOf, UnionOmit } from '../../types/utils.js'
|
24
24
|
import type { ZkSyncEip712Meta } from './eip712.js'
|
25
|
-
import type { ZkSyncFeeValues } from './fee.js'
|
25
|
+
import type { ZkSyncFee, ZkSyncFeeValues } from './fee.js'
|
26
26
|
import type {
|
27
27
|
ZkSyncL2ToL1Log,
|
28
28
|
ZkSyncLog,
|
@@ -117,7 +117,10 @@ export type ZkSyncRpcTransaction<TPending extends boolean = boolean> =
|
|
117
117
|
// Transaction Request
|
118
118
|
// https://era.zksync.io/docs/reference/concepts/transactions
|
119
119
|
|
120
|
-
type TransactionRequest
|
120
|
+
export type TransactionRequest<
|
121
|
+
TQuantity = bigint,
|
122
|
+
TIndex = number,
|
123
|
+
> = TransactionRequest_<TQuantity, TIndex> & {
|
121
124
|
gasPerPubdata?: undefined
|
122
125
|
customSignature?: undefined
|
123
126
|
paymaster?: undefined
|
@@ -125,10 +128,10 @@ type TransactionRequest = TransactionRequest_ & {
|
|
125
128
|
factoryDeps?: undefined
|
126
129
|
}
|
127
130
|
|
128
|
-
export type ZkSyncTransactionRequestEIP712
|
129
|
-
|
130
|
-
|
131
|
-
> &
|
131
|
+
export type ZkSyncTransactionRequestEIP712<
|
132
|
+
TQuantity = bigint,
|
133
|
+
TIndex = number,
|
134
|
+
> = Omit<TransactionRequestBase<TQuantity, TIndex>, 'type'> &
|
132
135
|
ExactPartial<FeeValuesEIP1559> & {
|
133
136
|
gasPerPubdata?: bigint | undefined
|
134
137
|
customSignature?: Hex | undefined
|
@@ -139,9 +142,9 @@ export type ZkSyncTransactionRequestEIP712 = Omit<
|
|
139
142
|
| { paymaster?: undefined; paymasterInput?: undefined }
|
140
143
|
)
|
141
144
|
|
142
|
-
export type ZkSyncTransactionRequest =
|
143
|
-
| TransactionRequest
|
144
|
-
| ZkSyncTransactionRequestEIP712
|
145
|
+
export type ZkSyncTransactionRequest<TQuantity = bigint, TIndex = number> =
|
146
|
+
| TransactionRequest<TQuantity, TIndex>
|
147
|
+
| ZkSyncTransactionRequestEIP712<TQuantity, TIndex>
|
145
148
|
|
146
149
|
type RpcTransactionRequest = RpcTransactionRequest_ & { eip712Meta?: undefined }
|
147
150
|
|
@@ -243,3 +246,74 @@ export type TransactionRequestEIP712<
|
|
243
246
|
customSignature?: Hex | undefined
|
244
247
|
type?: TTransactionType | undefined
|
245
248
|
}
|
249
|
+
|
250
|
+
type CommonDataRawBlockTransaction = {
|
251
|
+
sender: Address
|
252
|
+
maxFeePerGas: Hex
|
253
|
+
gasLimit: Hex
|
254
|
+
gasPerPubdataLimit: Hex
|
255
|
+
ethHash: Hash
|
256
|
+
ethBlock: number
|
257
|
+
canonicalTxHash: Hash
|
258
|
+
toMint: Hex
|
259
|
+
refundRecipient: Address
|
260
|
+
}
|
261
|
+
|
262
|
+
export type ZkSyncRawBlockTransactions = {
|
263
|
+
commonData: {
|
264
|
+
L1?:
|
265
|
+
| ({
|
266
|
+
serialId: number
|
267
|
+
deadlineBlock: number
|
268
|
+
layer2TipFee: Hex
|
269
|
+
fullFee: Hex
|
270
|
+
opProcessingType: string
|
271
|
+
priorityQueueType: string
|
272
|
+
} & CommonDataRawBlockTransaction)
|
273
|
+
| undefined
|
274
|
+
L2?:
|
275
|
+
| {
|
276
|
+
nonce: number
|
277
|
+
fee: ZkSyncFee<Hex>
|
278
|
+
initiatorAddress: Address
|
279
|
+
signature: Uint8Array
|
280
|
+
transactionType: string
|
281
|
+
input?:
|
282
|
+
| {
|
283
|
+
hash: Hash
|
284
|
+
data: Uint8Array
|
285
|
+
}
|
286
|
+
| undefined
|
287
|
+
paymasterParams: {
|
288
|
+
paymaster: Address
|
289
|
+
paymasterInput: Uint8Array
|
290
|
+
}
|
291
|
+
}
|
292
|
+
| undefined
|
293
|
+
ProtocolUpgrade?:
|
294
|
+
| ({
|
295
|
+
upgradeId: string
|
296
|
+
} & CommonDataRawBlockTransaction)
|
297
|
+
| undefined
|
298
|
+
}
|
299
|
+
execute: {
|
300
|
+
calldata: Hash
|
301
|
+
contractAddress: Address
|
302
|
+
factoryDeps?: Hash
|
303
|
+
value: bigint
|
304
|
+
}
|
305
|
+
receivedTimestampMs: number
|
306
|
+
rawBytes?: string | undefined
|
307
|
+
}[]
|
308
|
+
|
309
|
+
export type ZkSyncTransactionDetails = {
|
310
|
+
isL1Originated: boolean
|
311
|
+
status: string
|
312
|
+
fee: bigint
|
313
|
+
gasPerPubdata: bigint
|
314
|
+
initiatorAddress: Address
|
315
|
+
receivedAt: Date
|
316
|
+
ethCommitTxHash?: Hash | undefined
|
317
|
+
ethProveTxHash?: Hash | undefined
|
318
|
+
ethExecuteTxHash?: Hash | undefined
|
319
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export function camelCaseKeys(response: object): object {
|
2
|
+
if (!response) return response
|
3
|
+
if (typeof response !== 'object') return response
|
4
|
+
if (Array.isArray(response)) return response.map(camelCaseKeys)
|
5
|
+
return Object.fromEntries(
|
6
|
+
Object.entries(response).map(([key, value]) => [
|
7
|
+
key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()),
|
8
|
+
camelCaseKeys(value),
|
9
|
+
]),
|
10
|
+
)
|
11
|
+
}
|
@@ -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,7 +1,10 @@
|
|
1
1
|
import type { Address } from 'abitype'
|
2
2
|
import type { ByteArray, Hex } from '../../../types/misc.js'
|
3
|
-
import
|
4
|
-
|
3
|
+
import {
|
4
|
+
type EncodeFunctionDataReturnType,
|
5
|
+
encodeFunctionData,
|
6
|
+
} from '../../../utils/abi/encodeFunctionData.js'
|
7
|
+
import { bytesToHex } from '../../../utils/encoding/toHex.js'
|
5
8
|
import { paymasterAbi } from '../../constants/abis.js'
|
6
9
|
|
7
10
|
export type GetApprovalBasedPaymasterInputParameters = {
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import type { ByteArray, Hex } from '../../../types/misc.js'
|
2
|
-
import
|
3
|
-
|
2
|
+
import {
|
3
|
+
type EncodeFunctionDataReturnType,
|
4
|
+
encodeFunctionData,
|
5
|
+
} from '../../../utils/abi/encodeFunctionData.js'
|
6
|
+
import { bytesToHex } from '../../../utils/encoding/toHex.js'
|
4
7
|
import { paymasterAbi } from '../../constants/abis.js'
|
5
8
|
|
6
9
|
export type GetGeneralPaymasterInputParameters = {
|