viem 2.37.10 → 2.37.12
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 +14 -0
- package/_cjs/accounts/utils/signTransaction.js +2 -2
- package/_cjs/accounts/utils/signTransaction.js.map +1 -1
- package/_cjs/actions/public/call.js +1 -1
- package/_cjs/actions/public/call.js.map +1 -1
- package/_cjs/actions/public/createAccessList.js +1 -1
- package/_cjs/actions/public/createAccessList.js.map +1 -1
- package/_cjs/actions/public/estimateGas.js +1 -1
- package/_cjs/actions/public/estimateGas.js.map +1 -1
- package/_cjs/actions/public/getBlock.js +1 -1
- package/_cjs/actions/public/getBlock.js.map +1 -1
- package/_cjs/actions/public/getTransaction.js +1 -1
- package/_cjs/actions/public/getTransaction.js.map +1 -1
- package/_cjs/actions/public/getTransactionReceipt.js +1 -1
- package/_cjs/actions/public/getTransactionReceipt.js.map +1 -1
- package/_cjs/actions/test/sendUnsignedTransaction.js +1 -1
- package/_cjs/actions/test/sendUnsignedTransaction.js.map +1 -1
- package/_cjs/actions/wallet/sendTransaction.js +1 -1
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/signTransaction.js +1 -1
- package/_cjs/actions/wallet/signTransaction.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/linea/actions/estimateGas.js +1 -1
- package/_cjs/linea/actions/estimateGas.js.map +1 -1
- package/_cjs/utils/formatters/block.js +1 -1
- package/_cjs/utils/formatters/block.js.map +1 -1
- package/_cjs/utils/formatters/formatter.js +3 -3
- package/_cjs/utils/formatters/formatter.js.map +1 -1
- package/_cjs/utils/formatters/transaction.js +1 -1
- package/_cjs/utils/formatters/transaction.js.map +1 -1
- package/_cjs/utils/formatters/transactionReceipt.js +1 -1
- package/_cjs/utils/formatters/transactionReceipt.js.map +1 -1
- package/_cjs/utils/formatters/transactionRequest.js +1 -1
- package/_cjs/utils/formatters/transactionRequest.js.map +1 -1
- package/_cjs/utils/transaction/parseTransaction.js +1 -2
- package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
- package/_cjs/utils/transaction/serializeTransaction.js.map +1 -1
- package/_cjs/zksync/actions/estimateFee.js +1 -1
- package/_cjs/zksync/actions/estimateFee.js.map +1 -1
- package/_cjs/zksync/actions/estimateGasL1ToL2.js +1 -1
- package/_cjs/zksync/actions/estimateGasL1ToL2.js.map +1 -1
- package/_esm/accounts/utils/signTransaction.js +2 -2
- package/_esm/accounts/utils/signTransaction.js.map +1 -1
- package/_esm/actions/public/call.js +1 -1
- package/_esm/actions/public/call.js.map +1 -1
- package/_esm/actions/public/createAccessList.js +1 -1
- package/_esm/actions/public/createAccessList.js.map +1 -1
- package/_esm/actions/public/estimateGas.js +1 -1
- package/_esm/actions/public/estimateGas.js.map +1 -1
- package/_esm/actions/public/getBlock.js +1 -1
- package/_esm/actions/public/getBlock.js.map +1 -1
- package/_esm/actions/public/getTransaction.js +1 -1
- package/_esm/actions/public/getTransaction.js.map +1 -1
- package/_esm/actions/public/getTransactionReceipt.js +1 -1
- package/_esm/actions/public/getTransactionReceipt.js.map +1 -1
- package/_esm/actions/test/sendUnsignedTransaction.js +1 -1
- package/_esm/actions/test/sendUnsignedTransaction.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +1 -1
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/signTransaction.js +1 -1
- package/_esm/actions/wallet/signTransaction.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/linea/actions/estimateGas.js +1 -1
- package/_esm/linea/actions/estimateGas.js.map +1 -1
- package/_esm/utils/formatters/block.js +1 -1
- package/_esm/utils/formatters/block.js.map +1 -1
- package/_esm/utils/formatters/formatter.js +3 -3
- package/_esm/utils/formatters/formatter.js.map +1 -1
- package/_esm/utils/formatters/transaction.js +1 -1
- package/_esm/utils/formatters/transaction.js.map +1 -1
- package/_esm/utils/formatters/transactionReceipt.js +1 -1
- package/_esm/utils/formatters/transactionReceipt.js.map +1 -1
- package/_esm/utils/formatters/transactionRequest.js +1 -1
- package/_esm/utils/formatters/transactionRequest.js.map +1 -1
- package/_esm/utils/transaction/parseTransaction.js +1 -2
- package/_esm/utils/transaction/parseTransaction.js.map +1 -1
- package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
- package/_esm/zksync/actions/estimateFee.js +1 -1
- package/_esm/zksync/actions/estimateFee.js.map +1 -1
- package/_esm/zksync/actions/estimateGasL1ToL2.js +1 -1
- package/_esm/zksync/actions/estimateGasL1ToL2.js.map +1 -1
- package/_types/actions/public/call.d.ts.map +1 -1
- package/_types/actions/public/createAccessList.d.ts.map +1 -1
- package/_types/actions/public/estimateGas.d.ts.map +1 -1
- package/_types/actions/public/getTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/test/sendUnsignedTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/signTransaction.d.ts.map +1 -1
- package/_types/celo/chainConfig.d.ts +52 -14
- package/_types/celo/chainConfig.d.ts.map +1 -1
- package/_types/celo/formatters.d.ts +26 -7
- package/_types/celo/formatters.d.ts.map +1 -1
- package/_types/chains/definitions/abstract.d.ts +26 -7
- package/_types/chains/definitions/abstract.d.ts.map +1 -1
- package/_types/chains/definitions/abstractTestnet.d.ts +26 -7
- package/_types/chains/definitions/abstractTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/ancient8.d.ts +3 -3
- package/_types/chains/definitions/ancient8Sepolia.d.ts +3 -3
- package/_types/chains/definitions/base.d.ts +6 -6
- package/_types/chains/definitions/baseGoerli.d.ts +3 -3
- package/_types/chains/definitions/baseSepolia.d.ts +6 -6
- package/_types/chains/definitions/blast.d.ts +3 -3
- package/_types/chains/definitions/bob.d.ts +3 -3
- package/_types/chains/definitions/bobSepolia.d.ts +3 -3
- package/_types/chains/definitions/celo.d.ts +52 -14
- package/_types/chains/definitions/celo.d.ts.map +1 -1
- package/_types/chains/definitions/celoAlfajores.d.ts +52 -14
- package/_types/chains/definitions/celoAlfajores.d.ts.map +1 -1
- package/_types/chains/definitions/celoSepolia.d.ts +52 -14
- package/_types/chains/definitions/celoSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/dchain.d.ts +3 -3
- package/_types/chains/definitions/dchainTestnet.d.ts +3 -3
- package/_types/chains/definitions/elysiumTestnet.d.ts +3 -3
- package/_types/chains/definitions/fraxtal.d.ts +3 -3
- package/_types/chains/definitions/fraxtalTestnet.d.ts +3 -3
- package/_types/chains/definitions/funkiMainnet.d.ts +3 -3
- package/_types/chains/definitions/funkiSepolia.d.ts +3 -3
- package/_types/chains/definitions/garnet.d.ts +3 -3
- package/_types/chains/definitions/giwaSepolia.d.ts +3 -3
- package/_types/chains/definitions/ink.d.ts +3 -3
- package/_types/chains/definitions/inkSepolia.d.ts +3 -3
- package/_types/chains/definitions/lisk.d.ts +3 -3
- package/_types/chains/definitions/liskSepolia.d.ts +3 -3
- package/_types/chains/definitions/metalL2.d.ts +3 -3
- package/_types/chains/definitions/mode.d.ts +3 -3
- package/_types/chains/definitions/modeTestnet.d.ts +3 -3
- package/_types/chains/definitions/optimism.d.ts +3 -3
- package/_types/chains/definitions/optimismGoerli.d.ts +3 -3
- package/_types/chains/definitions/optimismSepolia.d.ts +3 -3
- package/_types/chains/definitions/pgn.d.ts +3 -3
- package/_types/chains/definitions/pgnTestnet.d.ts +3 -3
- package/_types/chains/definitions/playfiAlbireo.d.ts +26 -7
- package/_types/chains/definitions/playfiAlbireo.d.ts.map +1 -1
- package/_types/chains/definitions/pyrope.d.ts +3 -3
- package/_types/chains/definitions/redstone.d.ts +3 -3
- package/_types/chains/definitions/rss3.d.ts +3 -3
- package/_types/chains/definitions/rss3Sepolia.d.ts +3 -3
- package/_types/chains/definitions/shape.d.ts +3 -3
- package/_types/chains/definitions/shapeSepolia.d.ts +3 -3
- package/_types/chains/definitions/snax.d.ts +3 -3
- package/_types/chains/definitions/snaxTestnet.d.ts +3 -3
- package/_types/chains/definitions/soneium.d.ts +3 -3
- package/_types/chains/definitions/soneiumMinato.d.ts +3 -3
- package/_types/chains/definitions/sophon.d.ts +26 -7
- package/_types/chains/definitions/sophon.d.ts.map +1 -1
- package/_types/chains/definitions/sophonTestnet.d.ts +26 -7
- package/_types/chains/definitions/sophonTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/superseed.d.ts +3 -3
- package/_types/chains/definitions/superseedSepolia.d.ts +3 -3
- package/_types/chains/definitions/swellchain.d.ts +3 -3
- package/_types/chains/definitions/swellchainTestnet.d.ts +3 -3
- package/_types/chains/definitions/treasure.d.ts +26 -7
- package/_types/chains/definitions/treasure.d.ts.map +1 -1
- package/_types/chains/definitions/treasureTopaz.d.ts +26 -7
- package/_types/chains/definitions/treasureTopaz.d.ts.map +1 -1
- package/_types/chains/definitions/unichain.d.ts +3 -3
- package/_types/chains/definitions/unichainSepolia.d.ts +3 -3
- package/_types/chains/definitions/worldchain.d.ts +3 -3
- package/_types/chains/definitions/worldchainSepolia.d.ts +3 -3
- package/_types/chains/definitions/zircuit.d.ts +3 -3
- package/_types/chains/definitions/zircuitGarfieldTestnet.d.ts +3 -3
- package/_types/chains/definitions/zircuitTestnet.d.ts +3 -3
- package/_types/chains/definitions/zksync.d.ts +26 -7
- package/_types/chains/definitions/zksync.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncInMemoryNode.d.ts +26 -7
- package/_types/chains/definitions/zksyncInMemoryNode.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts +26 -7
- package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncLocalHyperchain.d.ts +26 -7
- package/_types/chains/definitions/zksyncLocalHyperchain.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncLocalNode.d.ts +26 -7
- package/_types/chains/definitions/zksyncLocalNode.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts +26 -7
- package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/zora.d.ts +3 -3
- package/_types/chains/definitions/zoraSepolia.d.ts +3 -3
- package/_types/chains/definitions/zoraTestnet.d.ts +3 -3
- package/_types/errors/version.d.ts +1 -1
- package/_types/linea/actions/estimateGas.d.ts.map +1 -1
- package/_types/op-stack/chainConfig.d.ts +3 -3
- package/_types/op-stack/formatters.d.ts +3 -3
- package/_types/types/chain.d.ts +1 -1
- package/_types/types/chain.d.ts.map +1 -1
- package/_types/types/transaction.d.ts +9 -6
- package/_types/types/transaction.d.ts.map +1 -1
- package/_types/utils/formatters/block.d.ts +3 -3
- package/_types/utils/formatters/block.d.ts.map +1 -1
- package/_types/utils/formatters/formatter.d.ts +3 -3
- package/_types/utils/formatters/formatter.d.ts.map +1 -1
- package/_types/utils/formatters/transaction.d.ts +4 -4
- package/_types/utils/formatters/transaction.d.ts.map +1 -1
- package/_types/utils/formatters/transactionReceipt.d.ts +3 -3
- package/_types/utils/formatters/transactionReceipt.d.ts.map +1 -1
- package/_types/utils/formatters/transactionRequest.d.ts +4 -4
- package/_types/utils/formatters/transactionRequest.d.ts.map +1 -1
- package/_types/utils/transaction/parseTransaction.d.ts +1 -1
- package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
- package/_types/utils/transaction/serializeTransaction.d.ts +2 -2
- package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
- package/_types/zksync/actions/estimateFee.d.ts.map +1 -1
- package/_types/zksync/actions/estimateGasL1ToL2.d.ts.map +1 -1
- package/_types/zksync/chainConfig.d.ts +26 -7
- package/_types/zksync/chainConfig.d.ts.map +1 -1
- package/_types/zksync/formatters.d.ts +26 -7
- package/_types/zksync/formatters.d.ts.map +1 -1
- package/accounts/utils/signTransaction.ts +5 -5
- package/actions/public/call.ts +20 -17
- package/actions/public/createAccessList.ts +17 -14
- package/actions/public/estimateGas.ts +21 -18
- package/actions/public/getBlock.ts +1 -1
- package/actions/public/getTransaction.ts +1 -1
- package/actions/public/getTransactionReceipt.ts +4 -1
- package/actions/test/sendUnsignedTransaction.ts +17 -14
- package/actions/wallet/sendTransaction.ts +22 -19
- package/actions/wallet/signTransaction.ts +4 -1
- package/errors/version.ts +1 -1
- package/linea/actions/estimateGas.ts +17 -14
- package/package.json +1 -1
- package/types/chain.ts +1 -1
- package/types/transaction.ts +18 -8
- package/utils/formatters/block.ts +4 -1
- package/utils/formatters/formatter.ts +8 -5
- package/utils/formatters/transaction.ts +4 -1
- package/utils/formatters/transactionReceipt.ts +1 -0
- package/utils/formatters/transactionRequest.ts +1 -0
- package/utils/transaction/parseTransaction.ts +4 -2
- package/utils/transaction/serializeTransaction.ts +9 -4
- package/zksync/actions/estimateFee.ts +7 -4
- package/zksync/actions/estimateGasL1ToL2.ts +7 -4
|
@@ -68,5 +68,8 @@ export async function getTransactionReceipt<chain extends Chain | undefined>(
|
|
|
68
68
|
const format =
|
|
69
69
|
client.chain?.formatters?.transactionReceipt?.format ||
|
|
70
70
|
formatTransactionReceipt
|
|
71
|
-
return format(
|
|
71
|
+
return format(
|
|
72
|
+
receipt,
|
|
73
|
+
'getTransactionReceipt',
|
|
74
|
+
) as GetTransactionReceiptReturnType<chain>
|
|
72
75
|
}
|
|
@@ -72,20 +72,23 @@ export async function sendUnsignedTransaction<
|
|
|
72
72
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format
|
|
73
73
|
const format = chainFormat || formatTransactionRequest
|
|
74
74
|
|
|
75
|
-
const request = format(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
const request = format(
|
|
76
|
+
{
|
|
77
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
78
|
+
...extract(rest, { format: chainFormat }),
|
|
79
|
+
accessList,
|
|
80
|
+
data,
|
|
81
|
+
from,
|
|
82
|
+
gas,
|
|
83
|
+
gasPrice,
|
|
84
|
+
maxFeePerGas,
|
|
85
|
+
maxPriorityFeePerGas,
|
|
86
|
+
nonce,
|
|
87
|
+
to,
|
|
88
|
+
value,
|
|
89
|
+
} as TransactionRequest,
|
|
90
|
+
'sendUnsignedTransaction',
|
|
91
|
+
)
|
|
89
92
|
const hash = await client.request({
|
|
90
93
|
method: 'eth_sendUnsignedTransaction',
|
|
91
94
|
params: [request],
|
|
@@ -219,25 +219,28 @@ export async function sendTransaction<
|
|
|
219
219
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format
|
|
220
220
|
const format = chainFormat || formatTransactionRequest
|
|
221
221
|
|
|
222
|
-
const request = format(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
222
|
+
const request = format(
|
|
223
|
+
{
|
|
224
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
225
|
+
...extract(rest, { format: chainFormat }),
|
|
226
|
+
accessList,
|
|
227
|
+
authorizationList,
|
|
228
|
+
blobs,
|
|
229
|
+
chainId,
|
|
230
|
+
data,
|
|
231
|
+
from: account?.address,
|
|
232
|
+
gas,
|
|
233
|
+
gasPrice,
|
|
234
|
+
maxFeePerBlobGas,
|
|
235
|
+
maxFeePerGas,
|
|
236
|
+
maxPriorityFeePerGas,
|
|
237
|
+
nonce,
|
|
238
|
+
to,
|
|
239
|
+
type,
|
|
240
|
+
value,
|
|
241
|
+
} as TransactionRequest,
|
|
242
|
+
'sendTransaction',
|
|
243
|
+
)
|
|
241
244
|
|
|
242
245
|
const isWalletNamespaceSupported = supportsWalletNamespace.get(client.uid)
|
|
243
246
|
const method = isWalletNamespaceSupported
|
|
@@ -172,7 +172,10 @@ export async function signTransaction<
|
|
|
172
172
|
method: 'eth_signTransaction',
|
|
173
173
|
params: [
|
|
174
174
|
{
|
|
175
|
-
...format(
|
|
175
|
+
...format(
|
|
176
|
+
transaction as unknown as TransactionRequest,
|
|
177
|
+
'signTransaction',
|
|
178
|
+
),
|
|
176
179
|
chainId: numberToHex(chainId),
|
|
177
180
|
from: account.address,
|
|
178
181
|
} as unknown as RpcTransactionRequest,
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.37.
|
|
1
|
+
export const version = '2.37.12'
|
|
@@ -89,20 +89,23 @@ export async function estimateGas<
|
|
|
89
89
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format
|
|
90
90
|
const format = chainFormat || formatTransactionRequest
|
|
91
91
|
|
|
92
|
-
const request = format(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
92
|
+
const request = format(
|
|
93
|
+
{
|
|
94
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
95
|
+
...extract(rest, { format: chainFormat }),
|
|
96
|
+
from: account?.address,
|
|
97
|
+
accessList,
|
|
98
|
+
data,
|
|
99
|
+
gas,
|
|
100
|
+
gasPrice,
|
|
101
|
+
maxFeePerGas,
|
|
102
|
+
maxPriorityFeePerGas,
|
|
103
|
+
nonce,
|
|
104
|
+
to,
|
|
105
|
+
value,
|
|
106
|
+
} as TransactionRequest,
|
|
107
|
+
'estimateGas',
|
|
108
|
+
)
|
|
106
109
|
|
|
107
110
|
type LineaEstimateGasSchema = Filter<
|
|
108
111
|
LineaRpcSchema,
|
package/package.json
CHANGED
package/types/chain.ts
CHANGED
package/types/transaction.ts
CHANGED
|
@@ -259,14 +259,20 @@ export type TransactionRequestEIP4844<
|
|
|
259
259
|
index = number,
|
|
260
260
|
type = 'eip4844',
|
|
261
261
|
> = RequiredBy<TransactionRequestBase<quantity, index, type>, 'to'> &
|
|
262
|
-
|
|
262
|
+
ExactPartial<FeeValuesEIP4844<quantity>> & {
|
|
263
263
|
accessList?: AccessList | undefined
|
|
264
|
-
/** The blobs associated with this transaction. */
|
|
265
|
-
blobs: readonly Hex[] | readonly ByteArray[]
|
|
266
|
-
blobVersionedHashes?: readonly Hex[] | undefined
|
|
267
|
-
kzg?: Kzg | undefined
|
|
268
264
|
sidecars?: readonly BlobSidecar<Hex>[] | undefined
|
|
269
|
-
}
|
|
265
|
+
} & OneOf<
|
|
266
|
+
| {
|
|
267
|
+
blobs?: readonly Hex[] | readonly ByteArray[] | undefined
|
|
268
|
+
blobVersionedHashes: readonly Hex[]
|
|
269
|
+
}
|
|
270
|
+
| {
|
|
271
|
+
blobs: readonly Hex[] | readonly ByteArray[]
|
|
272
|
+
blobVersionedHashes?: readonly Hex[] | undefined
|
|
273
|
+
kzg?: Kzg | undefined
|
|
274
|
+
}
|
|
275
|
+
>
|
|
270
276
|
|
|
271
277
|
export type TransactionRequestEIP7702<
|
|
272
278
|
quantity = bigint,
|
|
@@ -360,11 +366,15 @@ export type TransactionSerializableEIP1559<
|
|
|
360
366
|
export type TransactionSerializableEIP4844<
|
|
361
367
|
quantity = bigint,
|
|
362
368
|
index = number,
|
|
363
|
-
|
|
369
|
+
nullableSidecars extends boolean = boolean,
|
|
370
|
+
> = RequiredBy<TransactionSerializableBase<quantity, index>, 'to'> &
|
|
364
371
|
ExactPartial<FeeValuesEIP4844<quantity>> & {
|
|
365
372
|
accessList?: AccessList | undefined
|
|
366
373
|
chainId: number
|
|
367
|
-
sidecars?:
|
|
374
|
+
sidecars?:
|
|
375
|
+
| readonly BlobSidecar<Hex>[]
|
|
376
|
+
| (nullableSidecars extends true ? false : never)
|
|
377
|
+
| undefined
|
|
368
378
|
type?: 'eip4844' | undefined
|
|
369
379
|
yParity?: number | undefined
|
|
370
380
|
} & OneOf<
|
|
@@ -40,7 +40,10 @@ export type FormattedBlock<
|
|
|
40
40
|
|
|
41
41
|
export type FormatBlockErrorType = ErrorType
|
|
42
42
|
|
|
43
|
-
export function formatBlock(
|
|
43
|
+
export function formatBlock(
|
|
44
|
+
block: ExactPartial<RpcBlock>,
|
|
45
|
+
_?: string | undefined,
|
|
46
|
+
) {
|
|
44
47
|
const transactions = (block.transactions ?? []).map((transaction) => {
|
|
45
48
|
if (typeof transaction === 'string') return transaction
|
|
46
49
|
return formatTransaction(transaction)
|
|
@@ -5,7 +5,7 @@ export type DefineFormatterErrorType = ErrorType
|
|
|
5
5
|
|
|
6
6
|
export function defineFormatter<type extends string, parameters, returnType>(
|
|
7
7
|
type: type,
|
|
8
|
-
format: (
|
|
8
|
+
format: (args: parameters, action?: string | undefined) => returnType,
|
|
9
9
|
) {
|
|
10
10
|
return <
|
|
11
11
|
parametersOverride,
|
|
@@ -16,12 +16,15 @@ export function defineFormatter<type extends string, parameters, returnType>(
|
|
|
16
16
|
format: overrides,
|
|
17
17
|
}: {
|
|
18
18
|
exclude?: exclude | undefined
|
|
19
|
-
format: (
|
|
19
|
+
format: (
|
|
20
|
+
args: parametersOverride,
|
|
21
|
+
action?: string | undefined,
|
|
22
|
+
) => returnTypeOverride
|
|
20
23
|
}) => {
|
|
21
24
|
return {
|
|
22
25
|
exclude,
|
|
23
|
-
format: (args: parametersOverride) => {
|
|
24
|
-
const formatted = format(args as any)
|
|
26
|
+
format: (args: parametersOverride, action?: string | undefined) => {
|
|
27
|
+
const formatted = format(args as any, action)
|
|
25
28
|
if (exclude) {
|
|
26
29
|
for (const key of exclude) {
|
|
27
30
|
delete (formatted as any)[key]
|
|
@@ -29,7 +32,7 @@ export function defineFormatter<type extends string, parameters, returnType>(
|
|
|
29
32
|
}
|
|
30
33
|
return {
|
|
31
34
|
...formatted,
|
|
32
|
-
...overrides(args),
|
|
35
|
+
...overrides(args, action),
|
|
33
36
|
} as Prettify<returnTypeOverride> & {
|
|
34
37
|
[_key in exclude[number]]: never
|
|
35
38
|
}
|
|
@@ -45,7 +45,10 @@ export const transactionType = {
|
|
|
45
45
|
|
|
46
46
|
export type FormatTransactionErrorType = ErrorType
|
|
47
47
|
|
|
48
|
-
export function formatTransaction(
|
|
48
|
+
export function formatTransaction(
|
|
49
|
+
transaction: ExactPartial<RpcTransaction>,
|
|
50
|
+
_?: string | undefined,
|
|
51
|
+
) {
|
|
49
52
|
const transaction_ = {
|
|
50
53
|
...transaction,
|
|
51
54
|
blockHash: transaction.blockHash ? transaction.blockHash : null,
|
|
@@ -73,7 +73,9 @@ export type ParseTransactionReturnType<
|
|
|
73
73
|
?
|
|
74
74
|
| (type extends 'eip1559' ? TransactionSerializableEIP1559 : never)
|
|
75
75
|
| (type extends 'eip2930' ? TransactionSerializableEIP2930 : never)
|
|
76
|
-
| (type extends 'eip4844'
|
|
76
|
+
| (type extends 'eip4844'
|
|
77
|
+
? TransactionSerializableEIP4844<bigint, number, false>
|
|
78
|
+
: never)
|
|
77
79
|
| (type extends 'eip7702' ? TransactionSerializableEIP7702 : never)
|
|
78
80
|
| (type extends 'legacy' ? TransactionSerializableLegacy : never)
|
|
79
81
|
: TransactionSerializable
|
|
@@ -276,9 +278,9 @@ function parseTransactionEIP4844(
|
|
|
276
278
|
const transaction = {
|
|
277
279
|
blobVersionedHashes: blobVersionedHashes as Hex[],
|
|
278
280
|
chainId: hexToNumber(chainId as Hex),
|
|
281
|
+
to,
|
|
279
282
|
type: 'eip4844',
|
|
280
283
|
} as TransactionSerializableEIP4844
|
|
281
|
-
if (isHex(to) && to !== '0x') transaction.to = to
|
|
282
284
|
if (isHex(gas) && gas !== '0x') transaction.gas = hexToBigInt(gas)
|
|
283
285
|
if (isHex(data) && data !== '0x') transaction.data = data
|
|
284
286
|
if (isHex(nonce)) transaction.nonce = nonce === '0x' ? 0 : hexToNumber(nonce)
|
|
@@ -25,7 +25,7 @@ import type {
|
|
|
25
25
|
TransactionSerializedLegacy,
|
|
26
26
|
TransactionType,
|
|
27
27
|
} from '../../types/transaction.js'
|
|
28
|
-
import type { OneOf } from '../../types/utils.js'
|
|
28
|
+
import type { MaybePromise, OneOf } from '../../types/utils.js'
|
|
29
29
|
import {
|
|
30
30
|
type SerializeAuthorizationListErrorType,
|
|
31
31
|
serializeAuthorizationList,
|
|
@@ -87,9 +87,14 @@ export type SerializeTransactionFn<
|
|
|
87
87
|
transaction extends TransactionSerializableGeneric = TransactionSerializable,
|
|
88
88
|
///
|
|
89
89
|
_transactionType extends TransactionType = never,
|
|
90
|
-
> =
|
|
91
|
-
OneOf<TransactionSerializable | transaction>,
|
|
92
|
-
|
|
90
|
+
> = (
|
|
91
|
+
transaction: OneOf<TransactionSerializable | transaction>,
|
|
92
|
+
signature?: Signature | undefined,
|
|
93
|
+
) => MaybePromise<
|
|
94
|
+
SerializedTransactionReturnType<
|
|
95
|
+
OneOf<TransactionSerializable | transaction>,
|
|
96
|
+
_transactionType
|
|
97
|
+
>
|
|
93
98
|
>
|
|
94
99
|
|
|
95
100
|
export type SerializeTransactionErrorType =
|
|
@@ -27,10 +27,13 @@ export async function estimateFee<
|
|
|
27
27
|
const account = account_ ? parseAccount(account_) : client.account
|
|
28
28
|
|
|
29
29
|
const formatters = client.chain?.formatters
|
|
30
|
-
const formatted = formatters?.transactionRequest?.format(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const formatted = formatters?.transactionRequest?.format(
|
|
31
|
+
{
|
|
32
|
+
...request,
|
|
33
|
+
from: account?.address,
|
|
34
|
+
},
|
|
35
|
+
'estimateFee',
|
|
36
|
+
)
|
|
34
37
|
|
|
35
38
|
const result = await client.request({
|
|
36
39
|
method: 'zks_estimateFee',
|
|
@@ -24,10 +24,13 @@ export async function estimateGasL1ToL2<
|
|
|
24
24
|
const account = account_ ? parseAccount(account_) : client.account
|
|
25
25
|
|
|
26
26
|
const formatters = client.chain?.formatters
|
|
27
|
-
const formatted = formatters?.transactionRequest?.format(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const formatted = formatters?.transactionRequest?.format(
|
|
28
|
+
{
|
|
29
|
+
...request,
|
|
30
|
+
from: account?.address,
|
|
31
|
+
},
|
|
32
|
+
'estimateGasL1ToL2',
|
|
33
|
+
)
|
|
31
34
|
|
|
32
35
|
const result = await client.request({
|
|
33
36
|
method: 'zks_estimateGasL1ToL2',
|