@gearbox-protocol/sdk 14.0.0-next.7 → 14.0.0-next.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.
|
@@ -43,7 +43,9 @@ const RANGE_ERROR_PATTERNS = [
|
|
|
43
43
|
/eth_getLogs is limited to/i,
|
|
44
44
|
/eth_getLogs requests with up to/i,
|
|
45
45
|
/range is too large/i,
|
|
46
|
-
/exceeded max allowed range/i
|
|
46
|
+
/exceeded max allowed range/i,
|
|
47
|
+
// Encountered on DRPC: "query exceeds max results 20000, retry with the range …"
|
|
48
|
+
/exceeds max results/i
|
|
47
49
|
];
|
|
48
50
|
function isRangeError(error) {
|
|
49
51
|
const msg = errorMessage(error);
|
|
@@ -51,10 +53,17 @@ function isRangeError(error) {
|
|
|
51
53
|
}
|
|
52
54
|
const GENERIC_BLOCKS_RE = /(\d+)\s*block/i;
|
|
53
55
|
const ALCHEMY_RANGE_RE = /this block range should work: \[(0x[0-9a-fA-F]+),\s*(0x[0-9a-fA-F]+)\]/;
|
|
56
|
+
const DRPC_RANGE_RE = /retry with the range (\d+)-(\d+)/;
|
|
54
57
|
function parsePageSizeHint(error) {
|
|
55
58
|
const alchemy = tryAlchemyHint(error);
|
|
56
59
|
if (alchemy != null) return alchemy;
|
|
57
60
|
const msg = errorMessage(error);
|
|
61
|
+
const drpc = msg.match(DRPC_RANGE_RE);
|
|
62
|
+
if (drpc) {
|
|
63
|
+
const from = Number(drpc[1]);
|
|
64
|
+
const to = Number(drpc[2]);
|
|
65
|
+
return to - from + 1;
|
|
66
|
+
}
|
|
58
67
|
const m = msg.match(GENERIC_BLOCKS_RE);
|
|
59
68
|
return m ? Number(m[1]) : null;
|
|
60
69
|
}
|
|
@@ -21,7 +21,9 @@ const RANGE_ERROR_PATTERNS = [
|
|
|
21
21
|
/eth_getLogs is limited to/i,
|
|
22
22
|
/eth_getLogs requests with up to/i,
|
|
23
23
|
/range is too large/i,
|
|
24
|
-
/exceeded max allowed range/i
|
|
24
|
+
/exceeded max allowed range/i,
|
|
25
|
+
// Encountered on DRPC: "query exceeds max results 20000, retry with the range …"
|
|
26
|
+
/exceeds max results/i
|
|
25
27
|
];
|
|
26
28
|
function isRangeError(error) {
|
|
27
29
|
const msg = errorMessage(error);
|
|
@@ -29,10 +31,17 @@ function isRangeError(error) {
|
|
|
29
31
|
}
|
|
30
32
|
const GENERIC_BLOCKS_RE = /(\d+)\s*block/i;
|
|
31
33
|
const ALCHEMY_RANGE_RE = /this block range should work: \[(0x[0-9a-fA-F]+),\s*(0x[0-9a-fA-F]+)\]/;
|
|
34
|
+
const DRPC_RANGE_RE = /retry with the range (\d+)-(\d+)/;
|
|
32
35
|
function parsePageSizeHint(error) {
|
|
33
36
|
const alchemy = tryAlchemyHint(error);
|
|
34
37
|
if (alchemy != null) return alchemy;
|
|
35
38
|
const msg = errorMessage(error);
|
|
39
|
+
const drpc = msg.match(DRPC_RANGE_RE);
|
|
40
|
+
if (drpc) {
|
|
41
|
+
const from = Number(drpc[1]);
|
|
42
|
+
const to = Number(drpc[2]);
|
|
43
|
+
return to - from + 1;
|
|
44
|
+
}
|
|
36
45
|
const m = msg.match(GENERIC_BLOCKS_RE);
|
|
37
46
|
return m ? Number(m[1]) : null;
|
|
38
47
|
}
|
|
@@ -56,7 +56,9 @@ export declare function isRangeError(error: unknown): boolean;
|
|
|
56
56
|
* 1. **Alchemy JSON details** — parses the `details` field of a
|
|
57
57
|
* {@link HttpRequestError} for a suggested `[fromHex, toHex]` range and
|
|
58
58
|
* computes the span as `toHex - fromHex + 1`.
|
|
59
|
-
* 2. **
|
|
59
|
+
* 2. **DRPC decimal range** — matches `retry with the range <from>-<to>` and
|
|
60
|
+
* computes the span as `to - from + 1`.
|
|
61
|
+
* 3. **Generic N-blocks pattern** — matches `/<number> block(s)/i` in the
|
|
60
62
|
* error message.
|
|
61
63
|
*
|
|
62
64
|
* @param error - Any thrown value.
|