viem 2.57.13 → 2.57.15
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 +60 -0
- package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
- package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
- package/_cjs/actions/public/estimateGas.js +5 -2
- package/_cjs/actions/public/estimateGas.js.map +1 -1
- package/_cjs/actions/public/fillTransaction.js +2 -0
- package/_cjs/actions/public/fillTransaction.js.map +1 -1
- package/_cjs/actions/public/getFilterChanges.js +1 -0
- package/_cjs/actions/public/getFilterChanges.js.map +1 -1
- package/_cjs/actions/public/getFilterLogs.js +1 -0
- package/_cjs/actions/public/getFilterLogs.js.map +1 -1
- package/_cjs/actions/public/watchBlockNumber.js +3 -1
- package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
- package/_cjs/actions/public/watchBlocks.js +20 -8
- package/_cjs/actions/public/watchBlocks.js.map +1 -1
- package/_cjs/actions/public/watchContractEvent.js +10 -3
- package/_cjs/actions/public/watchContractEvent.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +5 -0
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +3 -2
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/actions/wallet/sendTransaction.js +4 -2
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/sendTransactionSync.js +48 -7
- package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_cjs/chains/definitions/hashKeyChain.js +4 -4
- package/_cjs/chains/definitions/hashKeyChain.js.map +1 -1
- package/_cjs/chains/definitions/hashkeyChainTestnet.js +4 -4
- package/_cjs/chains/definitions/hashkeyChainTestnet.js.map +1 -1
- package/_cjs/chains/definitions/turkchain.js +26 -0
- package/_cjs/chains/definitions/turkchain.js.map +1 -0
- package/_cjs/chains/definitions/zksync.js +1 -1
- package/_cjs/chains/definitions/zksync.js.map +1 -1
- package/_cjs/chains/index.js +4 -2
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/clients/transports/fallback.js +5 -0
- package/_cjs/clients/transports/fallback.js.map +1 -1
- package/_cjs/errors/node.js +10 -4
- package/_cjs/errors/node.js.map +1 -1
- package/_cjs/errors/typedData.js +4 -2
- package/_cjs/errors/typedData.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +5 -4
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/Account.js +85 -12
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Formatters.js +4 -1
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/Relay.js +5 -0
- package/_cjs/tempo/Relay.js.map +1 -1
- package/_cjs/tempo/Transaction.js +2 -1
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +10 -13
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/internal/relay/autoSwap.js +200 -0
- package/_cjs/tempo/internal/relay/autoSwap.js.map +1 -0
- package/_cjs/tempo/internal/relay/error.js +5 -1
- package/_cjs/tempo/internal/relay/error.js.map +1 -1
- package/_cjs/tempo/internal/relay/feePayer.js +18 -5
- package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
- package/_cjs/tempo/internal/relay/feeToken.js +14 -1
- package/_cjs/tempo/internal/relay/feeToken.js.map +1 -1
- package/_cjs/tempo/internal/relay/simulate.js +57 -15
- package/_cjs/tempo/internal/relay/simulate.js.map +1 -1
- package/_cjs/utils/abi/decodeEventLog.js +57 -7
- package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
- package/_cjs/utils/abi/getAbiItem.js +27 -6
- package/_cjs/utils/abi/getAbiItem.js.map +1 -1
- package/_cjs/utils/abi/parseEventLogs.js +27 -4
- package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
- package/_cjs/utils/authorization/recoverAuthorizationAddress.js +9 -2
- package/_cjs/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
- package/_cjs/utils/authorization/verifyAuthorization.js +14 -4
- package/_cjs/utils/authorization/verifyAuthorization.js.map +1 -1
- package/_cjs/utils/ccip.js +134 -28
- package/_cjs/utils/ccip.js.map +1 -1
- package/_cjs/utils/ccipTunnel.js +5 -1
- package/_cjs/utils/ccipTunnel.js.map +1 -1
- package/_cjs/utils/ens/localBatchGatewayRequest.js +55 -5
- package/_cjs/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_cjs/utils/internal/http.js +79 -0
- package/_cjs/utils/internal/http.js.map +1 -0
- package/_cjs/utils/nonceManager.js.map +1 -1
- package/_cjs/utils/rpc/http.js +3 -73
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/transaction/assertRequest.js +2 -2
- package/_cjs/utils/transaction/assertRequest.js.map +1 -1
- package/_cjs/utils/transaction/assertTransaction.js +2 -2
- package/_cjs/utils/transaction/assertTransaction.js.map +1 -1
- package/_cjs/utils/transaction/parseTransaction.js +21 -7
- package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
- package/_cjs/utils/typedData.js +19 -6
- package/_cjs/utils/typedData.js.map +1 -1
- package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
- package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
- package/_esm/actions/public/estimateGas.js +10 -5
- package/_esm/actions/public/estimateGas.js.map +1 -1
- package/_esm/actions/public/fillTransaction.js +2 -0
- package/_esm/actions/public/fillTransaction.js.map +1 -1
- package/_esm/actions/public/getFilterChanges.js +1 -0
- package/_esm/actions/public/getFilterChanges.js.map +1 -1
- package/_esm/actions/public/getFilterLogs.js +1 -0
- package/_esm/actions/public/getFilterLogs.js.map +1 -1
- package/_esm/actions/public/watchBlockNumber.js +5 -1
- package/_esm/actions/public/watchBlockNumber.js.map +1 -1
- package/_esm/actions/public/watchBlocks.js +28 -8
- package/_esm/actions/public/watchBlocks.js.map +1 -1
- package/_esm/actions/public/watchContractEvent.js +15 -5
- package/_esm/actions/public/watchContractEvent.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +11 -2
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +3 -2
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +6 -2
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/sendTransactionSync.js +59 -8
- package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_esm/chains/definitions/hashKeyChain.js +4 -4
- package/_esm/chains/definitions/hashKeyChain.js.map +1 -1
- package/_esm/chains/definitions/hashkeyChainTestnet.js +4 -4
- package/_esm/chains/definitions/hashkeyChainTestnet.js.map +1 -1
- package/_esm/chains/definitions/turkchain.js +23 -0
- package/_esm/chains/definitions/turkchain.js.map +1 -0
- package/_esm/chains/definitions/zksync.js +1 -1
- package/_esm/chains/definitions/zksync.js.map +1 -1
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/clients/transports/fallback.js +8 -0
- package/_esm/clients/transports/fallback.js.map +1 -1
- package/_esm/errors/node.js +10 -4
- package/_esm/errors/node.js.map +1 -1
- package/_esm/errors/typedData.js +5 -2
- package/_esm/errors/typedData.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/Account.js +122 -11
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Formatters.js +5 -2
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/Relay.js +20 -0
- package/_esm/tempo/Relay.js.map +1 -1
- package/_esm/tempo/Transaction.js +2 -0
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/chainConfig.js +20 -14
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/internal/relay/autoSwap.js +218 -0
- package/_esm/tempo/internal/relay/autoSwap.js.map +1 -0
- package/_esm/tempo/internal/relay/error.js +6 -2
- package/_esm/tempo/internal/relay/error.js.map +1 -1
- package/_esm/tempo/internal/relay/feePayer.js +24 -7
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
- package/_esm/tempo/internal/relay/feeToken.js +17 -3
- package/_esm/tempo/internal/relay/feeToken.js.map +1 -1
- package/_esm/tempo/internal/relay/simulate.js +68 -17
- package/_esm/tempo/internal/relay/simulate.js.map +1 -1
- package/_esm/utils/abi/decodeEventLog.js +69 -7
- package/_esm/utils/abi/decodeEventLog.js.map +1 -1
- package/_esm/utils/abi/getAbiItem.js +34 -6
- package/_esm/utils/abi/getAbiItem.js.map +1 -1
- package/_esm/utils/abi/parseEventLogs.js +43 -10
- package/_esm/utils/abi/parseEventLogs.js.map +1 -1
- package/_esm/utils/authorization/recoverAuthorizationAddress.js +11 -2
- package/_esm/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
- package/_esm/utils/authorization/verifyAuthorization.js +15 -4
- package/_esm/utils/authorization/verifyAuthorization.js.map +1 -1
- package/_esm/utils/ccip.js +163 -31
- package/_esm/utils/ccip.js.map +1 -1
- package/_esm/utils/ccipTunnel.js +5 -1
- package/_esm/utils/ccipTunnel.js.map +1 -1
- package/_esm/utils/ens/localBatchGatewayRequest.js +69 -4
- package/_esm/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_esm/utils/internal/http.js +83 -0
- package/_esm/utils/internal/http.js.map +1 -0
- package/_esm/utils/nonceManager.js.map +1 -1
- package/_esm/utils/rpc/http.js +1 -75
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/transaction/assertRequest.js +2 -2
- package/_esm/utils/transaction/assertRequest.js.map +1 -1
- package/_esm/utils/transaction/assertTransaction.js +2 -2
- package/_esm/utils/transaction/assertTransaction.js.map +1 -1
- package/_esm/utils/transaction/parseTransaction.js +24 -7
- package/_esm/utils/transaction/parseTransaction.js.map +1 -1
- package/_esm/utils/typedData.js +25 -8
- package/_esm/utils/typedData.js.map +1 -1
- package/_types/account-abstraction/utils/formatters/userOperationReceipt.d.ts.map +1 -1
- package/_types/actions/public/estimateGas.d.ts.map +1 -1
- package/_types/actions/public/fillTransaction.d.ts.map +1 -1
- package/_types/actions/public/getFilterChanges.d.ts.map +1 -1
- package/_types/actions/public/getFilterLogs.d.ts.map +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts +6 -2
- package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
- package/_types/actions/public/watchBlocks.d.ts +7 -2
- package/_types/actions/public/watchBlocks.d.ts.map +1 -1
- package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
- package/_types/chains/definitions/hashKeyChain.d.ts +4 -4
- package/_types/chains/definitions/hashkeyChainTestnet.d.ts +4 -4
- package/_types/chains/definitions/turkchain.d.ts +53 -0
- package/_types/chains/definitions/turkchain.d.ts.map +1 -0
- package/_types/chains/definitions/zksync.d.ts +1 -1
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts +6 -0
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/clients/transports/fallback.d.ts.map +1 -1
- package/_types/errors/node.d.ts.map +1 -1
- package/_types/errors/typedData.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +78 -5
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Capabilities.d.ts +32 -2
- package/_types/tempo/Capabilities.d.ts.map +1 -1
- package/_types/tempo/Relay.d.ts +27 -1
- package/_types/tempo/Relay.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +2 -0
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/actions/accessKey.d.ts +2 -2
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/internal/relay/autoSwap.d.ts +3 -0
- package/_types/tempo/internal/relay/autoSwap.d.ts.map +1 -0
- package/_types/tempo/internal/relay/error.d.ts.map +1 -1
- package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
- package/_types/tempo/internal/relay/feeToken.d.ts.map +1 -1
- package/_types/tempo/internal/relay/simulate.d.ts +4 -0
- package/_types/tempo/internal/relay/simulate.d.ts.map +1 -1
- package/_types/tempo/internal/relay/utils.d.ts +8 -8
- package/_types/utils/abi/decodeEventLog.d.ts +13 -1
- package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
- package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
- package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
- package/_types/utils/authorization/recoverAuthorizationAddress.d.ts +2 -1
- package/_types/utils/authorization/recoverAuthorizationAddress.d.ts.map +1 -1
- package/_types/utils/authorization/verifyAuthorization.d.ts.map +1 -1
- package/_types/utils/ccip.d.ts +24 -4
- package/_types/utils/ccip.d.ts.map +1 -1
- package/_types/utils/ccipTunnel.d.ts.map +1 -1
- package/_types/utils/ens/localBatchGatewayRequest.d.ts +26 -0
- package/_types/utils/ens/localBatchGatewayRequest.d.ts.map +1 -1
- package/_types/utils/internal/http.d.ts +16 -0
- package/_types/utils/internal/http.d.ts.map +1 -0
- package/_types/utils/nonceManager.d.ts +15 -1
- package/_types/utils/nonceManager.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
- package/_types/utils/typedData.d.ts.map +1 -1
- package/account-abstraction/utils/formatters/userOperationReceipt.ts +1 -0
- package/actions/public/estimateGas.ts +12 -5
- package/actions/public/fillTransaction.ts +2 -0
- package/actions/public/getFilterChanges.ts +1 -0
- package/actions/public/getFilterLogs.ts +1 -0
- package/actions/public/watchBlockNumber.ts +11 -2
- package/actions/public/watchBlocks.ts +46 -14
- package/actions/public/watchContractEvent.ts +22 -4
- package/actions/public/watchEvent.ts +17 -1
- package/actions/wallet/prepareTransactionRequest.ts +6 -2
- package/actions/wallet/sendTransaction.ts +9 -3
- package/actions/wallet/sendTransactionSync.ts +74 -12
- package/chains/definitions/hashKeyChain.ts +4 -4
- package/chains/definitions/hashkeyChainTestnet.ts +4 -4
- package/chains/definitions/turkchain.ts +23 -0
- package/chains/definitions/zksync.ts +1 -1
- package/chains/index.ts +1 -0
- package/clients/createClient.ts +6 -0
- package/clients/transports/fallback.ts +11 -0
- package/errors/node.ts +11 -5
- package/errors/typedData.ts +5 -2
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/package.json +1 -1
- package/tempo/Account.ts +203 -17
- package/tempo/Capabilities.ts +34 -2
- package/tempo/Formatters.ts +5 -5
- package/tempo/Relay.ts +32 -1
- package/tempo/Transaction.ts +3 -0
- package/tempo/actions/accessKey.ts +2 -2
- package/tempo/chainConfig.ts +22 -14
- package/tempo/internal/relay/autoSwap.ts +263 -0
- package/tempo/internal/relay/error.ts +7 -2
- package/tempo/internal/relay/feePayer.ts +30 -7
- package/tempo/internal/relay/feeToken.ts +21 -3
- package/tempo/internal/relay/simulate.ts +106 -19
- package/utils/abi/decodeEventLog.ts +97 -10
- package/utils/abi/getAbiItem.ts +35 -5
- package/utils/abi/parseEventLogs.ts +48 -11
- package/utils/authorization/recoverAuthorizationAddress.ts +18 -2
- package/utils/authorization/verifyAuthorization.ts +12 -7
- package/utils/ccip.ts +199 -33
- package/utils/ccipTunnel.ts +5 -1
- package/utils/ens/localBatchGatewayRequest.ts +82 -4
- package/utils/internal/http.ts +92 -0
- package/utils/nonceManager.ts +16 -1
- package/utils/rpc/http.ts +1 -83
- package/utils/transaction/assertRequest.ts +2 -2
- package/utils/transaction/assertTransaction.ts +2 -2
- package/utils/transaction/parseTransaction.ts +32 -7
- package/utils/typedData.ts +31 -8
|
@@ -38,7 +38,11 @@ export type WatchBlockNumberParameters<
|
|
|
38
38
|
}
|
|
39
39
|
: never)
|
|
40
40
|
| {
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Whether or not to emit the missed block numbers to the callback.
|
|
43
|
+
* Defaults to `true` when the polling interval is longer than half the
|
|
44
|
+
* chain's block time, otherwise `false`.
|
|
45
|
+
*/
|
|
42
46
|
emitMissed?: boolean | undefined
|
|
43
47
|
/** Whether or not to emit the latest block number to the callback when the subscription opens. */
|
|
44
48
|
emitOnBegin?: boolean | undefined
|
|
@@ -84,7 +88,7 @@ export function watchBlockNumber<
|
|
|
84
88
|
client: Client<transport, chain>,
|
|
85
89
|
{
|
|
86
90
|
emitOnBegin = false,
|
|
87
|
-
emitMissed
|
|
91
|
+
emitMissed: emitMissed_,
|
|
88
92
|
onBlockNumber,
|
|
89
93
|
onError,
|
|
90
94
|
poll: poll_,
|
|
@@ -106,6 +110,11 @@ export function watchBlockNumber<
|
|
|
106
110
|
return false
|
|
107
111
|
return true
|
|
108
112
|
})()
|
|
113
|
+
// Polling less than twice per block skips blocks, so emit the missed
|
|
114
|
+
// ones unless told otherwise.
|
|
115
|
+
const blockTime = client.chain?.blockTime
|
|
116
|
+
const emitMissed =
|
|
117
|
+
emitMissed_ ?? (blockTime !== undefined && pollingInterval > blockTime / 2)
|
|
109
118
|
|
|
110
119
|
let prevBlockNumber: GetBlockNumberReturnType | undefined
|
|
111
120
|
|
|
@@ -51,7 +51,12 @@ export type WatchBlocksParameters<
|
|
|
51
51
|
| {
|
|
52
52
|
/** The block tag. Defaults to "latest". */
|
|
53
53
|
blockTag?: blockTag | BlockTag | undefined
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Whether or not to emit the missed blocks to the callback.
|
|
56
|
+
* Defaults to `true` when `blockTag` is `latest` or `pending` and the
|
|
57
|
+
* polling interval is longer than half the chain's block time,
|
|
58
|
+
* otherwise `false`. The default skips gaps of more than 100 blocks.
|
|
59
|
+
*/
|
|
55
60
|
emitMissed?: boolean | undefined
|
|
56
61
|
/** Whether or not to emit the block to the callback when the subscription opens. */
|
|
57
62
|
emitOnBegin?: boolean | undefined
|
|
@@ -104,7 +109,7 @@ export function watchBlocks<
|
|
|
104
109
|
client: Client<transport, chain>,
|
|
105
110
|
{
|
|
106
111
|
blockTag = client.experimental_blockTag ?? 'latest',
|
|
107
|
-
emitMissed
|
|
112
|
+
emitMissed: emitMissed_,
|
|
108
113
|
emitOnBegin = false,
|
|
109
114
|
onBlock,
|
|
110
115
|
onError,
|
|
@@ -129,6 +134,19 @@ export function watchBlocks<
|
|
|
129
134
|
return true
|
|
130
135
|
})()
|
|
131
136
|
const includeTransactions = includeTransactions_ ?? false
|
|
137
|
+
// Polling less than twice per block skips blocks, so emit the missed
|
|
138
|
+
// ones unless told otherwise. `safe` and `finalized` can move by
|
|
139
|
+
// thousands of blocks at once (such as on Arbitrum) at any polling
|
|
140
|
+
// interval, so they emit missed blocks only when asked.
|
|
141
|
+
const blockTime = client.chain?.blockTime
|
|
142
|
+
const emitMissed =
|
|
143
|
+
emitMissed_ ??
|
|
144
|
+
((blockTag === 'latest' || blockTag === 'pending') &&
|
|
145
|
+
blockTime !== undefined &&
|
|
146
|
+
pollingInterval > blockTime / 2)
|
|
147
|
+
// The default catches up at most 100 blocks, so a long gap, such as a
|
|
148
|
+
// device waking from sleep, skips to the latest block.
|
|
149
|
+
const maxMissed = emitMissed_ === undefined ? 100 : Number.POSITIVE_INFINITY
|
|
132
150
|
|
|
133
151
|
let prevBlock:
|
|
134
152
|
| GetBlockReturnType<chain, false | includeTransactions, 'latest'>
|
|
@@ -142,6 +160,7 @@ export function watchBlocks<
|
|
|
142
160
|
emitMissed,
|
|
143
161
|
emitOnBegin,
|
|
144
162
|
includeTransactions,
|
|
163
|
+
maxMissed,
|
|
145
164
|
pollingInterval,
|
|
146
165
|
])
|
|
147
166
|
|
|
@@ -164,18 +183,31 @@ export function watchBlocks<
|
|
|
164
183
|
|
|
165
184
|
// If we have missed out on some previous blocks, and the
|
|
166
185
|
// `emitMissed` flag is truthy, let's emit those blocks.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
// Fetch them in parallel batches so catching up takes a few
|
|
187
|
+
// round trips rather than one per block.
|
|
188
|
+
const missed = Number(block.number - prevBlock.number) - 1
|
|
189
|
+
if (missed > 0 && missed <= maxMissed && emitMissed) {
|
|
190
|
+
const batchSize = 10
|
|
191
|
+
const start = prevBlock.number + 1n
|
|
192
|
+
for (let i = 0; i < missed; i += batchSize) {
|
|
193
|
+
const blocks = await Promise.all(
|
|
194
|
+
Array.from(
|
|
195
|
+
{ length: Math.min(batchSize, missed - i) },
|
|
196
|
+
(_, j) =>
|
|
197
|
+
getAction(
|
|
198
|
+
client,
|
|
199
|
+
getBlock,
|
|
200
|
+
'getBlock',
|
|
201
|
+
)({
|
|
202
|
+
blockNumber: start + BigInt(i + j),
|
|
203
|
+
includeTransactions,
|
|
204
|
+
}),
|
|
205
|
+
),
|
|
206
|
+
)
|
|
207
|
+
for (const block of blocks) {
|
|
208
|
+
emit.onBlock(block as any, prevBlock as any)
|
|
209
|
+
prevBlock = block as any
|
|
210
|
+
}
|
|
179
211
|
}
|
|
180
212
|
}
|
|
181
213
|
}
|
|
@@ -3,6 +3,8 @@ import type { Abi, Address, ExtractAbiEvent } from 'abitype'
|
|
|
3
3
|
import type { Client } from '../../clients/createClient.js'
|
|
4
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
|
5
5
|
import {
|
|
6
|
+
AbiEventSignatureEmptyTopicsError,
|
|
7
|
+
AbiEventSignatureNotFoundError,
|
|
6
8
|
DecodeLogDataMismatch,
|
|
7
9
|
DecodeLogTopicsMismatch,
|
|
8
10
|
} from '../../errors/abi.js'
|
|
@@ -20,7 +22,10 @@ import type { Filter } from '../../types/filter.js'
|
|
|
20
22
|
import type { Log } from '../../types/log.js'
|
|
21
23
|
import type { LogTopic } from '../../types/misc.js'
|
|
22
24
|
import type { GetPollOptions } from '../../types/transport.js'
|
|
23
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
AbiEventAmbiguityError,
|
|
27
|
+
decodeEventLog,
|
|
28
|
+
} from '../../utils/abi/decodeEventLog.js'
|
|
24
29
|
import {
|
|
25
30
|
type EncodeEventTopicsParameters,
|
|
26
31
|
encodeEventTopics,
|
|
@@ -340,6 +345,11 @@ export function watchContractEvent<
|
|
|
340
345
|
return client.transport
|
|
341
346
|
})()
|
|
342
347
|
|
|
348
|
+
// A topic filter cannot select an anonymous event, so the
|
|
349
|
+
// subscription can deliver logs that match no requested event. Skip
|
|
350
|
+
// them when the watch names an event, as the polling path does.
|
|
351
|
+
const skipUnmatched = Boolean(eventName || strict_)
|
|
352
|
+
|
|
343
353
|
const topics: LogTopic[] = eventName
|
|
344
354
|
? encodeEventTopics({
|
|
345
355
|
abi: abi,
|
|
@@ -354,18 +364,26 @@ export function watchContractEvent<
|
|
|
354
364
|
if (!active) return
|
|
355
365
|
const log = data.result
|
|
356
366
|
try {
|
|
357
|
-
const
|
|
367
|
+
const decoded = decodeEventLog({
|
|
358
368
|
abi: abi,
|
|
359
369
|
data: log.data,
|
|
370
|
+
eventName,
|
|
360
371
|
topics: log.topics as any,
|
|
361
372
|
strict: strict_,
|
|
362
373
|
})
|
|
363
374
|
const formatted = formatLog(log, {
|
|
364
|
-
args,
|
|
365
|
-
eventName: eventName as string,
|
|
375
|
+
args: decoded.args,
|
|
376
|
+
eventName: decoded.eventName as string,
|
|
366
377
|
})
|
|
367
378
|
emit.onLogs([formatted] as any)
|
|
368
379
|
} catch (err) {
|
|
380
|
+
if (
|
|
381
|
+
skipUnmatched &&
|
|
382
|
+
(err instanceof AbiEventAmbiguityError ||
|
|
383
|
+
err instanceof AbiEventSignatureEmptyTopicsError ||
|
|
384
|
+
err instanceof AbiEventSignatureNotFoundError)
|
|
385
|
+
)
|
|
386
|
+
return
|
|
369
387
|
let eventName: string | undefined
|
|
370
388
|
let isUnnamed: boolean | undefined
|
|
371
389
|
if (
|
|
@@ -3,6 +3,8 @@ import type { AbiEvent, Address } from 'abitype'
|
|
|
3
3
|
import type { Client } from '../../clients/createClient.js'
|
|
4
4
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
|
5
5
|
import {
|
|
6
|
+
AbiEventSignatureEmptyTopicsError,
|
|
7
|
+
AbiEventSignatureNotFoundError,
|
|
6
8
|
DecodeLogDataMismatch,
|
|
7
9
|
DecodeLogTopicsMismatch,
|
|
8
10
|
} from '../../errors/abi.js'
|
|
@@ -20,7 +22,10 @@ import type { Filter } from '../../types/filter.js'
|
|
|
20
22
|
import type { Log } from '../../types/log.js'
|
|
21
23
|
import type { LogTopic } from '../../types/misc.js'
|
|
22
24
|
import type { GetPollOptions } from '../../types/transport.js'
|
|
23
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
AbiEventAmbiguityError,
|
|
27
|
+
decodeEventLog,
|
|
28
|
+
} from '../../utils/abi/decodeEventLog.js'
|
|
24
29
|
import {
|
|
25
30
|
type EncodeEventTopicsParameters,
|
|
26
31
|
encodeEventTopics,
|
|
@@ -382,6 +387,17 @@ export function watchEvent<
|
|
|
382
387
|
const formatted = formatLog(log, { args, eventName })
|
|
383
388
|
onLogs([formatted] as any)
|
|
384
389
|
} catch (err) {
|
|
390
|
+
// A topic filter cannot select an anonymous event, so the
|
|
391
|
+
// subscription can deliver logs that match no requested event.
|
|
392
|
+
// Skip them when the watch names events, as the polling path
|
|
393
|
+
// does.
|
|
394
|
+
if (
|
|
395
|
+
(events_ || strict_) &&
|
|
396
|
+
(err instanceof AbiEventAmbiguityError ||
|
|
397
|
+
err instanceof AbiEventSignatureEmptyTopicsError ||
|
|
398
|
+
err instanceof AbiEventSignatureNotFoundError)
|
|
399
|
+
)
|
|
400
|
+
return
|
|
385
401
|
let eventName: string | undefined
|
|
386
402
|
let isUnnamed: boolean | undefined
|
|
387
403
|
if (
|
|
@@ -462,8 +462,12 @@ export async function prepareTransactionRequest<
|
|
|
462
462
|
feeToken !== null &&
|
|
463
463
|
(!('feeToken' in request) || hasFilledFeePayerSignature)
|
|
464
464
|
supportsFillTransaction.set(client.uid, true)
|
|
465
|
+
// The fee payer signs over the filled fee token, so a requested one must not replace or outlive it.
|
|
466
|
+
type WithFeeToken = { feeToken?: unknown }
|
|
467
|
+
const { feeToken: _feeToken, ...unsponsored } =
|
|
468
|
+
request as WithFeeToken
|
|
465
469
|
return {
|
|
466
|
-
...request,
|
|
470
|
+
...(hasFilledFeePayerSignature ? unsponsored : request),
|
|
467
471
|
...(from ? { from } : {}),
|
|
468
472
|
...(type && !request.type ? { type } : {}),
|
|
469
473
|
...(typeof chainId !== 'undefined' ? { chainId } : {}),
|
|
@@ -661,7 +665,7 @@ export async function prepareTransactionRequest<
|
|
|
661
665
|
|
|
662
666
|
if (
|
|
663
667
|
typeof request.maxPriorityFeePerGas === 'undefined' &&
|
|
664
|
-
request.maxFeePerGas &&
|
|
668
|
+
typeof request.maxFeePerGas === 'bigint' &&
|
|
665
669
|
request.maxFeePerGas < maxPriorityFeePerGas
|
|
666
670
|
)
|
|
667
671
|
throw new MaxFeePerGasTooLowError({
|
|
@@ -191,7 +191,9 @@ export async function sendTransaction<
|
|
|
191
191
|
docsPath: '/docs/actions/wallet/sendTransaction',
|
|
192
192
|
})
|
|
193
193
|
const account = account_ ? parseAccount(account_) : null
|
|
194
|
-
let nonceManagerParameters:
|
|
194
|
+
let nonceManagerParameters:
|
|
195
|
+
| { address: Address; chainId: number; nonce?: number | undefined }
|
|
196
|
+
| undefined
|
|
195
197
|
|
|
196
198
|
try {
|
|
197
199
|
assertRequest(parameters as AssertRequestParameters)
|
|
@@ -316,12 +318,16 @@ export async function sendTransaction<
|
|
|
316
318
|
return account.nonceManager
|
|
317
319
|
const nonceManager = account.nonceManager
|
|
318
320
|
return {
|
|
319
|
-
consume(parameters) {
|
|
321
|
+
async consume(parameters) {
|
|
320
322
|
nonceManagerParameters = {
|
|
321
323
|
address: parameters.address,
|
|
322
324
|
chainId: parameters.chainId,
|
|
323
325
|
}
|
|
324
|
-
|
|
326
|
+
const nonce = await nonceManager.consume(parameters)
|
|
327
|
+
// Pass the consumed nonce to `reset` so the manager can tell
|
|
328
|
+
// which `consume` a failed send follows.
|
|
329
|
+
nonceManagerParameters = { ...nonceManagerParameters, nonce }
|
|
330
|
+
return nonce
|
|
325
331
|
},
|
|
326
332
|
get(parameters) {
|
|
327
333
|
return nonceManager.get(parameters)
|
|
@@ -18,6 +18,7 @@ import { BaseError } from '../../errors/base.js'
|
|
|
18
18
|
import {
|
|
19
19
|
TransactionReceiptRevertedError,
|
|
20
20
|
type TransactionReceiptRevertedErrorType,
|
|
21
|
+
WaitForTransactionReceiptTimeoutError,
|
|
21
22
|
} from '../../errors/transaction.js'
|
|
22
23
|
import type { ErrorType } from '../../errors/utils.js'
|
|
23
24
|
import type { GetAccountParameter } from '../../types/account.js'
|
|
@@ -40,6 +41,9 @@ import {
|
|
|
40
41
|
assertCurrentChain,
|
|
41
42
|
} from '../../utils/chain/assertCurrentChain.js'
|
|
42
43
|
import { concat } from '../../utils/data/concat.js'
|
|
44
|
+
import { sliceHex } from '../../utils/data/slice.js'
|
|
45
|
+
import { fromRlp } from '../../utils/encoding/fromRlp.js'
|
|
46
|
+
import { toRlp } from '../../utils/encoding/toRlp.js'
|
|
43
47
|
import {
|
|
44
48
|
type GetTransactionErrorReturnType,
|
|
45
49
|
getTransactionError,
|
|
@@ -50,6 +54,8 @@ import {
|
|
|
50
54
|
formatTransactionRequest,
|
|
51
55
|
} from '../../utils/formatters/transactionRequest.js'
|
|
52
56
|
import { getAction } from '../../utils/getAction.js'
|
|
57
|
+
import { isHash } from '../../utils/hash/isHash.js'
|
|
58
|
+
import { keccak256 } from '../../utils/hash/keccak256.js'
|
|
53
59
|
import { LruMap } from '../../utils/lru.js'
|
|
54
60
|
import type { NonceManager } from '../../utils/nonceManager.js'
|
|
55
61
|
import {
|
|
@@ -214,7 +220,9 @@ export async function sendTransactionSync<
|
|
|
214
220
|
docsPath: '/docs/actions/wallet/sendTransactionSync',
|
|
215
221
|
})
|
|
216
222
|
const account = account_ ? parseAccount(account_) : null
|
|
217
|
-
let nonceManagerParameters:
|
|
223
|
+
let nonceManagerParameters:
|
|
224
|
+
| { address: Address; chainId: number; nonce?: number | undefined }
|
|
225
|
+
| undefined
|
|
218
226
|
|
|
219
227
|
try {
|
|
220
228
|
assertRequest(parameters as AssertRequestParameters)
|
|
@@ -355,12 +363,16 @@ export async function sendTransactionSync<
|
|
|
355
363
|
return account.nonceManager
|
|
356
364
|
const nonceManager = account.nonceManager
|
|
357
365
|
return {
|
|
358
|
-
consume(parameters) {
|
|
366
|
+
async consume(parameters) {
|
|
359
367
|
nonceManagerParameters = {
|
|
360
368
|
address: parameters.address,
|
|
361
369
|
chainId: parameters.chainId,
|
|
362
370
|
}
|
|
363
|
-
|
|
371
|
+
const nonce = await nonceManager.consume(parameters)
|
|
372
|
+
// Pass the consumed nonce to `reset` so the manager can tell
|
|
373
|
+
// which `consume` a failed send follows.
|
|
374
|
+
nonceManagerParameters = { ...nonceManagerParameters, nonce }
|
|
375
|
+
return nonce
|
|
364
376
|
},
|
|
365
377
|
get(parameters) {
|
|
366
378
|
return nonceManager.get(parameters)
|
|
@@ -415,15 +427,65 @@ export async function sendTransactionSync<
|
|
|
415
427
|
transaction: request as never,
|
|
416
428
|
})
|
|
417
429
|
: signedTransaction
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
430
|
+
const start = Date.now()
|
|
431
|
+
try {
|
|
432
|
+
return (await getAction(
|
|
433
|
+
client,
|
|
434
|
+
sendRawTransactionSync,
|
|
435
|
+
'sendRawTransactionSync',
|
|
436
|
+
)({
|
|
437
|
+
serializedTransaction,
|
|
438
|
+
throwOnReceiptRevert,
|
|
439
|
+
timeout: parameters.timeout,
|
|
440
|
+
})) as never
|
|
441
|
+
} catch (err) {
|
|
442
|
+
// The node accepted the transaction but stopped waiting for its
|
|
443
|
+
// receipt (EIP-7966).
|
|
444
|
+
const timeoutError =
|
|
445
|
+
err instanceof BaseError
|
|
446
|
+
? (err.walk((e) => (e as { code?: unknown } | null)?.code === 4) as
|
|
447
|
+
| (Error & { data?: unknown })
|
|
448
|
+
| null)
|
|
449
|
+
: null
|
|
450
|
+
if (!timeoutError) throw err
|
|
451
|
+
|
|
452
|
+
// The pending transaction holds the nonce, so keep it.
|
|
453
|
+
nonceManagerParameters = undefined
|
|
454
|
+
|
|
455
|
+
// Prefer the node's hash, since a relay (such as a fee payer) can
|
|
456
|
+
// change the bytes it broadcasts. Without one, derive it locally.
|
|
457
|
+
const hash = (() => {
|
|
458
|
+
const { data } = timeoutError
|
|
459
|
+
if (typeof data === 'string' && isHash(data)) return data
|
|
460
|
+
// An EIP-4844 network wrapper holds the signed payload, then the
|
|
461
|
+
// blobs, commitments, and proofs. The hash covers only the payload.
|
|
462
|
+
if (sliceHex(serializedTransaction, 0, 1) === '0x03') {
|
|
463
|
+
const fields = fromRlp(sliceHex(serializedTransaction, 1))
|
|
464
|
+
if (fields.length === 4 && Array.isArray(fields[0]))
|
|
465
|
+
return keccak256(concat(['0x03', toRlp(fields[0])]))
|
|
466
|
+
}
|
|
467
|
+
return keccak256(serializedTransaction)
|
|
468
|
+
})()
|
|
469
|
+
|
|
470
|
+
const remaining = timeout - (Date.now() - start)
|
|
471
|
+
// The node used up `timeout` before it answered.
|
|
472
|
+
if (remaining <= 0)
|
|
473
|
+
throw new WaitForTransactionReceiptTimeoutError({ hash })
|
|
474
|
+
|
|
475
|
+
const receipt = await getAction(
|
|
476
|
+
client,
|
|
477
|
+
waitForTransactionReceipt,
|
|
478
|
+
'waitForTransactionReceipt',
|
|
479
|
+
)({
|
|
480
|
+
checkReplacement: false,
|
|
481
|
+
hash,
|
|
482
|
+
pollingInterval,
|
|
483
|
+
timeout: remaining,
|
|
484
|
+
})
|
|
485
|
+
if (throwOnReceiptRevert && receipt.status === 'reverted')
|
|
486
|
+
throw new TransactionReceiptRevertedError({ receipt })
|
|
487
|
+
return receipt as never
|
|
488
|
+
}
|
|
427
489
|
}
|
|
428
490
|
|
|
429
491
|
if (account?.type === 'smart')
|
|
@@ -2,10 +2,10 @@ import { defineChain } from '../../utils/chain/defineChain.js'
|
|
|
2
2
|
|
|
3
3
|
export const hashkey = /*#__PURE__*/ defineChain({
|
|
4
4
|
id: 177,
|
|
5
|
-
name: '
|
|
5
|
+
name: 'HSKChain',
|
|
6
6
|
nativeCurrency: {
|
|
7
7
|
decimals: 18,
|
|
8
|
-
name: 'HashKey
|
|
8
|
+
name: 'HashKey Platform Token',
|
|
9
9
|
symbol: 'HSK',
|
|
10
10
|
},
|
|
11
11
|
rpcUrls: {
|
|
@@ -15,8 +15,8 @@ export const hashkey = /*#__PURE__*/ defineChain({
|
|
|
15
15
|
},
|
|
16
16
|
blockExplorers: {
|
|
17
17
|
default: {
|
|
18
|
-
name: '
|
|
19
|
-
url: 'https://
|
|
18
|
+
name: 'HSKChain Explorer',
|
|
19
|
+
url: 'https://hsk.blockscout.com',
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
contracts: {
|
|
@@ -2,10 +2,10 @@ import { defineChain } from '../../utils/chain/defineChain.js'
|
|
|
2
2
|
|
|
3
3
|
export const hashkeyTestnet = /*#__PURE__*/ defineChain({
|
|
4
4
|
id: 133,
|
|
5
|
-
name: '
|
|
5
|
+
name: 'HSKChain Testnet',
|
|
6
6
|
nativeCurrency: {
|
|
7
7
|
decimals: 18,
|
|
8
|
-
name: 'HashKey
|
|
8
|
+
name: 'HashKey Platform Token',
|
|
9
9
|
symbol: 'HSK',
|
|
10
10
|
},
|
|
11
11
|
rpcUrls: {
|
|
@@ -15,8 +15,8 @@ export const hashkeyTestnet = /*#__PURE__*/ defineChain({
|
|
|
15
15
|
},
|
|
16
16
|
blockExplorers: {
|
|
17
17
|
default: {
|
|
18
|
-
name: '
|
|
19
|
-
url: 'https://testnet-explorer.
|
|
18
|
+
name: 'HSKChain Testnet explorer',
|
|
19
|
+
url: 'https://testnet-explorer.hskchain.net',
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
testnet: true,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const turkchain = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 1919,
|
|
5
|
+
name: 'Turkchain',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'TC',
|
|
9
|
+
symbol: 'TURK',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: {
|
|
13
|
+
http: ['https://rpc.turkscan.com'],
|
|
14
|
+
webSocket: ['wss://evm-ws.turkscan.com'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
blockExplorers: {
|
|
18
|
+
default: {
|
|
19
|
+
name: 'TurkScan',
|
|
20
|
+
url: 'https://turkscan.com',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
})
|
|
@@ -21,7 +21,7 @@ export const zksync = /*#__PURE__*/ defineChain({
|
|
|
21
21
|
blockExplorers: {
|
|
22
22
|
default: {
|
|
23
23
|
name: 'ZKsync Explorer',
|
|
24
|
-
url: 'https://explorer.zksync.io
|
|
24
|
+
url: 'https://explorer.zksync.io',
|
|
25
25
|
apiUrl: 'https://block-explorer-api.mainnet.zksync.io/api',
|
|
26
26
|
},
|
|
27
27
|
},
|
package/chains/index.ts
CHANGED
|
@@ -689,6 +689,7 @@ export { treasureTopaz } from './definitions/treasureTopaz.js'
|
|
|
689
689
|
export { tron } from './definitions/tron.js'
|
|
690
690
|
export { tronNile } from './definitions/tronNile.js'
|
|
691
691
|
export { tronShasta } from './definitions/tronShasta.js'
|
|
692
|
+
export { turkchain } from './definitions/turkchain.js'
|
|
692
693
|
export { ubiq } from './definitions/ubiq.js'
|
|
693
694
|
export { ultra } from './definitions/ultra.js'
|
|
694
695
|
export { ultraTestnet } from './definitions/ultraTestnet.js'
|
package/clients/createClient.ts
CHANGED
|
@@ -62,6 +62,12 @@ export type ClientConfig<
|
|
|
62
62
|
/**
|
|
63
63
|
* [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration.
|
|
64
64
|
* If `false`, the client will not support offchain CCIP lookups.
|
|
65
|
+
*
|
|
66
|
+
* Gateway URLs must be HTTP(S). A lookup follows at most 4 nested callbacks
|
|
67
|
+
* and 4 nested local batches, and makes at most 256 gateway requests to
|
|
68
|
+
* contract-chosen URLs, 16 at a time. Each gateway request, including the
|
|
69
|
+
* response body, uses the transport timeout (default 10 seconds; the longest
|
|
70
|
+
* of a `fallback`'s transports) and reads at most 10 MiB.
|
|
65
71
|
*/
|
|
66
72
|
ccipRead?:
|
|
67
73
|
| {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseError } from '../../errors/base.js'
|
|
1
2
|
import { ExecutionRevertedError } from '../../errors/node.js'
|
|
2
3
|
import {
|
|
3
4
|
TransactionRejectedRpcError,
|
|
@@ -164,6 +165,16 @@ export function fallback<const transports extends readonly Transport[]>(
|
|
|
164
165
|
|
|
165
166
|
if (shouldThrow_(err as Error)) throw err
|
|
166
167
|
|
|
168
|
+
// The node accepted the transaction but stopped waiting for its
|
|
169
|
+
// receipt (EIP-7966), so do not send it to the next one. Custom
|
|
170
|
+
// transports wrap the provider's error, so check the causes too.
|
|
171
|
+
if (
|
|
172
|
+
method === 'eth_sendRawTransactionSync' &&
|
|
173
|
+
err instanceof BaseError &&
|
|
174
|
+
err.walk((e) => (e as { code?: unknown } | null)?.code === 4)
|
|
175
|
+
)
|
|
176
|
+
throw err
|
|
177
|
+
|
|
167
178
|
// If we've reached the end of the fallbacks, throw the error.
|
|
168
179
|
if (i === transports.length - 1) throw err
|
|
169
180
|
|
package/errors/node.ts
CHANGED
|
@@ -53,7 +53,9 @@ export class FeeCapTooHighError extends BaseError {
|
|
|
53
53
|
} = {}) {
|
|
54
54
|
super(
|
|
55
55
|
`The fee cap (\`maxFeePerGas\`${
|
|
56
|
-
|
|
56
|
+
typeof maxFeePerGas === 'bigint'
|
|
57
|
+
? ` = ${formatGwei(maxFeePerGas)} gwei`
|
|
58
|
+
: ''
|
|
57
59
|
}) cannot be higher than the maximum allowed value (2^256-1).`,
|
|
58
60
|
{
|
|
59
61
|
cause,
|
|
@@ -78,8 +80,10 @@ export class FeeCapTooLowError extends BaseError {
|
|
|
78
80
|
} = {}) {
|
|
79
81
|
super(
|
|
80
82
|
`The fee cap (\`maxFeePerGas\`${
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
typeof maxFeePerGas === 'bigint'
|
|
84
|
+
? ` = ${formatGwei(maxFeePerGas)} gwei`
|
|
85
|
+
: ''
|
|
86
|
+
}) cannot be lower than the block base fee.`,
|
|
83
87
|
{
|
|
84
88
|
cause,
|
|
85
89
|
name: 'FeeCapTooLowError',
|
|
@@ -249,11 +253,13 @@ export class TipAboveFeeCapError extends BaseError {
|
|
|
249
253
|
super(
|
|
250
254
|
[
|
|
251
255
|
`The provided tip (\`maxPriorityFeePerGas\`${
|
|
252
|
-
maxPriorityFeePerGas
|
|
256
|
+
typeof maxPriorityFeePerGas === 'bigint'
|
|
253
257
|
? ` = ${formatGwei(maxPriorityFeePerGas)} gwei`
|
|
254
258
|
: ''
|
|
255
259
|
}) cannot be higher than the fee cap (\`maxFeePerGas\`${
|
|
256
|
-
|
|
260
|
+
typeof maxFeePerGas === 'bigint'
|
|
261
|
+
? ` = ${formatGwei(maxFeePerGas)} gwei`
|
|
262
|
+
: ''
|
|
257
263
|
}).`,
|
|
258
264
|
].join('\n'),
|
|
259
265
|
{
|
package/errors/typedData.ts
CHANGED
|
@@ -51,9 +51,12 @@ export type InvalidTypedDataTypeErrorType = InvalidTypedDataTypeError & {
|
|
|
51
51
|
}
|
|
52
52
|
export class InvalidTypedDataTypeError extends BaseError {
|
|
53
53
|
constructor({ type }: { type: string }) {
|
|
54
|
-
|
|
54
|
+
// Suggest the canonical type only for the `int`/`uint` aliases.
|
|
55
|
+
const isAlias = /^u?int(\[[0-9]*\])*$/.test(type)
|
|
55
56
|
super(`Type "${type}" is not a valid EIP-712 type.`, {
|
|
56
|
-
metaMessages:
|
|
57
|
+
metaMessages: isAlias
|
|
58
|
+
? [`Use "${type.replace(/^(u?int)/, '$&256')}" instead.`]
|
|
59
|
+
: undefined,
|
|
57
60
|
name: 'InvalidTypedDataTypeError',
|
|
58
61
|
})
|
|
59
62
|
}
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.57.
|
|
1
|
+
export const version = '2.57.15'
|
package/index.ts
CHANGED
|
@@ -1350,6 +1350,8 @@ export {
|
|
|
1350
1350
|
decodeErrorResult,
|
|
1351
1351
|
} from './utils/abi/decodeErrorResult.js'
|
|
1352
1352
|
export {
|
|
1353
|
+
AbiEventAmbiguityError,
|
|
1354
|
+
type AbiEventAmbiguityErrorType,
|
|
1353
1355
|
type DecodeEventLogErrorType,
|
|
1354
1356
|
type DecodeEventLogParameters,
|
|
1355
1357
|
type DecodeEventLogReturnType,
|