@1delta/providers 0.0.47 → 0.0.49
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +35 -3
- package/dist/index.mjs +35 -3
- package/package.json +1 -1
- package/src/multicall/multicall.ts +21 -3
- package/src/rpc/rpcOverrides.ts +19 -0
- package/src/utils/utils.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8269,7 +8269,7 @@ declare const LIST_OVERRIDES: Record<string, string[]>;
|
|
|
8269
8269
|
declare function createTransport(url: string, config?: any): viem.WebSocketTransport | viem.HttpTransport<undefined, false>;
|
|
8270
8270
|
declare function getTransport(url: string): viem.WebSocketTransport | viem.HttpTransport<undefined, false>;
|
|
8271
8271
|
|
|
8272
|
-
declare const DEFAULT_BATCH_SIZE =
|
|
8272
|
+
declare const DEFAULT_BATCH_SIZE = 1024;
|
|
8273
8273
|
declare function trimTrailingSlash(url?: string): string | undefined;
|
|
8274
8274
|
declare function deepCompare(a: any, b: any): boolean;
|
|
8275
8275
|
declare function uniq<T>(array: T[]): T[];
|
package/dist/index.d.ts
CHANGED
|
@@ -8269,7 +8269,7 @@ declare const LIST_OVERRIDES: Record<string, string[]>;
|
|
|
8269
8269
|
declare function createTransport(url: string, config?: any): viem.WebSocketTransport | viem.HttpTransport<undefined, false>;
|
|
8270
8270
|
declare function getTransport(url: string): viem.WebSocketTransport | viem.HttpTransport<undefined, false>;
|
|
8271
8271
|
|
|
8272
|
-
declare const DEFAULT_BATCH_SIZE =
|
|
8272
|
+
declare const DEFAULT_BATCH_SIZE = 1024;
|
|
8273
8273
|
declare function trimTrailingSlash(url?: string): string | undefined;
|
|
8274
8274
|
declare function deepCompare(a: any, b: any): boolean;
|
|
8275
8275
|
declare function uniq<T>(array: T[]): T[];
|
package/dist/index.js
CHANGED
|
@@ -25122,6 +25122,25 @@ var LIST_OVERRIDES = {
|
|
|
25122
25122
|
"https://rpc2.monad.xyz",
|
|
25123
25123
|
"https://rpc3.monad.xyz",
|
|
25124
25124
|
"https://rpc4.monad.xyz"
|
|
25125
|
+
],
|
|
25126
|
+
[import_chain_registry2.Chain.HYPEREVM]: [
|
|
25127
|
+
"https://rpc.hypurrscan.io",
|
|
25128
|
+
"https://rpc.countzero.xyz/evm",
|
|
25129
|
+
"https://hyperliquid-json-rpc.stakely.io",
|
|
25130
|
+
"https://hyperliquid.drpc.org",
|
|
25131
|
+
"https://hyperliquid.rpc.blxrbdn.com",
|
|
25132
|
+
"https://hyperliquid.api.onfinality.io/evm/public",
|
|
25133
|
+
"https://rpc.hyperlend.finance",
|
|
25134
|
+
"https://rpc.hyperliquid.xyz/evm"
|
|
25135
|
+
],
|
|
25136
|
+
[import_chain_registry2.Chain.UNICHAIN]: [
|
|
25137
|
+
"https://mainnet.unichain.org",
|
|
25138
|
+
"https://rpc.sentio.xyz/unichain-mainnet",
|
|
25139
|
+
"https://unichain-mainnet.gateway.tatum.io",
|
|
25140
|
+
"https://unichain-rpc.publicnode.com",
|
|
25141
|
+
"https://unichain.drpc.org",
|
|
25142
|
+
"https://unichain.api.onfinality.io/public",
|
|
25143
|
+
"https://rpc.poolz.finance/unichain"
|
|
25125
25144
|
]
|
|
25126
25145
|
};
|
|
25127
25146
|
|
|
@@ -25143,7 +25162,7 @@ function getTransport(url) {
|
|
|
25143
25162
|
}
|
|
25144
25163
|
|
|
25145
25164
|
// src/utils/utils.ts
|
|
25146
|
-
var DEFAULT_BATCH_SIZE =
|
|
25165
|
+
var DEFAULT_BATCH_SIZE = 1024;
|
|
25147
25166
|
function trimTrailingSlash(url) {
|
|
25148
25167
|
if (!url) return void 0;
|
|
25149
25168
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
@@ -25262,6 +25281,19 @@ function isTransportError(e) {
|
|
|
25262
25281
|
const msg = e instanceof Error ? (e.message ?? "") + (e.details ?? "") : "";
|
|
25263
25282
|
return msg.includes("is not a constructor") || msg.includes("Dynamic require") || msg.includes("is not supported") || msg.includes("wrong json-rpc response") || msg.includes("there is neither result nor error");
|
|
25264
25283
|
}
|
|
25284
|
+
function isRateLimitError(e) {
|
|
25285
|
+
if (e instanceof BaseError2) {
|
|
25286
|
+
let err = e;
|
|
25287
|
+
while (err) {
|
|
25288
|
+
if (err.status === 429) return true;
|
|
25289
|
+
const details = err.details ?? "";
|
|
25290
|
+
if (details.includes("rate-limit") || details.includes("Too Many Requests"))
|
|
25291
|
+
return true;
|
|
25292
|
+
err = err.cause ?? null;
|
|
25293
|
+
}
|
|
25294
|
+
}
|
|
25295
|
+
return false;
|
|
25296
|
+
}
|
|
25265
25297
|
function isContractRevert(e) {
|
|
25266
25298
|
if (!(e instanceof BaseError2)) return false;
|
|
25267
25299
|
let err = e;
|
|
@@ -25275,7 +25307,7 @@ function isContractRevert(e) {
|
|
|
25275
25307
|
return false;
|
|
25276
25308
|
}
|
|
25277
25309
|
function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
|
|
25278
|
-
return async function multicallRetry2(chain, calls, abi2, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 3, providerId = 0, allowFailure = true, logErrors = false, revertedIndices = /* @__PURE__ */ new Set(), maxSkips =
|
|
25310
|
+
return async function multicallRetry2(chain, calls, abi2, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 3, providerId = 0, allowFailure = true, logErrors = false, revertedIndices = /* @__PURE__ */ new Set(), maxSkips = 6) {
|
|
25279
25311
|
const abiIsArray = isArray(abi2[0]);
|
|
25280
25312
|
try {
|
|
25281
25313
|
const nonRevertedIndices = calls.map((_, i) => i).filter((i) => !revertedIndices.has(i));
|
|
@@ -25352,7 +25384,7 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
|
|
|
25352
25384
|
);
|
|
25353
25385
|
}
|
|
25354
25386
|
}
|
|
25355
|
-
if (isTransportError(e) && maxSkips > 0) {
|
|
25387
|
+
if ((isRateLimitError(e) || isTransportError(e)) && maxSkips > 0) {
|
|
25356
25388
|
if (logErrors) console.debug(e);
|
|
25357
25389
|
return await multicallRetry2(
|
|
25358
25390
|
chain,
|
package/dist/index.mjs
CHANGED
|
@@ -11362,6 +11362,25 @@ var LIST_OVERRIDES = {
|
|
|
11362
11362
|
"https://rpc2.monad.xyz",
|
|
11363
11363
|
"https://rpc3.monad.xyz",
|
|
11364
11364
|
"https://rpc4.monad.xyz"
|
|
11365
|
+
],
|
|
11366
|
+
[Chain2.HYPEREVM]: [
|
|
11367
|
+
"https://rpc.hypurrscan.io",
|
|
11368
|
+
"https://rpc.countzero.xyz/evm",
|
|
11369
|
+
"https://hyperliquid-json-rpc.stakely.io",
|
|
11370
|
+
"https://hyperliquid.drpc.org",
|
|
11371
|
+
"https://hyperliquid.rpc.blxrbdn.com",
|
|
11372
|
+
"https://hyperliquid.api.onfinality.io/evm/public",
|
|
11373
|
+
"https://rpc.hyperlend.finance",
|
|
11374
|
+
"https://rpc.hyperliquid.xyz/evm"
|
|
11375
|
+
],
|
|
11376
|
+
[Chain2.UNICHAIN]: [
|
|
11377
|
+
"https://mainnet.unichain.org",
|
|
11378
|
+
"https://rpc.sentio.xyz/unichain-mainnet",
|
|
11379
|
+
"https://unichain-mainnet.gateway.tatum.io",
|
|
11380
|
+
"https://unichain-rpc.publicnode.com",
|
|
11381
|
+
"https://unichain.drpc.org",
|
|
11382
|
+
"https://unichain.api.onfinality.io/public",
|
|
11383
|
+
"https://rpc.poolz.finance/unichain"
|
|
11365
11384
|
]
|
|
11366
11385
|
};
|
|
11367
11386
|
|
|
@@ -11383,7 +11402,7 @@ function getTransport(url) {
|
|
|
11383
11402
|
}
|
|
11384
11403
|
|
|
11385
11404
|
// src/utils/utils.ts
|
|
11386
|
-
var DEFAULT_BATCH_SIZE =
|
|
11405
|
+
var DEFAULT_BATCH_SIZE = 1024;
|
|
11387
11406
|
function trimTrailingSlash(url) {
|
|
11388
11407
|
if (!url) return void 0;
|
|
11389
11408
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
@@ -11502,6 +11521,19 @@ function isTransportError(e) {
|
|
|
11502
11521
|
const msg = e instanceof Error ? (e.message ?? "") + (e.details ?? "") : "";
|
|
11503
11522
|
return msg.includes("is not a constructor") || msg.includes("Dynamic require") || msg.includes("is not supported") || msg.includes("wrong json-rpc response") || msg.includes("there is neither result nor error");
|
|
11504
11523
|
}
|
|
11524
|
+
function isRateLimitError(e) {
|
|
11525
|
+
if (e instanceof BaseError) {
|
|
11526
|
+
let err = e;
|
|
11527
|
+
while (err) {
|
|
11528
|
+
if (err.status === 429) return true;
|
|
11529
|
+
const details = err.details ?? "";
|
|
11530
|
+
if (details.includes("rate-limit") || details.includes("Too Many Requests"))
|
|
11531
|
+
return true;
|
|
11532
|
+
err = err.cause ?? null;
|
|
11533
|
+
}
|
|
11534
|
+
}
|
|
11535
|
+
return false;
|
|
11536
|
+
}
|
|
11505
11537
|
function isContractRevert(e) {
|
|
11506
11538
|
if (!(e instanceof BaseError)) return false;
|
|
11507
11539
|
let err = e;
|
|
@@ -11515,7 +11547,7 @@ function isContractRevert(e) {
|
|
|
11515
11547
|
return false;
|
|
11516
11548
|
}
|
|
11517
11549
|
function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
|
|
11518
|
-
return async function multicallRetry2(chain, calls, abi2, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 3, providerId = 0, allowFailure = true, logErrors = false, revertedIndices = /* @__PURE__ */ new Set(), maxSkips =
|
|
11550
|
+
return async function multicallRetry2(chain, calls, abi2, batchSize = DEFAULT_BATCH_SIZE, maxRetries = 3, providerId = 0, allowFailure = true, logErrors = false, revertedIndices = /* @__PURE__ */ new Set(), maxSkips = 6) {
|
|
11519
11551
|
const abiIsArray = isArray(abi2[0]);
|
|
11520
11552
|
try {
|
|
11521
11553
|
const nonRevertedIndices = calls.map((_, i) => i).filter((i) => !revertedIndices.has(i));
|
|
@@ -11592,7 +11624,7 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
|
|
|
11592
11624
|
);
|
|
11593
11625
|
}
|
|
11594
11626
|
}
|
|
11595
|
-
if (isTransportError(e) && maxSkips > 0) {
|
|
11627
|
+
if ((isRateLimitError(e) || isTransportError(e)) && maxSkips > 0) {
|
|
11596
11628
|
if (logErrors) console.debug(e);
|
|
11597
11629
|
return await multicallRetry2(
|
|
11598
11630
|
chain,
|
package/package.json
CHANGED
|
@@ -20,6 +20,24 @@ function isTransportError(e: unknown): boolean {
|
|
|
20
20
|
)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/** Return true if the error is a rate-limit (429) response */
|
|
24
|
+
function isRateLimitError(e: unknown): boolean {
|
|
25
|
+
if (e instanceof BaseError) {
|
|
26
|
+
let err: any = e
|
|
27
|
+
while (err) {
|
|
28
|
+
if (err.status === 429) return true
|
|
29
|
+
const details: string = err.details ?? ''
|
|
30
|
+
if (
|
|
31
|
+
details.includes('rate-limit') ||
|
|
32
|
+
details.includes('Too Many Requests')
|
|
33
|
+
)
|
|
34
|
+
return true
|
|
35
|
+
err = err.cause ?? null
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
|
|
23
41
|
/** Return true if it is a revert case */
|
|
24
42
|
function isContractRevert(e: unknown): boolean {
|
|
25
43
|
if (!(e instanceof BaseError)) return false
|
|
@@ -69,7 +87,7 @@ export function createMulticallRetry(
|
|
|
69
87
|
allowFailure = true,
|
|
70
88
|
logErrors = false,
|
|
71
89
|
revertedIndices: Set<number> = new Set(),
|
|
72
|
-
maxSkips =
|
|
90
|
+
maxSkips = 6,
|
|
73
91
|
): Promise<any[]> {
|
|
74
92
|
const abiIsArray = isArray(abi[0])
|
|
75
93
|
|
|
@@ -172,9 +190,9 @@ export function createMulticallRetry(
|
|
|
172
190
|
}
|
|
173
191
|
}
|
|
174
192
|
|
|
175
|
-
//
|
|
193
|
+
// Rate-limit (429) or transport/environment errors:
|
|
176
194
|
// skip to next RPC without consuming a retry
|
|
177
|
-
if (isTransportError(e) && maxSkips > 0) {
|
|
195
|
+
if ((isRateLimitError(e) || isTransportError(e)) && maxSkips > 0) {
|
|
178
196
|
if (logErrors) console.debug(e)
|
|
179
197
|
return await multicallRetry(
|
|
180
198
|
chain,
|
package/src/rpc/rpcOverrides.ts
CHANGED
|
@@ -252,4 +252,23 @@ export const LIST_OVERRIDES: Record<string, string[]> = {
|
|
|
252
252
|
'https://rpc3.monad.xyz',
|
|
253
253
|
'https://rpc4.monad.xyz',
|
|
254
254
|
],
|
|
255
|
+
[Chain.HYPEREVM]: [
|
|
256
|
+
'https://rpc.hypurrscan.io',
|
|
257
|
+
'https://rpc.countzero.xyz/evm',
|
|
258
|
+
'https://hyperliquid-json-rpc.stakely.io',
|
|
259
|
+
'https://hyperliquid.drpc.org',
|
|
260
|
+
'https://hyperliquid.rpc.blxrbdn.com',
|
|
261
|
+
'https://hyperliquid.api.onfinality.io/evm/public',
|
|
262
|
+
'https://rpc.hyperlend.finance',
|
|
263
|
+
'https://rpc.hyperliquid.xyz/evm',
|
|
264
|
+
],
|
|
265
|
+
[Chain.UNICHAIN]: [
|
|
266
|
+
'https://mainnet.unichain.org',
|
|
267
|
+
'https://rpc.sentio.xyz/unichain-mainnet',
|
|
268
|
+
'https://unichain-mainnet.gateway.tatum.io',
|
|
269
|
+
'https://unichain-rpc.publicnode.com',
|
|
270
|
+
'https://unichain.drpc.org',
|
|
271
|
+
'https://unichain.api.onfinality.io/public',
|
|
272
|
+
'https://rpc.poolz.finance/unichain',
|
|
273
|
+
],
|
|
255
274
|
}
|
package/src/utils/utils.ts
CHANGED