@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 +16 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4269,14 +4269,27 @@ var collectErrorText = (error) => {
|
|
|
4269
4269
|
return String(error);
|
|
4270
4270
|
}
|
|
4271
4271
|
};
|
|
4272
|
+
var readNestedRpcCode = (error) => {
|
|
4273
|
+
const e = error;
|
|
4274
|
+
return e.code ?? e.error?.code ?? e.info?.error?.code;
|
|
4275
|
+
};
|
|
4276
|
+
var readNestedHttpStatus = (error) => {
|
|
4277
|
+
const e = error;
|
|
4278
|
+
return e.data?.httpStatus ?? e.error?.data?.httpStatus ?? e.info?.responseStatus;
|
|
4279
|
+
};
|
|
4272
4280
|
var isTransientRpcError = (error) => {
|
|
4273
4281
|
const text = collectErrorText(error);
|
|
4274
|
-
|
|
4282
|
+
const lower = text.toLowerCase();
|
|
4283
|
+
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")) {
|
|
4275
4284
|
return true;
|
|
4276
4285
|
}
|
|
4277
4286
|
if (error && typeof error === "object") {
|
|
4278
|
-
const code = error
|
|
4279
|
-
if (code === "SERVER_ERROR" || code === "TIMEOUT" || code === "NETWORK_ERROR") {
|
|
4287
|
+
const code = readNestedRpcCode(error);
|
|
4288
|
+
if (code === "SERVER_ERROR" || code === "TIMEOUT" || code === "NETWORK_ERROR" || code === -32005 || code === "-32005") {
|
|
4289
|
+
return true;
|
|
4290
|
+
}
|
|
4291
|
+
const httpStatus = readNestedHttpStatus(error);
|
|
4292
|
+
if (httpStatus === 429 || httpStatus === "429") {
|
|
4280
4293
|
return true;
|
|
4281
4294
|
}
|
|
4282
4295
|
}
|