@chainrails/react 0.2.23 → 0.2.24
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { jsxs as we, jsx as
|
|
1
|
+
import { useState as C, useRef as re, useEffect as x, useMemo as ye, useSyncExternalStore as Rt, useCallback as At, useLayoutEffect as vt, useDebugValue as Pt } from "react";
|
|
2
|
+
import { jsxs as we, jsx as M } from "react/jsx-runtime";
|
|
3
3
|
import './index.css';class G extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
@@ -50,7 +50,7 @@ const be = (() => {
|
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
52
|
return e && !t;
|
|
53
|
-
})(), It = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function",
|
|
53
|
+
})(), It = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", Ut = typeof globalThis.FormData == "function", $e = ["get", "post", "put", "patch", "head", "delete"], xt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -59,7 +59,7 @@ const be = (() => {
|
|
|
59
59
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
60
60
|
// We still feature-check at runtime before exposing the shortcut.
|
|
61
61
|
bytes: "*/*"
|
|
62
|
-
}, W = 2147483647,
|
|
62
|
+
}, W = 2147483647, kt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, ze = Symbol("stop");
|
|
63
63
|
class Le {
|
|
64
64
|
options;
|
|
65
65
|
constructor(t) {
|
|
@@ -104,7 +104,7 @@ const Dt = (e) => new Le(e), Ot = {
|
|
|
104
104
|
if (e instanceof FormData) {
|
|
105
105
|
let t = 0;
|
|
106
106
|
for (const [s, n] of e)
|
|
107
|
-
t +=
|
|
107
|
+
t += kt, t += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, t += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
|
|
108
108
|
return t;
|
|
109
109
|
}
|
|
110
110
|
if (e instanceof Blob)
|
|
@@ -164,7 +164,7 @@ const Dt = (e) => new Le(e), Ot = {
|
|
|
164
164
|
duplex: "half",
|
|
165
165
|
body: je(e.body, n, t)
|
|
166
166
|
});
|
|
167
|
-
}, I = (e) => e !== null && typeof e == "object",
|
|
167
|
+
}, I = (e) => e !== null && typeof e == "object", B = (...e) => {
|
|
168
168
|
for (const t of e)
|
|
169
169
|
if ((!I(t) || Array.isArray(t)) && t !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
@@ -175,14 +175,14 @@ const Dt = (e) => new Le(e), Ot = {
|
|
|
175
175
|
n && o === "undefined" || o === void 0 ? s.delete(i) : s.set(i, o);
|
|
176
176
|
return s;
|
|
177
177
|
};
|
|
178
|
-
function
|
|
178
|
+
function $(e, t, s) {
|
|
179
179
|
return Object.hasOwn(t, s) && t[s] === void 0 ? [] : oe(e[s] ?? [], t[s] ?? []);
|
|
180
180
|
}
|
|
181
181
|
const qe = (e = {}, t = {}) => ({
|
|
182
|
-
beforeRequest:
|
|
183
|
-
beforeRetry:
|
|
184
|
-
afterResponse:
|
|
185
|
-
beforeError:
|
|
182
|
+
beforeRequest: $(e, t, "beforeRequest"),
|
|
183
|
+
beforeRetry: $(e, t, "beforeRetry"),
|
|
184
|
+
afterResponse: $(e, t, "afterResponse"),
|
|
185
|
+
beforeError: $(e, t, "beforeError")
|
|
186
186
|
}), Lt = (e, t) => {
|
|
187
187
|
const s = new URLSearchParams();
|
|
188
188
|
for (const n of [e, t])
|
|
@@ -323,7 +323,7 @@ class N {
|
|
|
323
323
|
if (n.#e.onDownloadProgress) {
|
|
324
324
|
if (typeof n.#e.onDownloadProgress != "function")
|
|
325
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
326
|
-
if (!
|
|
326
|
+
if (!Ct)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
328
|
return $t(o.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
@@ -332,7 +332,7 @@ class N {
|
|
|
332
332
|
const o = n.#o, a = [];
|
|
333
333
|
o && !o.bodyUsed && a.push(o.body?.cancel()), n.request.bodyUsed || a.push(n.request.body?.cancel()), await Promise.all(a);
|
|
334
334
|
});
|
|
335
|
-
for (const [o, a] of Object.entries(
|
|
335
|
+
for (const [o, a] of Object.entries(xt))
|
|
336
336
|
o === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[o] = async () => {
|
|
337
337
|
n.request.headers.set("accept", n.request.headers.get("accept") || a);
|
|
338
338
|
const c = await i;
|
|
@@ -387,7 +387,7 @@ class N {
|
|
|
387
387
|
}
|
|
388
388
|
It && Be && (this.#r = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal), be && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
|
|
389
389
|
const n = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
390
|
-
if (this.#t instanceof globalThis.Request && (
|
|
390
|
+
if (this.#t instanceof globalThis.Request && (Ut && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !n && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), Yt(this.#e.searchParams)) {
|
|
391
391
|
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(N.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
392
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
393
393
|
}
|
|
@@ -499,10 +499,10 @@ class N {
|
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const Q = (e) => {
|
|
502
|
-
const t = (s, n) => N.create(s,
|
|
502
|
+
const t = (s, n) => N.create(s, B(e, n));
|
|
503
503
|
for (const s of $e)
|
|
504
|
-
t[s] = (n, r) => N.create(n,
|
|
505
|
-
return t.create = (s) => Q(
|
|
504
|
+
t[s] = (n, r) => N.create(n, B(e, r, { method: s }));
|
|
505
|
+
return t.create = (s) => Q(B(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), Q(B(e, s))), t.stop = ze, t.retry = Dt, t;
|
|
506
506
|
}, Gt = Q();
|
|
507
507
|
var S = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(S || {});
|
|
508
508
|
const Fe = {
|
|
@@ -633,7 +633,7 @@ class tt extends v {
|
|
|
633
633
|
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function F(e, { dir: t, size: s = 32 } = {}) {
|
|
637
637
|
return typeof e == "string" ? Zt(e, { dir: t, size: s }) : Qt(e, { dir: t, size: s });
|
|
638
638
|
}
|
|
639
639
|
function Zt(e, { dir: t, size: s = 32 } = {}) {
|
|
@@ -697,7 +697,7 @@ function ss(e, t = {}) {
|
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
699
|
const a = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`;
|
|
700
|
-
return n ?
|
|
700
|
+
return n ? F(a, { size: n }) : a;
|
|
701
701
|
}
|
|
702
702
|
const ns = /* @__PURE__ */ new TextEncoder();
|
|
703
703
|
function rs(e, t = {}) {
|
|
@@ -705,7 +705,7 @@ function rs(e, t = {}) {
|
|
|
705
705
|
}
|
|
706
706
|
function os(e, t = {}) {
|
|
707
707
|
const s = new Uint8Array(1);
|
|
708
|
-
return s[0] = Number(e), typeof t.size == "number" ? (ae(s, { size: t.size }),
|
|
708
|
+
return s[0] = Number(e), typeof t.size == "number" ? (ae(s, { size: t.size }), F(s, { size: t.size })) : s;
|
|
709
709
|
}
|
|
710
710
|
const T = {
|
|
711
711
|
zero: 48,
|
|
@@ -725,7 +725,7 @@ function Te(e) {
|
|
|
725
725
|
}
|
|
726
726
|
function st(e, t = {}) {
|
|
727
727
|
let s = e;
|
|
728
|
-
t.size && (ae(s, { size: t.size }), s =
|
|
728
|
+
t.size && (ae(s, { size: t.size }), s = F(s, { dir: "right", size: t.size }));
|
|
729
729
|
let n = s.slice(2);
|
|
730
730
|
n.length % 2 && (n = `0${n}`);
|
|
731
731
|
const r = n.length / 2, i = new Uint8Array(r);
|
|
@@ -743,11 +743,11 @@ function is(e, t) {
|
|
|
743
743
|
}
|
|
744
744
|
function nt(e, t = {}) {
|
|
745
745
|
const s = ns.encode(e);
|
|
746
|
-
return typeof t.size == "number" ? (ae(s, { size: t.size }),
|
|
746
|
+
return typeof t.size == "number" ? (ae(s, { size: t.size }), F(s, { dir: "right", size: t.size })) : s;
|
|
747
747
|
}
|
|
748
|
-
const
|
|
748
|
+
const z = /* @__PURE__ */ BigInt(2 ** 32 - 1), Re = /* @__PURE__ */ BigInt(32);
|
|
749
749
|
function as(e, t = !1) {
|
|
750
|
-
return t ? { h: Number(e &
|
|
750
|
+
return t ? { h: Number(e & z), l: Number(e >> Re & z) } : { h: Number(e >> Re & z) | 0, l: Number(e & z) | 0 };
|
|
751
751
|
}
|
|
752
752
|
function cs(e, t = !1) {
|
|
753
753
|
const s = e.length;
|
|
@@ -767,7 +767,7 @@ function Ae(e) {
|
|
|
767
767
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
768
768
|
throw new Error("positive integer expected, got " + e);
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function L(e, ...t) {
|
|
771
771
|
if (!ds(e))
|
|
772
772
|
throw new Error("Uint8Array expected");
|
|
773
773
|
if (t.length > 0 && !t.includes(e.length))
|
|
@@ -780,7 +780,7 @@ function ve(e, t = !0) {
|
|
|
780
780
|
throw new Error("Hash#digest() has already been called");
|
|
781
781
|
}
|
|
782
782
|
function ps(e, t) {
|
|
783
|
-
|
|
783
|
+
L(e);
|
|
784
784
|
const s = t.outputLen;
|
|
785
785
|
if (e.length < s)
|
|
786
786
|
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
@@ -808,7 +808,7 @@ function bs(e) {
|
|
|
808
808
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
809
809
|
}
|
|
810
810
|
function ot(e) {
|
|
811
|
-
return typeof e == "string" && (e = bs(e)),
|
|
811
|
+
return typeof e == "string" && (e = bs(e)), L(e), e;
|
|
812
812
|
}
|
|
813
813
|
class Es {
|
|
814
814
|
}
|
|
@@ -816,28 +816,28 @@ function Ss(e) {
|
|
|
816
816
|
const t = (n) => e().update(ot(n)).digest(), s = e();
|
|
817
817
|
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
818
818
|
}
|
|
819
|
-
const Ts = BigInt(0),
|
|
820
|
-
for (let e = 0, t =
|
|
819
|
+
const Ts = BigInt(0), k = BigInt(1), Rs = BigInt(2), As = BigInt(7), vs = BigInt(256), Ps = BigInt(113), it = [], at = [], ct = [];
|
|
820
|
+
for (let e = 0, t = k, s = 1, n = 0; e < 24; e++) {
|
|
821
821
|
[s, n] = [n, (2 * s + 3 * n) % 5], it.push(2 * (5 * n + s)), at.push((e + 1) * (e + 2) / 2 % 64);
|
|
822
822
|
let r = Ts;
|
|
823
823
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
t = (t <<
|
|
824
|
+
t = (t << k ^ (t >> As) * Ps) % vs, t & Rs && (r ^= k << (k << /* @__PURE__ */ BigInt(i)) - k);
|
|
825
825
|
ct.push(r);
|
|
826
826
|
}
|
|
827
|
-
const ut = cs(ct, !0), Is = ut[0],
|
|
828
|
-
function
|
|
827
|
+
const ut = cs(ct, !0), Is = ut[0], Cs = ut[1], Ie = (e, t, s) => s > 32 ? fs(e, t, s) : us(e, t, s), Ce = (e, t, s) => s > 32 ? hs(e, t, s) : ls(e, t, s);
|
|
828
|
+
function Us(e, t = 24) {
|
|
829
829
|
const s = new Uint32Array(10);
|
|
830
830
|
for (let n = 24 - t; n < 24; n++) {
|
|
831
831
|
for (let o = 0; o < 10; o++)
|
|
832
832
|
s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
|
|
833
833
|
for (let o = 0; o < 10; o += 2) {
|
|
834
|
-
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Ie(u, l, 1) ^ s[a], d =
|
|
835
|
-
for (let
|
|
836
|
-
e[o +
|
|
834
|
+
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Ie(u, l, 1) ^ s[a], d = Ce(u, l, 1) ^ s[a + 1];
|
|
835
|
+
for (let m = 0; m < 50; m += 10)
|
|
836
|
+
e[o + m] ^= w, e[o + m + 1] ^= d;
|
|
837
837
|
}
|
|
838
838
|
let r = e[2], i = e[3];
|
|
839
839
|
for (let o = 0; o < 24; o++) {
|
|
840
|
-
const a = at[o], c = Ie(r, i, a), u =
|
|
840
|
+
const a = at[o], c = Ie(r, i, a), u = Ce(r, i, a), l = it[o];
|
|
841
841
|
r = e[l], i = e[l + 1], e[l] = c, e[l + 1] = u;
|
|
842
842
|
}
|
|
843
843
|
for (let o = 0; o < 50; o += 10) {
|
|
@@ -846,7 +846,7 @@ function Cs(e, t = 24) {
|
|
|
846
846
|
for (let a = 0; a < 10; a++)
|
|
847
847
|
e[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
848
848
|
}
|
|
849
|
-
e[0] ^= Is[n], e[1] ^=
|
|
849
|
+
e[0] ^= Is[n], e[1] ^= Cs[n];
|
|
850
850
|
}
|
|
851
851
|
rt(s);
|
|
852
852
|
}
|
|
@@ -861,10 +861,10 @@ class ce extends Es {
|
|
|
861
861
|
return this._cloneInto();
|
|
862
862
|
}
|
|
863
863
|
keccak() {
|
|
864
|
-
Pe(this.state32),
|
|
864
|
+
Pe(this.state32), Us(this.state32, this.rounds), Pe(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
865
|
}
|
|
866
866
|
update(t) {
|
|
867
|
-
ve(this), t = ot(t),
|
|
867
|
+
ve(this), t = ot(t), L(t);
|
|
868
868
|
const { blockLen: s, state: n } = this, r = t.length;
|
|
869
869
|
for (let i = 0; i < r; ) {
|
|
870
870
|
const o = Math.min(s - this.pos, r - i);
|
|
@@ -882,7 +882,7 @@ class ce extends Es {
|
|
|
882
882
|
t[n] ^= s, (s & 128) !== 0 && n === r - 1 && this.keccak(), t[r - 1] ^= 128, this.keccak();
|
|
883
883
|
}
|
|
884
884
|
writeInto(t) {
|
|
885
|
-
ve(this, !1),
|
|
885
|
+
ve(this, !1), L(t), this.finish();
|
|
886
886
|
const s = this.state, { blockLen: n } = this;
|
|
887
887
|
for (let r = 0, i = t.length; r < i; ) {
|
|
888
888
|
this.posOut >= n && this.keccak();
|
|
@@ -915,9 +915,9 @@ class ce extends Es {
|
|
|
915
915
|
return t || (t = new ce(s, n, r, o, i)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = i, t.suffix = n, t.outputLen = r, t.enableXOF = o, t.destroyed = this.destroyed, t;
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
|
-
const
|
|
918
|
+
const xs = (e, t, s) => Ss(() => new ce(t, e, s)), ks = xs(1, 136, 256 / 8);
|
|
919
919
|
function Ds(e, t) {
|
|
920
|
-
return
|
|
920
|
+
return ks(ie(e, { strict: !1 }) ? rs(e) : e);
|
|
921
921
|
}
|
|
922
922
|
class Os extends v {
|
|
923
923
|
constructor({ address: t }) {
|
|
@@ -1050,7 +1050,7 @@ const Bs = {
|
|
|
1050
1050
|
decimals: 6,
|
|
1051
1051
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1052
1052
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1053
|
-
},
|
|
1053
|
+
}, Ue = {
|
|
1054
1054
|
ARBITRUM_MAINNET: {
|
|
1055
1055
|
...Fe,
|
|
1056
1056
|
tokens: {
|
|
@@ -1125,44 +1125,44 @@ const Bs = {
|
|
|
1125
1125
|
var ee = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(ee || {}), ht = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ht || {});
|
|
1126
1126
|
const Ws = (e) => {
|
|
1127
1127
|
const t = e?.trim().toUpperCase();
|
|
1128
|
-
if (
|
|
1129
|
-
return
|
|
1128
|
+
if (Ue[t])
|
|
1129
|
+
return Ue[t];
|
|
1130
1130
|
};
|
|
1131
1131
|
function Vs(e, t) {
|
|
1132
1132
|
return Ws(e)?.tokens[t]?.address;
|
|
1133
1133
|
}
|
|
1134
1134
|
var ue = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(ue || {});
|
|
1135
|
-
class
|
|
1135
|
+
class p {
|
|
1136
1136
|
constructor({ api_key: t, env: s, seesion_token: n }) {
|
|
1137
1137
|
this.api_key = t || "", this.sessionToken = n || "", this.env = s ?? ue.PRODUCTION;
|
|
1138
1138
|
}
|
|
1139
1139
|
static async config(t) {
|
|
1140
|
-
if (!
|
|
1140
|
+
if (!p.app) {
|
|
1141
1141
|
if (!t)
|
|
1142
1142
|
throw new Error("Please provide an api_key");
|
|
1143
|
-
|
|
1143
|
+
p.app = new p(t);
|
|
1144
1144
|
}
|
|
1145
|
-
return t && (t.api_key !== void 0 && (
|
|
1145
|
+
return t && (t.api_key !== void 0 && (p.app.api_key = t.api_key), t.seesion_token !== void 0 && (p.app.sessionToken = t.seesion_token), t.env !== void 0 && (p.app.env = t.env)), p.app;
|
|
1146
1146
|
}
|
|
1147
1147
|
static getApiKey() {
|
|
1148
|
-
if (!
|
|
1148
|
+
if (!p.app)
|
|
1149
1149
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1150
|
-
return
|
|
1150
|
+
return p.app.api_key;
|
|
1151
1151
|
}
|
|
1152
1152
|
static getSessionToken() {
|
|
1153
|
-
if (!
|
|
1153
|
+
if (!p.app)
|
|
1154
1154
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1155
|
-
return
|
|
1155
|
+
return p.app.sessionToken;
|
|
1156
1156
|
}
|
|
1157
1157
|
static getEnv() {
|
|
1158
|
-
if (!
|
|
1158
|
+
if (!p.app)
|
|
1159
1159
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1160
|
-
return
|
|
1160
|
+
return p.app.env === "internal" ? "staging" : p.app.env;
|
|
1161
1161
|
}
|
|
1162
1162
|
static getBaseUrl() {
|
|
1163
|
-
if (!
|
|
1163
|
+
if (!p.app)
|
|
1164
1164
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1165
|
-
switch (
|
|
1165
|
+
switch (p.app.env) {
|
|
1166
1166
|
case "production":
|
|
1167
1167
|
return "https://api.chainrails.io/api/v1";
|
|
1168
1168
|
case "staging":
|
|
@@ -1174,23 +1174,23 @@ class h {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
static getPayModalUrl(t) {
|
|
1177
|
-
if (!
|
|
1177
|
+
if (!p.app)
|
|
1178
1178
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1179
|
-
const s =
|
|
1179
|
+
const s = p.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = Number(t), r = t && !isNaN(Number(t)) && n > 0 ? "/pay/" : "/deposit/", i = `${t && !isNaN(Number(t)) && n > 0 ? n * 100 : ""}`;
|
|
1180
1180
|
return s + r + i;
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
1183
|
let te = null;
|
|
1184
1184
|
function Ys() {
|
|
1185
1185
|
te = Gt.create({
|
|
1186
|
-
prefixUrl:
|
|
1186
|
+
prefixUrl: p.getBaseUrl(),
|
|
1187
1187
|
headers: {
|
|
1188
1188
|
"Content-Type": "application/json"
|
|
1189
1189
|
},
|
|
1190
1190
|
hooks: {
|
|
1191
1191
|
beforeRequest: [
|
|
1192
1192
|
(e) => {
|
|
1193
|
-
const t =
|
|
1193
|
+
const t = p.getSessionToken() || p.getApiKey();
|
|
1194
1194
|
e.headers.set("Authorization", `Bearer ${t}`);
|
|
1195
1195
|
}
|
|
1196
1196
|
],
|
|
@@ -1201,83 +1201,83 @@ function Ys() {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1204
|
+
function g() {
|
|
1205
1205
|
return te || Ys(), te;
|
|
1206
1206
|
}
|
|
1207
1207
|
class Xs {
|
|
1208
1208
|
async getById(t) {
|
|
1209
|
-
return await
|
|
1209
|
+
return await g().get("intents/" + t).json();
|
|
1210
1210
|
}
|
|
1211
1211
|
async getForSender(t) {
|
|
1212
|
-
return await
|
|
1212
|
+
return await g().get("intents/user/" + t).json();
|
|
1213
1213
|
}
|
|
1214
1214
|
async getForAddress(t) {
|
|
1215
|
-
return await
|
|
1215
|
+
return await g().get("intents/address/" + t).json();
|
|
1216
1216
|
}
|
|
1217
1217
|
async getForSession(t) {
|
|
1218
|
-
return await
|
|
1218
|
+
return await g().get("modal/sessions/intents/" + t).json();
|
|
1219
1219
|
}
|
|
1220
1220
|
async getAll(t) {
|
|
1221
|
-
return await
|
|
1221
|
+
return await g().get("intents", { searchParams: t }).json();
|
|
1222
1222
|
}
|
|
1223
1223
|
async create(t) {
|
|
1224
|
-
return await
|
|
1224
|
+
return await g().post("intents", { json: t }).json();
|
|
1225
1225
|
}
|
|
1226
1226
|
async createForSession(t) {
|
|
1227
|
-
return await
|
|
1227
|
+
return await g().post("modal/sessions/intents", { json: t }).json();
|
|
1228
1228
|
}
|
|
1229
1229
|
async update(t, s) {
|
|
1230
|
-
return await
|
|
1230
|
+
return await g().post("intents", { json: s }).json();
|
|
1231
1231
|
}
|
|
1232
1232
|
async triggerProcessing(t) {
|
|
1233
|
-
return await
|
|
1233
|
+
return await g().post(`intents/${t}/trigger-processing`).json();
|
|
1234
1234
|
}
|
|
1235
1235
|
async triggerProcessingForSession(t) {
|
|
1236
|
-
return await
|
|
1236
|
+
return await g().post(`modal/sessions/intents/${t}/process`).json();
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
1239
|
class Js {
|
|
1240
1240
|
async getFromSpecificBridge(t) {
|
|
1241
|
-
return await
|
|
1241
|
+
return await g().get("quotes/single", { searchParams: t }).json();
|
|
1242
1242
|
}
|
|
1243
1243
|
async getFromAllBridges(t) {
|
|
1244
|
-
return await
|
|
1244
|
+
return await g().get("quotes/multiple", { searchParams: t }).json();
|
|
1245
1245
|
}
|
|
1246
1246
|
async getBestAcrossBridges(t) {
|
|
1247
|
-
return await
|
|
1247
|
+
return await g().get("quotes/best", { searchParams: t }).json();
|
|
1248
1248
|
}
|
|
1249
1249
|
async getAll(t) {
|
|
1250
|
-
return await
|
|
1250
|
+
return await g().get("quotes/multi-source", { searchParams: t }).json();
|
|
1251
1251
|
}
|
|
1252
1252
|
async getAllForSession(t) {
|
|
1253
|
-
return await
|
|
1253
|
+
return await g().get("modal/sessions/quotes", { searchParams: t }).json();
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
class Gs {
|
|
1257
1257
|
async getOptimalRoutes(t) {
|
|
1258
|
-
return await
|
|
1258
|
+
return await g().get("router/optimal-route", { searchParams: t }).json();
|
|
1259
1259
|
}
|
|
1260
1260
|
async getAllSupportedBridges() {
|
|
1261
|
-
return await
|
|
1261
|
+
return await g().get("router/supported-bridges/all").json();
|
|
1262
1262
|
}
|
|
1263
1263
|
async getSupportedBridges(t) {
|
|
1264
|
-
return await
|
|
1264
|
+
return await g().get("router/supported-bridges/route", { searchParams: t }).json();
|
|
1265
1265
|
}
|
|
1266
1266
|
async getSupportedRoutes(t, s) {
|
|
1267
|
-
return await
|
|
1267
|
+
return await g().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
class Zs {
|
|
1271
1271
|
async getSupported(t) {
|
|
1272
|
-
return await
|
|
1272
|
+
return await g().get("chains", { searchParams: t }).json();
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
1275
|
class Qs {
|
|
1276
1276
|
async getClientInfo() {
|
|
1277
|
-
return await
|
|
1277
|
+
return await g().get("client/auth/client-info").json();
|
|
1278
1278
|
}
|
|
1279
1279
|
async getClientInfoForSession() {
|
|
1280
|
-
return await
|
|
1280
|
+
return await g().get("modal/sessions/client").json();
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
1283
|
class en {
|
|
@@ -1291,7 +1291,7 @@ class en {
|
|
|
1291
1291
|
destinationChain: ee[t.destinationChain?.replace("_MAINNET", "")],
|
|
1292
1292
|
amount: t.amount
|
|
1293
1293
|
};
|
|
1294
|
-
return
|
|
1294
|
+
return g().post("modal/sessions", { json: s }).json().then((n) => ({ ...n, amount: s.amount }));
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
const vn = {
|
|
@@ -1319,48 +1319,52 @@ function Pn(e) {
|
|
|
1319
1319
|
const {
|
|
1320
1320
|
amount: t,
|
|
1321
1321
|
styles: s,
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1322
|
+
excludedChains: n,
|
|
1323
|
+
isOpen: r,
|
|
1324
|
+
isPending: i,
|
|
1325
|
+
open: o,
|
|
1326
|
+
close: a,
|
|
1327
|
+
onCancel: c,
|
|
1328
|
+
onSuccess: u,
|
|
1329
|
+
session_url: l,
|
|
1330
|
+
sessionToken: w
|
|
1331
|
+
} = e, [d, m] = C(0), [b, H] = C(""), f = re(null);
|
|
1332
|
+
p.config({
|
|
1332
1333
|
api_key: "",
|
|
1333
1334
|
// @ts-expect-error
|
|
1334
1335
|
env: e.env === "internal" ? "internal" : "production"
|
|
1335
|
-
}),
|
|
1336
|
-
|
|
1337
|
-
}, [t]),
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1336
|
+
}), x(() => {
|
|
1337
|
+
H(p.getPayModalUrl(t));
|
|
1338
|
+
}, [t]), x(() => {
|
|
1339
|
+
const h = document.body.style.overflow;
|
|
1340
|
+
r ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = h || "";
|
|
1341
|
+
const E = (P) => {
|
|
1342
|
+
P.data === "closed" && (a(), c?.()), P.data === "completed" && (window.setTimeout(a, 2e3), u?.());
|
|
1342
1343
|
};
|
|
1343
|
-
return window.addEventListener("message",
|
|
1344
|
-
document.body.style.overflow =
|
|
1344
|
+
return window.addEventListener("message", E), () => {
|
|
1345
|
+
document.body.style.overflow = h || "", window.removeEventListener("message", E);
|
|
1345
1346
|
};
|
|
1346
|
-
}, [
|
|
1347
|
-
if (!
|
|
1348
|
-
const
|
|
1347
|
+
}, [r, c, u]), x(() => {
|
|
1348
|
+
if (!w) return;
|
|
1349
|
+
const h = {
|
|
1349
1350
|
type: "session",
|
|
1350
|
-
session_token:
|
|
1351
|
-
environment:
|
|
1352
|
-
styles: s
|
|
1351
|
+
session_token: w,
|
|
1352
|
+
environment: p.getEnv() || ue.PRODUCTION,
|
|
1353
|
+
styles: s,
|
|
1354
|
+
props: {
|
|
1355
|
+
excludedChains: n?.join(",")
|
|
1356
|
+
}
|
|
1353
1357
|
};
|
|
1354
|
-
|
|
1355
|
-
|
|
1358
|
+
f.current?.contentWindow?.postMessage(h, "https://app.chainrails.io"), f.current?.contentWindow?.postMessage(h, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
|
|
1359
|
+
f.current?.contentWindow?.postMessage(h, "https://app.chainrails.io"), f.current?.contentWindow?.postMessage(h, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1356
1360
|
}, 1e3);
|
|
1357
|
-
}, [
|
|
1358
|
-
function
|
|
1359
|
-
|
|
1361
|
+
}, [w, d, r, s]);
|
|
1362
|
+
function y() {
|
|
1363
|
+
m(Math.random());
|
|
1360
1364
|
}
|
|
1361
1365
|
return /* @__PURE__ */ we("div", {
|
|
1362
|
-
className: tn("payment-modal-wrapper",
|
|
1363
|
-
children: [(
|
|
1366
|
+
className: tn("payment-modal-wrapper", d === 0 || i ? "loading" : "not-loading", r ? "open" : "closed"),
|
|
1367
|
+
children: [(d === 0 || i) && /* @__PURE__ */ M("div", {
|
|
1364
1368
|
role: "status",
|
|
1365
1369
|
className: "payment-modal-loader",
|
|
1366
1370
|
children: /* @__PURE__ */ we("svg", {
|
|
@@ -1369,27 +1373,27 @@ function Pn(e) {
|
|
|
1369
1373
|
viewBox: "0 0 100 101",
|
|
1370
1374
|
fill: "none",
|
|
1371
1375
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1372
|
-
children: [/* @__PURE__ */
|
|
1376
|
+
children: [/* @__PURE__ */ M("path", {
|
|
1373
1377
|
d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
|
|
1374
1378
|
fill: "currentColor"
|
|
1375
|
-
}), /* @__PURE__ */
|
|
1379
|
+
}), /* @__PURE__ */ M("path", {
|
|
1376
1380
|
d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
|
|
1377
1381
|
fill: "currentFill"
|
|
1378
1382
|
})]
|
|
1379
1383
|
})
|
|
1380
|
-
}), /* @__PURE__ */
|
|
1384
|
+
}), /* @__PURE__ */ M("iframe", {
|
|
1381
1385
|
allow: "clipboard-read *; clipboard-write *",
|
|
1382
|
-
src:
|
|
1383
|
-
onLoad:
|
|
1384
|
-
className: `payment-modal ${
|
|
1386
|
+
src: b || void 0,
|
|
1387
|
+
onLoad: y,
|
|
1388
|
+
className: `payment-modal ${d === 0 || i ? "invisible" : "visible"}`,
|
|
1385
1389
|
"data-id": t,
|
|
1386
|
-
ref:
|
|
1390
|
+
ref: f
|
|
1387
1391
|
}, t)]
|
|
1388
1392
|
});
|
|
1389
1393
|
}
|
|
1390
|
-
const sn = Symbol(), le = Symbol(), D = "a", pt = "f",
|
|
1394
|
+
const sn = Symbol(), le = Symbol(), D = "a", pt = "f", xe = "p", gt = "c", mt = "t", fe = "h", O = "w", he = "o", de = "k";
|
|
1391
1395
|
let nn = (e, t) => new Proxy(e, t);
|
|
1392
|
-
const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (ne.has(e) ? ne.get(e) : se(e) === Object.prototype || se(e) === Array.prototype),
|
|
1396
|
+
const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (ne.has(e) ? ne.get(e) : se(e) === Object.prototype || se(e) === Array.prototype), j = (e) => typeof e == "object" && e !== null, rn = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), on = (e) => {
|
|
1393
1397
|
if (Array.isArray(e))
|
|
1394
1398
|
return Array.from(e);
|
|
1395
1399
|
const t = Object.getOwnPropertyDescriptors(e);
|
|
@@ -1442,14 +1446,14 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1442
1446
|
}
|
|
1443
1447
|
const [i, o] = r;
|
|
1444
1448
|
let a = s && s.get(i);
|
|
1445
|
-
return (!a || a[1][pt] !== !!o) && (a = an(i, !!o), a[1][
|
|
1449
|
+
return (!a || a[1][pt] !== !!o) && (a = an(i, !!o), a[1][xe] = nn(o || i, a[0]), s && s.set(i, a)), a[1][D] = t, a[1][gt] = s, a[1][mt] = n, a[1][xe];
|
|
1446
1450
|
}, cn = (e, t) => {
|
|
1447
1451
|
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1448
1452
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
1449
1453
|
}, bt = (e, t, s, n, r = Object.is) => {
|
|
1450
1454
|
if (r(e, t))
|
|
1451
1455
|
return !1;
|
|
1452
|
-
if (!
|
|
1456
|
+
if (!j(e) || !j(t))
|
|
1453
1457
|
return !0;
|
|
1454
1458
|
const i = s.get(pe(e));
|
|
1455
1459
|
if (!i)
|
|
@@ -1478,26 +1482,26 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1478
1482
|
if (o === null)
|
|
1479
1483
|
throw new Error("invalid used");
|
|
1480
1484
|
return o;
|
|
1481
|
-
}, un = (e) => yt(e) && e[le] || null,
|
|
1485
|
+
}, un = (e) => yt(e) && e[le] || null, ke = (e, t = !0) => {
|
|
1482
1486
|
ne.set(e, t);
|
|
1483
1487
|
}, ln = (e, t, s) => {
|
|
1484
1488
|
const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
1485
1489
|
var c, u, l;
|
|
1486
1490
|
if (r.has(o))
|
|
1487
1491
|
return;
|
|
1488
|
-
|
|
1489
|
-
const w =
|
|
1492
|
+
j(o) && r.add(o);
|
|
1493
|
+
const w = j(o) && t.get(pe(o));
|
|
1490
1494
|
if (w) {
|
|
1491
1495
|
if ((c = w[fe]) === null || c === void 0 || c.forEach((d) => {
|
|
1492
|
-
const
|
|
1493
|
-
n.push(a ? [...a,
|
|
1496
|
+
const m = `:has(${String(d)})`;
|
|
1497
|
+
n.push(a ? [...a, m] : [m]);
|
|
1494
1498
|
}), w[O] === !0) {
|
|
1495
1499
|
const d = ":ownKeys";
|
|
1496
1500
|
n.push(a ? [...a, d] : [d]);
|
|
1497
1501
|
} else
|
|
1498
1502
|
(u = w[he]) === null || u === void 0 || u.forEach((d) => {
|
|
1499
|
-
const
|
|
1500
|
-
n.push(a ? [...a,
|
|
1503
|
+
const m = `:hasOwn(${String(d)})`;
|
|
1504
|
+
n.push(a ? [...a, m] : [m]);
|
|
1501
1505
|
});
|
|
1502
1506
|
(l = w[de]) === null || l === void 0 || l.forEach((d) => {
|
|
1503
1507
|
"value" in (Object.getOwnPropertyDescriptor(o, d) || {}) && i(o[d], a ? [...a, d] : [d]);
|
|
@@ -1505,12 +1509,12 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1505
1509
|
} else a && n.push(a);
|
|
1506
1510
|
};
|
|
1507
1511
|
return i(e), n;
|
|
1508
|
-
},
|
|
1512
|
+
}, _ = {}, ge = (e) => typeof e == "object" && e !== null, fn = (e) => ge(e) && !me.has(e) && (Array.isArray(e) || !(Symbol.iterator in e)) && !(e instanceof WeakMap) && !(e instanceof WeakSet) && !(e instanceof Error) && !(e instanceof Number) && !(e instanceof Date) && !(e instanceof String) && !(e instanceof RegExp) && !(e instanceof ArrayBuffer) && !(e instanceof Promise), Et = (e, t) => {
|
|
1509
1513
|
const s = De.get(e);
|
|
1510
1514
|
if (s?.[0] === t)
|
|
1511
1515
|
return s[1];
|
|
1512
1516
|
const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1513
|
-
return
|
|
1517
|
+
return ke(n, !0), De.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
|
|
1514
1518
|
if (Object.getOwnPropertyDescriptor(n, r))
|
|
1515
1519
|
return;
|
|
1516
1520
|
const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
|
|
@@ -1524,9 +1528,9 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1524
1528
|
configurable: !0
|
|
1525
1529
|
};
|
|
1526
1530
|
if (me.has(i))
|
|
1527
|
-
|
|
1528
|
-
else if (
|
|
1529
|
-
const [c, u] =
|
|
1531
|
+
ke(i, !1);
|
|
1532
|
+
else if (U.has(i)) {
|
|
1533
|
+
const [c, u] = U.get(
|
|
1530
1534
|
i
|
|
1531
1535
|
);
|
|
1532
1536
|
a.value = Et(c, u());
|
|
@@ -1542,76 +1546,76 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1542
1546
|
},
|
|
1543
1547
|
set(r, i, o, a) {
|
|
1544
1548
|
const c = !e() && Reflect.has(r, i), u = Reflect.get(r, i, a);
|
|
1545
|
-
if (c && (Oe(u, o) ||
|
|
1549
|
+
if (c && (Oe(u, o) || q.has(o) && Oe(u, q.get(o))))
|
|
1546
1550
|
return !0;
|
|
1547
1551
|
s(i), ge(o) && (o = un(o) || o);
|
|
1548
|
-
const l = !
|
|
1552
|
+
const l = !U.has(o) && pn(o) ? St(o) : o;
|
|
1549
1553
|
return t(i, l), Reflect.set(r, i, l, a), n(["set", [i], o, u]), !0;
|
|
1550
1554
|
}
|
|
1551
|
-
}),
|
|
1555
|
+
}), U = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), De = /* @__PURE__ */ new WeakMap(), J = [1], q = /* @__PURE__ */ new WeakMap();
|
|
1552
1556
|
let Oe = Object.is, dn = (e, t) => new Proxy(e, t), pn = fn, gn = Et, mn = hn;
|
|
1553
1557
|
function St(e = {}) {
|
|
1554
1558
|
if (!ge(e))
|
|
1555
1559
|
throw new Error("object required");
|
|
1556
|
-
const t =
|
|
1560
|
+
const t = q.get(e);
|
|
1557
1561
|
if (t)
|
|
1558
1562
|
return t;
|
|
1559
1563
|
let s = J[0];
|
|
1560
|
-
const n = /* @__PURE__ */ new Set(), r = (
|
|
1561
|
-
s !==
|
|
1564
|
+
const n = /* @__PURE__ */ new Set(), r = (f, y = ++J[0]) => {
|
|
1565
|
+
s !== y && (i = s = y, n.forEach((h) => h(f, y)));
|
|
1562
1566
|
};
|
|
1563
1567
|
let i = s;
|
|
1564
|
-
const o = (
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
})), s), a = (
|
|
1568
|
-
const E = [...
|
|
1569
|
-
E[1] = [
|
|
1570
|
-
}, c = /* @__PURE__ */ new Map(), u = (
|
|
1571
|
-
const
|
|
1572
|
-
if (
|
|
1573
|
-
if ((
|
|
1568
|
+
const o = (f = J[0]) => (i !== f && (i = f, c.forEach(([y]) => {
|
|
1569
|
+
const h = y[1](f);
|
|
1570
|
+
h > s && (s = h);
|
|
1571
|
+
})), s), a = (f) => (y, h) => {
|
|
1572
|
+
const E = [...y];
|
|
1573
|
+
E[1] = [f, ...E[1]], r(E, h);
|
|
1574
|
+
}, c = /* @__PURE__ */ new Map(), u = (f, y) => {
|
|
1575
|
+
const h = !me.has(y) && U.get(y);
|
|
1576
|
+
if (h) {
|
|
1577
|
+
if ((_ ? "production" : void 0) !== "production" && c.has(f))
|
|
1574
1578
|
throw new Error("prop listener already exists");
|
|
1575
1579
|
if (n.size) {
|
|
1576
|
-
const E =
|
|
1577
|
-
c.set(
|
|
1580
|
+
const E = h[2](a(f));
|
|
1581
|
+
c.set(f, [h, E]);
|
|
1578
1582
|
} else
|
|
1579
|
-
c.set(
|
|
1583
|
+
c.set(f, [h]);
|
|
1580
1584
|
}
|
|
1581
|
-
}, l = (
|
|
1582
|
-
var
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
}, w = (
|
|
1586
|
-
if ((
|
|
1585
|
+
}, l = (f) => {
|
|
1586
|
+
var y;
|
|
1587
|
+
const h = c.get(f);
|
|
1588
|
+
h && (c.delete(f), (y = h[1]) == null || y.call(h));
|
|
1589
|
+
}, w = (f) => (n.add(f), n.size === 1 && c.forEach(([h, E], P) => {
|
|
1590
|
+
if ((_ ? "production" : void 0) !== "production" && E)
|
|
1587
1591
|
throw new Error("remove already exists");
|
|
1588
|
-
const Tt =
|
|
1589
|
-
c.set(
|
|
1592
|
+
const Tt = h[2](a(P));
|
|
1593
|
+
c.set(P, [h, Tt]);
|
|
1590
1594
|
}), () => {
|
|
1591
|
-
n.delete(
|
|
1592
|
-
E && (E(), c.set(
|
|
1595
|
+
n.delete(f), n.size === 0 && c.forEach(([h, E], P) => {
|
|
1596
|
+
E && (E(), c.set(P, [h]));
|
|
1593
1597
|
});
|
|
1594
1598
|
});
|
|
1595
1599
|
let d = !0;
|
|
1596
|
-
const
|
|
1600
|
+
const m = mn(
|
|
1597
1601
|
() => d,
|
|
1598
1602
|
u,
|
|
1599
1603
|
l,
|
|
1600
1604
|
r
|
|
1601
|
-
), b = dn(e,
|
|
1602
|
-
|
|
1603
|
-
const
|
|
1604
|
-
return
|
|
1605
|
-
const
|
|
1605
|
+
), b = dn(e, m);
|
|
1606
|
+
q.set(e, b);
|
|
1607
|
+
const H = [e, o, w];
|
|
1608
|
+
return U.set(b, H), Reflect.ownKeys(e).forEach((f) => {
|
|
1609
|
+
const y = Object.getOwnPropertyDescriptor(
|
|
1606
1610
|
e,
|
|
1607
|
-
|
|
1611
|
+
f
|
|
1608
1612
|
);
|
|
1609
|
-
"value" in
|
|
1613
|
+
"value" in y && y.writable && (b[f] = e[f]);
|
|
1610
1614
|
}), d = !1, b;
|
|
1611
1615
|
}
|
|
1612
1616
|
function yn(e, t, s) {
|
|
1613
|
-
const n =
|
|
1614
|
-
(
|
|
1617
|
+
const n = U.get(e);
|
|
1618
|
+
(_ ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1615
1619
|
let r;
|
|
1616
1620
|
const i = [], o = n[2];
|
|
1617
1621
|
let a = !1;
|
|
@@ -1625,14 +1629,14 @@ function yn(e, t, s) {
|
|
|
1625
1629
|
};
|
|
1626
1630
|
}
|
|
1627
1631
|
function Ne(e) {
|
|
1628
|
-
const t =
|
|
1629
|
-
(
|
|
1632
|
+
const t = U.get(e);
|
|
1633
|
+
(_ ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1630
1634
|
const [s, n] = t;
|
|
1631
1635
|
return gn(s, n());
|
|
1632
1636
|
}
|
|
1633
1637
|
const wn = {}, bn = (e, t) => {
|
|
1634
1638
|
const s = re(void 0);
|
|
1635
|
-
|
|
1639
|
+
x(() => {
|
|
1636
1640
|
s.current = ln(e, t);
|
|
1637
1641
|
}), Pt(s.current);
|
|
1638
1642
|
}, En = bn, Sn = /* @__PURE__ */ new WeakMap();
|
|
@@ -1682,7 +1686,7 @@ function In({
|
|
|
1682
1686
|
onCancel: t,
|
|
1683
1687
|
onSuccess: s
|
|
1684
1688
|
}) {
|
|
1685
|
-
const n = Tn(A), [r, i] =
|
|
1689
|
+
const n = Tn(A), [r, i] = C(!1), [o, a] = C(Date.now()), c = n?.data?.sessionToken, u = n?.data?.amount;
|
|
1686
1690
|
function l() {
|
|
1687
1691
|
c || window.setTimeout(() => {
|
|
1688
1692
|
c && i(!0);
|
|
@@ -1692,18 +1696,18 @@ function In({
|
|
|
1692
1696
|
i(!1);
|
|
1693
1697
|
}
|
|
1694
1698
|
const d = () => {
|
|
1695
|
-
const
|
|
1699
|
+
const m = Date.now();
|
|
1696
1700
|
A.isPending = !0, A.error = null, A.data = null, fetch(e, {
|
|
1697
1701
|
headers: {
|
|
1698
1702
|
"Content-Type": "application/json"
|
|
1699
1703
|
}
|
|
1700
1704
|
}).then((b) => b.json()).then((b) => {
|
|
1701
|
-
|
|
1705
|
+
m < o || (A.data = b, A.isPending = !1, a(m));
|
|
1702
1706
|
}).catch((b) => {
|
|
1703
|
-
|
|
1707
|
+
m < o || (A.error = b?.toString(), A.isPending = !1, a(m), setInterval(d, 5e3));
|
|
1704
1708
|
});
|
|
1705
1709
|
};
|
|
1706
|
-
return
|
|
1710
|
+
return x(() => {
|
|
1707
1711
|
d();
|
|
1708
1712
|
}, [e]), {
|
|
1709
1713
|
sessionToken: c,
|
|
@@ -1719,20 +1723,20 @@ function In({
|
|
|
1719
1723
|
onCancel: t
|
|
1720
1724
|
};
|
|
1721
1725
|
}
|
|
1722
|
-
function
|
|
1726
|
+
function Cn({
|
|
1723
1727
|
sessionToken: e,
|
|
1724
1728
|
amount: t,
|
|
1725
1729
|
onCancel: s,
|
|
1726
1730
|
onSuccess: n
|
|
1727
1731
|
}) {
|
|
1728
|
-
const [r, i] =
|
|
1732
|
+
const [r, i] = C(!1), [o, a] = C(e), [c, u] = C(t);
|
|
1729
1733
|
function l({
|
|
1730
|
-
sessionToken:
|
|
1734
|
+
sessionToken: m,
|
|
1731
1735
|
amount: b
|
|
1732
1736
|
}) {
|
|
1733
|
-
a(
|
|
1737
|
+
a(m), u(b);
|
|
1734
1738
|
}
|
|
1735
|
-
|
|
1739
|
+
x(() => {
|
|
1736
1740
|
a(e);
|
|
1737
1741
|
}, [e]);
|
|
1738
1742
|
function w() {
|
|
@@ -1755,11 +1759,11 @@ function Un({
|
|
|
1755
1759
|
};
|
|
1756
1760
|
}
|
|
1757
1761
|
export {
|
|
1758
|
-
|
|
1762
|
+
p as Chainrails,
|
|
1759
1763
|
Pn as PaymentModal,
|
|
1760
1764
|
ee as chains,
|
|
1761
1765
|
vn as crapi,
|
|
1762
1766
|
ht as tokens,
|
|
1763
|
-
|
|
1767
|
+
Cn as usePaymentModal,
|
|
1764
1768
|
In as usePaymentSession
|
|
1765
1769
|
};
|