viem 1.19.1 → 1.19.3

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 (202) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/actions/ens/getEnsAddress.js +1 -1
  3. package/_cjs/actions/ens/getEnsAddress.js.map +1 -1
  4. package/_cjs/actions/ens/getEnsAvatar.js +1 -1
  5. package/_cjs/actions/ens/getEnsAvatar.js.map +1 -1
  6. package/_cjs/actions/ens/getEnsName.js +1 -1
  7. package/_cjs/actions/ens/getEnsName.js.map +1 -1
  8. package/_cjs/actions/ens/getEnsResolver.js +1 -1
  9. package/_cjs/actions/ens/getEnsResolver.js.map +1 -1
  10. package/_cjs/actions/ens/getEnsText.js +1 -1
  11. package/_cjs/actions/ens/getEnsText.js.map +1 -1
  12. package/_cjs/actions/getContract.js +7 -7
  13. package/_cjs/actions/getContract.js.map +1 -1
  14. package/_cjs/actions/public/estimateContractGas.js +1 -1
  15. package/_cjs/actions/public/estimateContractGas.js.map +1 -1
  16. package/_cjs/actions/public/estimateFeesPerGas.js +5 -2
  17. package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -1
  18. package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js +5 -3
  19. package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
  20. package/_cjs/actions/public/getContractEvents.js +1 -1
  21. package/_cjs/actions/public/getContractEvents.js.map +1 -1
  22. package/_cjs/actions/public/getTransactionConfirmations.js +4 -2
  23. package/_cjs/actions/public/getTransactionConfirmations.js.map +1 -1
  24. package/_cjs/actions/public/multicall.js +1 -1
  25. package/_cjs/actions/public/multicall.js.map +1 -1
  26. package/_cjs/actions/public/readContract.js +1 -1
  27. package/_cjs/actions/public/readContract.js.map +1 -1
  28. package/_cjs/actions/public/simulateContract.js +1 -1
  29. package/_cjs/actions/public/simulateContract.js.map +1 -1
  30. package/_cjs/actions/public/verifyHash.js +1 -1
  31. package/_cjs/actions/public/verifyHash.js.map +1 -1
  32. package/_cjs/actions/public/waitForTransactionReceipt.js +5 -5
  33. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  34. package/_cjs/actions/public/watchBlockNumber.js +1 -1
  35. package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
  36. package/_cjs/actions/public/watchBlocks.js +2 -2
  37. package/_cjs/actions/public/watchBlocks.js.map +1 -1
  38. package/_cjs/actions/public/watchContractEvent.js +7 -6
  39. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  40. package/_cjs/actions/public/watchEvent.js +7 -6
  41. package/_cjs/actions/public/watchEvent.js.map +1 -1
  42. package/_cjs/actions/public/watchPendingTransactions.js +5 -4
  43. package/_cjs/actions/public/watchPendingTransactions.js.map +1 -1
  44. package/_cjs/actions/wallet/prepareTransactionRequest.js +3 -3
  45. package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
  46. package/_cjs/actions/wallet/sendTransaction.js +4 -4
  47. package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
  48. package/_cjs/actions/wallet/signTransaction.js +1 -1
  49. package/_cjs/actions/wallet/signTransaction.js.map +1 -1
  50. package/_cjs/actions/wallet/writeContract.js +1 -1
  51. package/_cjs/actions/wallet/writeContract.js.map +1 -1
  52. package/_cjs/errors/node.js +11 -11
  53. package/_cjs/errors/node.js.map +1 -1
  54. package/_cjs/errors/rpc.js +18 -18
  55. package/_cjs/errors/rpc.js.map +1 -1
  56. package/_cjs/errors/version.js +1 -1
  57. package/_cjs/utils/encoding/toRlp.js +3 -1
  58. package/_cjs/utils/encoding/toRlp.js.map +1 -1
  59. package/_cjs/utils/getAction.js +2 -2
  60. package/_cjs/utils/getAction.js.map +1 -1
  61. package/_cjs/utils/observe.js +2 -1
  62. package/_cjs/utils/observe.js.map +1 -1
  63. package/_cjs/utils/promise/createBatchScheduler.js +8 -2
  64. package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
  65. package/_esm/actions/ens/getEnsAddress.js +1 -1
  66. package/_esm/actions/ens/getEnsAddress.js.map +1 -1
  67. package/_esm/actions/ens/getEnsAvatar.js +1 -1
  68. package/_esm/actions/ens/getEnsAvatar.js.map +1 -1
  69. package/_esm/actions/ens/getEnsName.js +1 -1
  70. package/_esm/actions/ens/getEnsName.js.map +1 -1
  71. package/_esm/actions/ens/getEnsResolver.js +1 -1
  72. package/_esm/actions/ens/getEnsResolver.js.map +1 -1
  73. package/_esm/actions/ens/getEnsText.js +1 -1
  74. package/_esm/actions/ens/getEnsText.js.map +1 -1
  75. package/_esm/actions/getContract.js +7 -7
  76. package/_esm/actions/getContract.js.map +1 -1
  77. package/_esm/actions/public/estimateContractGas.js +1 -1
  78. package/_esm/actions/public/estimateContractGas.js.map +1 -1
  79. package/_esm/actions/public/estimateFeesPerGas.js +5 -2
  80. package/_esm/actions/public/estimateFeesPerGas.js.map +1 -1
  81. package/_esm/actions/public/estimateMaxPriorityFeePerGas.js +5 -3
  82. package/_esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
  83. package/_esm/actions/public/getContractEvents.js +1 -1
  84. package/_esm/actions/public/getContractEvents.js.map +1 -1
  85. package/_esm/actions/public/getTransactionConfirmations.js +4 -2
  86. package/_esm/actions/public/getTransactionConfirmations.js.map +1 -1
  87. package/_esm/actions/public/multicall.js +1 -1
  88. package/_esm/actions/public/multicall.js.map +1 -1
  89. package/_esm/actions/public/readContract.js +1 -1
  90. package/_esm/actions/public/readContract.js.map +1 -1
  91. package/_esm/actions/public/simulateContract.js +1 -1
  92. package/_esm/actions/public/simulateContract.js.map +1 -1
  93. package/_esm/actions/public/verifyHash.js +1 -1
  94. package/_esm/actions/public/verifyHash.js.map +1 -1
  95. package/_esm/actions/public/waitForTransactionReceipt.js +5 -5
  96. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  97. package/_esm/actions/public/watchBlockNumber.js +1 -1
  98. package/_esm/actions/public/watchBlockNumber.js.map +1 -1
  99. package/_esm/actions/public/watchBlocks.js +2 -2
  100. package/_esm/actions/public/watchBlocks.js.map +1 -1
  101. package/_esm/actions/public/watchContractEvent.js +7 -6
  102. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  103. package/_esm/actions/public/watchEvent.js +7 -6
  104. package/_esm/actions/public/watchEvent.js.map +1 -1
  105. package/_esm/actions/public/watchPendingTransactions.js +5 -4
  106. package/_esm/actions/public/watchPendingTransactions.js.map +1 -1
  107. package/_esm/actions/wallet/prepareTransactionRequest.js +3 -3
  108. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  109. package/_esm/actions/wallet/sendTransaction.js +4 -4
  110. package/_esm/actions/wallet/sendTransaction.js.map +1 -1
  111. package/_esm/actions/wallet/signTransaction.js +1 -1
  112. package/_esm/actions/wallet/signTransaction.js.map +1 -1
  113. package/_esm/actions/wallet/writeContract.js +1 -1
  114. package/_esm/actions/wallet/writeContract.js.map +1 -1
  115. package/_esm/errors/node.js +11 -22
  116. package/_esm/errors/node.js.map +1 -1
  117. package/_esm/errors/rpc.js +18 -36
  118. package/_esm/errors/rpc.js.map +1 -1
  119. package/_esm/errors/version.js +1 -1
  120. package/_esm/utils/encoding/toRlp.js +3 -1
  121. package/_esm/utils/encoding/toRlp.js.map +1 -1
  122. package/_esm/utils/getAction.js +12 -2
  123. package/_esm/utils/getAction.js.map +1 -1
  124. package/_esm/utils/observe.js +2 -1
  125. package/_esm/utils/observe.js.map +1 -1
  126. package/_esm/utils/promise/createBatchScheduler.js +8 -2
  127. package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
  128. package/_types/actions/ens/getEnsAddress.d.ts.map +1 -1
  129. package/_types/actions/ens/getEnsAvatar.d.ts.map +1 -1
  130. package/_types/actions/ens/getEnsName.d.ts.map +1 -1
  131. package/_types/actions/ens/getEnsResolver.d.ts.map +1 -1
  132. package/_types/actions/ens/getEnsText.d.ts.map +1 -1
  133. package/_types/actions/getContract.d.ts +8 -8
  134. package/_types/actions/getContract.d.ts.map +1 -1
  135. package/_types/actions/public/estimateContractGas.d.ts.map +1 -1
  136. package/_types/actions/public/estimateFeesPerGas.d.ts.map +1 -1
  137. package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
  138. package/_types/actions/public/getContractEvents.d.ts.map +1 -1
  139. package/_types/actions/public/getTransactionConfirmations.d.ts.map +1 -1
  140. package/_types/actions/public/multicall.d.ts.map +1 -1
  141. package/_types/actions/public/readContract.d.ts.map +1 -1
  142. package/_types/actions/public/simulateContract.d.ts.map +1 -1
  143. package/_types/actions/public/verifyHash.d.ts.map +1 -1
  144. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  145. package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
  146. package/_types/actions/public/watchBlocks.d.ts.map +1 -1
  147. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  148. package/_types/actions/public/watchEvent.d.ts.map +1 -1
  149. package/_types/actions/public/watchPendingTransactions.d.ts.map +1 -1
  150. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  151. package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
  152. package/_types/actions/wallet/writeContract.d.ts.map +1 -1
  153. package/_types/clients/createClient.d.ts +1 -1
  154. package/_types/errors/version.d.ts +1 -1
  155. package/_types/types/ens.d.ts +1 -1
  156. package/_types/types/ens.d.ts.map +1 -1
  157. package/_types/utils/formatters/block.d.ts +2 -2
  158. package/_types/utils/formatters/block.d.ts.map +1 -1
  159. package/_types/utils/formatters/formatter.d.ts +1 -1
  160. package/_types/utils/formatters/transaction.d.ts +2 -2
  161. package/_types/utils/formatters/transaction.d.ts.map +1 -1
  162. package/_types/utils/formatters/transactionReceipt.d.ts +1 -1
  163. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  164. package/_types/utils/getAction.d.ts +8 -1
  165. package/_types/utils/getAction.d.ts.map +1 -1
  166. package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
  167. package/actions/ens/getEnsAddress.ts +1 -0
  168. package/actions/ens/getEnsAvatar.ts +1 -0
  169. package/actions/ens/getEnsName.ts +1 -0
  170. package/actions/ens/getEnsResolver.ts +1 -0
  171. package/actions/ens/getEnsText.ts +1 -0
  172. package/actions/getContract.ts +23 -16
  173. package/actions/public/estimateContractGas.ts +1 -0
  174. package/actions/public/estimateFeesPerGas.ts +5 -2
  175. package/actions/public/estimateMaxPriorityFeePerGas.ts +5 -3
  176. package/actions/public/getContractEvents.ts +1 -0
  177. package/actions/public/getTransactionConfirmations.ts +4 -2
  178. package/actions/public/multicall.ts +1 -0
  179. package/actions/public/readContract.ts +1 -0
  180. package/actions/public/simulateContract.ts +1 -0
  181. package/actions/public/verifyHash.ts +1 -0
  182. package/actions/public/waitForTransactionReceipt.ts +9 -1
  183. package/actions/public/watchBlockNumber.ts +1 -0
  184. package/actions/public/watchBlocks.ts +2 -0
  185. package/actions/public/watchContractEvent.ts +19 -4
  186. package/actions/public/watchEvent.ts +19 -4
  187. package/actions/public/watchPendingTransactions.ts +13 -3
  188. package/actions/wallet/prepareTransactionRequest.ts +7 -1
  189. package/actions/wallet/sendTransaction.ts +5 -2
  190. package/actions/wallet/signTransaction.ts +1 -1
  191. package/actions/wallet/writeContract.ts +1 -0
  192. package/clients/createClient.ts +1 -1
  193. package/errors/version.ts +1 -1
  194. package/package.json +2 -2
  195. package/types/ens.ts +1 -1
  196. package/utils/encoding/toRlp.ts +3 -1
  197. package/utils/formatters/block.ts +1 -1
  198. package/utils/formatters/formatter.ts +1 -1
  199. package/utils/formatters/transaction.ts +1 -1
  200. package/utils/getAction.ts +11 -1
  201. package/utils/observe.ts +1 -1
  202. package/utils/promise/createBatchScheduler.ts +8 -4
@@ -156,10 +156,10 @@ export type GetContractReturnType<
156
156
  * // 424122n
157
157
  */
158
158
  read: {
159
- [FunctionName in _ReadFunctionNames]: GetReadFunction<
159
+ [_FunctionName in _ReadFunctionNames]: GetReadFunction<
160
160
  _Narrowable,
161
161
  TAbi,
162
- FunctionName
162
+ _FunctionName
163
163
  >
164
164
  }
165
165
  }) &
@@ -187,12 +187,12 @@ export type GetContractReturnType<
187
187
  * })
188
188
  */
189
189
  estimateGas: {
190
- [FunctionName in _WriteFunctionNames]: GetEstimateFunction<
190
+ [_FunctionName in _WriteFunctionNames]: GetEstimateFunction<
191
191
  _Narrowable,
192
192
  TPublicClient['chain'],
193
193
  undefined,
194
194
  TAbi,
195
- FunctionName
195
+ _FunctionName
196
196
  >
197
197
  }
198
198
  /**
@@ -220,11 +220,11 @@ export type GetContractReturnType<
220
220
  * })
221
221
  */
222
222
  simulate: {
223
- [FunctionName in _WriteFunctionNames]: GetSimulateFunction<
223
+ [_FunctionName in _WriteFunctionNames]: GetSimulateFunction<
224
224
  _Narrowable,
225
225
  TPublicClient['chain'],
226
226
  TAbi,
227
- FunctionName
227
+ _FunctionName
228
228
  >
229
229
  }
230
230
  }) &
@@ -250,10 +250,10 @@ export type GetContractReturnType<
250
250
  * const filter = await contract.createEventFilter.Transfer()
251
251
  */
252
252
  createEventFilter: {
253
- [EventName in _EventNames]: GetEventFilter<
253
+ [_EventName in _EventNames]: GetEventFilter<
254
254
  _Narrowable,
255
255
  TAbi,
256
- EventName
256
+ _EventName
257
257
  >
258
258
  }
259
259
  /**
@@ -275,10 +275,10 @@ export type GetContractReturnType<
275
275
  * const filter = await contract.createEventFilter.Transfer()
276
276
  */
277
277
  getEvents: {
278
- [EventName in _EventNames]: GetEventsFunction<
278
+ [_EventName in _EventNames]: GetEventsFunction<
279
279
  _Narrowable,
280
280
  TAbi,
281
- EventName
281
+ _EventName
282
282
  >
283
283
  }
284
284
  /**
@@ -308,10 +308,10 @@ export type GetContractReturnType<
308
308
  * )
309
309
  */
310
310
  watchEvent: {
311
- [EventName in _EventNames]: GetWatchEvent<
311
+ [_EventName in _EventNames]: GetWatchEvent<
312
312
  _Narrowable,
313
313
  TAbi,
314
- EventName
314
+ _EventName
315
315
  >
316
316
  }
317
317
  })
@@ -341,12 +341,12 @@ export type GetContractReturnType<
341
341
  * })
342
342
  */
343
343
  estimateGas: {
344
- [FunctionName in _WriteFunctionNames]: GetEstimateFunction<
344
+ [_FunctionName in _WriteFunctionNames]: GetEstimateFunction<
345
345
  _Narrowable,
346
346
  TWalletClient['chain'],
347
347
  TWalletClient['account'],
348
348
  TAbi,
349
- FunctionName
349
+ _FunctionName
350
350
  >
351
351
  }
352
352
  /**
@@ -376,12 +376,12 @@ export type GetContractReturnType<
376
376
  * })
377
377
  */
378
378
  write: {
379
- [FunctionName in _WriteFunctionNames]: GetWriteFunction<
379
+ [_FunctionName in _WriteFunctionNames]: GetWriteFunction<
380
380
  _Narrowable,
381
381
  TWalletClient['chain'],
382
382
  TWalletClient['account'],
383
383
  TAbi,
384
- FunctionName
384
+ _FunctionName
385
385
  >
386
386
  }
387
387
  }
@@ -489,6 +489,7 @@ export function getContract<
489
489
  return getAction(
490
490
  publicClient,
491
491
  readContract,
492
+ 'readContract',
492
493
  )({
493
494
  abi,
494
495
  address,
@@ -519,6 +520,7 @@ export function getContract<
519
520
  return getAction(
520
521
  publicClient,
521
522
  simulateContract,
523
+ 'simulateContract',
522
524
  )({
523
525
  abi,
524
526
  address,
@@ -555,6 +557,7 @@ export function getContract<
555
557
  return getAction(
556
558
  publicClient,
557
559
  createContractEventFilter,
560
+ 'createContractEventFilter',
558
561
  )({
559
562
  abi,
560
563
  address,
@@ -589,6 +592,7 @@ export function getContract<
589
592
  return getAction(
590
593
  publicClient,
591
594
  getContractEvents,
595
+ 'getContractEvents',
592
596
  )({
593
597
  abi,
594
598
  address,
@@ -623,6 +627,7 @@ export function getContract<
623
627
  return getAction(
624
628
  publicClient,
625
629
  watchContractEvent,
630
+ 'watchContractEvent',
626
631
  )({
627
632
  abi,
628
633
  address,
@@ -656,6 +661,7 @@ export function getContract<
656
661
  return getAction(
657
662
  walletClient,
658
663
  writeContract,
664
+ 'writeContract',
659
665
  )({
660
666
  abi,
661
667
  address,
@@ -694,6 +700,7 @@ export function getContract<
694
700
  return getAction(
695
701
  client,
696
702
  estimateContractGas,
703
+ 'estimateContractGas',
697
704
  )({
698
705
  abi,
699
706
  address,
@@ -99,6 +99,7 @@ export async function estimateContractGas<
99
99
  const gas = await getAction(
100
100
  client,
101
101
  estimateGas,
102
+ 'estimateGas',
102
103
  )({
103
104
  data,
104
105
  to: address,
@@ -126,7 +126,9 @@ export async function internal_estimateFeesPerGas<
126
126
  (base * BigInt(Math.ceil(baseFeeMultiplier * denominator))) /
127
127
  BigInt(denominator)
128
128
 
129
- const block = block_ ? block_ : await getAction(client, getBlock)({})
129
+ const block = block_
130
+ ? block_
131
+ : await getAction(client, getBlock, 'getBlock')({})
130
132
 
131
133
  if (typeof chain?.fees?.estimateFeesPerGas === 'function')
132
134
  return chain.fees.estimateFeesPerGas({
@@ -163,7 +165,8 @@ export async function internal_estimateFeesPerGas<
163
165
  }
164
166
 
165
167
  const gasPrice =
166
- request?.gasPrice ?? multiply(await getAction(client, getGasPrice)({}))
168
+ request?.gasPrice ??
169
+ multiply(await getAction(client, getGasPrice, 'getGasPrice')({}))
167
170
  return {
168
171
  gasPrice,
169
172
  } as EstimateFeesPerGasReturnType<type>
@@ -83,7 +83,7 @@ export async function internal_estimateMaxPriorityFeePerGas<
83
83
  ): Promise<EstimateMaxPriorityFeePerGasReturnType> {
84
84
  const { block: block_, chain = client.chain, request } = args || {}
85
85
  if (typeof chain?.fees?.defaultPriorityFee === 'function') {
86
- const block = block_ || (await getAction(client, getBlock)({}))
86
+ const block = block_ || (await getAction(client, getBlock, 'getBlock')({}))
87
87
  return chain.fees.defaultPriorityFee({
88
88
  block,
89
89
  client,
@@ -102,8 +102,10 @@ export async function internal_estimateMaxPriorityFeePerGas<
102
102
  // fall back to calculating it manually via `gasPrice - baseFeePerGas`.
103
103
  // See: https://github.com/ethereum/pm/issues/328#:~:text=eth_maxPriorityFeePerGas%20after%20London%20will%20effectively%20return%20eth_gasPrice%20%2D%20baseFee
104
104
  const [block, gasPrice] = await Promise.all([
105
- block_ ? Promise.resolve(block_) : getAction(client, getBlock)({}),
106
- getAction(client, getGasPrice)({}),
105
+ block_
106
+ ? Promise.resolve(block_)
107
+ : getAction(client, getBlock, 'getBlock')({}),
108
+ getAction(client, getGasPrice, 'getGasPrice')({}),
107
109
  ])
108
110
 
109
111
  if (typeof block.baseFeePerGas !== 'bigint')
@@ -134,6 +134,7 @@ export async function getContractEvents<
134
134
  return getAction(
135
135
  client,
136
136
  getLogs,
137
+ 'getLogs',
137
138
  )({
138
139
  address,
139
140
  args,
@@ -67,8 +67,10 @@ export async function getTransactionConfirmations<
67
67
  { hash, transactionReceipt }: GetTransactionConfirmationsParameters<TChain>,
68
68
  ): Promise<GetTransactionConfirmationsReturnType> {
69
69
  const [blockNumber, transaction] = await Promise.all([
70
- getAction(client, getBlockNumber)({}),
71
- hash ? getAction(client, getTransaction)({ hash }) : undefined,
70
+ getAction(client, getBlockNumber, 'getBlockNumber')({}),
71
+ hash
72
+ ? getAction(client, getTransaction, 'getBlockNumber')({ hash })
73
+ : undefined,
72
74
  ])
73
75
  const transactionBlockNumber =
74
76
  transactionReceipt?.blockNumber || transaction?.blockNumber
@@ -204,6 +204,7 @@ export async function multicall<
204
204
  getAction(
205
205
  client,
206
206
  readContract,
207
+ 'readContract',
207
208
  )({
208
209
  abi: multicall3Abi,
209
210
  address: multicallAddress!,
@@ -95,6 +95,7 @@ export async function readContract<
95
95
  const { data } = await getAction(
96
96
  client,
97
97
  call,
98
+ 'call',
98
99
  )({
99
100
  data: calldata,
100
101
  to: address,
@@ -146,6 +146,7 @@ export async function simulateContract<
146
146
  const { data } = await getAction(
147
147
  client,
148
148
  call,
149
+ 'call',
149
150
  )({
150
151
  batch: false,
151
152
  data: `${calldata}${dataSuffix ? dataSuffix.replace('0x', '') : ''}`,
@@ -58,6 +58,7 @@ export async function verifyHash<TChain extends Chain | undefined,>(
58
58
  const { data } = await getAction(
59
59
  client,
60
60
  call,
61
+ 'call',
61
62
  )({
62
63
  data: encodeDeployData({
63
64
  abi: universalSignatureValidatorAbi,
@@ -144,6 +144,7 @@ export async function waitForTransactionReceipt<
144
144
  const _unwatch = getAction(
145
145
  client,
146
146
  watchBlockNumber,
147
+ 'watchBlockNumber',
147
148
  )({
148
149
  emitMissed: true,
149
150
  emitOnBegin: true,
@@ -185,6 +186,7 @@ export async function waitForTransactionReceipt<
185
186
  transaction = (await getAction(
186
187
  client,
187
188
  getTransaction,
189
+ 'getTransaction',
188
190
  )({ hash })) as GetTransactionReturnType<TChain>
189
191
  if (transaction.blockNumber)
190
192
  blockNumber = transaction.blockNumber
@@ -199,7 +201,11 @@ export async function waitForTransactionReceipt<
199
201
  }
200
202
 
201
203
  // Get the receipt to check if it's been processed.
202
- receipt = await getAction(client, getTransactionReceipt)({ hash })
204
+ receipt = await getAction(
205
+ client,
206
+ getTransactionReceipt,
207
+ 'getTransactionReceipt',
208
+ )({ hash })
203
209
 
204
210
  // Check if we have enough confirmations. If not, continue polling.
205
211
  if (
@@ -225,6 +231,7 @@ export async function waitForTransactionReceipt<
225
231
  const block = await getAction(
226
232
  client,
227
233
  getBlock,
234
+ 'getBlock',
228
235
  )({
229
236
  blockNumber,
230
237
  includeTransactions: true,
@@ -245,6 +252,7 @@ export async function waitForTransactionReceipt<
245
252
  receipt = await getAction(
246
253
  client,
247
254
  getTransactionReceipt,
255
+ 'getTransactionReceipt',
248
256
  )({
249
257
  hash: replacementTransaction.hash,
250
258
  })
@@ -112,6 +112,7 @@ export function watchBlockNumber<
112
112
  const blockNumber = await getAction(
113
113
  client,
114
114
  getBlockNumber,
115
+ 'getBlockNumber',
115
116
  )({ cacheTime: 0 })
116
117
 
117
118
  if (prevBlockNumber) {
@@ -144,6 +144,7 @@ export function watchBlocks<
144
144
  const block = await getAction(
145
145
  client,
146
146
  getBlock,
147
+ 'getBlock',
147
148
  )({
148
149
  blockTag,
149
150
  includeTransactions,
@@ -160,6 +161,7 @@ export function watchBlocks<
160
161
  const block = (await getAction(
161
162
  client,
162
163
  getBlock,
164
+ 'getBlock',
163
165
  )({
164
166
  blockNumber: i,
165
167
  includeTransactions,
@@ -191,6 +191,7 @@ export function watchContractEvent<
191
191
  filter = (await getAction(
192
192
  client,
193
193
  createContractEventFilter,
194
+ 'createContractEventFilter',
194
195
  )({
195
196
  abi,
196
197
  address,
@@ -210,13 +211,21 @@ export function watchContractEvent<
210
211
  try {
211
212
  let logs: Log[]
212
213
  if (filter) {
213
- logs = await getAction(client, getFilterChanges)({ filter })
214
+ logs = await getAction(
215
+ client,
216
+ getFilterChanges,
217
+ 'getFilterChanges',
218
+ )({ filter })
214
219
  } else {
215
220
  // If the filter doesn't exist, we will fall back to use `getLogs`.
216
221
  // The fall back exists because some RPC Providers do not support filters.
217
222
 
218
223
  // Fetch the block number to use for `getLogs`.
219
- const blockNumber = await getAction(client, getBlockNumber)({})
224
+ const blockNumber = await getAction(
225
+ client,
226
+ getBlockNumber,
227
+ 'getBlockNumber',
228
+ )({})
220
229
 
221
230
  // If the block number has changed, we will need to fetch the logs.
222
231
  // If the block number doesn't exist, we are yet to reach the first poll interval,
@@ -225,6 +234,7 @@ export function watchContractEvent<
225
234
  logs = await getAction(
226
235
  client,
227
236
  getContractEvents,
237
+ 'getContractEvents',
228
238
  )({
229
239
  abi,
230
240
  address,
@@ -242,7 +252,7 @@ export function watchContractEvent<
242
252
 
243
253
  if (logs.length === 0) return
244
254
  if (batch) emit.onLogs(logs as any)
245
- else logs.forEach((log) => emit.onLogs([log] as any))
255
+ else for (const log of logs) emit.onLogs([log] as any)
246
256
  } catch (err) {
247
257
  // If a filter has been set and gets uninstalled, providers will throw an InvalidInput error.
248
258
  // Reinitalize the filter when this occurs
@@ -258,7 +268,12 @@ export function watchContractEvent<
258
268
  )
259
269
 
260
270
  return async () => {
261
- if (filter) await getAction(client, uninstallFilter)({ filter })
271
+ if (filter)
272
+ await getAction(
273
+ client,
274
+ uninstallFilter,
275
+ 'uninstallFilter',
276
+ )({ filter })
262
277
  unwatch()
263
278
  }
264
279
  })
@@ -226,6 +226,7 @@ export function watchEvent<
226
226
  filter = (await getAction(
227
227
  client,
228
228
  createEventFilter as any,
229
+ 'createEventFilter',
229
230
  )({
230
231
  address,
231
232
  args,
@@ -245,13 +246,21 @@ export function watchEvent<
245
246
  try {
246
247
  let logs: Log[]
247
248
  if (filter) {
248
- logs = await getAction(client, getFilterChanges)({ filter })
249
+ logs = await getAction(
250
+ client,
251
+ getFilterChanges,
252
+ 'getFilterChanges',
253
+ )({ filter })
249
254
  } else {
250
255
  // If the filter doesn't exist, we will fall back to use `getLogs`.
251
256
  // The fall back exists because some RPC Providers do not support filters.
252
257
 
253
258
  // Fetch the block number to use for `getLogs`.
254
- const blockNumber = await getAction(client, getBlockNumber)({})
259
+ const blockNumber = await getAction(
260
+ client,
261
+ getBlockNumber,
262
+ 'getBlockNumber',
263
+ )({})
255
264
 
256
265
  // If the block number has changed, we will need to fetch the logs.
257
266
  // If the block number doesn't exist, we are yet to reach the first poll interval,
@@ -260,6 +269,7 @@ export function watchEvent<
260
269
  logs = await getAction(
261
270
  client,
262
271
  getLogs,
272
+ 'getLogs',
263
273
  )({
264
274
  address,
265
275
  args,
@@ -276,7 +286,7 @@ export function watchEvent<
276
286
 
277
287
  if (logs.length === 0) return
278
288
  if (batch) emit.onLogs(logs as any)
279
- else logs.forEach((log) => emit.onLogs([log] as any))
289
+ else for (const log of logs) emit.onLogs([log] as any)
280
290
  } catch (err) {
281
291
  // If a filter has been set and gets uninstalled, providers will throw an InvalidInput error.
282
292
  // Reinitalize the filter when this occurs
@@ -292,7 +302,12 @@ export function watchEvent<
292
302
  )
293
303
 
294
304
  return async () => {
295
- if (filter) await getAction(client, uninstallFilter)({ filter })
305
+ if (filter)
306
+ await getAction(
307
+ client,
308
+ uninstallFilter,
309
+ 'uninstallFilter',
310
+ )({ filter })
296
311
  unwatch()
297
312
  }
298
313
  })
@@ -129,6 +129,7 @@ export function watchPendingTransactions<
129
129
  filter = await getAction(
130
130
  client,
131
131
  createPendingTransactionFilter,
132
+ 'createPendingTransactionFilter',
132
133
  )({})
133
134
  return
134
135
  } catch (err) {
@@ -137,10 +138,14 @@ export function watchPendingTransactions<
137
138
  }
138
139
  }
139
140
 
140
- const hashes = await getAction(client, getFilterChanges)({ filter })
141
+ const hashes = await getAction(
142
+ client,
143
+ getFilterChanges,
144
+ 'getFilterChanges',
145
+ )({ filter })
141
146
  if (hashes.length === 0) return
142
147
  if (batch) emit.onTransactions(hashes)
143
- else hashes.forEach((hash) => emit.onTransactions([hash]))
148
+ else for (const hash of hashes) emit.onTransactions([hash])
144
149
  } catch (err) {
145
150
  emit.onError?.(err as Error)
146
151
  }
@@ -152,7 +157,12 @@ export function watchPendingTransactions<
152
157
  )
153
158
 
154
159
  return async () => {
155
- if (filter) await getAction(client, uninstallFilter)({ filter })
160
+ if (filter)
161
+ await getAction(
162
+ client,
163
+ uninstallFilter,
164
+ 'uninstallFilter',
165
+ )({ filter })
156
166
  unwatch()
157
167
  }
158
168
  })
@@ -130,7 +130,11 @@ export async function prepareTransactionRequest<
130
130
  if (!account_) throw new AccountNotFoundError()
131
131
  const account = parseAccount(account_)
132
132
 
133
- const block = await getAction(client, getBlock)({ blockTag: 'latest' })
133
+ const block = await getAction(
134
+ client,
135
+ getBlock,
136
+ 'getBlock',
137
+ )({ blockTag: 'latest' })
134
138
 
135
139
  const request = { ...args, from: account.address }
136
140
 
@@ -138,6 +142,7 @@ export async function prepareTransactionRequest<
138
142
  request.nonce = await getAction(
139
143
  client,
140
144
  getTransactionCount,
145
+ 'getTransactionCount',
141
146
  )({
142
147
  address: account.address,
143
148
  blockTag: 'pending',
@@ -196,6 +201,7 @@ export async function prepareTransactionRequest<
196
201
  request.gas = await getAction(
197
202
  client,
198
203
  estimateGas,
204
+ 'estimateGas',
199
205
  )({
200
206
  ...request,
201
207
  account: { address: account.address, type: 'json-rpc' },
@@ -155,7 +155,7 @@ export async function sendTransaction<
155
155
 
156
156
  let chainId
157
157
  if (chain !== null) {
158
- chainId = await getAction(client, getChainId)({})
158
+ chainId = await getAction(client, getChainId, 'getChainId')({})
159
159
  assertCurrentChain({
160
160
  currentChainId: chainId,
161
161
  chain,
@@ -167,6 +167,7 @@ export async function sendTransaction<
167
167
  const request = await getAction(
168
168
  client,
169
169
  prepareTransactionRequest,
170
+ 'prepareTransactionRequest',
170
171
  )({
171
172
  account,
172
173
  accessList,
@@ -182,7 +183,8 @@ export async function sendTransaction<
182
183
  ...rest,
183
184
  } as any)
184
185
 
185
- if (!chainId) chainId = await getAction(client, getChainId)({})
186
+ if (!chainId)
187
+ chainId = await getAction(client, getChainId, 'getChainId')({})
186
188
 
187
189
  const serializer = chain?.serializers?.transaction
188
190
  const serializedTransaction = (await account.signTransaction(
@@ -195,6 +197,7 @@ export async function sendTransaction<
195
197
  return await getAction(
196
198
  client,
197
199
  sendRawTransaction,
200
+ 'sendRawTransaction',
198
201
  )({
199
202
  serializedTransaction,
200
203
  })
@@ -128,7 +128,7 @@ export async function signTransaction<
128
128
  ...args,
129
129
  })
130
130
 
131
- const chainId = await getAction(client, getChainId)({})
131
+ const chainId = await getAction(client, getChainId, 'getChainId')({})
132
132
  if (chain !== null)
133
133
  assertCurrentChain({
134
134
  currentChainId: chainId,
@@ -138,6 +138,7 @@ export async function writeContract<
138
138
  const hash = await getAction(
139
139
  client,
140
140
  sendTransaction,
141
+ 'sendTransaction',
141
142
  )({
142
143
  data: `${data}${dataSuffix ? dataSuffix.replace('0x', '') : ''}`,
143
144
  to: address,
@@ -147,7 +147,7 @@ type Client_Base<
147
147
 
148
148
  type Extended = Prettify<
149
149
  // disallow redefining base properties
150
- { [K in keyof Client_Base]?: undefined } & {
150
+ { [_ in keyof Client_Base]?: undefined } & {
151
151
  [key: string]: unknown
152
152
  }
153
153
  >
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.19.1'
1
+ export const version = '1.19.2'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "1.19.1",
4
+ "version": "1.19.3",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -133,7 +133,7 @@
133
133
  }
134
134
  },
135
135
  "dependencies": {
136
- "@adraffy/ens-normalize": "1.9.4",
136
+ "@adraffy/ens-normalize": "1.10.0",
137
137
  "@noble/curves": "1.2.0",
138
138
  "@noble/hashes": "1.3.2",
139
139
  "@scure/bip32": "1.3.2",
package/types/ens.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type AssetGateway = 'ipfs' | 'arweave'
2
2
 
3
3
  export type AssetGatewayUrls = {
4
- [key in AssetGateway]?: string
4
+ [_key in AssetGateway]?: string
5
5
  }
@@ -88,7 +88,9 @@ function getEncodableList(list: Encodable[]): Encodable {
88
88
  else if (sizeOfBodyLength === 3) cursor.pushUint24(bodyLength)
89
89
  else cursor.pushUint32(bodyLength)
90
90
  }
91
- list.forEach((x) => x.encode(cursor))
91
+ for (const { encode } of list) {
92
+ encode(cursor)
93
+ }
92
94
  },
93
95
  }
94
96
  }
@@ -28,7 +28,7 @@ export type FormattedBlock<
28
28
  _ExcludedPendingDependencies extends string = BlockPendingDependencies &
29
29
  ExtractChainFormatterExclude<TChain, 'block'>,
30
30
  _Formatted = Omit<_FormatterReturnType, BlockPendingDependencies> & {
31
- [K in _ExcludedPendingDependencies]: never
31
+ [_key in _ExcludedPendingDependencies]: never
32
32
  } & Pick<
33
33
  Block<bigint, TIncludeTransactions, TBlockTag>,
34
34
  BlockPendingDependencies
@@ -31,7 +31,7 @@ export function defineFormatter<TType extends string, TParameters, TReturnType>(
31
31
  ...formatted,
32
32
  ...overrides(args),
33
33
  } as Prettify<Assign<TReturnType, TOverrideReturnType>> & {
34
- [K in TExclude[number]]: never
34
+ [_key in TExclude[number]]: never
35
35
  }
36
36
  },
37
37
  type,