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.
- package/CHANGELOG.md +26 -0
- package/_cjs/actions/public/call.js +2 -2
- package/_cjs/actions/public/call.js.map +1 -1
- package/_cjs/actions/public/estimateGas.js +1 -1
- package/_cjs/actions/public/estimateGas.js.map +1 -1
- package/_cjs/actions/public/simulateBlocks.js +1 -1
- package/_cjs/actions/public/simulateBlocks.js.map +1 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js +9 -3
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/actions/public/watchBlocks.js +4 -2
- package/_cjs/actions/public/watchBlocks.js.map +1 -1
- package/_cjs/chains/definitions/bitkub.js +3 -3
- package/_cjs/chains/definitions/bitkub.js.map +1 -1
- package/_cjs/chains/definitions/chiliz.js +1 -1
- package/_cjs/chains/definitions/chiliz.js.map +1 -1
- package/_cjs/chains/definitions/jbc.js +1 -1
- package/_cjs/chains/definitions/jbc.js.map +1 -1
- package/_cjs/chains/definitions/riseTestnet.js +29 -0
- package/_cjs/chains/definitions/riseTestnet.js.map +1 -0
- package/_cjs/chains/index.js +6 -4
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/utils/rpc/socket.js +8 -4
- package/_cjs/utils/rpc/socket.js.map +1 -1
- package/_cjs/zksync/actions/claimFailedDeposit.js +146 -0
- package/_cjs/zksync/actions/claimFailedDeposit.js.map +1 -0
- package/_cjs/zksync/actions/deposit.js +51 -4
- package/_cjs/zksync/actions/deposit.js.map +1 -1
- package/_cjs/zksync/actions/finalizeWithdrawal.js +41 -41
- package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_cjs/zksync/actions/getDefaultBridgeAddresses.js +2 -0
- package/_cjs/zksync/actions/getDefaultBridgeAddresses.js.map +1 -1
- package/_cjs/zksync/actions/isWithdrawalFinalized.js +2 -17
- package/_cjs/zksync/actions/isWithdrawalFinalized.js.map +1 -1
- package/_cjs/zksync/actions/withdraw.js +49 -8
- package/_cjs/zksync/actions/withdraw.js.map +1 -1
- package/_cjs/zksync/constants/address.js +4 -1
- package/_cjs/zksync/constants/address.js.map +1 -1
- package/_cjs/zksync/decorators/walletL1.js +2 -0
- package/_cjs/zksync/decorators/walletL1.js.map +1 -1
- package/_cjs/zksync/errors/bridge.js +23 -1
- package/_cjs/zksync/errors/bridge.js.map +1 -1
- package/_cjs/zksync/index.js +4 -2
- package/_cjs/zksync/index.js.map +1 -1
- package/_esm/actions/public/call.js +2 -2
- package/_esm/actions/public/call.js.map +1 -1
- package/_esm/actions/public/estimateGas.js +1 -1
- package/_esm/actions/public/estimateGas.js.map +1 -1
- package/_esm/actions/public/simulateBlocks.js +1 -1
- package/_esm/actions/public/simulateBlocks.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +10 -3
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/actions/public/watchBlocks.js +4 -2
- package/_esm/actions/public/watchBlocks.js.map +1 -1
- package/_esm/chains/definitions/bitkub.js +3 -3
- package/_esm/chains/definitions/bitkub.js.map +1 -1
- package/_esm/chains/definitions/chiliz.js +1 -1
- package/_esm/chains/definitions/chiliz.js.map +1 -1
- package/_esm/chains/definitions/jbc.js +1 -1
- package/_esm/chains/definitions/jbc.js.map +1 -1
- package/_esm/chains/definitions/riseTestnet.js +26 -0
- package/_esm/chains/definitions/riseTestnet.js.map +1 -0
- package/_esm/chains/index.js +2 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/utils/rpc/socket.js +10 -6
- package/_esm/utils/rpc/socket.js.map +1 -1
- package/_esm/zksync/actions/claimFailedDeposit.js +199 -0
- package/_esm/zksync/actions/claimFailedDeposit.js.map +1 -0
- package/_esm/zksync/actions/deposit.js +61 -11
- package/_esm/zksync/actions/deposit.js.map +1 -1
- package/_esm/zksync/actions/finalizeWithdrawal.js +42 -42
- package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_esm/zksync/actions/getDefaultBridgeAddresses.js +2 -0
- package/_esm/zksync/actions/getDefaultBridgeAddresses.js.map +1 -1
- package/_esm/zksync/actions/isWithdrawalFinalized.js +3 -18
- package/_esm/zksync/actions/isWithdrawalFinalized.js.map +1 -1
- package/_esm/zksync/actions/withdraw.js +54 -10
- package/_esm/zksync/actions/withdraw.js.map +1 -1
- package/_esm/zksync/constants/address.js +3 -0
- package/_esm/zksync/constants/address.js.map +1 -1
- package/_esm/zksync/decorators/walletL1.js +2 -0
- package/_esm/zksync/decorators/walletL1.js.map +1 -1
- package/_esm/zksync/errors/bridge.js +19 -0
- package/_esm/zksync/errors/bridge.js.map +1 -1
- package/_esm/zksync/index.js +1 -0
- package/_esm/zksync/index.js.map +1 -1
- package/_types/actions/public/call.d.ts +1 -1
- package/_types/actions/public/estimateGas.d.ts +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/public/watchBlocks.d.ts.map +1 -1
- package/_types/chains/definitions/bitkub.d.ts +3 -3
- package/_types/chains/definitions/chiliz.d.ts +1 -1
- package/_types/chains/definitions/jbc.d.ts +1 -1
- package/_types/chains/definitions/riseTestnet.d.ts +35 -0
- package/_types/chains/definitions/riseTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +2 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/utils/rpc/socket.d.ts.map +1 -1
- package/_types/zksync/actions/claimFailedDeposit.d.ts +77 -0
- package/_types/zksync/actions/claimFailedDeposit.d.ts.map +1 -0
- package/_types/zksync/actions/deposit.d.ts +0 -1
- package/_types/zksync/actions/deposit.d.ts.map +1 -1
- package/_types/zksync/actions/finalizeWithdrawal.d.ts.map +1 -1
- package/_types/zksync/actions/getDefaultBridgeAddresses.d.ts.map +1 -1
- package/_types/zksync/actions/isWithdrawalFinalized.d.ts.map +1 -1
- package/_types/zksync/actions/withdraw.d.ts +1 -1
- package/_types/zksync/actions/withdraw.d.ts.map +1 -1
- package/_types/zksync/constants/address.d.ts +3 -0
- package/_types/zksync/constants/address.d.ts.map +1 -1
- package/_types/zksync/decorators/walletL1.d.ts +32 -1
- package/_types/zksync/decorators/walletL1.d.ts.map +1 -1
- package/_types/zksync/errors/bridge.d.ts +23 -0
- package/_types/zksync/errors/bridge.d.ts.map +1 -1
- package/_types/zksync/index.d.ts +1 -0
- package/_types/zksync/index.d.ts.map +1 -1
- package/_types/zksync/types/contract.d.ts +2 -0
- package/_types/zksync/types/contract.d.ts.map +1 -1
- package/_types/zksync/types/eip1193.d.ts +2 -0
- package/_types/zksync/types/eip1193.d.ts.map +1 -1
- package/actions/public/call.ts +3 -3
- package/actions/public/estimateGas.ts +2 -2
- package/actions/public/simulateBlocks.ts +1 -1
- package/actions/public/waitForTransactionReceipt.ts +159 -158
- package/actions/public/watchBlocks.ts +7 -5
- package/chains/definitions/bitkub.ts +3 -3
- package/chains/definitions/chiliz.ts +1 -1
- package/chains/definitions/jbc.ts +1 -1
- package/chains/definitions/riseTestnet.ts +26 -0
- package/chains/index.ts +2 -0
- package/errors/version.ts +1 -1
- package/package.json +7 -7
- package/utils/rpc/socket.ts +10 -8
- package/zksync/actions/claimFailedDeposit.ts +319 -0
- package/zksync/actions/deposit.ts +116 -14
- package/zksync/actions/finalizeWithdrawal.ts +53 -51
- package/zksync/actions/getDefaultBridgeAddresses.ts +3 -0
- package/zksync/actions/isWithdrawalFinalized.ts +4 -22
- package/zksync/actions/withdraw.ts +64 -8
- package/zksync/constants/address.ts +9 -0
- package/zksync/decorators/walletL1.ts +49 -1
- package/zksync/errors/bridge.ts +35 -0
- package/zksync/index.ts +6 -0
- package/zksync/types/contract.ts +2 -0
- 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
|
-
()
|
161
|
-
|
162
|
-
|
163
|
+
? setTimeout(() => {
|
164
|
+
_unwatch()
|
165
|
+
_unobserve()
|
166
|
+
reject(new WaitForTransactionReceiptTimeoutError({ hash }))
|
167
|
+
}, timeout)
|
163
168
|
: undefined
|
164
169
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
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
|
-
|
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
|
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
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
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
|
-
|
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
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
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
|
-
|
212
|
-
|
265
|
+
const block = await withRetry(
|
266
|
+
() =>
|
267
|
+
getAction(
|
213
268
|
client,
|
214
|
-
|
215
|
-
'
|
216
|
-
)({
|
217
|
-
|
218
|
-
|
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
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
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
|
-
|
291
|
-
|
292
|
+
// If we couldn't find a replacement transaction, continue polling.
|
293
|
+
if (!replacementTransaction) return
|
292
294
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
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
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
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
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
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
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
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
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
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: '
|
6
|
-
nativeCurrency: { name: '
|
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: '
|
14
|
+
name: 'KUB Chain Mainnet Explorer',
|
15
15
|
url: 'https://www.bkcscan.com',
|
16
16
|
apiUrl: 'https://www.bkcscan.com/api',
|
17
17
|
},
|
@@ -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.
|
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.
|
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.
|
194
|
-
"@noble/hashes": "1.
|
195
|
-
"@scure/bip32": "1.
|
196
|
-
"@scure/bip39": "1.
|
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.
|
200
|
-
"ws": "8.18.
|
199
|
+
"ox": "0.7.1",
|
200
|
+
"ws": "8.18.2"
|
201
201
|
},
|
202
202
|
"license": "MIT",
|
203
203
|
"homepage": "https://viem.sh",
|
package/utils/rpc/socket.ts
CHANGED
@@ -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
|