@swapkit/helpers 1.0.0-rc.72 → 1.0.0-rc.74
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +14 -13
- package/dist/index.es.js.map +1 -1
- package/package.json +6 -6
- package/src/modules/swapKitError.ts +1 -0
package/dist/index.es.js
CHANGED
|
@@ -65,9 +65,9 @@ class pe extends Error {
|
|
|
65
65
|
}), this.name = "TimeoutError", this.request = t;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const M = (e) => e !== null && typeof e == "object", x = (...e) => {
|
|
69
69
|
for (const t of e)
|
|
70
|
-
if ((!
|
|
70
|
+
if ((!M(t) || Array.isArray(t)) && t !== void 0)
|
|
71
71
|
throw new TypeError("The `options` argument must be an object");
|
|
72
72
|
return se({}, ...e);
|
|
73
73
|
}, me = (e = {}, t = {}) => {
|
|
@@ -80,10 +80,10 @@ const k = (e) => e !== null && typeof e == "object", x = (...e) => {
|
|
|
80
80
|
for (const r of e)
|
|
81
81
|
if (Array.isArray(r))
|
|
82
82
|
Array.isArray(t) || (t = []), t = [...t, ...r];
|
|
83
|
-
else if (
|
|
83
|
+
else if (M(r)) {
|
|
84
84
|
for (let [s, i] of Object.entries(r))
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
M(i) && s in t && (i = se(t[s], i)), t = { ...t, [s]: i };
|
|
86
|
+
M(r.headers) && (n = me(n, r.headers), t.headers = n);
|
|
87
87
|
}
|
|
88
88
|
return t;
|
|
89
89
|
}, He = (() => {
|
|
@@ -97,7 +97,7 @@ const k = (e) => e !== null && typeof e == "object", x = (...e) => {
|
|
|
97
97
|
return e = !0, "half";
|
|
98
98
|
}
|
|
99
99
|
}).headers.has("Content-Type")), e && !t;
|
|
100
|
-
})(), xe = typeof globalThis.AbortController == "function",
|
|
100
|
+
})(), xe = typeof globalThis.AbortController == "function", ke = typeof globalThis.ReadableStream == "function", Me = typeof globalThis.FormData == "function", _e = ["get", "post", "put", "patch", "head", "delete"], Le = {
|
|
101
101
|
json: "application/json",
|
|
102
102
|
text: "text/*",
|
|
103
103
|
formData: "multipart/form-data",
|
|
@@ -201,7 +201,7 @@ class W {
|
|
|
201
201
|
if (r._options.onDownloadProgress) {
|
|
202
202
|
if (typeof r._options.onDownloadProgress != "function")
|
|
203
203
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
204
|
-
if (!
|
|
204
|
+
if (!ke)
|
|
205
205
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
206
206
|
return r._stream(o.clone(), r._options.onDownloadProgress);
|
|
207
207
|
}
|
|
@@ -284,7 +284,7 @@ class W {
|
|
|
284
284
|
}
|
|
285
285
|
if (He && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
|
|
286
286
|
const r = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, r);
|
|
287
|
-
(
|
|
287
|
+
(Me && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(s, { ...this.request }), this._options);
|
|
288
288
|
}
|
|
289
289
|
this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
|
|
290
290
|
}
|
|
@@ -731,7 +731,7 @@ const q = class q {
|
|
|
731
731
|
_(this, "bigIntValue", 0n);
|
|
732
732
|
_(this, "decimal");
|
|
733
733
|
const n = te(t), r = typeof t == "object";
|
|
734
|
-
this.decimal = r ? t.decimal : void 0, this.decimalMultiplier = r && "decimalMultiplier" in t ? t.decimalMultiplier : y(Math.max(he(
|
|
734
|
+
this.decimal = r ? t.decimal : void 0, this.decimalMultiplier = r && "decimalMultiplier" in t ? t.decimalMultiplier : y(Math.max(he(k(n)), this.decimal || 0)), p(this, j, be).call(this, n);
|
|
735
735
|
}
|
|
736
736
|
static fromBigInt(t, n) {
|
|
737
737
|
return new q({
|
|
@@ -809,7 +809,7 @@ const q = class q {
|
|
|
809
809
|
getBigIntValue(t, n) {
|
|
810
810
|
if (!n && typeof t == "object")
|
|
811
811
|
return t.bigIntValue;
|
|
812
|
-
const r = te(t), s =
|
|
812
|
+
const r = te(t), s = k(r);
|
|
813
813
|
return s === "0" || s === "undefined" ? 0n : p(this, H, ee).call(this, s, n);
|
|
814
814
|
}
|
|
815
815
|
toSignificant(t = 6) {
|
|
@@ -915,10 +915,10 @@ w = new WeakSet(), I = function(t, ...n) {
|
|
|
915
915
|
return i === s;
|
|
916
916
|
}
|
|
917
917
|
}, j = new WeakSet(), be = function(t) {
|
|
918
|
-
const n =
|
|
918
|
+
const n = k(t) || "0";
|
|
919
919
|
this.bigIntValue = p(this, H, ee).call(this, n);
|
|
920
920
|
}, V = new WeakSet(), Z = function(...t) {
|
|
921
|
-
const n = t.map((r) => typeof r == "object" ? r.decimal || v(r.decimalMultiplier) : he(
|
|
921
|
+
const n = t.map((r) => typeof r == "object" ? r.decimal || v(r.decimalMultiplier) : he(k(r))).filter(Boolean);
|
|
922
922
|
return Math.max(...n, B);
|
|
923
923
|
}, H = new WeakSet(), ee = function(t, n) {
|
|
924
924
|
const r = n ? y(n) : this.decimalMultiplier, s = v(r), [i = "", o = ""] = t.split(".");
|
|
@@ -929,7 +929,7 @@ const pt = Intl.NumberFormat("fullwide", {
|
|
|
929
929
|
useGrouping: !1,
|
|
930
930
|
maximumFractionDigits: 20
|
|
931
931
|
});
|
|
932
|
-
function
|
|
932
|
+
function k(e) {
|
|
933
933
|
const n = `${typeof e == "number" ? pt.format(e) : te(e)}`.replaceAll(",", ".").split(".");
|
|
934
934
|
return n.length > 1 ? `${n.slice(0, -1).join("")}.${n.at(-1)}` : n[0];
|
|
935
935
|
}
|
|
@@ -1195,6 +1195,7 @@ const mt = {
|
|
|
1195
1195
|
* Chainflip
|
|
1196
1196
|
*/
|
|
1197
1197
|
chainflip_channel_error: 30001,
|
|
1198
|
+
chainflip_broker_recipient_error: 30002,
|
|
1198
1199
|
/**
|
|
1199
1200
|
* THORChain
|
|
1200
1201
|
*/
|