@coti-io/coti-wallet-plugin 0.2.3 → 0.2.4

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
@@ -4427,14 +4427,27 @@ var collectErrorText = (error) => {
4427
4427
  return String(error);
4428
4428
  }
4429
4429
  };
4430
+ var readNestedRpcCode = (error) => {
4431
+ const e = error;
4432
+ return e.code ?? e.error?.code ?? e.info?.error?.code;
4433
+ };
4434
+ var readNestedHttpStatus = (error) => {
4435
+ const e = error;
4436
+ return e.data?.httpStatus ?? e.error?.data?.httpStatus ?? e.info?.responseStatus;
4437
+ };
4430
4438
  var isTransientRpcError = (error) => {
4431
4439
  const text = collectErrorText(error);
4432
- if (text.includes("Too Many Requests") || text.includes("rate limit") || text.includes("-32005") || text.includes("ECONNRESET") || text.includes("ETIMEDOUT") || text.includes("timeout") || text.includes("503") || text.includes("502")) {
4440
+ const lower = text.toLowerCase();
4441
+ if (lower.includes("too many requests") || lower.includes("rate limit") || text.includes("-32005") || text.includes("ECONNRESET") || text.includes("ETIMEDOUT") || lower.includes("timeout") || text.includes("503") || text.includes("502") || text.includes("429")) {
4433
4442
  return true;
4434
4443
  }
4435
4444
  if (error && typeof error === "object") {
4436
- const code = error.code;
4437
- if (code === "SERVER_ERROR" || code === "TIMEOUT" || code === "NETWORK_ERROR") {
4445
+ const code = readNestedRpcCode(error);
4446
+ if (code === "SERVER_ERROR" || code === "TIMEOUT" || code === "NETWORK_ERROR" || code === -32005 || code === "-32005") {
4447
+ return true;
4448
+ }
4449
+ const httpStatus = readNestedHttpStatus(error);
4450
+ if (httpStatus === 429 || httpStatus === "429") {
4438
4451
  return true;
4439
4452
  }
4440
4453
  }