viem 2.30.0 → 2.30.2

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 (146) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/_cjs/actions/public/call.js +2 -2
  3. package/_cjs/actions/public/call.js.map +1 -1
  4. package/_cjs/actions/public/estimateGas.js +1 -1
  5. package/_cjs/actions/public/estimateGas.js.map +1 -1
  6. package/_cjs/actions/public/simulateBlocks.js +1 -1
  7. package/_cjs/actions/public/simulateBlocks.js.map +1 -1
  8. package/_cjs/actions/public/waitForTransactionReceipt.js +9 -3
  9. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  10. package/_cjs/actions/public/watchBlocks.js +4 -2
  11. package/_cjs/actions/public/watchBlocks.js.map +1 -1
  12. package/_cjs/chains/definitions/bitkub.js +3 -3
  13. package/_cjs/chains/definitions/bitkub.js.map +1 -1
  14. package/_cjs/chains/definitions/chiliz.js +1 -1
  15. package/_cjs/chains/definitions/chiliz.js.map +1 -1
  16. package/_cjs/chains/definitions/jbc.js +1 -1
  17. package/_cjs/chains/definitions/jbc.js.map +1 -1
  18. package/_cjs/chains/definitions/riseTestnet.js +29 -0
  19. package/_cjs/chains/definitions/riseTestnet.js.map +1 -0
  20. package/_cjs/chains/index.js +6 -4
  21. package/_cjs/chains/index.js.map +1 -1
  22. package/_cjs/errors/version.js +1 -1
  23. package/_cjs/utils/rpc/socket.js +8 -4
  24. package/_cjs/utils/rpc/socket.js.map +1 -1
  25. package/_cjs/zksync/actions/claimFailedDeposit.js +146 -0
  26. package/_cjs/zksync/actions/claimFailedDeposit.js.map +1 -0
  27. package/_cjs/zksync/actions/deposit.js +51 -4
  28. package/_cjs/zksync/actions/deposit.js.map +1 -1
  29. package/_cjs/zksync/actions/finalizeWithdrawal.js +41 -41
  30. package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
  31. package/_cjs/zksync/actions/getDefaultBridgeAddresses.js +2 -0
  32. package/_cjs/zksync/actions/getDefaultBridgeAddresses.js.map +1 -1
  33. package/_cjs/zksync/actions/isWithdrawalFinalized.js +2 -17
  34. package/_cjs/zksync/actions/isWithdrawalFinalized.js.map +1 -1
  35. package/_cjs/zksync/actions/withdraw.js +49 -8
  36. package/_cjs/zksync/actions/withdraw.js.map +1 -1
  37. package/_cjs/zksync/constants/address.js +4 -1
  38. package/_cjs/zksync/constants/address.js.map +1 -1
  39. package/_cjs/zksync/decorators/walletL1.js +2 -0
  40. package/_cjs/zksync/decorators/walletL1.js.map +1 -1
  41. package/_cjs/zksync/errors/bridge.js +23 -1
  42. package/_cjs/zksync/errors/bridge.js.map +1 -1
  43. package/_cjs/zksync/index.js +4 -2
  44. package/_cjs/zksync/index.js.map +1 -1
  45. package/_esm/actions/public/call.js +2 -2
  46. package/_esm/actions/public/call.js.map +1 -1
  47. package/_esm/actions/public/estimateGas.js +1 -1
  48. package/_esm/actions/public/estimateGas.js.map +1 -1
  49. package/_esm/actions/public/simulateBlocks.js +1 -1
  50. package/_esm/actions/public/simulateBlocks.js.map +1 -1
  51. package/_esm/actions/public/waitForTransactionReceipt.js +10 -3
  52. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  53. package/_esm/actions/public/watchBlocks.js +4 -2
  54. package/_esm/actions/public/watchBlocks.js.map +1 -1
  55. package/_esm/chains/definitions/bitkub.js +3 -3
  56. package/_esm/chains/definitions/bitkub.js.map +1 -1
  57. package/_esm/chains/definitions/chiliz.js +1 -1
  58. package/_esm/chains/definitions/chiliz.js.map +1 -1
  59. package/_esm/chains/definitions/jbc.js +1 -1
  60. package/_esm/chains/definitions/jbc.js.map +1 -1
  61. package/_esm/chains/definitions/riseTestnet.js +26 -0
  62. package/_esm/chains/definitions/riseTestnet.js.map +1 -0
  63. package/_esm/chains/index.js +2 -0
  64. package/_esm/chains/index.js.map +1 -1
  65. package/_esm/errors/version.js +1 -1
  66. package/_esm/utils/rpc/socket.js +10 -6
  67. package/_esm/utils/rpc/socket.js.map +1 -1
  68. package/_esm/zksync/actions/claimFailedDeposit.js +199 -0
  69. package/_esm/zksync/actions/claimFailedDeposit.js.map +1 -0
  70. package/_esm/zksync/actions/deposit.js +61 -11
  71. package/_esm/zksync/actions/deposit.js.map +1 -1
  72. package/_esm/zksync/actions/finalizeWithdrawal.js +42 -42
  73. package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
  74. package/_esm/zksync/actions/getDefaultBridgeAddresses.js +2 -0
  75. package/_esm/zksync/actions/getDefaultBridgeAddresses.js.map +1 -1
  76. package/_esm/zksync/actions/isWithdrawalFinalized.js +3 -18
  77. package/_esm/zksync/actions/isWithdrawalFinalized.js.map +1 -1
  78. package/_esm/zksync/actions/withdraw.js +54 -10
  79. package/_esm/zksync/actions/withdraw.js.map +1 -1
  80. package/_esm/zksync/constants/address.js +3 -0
  81. package/_esm/zksync/constants/address.js.map +1 -1
  82. package/_esm/zksync/decorators/walletL1.js +2 -0
  83. package/_esm/zksync/decorators/walletL1.js.map +1 -1
  84. package/_esm/zksync/errors/bridge.js +19 -0
  85. package/_esm/zksync/errors/bridge.js.map +1 -1
  86. package/_esm/zksync/index.js +1 -0
  87. package/_esm/zksync/index.js.map +1 -1
  88. package/_types/actions/public/call.d.ts +1 -1
  89. package/_types/actions/public/estimateGas.d.ts +1 -1
  90. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  91. package/_types/actions/public/watchBlocks.d.ts.map +1 -1
  92. package/_types/chains/definitions/bitkub.d.ts +3 -3
  93. package/_types/chains/definitions/chiliz.d.ts +1 -1
  94. package/_types/chains/definitions/jbc.d.ts +1 -1
  95. package/_types/chains/definitions/riseTestnet.d.ts +35 -0
  96. package/_types/chains/definitions/riseTestnet.d.ts.map +1 -0
  97. package/_types/chains/index.d.ts +2 -0
  98. package/_types/chains/index.d.ts.map +1 -1
  99. package/_types/errors/version.d.ts +1 -1
  100. package/_types/utils/rpc/socket.d.ts.map +1 -1
  101. package/_types/zksync/actions/claimFailedDeposit.d.ts +77 -0
  102. package/_types/zksync/actions/claimFailedDeposit.d.ts.map +1 -0
  103. package/_types/zksync/actions/deposit.d.ts +0 -1
  104. package/_types/zksync/actions/deposit.d.ts.map +1 -1
  105. package/_types/zksync/actions/finalizeWithdrawal.d.ts.map +1 -1
  106. package/_types/zksync/actions/getDefaultBridgeAddresses.d.ts.map +1 -1
  107. package/_types/zksync/actions/isWithdrawalFinalized.d.ts.map +1 -1
  108. package/_types/zksync/actions/withdraw.d.ts +1 -1
  109. package/_types/zksync/actions/withdraw.d.ts.map +1 -1
  110. package/_types/zksync/constants/address.d.ts +3 -0
  111. package/_types/zksync/constants/address.d.ts.map +1 -1
  112. package/_types/zksync/decorators/walletL1.d.ts +32 -1
  113. package/_types/zksync/decorators/walletL1.d.ts.map +1 -1
  114. package/_types/zksync/errors/bridge.d.ts +23 -0
  115. package/_types/zksync/errors/bridge.d.ts.map +1 -1
  116. package/_types/zksync/index.d.ts +1 -0
  117. package/_types/zksync/index.d.ts.map +1 -1
  118. package/_types/zksync/types/contract.d.ts +2 -0
  119. package/_types/zksync/types/contract.d.ts.map +1 -1
  120. package/_types/zksync/types/eip1193.d.ts +2 -0
  121. package/_types/zksync/types/eip1193.d.ts.map +1 -1
  122. package/actions/public/call.ts +3 -3
  123. package/actions/public/estimateGas.ts +2 -2
  124. package/actions/public/simulateBlocks.ts +1 -1
  125. package/actions/public/waitForTransactionReceipt.ts +159 -158
  126. package/actions/public/watchBlocks.ts +7 -5
  127. package/chains/definitions/bitkub.ts +3 -3
  128. package/chains/definitions/chiliz.ts +1 -1
  129. package/chains/definitions/jbc.ts +1 -1
  130. package/chains/definitions/riseTestnet.ts +26 -0
  131. package/chains/index.ts +2 -0
  132. package/errors/version.ts +1 -1
  133. package/package.json +7 -7
  134. package/utils/rpc/socket.ts +10 -8
  135. package/zksync/actions/claimFailedDeposit.ts +319 -0
  136. package/zksync/actions/deposit.ts +116 -14
  137. package/zksync/actions/finalizeWithdrawal.ts +53 -51
  138. package/zksync/actions/getDefaultBridgeAddresses.ts +3 -0
  139. package/zksync/actions/isWithdrawalFinalized.ts +4 -22
  140. package/zksync/actions/withdraw.ts +64 -8
  141. package/zksync/constants/address.ts +9 -0
  142. package/zksync/decorators/walletL1.ts +49 -1
  143. package/zksync/errors/bridge.ts +35 -0
  144. package/zksync/index.ts +6 -0
  145. package/zksync/types/contract.ts +2 -0
  146. package/zksync/types/eip1193.ts +2 -0
@@ -152,195 +152,196 @@ export async function waitForTransactionReceipt<
152
152
  let receipt: GetTransactionReceiptReturnType<chain>
153
153
  let retrying = false
154
154
 
155
+ // biome-ignore lint/style/useConst:
156
+ let _unobserve: () => void
157
+ let _unwatch: () => void
158
+
155
159
  const { promise, resolve, reject } =
156
160
  withResolvers<WaitForTransactionReceiptReturnType<chain>>()
157
161
 
158
162
  const timer = timeout
159
- ? setTimeout(
160
- () => reject(new WaitForTransactionReceiptTimeoutError({ hash })),
161
- timeout,
162
- )
163
+ ? setTimeout(() => {
164
+ _unwatch()
165
+ _unobserve()
166
+ reject(new WaitForTransactionReceiptTimeoutError({ hash }))
167
+ }, timeout)
163
168
  : undefined
164
169
 
165
- const _unobserve = observe(
166
- observerId,
167
- { onReplaced, resolve, reject },
168
- (emit) => {
169
- const _unwatch = getAction(
170
- client,
171
- watchBlockNumber,
172
- 'watchBlockNumber',
173
- )({
174
- emitMissed: true,
175
- emitOnBegin: true,
176
- poll: true,
177
- pollingInterval,
178
- async onBlockNumber(blockNumber_) {
179
- const done = (fn: () => void) => {
180
- clearTimeout(timer)
181
- _unwatch()
182
- fn()
183
- _unobserve()
170
+ _unobserve = observe(observerId, { onReplaced, resolve, reject }, (emit) => {
171
+ _unwatch = getAction(
172
+ client,
173
+ watchBlockNumber,
174
+ 'watchBlockNumber',
175
+ )({
176
+ emitMissed: true,
177
+ emitOnBegin: true,
178
+ poll: true,
179
+ pollingInterval,
180
+ async onBlockNumber(blockNumber_) {
181
+ const done = (fn: () => void) => {
182
+ clearTimeout(timer)
183
+ _unwatch()
184
+ fn()
185
+ _unobserve()
186
+ }
187
+
188
+ let blockNumber = blockNumber_
189
+
190
+ if (retrying) return
191
+
192
+ try {
193
+ // If we already have a valid receipt, let's check if we have enough
194
+ // confirmations. If we do, then we can resolve.
195
+ if (receipt) {
196
+ if (
197
+ confirmations > 1 &&
198
+ (!receipt.blockNumber ||
199
+ blockNumber - receipt.blockNumber + 1n < confirmations)
200
+ )
201
+ return
202
+
203
+ done(() => emit.resolve(receipt))
204
+ return
184
205
  }
185
206
 
186
- let blockNumber = blockNumber_
207
+ // Get the transaction to check if it's been replaced.
208
+ // We need to retry as some RPC Providers may be slow to sync
209
+ // up mined transactions.
210
+ if (!transaction) {
211
+ retrying = true
212
+ await withRetry(
213
+ async () => {
214
+ transaction = (await getAction(
215
+ client,
216
+ getTransaction,
217
+ 'getTransaction',
218
+ )({ hash })) as GetTransactionReturnType<chain>
219
+ if (transaction.blockNumber)
220
+ blockNumber = transaction.blockNumber
221
+ },
222
+ {
223
+ delay: retryDelay,
224
+ retryCount,
225
+ },
226
+ )
227
+ retrying = false
228
+ }
187
229
 
188
- if (retrying) return
230
+ // Get the receipt to check if it's been processed.
231
+ receipt = await getAction(
232
+ client,
233
+ getTransactionReceipt,
234
+ 'getTransactionReceipt',
235
+ )({ hash })
189
236
 
190
- try {
191
- // If we already have a valid receipt, let's check if we have enough
192
- // confirmations. If we do, then we can resolve.
193
- if (receipt) {
194
- if (
195
- confirmations > 1 &&
196
- (!receipt.blockNumber ||
197
- blockNumber - receipt.blockNumber + 1n < confirmations)
198
- )
199
- return
237
+ // Check if we have enough confirmations. If not, continue polling.
238
+ if (
239
+ confirmations > 1 &&
240
+ (!receipt.blockNumber ||
241
+ blockNumber - receipt.blockNumber + 1n < confirmations)
242
+ )
243
+ return
200
244
 
201
- done(() => emit.resolve(receipt))
245
+ done(() => emit.resolve(receipt))
246
+ } catch (err) {
247
+ // If the receipt is not found, the transaction will be pending.
248
+ // We need to check if it has potentially been replaced.
249
+ if (
250
+ err instanceof TransactionNotFoundError ||
251
+ err instanceof TransactionReceiptNotFoundError
252
+ ) {
253
+ if (!transaction) {
254
+ retrying = false
202
255
  return
203
256
  }
204
257
 
205
- // Get the transaction to check if it's been replaced.
206
- // We need to retry as some RPC Providers may be slow to sync
207
- // up mined transactions.
208
- if (!transaction) {
258
+ try {
259
+ replacedTransaction = transaction
260
+
261
+ // Let's retrieve the transactions from the current block.
262
+ // We need to retry as some RPC Providers may be slow to sync
263
+ // up mined blocks.
209
264
  retrying = true
210
- await withRetry(
211
- async () => {
212
- transaction = (await getAction(
265
+ const block = await withRetry(
266
+ () =>
267
+ getAction(
213
268
  client,
214
- getTransaction,
215
- 'getTransaction',
216
- )({ hash })) as GetTransactionReturnType<chain>
217
- if (transaction.blockNumber)
218
- blockNumber = transaction.blockNumber
219
- },
269
+ getBlock,
270
+ 'getBlock',
271
+ )({
272
+ blockNumber,
273
+ includeTransactions: true,
274
+ }),
220
275
  {
221
276
  delay: retryDelay,
222
277
  retryCount,
278
+ shouldRetry: ({ error }) =>
279
+ error instanceof BlockNotFoundError,
223
280
  },
224
281
  )
225
282
  retrying = false
226
- }
227
283
 
228
- // Get the receipt to check if it's been processed.
229
- receipt = await getAction(
230
- client,
231
- getTransactionReceipt,
232
- 'getTransactionReceipt',
233
- )({ hash })
234
-
235
- // Check if we have enough confirmations. If not, continue polling.
236
- if (
237
- confirmations > 1 &&
238
- (!receipt.blockNumber ||
239
- blockNumber - receipt.blockNumber + 1n < confirmations)
240
- )
241
- return
242
-
243
- done(() => emit.resolve(receipt))
244
- } catch (err) {
245
- // If the receipt is not found, the transaction will be pending.
246
- // We need to check if it has potentially been replaced.
247
- if (
248
- err instanceof TransactionNotFoundError ||
249
- err instanceof TransactionReceiptNotFoundError
250
- ) {
251
- if (!transaction) {
252
- retrying = false
253
- return
254
- }
255
-
256
- try {
257
- replacedTransaction = transaction
258
-
259
- // Let's retrieve the transactions from the current block.
260
- // We need to retry as some RPC Providers may be slow to sync
261
- // up mined blocks.
262
- retrying = true
263
- const block = await withRetry(
264
- () =>
265
- getAction(
266
- client,
267
- getBlock,
268
- 'getBlock',
269
- )({
270
- blockNumber,
271
- includeTransactions: true,
272
- }),
273
- {
274
- delay: retryDelay,
275
- retryCount,
276
- shouldRetry: ({ error }) =>
277
- error instanceof BlockNotFoundError,
278
- },
279
- )
280
- retrying = false
281
-
282
- const replacementTransaction = (
283
- block.transactions as {} as Transaction[]
284
- ).find(
285
- ({ from, nonce }) =>
286
- from === replacedTransaction!.from &&
287
- nonce === replacedTransaction!.nonce,
288
- )
284
+ const replacementTransaction = (
285
+ block.transactions as {} as Transaction[]
286
+ ).find(
287
+ ({ from, nonce }) =>
288
+ from === replacedTransaction!.from &&
289
+ nonce === replacedTransaction!.nonce,
290
+ )
289
291
 
290
- // If we couldn't find a replacement transaction, continue polling.
291
- if (!replacementTransaction) return
292
+ // If we couldn't find a replacement transaction, continue polling.
293
+ if (!replacementTransaction) return
292
294
 
293
- // If we found a replacement transaction, return it's receipt.
294
- receipt = await getAction(
295
- client,
296
- getTransactionReceipt,
297
- 'getTransactionReceipt',
298
- )({
299
- hash: replacementTransaction.hash,
300
- })
295
+ // If we found a replacement transaction, return it's receipt.
296
+ receipt = await getAction(
297
+ client,
298
+ getTransactionReceipt,
299
+ 'getTransactionReceipt',
300
+ )({
301
+ hash: replacementTransaction.hash,
302
+ })
301
303
 
302
- // Check if we have enough confirmations. If not, continue polling.
303
- if (
304
- confirmations > 1 &&
305
- (!receipt.blockNumber ||
306
- blockNumber - receipt.blockNumber + 1n < confirmations)
307
- )
308
- return
304
+ // Check if we have enough confirmations. If not, continue polling.
305
+ if (
306
+ confirmations > 1 &&
307
+ (!receipt.blockNumber ||
308
+ blockNumber - receipt.blockNumber + 1n < confirmations)
309
+ )
310
+ return
309
311
 
310
- let reason: ReplacementReason = 'replaced'
311
- if (
312
- replacementTransaction.to === replacedTransaction.to &&
313
- replacementTransaction.value === replacedTransaction.value &&
314
- replacementTransaction.input === replacedTransaction.input
315
- ) {
316
- reason = 'repriced'
317
- } else if (
318
- replacementTransaction.from === replacementTransaction.to &&
319
- replacementTransaction.value === 0n
320
- ) {
321
- reason = 'cancelled'
322
- }
312
+ let reason: ReplacementReason = 'replaced'
313
+ if (
314
+ replacementTransaction.to === replacedTransaction.to &&
315
+ replacementTransaction.value === replacedTransaction.value &&
316
+ replacementTransaction.input === replacedTransaction.input
317
+ ) {
318
+ reason = 'repriced'
319
+ } else if (
320
+ replacementTransaction.from === replacementTransaction.to &&
321
+ replacementTransaction.value === 0n
322
+ ) {
323
+ reason = 'cancelled'
324
+ }
323
325
 
324
- done(() => {
325
- emit.onReplaced?.({
326
- reason,
327
- replacedTransaction: replacedTransaction! as any,
328
- transaction: replacementTransaction,
329
- transactionReceipt: receipt,
330
- })
331
- emit.resolve(receipt)
326
+ done(() => {
327
+ emit.onReplaced?.({
328
+ reason,
329
+ replacedTransaction: replacedTransaction! as any,
330
+ transaction: replacementTransaction,
331
+ transactionReceipt: receipt,
332
332
  })
333
- } catch (err_) {
334
- done(() => emit.reject(err_))
335
- }
336
- } else {
337
- done(() => emit.reject(err))
333
+ emit.resolve(receipt)
334
+ })
335
+ } catch (err_) {
336
+ done(() => emit.reject(err_))
338
337
  }
338
+ } else {
339
+ done(() => emit.reject(err))
339
340
  }
340
- },
341
- })
342
- },
343
- )
341
+ }
342
+ },
343
+ })
344
+ })
344
345
 
345
346
  return promise
346
347
  }
@@ -213,12 +213,14 @@ export function watchBlocks<
213
213
  )({
214
214
  blockTag,
215
215
  includeTransactions,
216
- }).then((block) => {
217
- if (!active) return
218
- if (!emitFetched) return
219
- onBlock(block as any, undefined)
220
- emitFetched = false
221
216
  })
217
+ .then((block) => {
218
+ if (!active) return
219
+ if (!emitFetched) return
220
+ onBlock(block as any, undefined)
221
+ emitFetched = false
222
+ })
223
+ .catch(onError)
222
224
  }
223
225
 
224
226
  const transport = (() => {
@@ -2,8 +2,8 @@ import { defineChain } from '../../utils/chain/defineChain.js'
2
2
 
3
3
  export const bitkub = /*#__PURE__*/ defineChain({
4
4
  id: 96,
5
- name: 'Bitkub',
6
- nativeCurrency: { name: 'Bitkub', symbol: 'KUB', decimals: 18 },
5
+ name: 'KUB Mainnet',
6
+ nativeCurrency: { name: 'KUB Coin', symbol: 'KUB', decimals: 18 },
7
7
  rpcUrls: {
8
8
  default: {
9
9
  http: ['https://rpc.bitkubchain.io'],
@@ -11,7 +11,7 @@ export const bitkub = /*#__PURE__*/ defineChain({
11
11
  },
12
12
  blockExplorers: {
13
13
  default: {
14
- name: 'Bitkub Chain Mainnet Explorer',
14
+ name: 'KUB Chain Mainnet Explorer',
15
15
  url: 'https://www.bkcscan.com',
16
16
  apiUrl: 'https://www.bkcscan.com/api',
17
17
  },
@@ -11,7 +11,7 @@ export const chiliz = /*#__PURE__*/ defineChain({
11
11
  },
12
12
  rpcUrls: {
13
13
  default: {
14
- http: ['https://chiliz-rpc.publicnode.com'],
14
+ http: ['https://rpc.chiliz.com'],
15
15
  },
16
16
  },
17
17
  blockExplorers: {
@@ -2,7 +2,7 @@ import { defineChain } from '../../utils/chain/defineChain.js'
2
2
 
3
3
  export const jbc = /*#__PURE__*/ defineChain({
4
4
  id: 8899,
5
- name: 'JIBCHAIN L1',
5
+ name: 'JB Chain',
6
6
  network: 'jbc',
7
7
  nativeCurrency: { name: 'JBC', symbol: 'JBC', decimals: 18 },
8
8
  rpcUrls: {
@@ -0,0 +1,26 @@
1
+ import { defineChain } from '../../utils/chain/defineChain.js'
2
+
3
+ export const riseTestnet = /*#__PURE__*/ defineChain({
4
+ id: 11_155_931,
5
+ name: 'RISE Testnet',
6
+ nativeCurrency: { name: 'RISE Testnet Ether', symbol: 'ETH', decimals: 18 },
7
+ rpcUrls: {
8
+ default: {
9
+ http: ['https://testnet.riselabs.xyz'],
10
+ webSocket: ['wss://testnet.riselabs.xyz/ws'],
11
+ },
12
+ },
13
+ blockExplorers: {
14
+ default: {
15
+ name: 'Blockscout',
16
+ url: 'https://explorer.testnet.riselabs.xyz/',
17
+ apiUrl: 'https://explorer.testnet.riselabs.xyz/api',
18
+ },
19
+ },
20
+ contracts: {
21
+ multicall3: {
22
+ address: '0xca11bde05977b3631167028862be2a173976ca11',
23
+ },
24
+ },
25
+ testnet: true,
26
+ })
package/chains/index.ts CHANGED
@@ -427,6 +427,7 @@ export { redstone } from './definitions/redstone.js'
427
427
  export { rei } from './definitions/rei.js'
428
428
  export { reyaNetwork } from './definitions/reyaNetwork.js'
429
429
  export { reddioSepolia } from './definitions/reddioSepolia.js'
430
+ export { riseTestnet } from './definitions/riseTestnet.js'
430
431
  export { rivalz } from './definitions/rivalz.js'
431
432
  export { rollux } from './definitions/rollux.js'
432
433
  export { rolluxTestnet } from './definitions/rolluxTestnet.js'
@@ -602,6 +603,7 @@ export { zilliqa } from './definitions/zilliqa.js'
602
603
  export { zilliqaTestnet } from './definitions/zilliqaTestnet.js'
603
604
  export { zircuit } from './definitions/zircuit.js'
604
605
  export { zircuitGarfieldTestnet } from './definitions/zircuitGarfieldTestnet.js'
606
+ /** @deprecated Use zircuitGarfieldTestnet instead */
605
607
  export { zircuitTestnet } from './definitions/zircuitTestnet.js'
606
608
  export { zkFair } from './definitions/zkFair.js'
607
609
  export { zkFairTestnet } from './definitions/zkFairTestnet.js'
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.30.0'
1
+ export const version = '2.30.2'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.30.0",
4
+ "version": "2.30.2",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
@@ -190,14 +190,14 @@
190
190
  }
191
191
  },
192
192
  "dependencies": {
193
- "@noble/curves": "1.8.2",
194
- "@noble/hashes": "1.7.2",
195
- "@scure/bip32": "1.6.2",
196
- "@scure/bip39": "1.5.4",
193
+ "@noble/curves": "1.9.1",
194
+ "@noble/hashes": "1.8.0",
195
+ "@scure/bip32": "1.7.0",
196
+ "@scure/bip39": "1.6.0",
197
197
  "abitype": "1.0.8",
198
198
  "isows": "1.0.7",
199
- "ox": "0.6.9",
200
- "ws": "8.18.1"
199
+ "ox": "0.7.1",
200
+ "ws": "8.18.2"
201
201
  },
202
202
  "license": "MIT",
203
203
  "homepage": "https://viem.sh",
@@ -140,16 +140,17 @@ export async function getSocketRpcClient<socket extends {}>(
140
140
  for (const subscription of subscriptions.values())
141
141
  subscription.onError?.(new SocketClosedError({ url }))
142
142
 
143
- // Clear all requests and subscriptions.
144
- requests.clear()
145
- subscriptions.clear()
146
-
147
143
  // Attempt to reconnect.
148
144
  if (reconnect && reconnectCount < attempts)
149
145
  setTimeout(async () => {
150
146
  reconnectCount++
151
147
  await setup().catch(console.error)
152
148
  }, delay)
149
+ // Otherwise, clear all requests and subscriptions.
150
+ else {
151
+ requests.clear()
152
+ subscriptions.clear()
153
+ }
153
154
  },
154
155
  onError(error_) {
155
156
  error = error_
@@ -159,10 +160,6 @@ export async function getSocketRpcClient<socket extends {}>(
159
160
  for (const subscription of subscriptions.values())
160
161
  subscription.onError?.(error)
161
162
 
162
- // Clear all requests and subscriptions.
163
- requests.clear()
164
- subscriptions.clear()
165
-
166
163
  // Make sure socket is definitely closed.
167
164
  socketClient?.close()
168
165
 
@@ -172,6 +169,11 @@ export async function getSocketRpcClient<socket extends {}>(
172
169
  reconnectCount++
173
170
  await setup().catch(console.error)
174
171
  }, delay)
172
+ // Otherwise, clear all requests and subscriptions.
173
+ else {
174
+ requests.clear()
175
+ subscriptions.clear()
176
+ }
175
177
  },
176
178
  onOpen() {
177
179
  error = undefined