@1delta/providers 0.0.51 → 0.0.52
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +66 -13
- package/dist/index.mjs +65 -13
- package/package.json +1 -1
- package/src/multicall/multicall.ts +77 -45
- package/src/rpc/rpcOverrides.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8482,6 +8482,7 @@ declare function createMulticallRetry(customRpcs?: Record<string, string[]>): (c
|
|
|
8482
8482
|
* @see multicallRetryUniversal
|
|
8483
8483
|
*/
|
|
8484
8484
|
declare function multicallRetry(chain: string, calls: any[], abi: any, batchSize?: number, maxRetries?: number, providerId?: number, allowFailure?: boolean, overrdies?: Record<string, string[]>, logErrors?: boolean): Promise<any[]>;
|
|
8485
|
+
declare function createMulticallRetryUniversal(customRpcs?: Record<string, string[]>): (params: MulticallRetryParams) => Promise<any[]>;
|
|
8485
8486
|
declare function multicallRetryUniversal({ chain, calls, abi, batchSize, maxRetries, providerId, allowFailure, overrdies, logErrors, }: MulticallRetryParams): Promise<any[]>;
|
|
8486
8487
|
|
|
8487
|
-
export { DEFAULT_BATCH_SIZE, LIST_OVERRIDES, type MulticallRetryParams, createMulticallRetry, createTransport, customChains, deepCompare, filterHttpRpcs, getEvmChain, getEvmClient, getEvmClientUniversal, getEvmClientWithCustomRpcs, getEvmClientWithCustomRpcsUniversal, getTransport, isArray, katana, multicallRetry, multicallRetryUniversal, plasma, trimTrailingSlash, uniq };
|
|
8488
|
+
export { DEFAULT_BATCH_SIZE, LIST_OVERRIDES, type MulticallRetryParams, createMulticallRetry, createMulticallRetryUniversal, createTransport, customChains, deepCompare, filterHttpRpcs, getEvmChain, getEvmClient, getEvmClientUniversal, getEvmClientWithCustomRpcs, getEvmClientWithCustomRpcsUniversal, getTransport, isArray, katana, multicallRetry, multicallRetryUniversal, plasma, trimTrailingSlash, uniq };
|
package/dist/index.d.ts
CHANGED
|
@@ -8482,6 +8482,7 @@ declare function createMulticallRetry(customRpcs?: Record<string, string[]>): (c
|
|
|
8482
8482
|
* @see multicallRetryUniversal
|
|
8483
8483
|
*/
|
|
8484
8484
|
declare function multicallRetry(chain: string, calls: any[], abi: any, batchSize?: number, maxRetries?: number, providerId?: number, allowFailure?: boolean, overrdies?: Record<string, string[]>, logErrors?: boolean): Promise<any[]>;
|
|
8485
|
+
declare function createMulticallRetryUniversal(customRpcs?: Record<string, string[]>): (params: MulticallRetryParams) => Promise<any[]>;
|
|
8485
8486
|
declare function multicallRetryUniversal({ chain, calls, abi, batchSize, maxRetries, providerId, allowFailure, overrdies, logErrors, }: MulticallRetryParams): Promise<any[]>;
|
|
8486
8487
|
|
|
8487
|
-
export { DEFAULT_BATCH_SIZE, LIST_OVERRIDES, type MulticallRetryParams, createMulticallRetry, createTransport, customChains, deepCompare, filterHttpRpcs, getEvmChain, getEvmClient, getEvmClientUniversal, getEvmClientWithCustomRpcs, getEvmClientWithCustomRpcsUniversal, getTransport, isArray, katana, multicallRetry, multicallRetryUniversal, plasma, trimTrailingSlash, uniq };
|
|
8488
|
+
export { DEFAULT_BATCH_SIZE, LIST_OVERRIDES, type MulticallRetryParams, createMulticallRetry, createMulticallRetryUniversal, createTransport, customChains, deepCompare, filterHttpRpcs, getEvmChain, getEvmClient, getEvmClientUniversal, getEvmClientWithCustomRpcs, getEvmClientWithCustomRpcsUniversal, getTransport, isArray, katana, multicallRetry, multicallRetryUniversal, plasma, trimTrailingSlash, uniq };
|
package/dist/index.js
CHANGED
|
@@ -13453,6 +13453,7 @@ __export(index_exports, {
|
|
|
13453
13453
|
DEFAULT_BATCH_SIZE: () => DEFAULT_BATCH_SIZE,
|
|
13454
13454
|
LIST_OVERRIDES: () => LIST_OVERRIDES,
|
|
13455
13455
|
createMulticallRetry: () => createMulticallRetry,
|
|
13456
|
+
createMulticallRetryUniversal: () => createMulticallRetryUniversal,
|
|
13456
13457
|
createTransport: () => createTransport2,
|
|
13457
13458
|
customChains: () => customChains,
|
|
13458
13459
|
deepCompare: () => deepCompare,
|
|
@@ -24984,7 +24985,6 @@ var LIST_OVERRIDES = {
|
|
|
24984
24985
|
"https://erpc.xdcrpc.com"
|
|
24985
24986
|
],
|
|
24986
24987
|
[import_chain_registry2.Chain.ETHEREUM_MAINNET]: [
|
|
24987
|
-
"https://eth.llamarpc.com",
|
|
24988
24988
|
"https://api.zan.top/eth-mainnet",
|
|
24989
24989
|
"https://rpc.flashbots.net/fast",
|
|
24990
24990
|
"https://rpc.owlracle.info/eth/70d38ce1826c4a60bb2a8e05a6c8b20f",
|
|
@@ -24995,6 +24995,7 @@ var LIST_OVERRIDES = {
|
|
|
24995
24995
|
"https://rpc.flashbots.net",
|
|
24996
24996
|
"https://public-eth.nownodes.io",
|
|
24997
24997
|
"https://ethereum-json-rpc.stakely.io",
|
|
24998
|
+
"https://eth.llamarpc.com",
|
|
24998
24999
|
"https://eth.blockrazor.xyz",
|
|
24999
25000
|
"https://eth.drpc.org",
|
|
25000
25001
|
"https://ethereum.public.blockpi.network/v1/rpc/public",
|
|
@@ -25341,17 +25342,52 @@ function getEvmClientWithCustomRpcsUniversal({
|
|
|
25341
25342
|
}
|
|
25342
25343
|
|
|
25343
25344
|
// src/multicall/multicall.ts
|
|
25344
|
-
|
|
25345
|
-
|
|
25346
|
-
|
|
25347
|
-
|
|
25345
|
+
var HTTP_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
25346
|
+
"ECONNRESET",
|
|
25347
|
+
"ECONNREFUSED",
|
|
25348
|
+
"ECONNABORTED",
|
|
25349
|
+
"ETIMEDOUT",
|
|
25350
|
+
"ENOTFOUND",
|
|
25351
|
+
"EPIPE",
|
|
25352
|
+
"EAI_AGAIN",
|
|
25353
|
+
"ERR_SOCKET_TIMEOUT",
|
|
25354
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
25355
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
25356
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
25357
|
+
"UND_ERR_SOCKET"
|
|
25358
|
+
]);
|
|
25359
|
+
var HTTP_ERROR_STRINGS = [
|
|
25360
|
+
"rate-limit",
|
|
25361
|
+
"Too Many Requests",
|
|
25362
|
+
"Bad gateway",
|
|
25363
|
+
"Service Unavailable",
|
|
25364
|
+
"<!DOCTYPE html>",
|
|
25365
|
+
"HTTP request failed",
|
|
25366
|
+
"fetch failed",
|
|
25367
|
+
"not whitelisted",
|
|
25368
|
+
"timed out",
|
|
25369
|
+
"timeout",
|
|
25370
|
+
"took too long",
|
|
25371
|
+
"socket hang up",
|
|
25372
|
+
"network error",
|
|
25373
|
+
"request aborted",
|
|
25374
|
+
"body exceeded",
|
|
25375
|
+
"CORS",
|
|
25376
|
+
"AbortError",
|
|
25377
|
+
"-32601",
|
|
25378
|
+
"-32005",
|
|
25379
|
+
"exceeded",
|
|
25380
|
+
"limit reached",
|
|
25381
|
+
"overloaded"
|
|
25382
|
+
];
|
|
25348
25383
|
function isHttpError(e) {
|
|
25349
25384
|
const err = e;
|
|
25350
25385
|
const code = err?.code ?? err?.cause?.code;
|
|
25351
|
-
if (code
|
|
25352
|
-
return true;
|
|
25386
|
+
if (code && HTTP_ERROR_CODES.has(code)) return true;
|
|
25353
25387
|
if (err?.status === 401 || err?.status === 429 || err?.status >= 500)
|
|
25354
25388
|
return true;
|
|
25389
|
+
if (err?.name === "AbortError" || err?.cause?.name === "AbortError")
|
|
25390
|
+
return true;
|
|
25355
25391
|
if (e instanceof BaseError2) {
|
|
25356
25392
|
let current = e;
|
|
25357
25393
|
while (current) {
|
|
@@ -25360,15 +25396,13 @@ function isHttpError(e) {
|
|
|
25360
25396
|
const details = current.details ?? "";
|
|
25361
25397
|
const message = current.message ?? "";
|
|
25362
25398
|
const combined = `${message} ${details}`;
|
|
25363
|
-
if (
|
|
25364
|
-
return true;
|
|
25399
|
+
if (HTTP_ERROR_STRINGS.some((s) => combined.includes(s))) return true;
|
|
25365
25400
|
current = current.cause ?? null;
|
|
25366
25401
|
}
|
|
25367
25402
|
}
|
|
25368
25403
|
if (e instanceof Error) {
|
|
25369
25404
|
const combined = `${e.message ?? ""} ${e.details ?? ""}`;
|
|
25370
|
-
if (
|
|
25371
|
-
return true;
|
|
25405
|
+
if (HTTP_ERROR_STRINGS.some((s) => combined.includes(s))) return true;
|
|
25372
25406
|
}
|
|
25373
25407
|
return false;
|
|
25374
25408
|
}
|
|
@@ -25481,8 +25515,11 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
|
|
|
25481
25515
|
maxSkips
|
|
25482
25516
|
);
|
|
25483
25517
|
}
|
|
25484
|
-
if (
|
|
25485
|
-
if (logErrors)
|
|
25518
|
+
if (maxSkips > 0) {
|
|
25519
|
+
if (logErrors) {
|
|
25520
|
+
const tag = isHttpError(e) ? "HTTP" : "unknown-transient";
|
|
25521
|
+
console.debug(`[multicall] ${tag} error on provider ${providerId}, skipping`, e);
|
|
25522
|
+
}
|
|
25486
25523
|
return await multicallRetry2(
|
|
25487
25524
|
chain,
|
|
25488
25525
|
calls,
|
|
@@ -25543,6 +25580,21 @@ async function multicallRetry(chain, calls, abi2, batchSize = DEFAULT_BATCH_SIZE
|
|
|
25543
25580
|
logErrors
|
|
25544
25581
|
);
|
|
25545
25582
|
}
|
|
25583
|
+
function createMulticallRetryUniversal(customRpcs = LIST_OVERRIDES) {
|
|
25584
|
+
return async function multicallRetryUniversal2(params) {
|
|
25585
|
+
return multicallRetryInternal(
|
|
25586
|
+
params.chain,
|
|
25587
|
+
params.calls,
|
|
25588
|
+
params.abi,
|
|
25589
|
+
params.batchSize,
|
|
25590
|
+
params.maxRetries,
|
|
25591
|
+
params.providerId,
|
|
25592
|
+
params.allowFailure,
|
|
25593
|
+
customRpcs,
|
|
25594
|
+
params.logErrors
|
|
25595
|
+
);
|
|
25596
|
+
};
|
|
25597
|
+
}
|
|
25546
25598
|
async function multicallRetryUniversal({
|
|
25547
25599
|
chain,
|
|
25548
25600
|
calls,
|
|
@@ -25571,6 +25623,7 @@ async function multicallRetryUniversal({
|
|
|
25571
25623
|
DEFAULT_BATCH_SIZE,
|
|
25572
25624
|
LIST_OVERRIDES,
|
|
25573
25625
|
createMulticallRetry,
|
|
25626
|
+
createMulticallRetryUniversal,
|
|
25574
25627
|
createTransport,
|
|
25575
25628
|
customChains,
|
|
25576
25629
|
deepCompare,
|
package/dist/index.mjs
CHANGED
|
@@ -11224,7 +11224,6 @@ var LIST_OVERRIDES = {
|
|
|
11224
11224
|
"https://erpc.xdcrpc.com"
|
|
11225
11225
|
],
|
|
11226
11226
|
[Chain2.ETHEREUM_MAINNET]: [
|
|
11227
|
-
"https://eth.llamarpc.com",
|
|
11228
11227
|
"https://api.zan.top/eth-mainnet",
|
|
11229
11228
|
"https://rpc.flashbots.net/fast",
|
|
11230
11229
|
"https://rpc.owlracle.info/eth/70d38ce1826c4a60bb2a8e05a6c8b20f",
|
|
@@ -11235,6 +11234,7 @@ var LIST_OVERRIDES = {
|
|
|
11235
11234
|
"https://rpc.flashbots.net",
|
|
11236
11235
|
"https://public-eth.nownodes.io",
|
|
11237
11236
|
"https://ethereum-json-rpc.stakely.io",
|
|
11237
|
+
"https://eth.llamarpc.com",
|
|
11238
11238
|
"https://eth.blockrazor.xyz",
|
|
11239
11239
|
"https://eth.drpc.org",
|
|
11240
11240
|
"https://ethereum.public.blockpi.network/v1/rpc/public",
|
|
@@ -11581,17 +11581,52 @@ function getEvmClientWithCustomRpcsUniversal({
|
|
|
11581
11581
|
}
|
|
11582
11582
|
|
|
11583
11583
|
// src/multicall/multicall.ts
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11584
|
+
var HTTP_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
11585
|
+
"ECONNRESET",
|
|
11586
|
+
"ECONNREFUSED",
|
|
11587
|
+
"ECONNABORTED",
|
|
11588
|
+
"ETIMEDOUT",
|
|
11589
|
+
"ENOTFOUND",
|
|
11590
|
+
"EPIPE",
|
|
11591
|
+
"EAI_AGAIN",
|
|
11592
|
+
"ERR_SOCKET_TIMEOUT",
|
|
11593
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
11594
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
11595
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
11596
|
+
"UND_ERR_SOCKET"
|
|
11597
|
+
]);
|
|
11598
|
+
var HTTP_ERROR_STRINGS = [
|
|
11599
|
+
"rate-limit",
|
|
11600
|
+
"Too Many Requests",
|
|
11601
|
+
"Bad gateway",
|
|
11602
|
+
"Service Unavailable",
|
|
11603
|
+
"<!DOCTYPE html>",
|
|
11604
|
+
"HTTP request failed",
|
|
11605
|
+
"fetch failed",
|
|
11606
|
+
"not whitelisted",
|
|
11607
|
+
"timed out",
|
|
11608
|
+
"timeout",
|
|
11609
|
+
"took too long",
|
|
11610
|
+
"socket hang up",
|
|
11611
|
+
"network error",
|
|
11612
|
+
"request aborted",
|
|
11613
|
+
"body exceeded",
|
|
11614
|
+
"CORS",
|
|
11615
|
+
"AbortError",
|
|
11616
|
+
"-32601",
|
|
11617
|
+
"-32005",
|
|
11618
|
+
"exceeded",
|
|
11619
|
+
"limit reached",
|
|
11620
|
+
"overloaded"
|
|
11621
|
+
];
|
|
11588
11622
|
function isHttpError(e) {
|
|
11589
11623
|
const err = e;
|
|
11590
11624
|
const code = err?.code ?? err?.cause?.code;
|
|
11591
|
-
if (code
|
|
11592
|
-
return true;
|
|
11625
|
+
if (code && HTTP_ERROR_CODES.has(code)) return true;
|
|
11593
11626
|
if (err?.status === 401 || err?.status === 429 || err?.status >= 500)
|
|
11594
11627
|
return true;
|
|
11628
|
+
if (err?.name === "AbortError" || err?.cause?.name === "AbortError")
|
|
11629
|
+
return true;
|
|
11595
11630
|
if (e instanceof BaseError) {
|
|
11596
11631
|
let current = e;
|
|
11597
11632
|
while (current) {
|
|
@@ -11600,15 +11635,13 @@ function isHttpError(e) {
|
|
|
11600
11635
|
const details = current.details ?? "";
|
|
11601
11636
|
const message = current.message ?? "";
|
|
11602
11637
|
const combined = `${message} ${details}`;
|
|
11603
|
-
if (
|
|
11604
|
-
return true;
|
|
11638
|
+
if (HTTP_ERROR_STRINGS.some((s) => combined.includes(s))) return true;
|
|
11605
11639
|
current = current.cause ?? null;
|
|
11606
11640
|
}
|
|
11607
11641
|
}
|
|
11608
11642
|
if (e instanceof Error) {
|
|
11609
11643
|
const combined = `${e.message ?? ""} ${e.details ?? ""}`;
|
|
11610
|
-
if (
|
|
11611
|
-
return true;
|
|
11644
|
+
if (HTTP_ERROR_STRINGS.some((s) => combined.includes(s))) return true;
|
|
11612
11645
|
}
|
|
11613
11646
|
return false;
|
|
11614
11647
|
}
|
|
@@ -11721,8 +11754,11 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
|
|
|
11721
11754
|
maxSkips
|
|
11722
11755
|
);
|
|
11723
11756
|
}
|
|
11724
|
-
if (
|
|
11725
|
-
if (logErrors)
|
|
11757
|
+
if (maxSkips > 0) {
|
|
11758
|
+
if (logErrors) {
|
|
11759
|
+
const tag = isHttpError(e) ? "HTTP" : "unknown-transient";
|
|
11760
|
+
console.debug(`[multicall] ${tag} error on provider ${providerId}, skipping`, e);
|
|
11761
|
+
}
|
|
11726
11762
|
return await multicallRetry2(
|
|
11727
11763
|
chain,
|
|
11728
11764
|
calls,
|
|
@@ -11783,6 +11819,21 @@ async function multicallRetry(chain, calls, abi2, batchSize = DEFAULT_BATCH_SIZE
|
|
|
11783
11819
|
logErrors
|
|
11784
11820
|
);
|
|
11785
11821
|
}
|
|
11822
|
+
function createMulticallRetryUniversal(customRpcs = LIST_OVERRIDES) {
|
|
11823
|
+
return async function multicallRetryUniversal2(params) {
|
|
11824
|
+
return multicallRetryInternal(
|
|
11825
|
+
params.chain,
|
|
11826
|
+
params.calls,
|
|
11827
|
+
params.abi,
|
|
11828
|
+
params.batchSize,
|
|
11829
|
+
params.maxRetries,
|
|
11830
|
+
params.providerId,
|
|
11831
|
+
params.allowFailure,
|
|
11832
|
+
customRpcs,
|
|
11833
|
+
params.logErrors
|
|
11834
|
+
);
|
|
11835
|
+
};
|
|
11836
|
+
}
|
|
11786
11837
|
async function multicallRetryUniversal({
|
|
11787
11838
|
chain,
|
|
11788
11839
|
calls,
|
|
@@ -11810,6 +11861,7 @@ export {
|
|
|
11810
11861
|
DEFAULT_BATCH_SIZE,
|
|
11811
11862
|
LIST_OVERRIDES,
|
|
11812
11863
|
createMulticallRetry,
|
|
11864
|
+
createMulticallRetryUniversal,
|
|
11813
11865
|
createTransport2 as createTransport,
|
|
11814
11866
|
customChains,
|
|
11815
11867
|
deepCompare,
|
package/package.json
CHANGED
|
@@ -7,35 +7,63 @@ import { LIST_OVERRIDES } from '../rpc/rpcOverrides'
|
|
|
7
7
|
import { getEvmClientWithCustomRpcsUniversal } from '../client/client'
|
|
8
8
|
import { DEFAULT_BATCH_SIZE, deepCompare, isArray } from '../utils/utils'
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
/** Connection-level error codes that indicate a transport failure */
|
|
11
|
+
const HTTP_ERROR_CODES = new Set([
|
|
12
|
+
'ECONNRESET',
|
|
13
|
+
'ECONNREFUSED',
|
|
14
|
+
'ECONNABORTED',
|
|
15
|
+
'ETIMEDOUT',
|
|
16
|
+
'ENOTFOUND',
|
|
17
|
+
'EPIPE',
|
|
18
|
+
'EAI_AGAIN',
|
|
19
|
+
'ERR_SOCKET_TIMEOUT',
|
|
20
|
+
'UND_ERR_CONNECT_TIMEOUT',
|
|
21
|
+
'UND_ERR_HEADERS_TIMEOUT',
|
|
22
|
+
'UND_ERR_BODY_TIMEOUT',
|
|
23
|
+
'UND_ERR_SOCKET',
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
/** Substrings in error messages that indicate an HTTP/transport failure */
|
|
27
|
+
const HTTP_ERROR_STRINGS = [
|
|
28
|
+
'rate-limit',
|
|
29
|
+
'Too Many Requests',
|
|
30
|
+
'Bad gateway',
|
|
31
|
+
'Service Unavailable',
|
|
32
|
+
'<!DOCTYPE html>',
|
|
33
|
+
'HTTP request failed',
|
|
34
|
+
'fetch failed',
|
|
35
|
+
'not whitelisted',
|
|
36
|
+
'timed out',
|
|
37
|
+
'timeout',
|
|
38
|
+
'took too long',
|
|
39
|
+
'socket hang up',
|
|
40
|
+
'network error',
|
|
41
|
+
'request aborted',
|
|
42
|
+
'body exceeded',
|
|
43
|
+
'CORS',
|
|
44
|
+
'AbortError',
|
|
45
|
+
'-32601',
|
|
46
|
+
'-32005',
|
|
47
|
+
'exceeded',
|
|
48
|
+
'limit reached',
|
|
49
|
+
'overloaded',
|
|
50
|
+
]
|
|
22
51
|
|
|
23
52
|
/** Return true if the error is an HTTP-level failure (429, 502, 503, etc.) rather than a contract/RPC error */
|
|
24
53
|
function isHttpError(e: unknown): boolean {
|
|
25
54
|
// Check connection-level error codes on the error and its cause chain
|
|
26
55
|
const err = e as any
|
|
27
56
|
const code = err?.code ?? err?.cause?.code
|
|
28
|
-
if (
|
|
29
|
-
code === 'ECONNRESET' ||
|
|
30
|
-
code === 'ETIMEDOUT' ||
|
|
31
|
-
code === 'ENOTFOUND'
|
|
32
|
-
)
|
|
33
|
-
return true
|
|
57
|
+
if (code && HTTP_ERROR_CODES.has(code)) return true
|
|
34
58
|
|
|
35
59
|
// Check numeric status on the error itself (non-BaseError cases)
|
|
36
60
|
if (err?.status === 401 || err?.status === 429 || err?.status >= 500)
|
|
37
61
|
return true
|
|
38
62
|
|
|
63
|
+
// Check error name (e.g. AbortError from fetch timeout)
|
|
64
|
+
if (err?.name === 'AbortError' || err?.cause?.name === 'AbortError')
|
|
65
|
+
return true
|
|
66
|
+
|
|
39
67
|
// Walk the BaseError cause chain for status codes and detail strings
|
|
40
68
|
if (e instanceof BaseError) {
|
|
41
69
|
let current: any = e
|
|
@@ -45,19 +73,7 @@ function isHttpError(e: unknown): boolean {
|
|
|
45
73
|
const details: string = current.details ?? ''
|
|
46
74
|
const message: string = current.message ?? ''
|
|
47
75
|
const combined = `${message} ${details}`
|
|
48
|
-
if (
|
|
49
|
-
combined.includes('rate-limit') ||
|
|
50
|
-
combined.includes('Too Many Requests') ||
|
|
51
|
-
combined.includes('Bad gateway') ||
|
|
52
|
-
combined.includes('<!DOCTYPE html>') ||
|
|
53
|
-
combined.includes('HTTP request failed') ||
|
|
54
|
-
combined.includes('not whitelisted') ||
|
|
55
|
-
combined.includes('timed out') ||
|
|
56
|
-
combined.includes('timeout') ||
|
|
57
|
-
combined.includes('took too long') ||
|
|
58
|
-
combined.includes('-32601')
|
|
59
|
-
)
|
|
60
|
-
return true
|
|
76
|
+
if (HTTP_ERROR_STRINGS.some((s) => combined.includes(s))) return true
|
|
61
77
|
current = current.cause ?? null
|
|
62
78
|
}
|
|
63
79
|
}
|
|
@@ -65,16 +81,7 @@ function isHttpError(e: unknown): boolean {
|
|
|
65
81
|
// Fallback: check message + details as strings for non-BaseError errors
|
|
66
82
|
if (e instanceof Error) {
|
|
67
83
|
const combined = `${e.message ?? ''} ${(e as any).details ?? ''}`
|
|
68
|
-
if (
|
|
69
|
-
combined.includes('HTTP request failed') ||
|
|
70
|
-
combined.includes('fetch failed') ||
|
|
71
|
-
combined.includes('not whitelisted') ||
|
|
72
|
-
combined.includes('timed out') ||
|
|
73
|
-
combined.includes('timeout') ||
|
|
74
|
-
combined.includes('took too long') ||
|
|
75
|
-
combined.includes('-32601')
|
|
76
|
-
)
|
|
77
|
-
return true
|
|
84
|
+
if (HTTP_ERROR_STRINGS.some((s) => combined.includes(s))) return true
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
return false
|
|
@@ -256,10 +263,14 @@ export function createMulticallRetry(
|
|
|
256
263
|
)
|
|
257
264
|
}
|
|
258
265
|
|
|
259
|
-
//
|
|
260
|
-
//
|
|
261
|
-
|
|
262
|
-
|
|
266
|
+
// Any non-revert, non-OOG error is treated as transient (HTTP, transport,
|
|
267
|
+
// rate-limit, unknown RPC error). Skip to next RPC without consuming a
|
|
268
|
+
// retry — only deterministic errors (revert, OOG) are handled above.
|
|
269
|
+
if (maxSkips > 0) {
|
|
270
|
+
if (logErrors) {
|
|
271
|
+
const tag = isHttpError(e) ? 'HTTP' : 'unknown-transient'
|
|
272
|
+
console.debug(`[multicall] ${tag} error on provider ${providerId}, skipping`, e)
|
|
273
|
+
}
|
|
263
274
|
return await multicallRetry(
|
|
264
275
|
chain,
|
|
265
276
|
calls,
|
|
@@ -280,6 +291,7 @@ export function createMulticallRetry(
|
|
|
280
291
|
return Array(calls.length).fill('0x')
|
|
281
292
|
}
|
|
282
293
|
|
|
294
|
+
// Skips exhausted — consume a retry and rotate RPC
|
|
283
295
|
if (logErrors) console.debug(e)
|
|
284
296
|
|
|
285
297
|
return await multicallRetry(
|
|
@@ -350,6 +362,26 @@ export async function multicallRetry(
|
|
|
350
362
|
)
|
|
351
363
|
}
|
|
352
364
|
|
|
365
|
+
export function createMulticallRetryUniversal(
|
|
366
|
+
customRpcs: Record<string, string[]> = LIST_OVERRIDES,
|
|
367
|
+
) {
|
|
368
|
+
return async function multicallRetryUniversal(
|
|
369
|
+
params: MulticallRetryParams,
|
|
370
|
+
): Promise<any[]> {
|
|
371
|
+
return multicallRetryInternal(
|
|
372
|
+
params.chain,
|
|
373
|
+
params.calls,
|
|
374
|
+
params.abi,
|
|
375
|
+
params.batchSize,
|
|
376
|
+
params.maxRetries,
|
|
377
|
+
params.providerId,
|
|
378
|
+
params.allowFailure,
|
|
379
|
+
customRpcs,
|
|
380
|
+
params.logErrors,
|
|
381
|
+
)
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
353
385
|
export async function multicallRetryUniversal({
|
|
354
386
|
chain,
|
|
355
387
|
calls,
|
package/src/rpc/rpcOverrides.ts
CHANGED
|
@@ -61,7 +61,6 @@ export const LIST_OVERRIDES: Record<string, string[]> = {
|
|
|
61
61
|
'https://erpc.xdcrpc.com',
|
|
62
62
|
],
|
|
63
63
|
[Chain.ETHEREUM_MAINNET]: [
|
|
64
|
-
'https://eth.llamarpc.com',
|
|
65
64
|
'https://api.zan.top/eth-mainnet',
|
|
66
65
|
'https://rpc.flashbots.net/fast',
|
|
67
66
|
'https://rpc.owlracle.info/eth/70d38ce1826c4a60bb2a8e05a6c8b20f',
|
|
@@ -72,6 +71,7 @@ export const LIST_OVERRIDES: Record<string, string[]> = {
|
|
|
72
71
|
'https://rpc.flashbots.net',
|
|
73
72
|
'https://public-eth.nownodes.io',
|
|
74
73
|
'https://ethereum-json-rpc.stakely.io',
|
|
74
|
+
'https://eth.llamarpc.com',
|
|
75
75
|
'https://eth.blockrazor.xyz',
|
|
76
76
|
'https://eth.drpc.org',
|
|
77
77
|
'https://ethereum.public.blockpi.network/v1/rpc/public',
|