@chainrails/react 0.1.2 → 0.1.3
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/chainrails-sdk.es.js +24 -24
- package/dist/chainrails-sdk.es.mjs +24 -24
- package/dist/chainrails-sdk.umd.js +1 -1
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@ const we = (() => {
|
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
52
|
return e && !t;
|
|
53
|
-
})(), Ut = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function",
|
|
53
|
+
})(), Ut = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", _e = ["get", "post", "put", "patch", "head", "delete"], kt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -59,7 +59,7 @@ const we = (() => {
|
|
|
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
|
-
}, H = 2147483647, Ot = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,
|
|
62
|
+
}, H = 2147483647, Ot = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, $e = Symbol("stop");
|
|
63
63
|
class Le {
|
|
64
64
|
options;
|
|
65
65
|
constructor(t) {
|
|
@@ -98,7 +98,7 @@ const Dt = (e) => new Le(e), Nt = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
101
|
+
}, _t = (e) => {
|
|
102
102
|
if (!e)
|
|
103
103
|
return 0;
|
|
104
104
|
if (e instanceof FormData) {
|
|
@@ -140,7 +140,7 @@ const Dt = (e) => new Le(e), Nt = {
|
|
|
140
140
|
n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(t, r), transferredBytes: r }, n));
|
|
141
141
|
}
|
|
142
142
|
}));
|
|
143
|
-
},
|
|
143
|
+
}, $t = (e, t) => {
|
|
144
144
|
if (!e.body)
|
|
145
145
|
return e;
|
|
146
146
|
if (e.status === 204)
|
|
@@ -158,7 +158,7 @@ const Dt = (e) => new Le(e), Nt = {
|
|
|
158
158
|
}, Lt = (e, t, s) => {
|
|
159
159
|
if (!e.body)
|
|
160
160
|
return e;
|
|
161
|
-
const n =
|
|
161
|
+
const n = _t(s ?? e.body);
|
|
162
162
|
return new Request(e, {
|
|
163
163
|
// @ts-expect-error - Types are outdated.
|
|
164
164
|
duplex: "half",
|
|
@@ -235,7 +235,7 @@ const qe = (e = {}, t = {}) => ({
|
|
|
235
235
|
P(o.hooks) && (n = qe(n, o.hooks), t.hooks = n), P(o.headers) && (s = je(s, o.headers), t.headers = s);
|
|
236
236
|
}
|
|
237
237
|
return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] : Be ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
|
|
238
|
-
}, jt = (e) =>
|
|
238
|
+
}, jt = (e) => _e.includes(e) ? e.toUpperCase() : e, qt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], Ht = [413, 429, 503], be = {
|
|
239
239
|
limit: 2,
|
|
240
240
|
methods: qt,
|
|
241
241
|
statusCodes: Ft,
|
|
@@ -325,7 +325,7 @@ class O {
|
|
|
325
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
326
326
|
if (!Ct)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
|
-
return
|
|
328
|
+
return $t(o.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
330
330
|
return o;
|
|
331
331
|
}, i = n.#f(r).finally(async () => {
|
|
@@ -463,7 +463,7 @@ class O {
|
|
|
463
463
|
}
|
|
464
464
|
if (i instanceof globalThis.Response)
|
|
465
465
|
return i;
|
|
466
|
-
if (i ===
|
|
466
|
+
if (i === $e)
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
return this.#f(t);
|
|
@@ -500,9 +500,9 @@ class O {
|
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const G = (e) => {
|
|
502
502
|
const t = (s, n) => O.create(s, N(e, n));
|
|
503
|
-
for (const s of
|
|
503
|
+
for (const s of _e)
|
|
504
504
|
t[s] = (n, r) => O.create(n, N(e, r, { method: s }));
|
|
505
|
-
return t.create = (s) => G(N(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), G(N(e, s))), t.stop =
|
|
505
|
+
return t.create = (s) => G(N(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), G(N(e, s))), t.stop = $e, t.retry = Dt, t;
|
|
506
506
|
}, Zt = G();
|
|
507
507
|
var E = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(E || {});
|
|
508
508
|
const Fe = {
|
|
@@ -767,7 +767,7 @@ function Te(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 _(e, ...t) {
|
|
771
771
|
if (!ps(e))
|
|
772
772
|
throw new Error("Uint8Array expected");
|
|
773
773
|
if (t.length > 0 && !t.includes(e.length))
|
|
@@ -780,7 +780,7 @@ function Ae(e, t = !0) {
|
|
|
780
780
|
throw new Error("Hash#digest() has already been called");
|
|
781
781
|
}
|
|
782
782
|
function gs(e, t) {
|
|
783
|
-
|
|
783
|
+
_(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 Es(e) {
|
|
|
808
808
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
809
809
|
}
|
|
810
810
|
function ot(e) {
|
|
811
|
-
return typeof e == "string" && (e = Es(e)),
|
|
811
|
+
return typeof e == "string" && (e = Es(e)), _(e), e;
|
|
812
812
|
}
|
|
813
813
|
class Ss {
|
|
814
814
|
}
|
|
@@ -864,7 +864,7 @@ class ae extends Ss {
|
|
|
864
864
|
ve(this.state32), xs(this.state32, this.rounds), ve(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
865
|
}
|
|
866
866
|
update(t) {
|
|
867
|
-
Ae(this), t = ot(t),
|
|
867
|
+
Ae(this), t = ot(t), _(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 ae extends Ss {
|
|
|
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
|
-
Ae(this, !1),
|
|
885
|
+
Ae(this, !1), _(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();
|
|
@@ -974,7 +974,7 @@ function Bs(e, t) {
|
|
|
974
974
|
const r = Ms.test(e) ? e.toLowerCase() === e ? !0 : s ? ft(e) === e : !0 : !1;
|
|
975
975
|
return V.set(n, r), r;
|
|
976
976
|
}
|
|
977
|
-
const
|
|
977
|
+
const _s = {
|
|
978
978
|
chainId: He.chainId,
|
|
979
979
|
address: R("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
980
980
|
symbol: "USDC",
|
|
@@ -982,7 +982,7 @@ const $s = {
|
|
|
982
982
|
decimals: 6,
|
|
983
983
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
984
984
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
985
|
-
},
|
|
985
|
+
}, $s = {
|
|
986
986
|
chainId: Fe.chainId,
|
|
987
987
|
address: R("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
988
988
|
symbol: "USDC",
|
|
@@ -1054,7 +1054,7 @@ const $s = {
|
|
|
1054
1054
|
ARBITRUM_MAINNET: {
|
|
1055
1055
|
...Fe,
|
|
1056
1056
|
tokens: {
|
|
1057
|
-
[E.USDC]:
|
|
1057
|
+
[E.USDC]: $s
|
|
1058
1058
|
},
|
|
1059
1059
|
explorer: "https://arbiscan.io"
|
|
1060
1060
|
},
|
|
@@ -1062,7 +1062,7 @@ const $s = {
|
|
|
1062
1062
|
...He,
|
|
1063
1063
|
explorer: "https://sepolia.arbiscan.io",
|
|
1064
1064
|
tokens: {
|
|
1065
|
-
[E.USDC]:
|
|
1065
|
+
[E.USDC]: _s
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
1068
|
AVALANCHE_MAINNET: {
|
|
@@ -1383,7 +1383,7 @@ function nn(e) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
const rn = Symbol(), ue = Symbol(), x = "a", pt = "f", Ce = "p", gt = "c", mt = "t", le = "h", k = "w", fe = "o", he = "k";
|
|
1385
1385
|
let on = (e, t) => new Proxy(e, t);
|
|
1386
|
-
const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (te.has(e) ? te.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype),
|
|
1386
|
+
const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (te.has(e) ? te.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype), $ = (e) => typeof e == "object" && e !== null, an = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), cn = (e) => {
|
|
1387
1387
|
if (Array.isArray(e))
|
|
1388
1388
|
return Array.from(e);
|
|
1389
1389
|
const t = Object.getOwnPropertyDescriptors(e);
|
|
@@ -1443,7 +1443,7 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1443
1443
|
}, bt = (e, t, s, n, r = Object.is) => {
|
|
1444
1444
|
if (r(e, t))
|
|
1445
1445
|
return !1;
|
|
1446
|
-
if (
|
|
1446
|
+
if (!$(e) || !$(t))
|
|
1447
1447
|
return !0;
|
|
1448
1448
|
const i = s.get(de(e));
|
|
1449
1449
|
if (!i)
|
|
@@ -1479,8 +1479,8 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1479
1479
|
var c, u, l;
|
|
1480
1480
|
if (r.has(o))
|
|
1481
1481
|
return;
|
|
1482
|
-
|
|
1483
|
-
const w =
|
|
1482
|
+
$(o) && r.add(o);
|
|
1483
|
+
const w = $(o) && t.get(de(o));
|
|
1484
1484
|
if (w) {
|
|
1485
1485
|
if ((c = w[le]) === null || c === void 0 || c.forEach((d) => {
|
|
1486
1486
|
const y = `:has(${String(d)})`;
|
|
@@ -1694,7 +1694,7 @@ function Cn({
|
|
|
1694
1694
|
"Content-Type": "application/json"
|
|
1695
1695
|
},
|
|
1696
1696
|
body: JSON.stringify({
|
|
1697
|
-
destinationChain: t,
|
|
1697
|
+
destinationChain: t?.replace("_MAINNET", ""),
|
|
1698
1698
|
token: s,
|
|
1699
1699
|
amount: n ? nn(n) : "0",
|
|
1700
1700
|
recipient: r
|
|
@@ -50,7 +50,7 @@ const we = (() => {
|
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
52
|
return e && !t;
|
|
53
|
-
})(), Ut = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function",
|
|
53
|
+
})(), Ut = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", _e = ["get", "post", "put", "patch", "head", "delete"], kt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -59,7 +59,7 @@ const we = (() => {
|
|
|
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
|
-
}, H = 2147483647, Ot = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,
|
|
62
|
+
}, H = 2147483647, Ot = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, $e = Symbol("stop");
|
|
63
63
|
class Le {
|
|
64
64
|
options;
|
|
65
65
|
constructor(t) {
|
|
@@ -98,7 +98,7 @@ const Dt = (e) => new Le(e), Nt = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
101
|
+
}, _t = (e) => {
|
|
102
102
|
if (!e)
|
|
103
103
|
return 0;
|
|
104
104
|
if (e instanceof FormData) {
|
|
@@ -140,7 +140,7 @@ const Dt = (e) => new Le(e), Nt = {
|
|
|
140
140
|
n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(t, r), transferredBytes: r }, n));
|
|
141
141
|
}
|
|
142
142
|
}));
|
|
143
|
-
},
|
|
143
|
+
}, $t = (e, t) => {
|
|
144
144
|
if (!e.body)
|
|
145
145
|
return e;
|
|
146
146
|
if (e.status === 204)
|
|
@@ -158,7 +158,7 @@ const Dt = (e) => new Le(e), Nt = {
|
|
|
158
158
|
}, Lt = (e, t, s) => {
|
|
159
159
|
if (!e.body)
|
|
160
160
|
return e;
|
|
161
|
-
const n =
|
|
161
|
+
const n = _t(s ?? e.body);
|
|
162
162
|
return new Request(e, {
|
|
163
163
|
// @ts-expect-error - Types are outdated.
|
|
164
164
|
duplex: "half",
|
|
@@ -235,7 +235,7 @@ const qe = (e = {}, t = {}) => ({
|
|
|
235
235
|
P(o.hooks) && (n = qe(n, o.hooks), t.hooks = n), P(o.headers) && (s = je(s, o.headers), t.headers = s);
|
|
236
236
|
}
|
|
237
237
|
return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] : Be ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
|
|
238
|
-
}, jt = (e) =>
|
|
238
|
+
}, jt = (e) => _e.includes(e) ? e.toUpperCase() : e, qt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], Ht = [413, 429, 503], be = {
|
|
239
239
|
limit: 2,
|
|
240
240
|
methods: qt,
|
|
241
241
|
statusCodes: Ft,
|
|
@@ -325,7 +325,7 @@ class O {
|
|
|
325
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
326
326
|
if (!Ct)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
|
-
return
|
|
328
|
+
return $t(o.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
330
330
|
return o;
|
|
331
331
|
}, i = n.#f(r).finally(async () => {
|
|
@@ -463,7 +463,7 @@ class O {
|
|
|
463
463
|
}
|
|
464
464
|
if (i instanceof globalThis.Response)
|
|
465
465
|
return i;
|
|
466
|
-
if (i ===
|
|
466
|
+
if (i === $e)
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
return this.#f(t);
|
|
@@ -500,9 +500,9 @@ class O {
|
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const G = (e) => {
|
|
502
502
|
const t = (s, n) => O.create(s, N(e, n));
|
|
503
|
-
for (const s of
|
|
503
|
+
for (const s of _e)
|
|
504
504
|
t[s] = (n, r) => O.create(n, N(e, r, { method: s }));
|
|
505
|
-
return t.create = (s) => G(N(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), G(N(e, s))), t.stop =
|
|
505
|
+
return t.create = (s) => G(N(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), G(N(e, s))), t.stop = $e, t.retry = Dt, t;
|
|
506
506
|
}, Zt = G();
|
|
507
507
|
var E = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(E || {});
|
|
508
508
|
const Fe = {
|
|
@@ -767,7 +767,7 @@ function Te(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 _(e, ...t) {
|
|
771
771
|
if (!ps(e))
|
|
772
772
|
throw new Error("Uint8Array expected");
|
|
773
773
|
if (t.length > 0 && !t.includes(e.length))
|
|
@@ -780,7 +780,7 @@ function Ae(e, t = !0) {
|
|
|
780
780
|
throw new Error("Hash#digest() has already been called");
|
|
781
781
|
}
|
|
782
782
|
function gs(e, t) {
|
|
783
|
-
|
|
783
|
+
_(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 Es(e) {
|
|
|
808
808
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
809
809
|
}
|
|
810
810
|
function ot(e) {
|
|
811
|
-
return typeof e == "string" && (e = Es(e)),
|
|
811
|
+
return typeof e == "string" && (e = Es(e)), _(e), e;
|
|
812
812
|
}
|
|
813
813
|
class Ss {
|
|
814
814
|
}
|
|
@@ -864,7 +864,7 @@ class ae extends Ss {
|
|
|
864
864
|
ve(this.state32), xs(this.state32, this.rounds), ve(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
865
|
}
|
|
866
866
|
update(t) {
|
|
867
|
-
Ae(this), t = ot(t),
|
|
867
|
+
Ae(this), t = ot(t), _(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 ae extends Ss {
|
|
|
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
|
-
Ae(this, !1),
|
|
885
|
+
Ae(this, !1), _(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();
|
|
@@ -974,7 +974,7 @@ function Bs(e, t) {
|
|
|
974
974
|
const r = Ms.test(e) ? e.toLowerCase() === e ? !0 : s ? ft(e) === e : !0 : !1;
|
|
975
975
|
return V.set(n, r), r;
|
|
976
976
|
}
|
|
977
|
-
const
|
|
977
|
+
const _s = {
|
|
978
978
|
chainId: He.chainId,
|
|
979
979
|
address: R("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
980
980
|
symbol: "USDC",
|
|
@@ -982,7 +982,7 @@ const $s = {
|
|
|
982
982
|
decimals: 6,
|
|
983
983
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
984
984
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
985
|
-
},
|
|
985
|
+
}, $s = {
|
|
986
986
|
chainId: Fe.chainId,
|
|
987
987
|
address: R("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
988
988
|
symbol: "USDC",
|
|
@@ -1054,7 +1054,7 @@ const $s = {
|
|
|
1054
1054
|
ARBITRUM_MAINNET: {
|
|
1055
1055
|
...Fe,
|
|
1056
1056
|
tokens: {
|
|
1057
|
-
[E.USDC]:
|
|
1057
|
+
[E.USDC]: $s
|
|
1058
1058
|
},
|
|
1059
1059
|
explorer: "https://arbiscan.io"
|
|
1060
1060
|
},
|
|
@@ -1062,7 +1062,7 @@ const $s = {
|
|
|
1062
1062
|
...He,
|
|
1063
1063
|
explorer: "https://sepolia.arbiscan.io",
|
|
1064
1064
|
tokens: {
|
|
1065
|
-
[E.USDC]:
|
|
1065
|
+
[E.USDC]: _s
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
1068
|
AVALANCHE_MAINNET: {
|
|
@@ -1383,7 +1383,7 @@ function nn(e) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
const rn = Symbol(), ue = Symbol(), x = "a", pt = "f", Ce = "p", gt = "c", mt = "t", le = "h", k = "w", fe = "o", he = "k";
|
|
1385
1385
|
let on = (e, t) => new Proxy(e, t);
|
|
1386
|
-
const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (te.has(e) ? te.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype),
|
|
1386
|
+
const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (te.has(e) ? te.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype), $ = (e) => typeof e == "object" && e !== null, an = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), cn = (e) => {
|
|
1387
1387
|
if (Array.isArray(e))
|
|
1388
1388
|
return Array.from(e);
|
|
1389
1389
|
const t = Object.getOwnPropertyDescriptors(e);
|
|
@@ -1443,7 +1443,7 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1443
1443
|
}, bt = (e, t, s, n, r = Object.is) => {
|
|
1444
1444
|
if (r(e, t))
|
|
1445
1445
|
return !1;
|
|
1446
|
-
if (
|
|
1446
|
+
if (!$(e) || !$(t))
|
|
1447
1447
|
return !0;
|
|
1448
1448
|
const i = s.get(de(e));
|
|
1449
1449
|
if (!i)
|
|
@@ -1479,8 +1479,8 @@ const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1479
1479
|
var c, u, l;
|
|
1480
1480
|
if (r.has(o))
|
|
1481
1481
|
return;
|
|
1482
|
-
|
|
1483
|
-
const w =
|
|
1482
|
+
$(o) && r.add(o);
|
|
1483
|
+
const w = $(o) && t.get(de(o));
|
|
1484
1484
|
if (w) {
|
|
1485
1485
|
if ((c = w[le]) === null || c === void 0 || c.forEach((d) => {
|
|
1486
1486
|
const y = `:has(${String(d)})`;
|
|
@@ -1694,7 +1694,7 @@ function Cn({
|
|
|
1694
1694
|
"Content-Type": "application/json"
|
|
1695
1695
|
},
|
|
1696
1696
|
body: JSON.stringify({
|
|
1697
|
-
destinationChain: t,
|
|
1697
|
+
destinationChain: t?.replace("_MAINNET", ""),
|
|
1698
1698
|
token: s,
|
|
1699
1699
|
amount: n ? nn(n) : "0",
|
|
1700
1700
|
recipient: r
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function(S,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime"],w):(S=typeof globalThis<"u"?globalThis:S||self,w(S.Chainrails={},S.React,S.jsxRuntime))})(this,(function(S,w,v){"use strict";var ye=document.createElement("style");ye.textContent=`.payment-modal-wrapper{position:fixed;inset:0;z-index:10000;height:100dvh;width:100vw;transition:all .1s ease-in-out}.payment-modal-wrapper.loading{background-color:#0003;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.payment-modal-wrapper.not-loading{background-color:#0008;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.payment-modal-wrapper.open{visibility:visible}.payment-modal-wrapper.closed{visibility:hidden;opacity:0;pointer-events:none}.payment-modal-wrapper.closed *{pointer-events:none!important}.payment-modal-wrapper.open iframe{transform:translateY(0);transform:scale(1)}.payment-modal-wrapper.closed iframe{transform:translateY(50vh);transform:scale(1)}.payment-modal-loader{position:absolute;inset:0;z-index:10000;display:grid;height:100%;width:100%;place-content:center}.payment-modal-loader .icon{height:48px;width:48px;animation:cr-spin 1s linear infinite;fill:#2563eb;color:#475569}.payment-modal{position:absolute;inset:0;z-index:10000;height:100%;width:100%;transition:all .3s cubic-bezier(.25,1,.5,1)}.payment-modal.visible{opacity:1}.payment-modal.invisible{opacity:0}@keyframes cr-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
|
2
2
|
/*$vite$:1*/`,document.head.appendChild(ye);class K extends Error{response;request;options;constructor(t,s,n){const r=t.status||t.status===0?t.status:"",i=t.statusText??"",o=`${r} ${i}`.trim(),a=o?`status code ${o}`:"an unknown error";super(`Request failed with ${a}: ${s.method} ${s.url}`),this.name="HTTPError",this.response=t,this.request=s,this.options=n}}class we extends Error{name="NonError";value;constructor(t){let s="Non-error value was thrown";try{typeof t=="string"?s=t:t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"&&(s=t.message)}catch{}super(s),this.value=t}}class W extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(t){const s=t?.cause?t.cause instanceof Error?t.cause:new we(t.cause):void 0;super(t?.code?`Forced retry: ${t.code}`:"Forced retry",s?{cause:s}:void 0),this.customDelay=t?.delay,this.code=t?.code,this.customRequest=t?.request}}const be=(()=>{let e=!1,t=!1;const s=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(s&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(r){if(r instanceof Error&&r.message==="unsupported BodyInit type")return!1;throw r}return e&&!t})(),St=typeof globalThis.AbortController=="function",Se=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Et=typeof globalThis.ReadableStream=="function",Tt=typeof globalThis.FormData=="function",Ee=["get","post","put","patch","head","delete"],Rt={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},V=2147483647,At=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Te=Symbol("stop");class Re{options;constructor(t){this.options=t}}const vt=e=>new Re(e),Pt={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},It={next:!0},Ct={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Ut=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[s,n]of e)t+=At,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{const t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},Ae=(e,t,s)=>{let n,r=0;return e.pipeThrough(new TransformStream({transform(i,o){if(o.enqueue(i),n){r+=n.byteLength;let a=t===0?0:r/t;a>=1&&(a=1-Number.EPSILON),s?.({percent:a,totalBytes:Math.max(t,r),transferredBytes:r},n)}n=i},flush(){n&&(r+=n.byteLength,s?.({percent:1,totalBytes:Math.max(t,r),transferredBytes:r},n))}}))},kt=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});const s=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(Ae(e.body,s,t),{status:e.status,statusText:e.statusText,headers:e.headers})},xt=(e,t,s)=>{if(!e.body)return e;const n=Ut(s??e.body);return new Request(e,{duplex:"half",body:Ae(e.body,n,t)})},C=e=>e!==null&&typeof e=="object",M=(...e)=>{for(const t of e)if((!C(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Y({},...e)},ve=(e={},t={})=>{const s=new globalThis.Headers(e),n=t instanceof globalThis.Headers,r=new globalThis.Headers(t);for(const[i,o]of r.entries())n&&o==="undefined"||o===void 0?s.delete(i):s.set(i,o);return s};function _(e,t,s){return Object.hasOwn(t,s)&&t[s]===void 0?[]:Y(e[s]??[],t[s]??[])}const Pe=(e={},t={})=>({beforeRequest:_(e,t,"beforeRequest"),beforeRetry:_(e,t,"beforeRetry"),afterResponse:_(e,t,"afterResponse"),beforeError:_(e,t,"beforeError")}),Ot=(e,t)=>{const s=new URLSearchParams;for(const n of[e,t])if(n!==void 0)if(n instanceof URLSearchParams)for(const[r,i]of n.entries())s.append(r,i);else if(Array.isArray(n))for(const r of n){if(!Array.isArray(r)||r.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");s.append(String(r[0]),String(r[1]))}else if(C(n))for(const[r,i]of Object.entries(n))i!==void 0&&s.append(r,String(i));else{const r=new URLSearchParams(n);for(const[i,o]of r.entries())s.append(i,o)}return s},Y=(...e)=>{let t={},s={},n={},r;const i=[];for(const o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(C(o)){for(let[a,c]of Object.entries(o)){if(a==="signal"&&c instanceof globalThis.AbortSignal){i.push(c);continue}if(a==="context"){if(c!=null&&(!C(c)||Array.isArray(c)))throw new TypeError("The `context` option must be an object");t={...t,context:c==null?{}:{...t.context,...c}};continue}if(a==="searchParams"){c==null?r=void 0:r=r===void 0?c:Ot(r,c);continue}C(c)&&a in t&&(c=Y(t[a],c)),t={...t,[a]:c}}C(o.hooks)&&(n=Pe(n,o.hooks),t.hooks=n),C(o.headers)&&(s=ve(s,o.headers),t.headers=s)}return r!==void 0&&(t.searchParams=r),i.length>0&&(i.length===1?t.signal=i[0]:Se?t.signal=AbortSignal.any(i):t.signal=i.at(-1)),t.context===void 0&&(t.context={}),t},Dt=e=>Ee.includes(e)?e.toUpperCase():e,Ie={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},Nt=(e={})=>{if(typeof e=="number")return{...Ie,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Ie,...e}};class X extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}}async function Mt(e,t,s,n){return new Promise((r,i)=>{const o=setTimeout(()=>{s&&s.abort(),i(new X(e))},n.timeout);n.fetch(e,t).then(r).catch(i).then(()=>{clearTimeout(o)})})}async function _t(e,{signal:t}){return new Promise((s,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",r,{once:!0}));function r(){clearTimeout(i),n(t.reason)}const i=setTimeout(()=>{t?.removeEventListener("abort",r),s()},e)})}const $t=(e,t)=>{const s={};for(const n in t)Object.hasOwn(t,n)&&!(n in Ct)&&!(n in Pt)&&(!(n in e)||n in It)&&(s[n]=t[n]);return s},zt=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;function Bt(e){return e instanceof K||e?.name===K.name}function Lt(e){return e instanceof X||e?.name===X.name}class x{static create(t,s){const n=new x(t,s),r=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>V)throw new RangeError(`The \`timeout\` option cannot be greater than ${V}`);await Promise.resolve();let o=await n.#g();for(const a of n.#e.hooks.afterResponse){const c=n.#l(o.clone()),u=await a(n.request,n.#a(),c,{retryCount:n.#s});if(u instanceof globalThis.Response&&(o=u),u instanceof Re)throw await Promise.all([c.body?.cancel(),o.body?.cancel()]),new W(u.options)}if(n.#l(o),!o.ok&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(o.status):n.#e.throwHttpErrors)){let a=new K(o,n.request,n.#a());for(const c of n.#e.hooks.beforeError)a=await c(a,{retryCount:n.#s});throw a}if(n.#e.onDownloadProgress){if(typeof n.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Et)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return kt(o.clone(),n.#e.onDownloadProgress)}return o},i=n.#f(r).finally(async()=>{const o=n.#o,a=[];o&&!o.bodyUsed&&a.push(o.body?.cancel()),n.request.bodyUsed||a.push(n.request.body?.cancel()),await Promise.all(a)});for(const[o,a]of Object.entries(Rt))o==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(i[o]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||a);const c=await i;if(o==="json"){if(c.status===204)return"";const u=await c.text();return u===""?"":s.parseJson?s.parseJson(u):JSON.parse(u)}return c[o]()});return i}static#d(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,s])=>s!==void 0)):t}request;#n;#s=0;#t;#e;#o;#r;#i;constructor(t,s={}){if(this.#t=t,this.#e={...s,headers:ve(this.#t.headers,s.headers),hooks:Pe({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},s.hooks),method:Dt(s.method??this.#t.method??"GET"),prefixUrl:String(s.prefixUrl||""),retry:Nt(s.retry),throwHttpErrors:s.throwHttpErrors??!0,timeout:s.timeout??1e4,fetch:s.fetch??globalThis.fetch.bind(globalThis),context:s.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}St&&Se&&(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"));const n=s.headers&&new globalThis.Headers(s.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(Tt&&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),zt(this.#e.searchParams)){const i="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(x.#d(this.#e.searchParams)).toString()),o=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);this.request=new globalThis.Request(o,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!be)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#h(this.request,this.#e.body??void 0)}}#c(){const t=this.#e.retry.delay(this.#s);let s=t;return this.#e.retry.jitter===!0?s=Math.random()*t:typeof this.#e.retry.jitter=="function"&&(s=this.#e.retry.jitter(t),(!Number.isFinite(s)||s<0)&&(s=t)),Math.min(this.#e.retry.backoffLimit,s)}async#p(t){if(this.#s++,this.#s>this.#e.retry.limit)throw t;const s=t instanceof Error?t:new we(t);if(s instanceof W)return s.customDelay??this.#c();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw t;if(this.#e.retry.shouldRetry!==void 0){const n=await this.#e.retry.shouldRetry({error:s,retryCount:this.#s});if(n===!1)throw t;if(n===!0)return this.#c()}if(Lt(t)&&!this.#e.retry.retryOnTimeout)throw t;if(Bt(t)){if(!this.#e.retry.statusCodes.includes(t.response.status))throw t;const n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Retry-After")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#e.retry.afterStatusCodes.includes(t.response.status)){let r=Number(n)*1e3;Number.isNaN(r)?r=Date.parse(n)-Date.now():r>=Date.parse("2024-01-01")&&(r-=Date.now());const i=this.#e.retry.maxRetryAfter??r;return r<i?r:i}if(t.response.status===413)throw t}return this.#c()}#l(t){return this.#e.parseJson&&(t.json=async()=>this.#e.parseJson(await t.text())),t}async#f(t){try{return await t()}catch(s){const n=Math.min(await this.#p(s),V);if(this.#s<1)throw s;if(await _t(n,this.#r?{signal:this.#r}:{}),s instanceof W&&s.customRequest){const r=this.#e.signal?new globalThis.Request(s.customRequest,{signal:this.#e.signal}):new globalThis.Request(s.customRequest);this.#u(r)}for(const r of this.#e.hooks.beforeRetry){const i=await r({request:this.request,options:this.#a(),error:s,retryCount:this.#s});if(i instanceof globalThis.Request){this.#u(i);break}if(i instanceof globalThis.Response)return i;if(i===Te)return}return this.#f(t)}}async#g(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#r?AbortSignal.any([this.#r,this.#n.signal]):this.#n.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const s of this.#e.hooks.beforeRequest){const n=await s(this.request,this.#a(),{retryCount:this.#s});if(n instanceof Response)return n;if(n instanceof globalThis.Request){this.#u(n);break}}const t=$t(this.request,this.#e);return this.#o=this.request,this.request=this.#o.clone(),this.#e.timeout===!1?this.#e.fetch(this.#o,t):Mt(this.#o,t,this.#n,this.#e)}#a(){if(!this.#i){const{hooks:t,...s}=this.#e;this.#i=Object.freeze(s)}return this.#i}#u(t){this.#i=void 0,this.request=this.#h(t)}#h(t,s){return!this.#e.onUploadProgress||!t.body?t:xt(t,this.#e.onUploadProgress,s??this.#e.body??void 0)}}/*! MIT License © Sindre Sorhus */const J=e=>{const t=(s,n)=>x.create(s,M(e,n));for(const s of Ee)t[s]=(n,r)=>x.create(n,M(e,r,{method:s}));return t.create=s=>J(M(s)),t.extend=s=>(typeof s=="function"&&(s=s(e??{})),J(M(e,s))),t.stop=Te,t.retry=vt,t},jt=J();var T=(e=>(e.USDC="USDC",e))(T||{});const Ce={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},Ue={type:"evm",chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},ke={type:"evm",chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp"},xe={type:"evm",chainId:84532,name:"Base Sepolia",cctpDomain:6,logoURI:"/images/chains/base.webp"},Oe={type:"evm",chainId:56,name:"BNB Chain",cctpDomain:null,logoURI:"/images/chains/bsc.webp"},De={type:"evm",chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},Ne={type:"evm",chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},Me={type:"evm",chainId:43114,name:"Avalanche",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},_e={type:"evm",chainId:43113,name:"Avalanche Fuji",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},$e={type:"starknet",chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:null,logoURI:"/images/chains/starknet.svg"};function G(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ze(e){return G(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Be="2.43.4";let Z={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:s})=>t?`${e??"https://viem.sh"}${t}${s?`#${s}`:""}`:void 0,version:`viem@${Be}`};class P extends Error{constructor(t,s={}){const n=s.cause instanceof P?s.cause.details:s.cause?.message?s.cause.message:s.details,r=s.cause instanceof P&&s.cause.docsPath||s.docsPath,i=Z.getDocsUrl?.({...s,docsPath:r}),o=[t||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...Z.version?[`Version: ${Z.version}`]:[]].join(`
|
|
3
|
-
`);super(o,s.cause?{cause:s.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=r,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=t,this.version=Be}walk(t){return Le(this,t)}}function Le(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Le(e.cause,t):t?null:e}class je extends P{constructor({size:t,targetSize:s,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function $(e,{dir:t,size:s=32}={}){return typeof e=="string"?qt(e,{dir:t,size:s}):Ft(e,{dir:t,size:s})}function qt(e,{dir:t,size:s=32}={}){if(s===null)return e;const n=e.replace("0x","");if(n.length>s*2)throw new je({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](s*2,"0")}`}function Ft(e,{dir:t,size:s=32}={}){if(s===null)return e;if(e.length>s)throw new je({size:e.length,targetSize:s,type:"bytes"});const n=new Uint8Array(s);for(let r=0;r<s;r++){const i=t==="right";n[i?r:s-r-1]=e[i?r:e.length-r-1]}return n}class Ht extends P{constructor({max:t,min:s,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${s} to ${t})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class Kt extends P{constructor({givenSize:t,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Q(e,{size:t}){if(ze(e)>t)throw new Kt({givenSize:ze(e),maxSize:t})}function Wt(e,t={}){const{signed:s,size:n}=t,r=BigInt(e);let i;n?s?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&s?-i-1n:0;if(i&&r>i||r<o){const c=typeof e=="bigint"?"n":"";throw new Ht({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:s,size:n,value:`${e}${c}`})}const a=`0x${(s&&r<0?(1n<<BigInt(n*8))+BigInt(r):r).toString(16)}`;return n?$(a,{size:n}):a}const Vt=new TextEncoder;function Yt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Jt(e,t):typeof e=="boolean"?Xt(e,t):G(e)?Fe(e,t):He(e,t)}function Xt(e,t={}){const s=new Uint8Array(1);return s[0]=Number(e),typeof t.size=="number"?(Q(s,{size:t.size}),$(s,{size:t.size})):s}const R={zero:48,nine:57,A:65,F:70,a:97,f:102};function qe(e){if(e>=R.zero&&e<=R.nine)return e-R.zero;if(e>=R.A&&e<=R.F)return e-(R.A-10);if(e>=R.a&&e<=R.f)return e-(R.a-10)}function Fe(e,t={}){let s=e;t.size&&(Q(s,{size:t.size}),s=$(s,{dir:"right",size:t.size}));let n=s.slice(2);n.length%2&&(n=`0${n}`);const r=n.length/2,i=new Uint8Array(r);for(let o=0,a=0;o<r;o++){const c=qe(n.charCodeAt(a++)),u=qe(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new P(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);i[o]=c*16+u}return i}function Jt(e,t){const s=Wt(e,t);return Fe(s)}function He(e,t={}){const s=Vt.encode(e);return typeof t.size=="number"?(Q(s,{size:t.size}),$(s,{dir:"right",size:t.size})):s}const z=BigInt(2**32-1),Ke=BigInt(32);function Gt(e,t=!1){return t?{h:Number(e&z),l:Number(e>>Ke&z)}:{h:Number(e>>Ke&z)|0,l:Number(e&z)|0}}function Zt(e,t=!1){const s=e.length;let n=new Uint32Array(s),r=new Uint32Array(s);for(let i=0;i<s;i++){const{h:o,l:a}=Gt(e[i],t);[n[i],r[i]]=[o,a]}return[n,r]}const Qt=(e,t,s)=>e<<s|t>>>32-s,es=(e,t,s)=>t<<s|e>>>32-s,ts=(e,t,s)=>t<<s-32|e>>>64-s,ss=(e,t,s)=>e<<s-32|t>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ns(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function We(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function B(e,...t){if(!ns(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ve(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function rs(e,t){B(e);const s=t.outputLen;if(e.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function os(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Ye(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const is=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function as(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function cs(e){for(let t=0;t<e.length;t++)e[t]=as(e[t]);return e}const Xe=is?e=>e:cs;function us(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Je(e){return typeof e=="string"&&(e=us(e)),B(e),e}class ls{}function fs(e){const t=n=>e().update(Je(n)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t}const hs=BigInt(0),O=BigInt(1),ds=BigInt(2),ps=BigInt(7),gs=BigInt(256),ms=BigInt(113),Ge=[],Ze=[],Qe=[];for(let e=0,t=O,s=1,n=0;e<24;e++){[s,n]=[n,(2*s+3*n)%5],Ge.push(2*(5*n+s)),Ze.push((e+1)*(e+2)/2%64);let r=hs;for(let i=0;i<7;i++)t=(t<<O^(t>>ps)*ms)%gs,t&ds&&(r^=O<<(O<<BigInt(i))-O);Qe.push(r)}const et=Zt(Qe,!0),ys=et[0],ws=et[1],tt=(e,t,s)=>s>32?ts(e,t,s):Qt(e,t,s),st=(e,t,s)=>s>32?ss(e,t,s):es(e,t,s);function bs(e,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)s[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=s[c],l=s[c+1],b=tt(u,l,1)^s[a],d=st(u,l,1)^s[a+1];for(let y=0;y<50;y+=10)e[o+y]^=b,e[o+y+1]^=d}let r=e[2],i=e[3];for(let o=0;o<24;o++){const a=Ze[o],c=tt(r,i,a),u=st(r,i,a),l=Ge[o];r=e[l],i=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}e[0]^=ys[n],e[1]^=ws[n]}Ye(s)}class ee extends ls{constructor(t,s,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=r,this.rounds=i,We(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=os(this.state)}clone(){return this._cloneInto()}keccak(){Xe(this.state32),bs(this.state32,this.rounds),Xe(this.state32),this.posOut=0,this.pos=0}update(t){Ve(this),t=Je(t),B(t);const{blockLen:s,state:n}=this,r=t.length;for(let i=0;i<r;){const o=Math.min(s-this.pos,r-i);for(let a=0;a<o;a++)n[this.pos++]^=t[i++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:r}=this;t[n]^=s,(s&128)!==0&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){Ve(this,!1),B(t),this.finish();const s=this.state,{blockLen:n}=this;for(let r=0,i=t.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(s.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return We(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(rs(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Ye(this.state)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new ee(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}}const Ss=(e,t,s)=>fs(()=>new ee(t,e,s)),Es=Ss(1,136,256/8);function Ts(e,t){return Es(G(e,{strict:!1})?Yt(e):e)}class Rs extends P{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class nt extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const s=super.get(t);return super.has(t)&&s!==void 0&&(this.delete(t),super.set(t,s)),s}set(t,s){if(super.set(t,s),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const te=new nt(8192);function rt(e,t){if(te.has(`${e}.${t}`))return te.get(`${e}.${t}`);const s=e.substring(2).toLowerCase(),n=Ts(He(s)),r=s.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&r[o]&&(r[o]=r[o].toUpperCase()),(n[o>>1]&15)>=8&&r[o+1]&&(r[o+1]=r[o+1].toUpperCase());const i=`0x${r.join("")}`;return te.set(`${e}.${t}`,i),i}function A(e,t){if(!vs(e,{strict:!1}))throw new Rs({address:e});return rt(e,t)}const As=/^0x[a-fA-F0-9]{40}$/,se=new nt(8192);function vs(e,t){const{strict:s=!0}=t??{},n=`${e}.${s}`;if(se.has(n))return se.get(n);const r=As.test(e)?e.toLowerCase()===e?!0:s?rt(e)===e:!0:!1;return se.set(n,r),r}const Ps={chainId:Ue.chainId,address:A("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Is={chainId:Ce.chainId,address:A("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},Cs={chainId:_e.chainId,address:A("0x5425890298aed601595a70ab815c96711a31bc65"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Us={chainId:Me.chainId,address:A("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},ks={chainId:xe.chainId,address:A("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},xs={chainId:ke.chainId,address:A("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Os={chainId:Oe.chainId,address:A("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ds={chainId:Ne.chainId,address:A("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ns={chainId:De.chainId,address:A("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ms={chainId:$e.chainId,address:"0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},ot={ARBITRUM_MAINNET:{...Ce,tokens:{[T.USDC]:Is},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...Ue,explorer:"https://sepolia.arbiscan.io",tokens:{[T.USDC]:Ps}},AVALANCHE_MAINNET:{...Me,tokens:{[T.USDC]:Us},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{..._e,tokens:{[T.USDC]:Cs},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...ke,tokens:{[T.USDC]:xs},explorer:"https://basescan.org"},BASE_TESTNET:{...xe,tokens:{[T.USDC]:ks},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...Oe,tokens:{[T.USDC]:Os},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...De,tokens:{[T.USDC]:Ns},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...Ne,tokens:{[T.USDC]:Ds},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...$e,tokens:{[T.USDC]:Ms},explorer:""}};var L=(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))(L||{}),ne=(e=>(e.USDC="USDC",e))(ne||{});const _s=e=>{const t=e?.trim().toUpperCase();if(ot[t])return ot[t]};function $s(e,t){return _s(e)?.tokens[t]?.address}var re=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(re||{});class f{constructor({api_key:t,env:s,seesion_token:n}){this.api_key=t||"",this.sessionToken=n||"",this.env=s??re.PRODUCTION}static async config(t){if(!f.app){if(!t)throw new Error("Please provide an api_key");f.app=new f(t)}return t&&(t.api_key!==void 0&&(f.app.api_key=t.api_key),t.seesion_token!==void 0&&(f.app.sessionToken=t.seesion_token),t.env!==void 0&&(f.app.env=t.env)),f.app}static getApiKey(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return f.app.api_key}static getSessionToken(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return f.app.sessionToken}static getEnv(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return f.app.env==="internal"?"staging":f.app.env}static getBaseUrl(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(f.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(t,s,n,r){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const i=f.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",o=r&&r>0?"/pay/":"/deposit/",a=`_chain_/${t}/_token_/${s}/_to_/${n}${r?"/_amount_/"+r*100:""}`;return i+o+a}}let oe=null;function zs(){oe=jt.create({prefixUrl:f.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[e=>{const t=f.getSessionToken()||f.getApiKey();e.headers.set("Authorization",`Bearer ${t}`)}],afterResponse:[(e,t,s)=>s]},retry:{limit:2}})}function m(){return oe||zs(),oe}class Bs{async getById(t){return await m().get("intents/"+t).json()}async getForSender(t){return await m().get("intents/user/"+t).json()}async getForAddress(t){return await m().get("intents/address/"+t).json()}async getForSession(t){return await m().get("modal/sessions/intents/"+t).json()}async getAll(t){return await m().get("intents",{searchParams:t}).json()}async create(t){return await m().post("intents",{json:t}).json()}async createForSession(t){return await m().post("modal/sessions/intents",{json:t}).json()}async update(t,s){return await m().post("intents",{json:s}).json()}async triggerProcessing(t){return await m().post(`intents/${t}/trigger-processing`).json()}async triggerProcessingForSession(t){return await m().post(`modal/sessions/intents/${t}/process`).json()}}class Ls{async getFromSpecificBridge(t){return await m().get("quotes/single",{searchParams:t}).json()}async getFromAllBridges(t){return await m().get("quotes/multiple",{searchParams:t}).json()}async getBestAcrossBridges(t){return await m().get("quotes/best",{searchParams:t}).json()}async getAll(t){return await m().get("quotes/multi-source",{searchParams:t}).json()}async getAllForSession(t){return await m().get("modal/sessions/quotes",{searchParams:t}).json()}}class js{async getOptimalRoutes(t){return await m().get("router/optimal-route",{searchParams:t}).json()}async getAllSupportedBridges(){return await m().get("router/supported-bridges/all").json()}async getSupportedBridges(t){return await m().get("router/supported-bridges/route",{searchParams:t}).json()}async getSupportedRoutes(t,s){return await m().get("router/supported-bridges/bridge/"+t,{searchParams:s}).json()}}class qs{async getSupported(t){return await m().get("chains",{searchParams:t}).json()}}class Fs{async getClientInfo(){return await m().get("client/auth/client-info").json()}}class Hs{getSessionToken(t){const s={recipient:t.recipient,tokenOut:$s(L[t.destinationChain],ne[t.token]),destinationChain:L[t.destinationChain],amount:t.amount};return m().post("modal/sessions",{json:s}).json()}}const Ks={router:new js,quotes:new Ls,intents:new Bs,chains:new qs,client:new Fs,auth:new Hs};function it(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=it(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Ws(){for(var e,t,s=0,n="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=it(e))&&(n&&(n+=" "),n+=t);return n}function Vs(e){const{recipient:t,token:s,destinationChain:n,amount:r,isOpen:i,isPending:o,open:a,close:c,onCancel:u,onSuccess:l,data:b}=e,[d,y]=w.useState(!0),I=w.useRef(null);w.useEffect(()=>{h();const p=document.body.style.overflow;i?(document.body.style.overflow="hidden",document.body.style.overflow="hidden"):document.body.style.overflow=p||"";const g=E=>{E.data==="closed"&&(c(),u?.()),E.data==="completed"&&(window.setTimeout(c,2e3),l?.())};return window.addEventListener("message",g),()=>{document.body.style.overflow=p||"",window.removeEventListener("message",g)}},[i,u,l]);function me(){y(!1),h()}function h(){if(!b?.sessionToken)return;const p={type:"session",session_token:b.sessionToken,environment:f.getEnv()||re.PRODUCTION};I.current?.contentWindow?.postMessage(p,"https://app.chainrails.io"),I.current?.contentWindow?.postMessage(p,"https://chainrails-frontend-git-staging-horus-labs.vercel.app")}return b?.sessionToken?v.jsxs("div",{className:Ws("payment-modal-wrapper",d||o?"loading":"not-loading",i?"open":"closed"),children:[(d||o)&&v.jsx("div",{role:"status",className:"payment-modal-loader",children:v.jsxs("svg",{"aria-hidden":"true",className:"icon",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[v.jsx("path",{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",fill:"currentColor"}),v.jsx("path",{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",fill:"currentFill"})]})}),v.jsx("iframe",{allow:"clipboard-read *; clipboard-write *",src:f.getPayModalUrl(n,s,t,r),onLoad:me,className:`payment-modal ${d||o?"invisible":"visible"}`,"data-id":r,ref:I})]}):v.jsx(v.Fragment,{})}function Ys(e){return BigInt(e).toString()}const Xs=Symbol(),ie=Symbol(),D="a",at="f",ct="p",ut="c",lt="t",ae="h",N="w",ce="o",ue="k";let Js=(e,t)=>new Proxy(e,t);const le=Object.getPrototypeOf,fe=new WeakMap,ft=e=>e&&(fe.has(e)?fe.get(e):le(e)===Object.prototype||le(e)===Array.prototype),j=e=>typeof e=="object"&&e!==null,Gs=e=>Object.values(Object.getOwnPropertyDescriptors(e)).some(t=>!t.configurable&&!t.writable),Zs=e=>{if(Array.isArray(e))return Array.from(e);const t=Object.getOwnPropertyDescriptors(e);return Object.values(t).forEach(s=>{s.configurable=!0}),Object.create(le(e),t)},Qs=(e,t)=>{const s={[at]:t};let n=!1;const r=(a,c)=>{if(!n){let u=s[D].get(e);if(u||(u={},s[D].set(e,u)),a===N)u[N]=!0;else{let l=u[a];l||(l=new Set,u[a]=l),l.add(c)}}},i=()=>{n=!0,s[D].delete(e)},o={get(a,c){return c===ie?e:(r(ue,c),ht(Reflect.get(a,c),s[D],s[ut],s[lt]))},has(a,c){return c===Xs?(i(),!0):(r(ae,c),Reflect.has(a,c))},getOwnPropertyDescriptor(a,c){return r(ce,c),Reflect.getOwnPropertyDescriptor(a,c)},ownKeys(a){return r(N),Reflect.ownKeys(a)}};return t&&(o.set=o.deleteProperty=()=>!1),[o,s]},he=e=>e[ie]||e,ht=(e,t,s,n)=>{if(!ft(e))return e;let r=n&&n.get(e);if(!r){const c=he(e);Gs(c)?r=[c,Zs(c)]:r=[c],n?.set(e,r)}const[i,o]=r;let a=s&&s.get(i);return(!a||a[1][at]!==!!o)&&(a=Qs(i,!!o),a[1][ct]=Js(o||i,a[0]),s&&s.set(i,a)),a[1][D]=t,a[1][ut]=s,a[1][lt]=n,a[1][ct]},en=(e,t)=>{const s=Reflect.ownKeys(e),n=Reflect.ownKeys(t);return s.length!==n.length||s.some((r,i)=>r!==n[i])},dt=(e,t,s,n,r=Object.is)=>{if(r(e,t))return!1;if(!j(e)||!j(t))return!0;const i=s.get(he(e));if(!i)return!0;if(n){if(n.get(e)===t)return!1;n.set(e,t)}let o=null;for(const a of i[ae]||[])if(o=Reflect.has(e,a)!==Reflect.has(t,a),o)return o;if(i[N]===!0){if(o=en(e,t),o)return o}else for(const a of i[ce]||[]){const c=!!Reflect.getOwnPropertyDescriptor(e,a),u=!!Reflect.getOwnPropertyDescriptor(t,a);if(o=c!==u,o)return o}for(const a of i[ue]||[])if(o=dt(e[a],t[a],s,n,r),o)return o;if(o===null)throw new Error("invalid used");return o},tn=e=>ft(e)&&e[ie]||null,pt=(e,t=!0)=>{fe.set(e,t)},sn=(e,t,s)=>{const n=[],r=new WeakSet,i=(o,a)=>{var c,u,l;if(r.has(o))return;j(o)&&r.add(o);const b=j(o)&&t.get(he(o));if(b){if((c=b[ae])===null||c===void 0||c.forEach(d=>{const y=`:has(${String(d)})`;n.push(a?[...a,y]:[y])}),b[N]===!0){const d=":ownKeys";n.push(a?[...a,d]:[d])}else(u=b[ce])===null||u===void 0||u.forEach(d=>{const y=`:hasOwn(${String(d)})`;n.push(a?[...a,y]:[y])});(l=b[ue])===null||l===void 0||l.forEach(d=>{"value"in(Object.getOwnPropertyDescriptor(o,d)||{})&&i(o[d],a?[...a,d]:[d])})}else a&&n.push(a)};return i(e),n},q={},de=e=>typeof e=="object"&&e!==null,nn=e=>de(e)&&!pe.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),gt=(e,t)=>{const s=mt.get(e);if(s?.[0]===t)return s[1];const n=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return pt(n,!0),mt.set(e,[t,n]),Reflect.ownKeys(e).forEach(r=>{if(Object.getOwnPropertyDescriptor(n,r))return;const i=Reflect.get(e,r),{enumerable:o}=Reflect.getOwnPropertyDescriptor(e,r),a={value:i,enumerable:o,configurable:!0};if(pe.has(i))pt(i,!1);else if(U.has(i)){const[c,u]=U.get(i);a.value=gt(c,u())}Object.defineProperty(n,r,a)}),Object.preventExtensions(n)},rn=(e,t,s,n)=>({deleteProperty(r,i){const o=Reflect.get(r,i);s(i);const a=Reflect.deleteProperty(r,i);return a&&n(["delete",[i],o]),a},set(r,i,o,a){const c=!e()&&Reflect.has(r,i),u=Reflect.get(r,i,a);if(c&&(yt(u,o)||F.has(o)&&yt(u,F.get(o))))return!0;s(i),de(o)&&(o=tn(o)||o);const l=!U.has(o)&&an(o)?wt(o):o;return t(i,l),Reflect.set(r,i,l,a),n(["set",[i],o,u]),!0}}),U=new WeakMap,pe=new WeakSet,mt=new WeakMap,ge=[1],F=new WeakMap;let yt=Object.is,on=(e,t)=>new Proxy(e,t),an=nn,cn=gt,un=rn;function wt(e={}){if(!de(e))throw new Error("object required");const t=F.get(e);if(t)return t;let s=ge[0];const n=new Set,r=(h,p=++ge[0])=>{s!==p&&(i=s=p,n.forEach(g=>g(h,p)))};let i=s;const o=(h=ge[0])=>(i!==h&&(i=h,c.forEach(([p])=>{const g=p[1](h);g>s&&(s=g)})),s),a=h=>(p,g)=>{const E=[...p];E[1]=[h,...E[1]],r(E,g)},c=new Map,u=(h,p)=>{const g=!pe.has(p)&&U.get(p);if(g){if((q?"production":void 0)!=="production"&&c.has(h))throw new Error("prop listener already exists");if(n.size){const E=g[2](a(h));c.set(h,[g,E])}else c.set(h,[g])}},l=h=>{var p;const g=c.get(h);g&&(c.delete(h),(p=g[1])==null||p.call(g))},b=h=>(n.add(h),n.size===1&&c.forEach(([g,E],H)=>{if((q?"production":void 0)!=="production"&&E)throw new Error("remove already exists");const mn=g[2](a(H));c.set(H,[g,mn])}),()=>{n.delete(h),n.size===0&&c.forEach(([g,E],H)=>{E&&(E(),c.set(H,[g]))})});let d=!0;const y=un(()=>d,u,l,r),I=on(e,y);F.set(e,I);const me=[e,o,b];return U.set(I,me),Reflect.ownKeys(e).forEach(h=>{const p=Object.getOwnPropertyDescriptor(e,h);"value"in p&&p.writable&&(I[h]=e[h])}),d=!1,I}function ln(e,t,s){const n=U.get(e);(q?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let r;const i=[],o=n[2];let a=!1;const u=o(l=>{i.push(l),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,u()}}function bt(e){const t=U.get(e);(q?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[s,n]=t;return cn(s,n())}const fn={},hn=(e,t)=>{const s=w.useRef(void 0);w.useEffect(()=>{s.current=sn(e,t)}),w.useDebugValue(s.current)},dn=new WeakMap;function pn(e,t){const n=w.useMemo(()=>e&&new WeakMap,[e]),r=w.useRef(void 0);let i=!0;const o=w.useSyncExternalStore(w.useCallback(c=>{const u=ln(e,c);return c(),u},[e,void 0]),()=>{const c=bt(e);try{if(!i&&r.current&&!dt(r.current,c,n,new WeakMap))return r.current}catch{}return c},()=>bt(e));i=!1,w.useLayoutEffect(()=>{r.current=o}),(fn?"production":void 0)!=="production"&&hn(o,n);const a=w.useMemo(()=>new WeakMap,[]);return ht(o,n,a,dn)}const k=wt({data:null,isPending:!1,error:null});function gn({session_url:e,destinationChain:t,token:s,amount:n,recipient:r,onCancel:i,onSuccess:o}){const a=pn(k),[c,u]=w.useState(!1);function l(){u(!0)}function b(){u(!1)}const d=()=>{k.isPending=!0,k.error=null,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinationChain:t,token:s,amount:n?Ys(n):"0",recipient:r})}).then(y=>y.json()).then(y=>{k.data=y,f.config({api_key:y.sessionToken}),k.isPending=!1}).catch(y=>{k.error=y?.toString(),k.isPending=!1})};return w.useEffect(()=>{d()},[t,s,n,r]),{...a,destinationChain:t,token:s,recipient:r,isOpen:c,open:l,close:b,refetch:d,onSuccess:o,onCancel:i}}S.Chainrails=f,S.PaymentModal=Vs,S.chains=L,S.crapi=Ks,S.tokens=ne,S.usePaymentSession=gn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|
|
3
|
+
`);super(o,s.cause?{cause:s.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=r,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=t,this.version=Be}walk(t){return Le(this,t)}}function Le(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Le(e.cause,t):t?null:e}class je extends P{constructor({size:t,targetSize:s,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function $(e,{dir:t,size:s=32}={}){return typeof e=="string"?qt(e,{dir:t,size:s}):Ft(e,{dir:t,size:s})}function qt(e,{dir:t,size:s=32}={}){if(s===null)return e;const n=e.replace("0x","");if(n.length>s*2)throw new je({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](s*2,"0")}`}function Ft(e,{dir:t,size:s=32}={}){if(s===null)return e;if(e.length>s)throw new je({size:e.length,targetSize:s,type:"bytes"});const n=new Uint8Array(s);for(let r=0;r<s;r++){const i=t==="right";n[i?r:s-r-1]=e[i?r:e.length-r-1]}return n}class Ht extends P{constructor({max:t,min:s,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${s} to ${t})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class Kt extends P{constructor({givenSize:t,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Q(e,{size:t}){if(ze(e)>t)throw new Kt({givenSize:ze(e),maxSize:t})}function Wt(e,t={}){const{signed:s,size:n}=t,r=BigInt(e);let i;n?s?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&s?-i-1n:0;if(i&&r>i||r<o){const c=typeof e=="bigint"?"n":"";throw new Ht({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:s,size:n,value:`${e}${c}`})}const a=`0x${(s&&r<0?(1n<<BigInt(n*8))+BigInt(r):r).toString(16)}`;return n?$(a,{size:n}):a}const Vt=new TextEncoder;function Yt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Jt(e,t):typeof e=="boolean"?Xt(e,t):G(e)?Fe(e,t):He(e,t)}function Xt(e,t={}){const s=new Uint8Array(1);return s[0]=Number(e),typeof t.size=="number"?(Q(s,{size:t.size}),$(s,{size:t.size})):s}const R={zero:48,nine:57,A:65,F:70,a:97,f:102};function qe(e){if(e>=R.zero&&e<=R.nine)return e-R.zero;if(e>=R.A&&e<=R.F)return e-(R.A-10);if(e>=R.a&&e<=R.f)return e-(R.a-10)}function Fe(e,t={}){let s=e;t.size&&(Q(s,{size:t.size}),s=$(s,{dir:"right",size:t.size}));let n=s.slice(2);n.length%2&&(n=`0${n}`);const r=n.length/2,i=new Uint8Array(r);for(let o=0,a=0;o<r;o++){const c=qe(n.charCodeAt(a++)),u=qe(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new P(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);i[o]=c*16+u}return i}function Jt(e,t){const s=Wt(e,t);return Fe(s)}function He(e,t={}){const s=Vt.encode(e);return typeof t.size=="number"?(Q(s,{size:t.size}),$(s,{dir:"right",size:t.size})):s}const z=BigInt(2**32-1),Ke=BigInt(32);function Gt(e,t=!1){return t?{h:Number(e&z),l:Number(e>>Ke&z)}:{h:Number(e>>Ke&z)|0,l:Number(e&z)|0}}function Zt(e,t=!1){const s=e.length;let n=new Uint32Array(s),r=new Uint32Array(s);for(let i=0;i<s;i++){const{h:o,l:a}=Gt(e[i],t);[n[i],r[i]]=[o,a]}return[n,r]}const Qt=(e,t,s)=>e<<s|t>>>32-s,es=(e,t,s)=>t<<s|e>>>32-s,ts=(e,t,s)=>t<<s-32|e>>>64-s,ss=(e,t,s)=>e<<s-32|t>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ns(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function We(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function B(e,...t){if(!ns(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ve(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function rs(e,t){B(e);const s=t.outputLen;if(e.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function os(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Ye(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const is=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function as(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function cs(e){for(let t=0;t<e.length;t++)e[t]=as(e[t]);return e}const Xe=is?e=>e:cs;function us(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Je(e){return typeof e=="string"&&(e=us(e)),B(e),e}class ls{}function fs(e){const t=n=>e().update(Je(n)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t}const hs=BigInt(0),O=BigInt(1),ds=BigInt(2),ps=BigInt(7),gs=BigInt(256),ms=BigInt(113),Ge=[],Ze=[],Qe=[];for(let e=0,t=O,s=1,n=0;e<24;e++){[s,n]=[n,(2*s+3*n)%5],Ge.push(2*(5*n+s)),Ze.push((e+1)*(e+2)/2%64);let r=hs;for(let i=0;i<7;i++)t=(t<<O^(t>>ps)*ms)%gs,t&ds&&(r^=O<<(O<<BigInt(i))-O);Qe.push(r)}const et=Zt(Qe,!0),ys=et[0],ws=et[1],tt=(e,t,s)=>s>32?ts(e,t,s):Qt(e,t,s),st=(e,t,s)=>s>32?ss(e,t,s):es(e,t,s);function bs(e,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)s[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=s[c],l=s[c+1],b=tt(u,l,1)^s[a],d=st(u,l,1)^s[a+1];for(let y=0;y<50;y+=10)e[o+y]^=b,e[o+y+1]^=d}let r=e[2],i=e[3];for(let o=0;o<24;o++){const a=Ze[o],c=tt(r,i,a),u=st(r,i,a),l=Ge[o];r=e[l],i=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}e[0]^=ys[n],e[1]^=ws[n]}Ye(s)}class ee extends ls{constructor(t,s,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=r,this.rounds=i,We(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=os(this.state)}clone(){return this._cloneInto()}keccak(){Xe(this.state32),bs(this.state32,this.rounds),Xe(this.state32),this.posOut=0,this.pos=0}update(t){Ve(this),t=Je(t),B(t);const{blockLen:s,state:n}=this,r=t.length;for(let i=0;i<r;){const o=Math.min(s-this.pos,r-i);for(let a=0;a<o;a++)n[this.pos++]^=t[i++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:r}=this;t[n]^=s,(s&128)!==0&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){Ve(this,!1),B(t),this.finish();const s=this.state,{blockLen:n}=this;for(let r=0,i=t.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);t.set(s.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return We(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(rs(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Ye(this.state)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new ee(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}}const Ss=(e,t,s)=>fs(()=>new ee(t,e,s)),Es=Ss(1,136,256/8);function Ts(e,t){return Es(G(e,{strict:!1})?Yt(e):e)}class Rs extends P{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class nt extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const s=super.get(t);return super.has(t)&&s!==void 0&&(this.delete(t),super.set(t,s)),s}set(t,s){if(super.set(t,s),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const te=new nt(8192);function rt(e,t){if(te.has(`${e}.${t}`))return te.get(`${e}.${t}`);const s=e.substring(2).toLowerCase(),n=Ts(He(s)),r=s.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&r[o]&&(r[o]=r[o].toUpperCase()),(n[o>>1]&15)>=8&&r[o+1]&&(r[o+1]=r[o+1].toUpperCase());const i=`0x${r.join("")}`;return te.set(`${e}.${t}`,i),i}function A(e,t){if(!vs(e,{strict:!1}))throw new Rs({address:e});return rt(e,t)}const As=/^0x[a-fA-F0-9]{40}$/,se=new nt(8192);function vs(e,t){const{strict:s=!0}=t??{},n=`${e}.${s}`;if(se.has(n))return se.get(n);const r=As.test(e)?e.toLowerCase()===e?!0:s?rt(e)===e:!0:!1;return se.set(n,r),r}const Ps={chainId:Ue.chainId,address:A("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Is={chainId:Ce.chainId,address:A("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},Cs={chainId:_e.chainId,address:A("0x5425890298aed601595a70ab815c96711a31bc65"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Us={chainId:Me.chainId,address:A("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},ks={chainId:xe.chainId,address:A("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},xs={chainId:ke.chainId,address:A("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Os={chainId:Oe.chainId,address:A("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ds={chainId:Ne.chainId,address:A("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ns={chainId:De.chainId,address:A("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ms={chainId:$e.chainId,address:"0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},ot={ARBITRUM_MAINNET:{...Ce,tokens:{[T.USDC]:Is},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...Ue,explorer:"https://sepolia.arbiscan.io",tokens:{[T.USDC]:Ps}},AVALANCHE_MAINNET:{...Me,tokens:{[T.USDC]:Us},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{..._e,tokens:{[T.USDC]:Cs},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...ke,tokens:{[T.USDC]:xs},explorer:"https://basescan.org"},BASE_TESTNET:{...xe,tokens:{[T.USDC]:ks},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...Oe,tokens:{[T.USDC]:Os},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...De,tokens:{[T.USDC]:Ns},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...Ne,tokens:{[T.USDC]:Ds},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...$e,tokens:{[T.USDC]:Ms},explorer:""}};var L=(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))(L||{}),ne=(e=>(e.USDC="USDC",e))(ne||{});const _s=e=>{const t=e?.trim().toUpperCase();if(ot[t])return ot[t]};function $s(e,t){return _s(e)?.tokens[t]?.address}var re=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(re||{});class f{constructor({api_key:t,env:s,seesion_token:n}){this.api_key=t||"",this.sessionToken=n||"",this.env=s??re.PRODUCTION}static async config(t){if(!f.app){if(!t)throw new Error("Please provide an api_key");f.app=new f(t)}return t&&(t.api_key!==void 0&&(f.app.api_key=t.api_key),t.seesion_token!==void 0&&(f.app.sessionToken=t.seesion_token),t.env!==void 0&&(f.app.env=t.env)),f.app}static getApiKey(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return f.app.api_key}static getSessionToken(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return f.app.sessionToken}static getEnv(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return f.app.env==="internal"?"staging":f.app.env}static getBaseUrl(){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(f.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(t,s,n,r){if(!f.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const i=f.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",o=r&&r>0?"/pay/":"/deposit/",a=`_chain_/${t}/_token_/${s}/_to_/${n}${r?"/_amount_/"+r*100:""}`;return i+o+a}}let oe=null;function zs(){oe=jt.create({prefixUrl:f.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[e=>{const t=f.getSessionToken()||f.getApiKey();e.headers.set("Authorization",`Bearer ${t}`)}],afterResponse:[(e,t,s)=>s]},retry:{limit:2}})}function m(){return oe||zs(),oe}class Bs{async getById(t){return await m().get("intents/"+t).json()}async getForSender(t){return await m().get("intents/user/"+t).json()}async getForAddress(t){return await m().get("intents/address/"+t).json()}async getForSession(t){return await m().get("modal/sessions/intents/"+t).json()}async getAll(t){return await m().get("intents",{searchParams:t}).json()}async create(t){return await m().post("intents",{json:t}).json()}async createForSession(t){return await m().post("modal/sessions/intents",{json:t}).json()}async update(t,s){return await m().post("intents",{json:s}).json()}async triggerProcessing(t){return await m().post(`intents/${t}/trigger-processing`).json()}async triggerProcessingForSession(t){return await m().post(`modal/sessions/intents/${t}/process`).json()}}class Ls{async getFromSpecificBridge(t){return await m().get("quotes/single",{searchParams:t}).json()}async getFromAllBridges(t){return await m().get("quotes/multiple",{searchParams:t}).json()}async getBestAcrossBridges(t){return await m().get("quotes/best",{searchParams:t}).json()}async getAll(t){return await m().get("quotes/multi-source",{searchParams:t}).json()}async getAllForSession(t){return await m().get("modal/sessions/quotes",{searchParams:t}).json()}}class js{async getOptimalRoutes(t){return await m().get("router/optimal-route",{searchParams:t}).json()}async getAllSupportedBridges(){return await m().get("router/supported-bridges/all").json()}async getSupportedBridges(t){return await m().get("router/supported-bridges/route",{searchParams:t}).json()}async getSupportedRoutes(t,s){return await m().get("router/supported-bridges/bridge/"+t,{searchParams:s}).json()}}class qs{async getSupported(t){return await m().get("chains",{searchParams:t}).json()}}class Fs{async getClientInfo(){return await m().get("client/auth/client-info").json()}}class Hs{getSessionToken(t){const s={recipient:t.recipient,tokenOut:$s(L[t.destinationChain],ne[t.token]),destinationChain:L[t.destinationChain],amount:t.amount};return m().post("modal/sessions",{json:s}).json()}}const Ks={router:new js,quotes:new Ls,intents:new Bs,chains:new qs,client:new Fs,auth:new Hs};function it(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=it(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Ws(){for(var e,t,s=0,n="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=it(e))&&(n&&(n+=" "),n+=t);return n}function Vs(e){const{recipient:t,token:s,destinationChain:n,amount:r,isOpen:i,isPending:o,open:a,close:c,onCancel:u,onSuccess:l,data:b}=e,[d,y]=w.useState(!0),I=w.useRef(null);w.useEffect(()=>{h();const p=document.body.style.overflow;i?(document.body.style.overflow="hidden",document.body.style.overflow="hidden"):document.body.style.overflow=p||"";const g=E=>{E.data==="closed"&&(c(),u?.()),E.data==="completed"&&(window.setTimeout(c,2e3),l?.())};return window.addEventListener("message",g),()=>{document.body.style.overflow=p||"",window.removeEventListener("message",g)}},[i,u,l]);function me(){y(!1),h()}function h(){if(!b?.sessionToken)return;const p={type:"session",session_token:b.sessionToken,environment:f.getEnv()||re.PRODUCTION};I.current?.contentWindow?.postMessage(p,"https://app.chainrails.io"),I.current?.contentWindow?.postMessage(p,"https://chainrails-frontend-git-staging-horus-labs.vercel.app")}return b?.sessionToken?v.jsxs("div",{className:Ws("payment-modal-wrapper",d||o?"loading":"not-loading",i?"open":"closed"),children:[(d||o)&&v.jsx("div",{role:"status",className:"payment-modal-loader",children:v.jsxs("svg",{"aria-hidden":"true",className:"icon",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[v.jsx("path",{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",fill:"currentColor"}),v.jsx("path",{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",fill:"currentFill"})]})}),v.jsx("iframe",{allow:"clipboard-read *; clipboard-write *",src:f.getPayModalUrl(n,s,t,r),onLoad:me,className:`payment-modal ${d||o?"invisible":"visible"}`,"data-id":r,ref:I})]}):v.jsx(v.Fragment,{})}function Ys(e){return BigInt(e).toString()}const Xs=Symbol(),ie=Symbol(),D="a",at="f",ct="p",ut="c",lt="t",ae="h",N="w",ce="o",ue="k";let Js=(e,t)=>new Proxy(e,t);const le=Object.getPrototypeOf,fe=new WeakMap,ft=e=>e&&(fe.has(e)?fe.get(e):le(e)===Object.prototype||le(e)===Array.prototype),j=e=>typeof e=="object"&&e!==null,Gs=e=>Object.values(Object.getOwnPropertyDescriptors(e)).some(t=>!t.configurable&&!t.writable),Zs=e=>{if(Array.isArray(e))return Array.from(e);const t=Object.getOwnPropertyDescriptors(e);return Object.values(t).forEach(s=>{s.configurable=!0}),Object.create(le(e),t)},Qs=(e,t)=>{const s={[at]:t};let n=!1;const r=(a,c)=>{if(!n){let u=s[D].get(e);if(u||(u={},s[D].set(e,u)),a===N)u[N]=!0;else{let l=u[a];l||(l=new Set,u[a]=l),l.add(c)}}},i=()=>{n=!0,s[D].delete(e)},o={get(a,c){return c===ie?e:(r(ue,c),ht(Reflect.get(a,c),s[D],s[ut],s[lt]))},has(a,c){return c===Xs?(i(),!0):(r(ae,c),Reflect.has(a,c))},getOwnPropertyDescriptor(a,c){return r(ce,c),Reflect.getOwnPropertyDescriptor(a,c)},ownKeys(a){return r(N),Reflect.ownKeys(a)}};return t&&(o.set=o.deleteProperty=()=>!1),[o,s]},he=e=>e[ie]||e,ht=(e,t,s,n)=>{if(!ft(e))return e;let r=n&&n.get(e);if(!r){const c=he(e);Gs(c)?r=[c,Zs(c)]:r=[c],n?.set(e,r)}const[i,o]=r;let a=s&&s.get(i);return(!a||a[1][at]!==!!o)&&(a=Qs(i,!!o),a[1][ct]=Js(o||i,a[0]),s&&s.set(i,a)),a[1][D]=t,a[1][ut]=s,a[1][lt]=n,a[1][ct]},en=(e,t)=>{const s=Reflect.ownKeys(e),n=Reflect.ownKeys(t);return s.length!==n.length||s.some((r,i)=>r!==n[i])},dt=(e,t,s,n,r=Object.is)=>{if(r(e,t))return!1;if(!j(e)||!j(t))return!0;const i=s.get(he(e));if(!i)return!0;if(n){if(n.get(e)===t)return!1;n.set(e,t)}let o=null;for(const a of i[ae]||[])if(o=Reflect.has(e,a)!==Reflect.has(t,a),o)return o;if(i[N]===!0){if(o=en(e,t),o)return o}else for(const a of i[ce]||[]){const c=!!Reflect.getOwnPropertyDescriptor(e,a),u=!!Reflect.getOwnPropertyDescriptor(t,a);if(o=c!==u,o)return o}for(const a of i[ue]||[])if(o=dt(e[a],t[a],s,n,r),o)return o;if(o===null)throw new Error("invalid used");return o},tn=e=>ft(e)&&e[ie]||null,pt=(e,t=!0)=>{fe.set(e,t)},sn=(e,t,s)=>{const n=[],r=new WeakSet,i=(o,a)=>{var c,u,l;if(r.has(o))return;j(o)&&r.add(o);const b=j(o)&&t.get(he(o));if(b){if((c=b[ae])===null||c===void 0||c.forEach(d=>{const y=`:has(${String(d)})`;n.push(a?[...a,y]:[y])}),b[N]===!0){const d=":ownKeys";n.push(a?[...a,d]:[d])}else(u=b[ce])===null||u===void 0||u.forEach(d=>{const y=`:hasOwn(${String(d)})`;n.push(a?[...a,y]:[y])});(l=b[ue])===null||l===void 0||l.forEach(d=>{"value"in(Object.getOwnPropertyDescriptor(o,d)||{})&&i(o[d],a?[...a,d]:[d])})}else a&&n.push(a)};return i(e),n},q={},de=e=>typeof e=="object"&&e!==null,nn=e=>de(e)&&!pe.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),gt=(e,t)=>{const s=mt.get(e);if(s?.[0]===t)return s[1];const n=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return pt(n,!0),mt.set(e,[t,n]),Reflect.ownKeys(e).forEach(r=>{if(Object.getOwnPropertyDescriptor(n,r))return;const i=Reflect.get(e,r),{enumerable:o}=Reflect.getOwnPropertyDescriptor(e,r),a={value:i,enumerable:o,configurable:!0};if(pe.has(i))pt(i,!1);else if(U.has(i)){const[c,u]=U.get(i);a.value=gt(c,u())}Object.defineProperty(n,r,a)}),Object.preventExtensions(n)},rn=(e,t,s,n)=>({deleteProperty(r,i){const o=Reflect.get(r,i);s(i);const a=Reflect.deleteProperty(r,i);return a&&n(["delete",[i],o]),a},set(r,i,o,a){const c=!e()&&Reflect.has(r,i),u=Reflect.get(r,i,a);if(c&&(yt(u,o)||F.has(o)&&yt(u,F.get(o))))return!0;s(i),de(o)&&(o=tn(o)||o);const l=!U.has(o)&&an(o)?wt(o):o;return t(i,l),Reflect.set(r,i,l,a),n(["set",[i],o,u]),!0}}),U=new WeakMap,pe=new WeakSet,mt=new WeakMap,ge=[1],F=new WeakMap;let yt=Object.is,on=(e,t)=>new Proxy(e,t),an=nn,cn=gt,un=rn;function wt(e={}){if(!de(e))throw new Error("object required");const t=F.get(e);if(t)return t;let s=ge[0];const n=new Set,r=(h,p=++ge[0])=>{s!==p&&(i=s=p,n.forEach(g=>g(h,p)))};let i=s;const o=(h=ge[0])=>(i!==h&&(i=h,c.forEach(([p])=>{const g=p[1](h);g>s&&(s=g)})),s),a=h=>(p,g)=>{const E=[...p];E[1]=[h,...E[1]],r(E,g)},c=new Map,u=(h,p)=>{const g=!pe.has(p)&&U.get(p);if(g){if((q?"production":void 0)!=="production"&&c.has(h))throw new Error("prop listener already exists");if(n.size){const E=g[2](a(h));c.set(h,[g,E])}else c.set(h,[g])}},l=h=>{var p;const g=c.get(h);g&&(c.delete(h),(p=g[1])==null||p.call(g))},b=h=>(n.add(h),n.size===1&&c.forEach(([g,E],H)=>{if((q?"production":void 0)!=="production"&&E)throw new Error("remove already exists");const mn=g[2](a(H));c.set(H,[g,mn])}),()=>{n.delete(h),n.size===0&&c.forEach(([g,E],H)=>{E&&(E(),c.set(H,[g]))})});let d=!0;const y=un(()=>d,u,l,r),I=on(e,y);F.set(e,I);const me=[e,o,b];return U.set(I,me),Reflect.ownKeys(e).forEach(h=>{const p=Object.getOwnPropertyDescriptor(e,h);"value"in p&&p.writable&&(I[h]=e[h])}),d=!1,I}function ln(e,t,s){const n=U.get(e);(q?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let r;const i=[],o=n[2];let a=!1;const u=o(l=>{i.push(l),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,u()}}function bt(e){const t=U.get(e);(q?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[s,n]=t;return cn(s,n())}const fn={},hn=(e,t)=>{const s=w.useRef(void 0);w.useEffect(()=>{s.current=sn(e,t)}),w.useDebugValue(s.current)},dn=new WeakMap;function pn(e,t){const n=w.useMemo(()=>e&&new WeakMap,[e]),r=w.useRef(void 0);let i=!0;const o=w.useSyncExternalStore(w.useCallback(c=>{const u=ln(e,c);return c(),u},[e,void 0]),()=>{const c=bt(e);try{if(!i&&r.current&&!dt(r.current,c,n,new WeakMap))return r.current}catch{}return c},()=>bt(e));i=!1,w.useLayoutEffect(()=>{r.current=o}),(fn?"production":void 0)!=="production"&&hn(o,n);const a=w.useMemo(()=>new WeakMap,[]);return ht(o,n,a,dn)}const k=wt({data:null,isPending:!1,error:null});function gn({session_url:e,destinationChain:t,token:s,amount:n,recipient:r,onCancel:i,onSuccess:o}){const a=pn(k),[c,u]=w.useState(!1);function l(){u(!0)}function b(){u(!1)}const d=()=>{k.isPending=!0,k.error=null,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinationChain:t?.replace("_MAINNET",""),token:s,amount:n?Ys(n):"0",recipient:r})}).then(y=>y.json()).then(y=>{k.data=y,f.config({api_key:y.sessionToken}),k.isPending=!1}).catch(y=>{k.error=y?.toString(),k.isPending=!1})};return w.useEffect(()=>{d()},[t,s,n,r]),{...a,destinationChain:t,token:s,recipient:r,isOpen:c,open:l,close:b,refetch:d,onSuccess:o,onCancel:i}}S.Chainrails=f,S.PaymentModal=Vs,S.chains=L,S.crapi=Ks,S.tokens=ne,S.usePaymentSession=gn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|