@medialane/sdk 0.103.0 → 0.105.0
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.cjs +111 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -2
- package/dist/index.d.ts +58 -2
- package/dist/index.js +104 -2
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +15 -0
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.js +15 -0
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -903,8 +903,23 @@ var PUBLIC_RPC_FALLBACKS = [
|
|
|
903
903
|
"https://rpc.starknet.lava.build"
|
|
904
904
|
];
|
|
905
905
|
var TRANSIENT_BODY_RE = /"code"\s*:\s*-32001|"code"\s*:\s*-32603|unable to complete|rate.?limit|too many|throttl|exceed.*quota|temporarily unavailable|service unavailable|overload|gateway.*time|upstream.*time|backend.*error/i;
|
|
906
|
+
var POLICY_REFUSAL_CODES = [-32003, -32005, -32600];
|
|
907
|
+
function isPolicyRefusal(input) {
|
|
908
|
+
let body = input.body;
|
|
909
|
+
if (typeof body === "string") {
|
|
910
|
+
try {
|
|
911
|
+
body = JSON.parse(body);
|
|
912
|
+
} catch {
|
|
913
|
+
return false;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
const err = body?.error;
|
|
917
|
+
const code = err && typeof err === "object" ? err.code : void 0;
|
|
918
|
+
return typeof code === "number" && POLICY_REFUSAL_CODES.includes(code);
|
|
919
|
+
}
|
|
906
920
|
function isTransientRpcError(input) {
|
|
907
921
|
const { status, body } = input;
|
|
922
|
+
if (isPolicyRefusal({ body })) return false;
|
|
908
923
|
if (typeof status === "number" && (status === 429 || status >= 500)) return true;
|
|
909
924
|
if (body == null) return false;
|
|
910
925
|
if (typeof body === "object") {
|