viem 2.57.14 → 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.
Files changed (264) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
  3. package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
  4. package/_cjs/actions/public/estimateGas.js +5 -2
  5. package/_cjs/actions/public/estimateGas.js.map +1 -1
  6. package/_cjs/actions/public/fillTransaction.js +2 -0
  7. package/_cjs/actions/public/fillTransaction.js.map +1 -1
  8. package/_cjs/actions/public/getFilterChanges.js +1 -0
  9. package/_cjs/actions/public/getFilterChanges.js.map +1 -1
  10. package/_cjs/actions/public/getFilterLogs.js +1 -0
  11. package/_cjs/actions/public/getFilterLogs.js.map +1 -1
  12. package/_cjs/actions/public/watchBlockNumber.js +3 -1
  13. package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
  14. package/_cjs/actions/public/watchBlocks.js +20 -8
  15. package/_cjs/actions/public/watchBlocks.js.map +1 -1
  16. package/_cjs/actions/public/watchContractEvent.js +10 -3
  17. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  18. package/_cjs/actions/public/watchEvent.js +5 -0
  19. package/_cjs/actions/public/watchEvent.js.map +1 -1
  20. package/_cjs/actions/wallet/prepareTransactionRequest.js +3 -2
  21. package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
  22. package/_cjs/actions/wallet/sendTransaction.js +4 -2
  23. package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
  24. package/_cjs/actions/wallet/sendTransactionSync.js +48 -7
  25. package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
  26. package/_cjs/chains/definitions/hashKeyChain.js +4 -4
  27. package/_cjs/chains/definitions/hashKeyChain.js.map +1 -1
  28. package/_cjs/chains/definitions/hashkeyChainTestnet.js +4 -4
  29. package/_cjs/chains/definitions/hashkeyChainTestnet.js.map +1 -1
  30. package/_cjs/chains/definitions/turkchain.js +26 -0
  31. package/_cjs/chains/definitions/turkchain.js.map +1 -0
  32. package/_cjs/chains/definitions/zksync.js +1 -1
  33. package/_cjs/chains/definitions/zksync.js.map +1 -1
  34. package/_cjs/chains/index.js +4 -2
  35. package/_cjs/chains/index.js.map +1 -1
  36. package/_cjs/clients/createClient.js.map +1 -1
  37. package/_cjs/clients/transports/fallback.js +5 -0
  38. package/_cjs/clients/transports/fallback.js.map +1 -1
  39. package/_cjs/errors/node.js +10 -4
  40. package/_cjs/errors/node.js.map +1 -1
  41. package/_cjs/errors/typedData.js +4 -2
  42. package/_cjs/errors/typedData.js.map +1 -1
  43. package/_cjs/errors/version.js +1 -1
  44. package/_cjs/index.js +5 -4
  45. package/_cjs/index.js.map +1 -1
  46. package/_cjs/tempo/Account.js +85 -12
  47. package/_cjs/tempo/Account.js.map +1 -1
  48. package/_cjs/tempo/Transaction.js +2 -1
  49. package/_cjs/tempo/Transaction.js.map +1 -1
  50. package/_cjs/tempo/chainConfig.js +4 -12
  51. package/_cjs/tempo/chainConfig.js.map +1 -1
  52. package/_cjs/tempo/internal/relay/feePayer.js +18 -5
  53. package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
  54. package/_cjs/utils/abi/decodeEventLog.js +57 -7
  55. package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
  56. package/_cjs/utils/abi/getAbiItem.js +27 -6
  57. package/_cjs/utils/abi/getAbiItem.js.map +1 -1
  58. package/_cjs/utils/abi/parseEventLogs.js +27 -4
  59. package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
  60. package/_cjs/utils/authorization/recoverAuthorizationAddress.js +9 -2
  61. package/_cjs/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
  62. package/_cjs/utils/authorization/verifyAuthorization.js +14 -4
  63. package/_cjs/utils/authorization/verifyAuthorization.js.map +1 -1
  64. package/_cjs/utils/ccip.js +134 -28
  65. package/_cjs/utils/ccip.js.map +1 -1
  66. package/_cjs/utils/ccipTunnel.js +5 -1
  67. package/_cjs/utils/ccipTunnel.js.map +1 -1
  68. package/_cjs/utils/ens/localBatchGatewayRequest.js +55 -5
  69. package/_cjs/utils/ens/localBatchGatewayRequest.js.map +1 -1
  70. package/_cjs/utils/internal/http.js +79 -0
  71. package/_cjs/utils/internal/http.js.map +1 -0
  72. package/_cjs/utils/nonceManager.js.map +1 -1
  73. package/_cjs/utils/rpc/http.js +3 -73
  74. package/_cjs/utils/rpc/http.js.map +1 -1
  75. package/_cjs/utils/transaction/assertRequest.js +2 -2
  76. package/_cjs/utils/transaction/assertRequest.js.map +1 -1
  77. package/_cjs/utils/transaction/assertTransaction.js +2 -2
  78. package/_cjs/utils/transaction/assertTransaction.js.map +1 -1
  79. package/_cjs/utils/transaction/parseTransaction.js +21 -7
  80. package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
  81. package/_cjs/utils/typedData.js +19 -6
  82. package/_cjs/utils/typedData.js.map +1 -1
  83. package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
  84. package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
  85. package/_esm/actions/public/estimateGas.js +10 -5
  86. package/_esm/actions/public/estimateGas.js.map +1 -1
  87. package/_esm/actions/public/fillTransaction.js +2 -0
  88. package/_esm/actions/public/fillTransaction.js.map +1 -1
  89. package/_esm/actions/public/getFilterChanges.js +1 -0
  90. package/_esm/actions/public/getFilterChanges.js.map +1 -1
  91. package/_esm/actions/public/getFilterLogs.js +1 -0
  92. package/_esm/actions/public/getFilterLogs.js.map +1 -1
  93. package/_esm/actions/public/watchBlockNumber.js +5 -1
  94. package/_esm/actions/public/watchBlockNumber.js.map +1 -1
  95. package/_esm/actions/public/watchBlocks.js +28 -8
  96. package/_esm/actions/public/watchBlocks.js.map +1 -1
  97. package/_esm/actions/public/watchContractEvent.js +15 -5
  98. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  99. package/_esm/actions/public/watchEvent.js +11 -2
  100. package/_esm/actions/public/watchEvent.js.map +1 -1
  101. package/_esm/actions/wallet/prepareTransactionRequest.js +3 -2
  102. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  103. package/_esm/actions/wallet/sendTransaction.js +6 -2
  104. package/_esm/actions/wallet/sendTransaction.js.map +1 -1
  105. package/_esm/actions/wallet/sendTransactionSync.js +59 -8
  106. package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
  107. package/_esm/chains/definitions/hashKeyChain.js +4 -4
  108. package/_esm/chains/definitions/hashKeyChain.js.map +1 -1
  109. package/_esm/chains/definitions/hashkeyChainTestnet.js +4 -4
  110. package/_esm/chains/definitions/hashkeyChainTestnet.js.map +1 -1
  111. package/_esm/chains/definitions/turkchain.js +23 -0
  112. package/_esm/chains/definitions/turkchain.js.map +1 -0
  113. package/_esm/chains/definitions/zksync.js +1 -1
  114. package/_esm/chains/definitions/zksync.js.map +1 -1
  115. package/_esm/chains/index.js +1 -0
  116. package/_esm/chains/index.js.map +1 -1
  117. package/_esm/clients/createClient.js.map +1 -1
  118. package/_esm/clients/transports/fallback.js +8 -0
  119. package/_esm/clients/transports/fallback.js.map +1 -1
  120. package/_esm/errors/node.js +10 -4
  121. package/_esm/errors/node.js.map +1 -1
  122. package/_esm/errors/typedData.js +5 -2
  123. package/_esm/errors/typedData.js.map +1 -1
  124. package/_esm/errors/version.js +1 -1
  125. package/_esm/index.js +1 -1
  126. package/_esm/index.js.map +1 -1
  127. package/_esm/tempo/Account.js +122 -11
  128. package/_esm/tempo/Account.js.map +1 -1
  129. package/_esm/tempo/Transaction.js +2 -0
  130. package/_esm/tempo/Transaction.js.map +1 -1
  131. package/_esm/tempo/chainConfig.js +13 -15
  132. package/_esm/tempo/chainConfig.js.map +1 -1
  133. package/_esm/tempo/internal/relay/feePayer.js +24 -7
  134. package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
  135. package/_esm/utils/abi/decodeEventLog.js +69 -7
  136. package/_esm/utils/abi/decodeEventLog.js.map +1 -1
  137. package/_esm/utils/abi/getAbiItem.js +34 -6
  138. package/_esm/utils/abi/getAbiItem.js.map +1 -1
  139. package/_esm/utils/abi/parseEventLogs.js +43 -10
  140. package/_esm/utils/abi/parseEventLogs.js.map +1 -1
  141. package/_esm/utils/authorization/recoverAuthorizationAddress.js +11 -2
  142. package/_esm/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
  143. package/_esm/utils/authorization/verifyAuthorization.js +15 -4
  144. package/_esm/utils/authorization/verifyAuthorization.js.map +1 -1
  145. package/_esm/utils/ccip.js +163 -31
  146. package/_esm/utils/ccip.js.map +1 -1
  147. package/_esm/utils/ccipTunnel.js +5 -1
  148. package/_esm/utils/ccipTunnel.js.map +1 -1
  149. package/_esm/utils/ens/localBatchGatewayRequest.js +69 -4
  150. package/_esm/utils/ens/localBatchGatewayRequest.js.map +1 -1
  151. package/_esm/utils/internal/http.js +83 -0
  152. package/_esm/utils/internal/http.js.map +1 -0
  153. package/_esm/utils/nonceManager.js.map +1 -1
  154. package/_esm/utils/rpc/http.js +1 -75
  155. package/_esm/utils/rpc/http.js.map +1 -1
  156. package/_esm/utils/transaction/assertRequest.js +2 -2
  157. package/_esm/utils/transaction/assertRequest.js.map +1 -1
  158. package/_esm/utils/transaction/assertTransaction.js +2 -2
  159. package/_esm/utils/transaction/assertTransaction.js.map +1 -1
  160. package/_esm/utils/transaction/parseTransaction.js +24 -7
  161. package/_esm/utils/transaction/parseTransaction.js.map +1 -1
  162. package/_esm/utils/typedData.js +25 -8
  163. package/_esm/utils/typedData.js.map +1 -1
  164. package/_types/account-abstraction/utils/formatters/userOperationReceipt.d.ts.map +1 -1
  165. package/_types/actions/public/estimateGas.d.ts.map +1 -1
  166. package/_types/actions/public/fillTransaction.d.ts.map +1 -1
  167. package/_types/actions/public/getFilterChanges.d.ts.map +1 -1
  168. package/_types/actions/public/getFilterLogs.d.ts.map +1 -1
  169. package/_types/actions/public/watchBlockNumber.d.ts +6 -2
  170. package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
  171. package/_types/actions/public/watchBlocks.d.ts +7 -2
  172. package/_types/actions/public/watchBlocks.d.ts.map +1 -1
  173. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  174. package/_types/actions/public/watchEvent.d.ts.map +1 -1
  175. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  176. package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
  177. package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
  178. package/_types/chains/definitions/hashKeyChain.d.ts +4 -4
  179. package/_types/chains/definitions/hashkeyChainTestnet.d.ts +4 -4
  180. package/_types/chains/definitions/turkchain.d.ts +53 -0
  181. package/_types/chains/definitions/turkchain.d.ts.map +1 -0
  182. package/_types/chains/definitions/zksync.d.ts +1 -1
  183. package/_types/chains/index.d.ts +1 -0
  184. package/_types/chains/index.d.ts.map +1 -1
  185. package/_types/clients/createClient.d.ts +6 -0
  186. package/_types/clients/createClient.d.ts.map +1 -1
  187. package/_types/clients/transports/fallback.d.ts.map +1 -1
  188. package/_types/errors/node.d.ts.map +1 -1
  189. package/_types/errors/typedData.d.ts.map +1 -1
  190. package/_types/errors/version.d.ts +1 -1
  191. package/_types/index.d.ts +1 -1
  192. package/_types/index.d.ts.map +1 -1
  193. package/_types/tempo/Account.d.ts +77 -4
  194. package/_types/tempo/Account.d.ts.map +1 -1
  195. package/_types/tempo/Relay.d.ts +1 -1
  196. package/_types/tempo/Relay.d.ts.map +1 -1
  197. package/_types/tempo/Transaction.d.ts +2 -0
  198. package/_types/tempo/Transaction.d.ts.map +1 -1
  199. package/_types/tempo/chainConfig.d.ts.map +1 -1
  200. package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
  201. package/_types/tempo/internal/relay/utils.d.ts +8 -8
  202. package/_types/utils/abi/decodeEventLog.d.ts +13 -1
  203. package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
  204. package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
  205. package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
  206. package/_types/utils/authorization/recoverAuthorizationAddress.d.ts +2 -1
  207. package/_types/utils/authorization/recoverAuthorizationAddress.d.ts.map +1 -1
  208. package/_types/utils/authorization/verifyAuthorization.d.ts.map +1 -1
  209. package/_types/utils/ccip.d.ts +24 -4
  210. package/_types/utils/ccip.d.ts.map +1 -1
  211. package/_types/utils/ccipTunnel.d.ts.map +1 -1
  212. package/_types/utils/ens/localBatchGatewayRequest.d.ts +26 -0
  213. package/_types/utils/ens/localBatchGatewayRequest.d.ts.map +1 -1
  214. package/_types/utils/internal/http.d.ts +16 -0
  215. package/_types/utils/internal/http.d.ts.map +1 -0
  216. package/_types/utils/nonceManager.d.ts +15 -1
  217. package/_types/utils/nonceManager.d.ts.map +1 -1
  218. package/_types/utils/rpc/http.d.ts.map +1 -1
  219. package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
  220. package/_types/utils/typedData.d.ts.map +1 -1
  221. package/account-abstraction/utils/formatters/userOperationReceipt.ts +1 -0
  222. package/actions/public/estimateGas.ts +12 -5
  223. package/actions/public/fillTransaction.ts +2 -0
  224. package/actions/public/getFilterChanges.ts +1 -0
  225. package/actions/public/getFilterLogs.ts +1 -0
  226. package/actions/public/watchBlockNumber.ts +11 -2
  227. package/actions/public/watchBlocks.ts +46 -14
  228. package/actions/public/watchContractEvent.ts +22 -4
  229. package/actions/public/watchEvent.ts +17 -1
  230. package/actions/wallet/prepareTransactionRequest.ts +6 -2
  231. package/actions/wallet/sendTransaction.ts +9 -3
  232. package/actions/wallet/sendTransactionSync.ts +74 -12
  233. package/chains/definitions/hashKeyChain.ts +4 -4
  234. package/chains/definitions/hashkeyChainTestnet.ts +4 -4
  235. package/chains/definitions/turkchain.ts +23 -0
  236. package/chains/definitions/zksync.ts +1 -1
  237. package/chains/index.ts +1 -0
  238. package/clients/createClient.ts +6 -0
  239. package/clients/transports/fallback.ts +11 -0
  240. package/errors/node.ts +11 -5
  241. package/errors/typedData.ts +5 -2
  242. package/errors/version.ts +1 -1
  243. package/index.ts +2 -0
  244. package/package.json +1 -1
  245. package/tempo/Account.ts +202 -16
  246. package/tempo/Relay.ts +1 -1
  247. package/tempo/Transaction.ts +3 -0
  248. package/tempo/chainConfig.ts +13 -15
  249. package/tempo/internal/relay/feePayer.ts +30 -7
  250. package/utils/abi/decodeEventLog.ts +97 -10
  251. package/utils/abi/getAbiItem.ts +35 -5
  252. package/utils/abi/parseEventLogs.ts +48 -11
  253. package/utils/authorization/recoverAuthorizationAddress.ts +18 -2
  254. package/utils/authorization/verifyAuthorization.ts +12 -7
  255. package/utils/ccip.ts +199 -33
  256. package/utils/ccipTunnel.ts +5 -1
  257. package/utils/ens/localBatchGatewayRequest.ts +82 -4
  258. package/utils/internal/http.ts +92 -0
  259. package/utils/nonceManager.ts +16 -1
  260. package/utils/rpc/http.ts +1 -83
  261. package/utils/transaction/assertRequest.ts +2 -2
  262. package/utils/transaction/assertTransaction.ts +2 -2
  263. package/utils/transaction/parseTransaction.ts +32 -7
  264. package/utils/typedData.ts +31 -8
@@ -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: { address: Address; chainId: number } | undefined
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
- return nonceManager.consume(parameters)
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: { address: Address; chainId: number } | undefined
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
- return nonceManager.consume(parameters)
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
- return (await getAction(
419
- client,
420
- sendRawTransactionSync,
421
- 'sendRawTransactionSync',
422
- )({
423
- serializedTransaction,
424
- throwOnReceiptRevert,
425
- timeout: parameters.timeout,
426
- })) as never
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: 'HashKey Chain',
5
+ name: 'HSKChain',
6
6
  nativeCurrency: {
7
7
  decimals: 18,
8
- name: 'HashKey EcoPoints',
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: 'HashKey Chain Explorer',
19
- url: 'https://hashkey.blockscout.com',
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: 'HashKey Chain Testnet',
5
+ name: 'HSKChain Testnet',
6
6
  nativeCurrency: {
7
7
  decimals: 18,
8
- name: 'HashKey EcoPoints',
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: 'HashKey Chain Testnet explorer',
19
- url: 'https://testnet-explorer.hsk.xyz',
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'
@@ -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
- maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''
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
- maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ''
82
- } gwei) cannot be lower than the block base fee.`,
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
- maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''
260
+ typeof maxFeePerGas === 'bigint'
261
+ ? ` = ${formatGwei(maxFeePerGas)} gwei`
262
+ : ''
257
263
  }).`,
258
264
  ].join('\n'),
259
265
  {
@@ -51,9 +51,12 @@ export type InvalidTypedDataTypeErrorType = InvalidTypedDataTypeError & {
51
51
  }
52
52
  export class InvalidTypedDataTypeError extends BaseError {
53
53
  constructor({ type }: { type: string }) {
54
- const canonicalType = type.replace(/^(u?int)/, '$&256')
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: [`Use "${canonicalType}" instead.`],
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.14'
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,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.57.14",
4
+ "version": "2.57.15",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",