viem 2.10.5 → 2.10.8

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 (229) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/_cjs/chains/definitions/btr.js +31 -0
  3. package/_cjs/chains/definitions/btr.js.map +1 -0
  4. package/_cjs/chains/definitions/btrTestnet.js +30 -0
  5. package/_cjs/chains/definitions/btrTestnet.js.map +1 -0
  6. package/_cjs/chains/definitions/rootstockTestnet.js +24 -0
  7. package/_cjs/chains/definitions/rootstockTestnet.js.map +1 -0
  8. package/_cjs/chains/index.js +12 -6
  9. package/_cjs/chains/index.js.map +1 -1
  10. package/_cjs/clients/transports/http.js +1 -1
  11. package/_cjs/clients/transports/http.js.map +1 -1
  12. package/_cjs/errors/version.js +1 -1
  13. package/_cjs/utils/abi/decodeAbiParameters.js +2 -2
  14. package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  15. package/_cjs/utils/abi/encodeAbiParameters.js +2 -2
  16. package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -1
  17. package/_cjs/utils/abi/encodePacked.js +3 -3
  18. package/_cjs/utils/abi/encodePacked.js.map +1 -1
  19. package/_cjs/utils/buildRequest.js +1 -1
  20. package/_cjs/utils/buildRequest.js.map +1 -1
  21. package/_cjs/utils/cursor.js +2 -2
  22. package/_cjs/utils/cursor.js.map +1 -1
  23. package/_cjs/utils/encoding/fromRlp.js +3 -1
  24. package/_cjs/utils/encoding/fromRlp.js.map +1 -1
  25. package/_cjs/utils/ens/avatar/utils.js +1 -1
  26. package/_cjs/utils/ens/avatar/utils.js.map +1 -1
  27. package/_cjs/utils/promise/withCache.js +1 -1
  28. package/_cjs/utils/promise/withCache.js.map +1 -1
  29. package/_cjs/utils/typedData.js +3 -3
  30. package/_cjs/utils/typedData.js.map +1 -1
  31. package/_esm/actions/public/getFilterChanges.js +0 -1
  32. package/_esm/actions/public/getFilterChanges.js.map +1 -1
  33. package/_esm/actions/public/getFilterLogs.js +0 -1
  34. package/_esm/actions/public/getFilterLogs.js.map +1 -1
  35. package/_esm/actions/public/getLogs.js +0 -1
  36. package/_esm/actions/public/getLogs.js.map +1 -1
  37. package/_esm/actions/wallet/prepareTransactionRequest.js +0 -1
  38. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  39. package/_esm/actions/wallet/signTransaction.js +0 -1
  40. package/_esm/actions/wallet/signTransaction.js.map +1 -1
  41. package/_esm/celo/fees.js +0 -1
  42. package/_esm/celo/fees.js.map +1 -1
  43. package/_esm/celo/formatters.js +0 -1
  44. package/_esm/celo/formatters.js.map +1 -1
  45. package/_esm/chains/definitions/btr.js +28 -0
  46. package/_esm/chains/definitions/btr.js.map +1 -0
  47. package/_esm/chains/definitions/btrTestnet.js +27 -0
  48. package/_esm/chains/definitions/btrTestnet.js.map +1 -0
  49. package/_esm/chains/definitions/rootstockTestnet.js +21 -0
  50. package/_esm/chains/definitions/rootstockTestnet.js.map +1 -0
  51. package/_esm/chains/index.js +3 -0
  52. package/_esm/chains/index.js.map +1 -1
  53. package/_esm/clients/decorators/wallet.js +0 -1
  54. package/_esm/clients/decorators/wallet.js.map +1 -1
  55. package/_esm/clients/transports/http.js +1 -1
  56. package/_esm/clients/transports/http.js.map +1 -1
  57. package/_esm/clients/transports/ipc.js +0 -1
  58. package/_esm/clients/transports/ipc.js.map +1 -1
  59. package/_esm/errors/version.js +1 -1
  60. package/_esm/experimental/eip3074/utils/toAuthMessage.js +0 -1
  61. package/_esm/experimental/eip3074/utils/toAuthMessage.js.map +1 -1
  62. package/_esm/op-stack/actions/buildProveWithdrawal.js +0 -2
  63. package/_esm/op-stack/actions/buildProveWithdrawal.js.map +1 -1
  64. package/_esm/op-stack/actions/estimateL1Fee.js +0 -2
  65. package/_esm/op-stack/actions/estimateL1Fee.js.map +1 -1
  66. package/_esm/op-stack/actions/estimateL1Gas.js +0 -2
  67. package/_esm/op-stack/actions/estimateL1Gas.js.map +1 -1
  68. package/_esm/op-stack/actions/estimateTotalFee.js +0 -1
  69. package/_esm/op-stack/actions/estimateTotalFee.js.map +1 -1
  70. package/_esm/op-stack/actions/estimateTotalGas.js +0 -1
  71. package/_esm/op-stack/actions/estimateTotalGas.js.map +1 -1
  72. package/_esm/op-stack/actions/getL1BaseFee.js +0 -3
  73. package/_esm/op-stack/actions/getL1BaseFee.js.map +1 -1
  74. package/_esm/op-stack/formatters.js +0 -2
  75. package/_esm/op-stack/formatters.js.map +1 -1
  76. package/_esm/types/contract.js +1 -1
  77. package/_esm/types/contract.js.map +1 -1
  78. package/_esm/utils/abi/decodeAbiParameters.js +2 -2
  79. package/_esm/utils/abi/decodeAbiParameters.js.map +1 -1
  80. package/_esm/utils/abi/encodeAbiParameters.js +2 -2
  81. package/_esm/utils/abi/encodeAbiParameters.js.map +1 -1
  82. package/_esm/utils/abi/encodePacked.js +3 -3
  83. package/_esm/utils/abi/encodePacked.js.map +1 -1
  84. package/_esm/utils/abi/getAbiItem.js +0 -1
  85. package/_esm/utils/abi/getAbiItem.js.map +1 -1
  86. package/_esm/utils/abi/prepareEncodeFunctionData.js +0 -1
  87. package/_esm/utils/abi/prepareEncodeFunctionData.js.map +1 -1
  88. package/_esm/utils/buildRequest.js +1 -1
  89. package/_esm/utils/buildRequest.js.map +1 -1
  90. package/_esm/utils/ccip.js +0 -1
  91. package/_esm/utils/ccip.js.map +1 -1
  92. package/_esm/utils/cursor.js +2 -2
  93. package/_esm/utils/cursor.js.map +1 -1
  94. package/_esm/utils/encoding/fromRlp.js +3 -1
  95. package/_esm/utils/encoding/fromRlp.js.map +1 -1
  96. package/_esm/utils/ens/avatar/utils.js +1 -1
  97. package/_esm/utils/ens/avatar/utils.js.map +1 -1
  98. package/_esm/utils/promise/withCache.js +1 -1
  99. package/_esm/utils/promise/withCache.js.map +1 -1
  100. package/_esm/utils/rpc/compat.js +0 -4
  101. package/_esm/utils/rpc/compat.js.map +1 -1
  102. package/_esm/utils/transaction/serializeAccessList.js +0 -1
  103. package/_esm/utils/transaction/serializeAccessList.js.map +1 -1
  104. package/_esm/utils/typedData.js +3 -3
  105. package/_esm/utils/typedData.js.map +1 -1
  106. package/_esm/zksync/actions/sendEip712Transaction.js +0 -2
  107. package/_esm/zksync/actions/sendEip712Transaction.js.map +1 -1
  108. package/_esm/zksync/actions/sendTransaction.js +0 -1
  109. package/_esm/zksync/actions/sendTransaction.js.map +1 -1
  110. package/_esm/zksync/formatters.js +0 -1
  111. package/_esm/zksync/formatters.js.map +1 -1
  112. package/_esm/zksync/utils/abi/encodeDeployData.js +0 -1
  113. package/_esm/zksync/utils/abi/encodeDeployData.js.map +1 -1
  114. package/_esm/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js +0 -1
  115. package/_esm/zksync/utils/paymaster/getApprovalBasedPaymasterInput.js.map +1 -1
  116. package/_types/actions/public/getFilterChanges.d.ts +1 -1
  117. package/_types/actions/public/getFilterChanges.d.ts.map +1 -1
  118. package/_types/actions/public/getFilterLogs.d.ts +1 -1
  119. package/_types/actions/public/getFilterLogs.d.ts.map +1 -1
  120. package/_types/actions/public/getLogs.d.ts +1 -1
  121. package/_types/actions/public/getLogs.d.ts.map +1 -1
  122. package/_types/actions/wallet/prepareTransactionRequest.d.ts +1 -1
  123. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  124. package/_types/celo/fees.d.ts +1 -1
  125. package/_types/celo/fees.d.ts.map +1 -1
  126. package/_types/celo/types.d.ts +2 -2
  127. package/_types/celo/types.d.ts.map +1 -1
  128. package/_types/chains/definitions/btr.d.ts +37 -0
  129. package/_types/chains/definitions/btr.d.ts.map +1 -0
  130. package/_types/chains/definitions/btrTestnet.d.ts +37 -0
  131. package/_types/chains/definitions/btrTestnet.d.ts.map +1 -0
  132. package/_types/chains/definitions/rootstockTestnet.d.ts +36 -0
  133. package/_types/chains/definitions/rootstockTestnet.d.ts.map +1 -0
  134. package/_types/chains/index.d.ts +3 -0
  135. package/_types/chains/index.d.ts.map +1 -1
  136. package/_types/clients/decorators/wallet.d.ts +1 -1
  137. package/_types/clients/decorators/wallet.d.ts.map +1 -1
  138. package/_types/clients/transports/ipc.d.ts +1 -1
  139. package/_types/clients/transports/ipc.d.ts.map +1 -1
  140. package/_types/errors/version.d.ts +1 -1
  141. package/_types/experimental/eip3074/utils/toAuthMessage.d.ts +1 -1
  142. package/_types/experimental/eip3074/utils/toAuthMessage.d.ts.map +1 -1
  143. package/_types/op-stack/actions/buildProveWithdrawal.d.ts +2 -2
  144. package/_types/op-stack/actions/buildProveWithdrawal.d.ts.map +1 -1
  145. package/_types/op-stack/actions/estimateL1Fee.d.ts +2 -2
  146. package/_types/op-stack/actions/estimateL1Fee.d.ts.map +1 -1
  147. package/_types/op-stack/actions/estimateL1Gas.d.ts +2 -2
  148. package/_types/op-stack/actions/estimateL1Gas.d.ts.map +1 -1
  149. package/_types/op-stack/actions/estimateTotalFee.d.ts +1 -1
  150. package/_types/op-stack/actions/estimateTotalFee.d.ts.map +1 -1
  151. package/_types/op-stack/actions/estimateTotalGas.d.ts +1 -1
  152. package/_types/op-stack/actions/estimateTotalGas.d.ts.map +1 -1
  153. package/_types/op-stack/actions/getL1BaseFee.d.ts +3 -3
  154. package/_types/op-stack/actions/getL1BaseFee.d.ts.map +1 -1
  155. package/_types/op-stack/types/transaction.d.ts +2 -2
  156. package/_types/op-stack/types/transaction.d.ts.map +1 -1
  157. package/_types/types/contract.d.ts +1 -1
  158. package/_types/types/contract.d.ts.map +1 -1
  159. package/_types/types/eip1193.d.ts +1 -1
  160. package/_types/types/eip1193.d.ts.map +1 -1
  161. package/_types/utils/abi/getAbiItem.d.ts +1 -1
  162. package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
  163. package/_types/utils/abi/prepareEncodeFunctionData.d.ts +1 -1
  164. package/_types/utils/abi/prepareEncodeFunctionData.d.ts.map +1 -1
  165. package/_types/utils/buildRequest.d.ts.map +1 -1
  166. package/_types/utils/encoding/fromRlp.d.ts.map +1 -1
  167. package/_types/utils/promise/withCache.d.ts.map +1 -1
  168. package/_types/utils/rpc/compat.d.ts +3 -3
  169. package/_types/utils/rpc/compat.d.ts.map +1 -1
  170. package/_types/utils/transaction/serializeAccessList.d.ts +1 -1
  171. package/_types/utils/transaction/serializeAccessList.d.ts.map +1 -1
  172. package/_types/zksync/actions/sendEip712Transaction.d.ts +1 -1
  173. package/_types/zksync/actions/sendEip712Transaction.d.ts.map +1 -1
  174. package/_types/zksync/actions/sendTransaction.d.ts +1 -1
  175. package/_types/zksync/actions/sendTransaction.d.ts.map +1 -1
  176. package/_types/zksync/types/transaction.d.ts +1 -1
  177. package/_types/zksync/types/transaction.d.ts.map +1 -1
  178. package/_types/zksync/utils/abi/encodeDeployData.d.ts +1 -1
  179. package/_types/zksync/utils/abi/encodeDeployData.d.ts.map +1 -1
  180. package/_types/zksync/utils/paymaster/getApprovalBasedPaymasterInput.d.ts +1 -1
  181. package/_types/zksync/utils/paymaster/getApprovalBasedPaymasterInput.d.ts.map +1 -1
  182. package/actions/public/getFilterChanges.ts +1 -1
  183. package/actions/public/getFilterLogs.ts +1 -1
  184. package/actions/public/getLogs.ts +1 -1
  185. package/actions/wallet/prepareTransactionRequest.ts +1 -1
  186. package/actions/wallet/signTransaction.ts +1 -1
  187. package/celo/fees.ts +1 -1
  188. package/celo/formatters.ts +1 -1
  189. package/celo/types.ts +3 -3
  190. package/chains/definitions/btr.ts +28 -0
  191. package/chains/definitions/btrTestnet.ts +27 -0
  192. package/chains/definitions/rootstockTestnet.ts +21 -0
  193. package/chains/index.ts +3 -0
  194. package/clients/decorators/wallet.ts +3 -3
  195. package/clients/transports/http.ts +1 -1
  196. package/clients/transports/ipc.ts +1 -1
  197. package/errors/version.ts +1 -1
  198. package/experimental/eip3074/utils/toAuthMessage.ts +1 -1
  199. package/op-stack/actions/buildProveWithdrawal.ts +2 -2
  200. package/op-stack/actions/estimateL1Fee.ts +2 -2
  201. package/op-stack/actions/estimateL1Gas.ts +2 -2
  202. package/op-stack/actions/estimateTotalFee.ts +1 -1
  203. package/op-stack/actions/estimateTotalGas.ts +1 -1
  204. package/op-stack/actions/getL1BaseFee.ts +3 -3
  205. package/op-stack/formatters.ts +2 -2
  206. package/op-stack/types/transaction.ts +2 -2
  207. package/package.json +4 -3
  208. package/types/contract.ts +16 -16
  209. package/types/eip1193.ts +1 -1
  210. package/utils/abi/decodeAbiParameters.ts +2 -2
  211. package/utils/abi/encodeAbiParameters.ts +2 -2
  212. package/utils/abi/encodePacked.ts +3 -3
  213. package/utils/abi/getAbiItem.ts +1 -1
  214. package/utils/abi/prepareEncodeFunctionData.ts +1 -1
  215. package/utils/buildRequest.ts +2 -1
  216. package/utils/ccip.ts +1 -1
  217. package/utils/cursor.ts +2 -2
  218. package/utils/encoding/fromRlp.ts +3 -1
  219. package/utils/ens/avatar/utils.ts +1 -1
  220. package/utils/promise/withCache.ts +1 -1
  221. package/utils/rpc/compat.ts +4 -4
  222. package/utils/transaction/serializeAccessList.ts +1 -1
  223. package/utils/typedData.ts +3 -3
  224. package/zksync/actions/sendEip712Transaction.ts +2 -2
  225. package/zksync/actions/sendTransaction.ts +1 -1
  226. package/zksync/formatters.ts +1 -1
  227. package/zksync/types/transaction.ts +2 -2
  228. package/zksync/utils/abi/encodeDeployData.ts +3 -3
  229. package/zksync/utils/paymaster/getApprovalBasedPaymasterInput.ts +1 -1
@@ -0,0 +1,28 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const btr = /*#__PURE__*/ defineChain({
4
+ id: 200901,
5
+ name: 'Bitlayer',
6
+ nativeCurrency: {
7
+ name: 'Ether',
8
+ symbol: 'ETH',
9
+ decimals: 18,
10
+ },
11
+ rpcUrls: {
12
+ default: {
13
+ http: [
14
+ 'https://rpc.bitlayer.org',
15
+ 'https://rpc.bitlayer-rpc.com',
16
+ 'https://rpc.ankr.com/bitlayer',
17
+ ],
18
+ webSocket: ['wss://ws.bitlayer.org', 'wss://ws.bitlayer-rpc.com'],
19
+ },
20
+ },
21
+ blockExplorers: {
22
+ default: {
23
+ name: 'btrscan',
24
+ url: 'https://www.btrscan.com',
25
+ apiUrl: 'https://www.btrscan.com/apis',
26
+ },
27
+ },
28
+ })
@@ -0,0 +1,27 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const btrTestnet = /*#__PURE__*/ defineChain({
4
+ id: 200810,
5
+ name: 'Bitlayer Testnet',
6
+ nativeCurrency: {
7
+ name: 'Ether',
8
+ symbol: 'ETH',
9
+ decimals: 18,
10
+ },
11
+ rpcUrls: {
12
+ default: {
13
+ http: ['https://testnet-rpc.bitlayer.org'],
14
+ webSocket: [
15
+ 'wss://testnet-ws.bitlayer.org',
16
+ 'wss://testnet-ws.bitlayer-rpc.com',
17
+ ],
18
+ },
19
+ },
20
+ blockExplorers: {
21
+ default: {
22
+ name: 'btrscan',
23
+ url: 'https://testnet-scan.bitlayer.org',
24
+ apiUrl: 'https://testnet-scan.bitlayer.org/apis',
25
+ },
26
+ },
27
+ })
@@ -0,0 +1,21 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const rootstockTestnet = /*#__PURE__*/ defineChain({
4
+ id: 31,
5
+ name: 'Rootstock Testnet',
6
+ network: 'rootstock',
7
+ nativeCurrency: {
8
+ decimals: 18,
9
+ name: 'Rootstock Bitcoin',
10
+ symbol: 'tRBTC',
11
+ },
12
+ rpcUrls: {
13
+ default: { http: ['https://public-node.testnet.rsk.co'] },
14
+ },
15
+ blockExplorers: {
16
+ default: {
17
+ name: 'RSK Explorer',
18
+ url: 'https://explorer.testnet.rootstock.io',
19
+ },
20
+ },
21
+ })
package/chains/index.ts CHANGED
@@ -39,6 +39,8 @@ export { bronosTestnet } from './definitions/bronosTestnet.js'
39
39
  export { bsc } from './definitions/bsc.js'
40
40
  export { bscTestnet } from './definitions/bscTestnet.js'
41
41
  export { bscGreenfield } from './definitions/bscGreenfield.js'
42
+ export { btr } from './definitions/btr.js'
43
+ export { btrTestnet } from './definitions/btrTestnet.js'
42
44
  export { bxn } from './definitions/bxn.js'
43
45
  export { bxnTestnet } from './definitions/bxnTestnet.js'
44
46
  export { canto } from './definitions/canto.js'
@@ -194,6 +196,7 @@ export { rollux } from './definitions/rollux.js'
194
196
  export { rolluxTestnet } from './definitions/rolluxTestnet.js'
195
197
  export { ronin } from './definitions/ronin.js'
196
198
  export { rootstock } from './definitions/rootstock.js'
199
+ export { rootstockTestnet } from './definitions/rootstockTestnet.js'
197
200
  export { rss3 } from './definitions/rss3.js'
198
201
  export { rss3Sepolia } from './definitions/rss3Sepolia.js'
199
202
  export { saigon } from './definitions/saigon.js'
@@ -78,9 +78,9 @@ import {
78
78
  writeContract,
79
79
  } from '../../actions/wallet/writeContract.js'
80
80
  import type { Chain } from '../../types/chain.js'
81
- import {
82
- type ContractFunctionArgs,
83
- type ContractFunctionName,
81
+ import type {
82
+ ContractFunctionArgs,
83
+ ContractFunctionName,
84
84
  } from '../../types/contract.js'
85
85
  import type { Client } from '../createClient.js'
86
86
  import type { Transport } from '../transports/createTransport.js'
@@ -105,7 +105,7 @@ export function http(
105
105
  const body = { method, params }
106
106
 
107
107
  const { schedule } = createBatchScheduler({
108
- id: `${url}`,
108
+ id: url_,
109
109
  wait,
110
110
  shouldSplitBatch(requests) {
111
111
  return requests.length > batchSize
@@ -1,5 +1,5 @@
1
1
  import { RpcRequestError } from '../../errors/request.js'
2
- import { type UrlRequiredErrorType } from '../../errors/transport.js'
2
+ import type { UrlRequiredErrorType } from '../../errors/transport.js'
3
3
  import type { ErrorType } from '../../errors/utils.js'
4
4
  import type { Hash } from '../../types/misc.js'
5
5
  import type { RpcResponse } from '../../types/rpc.js'
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.10.5'
1
+ export const version = '2.10.8'
@@ -10,7 +10,7 @@ import {
10
10
  type NumberToHexErrorType,
11
11
  numberToHex,
12
12
  } from '../../../utils/encoding/toHex.js'
13
- import { type Keccak256ErrorType } from '../../../utils/hash/keccak256.js'
13
+ import type { Keccak256ErrorType } from '../../../utils/hash/keccak256.js'
14
14
 
15
15
  export type ToAuthMessageParameters = {
16
16
  chainId: number
@@ -20,7 +20,7 @@ import type {
20
20
  DeriveChain,
21
21
  GetChainParameter,
22
22
  } from '../../types/chain.js'
23
- import { type Hex } from '../../types/misc.js'
23
+ import type { Hex } from '../../types/misc.js'
24
24
  import type { OneOf, Prettify } from '../../types/utils.js'
25
25
  import { fromRlp } from '../../utils/encoding/fromRlp.js'
26
26
  import { toRlp } from '../../utils/encoding/toRlp.js'
@@ -31,7 +31,7 @@ import {
31
31
  type GetWithdrawalHashStorageSlotErrorType,
32
32
  getWithdrawalHashStorageSlot,
33
33
  } from '../utils/getWithdrawalHashStorageSlot.js'
34
- import { type GetGameReturnType } from './getGame.js'
34
+ import type { GetGameReturnType } from './getGame.js'
35
35
  import type { GetL2OutputReturnType } from './getL2Output.js'
36
36
  import type { ProveWithdrawalParameters } from './proveWithdrawal.js'
37
37
 
@@ -13,14 +13,14 @@ import type { Client } from '../../clients/createClient.js'
13
13
  import type { Transport } from '../../clients/transports/createTransport.js'
14
14
  import type { ErrorType } from '../../errors/utils.js'
15
15
  import type { Account, GetAccountParameter } from '../../types/account.js'
16
- import { type Chain, type GetChainParameter } from '../../types/chain.js'
16
+ import type { Chain, GetChainParameter } from '../../types/chain.js'
17
17
  import type {
18
18
  TransactionRequestEIP1559,
19
19
  TransactionSerializable,
20
20
  } from '../../types/transaction.js'
21
21
  import type { RequestErrorType } from '../../utils/buildRequest.js'
22
22
  import { getChainContractAddress } from '../../utils/chain/getChainContractAddress.js'
23
- import { type HexToNumberErrorType } from '../../utils/encoding/fromHex.js'
23
+ import type { HexToNumberErrorType } from '../../utils/encoding/fromHex.js'
24
24
  import {
25
25
  type AssertRequestErrorType,
26
26
  type AssertRequestParameters,
@@ -13,14 +13,14 @@ import type { Client } from '../../clients/createClient.js'
13
13
  import type { Transport } from '../../clients/transports/createTransport.js'
14
14
  import type { ErrorType } from '../../errors/utils.js'
15
15
  import type { Account, GetAccountParameter } from '../../types/account.js'
16
- import { type Chain, type GetChainParameter } from '../../types/chain.js'
16
+ import type { Chain, GetChainParameter } from '../../types/chain.js'
17
17
  import type {
18
18
  TransactionRequestEIP1559,
19
19
  TransactionSerializable,
20
20
  } from '../../types/transaction.js'
21
21
  import type { RequestErrorType } from '../../utils/buildRequest.js'
22
22
  import { getChainContractAddress } from '../../utils/chain/getChainContractAddress.js'
23
- import { type HexToNumberErrorType } from '../../utils/encoding/fromHex.js'
23
+ import type { HexToNumberErrorType } from '../../utils/encoding/fromHex.js'
24
24
  import {
25
25
  type AssertRequestErrorType,
26
26
  type AssertRequestParameters,
@@ -16,7 +16,7 @@ import type { Client } from '../../clients/createClient.js'
16
16
  import type { Transport } from '../../clients/transports/createTransport.js'
17
17
  import type { ErrorType } from '../../errors/utils.js'
18
18
  import type { Account } from '../../types/account.js'
19
- import { type Chain } from '../../types/chain.js'
19
+ import type { Chain } from '../../types/chain.js'
20
20
  import type { RequestErrorType } from '../../utils/buildRequest.js'
21
21
  import {
22
22
  type EstimateL1FeeErrorType,
@@ -12,7 +12,7 @@ import type { Client } from '../../clients/createClient.js'
12
12
  import type { Transport } from '../../clients/transports/createTransport.js'
13
13
  import type { ErrorType } from '../../errors/utils.js'
14
14
  import type { Account } from '../../types/account.js'
15
- import { type Chain } from '../../types/chain.js'
15
+ import type { Chain } from '../../types/chain.js'
16
16
  import type { RequestErrorType } from '../../utils/buildRequest.js'
17
17
  import {
18
18
  type EstimateL1GasErrorType,
@@ -4,14 +4,14 @@ import {
4
4
  type ReadContractErrorType,
5
5
  readContract,
6
6
  } from '../../actions/public/readContract.js'
7
- import { type PrepareTransactionRequestErrorType } from '../../actions/wallet/prepareTransactionRequest.js'
7
+ import type { PrepareTransactionRequestErrorType } from '../../actions/wallet/prepareTransactionRequest.js'
8
8
  import type { Client } from '../../clients/createClient.js'
9
9
  import type { Transport } from '../../clients/transports/createTransport.js'
10
10
  import type { ErrorType } from '../../errors/utils.js'
11
- import { type Chain, type GetChainParameter } from '../../types/chain.js'
11
+ import type { Chain, GetChainParameter } from '../../types/chain.js'
12
12
  import type { RequestErrorType } from '../../utils/buildRequest.js'
13
13
  import { getChainContractAddress } from '../../utils/chain/getChainContractAddress.js'
14
- import { type HexToNumberErrorType } from '../../utils/encoding/fromHex.js'
14
+ import type { HexToNumberErrorType } from '../../utils/encoding/fromHex.js'
15
15
 
16
16
  import { gasPriceOracleAbi } from '../abis.js'
17
17
  import { contracts } from '../contracts.js'
@@ -1,6 +1,6 @@
1
- import { type ChainFormatters } from '../types/chain.js'
1
+ import type { ChainFormatters } from '../types/chain.js'
2
2
  import type { Hash } from '../types/misc.js'
3
- import { type RpcTransaction } from '../types/rpc.js'
3
+ import type { RpcTransaction } from '../types/rpc.js'
4
4
  import { hexToBigInt } from '../utils/encoding/fromHex.js'
5
5
  import { defineBlock } from '../utils/formatters/block.js'
6
6
  import {
@@ -3,17 +3,17 @@ import type { Hex } from '../../types/misc.js'
3
3
  import type {
4
4
  Index,
5
5
  Quantity,
6
- RpcTransaction as RpcTransaction_,
7
6
  RpcTransactionReceipt,
7
+ RpcTransaction as RpcTransaction_,
8
8
  } from '../../types/rpc.js'
9
9
  import type {
10
- Transaction as Transaction_,
11
10
  TransactionBase,
12
11
  TransactionReceipt,
13
12
  TransactionSerializable,
14
13
  TransactionSerializableBase,
15
14
  TransactionSerialized,
16
15
  TransactionType,
16
+ Transaction as Transaction_,
17
17
  } from '../../types/transaction.js'
18
18
  import type { OneOf } from '../../types/utils.js'
19
19
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.10.5",
4
+ "version": "2.10.8",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -14,7 +14,8 @@
14
14
  "!**/*.test.ts.snap",
15
15
  "!**/*.test-d.ts",
16
16
  "!**/*.bench.ts",
17
- "!tsconfig.build.json"
17
+ "!tsconfig.build.json",
18
+ "!jsr.json"
18
19
  ],
19
20
  "exports": {
20
21
  ".": {
@@ -139,7 +140,7 @@
139
140
  "@scure/bip32": "1.3.2",
140
141
  "@scure/bip39": "1.2.1",
141
142
  "abitype": "1.0.0",
142
- "isows": "1.0.3",
143
+ "isows": "1.0.4",
143
144
  "ws": "8.13.0"
144
145
  },
145
146
  "license": "MIT",
package/types/contract.ts CHANGED
@@ -1,19 +1,19 @@
1
- import {
2
- type Abi,
3
- type AbiEvent,
4
- type AbiFunction,
5
- type AbiParameter,
6
- type AbiParameterToPrimitiveType,
7
- type AbiParametersToPrimitiveTypes,
8
- type AbiStateMutability,
9
- type Address,
10
- type ExtractAbiError,
11
- type ExtractAbiErrorNames,
12
- type ExtractAbiEvent,
13
- type ExtractAbiEventNames,
14
- type ExtractAbiFunction,
15
- type ExtractAbiFunctionNames,
16
- type ResolvedRegister,
1
+ import type {
2
+ Abi,
3
+ AbiEvent,
4
+ AbiFunction,
5
+ AbiParameter,
6
+ AbiParameterToPrimitiveType,
7
+ AbiParametersToPrimitiveTypes,
8
+ AbiStateMutability,
9
+ Address,
10
+ ExtractAbiError,
11
+ ExtractAbiErrorNames,
12
+ ExtractAbiEvent,
13
+ ExtractAbiEventNames,
14
+ ExtractAbiFunction,
15
+ ExtractAbiFunctionNames,
16
+ ResolvedRegister,
17
17
  } from 'abitype'
18
18
 
19
19
  import type { Hex, LogTopic } from './misc.js'
package/types/eip1193.ts CHANGED
@@ -4,13 +4,13 @@ import type { BlockTag } from './block.js'
4
4
  import type { Hash, Hex, LogTopic } from './misc.js'
5
5
  import type { RpcStateOverride } from './rpc.js'
6
6
  import type {
7
- Quantity,
8
7
  RpcBlock as Block,
9
8
  RpcBlockIdentifier as BlockIdentifier,
10
9
  RpcBlockNumber as BlockNumber,
11
10
  RpcFeeHistory as FeeHistory,
12
11
  RpcLog as Log,
13
12
  RpcProof as Proof,
13
+ Quantity,
14
14
  RpcTransaction as Transaction,
15
15
  RpcTransactionReceipt as TransactionReceipt,
16
16
  RpcTransactionRequest as TransactionRequest,
@@ -249,7 +249,7 @@ function decodeBytes(
249
249
  return [bytesToHex(data), 32]
250
250
  }
251
251
 
252
- const value = bytesToHex(cursor.readBytes(parseInt(size), 32))
252
+ const value = bytesToHex(cursor.readBytes(Number.parseInt(size), 32))
253
253
  return [value, 32]
254
254
  }
255
255
 
@@ -260,7 +260,7 @@ type DecodeNumberErrorType =
260
260
 
261
261
  function decodeNumber(cursor: Cursor, param: AbiParameter) {
262
262
  const signed = param.type.startsWith('int')
263
- const size = parseInt(param.type.split('int')[1] || '256')
263
+ const size = Number.parseInt(param.type.split('int')[1] || '256')
264
264
  const value = cursor.readBytes(32)
265
265
  return [
266
266
  size > 48
@@ -298,9 +298,9 @@ function encodeBytes<const TParam extends AbiParameter>(
298
298
  encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_]),
299
299
  }
300
300
  }
301
- if (bytesSize !== parseInt(paramSize))
301
+ if (bytesSize !== Number.parseInt(paramSize))
302
302
  throw new AbiEncodingBytesSizeMismatchError({
303
- expectedSize: parseInt(paramSize),
303
+ expectedSize: Number.parseInt(paramSize),
304
304
  value,
305
305
  })
306
306
  return { dynamic: false, encoded: padHex(value, { dir: 'right' }) }
@@ -107,7 +107,7 @@ function encode<const TPackedAbiType extends PackedAbiType | unknown>(
107
107
  const intMatch = (type as string).match(integerRegex)
108
108
  if (intMatch) {
109
109
  const [_type, baseType, bits = '256'] = intMatch
110
- const size = parseInt(bits) / 8
110
+ const size = Number.parseInt(bits) / 8
111
111
  return numberToHex(value as number, {
112
112
  size: isArray ? 32 : size,
113
113
  signed: baseType === 'int',
@@ -117,9 +117,9 @@ function encode<const TPackedAbiType extends PackedAbiType | unknown>(
117
117
  const bytesMatch = (type as string).match(bytesRegex)
118
118
  if (bytesMatch) {
119
119
  const [_type, size] = bytesMatch
120
- if (parseInt(size) !== ((value as Hex).length - 2) / 2)
120
+ if (Number.parseInt(size) !== ((value as Hex).length - 2) / 2)
121
121
  throw new BytesSizeMismatchError({
122
- expectedSize: parseInt(size),
122
+ expectedSize: Number.parseInt(size),
123
123
  givenSize: ((value as Hex).length - 2) / 2,
124
124
  })
125
125
  return pad(value as Hex, { dir: 'right', size: isArray ? 32 : null }) as Hex
@@ -1,4 +1,4 @@
1
- import { type Abi, type AbiParameter, type Address } from 'abitype'
1
+ import type { Abi, AbiParameter, Address } from 'abitype'
2
2
 
3
3
  import { AbiItemAmbiguityError } from '../../errors/abi.js'
4
4
  import type { ErrorType } from '../../errors/utils.js'
@@ -13,7 +13,7 @@ import type {
13
13
  ContractFunctionArgs,
14
14
  ContractFunctionName,
15
15
  } from '../../types/contract.js'
16
- import { type ConcatHexErrorType } from '../data/concat.js'
16
+ import type { ConcatHexErrorType } from '../data/concat.js'
17
17
  import {
18
18
  type ToFunctionSelectorErrorType,
19
19
  toFunctionSelector,
@@ -176,7 +176,8 @@ export function buildRequest<request extends (args: any) => Promise<any>>(
176
176
  // If we find a Retry-After header, let's retry after the given time.
177
177
  if (error && error instanceof HttpRequestError) {
178
178
  const retryAfter = error?.headers?.get('Retry-After')
179
- if (retryAfter?.match(/\d/)) return parseInt(retryAfter) * 1000
179
+ if (retryAfter?.match(/\d/))
180
+ return Number.parseInt(retryAfter) * 1000
180
181
  }
181
182
 
182
183
  // Otherwise, let's retry with an exponential backoff.
package/utils/ccip.ts CHANGED
@@ -2,7 +2,7 @@ import type { Abi, Address } from 'abitype'
2
2
 
3
3
  import { type CallParameters, call } from '../actions/public/call.js'
4
4
  import type { Transport } from '../clients/transports/createTransport.js'
5
- import { type BaseError } from '../errors/base.js'
5
+ import type { BaseError } from '../errors/base.js'
6
6
  import {
7
7
  OffchainLookupError,
8
8
  OffchainLookupResponseMalformedError,
package/utils/cursor.ts CHANGED
@@ -61,7 +61,7 @@ const staticCursor: Cursor = {
61
61
  position: 0,
62
62
  positionReadCount: new Map(),
63
63
  recursiveReadCount: 0,
64
- recursiveReadLimit: Infinity,
64
+ recursiveReadLimit: Number.POSITIVE_INFINITY,
65
65
  assertReadLimit() {
66
66
  if (this.recursiveReadCount >= this.recursiveReadLimit)
67
67
  throw new RecursiveReadLimitExceededError({
@@ -207,7 +207,7 @@ const staticCursor: Cursor = {
207
207
  return () => (this.position = oldPosition)
208
208
  },
209
209
  _touch() {
210
- if (this.recursiveReadLimit === Infinity) return
210
+ if (this.recursiveReadLimit === Number.POSITIVE_INFINITY) return
211
211
  const count = this.getReadCount()
212
212
  this.positionReadCount.set(this.position, count + 1)
213
213
  if (count > 0) this.recursiveReadCount++
@@ -41,7 +41,9 @@ export function fromRlp<to extends To = 'hex'>(
41
41
  return value
42
42
  })()
43
43
 
44
- const cursor = createCursor(bytes, { recursiveReadLimit: Infinity })
44
+ const cursor = createCursor(bytes, {
45
+ recursiveReadLimit: Number.POSITIVE_INFINITY,
46
+ })
45
47
  const result = fromRlpCursor(cursor, to)
46
48
 
47
49
  return result as FromRlpReturnType<to>
@@ -244,7 +244,7 @@ export function parseNftUri(uri_: string): ParsedNft {
244
244
  throw new EnsAvatarInvalidNftUriError({ reason: 'ERC namespace not found' })
245
245
 
246
246
  return {
247
- chainID: parseInt(chainID),
247
+ chainID: Number.parseInt(chainID),
248
248
  namespace: erc_namespace.toLowerCase(),
249
249
  contractAddress: contractAddress as Address,
250
250
  tokenID,
@@ -41,7 +41,7 @@ export type WithCacheParameters = {
41
41
  */
42
42
  export async function withCache<TData>(
43
43
  fn: () => Promise<TData>,
44
- { cacheKey, cacheTime = Infinity }: WithCacheParameters,
44
+ { cacheKey, cacheTime = Number.POSITIVE_INFINITY }: WithCacheParameters,
45
45
  ) {
46
46
  const cache = getCache<TData>(cacheKey)
47
47
 
@@ -2,15 +2,15 @@
2
2
  // These APIs will be removed in v3.
3
3
 
4
4
  /* c8 ignore start */
5
- import {
6
- type TimeoutErrorType,
5
+ import type {
6
+ TimeoutErrorType,
7
7
  WebSocketRequestError,
8
8
  } from '../../errors/request.js'
9
9
  import type { ErrorType } from '../../errors/utils.js'
10
10
  import type { RpcResponse } from '../../types/rpc.js'
11
- import { type WithTimeoutErrorType } from '../promise/withTimeout.js'
11
+ import type { WithTimeoutErrorType } from '../promise/withTimeout.js'
12
12
  import { type HttpRequestParameters, getHttpRpcClient } from './http.js'
13
- import { type SocketRpcClient } from './socket.js'
13
+ import type { SocketRpcClient } from './socket.js'
14
14
  import { getWebSocketRpcClient } from './webSocket.js'
15
15
 
16
16
  export type WebSocketOptions = Parameters<
@@ -10,7 +10,7 @@ import type { ErrorType } from '../../errors/utils.js'
10
10
  import type { Hex } from '../../types/misc.js'
11
11
  import type { AccessList } from '../../types/transaction.js'
12
12
  import { type IsAddressErrorType, isAddress } from '../address/isAddress.js'
13
- import { type RecursiveArray } from '../encoding/toRlp.js'
13
+ import type { RecursiveArray } from '../encoding/toRlp.js'
14
14
 
15
15
  export type SerializeAccessListErrorType =
16
16
  | InvalidStorageKeySizeErrorType
@@ -47,7 +47,7 @@ export function validateTypedData<
47
47
  // and will throw.
48
48
  numberToHex(value, {
49
49
  signed: base === 'int',
50
- size: parseInt(size_) / 8,
50
+ size: Number.parseInt(size_) / 8,
51
51
  })
52
52
  }
53
53
 
@@ -57,9 +57,9 @@ export function validateTypedData<
57
57
  const bytesMatch = type.match(bytesRegex)
58
58
  if (bytesMatch) {
59
59
  const [_type, size_] = bytesMatch
60
- if (size_ && size(value as Hex) !== parseInt(size_))
60
+ if (size_ && size(value as Hex) !== Number.parseInt(size_))
61
61
  throw new BytesSizeMismatchError({
62
- expectedSize: parseInt(size_),
62
+ expectedSize: Number.parseInt(size_),
63
63
  givenSize: size(value as Hex),
64
64
  })
65
65
  }
@@ -11,7 +11,7 @@ import type {
11
11
  import type { Client } from '../../clients/createClient.js'
12
12
  import type { Transport } from '../../clients/transports/createTransport.js'
13
13
  import { AccountNotFoundError } from '../../errors/account.js'
14
- import { BaseError } from '../../errors/base.js'
14
+ import type { BaseError } from '../../errors/base.js'
15
15
  import type { Chain } from '../../types/chain.js'
16
16
  import { assertCurrentChain } from '../../utils/chain/assertCurrentChain.js'
17
17
  import {
@@ -19,7 +19,7 @@ import {
19
19
  getTransactionError,
20
20
  } from '../../utils/errors/getTransactionError.js'
21
21
  import { getAction } from '../../utils/getAction.js'
22
- import { type ChainEIP712 } from '../types/chain.js'
22
+ import type { ChainEIP712 } from '../types/chain.js'
23
23
  import { assertEip712Request } from '../utils/assertEip712Request.js'
24
24
  import { signTransaction } from './signTransaction.js'
25
25
 
@@ -7,7 +7,7 @@ import type {
7
7
  } from '../../actions/wallet/sendTransaction.js'
8
8
  import type { Client } from '../../clients/createClient.js'
9
9
  import type { Transport } from '../../clients/transports/createTransport.js'
10
- import { type ChainEIP712 } from '../types/chain.js'
10
+ import type { ChainEIP712 } from '../types/chain.js'
11
11
  import { isEIP712Transaction } from '../utils/isEip712Transaction.js'
12
12
  import { sendEip712Transaction } from './sendEip712Transaction.js'
13
13
 
@@ -1,4 +1,4 @@
1
- import { type ChainFormatters } from '../types/chain.js'
1
+ import type { ChainFormatters } from '../types/chain.js'
2
2
  import type { Hash } from '../types/misc.js'
3
3
  import { hexToBigInt, hexToNumber } from '../utils/encoding/fromHex.js'
4
4
  import { hexToBytes } from '../utils/encoding/toBytes.js'
@@ -7,18 +7,18 @@ import type {
7
7
  RpcTransactionRequest as RpcTransactionRequest_,
8
8
  } from '../../types/rpc.js'
9
9
  import type {
10
- Transaction as Transaction_,
11
10
  TransactionBase,
12
11
  TransactionEIP1559 as TransactionEIP1559_,
13
12
  TransactionEIP2930 as TransactionEIP2930_,
14
13
  TransactionLegacy as TransactionLegacy_,
15
14
  TransactionReceipt,
16
- TransactionRequest as TransactionRequest_,
17
15
  TransactionRequestBase,
16
+ TransactionRequest as TransactionRequest_,
18
17
  TransactionSerializable,
19
18
  TransactionSerializableEIP1559,
20
19
  TransactionSerialized,
21
20
  TransactionType,
21
+ Transaction as Transaction_,
22
22
  } from '../../types/transaction.js'
23
23
  import type { ExactPartial, OneOf, UnionOmit } from '../../types/utils.js'
24
24
  import type { ZkSyncEip712Meta } from './eip712.js'
@@ -9,9 +9,9 @@ import type { ContractConstructorArgs } from '../../../types/contract.js'
9
9
  import type { Hash } from '../../../types/misc.js'
10
10
  import type { Hex } from '../../../types/misc.js'
11
11
  import { encodeAbiParameters } from '../../../utils/abi/encodeAbiParameters.js'
12
- import {
13
- type EncodeDeployDataParameters as EncodeDeployDataParameters_,
14
- type EncodeDeployDataReturnType,
12
+ import type {
13
+ EncodeDeployDataParameters as EncodeDeployDataParameters_,
14
+ EncodeDeployDataReturnType,
15
15
  } from '../../../utils/abi/encodeDeployData.js'
16
16
  import { encodeFunctionData } from '../../../utils/abi/encodeFunctionData.js'
17
17
  import { toHex } from '../../../utils/encoding/toHex.js'
@@ -1,4 +1,4 @@
1
- import { type Address } from 'abitype'
1
+ import type { Address } from 'abitype'
2
2
  import type { ByteArray, Hex } from '../../../types/misc.js'
3
3
  import type { EncodeFunctionDataReturnType } from '../../../utils/abi/encodeFunctionData.js'
4
4
  import { bytesToHex, encodeFunctionData } from '../../../utils/index.js'