@chainrails/react 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useState as X, useRef as ne, useEffect as re, useMemo as ye, useSyncExternalStore as
|
|
2
|
-
import {
|
|
1
|
+
import { useState as X, useRef as ne, useEffect as re, useMemo as ye, useSyncExternalStore as Rt, useCallback as At, useLayoutEffect as vt, useDebugValue as Pt } from "react";
|
|
2
|
+
import { jsx as k, Fragment as It, jsxs as we } from "react/jsx-runtime";
|
|
3
3
|
import './index.css';class J extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
@@ -50,7 +50,7 @@ const be = (() => {
|
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
52
|
return e && !t;
|
|
53
|
-
})(),
|
|
53
|
+
})(), Ut = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", kt = typeof globalThis.FormData == "function", _e = ["get", "post", "put", "patch", "head", "delete"], xt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -59,14 +59,14 @@ const be = (() => {
|
|
|
59
59
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
60
60
|
// We still feature-check at runtime before exposing the shortcut.
|
|
61
61
|
bytes: "*/*"
|
|
62
|
-
}, H = 2147483647,
|
|
63
|
-
class
|
|
62
|
+
}, H = 2147483647, Dt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, $e = Symbol("stop");
|
|
63
|
+
class Le {
|
|
64
64
|
options;
|
|
65
65
|
constructor(t) {
|
|
66
66
|
this.options = t;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const Ot = (e) => new Le(e), Nt = {
|
|
70
70
|
json: !0,
|
|
71
71
|
parseJson: !0,
|
|
72
72
|
stringifyJson: !0,
|
|
@@ -80,10 +80,10 @@ const Dt = (e) => new _e(e), Ot = {
|
|
|
80
80
|
onUploadProgress: !0,
|
|
81
81
|
fetch: !0,
|
|
82
82
|
context: !0
|
|
83
|
-
},
|
|
83
|
+
}, Mt = {
|
|
84
84
|
next: !0
|
|
85
85
|
// Next.js cache revalidation (revalidate, tags)
|
|
86
|
-
},
|
|
86
|
+
}, Bt = {
|
|
87
87
|
method: !0,
|
|
88
88
|
headers: !0,
|
|
89
89
|
body: !0,
|
|
@@ -98,13 +98,13 @@ const Dt = (e) => new _e(e), Ot = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
101
|
+
}, _t = (e) => {
|
|
102
102
|
if (!e)
|
|
103
103
|
return 0;
|
|
104
104
|
if (e instanceof FormData) {
|
|
105
105
|
let t = 0;
|
|
106
106
|
for (const [s, n] of e)
|
|
107
|
-
t +=
|
|
107
|
+
t += Dt, t += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, t += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
|
|
108
108
|
return t;
|
|
109
109
|
}
|
|
110
110
|
if (e instanceof Blob)
|
|
@@ -158,15 +158,15 @@ const Dt = (e) => new _e(e), Ot = {
|
|
|
158
158
|
}, Lt = (e, t, s) => {
|
|
159
159
|
if (!e.body)
|
|
160
160
|
return e;
|
|
161
|
-
const n =
|
|
161
|
+
const n = _t(s ?? e.body);
|
|
162
162
|
return new Request(e, {
|
|
163
163
|
// @ts-expect-error - Types are outdated.
|
|
164
164
|
duplex: "half",
|
|
165
165
|
body: ze(e.body, n, t)
|
|
166
166
|
});
|
|
167
|
-
},
|
|
167
|
+
}, U = (e) => e !== null && typeof e == "object", M = (...e) => {
|
|
168
168
|
for (const t of e)
|
|
169
|
-
if ((!
|
|
169
|
+
if ((!U(t) || Array.isArray(t)) && t !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
171
|
return oe({}, ...e);
|
|
172
172
|
}, je = (e = {}, t = {}) => {
|
|
@@ -183,7 +183,7 @@ const qe = (e = {}, t = {}) => ({
|
|
|
183
183
|
beforeRetry: B(e, t, "beforeRetry"),
|
|
184
184
|
afterResponse: B(e, t, "afterResponse"),
|
|
185
185
|
beforeError: B(e, t, "beforeError")
|
|
186
|
-
}),
|
|
186
|
+
}), zt = (e, t) => {
|
|
187
187
|
const s = new URLSearchParams();
|
|
188
188
|
for (const n of [e, t])
|
|
189
189
|
if (n !== void 0)
|
|
@@ -196,7 +196,7 @@ const qe = (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 (U(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 qe = (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 (U(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 && (!U(c) || Array.isArray(c)))
|
|
222
222
|
throw new TypeError("The `context` option must be an object");
|
|
223
223
|
t = {
|
|
224
224
|
...t,
|
|
@@ -227,25 +227,25 @@ const qe = (e = {}, t = {}) => ({
|
|
|
227
227
|
continue;
|
|
228
228
|
}
|
|
229
229
|
if (a === "searchParams") {
|
|
230
|
-
c == null ? r = void 0 : r = r === void 0 ? c :
|
|
230
|
+
c == null ? r = void 0 : r = r === void 0 ? c : zt(r, c);
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
U(c) && a in t && (c = oe(t[a], c)), t = { ...t, [a]: c };
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
U(o.hooks) && (n = qe(n, o.hooks), t.hooks = n), U(o.headers) && (s = je(s, o.headers), t.headers = s);
|
|
236
236
|
}
|
|
237
237
|
return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] : Be ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
|
|
238
|
-
},
|
|
238
|
+
}, jt = (e) => _e.includes(e) ? e.toUpperCase() : e, qt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], Ht = [413, 429, 503], Ee = {
|
|
239
239
|
limit: 2,
|
|
240
|
-
methods:
|
|
241
|
-
statusCodes:
|
|
242
|
-
afterStatusCodes:
|
|
240
|
+
methods: qt,
|
|
241
|
+
statusCodes: Ft,
|
|
242
|
+
afterStatusCodes: Ht,
|
|
243
243
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
244
244
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
245
245
|
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3,
|
|
246
246
|
jitter: void 0,
|
|
247
247
|
retryOnTimeout: !1
|
|
248
|
-
},
|
|
248
|
+
}, Kt = (e = {}) => {
|
|
249
249
|
if (typeof e == "number")
|
|
250
250
|
return {
|
|
251
251
|
...Ee,
|
|
@@ -266,7 +266,7 @@ class G extends Error {
|
|
|
266
266
|
super(`Request timed out: ${t.method} ${t.url}`), this.name = "TimeoutError", this.request = t;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
269
|
+
async function Wt(e, t, s, n) {
|
|
270
270
|
return new Promise((r, i) => {
|
|
271
271
|
const o = setTimeout(() => {
|
|
272
272
|
s && s.abort(), i(new G(e));
|
|
@@ -276,7 +276,7 @@ async function Kt(e, t, s, n) {
|
|
|
276
276
|
});
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
async function
|
|
279
|
+
async function Vt(e, { signal: t }) {
|
|
280
280
|
return new Promise((s, n) => {
|
|
281
281
|
t && (t.throwIfAborted(), t.addEventListener("abort", r, { once: !0 }));
|
|
282
282
|
function r() {
|
|
@@ -287,28 +287,28 @@ async function Wt(e, { signal: t }) {
|
|
|
287
287
|
}, e);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const Yt = (e, t) => {
|
|
291
291
|
const s = {};
|
|
292
292
|
for (const n in t)
|
|
293
|
-
Object.hasOwn(t, n) && !(n in
|
|
293
|
+
Object.hasOwn(t, n) && !(n in Bt) && !(n in Nt) && (!(n in e) || n in Mt) && (s[n] = t[n]);
|
|
294
294
|
return s;
|
|
295
|
-
},
|
|
296
|
-
function
|
|
295
|
+
}, Xt = (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;
|
|
296
|
+
function Jt(e) {
|
|
297
297
|
return e instanceof J || e?.name === J.name;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Gt(e) {
|
|
300
300
|
return e instanceof G || e?.name === G.name;
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class N {
|
|
303
303
|
static create(t, s) {
|
|
304
|
-
const n = new
|
|
304
|
+
const n = new N(t, s), r = async () => {
|
|
305
305
|
if (typeof n.#e.timeout == "number" && n.#e.timeout > H)
|
|
306
306
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${H}`);
|
|
307
307
|
await Promise.resolve();
|
|
308
308
|
let o = await n.#g();
|
|
309
309
|
for (const a of n.#e.hooks.afterResponse) {
|
|
310
310
|
const c = n.#l(o.clone()), u = await a(n.request, n.#a(), c, { retryCount: n.#s });
|
|
311
|
-
if (u instanceof globalThis.Response && (o = u), u instanceof
|
|
311
|
+
if (u instanceof globalThis.Response && (o = u), u instanceof Le)
|
|
312
312
|
throw await Promise.all([
|
|
313
313
|
c.body?.cancel(),
|
|
314
314
|
o.body?.cancel()
|
|
@@ -323,7 +323,7 @@ class D {
|
|
|
323
323
|
if (n.#e.onDownloadProgress) {
|
|
324
324
|
if (typeof n.#e.onDownloadProgress != "function")
|
|
325
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
326
|
-
if (!
|
|
326
|
+
if (!Ct)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
328
|
return $t(o.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
@@ -370,10 +370,10 @@ class D {
|
|
|
370
370
|
beforeError: [],
|
|
371
371
|
afterResponse: []
|
|
372
372
|
}, s.hooks),
|
|
373
|
-
method:
|
|
373
|
+
method: jt(s.method ?? this.#t.method ?? "GET"),
|
|
374
374
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
375
375
|
prefixUrl: String(s.prefixUrl || ""),
|
|
376
|
-
retry:
|
|
376
|
+
retry: Kt(s.retry),
|
|
377
377
|
throwHttpErrors: s.throwHttpErrors ?? !0,
|
|
378
378
|
timeout: s.timeout ?? 1e4,
|
|
379
379
|
fetch: s.fetch ?? globalThis.fetch.bind(globalThis),
|
|
@@ -385,10 +385,10 @@ class D {
|
|
|
385
385
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
386
386
|
this.#e.prefixUrl.endsWith("/") || (this.#e.prefixUrl += "/"), this.#t = this.#e.prefixUrl + this.#t;
|
|
387
387
|
}
|
|
388
|
-
|
|
388
|
+
Ut && Be && (this.#r = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal), be && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
|
|
389
389
|
const n = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
390
|
-
if (this.#t instanceof globalThis.Request && (
|
|
391
|
-
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(
|
|
390
|
+
if (this.#t instanceof globalThis.Request && (kt && 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), Xt(this.#e.searchParams)) {
|
|
391
|
+
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(N.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
392
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
393
393
|
}
|
|
394
394
|
if (this.#e.onUploadProgress) {
|
|
@@ -419,9 +419,9 @@ class D {
|
|
|
419
419
|
if (n === !0)
|
|
420
420
|
return this.#c();
|
|
421
421
|
}
|
|
422
|
-
if (
|
|
422
|
+
if (Gt(t) && !this.#e.retry.retryOnTimeout)
|
|
423
423
|
throw t;
|
|
424
|
-
if (
|
|
424
|
+
if (Jt(t)) {
|
|
425
425
|
if (!this.#e.retry.statusCodes.includes(t.response.status))
|
|
426
426
|
throw t;
|
|
427
427
|
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");
|
|
@@ -446,7 +446,7 @@ class D {
|
|
|
446
446
|
const n = Math.min(await this.#p(s), H);
|
|
447
447
|
if (this.#s < 1)
|
|
448
448
|
throw s;
|
|
449
|
-
if (await
|
|
449
|
+
if (await Vt(n, this.#r ? { signal: this.#r } : {}), s instanceof F && s.customRequest) {
|
|
450
450
|
const r = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
|
|
451
451
|
this.#u(r);
|
|
452
452
|
}
|
|
@@ -463,7 +463,7 @@ class D {
|
|
|
463
463
|
}
|
|
464
464
|
if (i instanceof globalThis.Response)
|
|
465
465
|
return i;
|
|
466
|
-
if (i ===
|
|
466
|
+
if (i === $e)
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
return this.#f(t);
|
|
@@ -480,8 +480,8 @@ class D {
|
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
const t =
|
|
484
|
-
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, t) :
|
|
483
|
+
const t = Yt(this.request, this.#e);
|
|
484
|
+
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, t) : Wt(this.#o, t, this.#n, this.#e);
|
|
485
485
|
}
|
|
486
486
|
#a() {
|
|
487
487
|
if (!this.#i) {
|
|
@@ -499,11 +499,11 @@ class D {
|
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const Z = (e) => {
|
|
502
|
-
const t = (s, n) =>
|
|
503
|
-
for (const s of
|
|
504
|
-
t[s] = (n, r) =>
|
|
505
|
-
return t.create = (s) => Z(M(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), Z(M(e, s))), t.stop =
|
|
506
|
-
},
|
|
502
|
+
const t = (s, n) => N.create(s, M(e, n));
|
|
503
|
+
for (const s of _e)
|
|
504
|
+
t[s] = (n, r) => N.create(n, M(e, r, { method: s }));
|
|
505
|
+
return t.create = (s) => Z(M(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), Z(M(e, s))), t.stop = $e, t.retry = Ot, t;
|
|
506
|
+
}, Zt = Z();
|
|
507
507
|
var S = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(S || {});
|
|
508
508
|
const Fe = {
|
|
509
509
|
type: "evm",
|
|
@@ -634,9 +634,9 @@ class tt extends v {
|
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
function q(e, { dir: t, size: s = 32 } = {}) {
|
|
637
|
-
return typeof e == "string" ?
|
|
637
|
+
return typeof e == "string" ? Qt(e, { dir: t, size: s }) : es(e, { dir: t, size: s });
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function Qt(e, { dir: t, size: s = 32 } = {}) {
|
|
640
640
|
if (s === null)
|
|
641
641
|
return e;
|
|
642
642
|
const n = e.replace("0x", "");
|
|
@@ -648,7 +648,7 @@ function Zt(e, { dir: t, size: s = 32 } = {}) {
|
|
|
648
648
|
});
|
|
649
649
|
return `0x${n[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function es(e, { dir: t, size: s = 32 } = {}) {
|
|
652
652
|
if (s === null)
|
|
653
653
|
return e;
|
|
654
654
|
if (e.length > s)
|
|
@@ -664,31 +664,31 @@ function Qt(e, { dir: t, size: s = 32 } = {}) {
|
|
|
664
664
|
}
|
|
665
665
|
return n;
|
|
666
666
|
}
|
|
667
|
-
class
|
|
667
|
+
class ts extends v {
|
|
668
668
|
constructor({ max: t, min: s, signed: n, size: r, value: i }) {
|
|
669
669
|
super(`Number "${i}" is not in safe ${r ? `${r * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${s} to ${t})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
class
|
|
672
|
+
class ss extends v {
|
|
673
673
|
constructor({ givenSize: t, maxSize: s }) {
|
|
674
674
|
super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
function ae(e, { size: t }) {
|
|
678
678
|
if (Se(e) > t)
|
|
679
|
-
throw new
|
|
679
|
+
throw new ss({
|
|
680
680
|
givenSize: Se(e),
|
|
681
681
|
maxSize: t
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function ns(e, t = {}) {
|
|
685
685
|
const { signed: s, size: n } = t, r = BigInt(e);
|
|
686
686
|
let i;
|
|
687
687
|
n ? s ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
|
|
688
688
|
const o = typeof i == "bigint" && s ? -i - 1n : 0;
|
|
689
689
|
if (i && r > i || r < o) {
|
|
690
690
|
const c = typeof e == "bigint" ? "n" : "";
|
|
691
|
-
throw new
|
|
691
|
+
throw new ts({
|
|
692
692
|
max: i ? `${i}${c}` : void 0,
|
|
693
693
|
min: `${o}${c}`,
|
|
694
694
|
signed: s,
|
|
@@ -699,11 +699,11 @@ function ss(e, t = {}) {
|
|
|
699
699
|
const a = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`;
|
|
700
700
|
return n ? q(a, { size: n }) : a;
|
|
701
701
|
}
|
|
702
|
-
const
|
|
703
|
-
function rs(e, t = {}) {
|
|
704
|
-
return typeof e == "number" || typeof e == "bigint" ? is(e, t) : typeof e == "boolean" ? os(e, t) : ie(e) ? st(e, t) : nt(e, t);
|
|
705
|
-
}
|
|
702
|
+
const rs = /* @__PURE__ */ new TextEncoder();
|
|
706
703
|
function os(e, t = {}) {
|
|
704
|
+
return typeof e == "number" || typeof e == "bigint" ? as(e, t) : typeof e == "boolean" ? is(e, t) : ie(e) ? st(e, t) : nt(e, t);
|
|
705
|
+
}
|
|
706
|
+
function is(e, t = {}) {
|
|
707
707
|
const s = new Uint8Array(1);
|
|
708
708
|
return s[0] = Number(e), typeof t.size == "number" ? (ae(s, { size: t.size }), q(s, { size: t.size })) : s;
|
|
709
709
|
}
|
|
@@ -715,7 +715,7 @@ const R = {
|
|
|
715
715
|
a: 97,
|
|
716
716
|
f: 102
|
|
717
717
|
};
|
|
718
|
-
function
|
|
718
|
+
function Te(e) {
|
|
719
719
|
if (e >= R.zero && e <= R.nine)
|
|
720
720
|
return e - R.zero;
|
|
721
721
|
if (e >= R.A && e <= R.F)
|
|
@@ -730,45 +730,45 @@ function st(e, t = {}) {
|
|
|
730
730
|
n.length % 2 && (n = `0${n}`);
|
|
731
731
|
const r = n.length / 2, i = new Uint8Array(r);
|
|
732
732
|
for (let o = 0, a = 0; o < r; o++) {
|
|
733
|
-
const c =
|
|
733
|
+
const c = Te(n.charCodeAt(a++)), u = Te(n.charCodeAt(a++));
|
|
734
734
|
if (c === void 0 || u === void 0)
|
|
735
735
|
throw new v(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
|
|
736
736
|
i[o] = c * 16 + u;
|
|
737
737
|
}
|
|
738
738
|
return i;
|
|
739
739
|
}
|
|
740
|
-
function
|
|
741
|
-
const s =
|
|
740
|
+
function as(e, t) {
|
|
741
|
+
const s = ns(e, t);
|
|
742
742
|
return st(s);
|
|
743
743
|
}
|
|
744
744
|
function nt(e, t = {}) {
|
|
745
|
-
const s =
|
|
745
|
+
const s = rs.encode(e);
|
|
746
746
|
return typeof t.size == "number" ? (ae(s, { size: t.size }), q(s, { dir: "right", size: t.size })) : s;
|
|
747
747
|
}
|
|
748
|
-
const
|
|
749
|
-
function as(e, t = !1) {
|
|
750
|
-
return t ? { h: Number(e & $), l: Number(e >> Te & $) } : { h: Number(e >> Te & $) | 0, l: Number(e & $) | 0 };
|
|
751
|
-
}
|
|
748
|
+
const _ = /* @__PURE__ */ BigInt(2 ** 32 - 1), Re = /* @__PURE__ */ BigInt(32);
|
|
752
749
|
function cs(e, t = !1) {
|
|
750
|
+
return t ? { h: Number(e & _), l: Number(e >> Re & _) } : { h: Number(e >> Re & _) | 0, l: Number(e & _) | 0 };
|
|
751
|
+
}
|
|
752
|
+
function us(e, t = !1) {
|
|
753
753
|
const s = e.length;
|
|
754
754
|
let n = new Uint32Array(s), r = new Uint32Array(s);
|
|
755
755
|
for (let i = 0; i < s; i++) {
|
|
756
|
-
const { h: o, l: a } =
|
|
756
|
+
const { h: o, l: a } = cs(e[i], t);
|
|
757
757
|
[n[i], r[i]] = [o, a];
|
|
758
758
|
}
|
|
759
759
|
return [n, r];
|
|
760
760
|
}
|
|
761
|
-
const
|
|
761
|
+
const ls = (e, t, s) => e << s | t >>> 32 - s, fs = (e, t, s) => t << s | e >>> 32 - s, hs = (e, t, s) => t << s - 32 | e >>> 64 - s, ds = (e, t, s) => e << s - 32 | t >>> 64 - s;
|
|
762
762
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
763
|
-
function
|
|
763
|
+
function ps(e) {
|
|
764
764
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
765
765
|
}
|
|
766
766
|
function Ae(e) {
|
|
767
767
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
768
768
|
throw new Error("positive integer expected, got " + e);
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
if (!
|
|
770
|
+
function $(e, ...t) {
|
|
771
|
+
if (!ps(e))
|
|
772
772
|
throw new Error("Uint8Array expected");
|
|
773
773
|
if (t.length > 0 && !t.includes(e.length))
|
|
774
774
|
throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
@@ -779,61 +779,61 @@ function ve(e, t = !0) {
|
|
|
779
779
|
if (t && e.finished)
|
|
780
780
|
throw new Error("Hash#digest() has already been called");
|
|
781
781
|
}
|
|
782
|
-
function
|
|
783
|
-
|
|
782
|
+
function gs(e, t) {
|
|
783
|
+
$(e);
|
|
784
784
|
const s = t.outputLen;
|
|
785
785
|
if (e.length < s)
|
|
786
786
|
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function ms(e) {
|
|
789
789
|
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
790
790
|
}
|
|
791
791
|
function rt(...e) {
|
|
792
792
|
for (let t = 0; t < e.length; t++)
|
|
793
793
|
e[t].fill(0);
|
|
794
794
|
}
|
|
795
|
-
const
|
|
796
|
-
function
|
|
795
|
+
const ys = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
796
|
+
function ws(e) {
|
|
797
797
|
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
798
798
|
}
|
|
799
|
-
function
|
|
799
|
+
function bs(e) {
|
|
800
800
|
for (let t = 0; t < e.length; t++)
|
|
801
|
-
e[t] =
|
|
801
|
+
e[t] = ws(e[t]);
|
|
802
802
|
return e;
|
|
803
803
|
}
|
|
804
|
-
const Pe =
|
|
805
|
-
function
|
|
804
|
+
const Pe = ys ? (e) => e : bs;
|
|
805
|
+
function Es(e) {
|
|
806
806
|
if (typeof e != "string")
|
|
807
807
|
throw new Error("string expected");
|
|
808
808
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
809
809
|
}
|
|
810
810
|
function ot(e) {
|
|
811
|
-
return typeof e == "string" && (e =
|
|
811
|
+
return typeof e == "string" && (e = Es(e)), $(e), e;
|
|
812
812
|
}
|
|
813
|
-
class
|
|
813
|
+
class Ss {
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function Ts(e) {
|
|
816
816
|
const t = (n) => e().update(ot(n)).digest(), s = e();
|
|
817
817
|
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
818
818
|
}
|
|
819
|
-
const Rs = BigInt(0),
|
|
820
|
-
for (let e = 0, t =
|
|
819
|
+
const Rs = BigInt(0), x = BigInt(1), As = BigInt(2), vs = BigInt(7), Ps = BigInt(256), Is = BigInt(113), it = [], at = [], ct = [];
|
|
820
|
+
for (let e = 0, t = x, s = 1, n = 0; e < 24; e++) {
|
|
821
821
|
[s, n] = [n, (2 * s + 3 * n) % 5], it.push(2 * (5 * n + s)), at.push((e + 1) * (e + 2) / 2 % 64);
|
|
822
822
|
let r = Rs;
|
|
823
823
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
t = (t <<
|
|
824
|
+
t = (t << x ^ (t >> vs) * Is) % Ps, t & As && (r ^= x << (x << /* @__PURE__ */ BigInt(i)) - x);
|
|
825
825
|
ct.push(r);
|
|
826
826
|
}
|
|
827
|
-
const ut =
|
|
828
|
-
function
|
|
827
|
+
const ut = us(ct, !0), Us = ut[0], Cs = ut[1], Ie = (e, t, s) => s > 32 ? hs(e, t, s) : ls(e, t, s), Ue = (e, t, s) => s > 32 ? ds(e, t, s) : fs(e, t, s);
|
|
828
|
+
function ks(e, t = 24) {
|
|
829
829
|
const s = new Uint32Array(10);
|
|
830
830
|
for (let n = 24 - t; n < 24; n++) {
|
|
831
831
|
for (let o = 0; o < 10; o++)
|
|
832
832
|
s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
|
|
833
833
|
for (let o = 0; o < 10; o += 2) {
|
|
834
|
-
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], f = s[c + 1],
|
|
835
|
-
for (let
|
|
836
|
-
e[o +
|
|
834
|
+
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], f = s[c + 1], w = Ie(u, f, 1) ^ s[a], p = Ue(u, f, 1) ^ s[a + 1];
|
|
835
|
+
for (let y = 0; y < 50; y += 10)
|
|
836
|
+
e[o + y] ^= w, e[o + y + 1] ^= p;
|
|
837
837
|
}
|
|
838
838
|
let r = e[2], i = e[3];
|
|
839
839
|
for (let o = 0; o < 24; o++) {
|
|
@@ -846,25 +846,25 @@ function Cs(e, t = 24) {
|
|
|
846
846
|
for (let a = 0; a < 10; a++)
|
|
847
847
|
e[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
848
848
|
}
|
|
849
|
-
e[0] ^=
|
|
849
|
+
e[0] ^= Us[n], e[1] ^= Cs[n];
|
|
850
850
|
}
|
|
851
851
|
rt(s);
|
|
852
852
|
}
|
|
853
|
-
class ce extends
|
|
853
|
+
class ce extends Ss {
|
|
854
854
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
855
855
|
constructor(t, s, n, r = !1, i = 24) {
|
|
856
856
|
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, Ae(n), !(0 < t && t < 200))
|
|
857
857
|
throw new Error("only keccak-f1600 function is supported");
|
|
858
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
858
|
+
this.state = new Uint8Array(200), this.state32 = ms(this.state);
|
|
859
859
|
}
|
|
860
860
|
clone() {
|
|
861
861
|
return this._cloneInto();
|
|
862
862
|
}
|
|
863
863
|
keccak() {
|
|
864
|
-
Pe(this.state32),
|
|
864
|
+
Pe(this.state32), ks(this.state32, this.rounds), Pe(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
865
|
}
|
|
866
866
|
update(t) {
|
|
867
|
-
ve(this), t = ot(t),
|
|
867
|
+
ve(this), t = ot(t), $(t);
|
|
868
868
|
const { blockLen: s, state: n } = this, r = t.length;
|
|
869
869
|
for (let i = 0; i < r; ) {
|
|
870
870
|
const o = Math.min(s - this.pos, r - i);
|
|
@@ -882,7 +882,7 @@ class ce extends Es {
|
|
|
882
882
|
t[n] ^= s, (s & 128) !== 0 && n === r - 1 && this.keccak(), t[r - 1] ^= 128, this.keccak();
|
|
883
883
|
}
|
|
884
884
|
writeInto(t) {
|
|
885
|
-
ve(this, !1),
|
|
885
|
+
ve(this, !1), $(t), this.finish();
|
|
886
886
|
const s = this.state, { blockLen: n } = this;
|
|
887
887
|
for (let r = 0, i = t.length; r < i; ) {
|
|
888
888
|
this.posOut >= n && this.keccak();
|
|
@@ -900,7 +900,7 @@ class ce extends Es {
|
|
|
900
900
|
return Ae(t), this.xofInto(new Uint8Array(t));
|
|
901
901
|
}
|
|
902
902
|
digestInto(t) {
|
|
903
|
-
if (
|
|
903
|
+
if (gs(t, this), this.finished)
|
|
904
904
|
throw new Error("digest() was already called");
|
|
905
905
|
return this.writeInto(t), this.destroy(), t;
|
|
906
906
|
}
|
|
@@ -915,11 +915,11 @@ class ce extends Es {
|
|
|
915
915
|
return t || (t = new ce(s, n, r, o, i)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = i, t.suffix = n, t.outputLen = r, t.enableXOF = o, t.destroyed = this.destroyed, t;
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
|
-
const xs = (e, t, s) =>
|
|
919
|
-
function
|
|
920
|
-
return
|
|
918
|
+
const xs = (e, t, s) => Ts(() => new ce(t, e, s)), Ds = xs(1, 136, 256 / 8);
|
|
919
|
+
function Os(e, t) {
|
|
920
|
+
return Ds(ie(e, { strict: !1 }) ? os(e) : e);
|
|
921
921
|
}
|
|
922
|
-
class
|
|
922
|
+
class Ns extends v {
|
|
923
923
|
constructor({ address: t }) {
|
|
924
924
|
super(`Address "${t}" is invalid.`, {
|
|
925
925
|
metaMessages: [
|
|
@@ -955,28 +955,28 @@ const W = /* @__PURE__ */ new lt(8192);
|
|
|
955
955
|
function ft(e, t) {
|
|
956
956
|
if (W.has(`${e}.${t}`))
|
|
957
957
|
return W.get(`${e}.${t}`);
|
|
958
|
-
const s = e.substring(2).toLowerCase(), n =
|
|
958
|
+
const s = e.substring(2).toLowerCase(), n = Os(nt(s)), r = s.split("");
|
|
959
959
|
for (let o = 0; o < 40; o += 2)
|
|
960
960
|
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());
|
|
961
961
|
const i = `0x${r.join("")}`;
|
|
962
962
|
return W.set(`${e}.${t}`, i), i;
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
if (!
|
|
966
|
-
throw new
|
|
964
|
+
function A(e, t) {
|
|
965
|
+
if (!Bs(e, { strict: !1 }))
|
|
966
|
+
throw new Ns({ address: e });
|
|
967
967
|
return ft(e, t);
|
|
968
968
|
}
|
|
969
|
-
const
|
|
970
|
-
function
|
|
969
|
+
const Ms = /^0x[a-fA-F0-9]{40}$/, V = /* @__PURE__ */ new lt(8192);
|
|
970
|
+
function Bs(e, t) {
|
|
971
971
|
const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
|
|
972
972
|
if (V.has(n))
|
|
973
973
|
return V.get(n);
|
|
974
|
-
const r =
|
|
974
|
+
const r = Ms.test(e) ? e.toLowerCase() === e ? !0 : s ? ft(e) === e : !0 : !1;
|
|
975
975
|
return V.set(n, r), r;
|
|
976
976
|
}
|
|
977
|
-
const
|
|
977
|
+
const _s = {
|
|
978
978
|
chainId: He.chainId,
|
|
979
|
-
address:
|
|
979
|
+
address: A("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
980
980
|
symbol: "USDC",
|
|
981
981
|
fiatISO: "USD",
|
|
982
982
|
decimals: 6,
|
|
@@ -984,7 +984,7 @@ const Bs = {
|
|
|
984
984
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
985
985
|
}, $s = {
|
|
986
986
|
chainId: Fe.chainId,
|
|
987
|
-
address:
|
|
987
|
+
address: A("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
988
988
|
symbol: "USDC",
|
|
989
989
|
name: "USD Coin",
|
|
990
990
|
decimals: 6,
|
|
@@ -992,58 +992,58 @@ const Bs = {
|
|
|
992
992
|
/* USDC */
|
|
993
993
|
}, Ls = {
|
|
994
994
|
chainId: Ge.chainId,
|
|
995
|
-
address:
|
|
995
|
+
address: A("0x5425890298aed601595a70ab815c96711a31bc65"),
|
|
996
996
|
symbol: "USDC",
|
|
997
997
|
fiatISO: "USD",
|
|
998
998
|
decimals: 6,
|
|
999
999
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1000
1000
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1001
|
-
},
|
|
1001
|
+
}, zs = {
|
|
1002
1002
|
chainId: Je.chainId,
|
|
1003
|
-
address:
|
|
1003
|
+
address: A("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
1004
1004
|
symbol: "USDC",
|
|
1005
1005
|
fiatISO: "USD",
|
|
1006
1006
|
decimals: 6,
|
|
1007
1007
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1008
1008
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1009
|
-
},
|
|
1009
|
+
}, js = {
|
|
1010
1010
|
chainId: We.chainId,
|
|
1011
|
-
address:
|
|
1011
|
+
address: A("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
1012
1012
|
symbol: "USDC",
|
|
1013
1013
|
fiatISO: "USD",
|
|
1014
1014
|
decimals: 6,
|
|
1015
1015
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1016
1016
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1017
|
-
},
|
|
1017
|
+
}, qs = {
|
|
1018
1018
|
chainId: Ke.chainId,
|
|
1019
|
-
address:
|
|
1019
|
+
address: A("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
1020
1020
|
symbol: "USDC",
|
|
1021
1021
|
fiatISO: "USD",
|
|
1022
1022
|
decimals: 6,
|
|
1023
1023
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1024
1024
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1025
|
-
},
|
|
1025
|
+
}, Fs = {
|
|
1026
1026
|
chainId: Ve.chainId,
|
|
1027
|
-
address:
|
|
1027
|
+
address: A("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1028
1028
|
symbol: "USDC",
|
|
1029
1029
|
decimals: 18,
|
|
1030
1030
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1031
1031
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1032
|
-
},
|
|
1032
|
+
}, Hs = {
|
|
1033
1033
|
chainId: Xe.chainId,
|
|
1034
|
-
address:
|
|
1034
|
+
address: A("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1035
1035
|
symbol: "USDC",
|
|
1036
1036
|
decimals: 6,
|
|
1037
1037
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1038
1038
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1039
|
-
},
|
|
1039
|
+
}, Ks = {
|
|
1040
1040
|
chainId: Ye.chainId,
|
|
1041
|
-
address:
|
|
1041
|
+
address: A("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1042
1042
|
symbol: "USDC",
|
|
1043
1043
|
decimals: 6,
|
|
1044
1044
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1045
1045
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1046
|
-
},
|
|
1046
|
+
}, Ws = {
|
|
1047
1047
|
chainId: Ze.chainId,
|
|
1048
1048
|
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
1049
1049
|
symbol: "USDC",
|
|
@@ -1062,13 +1062,13 @@ const Bs = {
|
|
|
1062
1062
|
...He,
|
|
1063
1063
|
explorer: "https://sepolia.arbiscan.io",
|
|
1064
1064
|
tokens: {
|
|
1065
|
-
[S.USDC]:
|
|
1065
|
+
[S.USDC]: _s
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
1068
|
AVALANCHE_MAINNET: {
|
|
1069
1069
|
...Je,
|
|
1070
1070
|
tokens: {
|
|
1071
|
-
[S.USDC]:
|
|
1071
|
+
[S.USDC]: zs
|
|
1072
1072
|
},
|
|
1073
1073
|
explorer: "https://snowtrace.io"
|
|
1074
1074
|
},
|
|
@@ -1082,87 +1082,87 @@ const Bs = {
|
|
|
1082
1082
|
BASE_MAINNET: {
|
|
1083
1083
|
...Ke,
|
|
1084
1084
|
tokens: {
|
|
1085
|
-
[S.USDC]:
|
|
1085
|
+
[S.USDC]: qs
|
|
1086
1086
|
},
|
|
1087
1087
|
explorer: "https://basescan.org"
|
|
1088
1088
|
},
|
|
1089
1089
|
BASE_TESTNET: {
|
|
1090
1090
|
...We,
|
|
1091
1091
|
tokens: {
|
|
1092
|
-
[S.USDC]:
|
|
1092
|
+
[S.USDC]: js
|
|
1093
1093
|
},
|
|
1094
1094
|
explorer: "https://sepolia.basescan.org"
|
|
1095
1095
|
},
|
|
1096
1096
|
BSC_MAINNET: {
|
|
1097
1097
|
...Ve,
|
|
1098
1098
|
tokens: {
|
|
1099
|
-
[S.USDC]:
|
|
1099
|
+
[S.USDC]: Fs
|
|
1100
1100
|
},
|
|
1101
1101
|
explorer: "https://bscscan.com"
|
|
1102
1102
|
},
|
|
1103
1103
|
ETHEREUM_MAINNET: {
|
|
1104
1104
|
...Ye,
|
|
1105
1105
|
tokens: {
|
|
1106
|
-
[S.USDC]:
|
|
1106
|
+
[S.USDC]: Ks
|
|
1107
1107
|
},
|
|
1108
1108
|
explorer: "https://etherscan.io"
|
|
1109
1109
|
},
|
|
1110
1110
|
ETHEREUM_TESTNET: {
|
|
1111
1111
|
...Xe,
|
|
1112
1112
|
tokens: {
|
|
1113
|
-
[S.USDC]:
|
|
1113
|
+
[S.USDC]: Hs
|
|
1114
1114
|
},
|
|
1115
1115
|
explorer: "https://sepolia.etherscan.io"
|
|
1116
1116
|
},
|
|
1117
1117
|
STARKNET_MAINNET: {
|
|
1118
1118
|
...Ze,
|
|
1119
1119
|
tokens: {
|
|
1120
|
-
[S.USDC]:
|
|
1120
|
+
[S.USDC]: Ws
|
|
1121
1121
|
},
|
|
1122
1122
|
explorer: ""
|
|
1123
1123
|
}
|
|
1124
1124
|
};
|
|
1125
1125
|
var Q = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(Q || {}), ht = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ht || {});
|
|
1126
|
-
const
|
|
1126
|
+
const Vs = (e) => {
|
|
1127
1127
|
const t = e?.trim().toUpperCase();
|
|
1128
1128
|
if (Ce[t])
|
|
1129
1129
|
return Ce[t];
|
|
1130
1130
|
};
|
|
1131
|
-
function
|
|
1132
|
-
return
|
|
1131
|
+
function Ys(e, t) {
|
|
1132
|
+
return Vs(e)?.tokens[t]?.address;
|
|
1133
1133
|
}
|
|
1134
1134
|
var ue = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(ue || {});
|
|
1135
|
-
class
|
|
1135
|
+
class d {
|
|
1136
1136
|
constructor({ api_key: t, env: s, seesion_token: n }) {
|
|
1137
1137
|
this.api_key = t || "", this.sessionToken = n || "", this.env = s ?? ue.PRODUCTION;
|
|
1138
1138
|
}
|
|
1139
1139
|
static async config(t) {
|
|
1140
|
-
if (!
|
|
1140
|
+
if (!d.app) {
|
|
1141
1141
|
if (!t)
|
|
1142
1142
|
throw new Error("Please provide an api_key");
|
|
1143
|
-
|
|
1143
|
+
d.app = new d(t);
|
|
1144
1144
|
}
|
|
1145
|
-
return t && (t.api_key !== void 0 && (
|
|
1145
|
+
return t && (t.api_key !== void 0 && (d.app.api_key = t.api_key), t.seesion_token !== void 0 && (d.app.sessionToken = t.seesion_token), t.env !== void 0 && (d.app.env = t.env)), d.app;
|
|
1146
1146
|
}
|
|
1147
1147
|
static getApiKey() {
|
|
1148
|
-
if (!
|
|
1148
|
+
if (!d.app)
|
|
1149
1149
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1150
|
-
return
|
|
1150
|
+
return d.app.api_key;
|
|
1151
1151
|
}
|
|
1152
1152
|
static getSessionToken() {
|
|
1153
|
-
if (!
|
|
1153
|
+
if (!d.app)
|
|
1154
1154
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1155
|
-
return
|
|
1155
|
+
return d.app.sessionToken;
|
|
1156
1156
|
}
|
|
1157
1157
|
static getEnv() {
|
|
1158
|
-
if (!
|
|
1158
|
+
if (!d.app)
|
|
1159
1159
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1160
|
-
return
|
|
1160
|
+
return d.app.env === "internal" ? "staging" : d.app.env;
|
|
1161
1161
|
}
|
|
1162
1162
|
static getBaseUrl() {
|
|
1163
|
-
if (!
|
|
1163
|
+
if (!d.app)
|
|
1164
1164
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1165
|
-
switch (
|
|
1165
|
+
switch (d.app.env) {
|
|
1166
1166
|
case "production":
|
|
1167
1167
|
return "https://api.chainrails.io/api/v1";
|
|
1168
1168
|
case "staging":
|
|
@@ -1174,23 +1174,23 @@ class h {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
static getPayModalUrl(t, s, n, r) {
|
|
1177
|
-
if (!
|
|
1177
|
+
if (!d.app)
|
|
1178
1178
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1179
|
-
const i =
|
|
1179
|
+
const i = d.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 : ""}`;
|
|
1180
1180
|
return i + o + a;
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
1183
|
let ee = null;
|
|
1184
|
-
function
|
|
1185
|
-
ee =
|
|
1186
|
-
prefixUrl:
|
|
1184
|
+
function Xs() {
|
|
1185
|
+
ee = Zt.create({
|
|
1186
|
+
prefixUrl: d.getBaseUrl(),
|
|
1187
1187
|
headers: {
|
|
1188
1188
|
"Content-Type": "application/json"
|
|
1189
1189
|
},
|
|
1190
1190
|
hooks: {
|
|
1191
1191
|
beforeRequest: [
|
|
1192
1192
|
(e) => {
|
|
1193
|
-
const t =
|
|
1193
|
+
const t = d.getSessionToken() || d.getApiKey();
|
|
1194
1194
|
e.headers.set("Authorization", `Bearer ${t}`);
|
|
1195
1195
|
}
|
|
1196
1196
|
],
|
|
@@ -1201,103 +1201,103 @@ function Ys() {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return ee ||
|
|
1204
|
+
function g() {
|
|
1205
|
+
return ee || Xs(), ee;
|
|
1206
1206
|
}
|
|
1207
|
-
class
|
|
1207
|
+
class Js {
|
|
1208
1208
|
async getById(t) {
|
|
1209
|
-
return await
|
|
1209
|
+
return await g().get("intents/" + t).json();
|
|
1210
1210
|
}
|
|
1211
1211
|
async getForSender(t) {
|
|
1212
|
-
return await
|
|
1212
|
+
return await g().get("intents/user/" + t).json();
|
|
1213
1213
|
}
|
|
1214
1214
|
async getForAddress(t) {
|
|
1215
|
-
return await
|
|
1215
|
+
return await g().get("intents/address/" + t).json();
|
|
1216
1216
|
}
|
|
1217
1217
|
async getForSession(t) {
|
|
1218
|
-
return await
|
|
1218
|
+
return await g().get("modal/sessions/intents/" + t).json();
|
|
1219
1219
|
}
|
|
1220
1220
|
async getAll(t) {
|
|
1221
|
-
return await
|
|
1221
|
+
return await g().get("intents", { searchParams: t }).json();
|
|
1222
1222
|
}
|
|
1223
1223
|
async create(t) {
|
|
1224
|
-
return await
|
|
1224
|
+
return await g().post("intents", { json: t }).json();
|
|
1225
1225
|
}
|
|
1226
1226
|
async createForSession(t) {
|
|
1227
|
-
return await
|
|
1227
|
+
return await g().post("modal/sessions/intents", { json: t }).json();
|
|
1228
1228
|
}
|
|
1229
1229
|
async update(t, s) {
|
|
1230
|
-
return await
|
|
1230
|
+
return await g().post("intents", { json: s }).json();
|
|
1231
1231
|
}
|
|
1232
1232
|
async triggerProcessing(t) {
|
|
1233
|
-
return await
|
|
1233
|
+
return await g().post(`intents/${t}/trigger-processing`).json();
|
|
1234
1234
|
}
|
|
1235
1235
|
async triggerProcessingForSession(t) {
|
|
1236
|
-
return await
|
|
1236
|
+
return await g().post(`modal/sessions/intents/${t}/process`).json();
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
class
|
|
1239
|
+
class Gs {
|
|
1240
1240
|
async getFromSpecificBridge(t) {
|
|
1241
|
-
return await
|
|
1241
|
+
return await g().get("quotes/single", { searchParams: t }).json();
|
|
1242
1242
|
}
|
|
1243
1243
|
async getFromAllBridges(t) {
|
|
1244
|
-
return await
|
|
1244
|
+
return await g().get("quotes/multiple", { searchParams: t }).json();
|
|
1245
1245
|
}
|
|
1246
1246
|
async getBestAcrossBridges(t) {
|
|
1247
|
-
return await
|
|
1247
|
+
return await g().get("quotes/best", { searchParams: t }).json();
|
|
1248
1248
|
}
|
|
1249
1249
|
async getAll(t) {
|
|
1250
|
-
return await
|
|
1250
|
+
return await g().get("quotes/multi-source", { searchParams: t }).json();
|
|
1251
1251
|
}
|
|
1252
1252
|
async getAllForSession(t) {
|
|
1253
|
-
return await
|
|
1253
|
+
return await g().get("modal/sessions/quotes", { searchParams: t }).json();
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
|
-
class
|
|
1256
|
+
class Zs {
|
|
1257
1257
|
async getOptimalRoutes(t) {
|
|
1258
|
-
return await
|
|
1258
|
+
return await g().get("router/optimal-route", { searchParams: t }).json();
|
|
1259
1259
|
}
|
|
1260
1260
|
async getAllSupportedBridges() {
|
|
1261
|
-
return await
|
|
1261
|
+
return await g().get("router/supported-bridges/all").json();
|
|
1262
1262
|
}
|
|
1263
1263
|
async getSupportedBridges(t) {
|
|
1264
|
-
return await
|
|
1264
|
+
return await g().get("router/supported-bridges/route", { searchParams: t }).json();
|
|
1265
1265
|
}
|
|
1266
1266
|
async getSupportedRoutes(t, s) {
|
|
1267
|
-
return await
|
|
1267
|
+
return await g().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
|
-
class
|
|
1270
|
+
class Qs {
|
|
1271
1271
|
async getSupported(t) {
|
|
1272
|
-
return await
|
|
1272
|
+
return await g().get("chains", { searchParams: t }).json();
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
|
-
class
|
|
1275
|
+
class en {
|
|
1276
1276
|
async getClientInfo() {
|
|
1277
|
-
return await
|
|
1277
|
+
return await g().get("client/auth/client-info").json();
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
-
class
|
|
1280
|
+
class tn {
|
|
1281
1281
|
getSessionToken(t) {
|
|
1282
1282
|
const s = {
|
|
1283
1283
|
recipient: t.recipient,
|
|
1284
|
-
tokenOut:
|
|
1284
|
+
tokenOut: Ys(
|
|
1285
1285
|
Q[t.destinationChain],
|
|
1286
1286
|
ht[t.token]
|
|
1287
1287
|
),
|
|
1288
1288
|
destinationChain: Q[t.destinationChain],
|
|
1289
1289
|
amount: t.amount
|
|
1290
1290
|
};
|
|
1291
|
-
return
|
|
1291
|
+
return g().post("modal/sessions", { json: s }).json();
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
|
-
const
|
|
1295
|
-
router: new
|
|
1296
|
-
quotes: new
|
|
1297
|
-
intents: new
|
|
1298
|
-
chains: new
|
|
1299
|
-
client: new
|
|
1300
|
-
auth: new
|
|
1294
|
+
const In = {
|
|
1295
|
+
router: new Zs(),
|
|
1296
|
+
quotes: new Gs(),
|
|
1297
|
+
intents: new Js(),
|
|
1298
|
+
chains: new Qs(),
|
|
1299
|
+
client: new en(),
|
|
1300
|
+
auth: new tn()
|
|
1301
1301
|
};
|
|
1302
1302
|
function dt(e) {
|
|
1303
1303
|
var t, s, n = "";
|
|
@@ -1308,11 +1308,11 @@ function dt(e) {
|
|
|
1308
1308
|
} else for (s in e) e[s] && (n && (n += " "), n += s);
|
|
1309
1309
|
return n;
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function sn() {
|
|
1312
1312
|
for (var e, t, s = 0, n = "", r = arguments.length; s < r; s++) (e = arguments[s]) && (t = dt(e)) && (n && (n += " "), n += t);
|
|
1313
1313
|
return n;
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1315
|
+
function Un(e) {
|
|
1316
1316
|
const {
|
|
1317
1317
|
recipient: t,
|
|
1318
1318
|
token: s,
|
|
@@ -1324,34 +1324,38 @@ function In(e) {
|
|
|
1324
1324
|
close: c,
|
|
1325
1325
|
onCancel: u,
|
|
1326
1326
|
onSuccess: f,
|
|
1327
|
-
|
|
1328
|
-
|
|
1327
|
+
session_url: w,
|
|
1328
|
+
data: p
|
|
1329
|
+
} = e, [y, T] = X(!0), b = ne(null);
|
|
1329
1330
|
re(() => {
|
|
1330
|
-
|
|
1331
|
-
const
|
|
1332
|
-
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1331
|
+
m();
|
|
1332
|
+
const h = document.body.style.overflow;
|
|
1333
|
+
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = h || "";
|
|
1334
|
+
const E = (P) => {
|
|
1335
|
+
P.data === "closed" && (c(), u?.()), P.data === "completed" && (window.setTimeout(c, 2e3), f?.());
|
|
1335
1336
|
};
|
|
1336
|
-
return window.addEventListener("message",
|
|
1337
|
-
document.body.style.overflow =
|
|
1337
|
+
return window.addEventListener("message", E), () => {
|
|
1338
|
+
document.body.style.overflow = h || "", window.removeEventListener("message", E);
|
|
1338
1339
|
};
|
|
1339
|
-
}, [i, u, f,
|
|
1340
|
-
function A() {
|
|
1341
|
-
w(!1), l();
|
|
1342
|
-
}
|
|
1340
|
+
}, [i, u, f, p?.sessionToken]);
|
|
1343
1341
|
function l() {
|
|
1344
|
-
|
|
1345
|
-
|
|
1342
|
+
T(!1), m();
|
|
1343
|
+
}
|
|
1344
|
+
function m() {
|
|
1345
|
+
if (!p?.sessionToken) return;
|
|
1346
|
+
const h = {
|
|
1346
1347
|
type: "session",
|
|
1347
|
-
session_token:
|
|
1348
|
-
environment:
|
|
1348
|
+
session_token: p.sessionToken,
|
|
1349
|
+
environment: d.getEnv() || ue.PRODUCTION
|
|
1349
1350
|
};
|
|
1350
|
-
console.log(b.current, b.current?.contentWindow, b.current?.src), b.current?.contentWindow?.postMessage(
|
|
1351
|
-
}
|
|
1352
|
-
return
|
|
1353
|
-
|
|
1354
|
-
|
|
1351
|
+
console.log(b.current, b.current?.contentWindow, b.current?.src), b.current?.contentWindow?.postMessage(h, "https://app.chainrails.io"), b.current?.contentWindow?.postMessage(h, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1352
|
+
}
|
|
1353
|
+
return d.config({
|
|
1354
|
+
api_key: p?.sessionToken || "",
|
|
1355
|
+
env: w === "https://chainrails-sdk-server.vercel.app/test/create-session" ? "internal" : "production"
|
|
1356
|
+
}), p?.sessionToken ? /* @__PURE__ */ we("div", {
|
|
1357
|
+
className: sn("payment-modal-wrapper", y || o ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
1358
|
+
children: [(y || o) && /* @__PURE__ */ k("div", {
|
|
1355
1359
|
role: "status",
|
|
1356
1360
|
className: "payment-modal-loader",
|
|
1357
1361
|
children: /* @__PURE__ */ we("svg", {
|
|
@@ -1360,65 +1364,65 @@ function In(e) {
|
|
|
1360
1364
|
viewBox: "0 0 100 101",
|
|
1361
1365
|
fill: "none",
|
|
1362
1366
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1363
|
-
children: [/* @__PURE__ */
|
|
1367
|
+
children: [/* @__PURE__ */ k("path", {
|
|
1364
1368
|
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",
|
|
1365
1369
|
fill: "currentColor"
|
|
1366
|
-
}), /* @__PURE__ */
|
|
1370
|
+
}), /* @__PURE__ */ k("path", {
|
|
1367
1371
|
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",
|
|
1368
1372
|
fill: "currentFill"
|
|
1369
1373
|
})]
|
|
1370
1374
|
})
|
|
1371
|
-
}), /* @__PURE__ */
|
|
1375
|
+
}), /* @__PURE__ */ k("iframe", {
|
|
1372
1376
|
allow: "clipboard-read *; clipboard-write *",
|
|
1373
|
-
src:
|
|
1374
|
-
onLoad:
|
|
1375
|
-
className: `payment-modal ${
|
|
1377
|
+
src: d.getPayModalUrl(n, s, t, r),
|
|
1378
|
+
onLoad: l,
|
|
1379
|
+
className: `payment-modal ${y || o ? "invisible" : "visible"}`,
|
|
1376
1380
|
"data-id": r,
|
|
1377
1381
|
ref: b
|
|
1378
1382
|
})]
|
|
1379
|
-
});
|
|
1383
|
+
}) : /* @__PURE__ */ k(It, {});
|
|
1380
1384
|
}
|
|
1381
|
-
function
|
|
1385
|
+
function nn(e) {
|
|
1382
1386
|
return BigInt(e).toString();
|
|
1383
1387
|
}
|
|
1384
|
-
const
|
|
1385
|
-
let
|
|
1386
|
-
const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (se.has(e) ? se.get(e) : te(e) === Object.prototype || te(e) === Array.prototype),
|
|
1388
|
+
const rn = Symbol(), le = Symbol(), D = "a", pt = "f", ke = "p", gt = "c", mt = "t", fe = "h", O = "w", he = "o", de = "k";
|
|
1389
|
+
let on = (e, t) => new Proxy(e, t);
|
|
1390
|
+
const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (se.has(e) ? se.get(e) : te(e) === Object.prototype || te(e) === Array.prototype), L = (e) => typeof e == "object" && e !== null, an = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), cn = (e) => {
|
|
1387
1391
|
if (Array.isArray(e))
|
|
1388
1392
|
return Array.from(e);
|
|
1389
1393
|
const t = Object.getOwnPropertyDescriptors(e);
|
|
1390
1394
|
return Object.values(t).forEach((s) => {
|
|
1391
1395
|
s.configurable = !0;
|
|
1392
1396
|
}), Object.create(te(e), t);
|
|
1393
|
-
},
|
|
1397
|
+
}, un = (e, t) => {
|
|
1394
1398
|
const s = {
|
|
1395
1399
|
[pt]: t
|
|
1396
1400
|
};
|
|
1397
1401
|
let n = !1;
|
|
1398
1402
|
const r = (a, c) => {
|
|
1399
1403
|
if (!n) {
|
|
1400
|
-
let u = s[
|
|
1401
|
-
if (u || (u = {}, s[
|
|
1402
|
-
u[
|
|
1404
|
+
let u = s[D].get(e);
|
|
1405
|
+
if (u || (u = {}, s[D].set(e, u)), a === O)
|
|
1406
|
+
u[O] = !0;
|
|
1403
1407
|
else {
|
|
1404
1408
|
let f = u[a];
|
|
1405
1409
|
f || (f = /* @__PURE__ */ new Set(), u[a] = f), f.add(c);
|
|
1406
1410
|
}
|
|
1407
1411
|
}
|
|
1408
1412
|
}, i = () => {
|
|
1409
|
-
n = !0, s[
|
|
1413
|
+
n = !0, s[D].delete(e);
|
|
1410
1414
|
}, o = {
|
|
1411
1415
|
get(a, c) {
|
|
1412
|
-
return c === le ? e : (r(de, c), wt(Reflect.get(a, c), s[
|
|
1416
|
+
return c === le ? e : (r(de, c), wt(Reflect.get(a, c), s[D], s[gt], s[mt]));
|
|
1413
1417
|
},
|
|
1414
1418
|
has(a, c) {
|
|
1415
|
-
return c ===
|
|
1419
|
+
return c === rn ? (i(), !0) : (r(fe, c), Reflect.has(a, c));
|
|
1416
1420
|
},
|
|
1417
1421
|
getOwnPropertyDescriptor(a, c) {
|
|
1418
1422
|
return r(he, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
1419
1423
|
},
|
|
1420
1424
|
ownKeys(a) {
|
|
1421
|
-
return r(
|
|
1425
|
+
return r(O), Reflect.ownKeys(a);
|
|
1422
1426
|
}
|
|
1423
1427
|
};
|
|
1424
1428
|
return t && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
@@ -1432,18 +1436,18 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1432
1436
|
let r = n && n.get(e);
|
|
1433
1437
|
if (!r) {
|
|
1434
1438
|
const c = pe(e);
|
|
1435
|
-
|
|
1439
|
+
an(c) ? r = [c, cn(c)] : r = [c], n?.set(e, r);
|
|
1436
1440
|
}
|
|
1437
1441
|
const [i, o] = r;
|
|
1438
1442
|
let a = s && s.get(i);
|
|
1439
|
-
return (!a || a[1][pt] !== !!o) && (a =
|
|
1440
|
-
},
|
|
1443
|
+
return (!a || a[1][pt] !== !!o) && (a = un(i, !!o), a[1][ke] = on(o || i, a[0]), s && s.set(i, a)), a[1][D] = t, a[1][gt] = s, a[1][mt] = n, a[1][ke];
|
|
1444
|
+
}, ln = (e, t) => {
|
|
1441
1445
|
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1442
1446
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
1443
1447
|
}, bt = (e, t, s, n, r = Object.is) => {
|
|
1444
1448
|
if (r(e, t))
|
|
1445
1449
|
return !1;
|
|
1446
|
-
if (!
|
|
1450
|
+
if (!L(e) || !L(t))
|
|
1447
1451
|
return !0;
|
|
1448
1452
|
const i = s.get(pe(e));
|
|
1449
1453
|
if (!i)
|
|
@@ -1457,8 +1461,8 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1457
1461
|
for (const a of i[fe] || [])
|
|
1458
1462
|
if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
|
|
1459
1463
|
return o;
|
|
1460
|
-
if (i[
|
|
1461
|
-
if (o =
|
|
1464
|
+
if (i[O] === !0) {
|
|
1465
|
+
if (o = ln(e, t), o)
|
|
1462
1466
|
return o;
|
|
1463
1467
|
} else
|
|
1464
1468
|
for (const a of i[he] || []) {
|
|
@@ -1472,39 +1476,39 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1472
1476
|
if (o === null)
|
|
1473
1477
|
throw new Error("invalid used");
|
|
1474
1478
|
return o;
|
|
1475
|
-
},
|
|
1479
|
+
}, fn = (e) => yt(e) && e[le] || null, xe = (e, t = !0) => {
|
|
1476
1480
|
se.set(e, t);
|
|
1477
|
-
},
|
|
1481
|
+
}, hn = (e, t, s) => {
|
|
1478
1482
|
const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
1479
1483
|
var c, u, f;
|
|
1480
1484
|
if (r.has(o))
|
|
1481
1485
|
return;
|
|
1482
|
-
|
|
1483
|
-
const
|
|
1484
|
-
if (
|
|
1485
|
-
if ((c =
|
|
1486
|
-
const
|
|
1487
|
-
n.push(a ? [...a,
|
|
1488
|
-
}),
|
|
1489
|
-
const
|
|
1490
|
-
n.push(a ? [...a,
|
|
1486
|
+
L(o) && r.add(o);
|
|
1487
|
+
const w = L(o) && t.get(pe(o));
|
|
1488
|
+
if (w) {
|
|
1489
|
+
if ((c = w[fe]) === null || c === void 0 || c.forEach((p) => {
|
|
1490
|
+
const y = `:has(${String(p)})`;
|
|
1491
|
+
n.push(a ? [...a, y] : [y]);
|
|
1492
|
+
}), w[O] === !0) {
|
|
1493
|
+
const p = ":ownKeys";
|
|
1494
|
+
n.push(a ? [...a, p] : [p]);
|
|
1491
1495
|
} else
|
|
1492
|
-
(u =
|
|
1493
|
-
const
|
|
1494
|
-
n.push(a ? [...a,
|
|
1496
|
+
(u = w[he]) === null || u === void 0 || u.forEach((p) => {
|
|
1497
|
+
const y = `:hasOwn(${String(p)})`;
|
|
1498
|
+
n.push(a ? [...a, y] : [y]);
|
|
1495
1499
|
});
|
|
1496
|
-
(f =
|
|
1497
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
1500
|
+
(f = w[de]) === null || f === void 0 || f.forEach((p) => {
|
|
1501
|
+
"value" in (Object.getOwnPropertyDescriptor(o, p) || {}) && i(o[p], a ? [...a, p] : [p]);
|
|
1498
1502
|
});
|
|
1499
1503
|
} else a && n.push(a);
|
|
1500
1504
|
};
|
|
1501
1505
|
return i(e), n;
|
|
1502
|
-
}, z = {}, ge = (e) => typeof e == "object" && e !== null,
|
|
1506
|
+
}, z = {}, ge = (e) => typeof e == "object" && e !== null, dn = (e) => ge(e) && !me.has(e) && (Array.isArray(e) || !(Symbol.iterator in e)) && !(e instanceof WeakMap) && !(e instanceof WeakSet) && !(e instanceof Error) && !(e instanceof Number) && !(e instanceof Date) && !(e instanceof String) && !(e instanceof RegExp) && !(e instanceof ArrayBuffer) && !(e instanceof Promise), Et = (e, t) => {
|
|
1503
1507
|
const s = De.get(e);
|
|
1504
1508
|
if (s?.[0] === t)
|
|
1505
1509
|
return s[1];
|
|
1506
1510
|
const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1507
|
-
return
|
|
1511
|
+
return xe(n, !0), De.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
|
|
1508
1512
|
if (Object.getOwnPropertyDescriptor(n, r))
|
|
1509
1513
|
return;
|
|
1510
1514
|
const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
|
|
@@ -1518,16 +1522,16 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1518
1522
|
configurable: !0
|
|
1519
1523
|
};
|
|
1520
1524
|
if (me.has(i))
|
|
1521
|
-
|
|
1522
|
-
else if (
|
|
1523
|
-
const [c, u] =
|
|
1525
|
+
xe(i, !1);
|
|
1526
|
+
else if (C.has(i)) {
|
|
1527
|
+
const [c, u] = C.get(
|
|
1524
1528
|
i
|
|
1525
1529
|
);
|
|
1526
1530
|
a.value = Et(c, u());
|
|
1527
1531
|
}
|
|
1528
1532
|
Object.defineProperty(n, r, a);
|
|
1529
1533
|
}), Object.preventExtensions(n);
|
|
1530
|
-
},
|
|
1534
|
+
}, pn = (e, t, s, n) => ({
|
|
1531
1535
|
deleteProperty(r, i) {
|
|
1532
1536
|
const o = Reflect.get(r, i);
|
|
1533
1537
|
s(i);
|
|
@@ -1538,12 +1542,12 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1538
1542
|
const c = !e() && Reflect.has(r, i), u = Reflect.get(r, i, a);
|
|
1539
1543
|
if (c && (Oe(u, o) || j.has(o) && Oe(u, j.get(o))))
|
|
1540
1544
|
return !0;
|
|
1541
|
-
s(i), ge(o) && (o =
|
|
1542
|
-
const f = !
|
|
1545
|
+
s(i), ge(o) && (o = fn(o) || o);
|
|
1546
|
+
const f = !C.has(o) && mn(o) ? St(o) : o;
|
|
1543
1547
|
return t(i, f), Reflect.set(r, i, f, a), n(["set", [i], o, u]), !0;
|
|
1544
1548
|
}
|
|
1545
|
-
}),
|
|
1546
|
-
let Oe = Object.is,
|
|
1549
|
+
}), C = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), De = /* @__PURE__ */ new WeakMap(), Y = [1], j = /* @__PURE__ */ new WeakMap();
|
|
1550
|
+
let Oe = Object.is, gn = (e, t) => new Proxy(e, t), mn = dn, yn = Et, wn = pn;
|
|
1547
1551
|
function St(e = {}) {
|
|
1548
1552
|
if (!ge(e))
|
|
1549
1553
|
throw new Error("object required");
|
|
@@ -1551,60 +1555,60 @@ function St(e = {}) {
|
|
|
1551
1555
|
if (t)
|
|
1552
1556
|
return t;
|
|
1553
1557
|
let s = Y[0];
|
|
1554
|
-
const n = /* @__PURE__ */ new Set(), r = (l,
|
|
1555
|
-
s !==
|
|
1558
|
+
const n = /* @__PURE__ */ new Set(), r = (l, m = ++Y[0]) => {
|
|
1559
|
+
s !== m && (i = s = m, n.forEach((h) => h(l, m)));
|
|
1556
1560
|
};
|
|
1557
1561
|
let i = s;
|
|
1558
|
-
const o = (l = Y[0]) => (i !== l && (i = l, c.forEach(([
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1561
|
-
})), s), a = (l) => (
|
|
1562
|
-
const E = [...
|
|
1563
|
-
E[1] = [l, ...E[1]], r(E,
|
|
1564
|
-
}, c = /* @__PURE__ */ new Map(), u = (l,
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1562
|
+
const o = (l = Y[0]) => (i !== l && (i = l, c.forEach(([m]) => {
|
|
1563
|
+
const h = m[1](l);
|
|
1564
|
+
h > s && (s = h);
|
|
1565
|
+
})), s), a = (l) => (m, h) => {
|
|
1566
|
+
const E = [...m];
|
|
1567
|
+
E[1] = [l, ...E[1]], r(E, h);
|
|
1568
|
+
}, c = /* @__PURE__ */ new Map(), u = (l, m) => {
|
|
1569
|
+
const h = !me.has(m) && C.get(m);
|
|
1570
|
+
if (h) {
|
|
1567
1571
|
if ((z ? "production" : void 0) !== "production" && c.has(l))
|
|
1568
1572
|
throw new Error("prop listener already exists");
|
|
1569
1573
|
if (n.size) {
|
|
1570
|
-
const E =
|
|
1571
|
-
c.set(l, [
|
|
1574
|
+
const E = h[2](a(l));
|
|
1575
|
+
c.set(l, [h, E]);
|
|
1572
1576
|
} else
|
|
1573
|
-
c.set(l, [
|
|
1577
|
+
c.set(l, [h]);
|
|
1574
1578
|
}
|
|
1575
1579
|
}, f = (l) => {
|
|
1576
|
-
var
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
},
|
|
1580
|
+
var m;
|
|
1581
|
+
const h = c.get(l);
|
|
1582
|
+
h && (c.delete(l), (m = h[1]) == null || m.call(h));
|
|
1583
|
+
}, w = (l) => (n.add(l), n.size === 1 && c.forEach(([h, E], P) => {
|
|
1580
1584
|
if ((z ? "production" : void 0) !== "production" && E)
|
|
1581
1585
|
throw new Error("remove already exists");
|
|
1582
|
-
const
|
|
1583
|
-
c.set(
|
|
1586
|
+
const Tt = h[2](a(P));
|
|
1587
|
+
c.set(P, [h, Tt]);
|
|
1584
1588
|
}), () => {
|
|
1585
|
-
n.delete(l), n.size === 0 && c.forEach(([
|
|
1586
|
-
E && (E(), c.set(
|
|
1589
|
+
n.delete(l), n.size === 0 && c.forEach(([h, E], P) => {
|
|
1590
|
+
E && (E(), c.set(P, [h]));
|
|
1587
1591
|
});
|
|
1588
1592
|
});
|
|
1589
|
-
let
|
|
1590
|
-
const
|
|
1591
|
-
() =>
|
|
1593
|
+
let p = !0;
|
|
1594
|
+
const y = wn(
|
|
1595
|
+
() => p,
|
|
1592
1596
|
u,
|
|
1593
1597
|
f,
|
|
1594
1598
|
r
|
|
1595
|
-
),
|
|
1596
|
-
j.set(e,
|
|
1597
|
-
const
|
|
1598
|
-
return
|
|
1599
|
-
const
|
|
1599
|
+
), T = gn(e, y);
|
|
1600
|
+
j.set(e, T);
|
|
1601
|
+
const b = [e, o, w];
|
|
1602
|
+
return C.set(T, b), Reflect.ownKeys(e).forEach((l) => {
|
|
1603
|
+
const m = Object.getOwnPropertyDescriptor(
|
|
1600
1604
|
e,
|
|
1601
1605
|
l
|
|
1602
1606
|
);
|
|
1603
|
-
"value" in
|
|
1604
|
-
}),
|
|
1607
|
+
"value" in m && m.writable && (T[l] = e[l]);
|
|
1608
|
+
}), p = !1, T;
|
|
1605
1609
|
}
|
|
1606
|
-
function
|
|
1607
|
-
const n =
|
|
1610
|
+
function bn(e, t, s) {
|
|
1611
|
+
const n = C.get(e);
|
|
1608
1612
|
(z ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1609
1613
|
let r;
|
|
1610
1614
|
const i = [], o = n[2];
|
|
@@ -1619,27 +1623,27 @@ function wn(e, t, s) {
|
|
|
1619
1623
|
};
|
|
1620
1624
|
}
|
|
1621
1625
|
function Ne(e) {
|
|
1622
|
-
const t =
|
|
1626
|
+
const t = C.get(e);
|
|
1623
1627
|
(z ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1624
1628
|
const [s, n] = t;
|
|
1625
|
-
return
|
|
1629
|
+
return yn(s, n());
|
|
1626
1630
|
}
|
|
1627
|
-
const
|
|
1631
|
+
const En = {}, Sn = (e, t) => {
|
|
1628
1632
|
const s = ne(void 0);
|
|
1629
1633
|
re(() => {
|
|
1630
|
-
s.current =
|
|
1634
|
+
s.current = hn(e, t);
|
|
1631
1635
|
}), Pt(s.current);
|
|
1632
|
-
},
|
|
1633
|
-
function
|
|
1636
|
+
}, Tn = Sn, Rn = /* @__PURE__ */ new WeakMap();
|
|
1637
|
+
function An(e, t) {
|
|
1634
1638
|
const n = ye(
|
|
1635
1639
|
() => e && /* @__PURE__ */ new WeakMap(),
|
|
1636
1640
|
[e]
|
|
1637
1641
|
), r = ne(void 0);
|
|
1638
1642
|
let i = !0;
|
|
1639
|
-
const o =
|
|
1643
|
+
const o = Rt(
|
|
1640
1644
|
At(
|
|
1641
1645
|
(c) => {
|
|
1642
|
-
const u =
|
|
1646
|
+
const u = bn(e, c);
|
|
1643
1647
|
return c(), u;
|
|
1644
1648
|
},
|
|
1645
1649
|
[e, void 0]
|
|
@@ -1662,16 +1666,16 @@ function Tn(e, t) {
|
|
|
1662
1666
|
);
|
|
1663
1667
|
i = !1, vt(() => {
|
|
1664
1668
|
r.current = o;
|
|
1665
|
-
}), (
|
|
1669
|
+
}), (En ? "production" : void 0) !== "production" && Tn(o, n);
|
|
1666
1670
|
const a = ye(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1667
1671
|
return wt(o, n, a, Rn);
|
|
1668
1672
|
}
|
|
1669
|
-
const
|
|
1673
|
+
const I = St({
|
|
1670
1674
|
data: null,
|
|
1671
1675
|
isPending: !1,
|
|
1672
1676
|
error: null
|
|
1673
1677
|
});
|
|
1674
|
-
function
|
|
1678
|
+
function Cn({
|
|
1675
1679
|
session_url: e,
|
|
1676
1680
|
destinationChain: t,
|
|
1677
1681
|
token: s,
|
|
@@ -1680,16 +1684,16 @@ function Un({
|
|
|
1680
1684
|
onCancel: i,
|
|
1681
1685
|
onSuccess: o
|
|
1682
1686
|
}) {
|
|
1683
|
-
const a =
|
|
1684
|
-
function
|
|
1687
|
+
const a = An(I), [c, u] = X(!1), [f, w] = X(Date.now());
|
|
1688
|
+
function p() {
|
|
1685
1689
|
u(!0);
|
|
1686
1690
|
}
|
|
1687
|
-
function
|
|
1688
|
-
u(!1),
|
|
1691
|
+
function y() {
|
|
1692
|
+
u(!1), T();
|
|
1689
1693
|
}
|
|
1690
|
-
const
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1694
|
+
const T = () => {
|
|
1695
|
+
const b = Date.now();
|
|
1696
|
+
I.isPending = !0, I.error = null, fetch(e, {
|
|
1693
1697
|
method: "POST",
|
|
1694
1698
|
headers: {
|
|
1695
1699
|
"Content-Type": "application/json"
|
|
@@ -1697,38 +1701,35 @@ function Un({
|
|
|
1697
1701
|
body: JSON.stringify({
|
|
1698
1702
|
destinationChain: t?.replace("_MAINNET", ""),
|
|
1699
1703
|
token: s,
|
|
1700
|
-
amount: n ?
|
|
1704
|
+
amount: n ? nn(n) : "0",
|
|
1701
1705
|
recipient: r
|
|
1702
1706
|
})
|
|
1703
1707
|
}).then((l) => l.json()).then((l) => {
|
|
1704
|
-
|
|
1708
|
+
b < f || (I.data = l, I.isPending = !1, w(b));
|
|
1705
1709
|
}).catch((l) => {
|
|
1706
|
-
|
|
1710
|
+
b < f || (I.error = l?.toString(), I.isPending = !1, w(b));
|
|
1707
1711
|
});
|
|
1708
1712
|
};
|
|
1709
1713
|
return re(() => {
|
|
1710
|
-
|
|
1711
|
-
api_key: "",
|
|
1712
|
-
env: e === "https://chainrails-sdk-server.vercel.app/test/create-session" ? "internal" : "production"
|
|
1713
|
-
}), b();
|
|
1714
|
+
T();
|
|
1714
1715
|
}, [t, s, n, r, e]), {
|
|
1715
1716
|
...a,
|
|
1716
1717
|
destinationChain: t,
|
|
1717
1718
|
token: s,
|
|
1718
1719
|
recipient: r,
|
|
1719
1720
|
isOpen: c,
|
|
1720
|
-
open:
|
|
1721
|
-
close:
|
|
1722
|
-
refetch:
|
|
1721
|
+
open: p,
|
|
1722
|
+
close: y,
|
|
1723
|
+
refetch: T,
|
|
1723
1724
|
onSuccess: o,
|
|
1724
1725
|
onCancel: i
|
|
1725
1726
|
};
|
|
1726
1727
|
}
|
|
1727
1728
|
export {
|
|
1728
|
-
|
|
1729
|
-
|
|
1729
|
+
d as Chainrails,
|
|
1730
|
+
Un as PaymentModal,
|
|
1730
1731
|
Q as chains,
|
|
1731
|
-
|
|
1732
|
+
In as crapi,
|
|
1732
1733
|
ht as tokens,
|
|
1733
|
-
|
|
1734
|
+
Cn as usePaymentSession
|
|
1734
1735
|
};
|