@chainrails/react 0.1.16 → 0.1.17
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/PaymentModal/index.d.ts +6 -0
- package/dist/PaymentModal/index.d.ts.map +1 -1
- package/dist/chainrails-sdk.es.js +65 -63
- package/dist/chainrails-sdk.es.mjs +65 -63
- package/dist/chainrails-sdk.umd.js +2 -2
- package/dist/hooks/usePaymentSession.d.ts +1 -0
- package/dist/hooks/usePaymentSession.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Chainrails } from "@chainrails/sdk";
|
|
1
2
|
import React from "react";
|
|
2
3
|
type PaymentModalProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
4
|
recipient: string;
|
|
@@ -18,5 +19,10 @@ type PaymentModalProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
18
19
|
onSuccess?: () => void;
|
|
19
20
|
};
|
|
20
21
|
export declare function PaymentModal(props: PaymentModalProps): JSX.Element;
|
|
22
|
+
declare global {
|
|
23
|
+
interface Window {
|
|
24
|
+
chainrails: Chainrails;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
21
27
|
export {};
|
|
22
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaymentModal/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaymentModal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAe,MAAM,iBAAiB,CAAC;AAE1D,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAuGpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as L, useRef as re, useEffect as oe, useMemo as be, useSyncExternalStore as At, useCallback as vt, useLayoutEffect as Pt, useDebugValue as It } from "react";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as x, Fragment as Ut, jsxs as Ee } from "react/jsx-runtime";
|
|
3
3
|
import './index.css';class G extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
@@ -164,9 +164,9 @@ const Nt = (e) => new je(e), Mt = {
|
|
|
164
164
|
duplex: "half",
|
|
165
165
|
body: qe(e.body, n, t)
|
|
166
166
|
});
|
|
167
|
-
},
|
|
167
|
+
}, C = (e) => e !== null && typeof e == "object", B = (...e) => {
|
|
168
168
|
for (const t of e)
|
|
169
|
-
if ((!
|
|
169
|
+
if ((!C(t) || Array.isArray(t)) && t !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
171
|
return ie({}, ...e);
|
|
172
172
|
}, Fe = (e = {}, t = {}) => {
|
|
@@ -196,7 +196,7 @@ const He = (e = {}, t = {}) => ({
|
|
|
196
196
|
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
197
197
|
s.append(String(r[0]), String(r[1]));
|
|
198
198
|
}
|
|
199
|
-
else if (
|
|
199
|
+
else if (C(n))
|
|
200
200
|
for (const [r, i] of Object.entries(n))
|
|
201
201
|
i !== void 0 && s.append(r, String(i));
|
|
202
202
|
else {
|
|
@@ -211,14 +211,14 @@ const He = (e = {}, t = {}) => ({
|
|
|
211
211
|
for (const o of e)
|
|
212
212
|
if (Array.isArray(o))
|
|
213
213
|
Array.isArray(t) || (t = []), t = [...t, ...o];
|
|
214
|
-
else if (
|
|
214
|
+
else if (C(o)) {
|
|
215
215
|
for (let [a, c] of Object.entries(o)) {
|
|
216
216
|
if (a === "signal" && c instanceof globalThis.AbortSignal) {
|
|
217
217
|
i.push(c);
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
220
|
if (a === "context") {
|
|
221
|
-
if (c != null && (!
|
|
221
|
+
if (c != null && (!C(c) || Array.isArray(c)))
|
|
222
222
|
throw new TypeError("The `context` option must be an object");
|
|
223
223
|
t = {
|
|
224
224
|
...t,
|
|
@@ -230,9 +230,9 @@ const He = (e = {}, t = {}) => ({
|
|
|
230
230
|
c == null ? r = void 0 : r = r === void 0 ? c : jt(r, c);
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
C(c) && a in t && (c = ie(t[a], c)), t = { ...t, [a]: c };
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
C(o.hooks) && (n = He(n, o.hooks), t.hooks = n), C(o.headers) && (s = Fe(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] : _e ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
|
|
238
238
|
}, qt = (e) => Le.includes(e) ? e.toUpperCase() : e, Ft = ["get", "put", "head", "delete", "options", "trace"], Ht = [408, 413, 429, 500, 502, 503, 504], Kt = [413, 429, 503], Te = {
|
|
@@ -299,9 +299,9 @@ function Gt(e) {
|
|
|
299
299
|
function Zt(e) {
|
|
300
300
|
return e instanceof Z || e?.name === Z.name;
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class M {
|
|
303
303
|
static create(t, s) {
|
|
304
|
-
const n = new
|
|
304
|
+
const n = new M(t, s), r = async () => {
|
|
305
305
|
if (typeof n.#e.timeout == "number" && n.#e.timeout > W)
|
|
306
306
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${W}`);
|
|
307
307
|
await Promise.resolve();
|
|
@@ -388,7 +388,7 @@ class N {
|
|
|
388
388
|
Ct && _e && (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), Se && (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
390
|
if (this.#t instanceof globalThis.Request && (xt && 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), Jt(this.#e.searchParams)) {
|
|
391
|
-
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(
|
|
391
|
+
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(M.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
392
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
393
393
|
}
|
|
394
394
|
if (this.#e.onUploadProgress) {
|
|
@@ -499,9 +499,9 @@ class N {
|
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const Q = (e) => {
|
|
502
|
-
const t = (s, n) =>
|
|
502
|
+
const t = (s, n) => M.create(s, B(e, n));
|
|
503
503
|
for (const s of Le)
|
|
504
|
-
t[s] = (n, r) =>
|
|
504
|
+
t[s] = (n, r) => M.create(n, B(e, r, { method: s }));
|
|
505
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 = Nt, t;
|
|
506
506
|
}, Qt = Q();
|
|
507
507
|
var E = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(E || {});
|
|
@@ -816,12 +816,12 @@ function Rs(e) {
|
|
|
816
816
|
const t = (n) => e().update(at(n)).digest(), s = e();
|
|
817
817
|
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
818
818
|
}
|
|
819
|
-
const As = BigInt(0),
|
|
820
|
-
for (let e = 0, t =
|
|
819
|
+
const As = BigInt(0), D = BigInt(1), vs = BigInt(2), Ps = BigInt(7), Is = BigInt(256), Us = BigInt(113), ct = [], ut = [], lt = [];
|
|
820
|
+
for (let e = 0, t = D, s = 1, n = 0; e < 24; e++) {
|
|
821
821
|
[s, n] = [n, (2 * s + 3 * n) % 5], ct.push(2 * (5 * n + s)), ut.push((e + 1) * (e + 2) / 2 % 64);
|
|
822
822
|
let r = As;
|
|
823
823
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
t = (t <<
|
|
824
|
+
t = (t << D ^ (t >> Ps) * Us) % Is, t & vs && (r ^= D << (D << /* @__PURE__ */ BigInt(i)) - D);
|
|
825
825
|
lt.push(r);
|
|
826
826
|
}
|
|
827
827
|
const ft = ls(lt, !0), Cs = ft[0], ks = ft[1], Ce = (e, t, s) => s > 32 ? ds(e, t, s) : fs(e, t, s), ke = (e, t, s) => s > 32 ? ps(e, t, s) : hs(e, t, s);
|
|
@@ -1326,37 +1326,38 @@ function Cn(e) {
|
|
|
1326
1326
|
onSuccess: f,
|
|
1327
1327
|
session_url: w,
|
|
1328
1328
|
data: d
|
|
1329
|
-
} = e, [y, S] = L(!0), [
|
|
1329
|
+
} = e, [y, S] = L(!0), [T, l] = L(null), m = re(null);
|
|
1330
1330
|
oe(() => {
|
|
1331
1331
|
b();
|
|
1332
|
-
const
|
|
1333
|
-
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
1334
|
-
const
|
|
1332
|
+
const R = document.body.style.overflow;
|
|
1333
|
+
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = R || "";
|
|
1334
|
+
const I = (we) => {
|
|
1335
1335
|
we.data === "closed" && (c(), u?.()), we.data === "completed" && (window.setTimeout(c, 2e3), f?.());
|
|
1336
1336
|
};
|
|
1337
|
-
return window.addEventListener("message",
|
|
1338
|
-
document.body.style.overflow =
|
|
1337
|
+
return window.addEventListener("message", I), () => {
|
|
1338
|
+
document.body.style.overflow = R || "", window.removeEventListener("message", I);
|
|
1339
1339
|
};
|
|
1340
1340
|
}, [i, u, f, d?.sessionToken]);
|
|
1341
1341
|
function p() {
|
|
1342
1342
|
S(!1), b();
|
|
1343
1343
|
}
|
|
1344
|
-
function b() {
|
|
1344
|
+
async function b() {
|
|
1345
1345
|
if (!d?.sessionToken) return;
|
|
1346
|
-
h.config({
|
|
1346
|
+
const R = await h.config({
|
|
1347
1347
|
api_key: d?.sessionToken || "",
|
|
1348
1348
|
env: w === "https://chainrails-sdk-server.vercel.app/test/create-session" ? "internal" : "production"
|
|
1349
|
-
})
|
|
1350
|
-
|
|
1349
|
+
});
|
|
1350
|
+
l(h.getPayModalUrl(n, s, t, r));
|
|
1351
|
+
const I = {
|
|
1351
1352
|
type: "session",
|
|
1352
1353
|
session_token: d.sessionToken,
|
|
1353
1354
|
environment: h.getEnv() || le.PRODUCTION
|
|
1354
1355
|
};
|
|
1355
|
-
m.current?.contentWindow?.postMessage(
|
|
1356
|
+
window.chainrails = R, m.current?.contentWindow?.postMessage(I, "https://app.chainrails.io"), m.current?.contentWindow?.postMessage(I, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1356
1357
|
}
|
|
1357
1358
|
return d?.sessionToken ? /* @__PURE__ */ Ee("div", {
|
|
1358
1359
|
className: nn("payment-modal-wrapper", y || o ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
1359
|
-
children: [(y || o) && /* @__PURE__ */
|
|
1360
|
+
children: [(y || o) && /* @__PURE__ */ x("div", {
|
|
1360
1361
|
role: "status",
|
|
1361
1362
|
className: "payment-modal-loader",
|
|
1362
1363
|
children: /* @__PURE__ */ Ee("svg", {
|
|
@@ -1365,28 +1366,28 @@ function Cn(e) {
|
|
|
1365
1366
|
viewBox: "0 0 100 101",
|
|
1366
1367
|
fill: "none",
|
|
1367
1368
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1368
|
-
children: [/* @__PURE__ */
|
|
1369
|
+
children: [/* @__PURE__ */ x("path", {
|
|
1369
1370
|
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",
|
|
1370
1371
|
fill: "currentColor"
|
|
1371
|
-
}), /* @__PURE__ */
|
|
1372
|
+
}), /* @__PURE__ */ x("path", {
|
|
1372
1373
|
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",
|
|
1373
1374
|
fill: "currentFill"
|
|
1374
1375
|
})]
|
|
1375
1376
|
})
|
|
1376
|
-
}),
|
|
1377
|
+
}), T ? /* @__PURE__ */ x("iframe", {
|
|
1377
1378
|
allow: "clipboard-read *; clipboard-write *",
|
|
1378
|
-
src:
|
|
1379
|
+
src: T,
|
|
1379
1380
|
onLoad: p,
|
|
1380
1381
|
className: `payment-modal ${y || o ? "invisible" : "visible"}`,
|
|
1381
1382
|
"data-id": r,
|
|
1382
1383
|
ref: m
|
|
1383
1384
|
}) : null]
|
|
1384
|
-
}) : /* @__PURE__ */
|
|
1385
|
+
}) : /* @__PURE__ */ x(Ut, {});
|
|
1385
1386
|
}
|
|
1386
1387
|
function rn(e) {
|
|
1387
1388
|
return BigInt(e).toString();
|
|
1388
1389
|
}
|
|
1389
|
-
const on = Symbol(), fe = Symbol(),
|
|
1390
|
+
const on = Symbol(), fe = Symbol(), O = "a", mt = "f", De = "p", yt = "c", wt = "t", he = "h", N = "w", de = "o", pe = "k";
|
|
1390
1391
|
let an = (e, t) => new Proxy(e, t);
|
|
1391
1392
|
const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) => e && (ne.has(e) ? ne.get(e) : se(e) === Object.prototype || se(e) === Array.prototype), j = (e) => typeof e == "object" && e !== null, cn = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), un = (e) => {
|
|
1392
1393
|
if (Array.isArray(e))
|
|
@@ -1402,19 +1403,19 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1402
1403
|
let n = !1;
|
|
1403
1404
|
const r = (a, c) => {
|
|
1404
1405
|
if (!n) {
|
|
1405
|
-
let u = s[
|
|
1406
|
-
if (u || (u = {}, s[
|
|
1407
|
-
u[
|
|
1406
|
+
let u = s[O].get(e);
|
|
1407
|
+
if (u || (u = {}, s[O].set(e, u)), a === N)
|
|
1408
|
+
u[N] = !0;
|
|
1408
1409
|
else {
|
|
1409
1410
|
let f = u[a];
|
|
1410
1411
|
f || (f = /* @__PURE__ */ new Set(), u[a] = f), f.add(c);
|
|
1411
1412
|
}
|
|
1412
1413
|
}
|
|
1413
1414
|
}, i = () => {
|
|
1414
|
-
n = !0, s[
|
|
1415
|
+
n = !0, s[O].delete(e);
|
|
1415
1416
|
}, o = {
|
|
1416
1417
|
get(a, c) {
|
|
1417
|
-
return c === fe ? e : (r(pe, c), Et(Reflect.get(a, c), s[
|
|
1418
|
+
return c === fe ? e : (r(pe, c), Et(Reflect.get(a, c), s[O], s[yt], s[wt]));
|
|
1418
1419
|
},
|
|
1419
1420
|
has(a, c) {
|
|
1420
1421
|
return c === on ? (i(), !0) : (r(he, c), Reflect.has(a, c));
|
|
@@ -1423,7 +1424,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1423
1424
|
return r(de, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
1424
1425
|
},
|
|
1425
1426
|
ownKeys(a) {
|
|
1426
|
-
return r(
|
|
1427
|
+
return r(N), Reflect.ownKeys(a);
|
|
1427
1428
|
}
|
|
1428
1429
|
};
|
|
1429
1430
|
return t && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
@@ -1441,7 +1442,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1441
1442
|
}
|
|
1442
1443
|
const [i, o] = r;
|
|
1443
1444
|
let a = s && s.get(i);
|
|
1444
|
-
return (!a || a[1][mt] !== !!o) && (a = ln(i, !!o), a[1][De] = an(o || i, a[0]), s && s.set(i, a)), a[1][
|
|
1445
|
+
return (!a || a[1][mt] !== !!o) && (a = ln(i, !!o), a[1][De] = an(o || i, a[0]), s && s.set(i, a)), a[1][O] = t, a[1][yt] = s, a[1][wt] = n, a[1][De];
|
|
1445
1446
|
}, fn = (e, t) => {
|
|
1446
1447
|
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1447
1448
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
@@ -1462,7 +1463,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1462
1463
|
for (const a of i[he] || [])
|
|
1463
1464
|
if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
|
|
1464
1465
|
return o;
|
|
1465
|
-
if (i[
|
|
1466
|
+
if (i[N] === !0) {
|
|
1466
1467
|
if (o = fn(e, t), o)
|
|
1467
1468
|
return o;
|
|
1468
1469
|
} else
|
|
@@ -1490,7 +1491,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1490
1491
|
if ((c = w[he]) === null || c === void 0 || c.forEach((d) => {
|
|
1491
1492
|
const y = `:has(${String(d)})`;
|
|
1492
1493
|
n.push(a ? [...a, y] : [y]);
|
|
1493
|
-
}), w[
|
|
1494
|
+
}), w[N] === !0) {
|
|
1494
1495
|
const d = ":ownKeys";
|
|
1495
1496
|
n.push(a ? [...a, d] : [d]);
|
|
1496
1497
|
} else
|
|
@@ -1524,8 +1525,8 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1524
1525
|
};
|
|
1525
1526
|
if (ye.has(i))
|
|
1526
1527
|
Oe(i, !1);
|
|
1527
|
-
else if (
|
|
1528
|
-
const [c, u] =
|
|
1528
|
+
else if (k.has(i)) {
|
|
1529
|
+
const [c, u] = k.get(
|
|
1529
1530
|
i
|
|
1530
1531
|
);
|
|
1531
1532
|
a.value = Tt(c, u());
|
|
@@ -1544,10 +1545,10 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1544
1545
|
if (c && (Me(u, o) || F.has(o) && Me(u, F.get(o))))
|
|
1545
1546
|
return !0;
|
|
1546
1547
|
s(i), me(o) && (o = hn(o) || o);
|
|
1547
|
-
const f = !
|
|
1548
|
+
const f = !k.has(o) && yn(o) ? Rt(o) : o;
|
|
1548
1549
|
return t(i, f), Reflect.set(r, i, f, a), n(["set", [i], o, u]), !0;
|
|
1549
1550
|
}
|
|
1550
|
-
}),
|
|
1551
|
+
}), k = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new WeakMap(), J = [1], F = /* @__PURE__ */ new WeakMap();
|
|
1551
1552
|
let Me = Object.is, mn = (e, t) => new Proxy(e, t), yn = pn, wn = Tt, bn = gn;
|
|
1552
1553
|
function Rt(e = {}) {
|
|
1553
1554
|
if (!me(e))
|
|
@@ -1567,7 +1568,7 @@ function Rt(e = {}) {
|
|
|
1567
1568
|
const b = [...m];
|
|
1568
1569
|
b[1] = [l, ...b[1]], r(b, p);
|
|
1569
1570
|
}, c = /* @__PURE__ */ new Map(), u = (l, m) => {
|
|
1570
|
-
const p = !ye.has(m) &&
|
|
1571
|
+
const p = !ye.has(m) && k.get(m);
|
|
1571
1572
|
if (p) {
|
|
1572
1573
|
if ((q ? "production" : void 0) !== "production" && c.has(l))
|
|
1573
1574
|
throw new Error("prop listener already exists");
|
|
@@ -1581,14 +1582,14 @@ function Rt(e = {}) {
|
|
|
1581
1582
|
var m;
|
|
1582
1583
|
const p = c.get(l);
|
|
1583
1584
|
p && (c.delete(l), (m = p[1]) == null || m.call(p));
|
|
1584
|
-
}, w = (l) => (n.add(l), n.size === 1 && c.forEach(([p, b],
|
|
1585
|
+
}, w = (l) => (n.add(l), n.size === 1 && c.forEach(([p, b], R) => {
|
|
1585
1586
|
if ((q ? "production" : void 0) !== "production" && b)
|
|
1586
1587
|
throw new Error("remove already exists");
|
|
1587
|
-
const
|
|
1588
|
-
c.set(
|
|
1588
|
+
const I = p[2](a(R));
|
|
1589
|
+
c.set(R, [p, I]);
|
|
1589
1590
|
}), () => {
|
|
1590
|
-
n.delete(l), n.size === 0 && c.forEach(([p, b],
|
|
1591
|
-
b && (b(), c.set(
|
|
1591
|
+
n.delete(l), n.size === 0 && c.forEach(([p, b], R) => {
|
|
1592
|
+
b && (b(), c.set(R, [p]));
|
|
1592
1593
|
});
|
|
1593
1594
|
});
|
|
1594
1595
|
let d = !0;
|
|
@@ -1599,8 +1600,8 @@ function Rt(e = {}) {
|
|
|
1599
1600
|
r
|
|
1600
1601
|
), S = mn(e, y);
|
|
1601
1602
|
F.set(e, S);
|
|
1602
|
-
const
|
|
1603
|
-
return
|
|
1603
|
+
const T = [e, o, w];
|
|
1604
|
+
return k.set(S, T), Reflect.ownKeys(e).forEach((l) => {
|
|
1604
1605
|
const m = Object.getOwnPropertyDescriptor(
|
|
1605
1606
|
e,
|
|
1606
1607
|
l
|
|
@@ -1609,7 +1610,7 @@ function Rt(e = {}) {
|
|
|
1609
1610
|
}), d = !1, S;
|
|
1610
1611
|
}
|
|
1611
1612
|
function En(e, t, s) {
|
|
1612
|
-
const n =
|
|
1613
|
+
const n = k.get(e);
|
|
1613
1614
|
(q ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1614
1615
|
let r;
|
|
1615
1616
|
const i = [], o = n[2];
|
|
@@ -1624,7 +1625,7 @@ function En(e, t, s) {
|
|
|
1624
1625
|
};
|
|
1625
1626
|
}
|
|
1626
1627
|
function Be(e) {
|
|
1627
|
-
const t =
|
|
1628
|
+
const t = k.get(e);
|
|
1628
1629
|
(q ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1629
1630
|
const [s, n] = t;
|
|
1630
1631
|
return wn(s, n());
|
|
@@ -1671,7 +1672,7 @@ function vn(e, t) {
|
|
|
1671
1672
|
const a = be(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1672
1673
|
return Et(o, n, a, An);
|
|
1673
1674
|
}
|
|
1674
|
-
const
|
|
1675
|
+
const U = Rt({
|
|
1675
1676
|
data: null,
|
|
1676
1677
|
isPending: !1,
|
|
1677
1678
|
error: null
|
|
@@ -1685,7 +1686,7 @@ function kn({
|
|
|
1685
1686
|
onCancel: i,
|
|
1686
1687
|
onSuccess: o
|
|
1687
1688
|
}) {
|
|
1688
|
-
const a = vn(
|
|
1689
|
+
const a = vn(U), [c, u] = L(!1), [f, w] = L(Date.now());
|
|
1689
1690
|
function d() {
|
|
1690
1691
|
u(!0);
|
|
1691
1692
|
}
|
|
@@ -1693,8 +1694,8 @@ function kn({
|
|
|
1693
1694
|
u(!1), S();
|
|
1694
1695
|
}
|
|
1695
1696
|
const S = () => {
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1697
|
+
const T = Date.now();
|
|
1698
|
+
U.isPending = !0, U.error = null, fetch(e, {
|
|
1698
1699
|
method: "POST",
|
|
1699
1700
|
headers: {
|
|
1700
1701
|
"Content-Type": "application/json"
|
|
@@ -1706,15 +1707,16 @@ function kn({
|
|
|
1706
1707
|
recipient: r
|
|
1707
1708
|
})
|
|
1708
1709
|
}).then((l) => l.json()).then((l) => {
|
|
1709
|
-
|
|
1710
|
+
T < f || (U.data = l, U.isPending = !1, w(T));
|
|
1710
1711
|
}).catch((l) => {
|
|
1711
|
-
|
|
1712
|
+
T < f || (U.error = l?.toString(), U.isPending = !1, w(T));
|
|
1712
1713
|
});
|
|
1713
1714
|
};
|
|
1714
1715
|
return oe(() => {
|
|
1715
1716
|
S();
|
|
1716
1717
|
}, [t, s, n, r, e]), {
|
|
1717
1718
|
...a,
|
|
1719
|
+
amount: n,
|
|
1718
1720
|
destinationChain: t,
|
|
1719
1721
|
token: s,
|
|
1720
1722
|
recipient: r,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as L, useRef as re, useEffect as oe, useMemo as be, useSyncExternalStore as At, useCallback as vt, useLayoutEffect as Pt, useDebugValue as It } from "react";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as x, Fragment as Ut, jsxs as Ee } from "react/jsx-runtime";
|
|
3
3
|
import './index.css';class G extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
@@ -164,9 +164,9 @@ const Nt = (e) => new je(e), Mt = {
|
|
|
164
164
|
duplex: "half",
|
|
165
165
|
body: qe(e.body, n, t)
|
|
166
166
|
});
|
|
167
|
-
},
|
|
167
|
+
}, C = (e) => e !== null && typeof e == "object", B = (...e) => {
|
|
168
168
|
for (const t of e)
|
|
169
|
-
if ((!
|
|
169
|
+
if ((!C(t) || Array.isArray(t)) && t !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
171
|
return ie({}, ...e);
|
|
172
172
|
}, Fe = (e = {}, t = {}) => {
|
|
@@ -196,7 +196,7 @@ const He = (e = {}, t = {}) => ({
|
|
|
196
196
|
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
197
197
|
s.append(String(r[0]), String(r[1]));
|
|
198
198
|
}
|
|
199
|
-
else if (
|
|
199
|
+
else if (C(n))
|
|
200
200
|
for (const [r, i] of Object.entries(n))
|
|
201
201
|
i !== void 0 && s.append(r, String(i));
|
|
202
202
|
else {
|
|
@@ -211,14 +211,14 @@ const He = (e = {}, t = {}) => ({
|
|
|
211
211
|
for (const o of e)
|
|
212
212
|
if (Array.isArray(o))
|
|
213
213
|
Array.isArray(t) || (t = []), t = [...t, ...o];
|
|
214
|
-
else if (
|
|
214
|
+
else if (C(o)) {
|
|
215
215
|
for (let [a, c] of Object.entries(o)) {
|
|
216
216
|
if (a === "signal" && c instanceof globalThis.AbortSignal) {
|
|
217
217
|
i.push(c);
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
220
|
if (a === "context") {
|
|
221
|
-
if (c != null && (!
|
|
221
|
+
if (c != null && (!C(c) || Array.isArray(c)))
|
|
222
222
|
throw new TypeError("The `context` option must be an object");
|
|
223
223
|
t = {
|
|
224
224
|
...t,
|
|
@@ -230,9 +230,9 @@ const He = (e = {}, t = {}) => ({
|
|
|
230
230
|
c == null ? r = void 0 : r = r === void 0 ? c : jt(r, c);
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
C(c) && a in t && (c = ie(t[a], c)), t = { ...t, [a]: c };
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
C(o.hooks) && (n = He(n, o.hooks), t.hooks = n), C(o.headers) && (s = Fe(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] : _e ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
|
|
238
238
|
}, qt = (e) => Le.includes(e) ? e.toUpperCase() : e, Ft = ["get", "put", "head", "delete", "options", "trace"], Ht = [408, 413, 429, 500, 502, 503, 504], Kt = [413, 429, 503], Te = {
|
|
@@ -299,9 +299,9 @@ function Gt(e) {
|
|
|
299
299
|
function Zt(e) {
|
|
300
300
|
return e instanceof Z || e?.name === Z.name;
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class M {
|
|
303
303
|
static create(t, s) {
|
|
304
|
-
const n = new
|
|
304
|
+
const n = new M(t, s), r = async () => {
|
|
305
305
|
if (typeof n.#e.timeout == "number" && n.#e.timeout > W)
|
|
306
306
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${W}`);
|
|
307
307
|
await Promise.resolve();
|
|
@@ -388,7 +388,7 @@ class N {
|
|
|
388
388
|
Ct && _e && (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), Se && (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
390
|
if (this.#t instanceof globalThis.Request && (xt && 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), Jt(this.#e.searchParams)) {
|
|
391
|
-
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(
|
|
391
|
+
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(M.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
392
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
393
393
|
}
|
|
394
394
|
if (this.#e.onUploadProgress) {
|
|
@@ -499,9 +499,9 @@ class N {
|
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const Q = (e) => {
|
|
502
|
-
const t = (s, n) =>
|
|
502
|
+
const t = (s, n) => M.create(s, B(e, n));
|
|
503
503
|
for (const s of Le)
|
|
504
|
-
t[s] = (n, r) =>
|
|
504
|
+
t[s] = (n, r) => M.create(n, B(e, r, { method: s }));
|
|
505
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 = Nt, t;
|
|
506
506
|
}, Qt = Q();
|
|
507
507
|
var E = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(E || {});
|
|
@@ -816,12 +816,12 @@ function Rs(e) {
|
|
|
816
816
|
const t = (n) => e().update(at(n)).digest(), s = e();
|
|
817
817
|
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
818
818
|
}
|
|
819
|
-
const As = BigInt(0),
|
|
820
|
-
for (let e = 0, t =
|
|
819
|
+
const As = BigInt(0), D = BigInt(1), vs = BigInt(2), Ps = BigInt(7), Is = BigInt(256), Us = BigInt(113), ct = [], ut = [], lt = [];
|
|
820
|
+
for (let e = 0, t = D, s = 1, n = 0; e < 24; e++) {
|
|
821
821
|
[s, n] = [n, (2 * s + 3 * n) % 5], ct.push(2 * (5 * n + s)), ut.push((e + 1) * (e + 2) / 2 % 64);
|
|
822
822
|
let r = As;
|
|
823
823
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
t = (t <<
|
|
824
|
+
t = (t << D ^ (t >> Ps) * Us) % Is, t & vs && (r ^= D << (D << /* @__PURE__ */ BigInt(i)) - D);
|
|
825
825
|
lt.push(r);
|
|
826
826
|
}
|
|
827
827
|
const ft = ls(lt, !0), Cs = ft[0], ks = ft[1], Ce = (e, t, s) => s > 32 ? ds(e, t, s) : fs(e, t, s), ke = (e, t, s) => s > 32 ? ps(e, t, s) : hs(e, t, s);
|
|
@@ -1326,37 +1326,38 @@ function Cn(e) {
|
|
|
1326
1326
|
onSuccess: f,
|
|
1327
1327
|
session_url: w,
|
|
1328
1328
|
data: d
|
|
1329
|
-
} = e, [y, S] = L(!0), [
|
|
1329
|
+
} = e, [y, S] = L(!0), [T, l] = L(null), m = re(null);
|
|
1330
1330
|
oe(() => {
|
|
1331
1331
|
b();
|
|
1332
|
-
const
|
|
1333
|
-
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
1334
|
-
const
|
|
1332
|
+
const R = document.body.style.overflow;
|
|
1333
|
+
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = R || "";
|
|
1334
|
+
const I = (we) => {
|
|
1335
1335
|
we.data === "closed" && (c(), u?.()), we.data === "completed" && (window.setTimeout(c, 2e3), f?.());
|
|
1336
1336
|
};
|
|
1337
|
-
return window.addEventListener("message",
|
|
1338
|
-
document.body.style.overflow =
|
|
1337
|
+
return window.addEventListener("message", I), () => {
|
|
1338
|
+
document.body.style.overflow = R || "", window.removeEventListener("message", I);
|
|
1339
1339
|
};
|
|
1340
1340
|
}, [i, u, f, d?.sessionToken]);
|
|
1341
1341
|
function p() {
|
|
1342
1342
|
S(!1), b();
|
|
1343
1343
|
}
|
|
1344
|
-
function b() {
|
|
1344
|
+
async function b() {
|
|
1345
1345
|
if (!d?.sessionToken) return;
|
|
1346
|
-
h.config({
|
|
1346
|
+
const R = await h.config({
|
|
1347
1347
|
api_key: d?.sessionToken || "",
|
|
1348
1348
|
env: w === "https://chainrails-sdk-server.vercel.app/test/create-session" ? "internal" : "production"
|
|
1349
|
-
})
|
|
1350
|
-
|
|
1349
|
+
});
|
|
1350
|
+
l(h.getPayModalUrl(n, s, t, r));
|
|
1351
|
+
const I = {
|
|
1351
1352
|
type: "session",
|
|
1352
1353
|
session_token: d.sessionToken,
|
|
1353
1354
|
environment: h.getEnv() || le.PRODUCTION
|
|
1354
1355
|
};
|
|
1355
|
-
m.current?.contentWindow?.postMessage(
|
|
1356
|
+
window.chainrails = R, m.current?.contentWindow?.postMessage(I, "https://app.chainrails.io"), m.current?.contentWindow?.postMessage(I, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1356
1357
|
}
|
|
1357
1358
|
return d?.sessionToken ? /* @__PURE__ */ Ee("div", {
|
|
1358
1359
|
className: nn("payment-modal-wrapper", y || o ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
1359
|
-
children: [(y || o) && /* @__PURE__ */
|
|
1360
|
+
children: [(y || o) && /* @__PURE__ */ x("div", {
|
|
1360
1361
|
role: "status",
|
|
1361
1362
|
className: "payment-modal-loader",
|
|
1362
1363
|
children: /* @__PURE__ */ Ee("svg", {
|
|
@@ -1365,28 +1366,28 @@ function Cn(e) {
|
|
|
1365
1366
|
viewBox: "0 0 100 101",
|
|
1366
1367
|
fill: "none",
|
|
1367
1368
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1368
|
-
children: [/* @__PURE__ */
|
|
1369
|
+
children: [/* @__PURE__ */ x("path", {
|
|
1369
1370
|
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",
|
|
1370
1371
|
fill: "currentColor"
|
|
1371
|
-
}), /* @__PURE__ */
|
|
1372
|
+
}), /* @__PURE__ */ x("path", {
|
|
1372
1373
|
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",
|
|
1373
1374
|
fill: "currentFill"
|
|
1374
1375
|
})]
|
|
1375
1376
|
})
|
|
1376
|
-
}),
|
|
1377
|
+
}), T ? /* @__PURE__ */ x("iframe", {
|
|
1377
1378
|
allow: "clipboard-read *; clipboard-write *",
|
|
1378
|
-
src:
|
|
1379
|
+
src: T,
|
|
1379
1380
|
onLoad: p,
|
|
1380
1381
|
className: `payment-modal ${y || o ? "invisible" : "visible"}`,
|
|
1381
1382
|
"data-id": r,
|
|
1382
1383
|
ref: m
|
|
1383
1384
|
}) : null]
|
|
1384
|
-
}) : /* @__PURE__ */
|
|
1385
|
+
}) : /* @__PURE__ */ x(Ut, {});
|
|
1385
1386
|
}
|
|
1386
1387
|
function rn(e) {
|
|
1387
1388
|
return BigInt(e).toString();
|
|
1388
1389
|
}
|
|
1389
|
-
const on = Symbol(), fe = Symbol(),
|
|
1390
|
+
const on = Symbol(), fe = Symbol(), O = "a", mt = "f", De = "p", yt = "c", wt = "t", he = "h", N = "w", de = "o", pe = "k";
|
|
1390
1391
|
let an = (e, t) => new Proxy(e, t);
|
|
1391
1392
|
const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) => e && (ne.has(e) ? ne.get(e) : se(e) === Object.prototype || se(e) === Array.prototype), j = (e) => typeof e == "object" && e !== null, cn = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), un = (e) => {
|
|
1392
1393
|
if (Array.isArray(e))
|
|
@@ -1402,19 +1403,19 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1402
1403
|
let n = !1;
|
|
1403
1404
|
const r = (a, c) => {
|
|
1404
1405
|
if (!n) {
|
|
1405
|
-
let u = s[
|
|
1406
|
-
if (u || (u = {}, s[
|
|
1407
|
-
u[
|
|
1406
|
+
let u = s[O].get(e);
|
|
1407
|
+
if (u || (u = {}, s[O].set(e, u)), a === N)
|
|
1408
|
+
u[N] = !0;
|
|
1408
1409
|
else {
|
|
1409
1410
|
let f = u[a];
|
|
1410
1411
|
f || (f = /* @__PURE__ */ new Set(), u[a] = f), f.add(c);
|
|
1411
1412
|
}
|
|
1412
1413
|
}
|
|
1413
1414
|
}, i = () => {
|
|
1414
|
-
n = !0, s[
|
|
1415
|
+
n = !0, s[O].delete(e);
|
|
1415
1416
|
}, o = {
|
|
1416
1417
|
get(a, c) {
|
|
1417
|
-
return c === fe ? e : (r(pe, c), Et(Reflect.get(a, c), s[
|
|
1418
|
+
return c === fe ? e : (r(pe, c), Et(Reflect.get(a, c), s[O], s[yt], s[wt]));
|
|
1418
1419
|
},
|
|
1419
1420
|
has(a, c) {
|
|
1420
1421
|
return c === on ? (i(), !0) : (r(he, c), Reflect.has(a, c));
|
|
@@ -1423,7 +1424,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1423
1424
|
return r(de, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
1424
1425
|
},
|
|
1425
1426
|
ownKeys(a) {
|
|
1426
|
-
return r(
|
|
1427
|
+
return r(N), Reflect.ownKeys(a);
|
|
1427
1428
|
}
|
|
1428
1429
|
};
|
|
1429
1430
|
return t && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
@@ -1441,7 +1442,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1441
1442
|
}
|
|
1442
1443
|
const [i, o] = r;
|
|
1443
1444
|
let a = s && s.get(i);
|
|
1444
|
-
return (!a || a[1][mt] !== !!o) && (a = ln(i, !!o), a[1][De] = an(o || i, a[0]), s && s.set(i, a)), a[1][
|
|
1445
|
+
return (!a || a[1][mt] !== !!o) && (a = ln(i, !!o), a[1][De] = an(o || i, a[0]), s && s.set(i, a)), a[1][O] = t, a[1][yt] = s, a[1][wt] = n, a[1][De];
|
|
1445
1446
|
}, fn = (e, t) => {
|
|
1446
1447
|
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1447
1448
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
@@ -1462,7 +1463,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1462
1463
|
for (const a of i[he] || [])
|
|
1463
1464
|
if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
|
|
1464
1465
|
return o;
|
|
1465
|
-
if (i[
|
|
1466
|
+
if (i[N] === !0) {
|
|
1466
1467
|
if (o = fn(e, t), o)
|
|
1467
1468
|
return o;
|
|
1468
1469
|
} else
|
|
@@ -1490,7 +1491,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1490
1491
|
if ((c = w[he]) === null || c === void 0 || c.forEach((d) => {
|
|
1491
1492
|
const y = `:has(${String(d)})`;
|
|
1492
1493
|
n.push(a ? [...a, y] : [y]);
|
|
1493
|
-
}), w[
|
|
1494
|
+
}), w[N] === !0) {
|
|
1494
1495
|
const d = ":ownKeys";
|
|
1495
1496
|
n.push(a ? [...a, d] : [d]);
|
|
1496
1497
|
} else
|
|
@@ -1524,8 +1525,8 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1524
1525
|
};
|
|
1525
1526
|
if (ye.has(i))
|
|
1526
1527
|
Oe(i, !1);
|
|
1527
|
-
else if (
|
|
1528
|
-
const [c, u] =
|
|
1528
|
+
else if (k.has(i)) {
|
|
1529
|
+
const [c, u] = k.get(
|
|
1529
1530
|
i
|
|
1530
1531
|
);
|
|
1531
1532
|
a.value = Tt(c, u());
|
|
@@ -1544,10 +1545,10 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) =
|
|
|
1544
1545
|
if (c && (Me(u, o) || F.has(o) && Me(u, F.get(o))))
|
|
1545
1546
|
return !0;
|
|
1546
1547
|
s(i), me(o) && (o = hn(o) || o);
|
|
1547
|
-
const f = !
|
|
1548
|
+
const f = !k.has(o) && yn(o) ? Rt(o) : o;
|
|
1548
1549
|
return t(i, f), Reflect.set(r, i, f, a), n(["set", [i], o, u]), !0;
|
|
1549
1550
|
}
|
|
1550
|
-
}),
|
|
1551
|
+
}), k = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new WeakMap(), J = [1], F = /* @__PURE__ */ new WeakMap();
|
|
1551
1552
|
let Me = Object.is, mn = (e, t) => new Proxy(e, t), yn = pn, wn = Tt, bn = gn;
|
|
1552
1553
|
function Rt(e = {}) {
|
|
1553
1554
|
if (!me(e))
|
|
@@ -1567,7 +1568,7 @@ function Rt(e = {}) {
|
|
|
1567
1568
|
const b = [...m];
|
|
1568
1569
|
b[1] = [l, ...b[1]], r(b, p);
|
|
1569
1570
|
}, c = /* @__PURE__ */ new Map(), u = (l, m) => {
|
|
1570
|
-
const p = !ye.has(m) &&
|
|
1571
|
+
const p = !ye.has(m) && k.get(m);
|
|
1571
1572
|
if (p) {
|
|
1572
1573
|
if ((q ? "production" : void 0) !== "production" && c.has(l))
|
|
1573
1574
|
throw new Error("prop listener already exists");
|
|
@@ -1581,14 +1582,14 @@ function Rt(e = {}) {
|
|
|
1581
1582
|
var m;
|
|
1582
1583
|
const p = c.get(l);
|
|
1583
1584
|
p && (c.delete(l), (m = p[1]) == null || m.call(p));
|
|
1584
|
-
}, w = (l) => (n.add(l), n.size === 1 && c.forEach(([p, b],
|
|
1585
|
+
}, w = (l) => (n.add(l), n.size === 1 && c.forEach(([p, b], R) => {
|
|
1585
1586
|
if ((q ? "production" : void 0) !== "production" && b)
|
|
1586
1587
|
throw new Error("remove already exists");
|
|
1587
|
-
const
|
|
1588
|
-
c.set(
|
|
1588
|
+
const I = p[2](a(R));
|
|
1589
|
+
c.set(R, [p, I]);
|
|
1589
1590
|
}), () => {
|
|
1590
|
-
n.delete(l), n.size === 0 && c.forEach(([p, b],
|
|
1591
|
-
b && (b(), c.set(
|
|
1591
|
+
n.delete(l), n.size === 0 && c.forEach(([p, b], R) => {
|
|
1592
|
+
b && (b(), c.set(R, [p]));
|
|
1592
1593
|
});
|
|
1593
1594
|
});
|
|
1594
1595
|
let d = !0;
|
|
@@ -1599,8 +1600,8 @@ function Rt(e = {}) {
|
|
|
1599
1600
|
r
|
|
1600
1601
|
), S = mn(e, y);
|
|
1601
1602
|
F.set(e, S);
|
|
1602
|
-
const
|
|
1603
|
-
return
|
|
1603
|
+
const T = [e, o, w];
|
|
1604
|
+
return k.set(S, T), Reflect.ownKeys(e).forEach((l) => {
|
|
1604
1605
|
const m = Object.getOwnPropertyDescriptor(
|
|
1605
1606
|
e,
|
|
1606
1607
|
l
|
|
@@ -1609,7 +1610,7 @@ function Rt(e = {}) {
|
|
|
1609
1610
|
}), d = !1, S;
|
|
1610
1611
|
}
|
|
1611
1612
|
function En(e, t, s) {
|
|
1612
|
-
const n =
|
|
1613
|
+
const n = k.get(e);
|
|
1613
1614
|
(q ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1614
1615
|
let r;
|
|
1615
1616
|
const i = [], o = n[2];
|
|
@@ -1624,7 +1625,7 @@ function En(e, t, s) {
|
|
|
1624
1625
|
};
|
|
1625
1626
|
}
|
|
1626
1627
|
function Be(e) {
|
|
1627
|
-
const t =
|
|
1628
|
+
const t = k.get(e);
|
|
1628
1629
|
(q ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1629
1630
|
const [s, n] = t;
|
|
1630
1631
|
return wn(s, n());
|
|
@@ -1671,7 +1672,7 @@ function vn(e, t) {
|
|
|
1671
1672
|
const a = be(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1672
1673
|
return Et(o, n, a, An);
|
|
1673
1674
|
}
|
|
1674
|
-
const
|
|
1675
|
+
const U = Rt({
|
|
1675
1676
|
data: null,
|
|
1676
1677
|
isPending: !1,
|
|
1677
1678
|
error: null
|
|
@@ -1685,7 +1686,7 @@ function kn({
|
|
|
1685
1686
|
onCancel: i,
|
|
1686
1687
|
onSuccess: o
|
|
1687
1688
|
}) {
|
|
1688
|
-
const a = vn(
|
|
1689
|
+
const a = vn(U), [c, u] = L(!1), [f, w] = L(Date.now());
|
|
1689
1690
|
function d() {
|
|
1690
1691
|
u(!0);
|
|
1691
1692
|
}
|
|
@@ -1693,8 +1694,8 @@ function kn({
|
|
|
1693
1694
|
u(!1), S();
|
|
1694
1695
|
}
|
|
1695
1696
|
const S = () => {
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1697
|
+
const T = Date.now();
|
|
1698
|
+
U.isPending = !0, U.error = null, fetch(e, {
|
|
1698
1699
|
method: "POST",
|
|
1699
1700
|
headers: {
|
|
1700
1701
|
"Content-Type": "application/json"
|
|
@@ -1706,15 +1707,16 @@ function kn({
|
|
|
1706
1707
|
recipient: r
|
|
1707
1708
|
})
|
|
1708
1709
|
}).then((l) => l.json()).then((l) => {
|
|
1709
|
-
|
|
1710
|
+
T < f || (U.data = l, U.isPending = !1, w(T));
|
|
1710
1711
|
}).catch((l) => {
|
|
1711
|
-
|
|
1712
|
+
T < f || (U.error = l?.toString(), U.isPending = !1, w(T));
|
|
1712
1713
|
});
|
|
1713
1714
|
};
|
|
1714
1715
|
return oe(() => {
|
|
1715
1716
|
S();
|
|
1716
1717
|
}, [t, s, n, r, e]), {
|
|
1717
1718
|
...a,
|
|
1719
|
+
amount: n,
|
|
1718
1720
|
destinationChain: t,
|
|
1719
1721
|
token: s,
|
|
1720
1722
|
recipient: r,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function(S,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime"],y):(S=typeof globalThis<"u"?globalThis:S||self,y(S.Chainrails={},S.React,S.jsxRuntime))})(this,(function(S,y,C){"use strict";var we=document.createElement("style");we.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
|
-
/*$vite$:1*/`,document.head.appendChild(we);class V 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 be 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 Y extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(t){const s=t?.cause?t.cause instanceof Error?t.cause:new be(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 Se=(()=>{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})(),Tt=typeof globalThis.AbortController=="function",Ee=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Rt=typeof globalThis.ReadableStream=="function",At=typeof globalThis.FormData=="function",Te=["get","post","put","patch","head","delete"],vt={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},X=2147483647,Pt=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Re=Symbol("stop");class Ae{options;constructor(t){this.options=t}}const It=e=>new Ae(e),Ct={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},Ut={next:!0},kt={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},xt=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[s,n]of e)t+=Pt,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},ve=(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))}}))},Dt=(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(ve(e.body,s,t),{status:e.status,statusText:e.statusText,headers:e.headers})},Ot=(e,t,s)=>{if(!e.body)return e;const n=xt(s??e.body);return new Request(e,{duplex:"half",body:ve(e.body,n,t)})},k=e=>e!==null&&typeof e=="object",$=(...e)=>{for(const t of e)if((!k(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return J({},...e)},Pe=(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 z(e,t,s){return Object.hasOwn(t,s)&&t[s]===void 0?[]:J(e[s]??[],t[s]??[])}const Ie=(e={},t={})=>({beforeRequest:z(e,t,"beforeRequest"),beforeRetry:z(e,t,"beforeRetry"),afterResponse:z(e,t,"afterResponse"),beforeError:z(e,t,"beforeError")}),Nt=(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(k(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},J=(...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(k(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&&(!k(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:Nt(r,c);continue}k(c)&&a in t&&(c=J(t[a],c)),t={...t,[a]:c}}k(o.hooks)&&(n=Ie(n,o.hooks),t.hooks=n),k(o.headers)&&(s=Pe(s,o.headers),t.headers=s)}return r!==void 0&&(t.searchParams=r),i.length>0&&(i.length===1?t.signal=i[0]:Ee?t.signal=AbortSignal.any(i):t.signal=i.at(-1)),t.context===void 0&&(t.context={}),t},Mt=e=>Te.includes(e)?e.toUpperCase():e,Ce={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},_t=(e={})=>{if(typeof e=="number")return{...Ce,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{...Ce,...e}};class G extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}}async function $t(e,t,s,n){return new Promise((r,i)=>{const o=setTimeout(()=>{s&&s.abort(),i(new G(e))},n.timeout);n.fetch(e,t).then(r).catch(i).then(()=>{clearTimeout(o)})})}async function zt(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 Bt=(e,t)=>{const s={};for(const n in t)Object.hasOwn(t,n)&&!(n in kt)&&!(n in Ct)&&(!(n in e)||n in Ut)&&(s[n]=t[n]);return s},Lt=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 jt(e){return e instanceof V||e?.name===V.name}function qt(e){return e instanceof G||e?.name===G.name}class O{static create(t,s){const n=new O(t,s),r=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>X)throw new RangeError(`The \`timeout\` option cannot be greater than ${X}`);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 Ae)throw await Promise.all([c.body?.cancel(),o.body?.cancel()]),new Y(u.options)}if(n.#l(o),!o.ok&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(o.status):n.#e.throwHttpErrors)){let a=new V(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(!Rt)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Dt(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(vt))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:Pe(this.#t.headers,s.headers),hooks:Ie({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},s.hooks),method:Mt(s.method??this.#t.method??"GET"),prefixUrl:String(s.prefixUrl||""),retry:_t(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}Tt&&Ee&&(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),Se&&(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&&(At&&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),Lt(this.#e.searchParams)){const i="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(O.#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(!Se)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 be(t);if(s instanceof Y)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(qt(t)&&!this.#e.retry.retryOnTimeout)throw t;if(jt(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),X);if(this.#s<1)throw s;if(await zt(n,this.#r?{signal:this.#r}:{}),s instanceof Y&&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===Re)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=Bt(this.request,this.#e);return this.#o=this.request,this.request=this.#o.clone(),this.#e.timeout===!1?this.#e.fetch(this.#o,t):$t(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:Ot(t,this.#e.onUploadProgress,s??this.#e.body??void 0)}}/*! MIT License © Sindre Sorhus */const Z=e=>{const t=(s,n)=>O.create(s,$(e,n));for(const s of Te)t[s]=(n,r)=>O.create(n,$(e,r,{method:s}));return t.create=s=>Z($(s)),t.extend=s=>(typeof s=="function"&&(s=s(e??{})),Z($(e,s))),t.stop=Re,t.retry=It,t},Ft=Z();var T=(e=>(e.USDC="USDC",e))(T||{});const Ue={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},ke={type:"evm",chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},xe={type:"evm",chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp"},De={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"},Ne={type:"evm",chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},Me={type:"evm",chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},_e={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"},ze={type:"starknet",chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:null,logoURI:"/images/chains/starknet.svg"};function Q(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Be(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Le="2.43.4";let ee={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:s})=>t?`${e??"https://viem.sh"}${t}${s?`#${s}`:""}`:void 0,version:`viem@${Le}`};class U extends Error{constructor(t,s={}){const n=s.cause instanceof U?s.cause.details:s.cause?.message?s.cause.message:s.details,r=s.cause instanceof U&&s.cause.docsPath||s.docsPath,i=ee.getDocsUrl?.({...s,docsPath:r}),o=[t||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...ee.version?[`Version: ${ee.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=Le}walk(t){return je(this,t)}}function je(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?je(e.cause,t):t?null:e}class qe extends U{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 B(e,{dir:t,size:s=32}={}){return typeof e=="string"?Ht(e,{dir:t,size:s}):Kt(e,{dir:t,size:s})}function Ht(e,{dir:t,size:s=32}={}){if(s===null)return e;const n=e.replace("0x","");if(n.length>s*2)throw new qe({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](s*2,"0")}`}function Kt(e,{dir:t,size:s=32}={}){if(s===null)return e;if(e.length>s)throw new qe({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 Wt extends U{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 Vt extends U{constructor({givenSize:t,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function te(e,{size:t}){if(Be(e)>t)throw new Vt({givenSize:Be(e),maxSize:t})}function Yt(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 Wt({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?B(a,{size:n}):a}const Xt=new TextEncoder;function Jt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Zt(e,t):typeof e=="boolean"?Gt(e,t):Q(e)?He(e,t):Ke(e,t)}function Gt(e,t={}){const s=new Uint8Array(1);return s[0]=Number(e),typeof t.size=="number"?(te(s,{size:t.size}),B(s,{size:t.size})):s}const v={zero:48,nine:57,A:65,F:70,a:97,f:102};function Fe(e){if(e>=v.zero&&e<=v.nine)return e-v.zero;if(e>=v.A&&e<=v.F)return e-(v.A-10);if(e>=v.a&&e<=v.f)return e-(v.a-10)}function He(e,t={}){let s=e;t.size&&(te(s,{size:t.size}),s=B(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=Fe(n.charCodeAt(a++)),u=Fe(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new U(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);i[o]=c*16+u}return i}function Zt(e,t){const s=Yt(e,t);return He(s)}function Ke(e,t={}){const s=Xt.encode(e);return typeof t.size=="number"?(te(s,{size:t.size}),B(s,{dir:"right",size:t.size})):s}const L=BigInt(2**32-1),We=BigInt(32);function Qt(e,t=!1){return t?{h:Number(e&L),l:Number(e>>We&L)}:{h:Number(e>>We&L)|0,l:Number(e&L)|0}}function es(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}=Qt(e[i],t);[n[i],r[i]]=[o,a]}return[n,r]}const ts=(e,t,s)=>e<<s|t>>>32-s,ss=(e,t,s)=>t<<s|e>>>32-s,ns=(e,t,s)=>t<<s-32|e>>>64-s,rs=(e,t,s)=>e<<s-32|t>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function os(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ve(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function j(e,...t){if(!os(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 Ye(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 is(e,t){j(e);const s=t.outputLen;if(e.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function as(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Xe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const cs=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function us(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function ls(e){for(let t=0;t<e.length;t++)e[t]=us(e[t]);return e}const Je=cs?e=>e:ls;function fs(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ge(e){return typeof e=="string"&&(e=fs(e)),j(e),e}class hs{}function ds(e){const t=n=>e().update(Ge(n)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t}const ps=BigInt(0),N=BigInt(1),gs=BigInt(2),ms=BigInt(7),ys=BigInt(256),ws=BigInt(113),Ze=[],Qe=[],et=[];for(let e=0,t=N,s=1,n=0;e<24;e++){[s,n]=[n,(2*s+3*n)%5],Ze.push(2*(5*n+s)),Qe.push((e+1)*(e+2)/2%64);let r=ps;for(let i=0;i<7;i++)t=(t<<N^(t>>ms)*ws)%ys,t&gs&&(r^=N<<(N<<BigInt(i))-N);et.push(r)}const tt=es(et,!0),bs=tt[0],Ss=tt[1],st=(e,t,s)=>s>32?ns(e,t,s):ts(e,t,s),nt=(e,t,s)=>s>32?rs(e,t,s):ss(e,t,s);function Es(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],f=s[c+1],b=st(u,f,1)^s[a],d=nt(u,f,1)^s[a+1];for(let w=0;w<50;w+=10)e[o+w]^=b,e[o+w+1]^=d}let r=e[2],i=e[3];for(let o=0;o<24;o++){const a=Qe[o],c=st(r,i,a),u=nt(r,i,a),f=Ze[o];r=e[f],i=e[f+1],e[f]=c,e[f+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]^=bs[n],e[1]^=Ss[n]}Xe(s)}class se extends hs{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,Ve(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=as(this.state)}clone(){return this._cloneInto()}keccak(){Je(this.state32),Es(this.state32,this.rounds),Je(this.state32),this.posOut=0,this.pos=0}update(t){Ye(this),t=Ge(t),j(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){Ye(this,!1),j(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 Ve(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(is(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,Xe(this.state)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new se(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 Ts=(e,t,s)=>ds(()=>new se(t,e,s)),Rs=Ts(1,136,256/8);function As(e,t){return Rs(Q(e,{strict:!1})?Jt(e):e)}class vs extends U{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 rt 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 ne=new rt(8192);function ot(e,t){if(ne.has(`${e}.${t}`))return ne.get(`${e}.${t}`);const s=e.substring(2).toLowerCase(),n=As(Ke(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 ne.set(`${e}.${t}`,i),i}function P(e,t){if(!Is(e,{strict:!1}))throw new vs({address:e});return ot(e,t)}const Ps=/^0x[a-fA-F0-9]{40}$/,re=new rt(8192);function Is(e,t){const{strict:s=!0}=t??{},n=`${e}.${s}`;if(re.has(n))return re.get(n);const r=Ps.test(e)?e.toLowerCase()===e?!0:s?ot(e)===e:!0:!1;return re.set(n,r),r}const Cs={chainId:ke.chainId,address:P("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"},Us={chainId:Ue.chainId,address:P("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},ks={chainId:$e.chainId,address:P("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"},xs={chainId:_e.chainId,address:P("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"},Ds={chainId:De.chainId,address:P("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"},Os={chainId:xe.chainId,address:P("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"},Ns={chainId:Oe.chainId,address:P("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ms={chainId:Me.chainId,address:P("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},_s={chainId:Ne.chainId,address:P("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},$s={chainId:ze.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"},it={ARBITRUM_MAINNET:{...Ue,tokens:{[T.USDC]:Us},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...ke,explorer:"https://sepolia.arbiscan.io",tokens:{[T.USDC]:Cs}},AVALANCHE_MAINNET:{..._e,tokens:{[T.USDC]:xs},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{...$e,tokens:{[T.USDC]:ks},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...xe,tokens:{[T.USDC]:Os},explorer:"https://basescan.org"},BASE_TESTNET:{...De,tokens:{[T.USDC]:Ds},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...Oe,tokens:{[T.USDC]:Ns},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...Ne,tokens:{[T.USDC]:_s},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...Me,tokens:{[T.USDC]:Ms},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...ze,tokens:{[T.USDC]:$s},explorer:""}};var q=(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))(q||{}),oe=(e=>(e.USDC="USDC",e))(oe||{});const zs=e=>{const t=e?.trim().toUpperCase();if(it[t])return it[t]};function Bs(e,t){return zs(e)?.tokens[t]?.address}var ie=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(ie||{});class h{constructor({api_key:t,env:s,seesion_token:n}){this.api_key=t||"",this.sessionToken=n||"",this.env=s??ie.PRODUCTION}static async config(t){if(!h.app){if(!t)throw new Error("Please provide an api_key");h.app=new h(t)}return t&&(t.api_key!==void 0&&(h.app.api_key=t.api_key),t.seesion_token!==void 0&&(h.app.sessionToken=t.seesion_token),t.env!==void 0&&(h.app.env=t.env)),h.app}static getApiKey(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.api_key}static getSessionToken(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.sessionToken}static getEnv(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.env==="internal"?"staging":h.app.env}static getBaseUrl(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(h.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(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const i=h.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 ae=null;function Ls(){ae=Ft.create({prefixUrl:h.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[e=>{const t=h.getSessionToken()||h.getApiKey();e.headers.set("Authorization",`Bearer ${t}`)}],afterResponse:[(e,t,s)=>s]},retry:{limit:2}})}function p(){return ae||Ls(),ae}class js{async getById(t){return await p().get("intents/"+t).json()}async getForSender(t){return await p().get("intents/user/"+t).json()}async getForAddress(t){return await p().get("intents/address/"+t).json()}async getForSession(t){return await p().get("modal/sessions/intents/"+t).json()}async getAll(t){return await p().get("intents",{searchParams:t}).json()}async create(t){return await p().post("intents",{json:t}).json()}async createForSession(t){return await p().post("modal/sessions/intents",{json:t}).json()}async update(t,s){return await p().post("intents",{json:s}).json()}async triggerProcessing(t){return await p().post(`intents/${t}/trigger-processing`).json()}async triggerProcessingForSession(t){return await p().post(`modal/sessions/intents/${t}/process`).json()}}class qs{async getFromSpecificBridge(t){return await p().get("quotes/single",{searchParams:t}).json()}async getFromAllBridges(t){return await p().get("quotes/multiple",{searchParams:t}).json()}async getBestAcrossBridges(t){return await p().get("quotes/best",{searchParams:t}).json()}async getAll(t){return await p().get("quotes/multi-source",{searchParams:t}).json()}async getAllForSession(t){return await p().get("modal/sessions/quotes",{searchParams:t}).json()}}class Fs{async getOptimalRoutes(t){return await p().get("router/optimal-route",{searchParams:t}).json()}async getAllSupportedBridges(){return await p().get("router/supported-bridges/all").json()}async getSupportedBridges(t){return await p().get("router/supported-bridges/route",{searchParams:t}).json()}async getSupportedRoutes(t,s){return await p().get("router/supported-bridges/bridge/"+t,{searchParams:s}).json()}}class Hs{async getSupported(t){return await p().get("chains",{searchParams:t}).json()}}class Ks{async getClientInfo(){return await p().get("client/auth/client-info").json()}}class Ws{getSessionToken(t){const s={recipient:t.recipient,tokenOut:Bs(q[t.destinationChain],oe[t.token]),destinationChain:q[t.destinationChain],amount:t.amount};return p().post("modal/sessions",{json:s}).json()}}const Vs={router:new Fs,quotes:new qs,intents:new js,chains:new Hs,client:new Ks,auth:new Ws};function at(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=at(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Ys(){for(var e,t,s=0,n="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=at(e))&&(n&&(n+=" "),n+=t);return n}function Xs(e){const{recipient:t,token:s,destinationChain:n,amount:r,isOpen:i,isPending:o,open:a,close:c,onCancel:u,onSuccess:f,session_url:b,data:d}=e,[w,R]=y.useState(!0),[I,l]=y.useState(null),m=y.useRef(null);y.useEffect(()=>{E();const A=document.body.style.overflow;i?(document.body.style.overflow="hidden",document.body.style.overflow="hidden"):document.body.style.overflow=A||"";const W=Et=>{Et.data==="closed"&&(c(),u?.()),Et.data==="completed"&&(window.setTimeout(c,2e3),f?.())};return window.addEventListener("message",W),()=>{document.body.style.overflow=A||"",window.removeEventListener("message",W)}},[i,u,f,d?.sessionToken]);function g(){R(!1),E()}function E(){if(!d?.sessionToken)return;h.config({api_key:d?.sessionToken||"",env:b==="https://chainrails-sdk-server.vercel.app/test/create-session"?"internal":"production"}),l(h.getPayModalUrl(n,s,t,r)),console.log(n,s,t,r);const A={type:"session",session_token:d.sessionToken,environment:h.getEnv()||ie.PRODUCTION};m.current?.contentWindow?.postMessage(A,"https://app.chainrails.io"),m.current?.contentWindow?.postMessage(A,"https://chainrails-frontend-git-staging-horus-labs.vercel.app")}return d?.sessionToken?C.jsxs("div",{className:Ys("payment-modal-wrapper",w||o?"loading":"not-loading",i?"open":"closed"),children:[(w||o)&&C.jsx("div",{role:"status",className:"payment-modal-loader",children:C.jsxs("svg",{"aria-hidden":"true",className:"icon",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[C.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"}),C.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"})]})}),I?C.jsx("iframe",{allow:"clipboard-read *; clipboard-write *",src:I,onLoad:g,className:`payment-modal ${w||o?"invisible":"visible"}`,"data-id":r,ref:m}):null]}):C.jsx(C.Fragment,{})}function Js(e){return BigInt(e).toString()}const Gs=Symbol(),ce=Symbol(),M="a",ct="f",ut="p",lt="c",ft="t",ue="h",_="w",le="o",fe="k";let Zs=(e,t)=>new Proxy(e,t);const he=Object.getPrototypeOf,de=new WeakMap,ht=e=>e&&(de.has(e)?de.get(e):he(e)===Object.prototype||he(e)===Array.prototype),F=e=>typeof e=="object"&&e!==null,Qs=e=>Object.values(Object.getOwnPropertyDescriptors(e)).some(t=>!t.configurable&&!t.writable),en=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(he(e),t)},tn=(e,t)=>{const s={[ct]:t};let n=!1;const r=(a,c)=>{if(!n){let u=s[M].get(e);if(u||(u={},s[M].set(e,u)),a===_)u[_]=!0;else{let f=u[a];f||(f=new Set,u[a]=f),f.add(c)}}},i=()=>{n=!0,s[M].delete(e)},o={get(a,c){return c===ce?e:(r(fe,c),dt(Reflect.get(a,c),s[M],s[lt],s[ft]))},has(a,c){return c===Gs?(i(),!0):(r(ue,c),Reflect.has(a,c))},getOwnPropertyDescriptor(a,c){return r(le,c),Reflect.getOwnPropertyDescriptor(a,c)},ownKeys(a){return r(_),Reflect.ownKeys(a)}};return t&&(o.set=o.deleteProperty=()=>!1),[o,s]},pe=e=>e[ce]||e,dt=(e,t,s,n)=>{if(!ht(e))return e;let r=n&&n.get(e);if(!r){const c=pe(e);Qs(c)?r=[c,en(c)]:r=[c],n?.set(e,r)}const[i,o]=r;let a=s&&s.get(i);return(!a||a[1][ct]!==!!o)&&(a=tn(i,!!o),a[1][ut]=Zs(o||i,a[0]),s&&s.set(i,a)),a[1][M]=t,a[1][lt]=s,a[1][ft]=n,a[1][ut]},sn=(e,t)=>{const s=Reflect.ownKeys(e),n=Reflect.ownKeys(t);return s.length!==n.length||s.some((r,i)=>r!==n[i])},pt=(e,t,s,n,r=Object.is)=>{if(r(e,t))return!1;if(!F(e)||!F(t))return!0;const i=s.get(pe(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[ue]||[])if(o=Reflect.has(e,a)!==Reflect.has(t,a),o)return o;if(i[_]===!0){if(o=sn(e,t),o)return o}else for(const a of i[le]||[]){const c=!!Reflect.getOwnPropertyDescriptor(e,a),u=!!Reflect.getOwnPropertyDescriptor(t,a);if(o=c!==u,o)return o}for(const a of i[fe]||[])if(o=pt(e[a],t[a],s,n,r),o)return o;if(o===null)throw new Error("invalid used");return o},nn=e=>ht(e)&&e[ce]||null,gt=(e,t=!0)=>{de.set(e,t)},rn=(e,t,s)=>{const n=[],r=new WeakSet,i=(o,a)=>{var c,u,f;if(r.has(o))return;F(o)&&r.add(o);const b=F(o)&&t.get(pe(o));if(b){if((c=b[ue])===null||c===void 0||c.forEach(d=>{const w=`:has(${String(d)})`;n.push(a?[...a,w]:[w])}),b[_]===!0){const d=":ownKeys";n.push(a?[...a,d]:[d])}else(u=b[le])===null||u===void 0||u.forEach(d=>{const w=`:hasOwn(${String(d)})`;n.push(a?[...a,w]:[w])});(f=b[fe])===null||f===void 0||f.forEach(d=>{"value"in(Object.getOwnPropertyDescriptor(o,d)||{})&&i(o[d],a?[...a,d]:[d])})}else a&&n.push(a)};return i(e),n},H={},ge=e=>typeof e=="object"&&e!==null,on=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),mt=(e,t)=>{const s=yt.get(e);if(s?.[0]===t)return s[1];const n=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return gt(n,!0),yt.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(me.has(i))gt(i,!1);else if(x.has(i)){const[c,u]=x.get(i);a.value=mt(c,u())}Object.defineProperty(n,r,a)}),Object.preventExtensions(n)},an=(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&&(wt(u,o)||K.has(o)&&wt(u,K.get(o))))return!0;s(i),ge(o)&&(o=nn(o)||o);const f=!x.has(o)&&un(o)?bt(o):o;return t(i,f),Reflect.set(r,i,f,a),n(["set",[i],o,u]),!0}}),x=new WeakMap,me=new WeakSet,yt=new WeakMap,ye=[1],K=new WeakMap;let wt=Object.is,cn=(e,t)=>new Proxy(e,t),un=on,ln=mt,fn=an;function bt(e={}){if(!ge(e))throw new Error("object required");const t=K.get(e);if(t)return t;let s=ye[0];const n=new Set,r=(l,m=++ye[0])=>{s!==m&&(i=s=m,n.forEach(g=>g(l,m)))};let i=s;const o=(l=ye[0])=>(i!==l&&(i=l,c.forEach(([m])=>{const g=m[1](l);g>s&&(s=g)})),s),a=l=>(m,g)=>{const E=[...m];E[1]=[l,...E[1]],r(E,g)},c=new Map,u=(l,m)=>{const g=!me.has(m)&&x.get(m);if(g){if((H?"production":void 0)!=="production"&&c.has(l))throw new Error("prop listener already exists");if(n.size){const E=g[2](a(l));c.set(l,[g,E])}else c.set(l,[g])}},f=l=>{var m;const g=c.get(l);g&&(c.delete(l),(m=g[1])==null||m.call(g))},b=l=>(n.add(l),n.size===1&&c.forEach(([g,E],A)=>{if((H?"production":void 0)!=="production"&&E)throw new Error("remove already exists");const W=g[2](a(A));c.set(A,[g,W])}),()=>{n.delete(l),n.size===0&&c.forEach(([g,E],A)=>{E&&(E(),c.set(A,[g]))})});let d=!0;const w=fn(()=>d,u,f,r),R=cn(e,w);K.set(e,R);const I=[e,o,b];return x.set(R,I),Reflect.ownKeys(e).forEach(l=>{const m=Object.getOwnPropertyDescriptor(e,l);"value"in m&&m.writable&&(R[l]=e[l])}),d=!1,R}function hn(e,t,s){const n=x.get(e);(H?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let r;const i=[],o=n[2];let a=!1;const u=o(f=>{i.push(f),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,u()}}function St(e){const t=x.get(e);(H?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[s,n]=t;return ln(s,n())}const dn={},pn=(e,t)=>{const s=y.useRef(void 0);y.useEffect(()=>{s.current=rn(e,t)}),y.useDebugValue(s.current)},gn=new WeakMap;function mn(e,t){const n=y.useMemo(()=>e&&new WeakMap,[e]),r=y.useRef(void 0);let i=!0;const o=y.useSyncExternalStore(y.useCallback(c=>{const u=hn(e,c);return c(),u},[e,void 0]),()=>{const c=St(e);try{if(!i&&r.current&&!pt(r.current,c,n,new WeakMap))return r.current}catch{}return c},()=>St(e));i=!1,y.useLayoutEffect(()=>{r.current=o}),(dn?"production":void 0)!=="production"&&pn(o,n);const a=y.useMemo(()=>new WeakMap,[]);return dt(o,n,a,gn)}const D=bt({data:null,isPending:!1,error:null});function yn({session_url:e,destinationChain:t,token:s,amount:n,recipient:r,onCancel:i,onSuccess:o}){const a=mn(D),[c,u]=y.useState(!1),[f,b]=y.useState(Date.now());function d(){u(!0)}function w(){u(!1),R()}const R=()=>{const I=Date.now();D.isPending=!0,D.error=null,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinationChain:t?.replace("_MAINNET",""),token:s,amount:n?Js(n):"0",recipient:r})}).then(l=>l.json()).then(l=>{I<f||(D.data=l,D.isPending=!1,b(I))}).catch(l=>{I<f||(D.error=l?.toString(),D.isPending=!1,b(I))})};return y.useEffect(()=>{R()},[t,s,n,r,e]),{...a,destinationChain:t,token:s,recipient:r,isOpen:c,session_url:e,open:d,close:w,refetch:R,onSuccess:o,onCancel:i}}S.Chainrails=h,S.PaymentModal=Xs,S.chains=q,S.crapi=Vs,S.tokens=oe,S.usePaymentSession=yn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
+
/*$vite$:1*/`,document.head.appendChild(we);class V 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 be 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 Y extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(t){const s=t?.cause?t.cause instanceof Error?t.cause:new be(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 Se=(()=>{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})(),Tt=typeof globalThis.AbortController=="function",Ee=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Rt=typeof globalThis.ReadableStream=="function",At=typeof globalThis.FormData=="function",Te=["get","post","put","patch","head","delete"],vt={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},X=2147483647,Pt=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Re=Symbol("stop");class Ae{options;constructor(t){this.options=t}}const It=e=>new Ae(e),Ct={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},Ut={next:!0},kt={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},xt=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[s,n]of e)t+=Pt,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},ve=(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))}}))},Dt=(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(ve(e.body,s,t),{status:e.status,statusText:e.statusText,headers:e.headers})},Ot=(e,t,s)=>{if(!e.body)return e;const n=xt(s??e.body);return new Request(e,{duplex:"half",body:ve(e.body,n,t)})},k=e=>e!==null&&typeof e=="object",z=(...e)=>{for(const t of e)if((!k(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return J({},...e)},Pe=(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 B(e,t,s){return Object.hasOwn(t,s)&&t[s]===void 0?[]:J(e[s]??[],t[s]??[])}const Ie=(e={},t={})=>({beforeRequest:B(e,t,"beforeRequest"),beforeRetry:B(e,t,"beforeRetry"),afterResponse:B(e,t,"afterResponse"),beforeError:B(e,t,"beforeError")}),Nt=(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(k(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},J=(...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(k(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&&(!k(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:Nt(r,c);continue}k(c)&&a in t&&(c=J(t[a],c)),t={...t,[a]:c}}k(o.hooks)&&(n=Ie(n,o.hooks),t.hooks=n),k(o.headers)&&(s=Pe(s,o.headers),t.headers=s)}return r!==void 0&&(t.searchParams=r),i.length>0&&(i.length===1?t.signal=i[0]:Ee?t.signal=AbortSignal.any(i):t.signal=i.at(-1)),t.context===void 0&&(t.context={}),t},Mt=e=>Te.includes(e)?e.toUpperCase():e,Ce={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},_t=(e={})=>{if(typeof e=="number")return{...Ce,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{...Ce,...e}};class G extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}}async function $t(e,t,s,n){return new Promise((r,i)=>{const o=setTimeout(()=>{s&&s.abort(),i(new G(e))},n.timeout);n.fetch(e,t).then(r).catch(i).then(()=>{clearTimeout(o)})})}async function zt(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 Bt=(e,t)=>{const s={};for(const n in t)Object.hasOwn(t,n)&&!(n in kt)&&!(n in Ct)&&(!(n in e)||n in Ut)&&(s[n]=t[n]);return s},Lt=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 jt(e){return e instanceof V||e?.name===V.name}function qt(e){return e instanceof G||e?.name===G.name}class N{static create(t,s){const n=new N(t,s),r=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>X)throw new RangeError(`The \`timeout\` option cannot be greater than ${X}`);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 Ae)throw await Promise.all([c.body?.cancel(),o.body?.cancel()]),new Y(u.options)}if(n.#l(o),!o.ok&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(o.status):n.#e.throwHttpErrors)){let a=new V(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(!Rt)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Dt(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(vt))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:Pe(this.#t.headers,s.headers),hooks:Ie({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},s.hooks),method:Mt(s.method??this.#t.method??"GET"),prefixUrl:String(s.prefixUrl||""),retry:_t(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}Tt&&Ee&&(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),Se&&(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&&(At&&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),Lt(this.#e.searchParams)){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);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(!Se)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 be(t);if(s instanceof Y)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(qt(t)&&!this.#e.retry.retryOnTimeout)throw t;if(jt(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),X);if(this.#s<1)throw s;if(await zt(n,this.#r?{signal:this.#r}:{}),s instanceof Y&&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===Re)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=Bt(this.request,this.#e);return this.#o=this.request,this.request=this.#o.clone(),this.#e.timeout===!1?this.#e.fetch(this.#o,t):$t(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:Ot(t,this.#e.onUploadProgress,s??this.#e.body??void 0)}}/*! MIT License © Sindre Sorhus */const Z=e=>{const t=(s,n)=>N.create(s,z(e,n));for(const s of Te)t[s]=(n,r)=>N.create(n,z(e,r,{method:s}));return t.create=s=>Z(z(s)),t.extend=s=>(typeof s=="function"&&(s=s(e??{})),Z(z(e,s))),t.stop=Re,t.retry=It,t},Ft=Z();var T=(e=>(e.USDC="USDC",e))(T||{});const Ue={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},ke={type:"evm",chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},xe={type:"evm",chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp"},De={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"},Ne={type:"evm",chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},Me={type:"evm",chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},_e={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"},ze={type:"starknet",chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:null,logoURI:"/images/chains/starknet.svg"};function Q(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Be(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Le="2.43.4";let ee={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:s})=>t?`${e??"https://viem.sh"}${t}${s?`#${s}`:""}`:void 0,version:`viem@${Le}`};class U extends Error{constructor(t,s={}){const n=s.cause instanceof U?s.cause.details:s.cause?.message?s.cause.message:s.details,r=s.cause instanceof U&&s.cause.docsPath||s.docsPath,i=ee.getDocsUrl?.({...s,docsPath:r}),o=[t||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...ee.version?[`Version: ${ee.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=Le}walk(t){return je(this,t)}}function je(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?je(e.cause,t):t?null:e}class qe extends U{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 L(e,{dir:t,size:s=32}={}){return typeof e=="string"?Ht(e,{dir:t,size:s}):Kt(e,{dir:t,size:s})}function Ht(e,{dir:t,size:s=32}={}){if(s===null)return e;const n=e.replace("0x","");if(n.length>s*2)throw new qe({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](s*2,"0")}`}function Kt(e,{dir:t,size:s=32}={}){if(s===null)return e;if(e.length>s)throw new qe({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 Wt extends U{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 Vt extends U{constructor({givenSize:t,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function te(e,{size:t}){if(Be(e)>t)throw new Vt({givenSize:Be(e),maxSize:t})}function Yt(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 Wt({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?L(a,{size:n}):a}const Xt=new TextEncoder;function Jt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Zt(e,t):typeof e=="boolean"?Gt(e,t):Q(e)?He(e,t):Ke(e,t)}function Gt(e,t={}){const s=new Uint8Array(1);return s[0]=Number(e),typeof t.size=="number"?(te(s,{size:t.size}),L(s,{size:t.size})):s}const A={zero:48,nine:57,A:65,F:70,a:97,f:102};function Fe(e){if(e>=A.zero&&e<=A.nine)return e-A.zero;if(e>=A.A&&e<=A.F)return e-(A.A-10);if(e>=A.a&&e<=A.f)return e-(A.a-10)}function He(e,t={}){let s=e;t.size&&(te(s,{size:t.size}),s=L(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=Fe(n.charCodeAt(a++)),u=Fe(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new U(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);i[o]=c*16+u}return i}function Zt(e,t){const s=Yt(e,t);return He(s)}function Ke(e,t={}){const s=Xt.encode(e);return typeof t.size=="number"?(te(s,{size:t.size}),L(s,{dir:"right",size:t.size})):s}const j=BigInt(2**32-1),We=BigInt(32);function Qt(e,t=!1){return t?{h:Number(e&j),l:Number(e>>We&j)}:{h:Number(e>>We&j)|0,l:Number(e&j)|0}}function es(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}=Qt(e[i],t);[n[i],r[i]]=[o,a]}return[n,r]}const ts=(e,t,s)=>e<<s|t>>>32-s,ss=(e,t,s)=>t<<s|e>>>32-s,ns=(e,t,s)=>t<<s-32|e>>>64-s,rs=(e,t,s)=>e<<s-32|t>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function os(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ve(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function q(e,...t){if(!os(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 Ye(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 is(e,t){q(e);const s=t.outputLen;if(e.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function as(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Xe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const cs=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function us(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function ls(e){for(let t=0;t<e.length;t++)e[t]=us(e[t]);return e}const Je=cs?e=>e:ls;function fs(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ge(e){return typeof e=="string"&&(e=fs(e)),q(e),e}class hs{}function ds(e){const t=n=>e().update(Ge(n)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t}const ps=BigInt(0),M=BigInt(1),gs=BigInt(2),ms=BigInt(7),ys=BigInt(256),ws=BigInt(113),Ze=[],Qe=[],et=[];for(let e=0,t=M,s=1,n=0;e<24;e++){[s,n]=[n,(2*s+3*n)%5],Ze.push(2*(5*n+s)),Qe.push((e+1)*(e+2)/2%64);let r=ps;for(let i=0;i<7;i++)t=(t<<M^(t>>ms)*ws)%ys,t&gs&&(r^=M<<(M<<BigInt(i))-M);et.push(r)}const tt=es(et,!0),bs=tt[0],Ss=tt[1],st=(e,t,s)=>s>32?ns(e,t,s):ts(e,t,s),nt=(e,t,s)=>s>32?rs(e,t,s):ss(e,t,s);function Es(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],f=s[c+1],b=st(u,f,1)^s[a],d=nt(u,f,1)^s[a+1];for(let w=0;w<50;w+=10)e[o+w]^=b,e[o+w+1]^=d}let r=e[2],i=e[3];for(let o=0;o<24;o++){const a=Qe[o],c=st(r,i,a),u=nt(r,i,a),f=Ze[o];r=e[f],i=e[f+1],e[f]=c,e[f+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]^=bs[n],e[1]^=Ss[n]}Xe(s)}class se extends hs{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,Ve(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=as(this.state)}clone(){return this._cloneInto()}keccak(){Je(this.state32),Es(this.state32,this.rounds),Je(this.state32),this.posOut=0,this.pos=0}update(t){Ye(this),t=Ge(t),q(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){Ye(this,!1),q(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 Ve(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(is(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,Xe(this.state)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new se(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 Ts=(e,t,s)=>ds(()=>new se(t,e,s)),Rs=Ts(1,136,256/8);function As(e,t){return Rs(Q(e,{strict:!1})?Jt(e):e)}class vs extends U{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 rt 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 ne=new rt(8192);function ot(e,t){if(ne.has(`${e}.${t}`))return ne.get(`${e}.${t}`);const s=e.substring(2).toLowerCase(),n=As(Ke(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 ne.set(`${e}.${t}`,i),i}function v(e,t){if(!Is(e,{strict:!1}))throw new vs({address:e});return ot(e,t)}const Ps=/^0x[a-fA-F0-9]{40}$/,re=new rt(8192);function Is(e,t){const{strict:s=!0}=t??{},n=`${e}.${s}`;if(re.has(n))return re.get(n);const r=Ps.test(e)?e.toLowerCase()===e?!0:s?ot(e)===e:!0:!1;return re.set(n,r),r}const Cs={chainId:ke.chainId,address:v("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"},Us={chainId:Ue.chainId,address:v("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},ks={chainId:$e.chainId,address:v("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"},xs={chainId:_e.chainId,address:v("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"},Ds={chainId:De.chainId,address:v("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"},Os={chainId:xe.chainId,address:v("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"},Ns={chainId:Oe.chainId,address:v("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ms={chainId:Me.chainId,address:v("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},_s={chainId:Ne.chainId,address:v("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},$s={chainId:ze.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"},it={ARBITRUM_MAINNET:{...Ue,tokens:{[T.USDC]:Us},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...ke,explorer:"https://sepolia.arbiscan.io",tokens:{[T.USDC]:Cs}},AVALANCHE_MAINNET:{..._e,tokens:{[T.USDC]:xs},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{...$e,tokens:{[T.USDC]:ks},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...xe,tokens:{[T.USDC]:Os},explorer:"https://basescan.org"},BASE_TESTNET:{...De,tokens:{[T.USDC]:Ds},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...Oe,tokens:{[T.USDC]:Ns},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...Ne,tokens:{[T.USDC]:_s},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...Me,tokens:{[T.USDC]:Ms},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...ze,tokens:{[T.USDC]:$s},explorer:""}};var F=(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))(F||{}),oe=(e=>(e.USDC="USDC",e))(oe||{});const zs=e=>{const t=e?.trim().toUpperCase();if(it[t])return it[t]};function Bs(e,t){return zs(e)?.tokens[t]?.address}var ie=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(ie||{});class h{constructor({api_key:t,env:s,seesion_token:n}){this.api_key=t||"",this.sessionToken=n||"",this.env=s??ie.PRODUCTION}static async config(t){if(!h.app){if(!t)throw new Error("Please provide an api_key");h.app=new h(t)}return t&&(t.api_key!==void 0&&(h.app.api_key=t.api_key),t.seesion_token!==void 0&&(h.app.sessionToken=t.seesion_token),t.env!==void 0&&(h.app.env=t.env)),h.app}static getApiKey(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.api_key}static getSessionToken(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.sessionToken}static getEnv(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.env==="internal"?"staging":h.app.env}static getBaseUrl(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(h.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(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const i=h.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 ae=null;function Ls(){ae=Ft.create({prefixUrl:h.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[e=>{const t=h.getSessionToken()||h.getApiKey();e.headers.set("Authorization",`Bearer ${t}`)}],afterResponse:[(e,t,s)=>s]},retry:{limit:2}})}function p(){return ae||Ls(),ae}class js{async getById(t){return await p().get("intents/"+t).json()}async getForSender(t){return await p().get("intents/user/"+t).json()}async getForAddress(t){return await p().get("intents/address/"+t).json()}async getForSession(t){return await p().get("modal/sessions/intents/"+t).json()}async getAll(t){return await p().get("intents",{searchParams:t}).json()}async create(t){return await p().post("intents",{json:t}).json()}async createForSession(t){return await p().post("modal/sessions/intents",{json:t}).json()}async update(t,s){return await p().post("intents",{json:s}).json()}async triggerProcessing(t){return await p().post(`intents/${t}/trigger-processing`).json()}async triggerProcessingForSession(t){return await p().post(`modal/sessions/intents/${t}/process`).json()}}class qs{async getFromSpecificBridge(t){return await p().get("quotes/single",{searchParams:t}).json()}async getFromAllBridges(t){return await p().get("quotes/multiple",{searchParams:t}).json()}async getBestAcrossBridges(t){return await p().get("quotes/best",{searchParams:t}).json()}async getAll(t){return await p().get("quotes/multi-source",{searchParams:t}).json()}async getAllForSession(t){return await p().get("modal/sessions/quotes",{searchParams:t}).json()}}class Fs{async getOptimalRoutes(t){return await p().get("router/optimal-route",{searchParams:t}).json()}async getAllSupportedBridges(){return await p().get("router/supported-bridges/all").json()}async getSupportedBridges(t){return await p().get("router/supported-bridges/route",{searchParams:t}).json()}async getSupportedRoutes(t,s){return await p().get("router/supported-bridges/bridge/"+t,{searchParams:s}).json()}}class Hs{async getSupported(t){return await p().get("chains",{searchParams:t}).json()}}class Ks{async getClientInfo(){return await p().get("client/auth/client-info").json()}}class Ws{getSessionToken(t){const s={recipient:t.recipient,tokenOut:Bs(F[t.destinationChain],oe[t.token]),destinationChain:F[t.destinationChain],amount:t.amount};return p().post("modal/sessions",{json:s}).json()}}const Vs={router:new Fs,quotes:new qs,intents:new js,chains:new Hs,client:new Ks,auth:new Ws};function at(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=at(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Ys(){for(var e,t,s=0,n="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=at(e))&&(n&&(n+=" "),n+=t);return n}function Xs(e){const{recipient:t,token:s,destinationChain:n,amount:r,isOpen:i,isPending:o,open:a,close:c,onCancel:u,onSuccess:f,session_url:b,data:d}=e,[w,R]=y.useState(!0),[P,l]=y.useState(null),m=y.useRef(null);y.useEffect(()=>{E();const I=document.body.style.overflow;i?(document.body.style.overflow="hidden",document.body.style.overflow="hidden"):document.body.style.overflow=I||"";const O=Et=>{Et.data==="closed"&&(c(),u?.()),Et.data==="completed"&&(window.setTimeout(c,2e3),f?.())};return window.addEventListener("message",O),()=>{document.body.style.overflow=I||"",window.removeEventListener("message",O)}},[i,u,f,d?.sessionToken]);function g(){R(!1),E()}async function E(){if(!d?.sessionToken)return;const I=await h.config({api_key:d?.sessionToken||"",env:b==="https://chainrails-sdk-server.vercel.app/test/create-session"?"internal":"production"});l(h.getPayModalUrl(n,s,t,r));const O={type:"session",session_token:d.sessionToken,environment:h.getEnv()||ie.PRODUCTION};window.chainrails=I,m.current?.contentWindow?.postMessage(O,"https://app.chainrails.io"),m.current?.contentWindow?.postMessage(O,"https://chainrails-frontend-git-staging-horus-labs.vercel.app")}return d?.sessionToken?C.jsxs("div",{className:Ys("payment-modal-wrapper",w||o?"loading":"not-loading",i?"open":"closed"),children:[(w||o)&&C.jsx("div",{role:"status",className:"payment-modal-loader",children:C.jsxs("svg",{"aria-hidden":"true",className:"icon",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[C.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"}),C.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"})]})}),P?C.jsx("iframe",{allow:"clipboard-read *; clipboard-write *",src:P,onLoad:g,className:`payment-modal ${w||o?"invisible":"visible"}`,"data-id":r,ref:m}):null]}):C.jsx(C.Fragment,{})}function Js(e){return BigInt(e).toString()}const Gs=Symbol(),ce=Symbol(),_="a",ct="f",ut="p",lt="c",ft="t",ue="h",$="w",le="o",fe="k";let Zs=(e,t)=>new Proxy(e,t);const he=Object.getPrototypeOf,de=new WeakMap,ht=e=>e&&(de.has(e)?de.get(e):he(e)===Object.prototype||he(e)===Array.prototype),H=e=>typeof e=="object"&&e!==null,Qs=e=>Object.values(Object.getOwnPropertyDescriptors(e)).some(t=>!t.configurable&&!t.writable),en=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(he(e),t)},tn=(e,t)=>{const s={[ct]:t};let n=!1;const r=(a,c)=>{if(!n){let u=s[_].get(e);if(u||(u={},s[_].set(e,u)),a===$)u[$]=!0;else{let f=u[a];f||(f=new Set,u[a]=f),f.add(c)}}},i=()=>{n=!0,s[_].delete(e)},o={get(a,c){return c===ce?e:(r(fe,c),dt(Reflect.get(a,c),s[_],s[lt],s[ft]))},has(a,c){return c===Gs?(i(),!0):(r(ue,c),Reflect.has(a,c))},getOwnPropertyDescriptor(a,c){return r(le,c),Reflect.getOwnPropertyDescriptor(a,c)},ownKeys(a){return r($),Reflect.ownKeys(a)}};return t&&(o.set=o.deleteProperty=()=>!1),[o,s]},pe=e=>e[ce]||e,dt=(e,t,s,n)=>{if(!ht(e))return e;let r=n&&n.get(e);if(!r){const c=pe(e);Qs(c)?r=[c,en(c)]:r=[c],n?.set(e,r)}const[i,o]=r;let a=s&&s.get(i);return(!a||a[1][ct]!==!!o)&&(a=tn(i,!!o),a[1][ut]=Zs(o||i,a[0]),s&&s.set(i,a)),a[1][_]=t,a[1][lt]=s,a[1][ft]=n,a[1][ut]},sn=(e,t)=>{const s=Reflect.ownKeys(e),n=Reflect.ownKeys(t);return s.length!==n.length||s.some((r,i)=>r!==n[i])},pt=(e,t,s,n,r=Object.is)=>{if(r(e,t))return!1;if(!H(e)||!H(t))return!0;const i=s.get(pe(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[ue]||[])if(o=Reflect.has(e,a)!==Reflect.has(t,a),o)return o;if(i[$]===!0){if(o=sn(e,t),o)return o}else for(const a of i[le]||[]){const c=!!Reflect.getOwnPropertyDescriptor(e,a),u=!!Reflect.getOwnPropertyDescriptor(t,a);if(o=c!==u,o)return o}for(const a of i[fe]||[])if(o=pt(e[a],t[a],s,n,r),o)return o;if(o===null)throw new Error("invalid used");return o},nn=e=>ht(e)&&e[ce]||null,gt=(e,t=!0)=>{de.set(e,t)},rn=(e,t,s)=>{const n=[],r=new WeakSet,i=(o,a)=>{var c,u,f;if(r.has(o))return;H(o)&&r.add(o);const b=H(o)&&t.get(pe(o));if(b){if((c=b[ue])===null||c===void 0||c.forEach(d=>{const w=`:has(${String(d)})`;n.push(a?[...a,w]:[w])}),b[$]===!0){const d=":ownKeys";n.push(a?[...a,d]:[d])}else(u=b[le])===null||u===void 0||u.forEach(d=>{const w=`:hasOwn(${String(d)})`;n.push(a?[...a,w]:[w])});(f=b[fe])===null||f===void 0||f.forEach(d=>{"value"in(Object.getOwnPropertyDescriptor(o,d)||{})&&i(o[d],a?[...a,d]:[d])})}else a&&n.push(a)};return i(e),n},K={},ge=e=>typeof e=="object"&&e!==null,on=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),mt=(e,t)=>{const s=yt.get(e);if(s?.[0]===t)return s[1];const n=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return gt(n,!0),yt.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(me.has(i))gt(i,!1);else if(x.has(i)){const[c,u]=x.get(i);a.value=mt(c,u())}Object.defineProperty(n,r,a)}),Object.preventExtensions(n)},an=(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&&(wt(u,o)||W.has(o)&&wt(u,W.get(o))))return!0;s(i),ge(o)&&(o=nn(o)||o);const f=!x.has(o)&&un(o)?bt(o):o;return t(i,f),Reflect.set(r,i,f,a),n(["set",[i],o,u]),!0}}),x=new WeakMap,me=new WeakSet,yt=new WeakMap,ye=[1],W=new WeakMap;let wt=Object.is,cn=(e,t)=>new Proxy(e,t),un=on,ln=mt,fn=an;function bt(e={}){if(!ge(e))throw new Error("object required");const t=W.get(e);if(t)return t;let s=ye[0];const n=new Set,r=(l,m=++ye[0])=>{s!==m&&(i=s=m,n.forEach(g=>g(l,m)))};let i=s;const o=(l=ye[0])=>(i!==l&&(i=l,c.forEach(([m])=>{const g=m[1](l);g>s&&(s=g)})),s),a=l=>(m,g)=>{const E=[...m];E[1]=[l,...E[1]],r(E,g)},c=new Map,u=(l,m)=>{const g=!me.has(m)&&x.get(m);if(g){if((K?"production":void 0)!=="production"&&c.has(l))throw new Error("prop listener already exists");if(n.size){const E=g[2](a(l));c.set(l,[g,E])}else c.set(l,[g])}},f=l=>{var m;const g=c.get(l);g&&(c.delete(l),(m=g[1])==null||m.call(g))},b=l=>(n.add(l),n.size===1&&c.forEach(([g,E],I)=>{if((K?"production":void 0)!=="production"&&E)throw new Error("remove already exists");const O=g[2](a(I));c.set(I,[g,O])}),()=>{n.delete(l),n.size===0&&c.forEach(([g,E],I)=>{E&&(E(),c.set(I,[g]))})});let d=!0;const w=fn(()=>d,u,f,r),R=cn(e,w);W.set(e,R);const P=[e,o,b];return x.set(R,P),Reflect.ownKeys(e).forEach(l=>{const m=Object.getOwnPropertyDescriptor(e,l);"value"in m&&m.writable&&(R[l]=e[l])}),d=!1,R}function hn(e,t,s){const n=x.get(e);(K?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let r;const i=[],o=n[2];let a=!1;const u=o(f=>{i.push(f),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,u()}}function St(e){const t=x.get(e);(K?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[s,n]=t;return ln(s,n())}const dn={},pn=(e,t)=>{const s=y.useRef(void 0);y.useEffect(()=>{s.current=rn(e,t)}),y.useDebugValue(s.current)},gn=new WeakMap;function mn(e,t){const n=y.useMemo(()=>e&&new WeakMap,[e]),r=y.useRef(void 0);let i=!0;const o=y.useSyncExternalStore(y.useCallback(c=>{const u=hn(e,c);return c(),u},[e,void 0]),()=>{const c=St(e);try{if(!i&&r.current&&!pt(r.current,c,n,new WeakMap))return r.current}catch{}return c},()=>St(e));i=!1,y.useLayoutEffect(()=>{r.current=o}),(dn?"production":void 0)!=="production"&&pn(o,n);const a=y.useMemo(()=>new WeakMap,[]);return dt(o,n,a,gn)}const D=bt({data:null,isPending:!1,error:null});function yn({session_url:e,destinationChain:t,token:s,amount:n,recipient:r,onCancel:i,onSuccess:o}){const a=mn(D),[c,u]=y.useState(!1),[f,b]=y.useState(Date.now());function d(){u(!0)}function w(){u(!1),R()}const R=()=>{const P=Date.now();D.isPending=!0,D.error=null,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinationChain:t?.replace("_MAINNET",""),token:s,amount:n?Js(n):"0",recipient:r})}).then(l=>l.json()).then(l=>{P<f||(D.data=l,D.isPending=!1,b(P))}).catch(l=>{P<f||(D.error=l?.toString(),D.isPending=!1,b(P))})};return y.useEffect(()=>{R()},[t,s,n,r,e]),{...a,amount:n,destinationChain:t,token:s,recipient:r,isOpen:c,session_url:e,open:d,close:w,refetch:R,onSuccess:o,onCancel:i}}S.Chainrails=h,S.PaymentModal=Xs,S.chains=F,S.crapi=Vs,S.tokens=oe,S.usePaymentSession=yn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -9,6 +9,7 @@ interface usePaymentSessionProps {
|
|
|
9
9
|
onSuccess?: () => void;
|
|
10
10
|
}
|
|
11
11
|
export declare function usePaymentSession({ session_url, destinationChain, token, amount, recipient, onCancel, onSuccess, }: usePaymentSessionProps): {
|
|
12
|
+
amount: number | undefined;
|
|
12
13
|
destinationChain: chains;
|
|
13
14
|
token: tokens;
|
|
14
15
|
recipient: `0x${string}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentSession.d.ts","sourceRoot":"","sources":["../../src/hooks/usePaymentSession.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,EAAoB,MAAM,iBAAiB,CAAC;AAqB/E,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,SAAS,GACV,EAAE,sBAAsB
|
|
1
|
+
{"version":3,"file":"usePaymentSession.d.ts","sourceRoot":"","sources":["../../src/hooks/usePaymentSession.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,EAAoB,MAAM,iBAAiB,CAAC;AAqB/E,UAAU,sBAAsB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,SAAS,GACV,EAAE,sBAAsB;;;;;;;;;;sBAXL,IAAI;qBADL,IAAI;;+BArBP,MAAM;4BACT,MAAM;4BACN,MAAM;;WAKV,MAAM,GAAG,IAAI;eACT,OAAO;EAyFnB"}
|