@1delta/providers 0.0.54 → 0.0.55

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.js CHANGED
@@ -25413,6 +25413,15 @@ function isHttpError(e) {
25413
25413
  }
25414
25414
  return false;
25415
25415
  }
25416
+ function formatViemError(e) {
25417
+ if (e instanceof BaseError2) {
25418
+ const cause = e.walk()?.shortMessage;
25419
+ const short = e.shortMessage;
25420
+ return cause && cause !== short ? `${e.name}: ${short} | cause: ${cause}` : `${e.name}: ${short}`;
25421
+ }
25422
+ if (e instanceof Error) return `${e.name}: ${e.message}`;
25423
+ return String(e);
25424
+ }
25416
25425
  function isOutOfGasError(e) {
25417
25426
  const msg = e instanceof Error ? (e.message ?? "") + (e.details ?? "") : "";
25418
25427
  return msg.includes("out of gas") || msg.includes("gas exhausted");
@@ -25523,7 +25532,7 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
25523
25532
  }
25524
25533
  }
25525
25534
  if (isOutOfGasError(e) && batchSize > 1) {
25526
- if (logErrors) console.debug(e);
25535
+ if (logErrors) console.debug("[multicall] OOG", formatViemError(e));
25527
25536
  return await multicallRetry2(
25528
25537
  chain,
25529
25538
  calls,
@@ -25541,8 +25550,8 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
25541
25550
  if (logErrors) {
25542
25551
  const tag = isHttpError(e) ? "HTTP" : "unknown-transient";
25543
25552
  console.debug(
25544
- `[multicall] ${tag} error on provider ${providerId}, skipping`,
25545
- e
25553
+ `[multicall] ${tag} error on provider ${providerId}, skipping:`,
25554
+ formatViemError(e)
25546
25555
  );
25547
25556
  }
25548
25557
  return await multicallRetry2(
@@ -25560,10 +25569,14 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
25560
25569
  }
25561
25570
  if (maxRetries === 0) {
25562
25571
  if (!allowFailure) throw e;
25563
- if (logErrors) console.debug(e);
25572
+ if (logErrors) console.debug("[multicall]", formatViemError(e));
25564
25573
  return Array(calls.length).fill("0x");
25565
25574
  }
25566
- if (logErrors) console.debug(e);
25575
+ if (logErrors)
25576
+ console.debug(
25577
+ `[multicall] retrying on provider ${providerId + 1}:`,
25578
+ formatViemError(e)
25579
+ );
25567
25580
  return await multicallRetry2(
25568
25581
  chain,
25569
25582
  calls,
package/dist/index.mjs CHANGED
@@ -11652,6 +11652,15 @@ function isHttpError(e) {
11652
11652
  }
11653
11653
  return false;
11654
11654
  }
11655
+ function formatViemError(e) {
11656
+ if (e instanceof BaseError) {
11657
+ const cause = e.walk()?.shortMessage;
11658
+ const short = e.shortMessage;
11659
+ return cause && cause !== short ? `${e.name}: ${short} | cause: ${cause}` : `${e.name}: ${short}`;
11660
+ }
11661
+ if (e instanceof Error) return `${e.name}: ${e.message}`;
11662
+ return String(e);
11663
+ }
11655
11664
  function isOutOfGasError(e) {
11656
11665
  const msg = e instanceof Error ? (e.message ?? "") + (e.details ?? "") : "";
11657
11666
  return msg.includes("out of gas") || msg.includes("gas exhausted");
@@ -11762,7 +11771,7 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
11762
11771
  }
11763
11772
  }
11764
11773
  if (isOutOfGasError(e) && batchSize > 1) {
11765
- if (logErrors) console.debug(e);
11774
+ if (logErrors) console.debug("[multicall] OOG", formatViemError(e));
11766
11775
  return await multicallRetry2(
11767
11776
  chain,
11768
11777
  calls,
@@ -11780,8 +11789,8 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
11780
11789
  if (logErrors) {
11781
11790
  const tag = isHttpError(e) ? "HTTP" : "unknown-transient";
11782
11791
  console.debug(
11783
- `[multicall] ${tag} error on provider ${providerId}, skipping`,
11784
- e
11792
+ `[multicall] ${tag} error on provider ${providerId}, skipping:`,
11793
+ formatViemError(e)
11785
11794
  );
11786
11795
  }
11787
11796
  return await multicallRetry2(
@@ -11799,10 +11808,14 @@ function createMulticallRetry(customRpcs = LIST_OVERRIDES) {
11799
11808
  }
11800
11809
  if (maxRetries === 0) {
11801
11810
  if (!allowFailure) throw e;
11802
- if (logErrors) console.debug(e);
11811
+ if (logErrors) console.debug("[multicall]", formatViemError(e));
11803
11812
  return Array(calls.length).fill("0x");
11804
11813
  }
11805
- if (logErrors) console.debug(e);
11814
+ if (logErrors)
11815
+ console.debug(
11816
+ `[multicall] retrying on provider ${providerId + 1}:`,
11817
+ formatViemError(e)
11818
+ );
11806
11819
  return await multicallRetry2(
11807
11820
  chain,
11808
11821
  calls,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1delta/providers",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "vitest": "^4.0.18",
21
21
  "@1delta/chain-registry": "0.0.4",
22
- "@1delta/data-sdk": "0.0.21"
22
+ "@1delta/data-sdk": "0.0.22"
23
23
  },
24
24
  "devDependencies": {
25
25
  "tsup": "^8.5.1",
@@ -87,6 +87,19 @@ function isHttpError(e: unknown): boolean {
87
87
  return false
88
88
  }
89
89
 
90
+ /** Compact viem/error formatter — avoids dumping full ABI/calldata/args */
91
+ function formatViemError(e: unknown): string {
92
+ if (e instanceof BaseError) {
93
+ const cause = (e.walk() as any)?.shortMessage
94
+ const short = e.shortMessage
95
+ return cause && cause !== short
96
+ ? `${e.name}: ${short} | cause: ${cause}`
97
+ : `${e.name}: ${short}`
98
+ }
99
+ if (e instanceof Error) return `${e.name}: ${e.message}`
100
+ return String(e)
101
+ }
102
+
90
103
  /** Return true if the multicall ran out of gas (batch too large for the RPC gas limit) */
91
104
  function isOutOfGasError(e: unknown): boolean {
92
105
  const msg =
@@ -267,7 +280,7 @@ export function createMulticallRetry(
267
280
 
268
281
  // Out-of-gas: batch too large for the RPC gas limit — halve batch size and retry
269
282
  if (isOutOfGasError(e) && batchSize > 1) {
270
- if (logErrors) console.debug(e)
283
+ if (logErrors) console.debug('[multicall] OOG', formatViemError(e))
271
284
  return await multicallRetry(
272
285
  chain,
273
286
  calls,
@@ -289,8 +302,8 @@ export function createMulticallRetry(
289
302
  if (logErrors) {
290
303
  const tag = isHttpError(e) ? 'HTTP' : 'unknown-transient'
291
304
  console.debug(
292
- `[multicall] ${tag} error on provider ${providerId}, skipping`,
293
- e,
305
+ `[multicall] ${tag} error on provider ${providerId}, skipping:`,
306
+ formatViemError(e),
294
307
  )
295
308
  }
296
309
  return await multicallRetry(
@@ -309,12 +322,16 @@ export function createMulticallRetry(
309
322
 
310
323
  if (maxRetries === 0) {
311
324
  if (!allowFailure) throw e
312
- if (logErrors) console.debug(e)
325
+ if (logErrors) console.debug('[multicall]', formatViemError(e))
313
326
  return Array(calls.length).fill('0x')
314
327
  }
315
328
 
316
329
  // Skips exhausted — consume a retry and rotate RPC
317
- if (logErrors) console.debug(e)
330
+ if (logErrors)
331
+ console.debug(
332
+ `[multicall] retrying on provider ${providerId + 1}:`,
333
+ formatViemError(e),
334
+ )
318
335
 
319
336
  return await multicallRetry(
320
337
  chain,