@chainrails/react 0.0.29 → 0.0.31
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 +4 -5
- package/dist/PaymentModal/index.d.ts.map +1 -1
- package/dist/chainrails-sdk.es.js +240 -269
- package/dist/chainrails-sdk.es.mjs +240 -269
- package/dist/chainrails-sdk.umd.js +2 -2
- package/dist/hooks/useGetSessionToken.d.ts +3 -0
- package/dist/hooks/useGetSessionToken.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/hooks/usePaymentModal.d.ts +0 -23
- package/dist/hooks/usePaymentModal.d.ts.map +0 -1
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { useState as le, useRef as W, useEffect as F, useMemo as te, useSyncExternalStore as ke, useCallback as Ne, useLayoutEffect as qe, useDebugValue as _e } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import './index.css';
|
|
4
|
-
var e, s, r = "";
|
|
5
|
-
if (typeof t == "string" || typeof t == "number") r += t;
|
|
6
|
-
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
7
|
-
var n = t.length;
|
|
8
|
-
for (e = 0; e < n; e++) t[e] && (s = fe(t[e])) && (r && (r += " "), r += s);
|
|
9
|
-
} else for (s in t) t[s] && (r && (r += " "), r += s);
|
|
10
|
-
return r;
|
|
11
|
-
}
|
|
12
|
-
function Me() {
|
|
13
|
-
for (var t, e, s = 0, r = "", n = arguments.length; s < n; s++) (t = arguments[s]) && (e = fe(t)) && (r && (r += " "), r += e);
|
|
14
|
-
return r;
|
|
15
|
-
}
|
|
16
|
-
class D extends Error {
|
|
2
|
+
import { jsx as S, Fragment as Ue, jsxs as se } from "react/jsx-runtime";
|
|
3
|
+
import './index.css';class D extends Error {
|
|
17
4
|
response;
|
|
18
5
|
request;
|
|
19
6
|
options;
|
|
@@ -22,7 +9,7 @@ class D extends Error {
|
|
|
22
9
|
super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response = e, this.request = s, this.options = r;
|
|
23
10
|
}
|
|
24
11
|
}
|
|
25
|
-
class
|
|
12
|
+
class fe extends Error {
|
|
26
13
|
name = "NonError";
|
|
27
14
|
value;
|
|
28
15
|
constructor(e) {
|
|
@@ -34,13 +21,13 @@ class he extends Error {
|
|
|
34
21
|
super(s), this.value = e;
|
|
35
22
|
}
|
|
36
23
|
}
|
|
37
|
-
class
|
|
24
|
+
class M extends Error {
|
|
38
25
|
name = "ForceRetryError";
|
|
39
26
|
customDelay;
|
|
40
27
|
code;
|
|
41
28
|
customRequest;
|
|
42
29
|
constructor(e) {
|
|
43
|
-
const s = e?.cause ? e.cause instanceof Error ? e.cause : new
|
|
30
|
+
const s = e?.cause ? e.cause instanceof Error ? e.cause : new fe(e.cause) : void 0;
|
|
44
31
|
super(e?.code ? `Forced retry: ${e.code}` : "Forced retry", s ? { cause: s } : void 0), this.customDelay = e?.delay, this.code = e?.code, this.customRequest = e?.request;
|
|
45
32
|
}
|
|
46
33
|
}
|
|
@@ -63,7 +50,7 @@ const re = (() => {
|
|
|
63
50
|
throw n;
|
|
64
51
|
}
|
|
65
52
|
return t && !e;
|
|
66
|
-
})(),
|
|
53
|
+
})(), je = typeof globalThis.AbortController == "function", he = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Me = typeof globalThis.ReadableStream == "function", xe = typeof globalThis.FormData == "function", de = ["get", "post", "put", "patch", "head", "delete"], Le = {
|
|
67
54
|
json: "application/json",
|
|
68
55
|
text: "text/*",
|
|
69
56
|
formData: "multipart/form-data",
|
|
@@ -72,14 +59,14 @@ const re = (() => {
|
|
|
72
59
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
73
60
|
// We still feature-check at runtime before exposing the shortcut.
|
|
74
61
|
bytes: "*/*"
|
|
75
|
-
}, x = 2147483647, De = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,
|
|
76
|
-
class
|
|
62
|
+
}, x = 2147483647, De = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, pe = Symbol("stop");
|
|
63
|
+
class ye {
|
|
77
64
|
options;
|
|
78
65
|
constructor(e) {
|
|
79
66
|
this.options = e;
|
|
80
67
|
}
|
|
81
68
|
}
|
|
82
|
-
const Ie = (t) => new
|
|
69
|
+
const Ie = (t) => new ye(t), Be = {
|
|
83
70
|
json: !0,
|
|
84
71
|
parseJson: !0,
|
|
85
72
|
stringifyJson: !0,
|
|
@@ -138,7 +125,7 @@ const Ie = (t) => new ge(t), Be = {
|
|
|
138
125
|
return 0;
|
|
139
126
|
}
|
|
140
127
|
return 0;
|
|
141
|
-
},
|
|
128
|
+
}, ge = (t, e, s) => {
|
|
142
129
|
let r, n = 0;
|
|
143
130
|
return t.pipeThrough(new TransformStream({
|
|
144
131
|
transform(i, o) {
|
|
@@ -163,7 +150,7 @@ const Ie = (t) => new ge(t), Be = {
|
|
|
163
150
|
headers: t.headers
|
|
164
151
|
});
|
|
165
152
|
const s = Math.max(0, Number(t.headers.get("content-length")) || 0);
|
|
166
|
-
return new Response(
|
|
153
|
+
return new Response(ge(t.body, s, e), {
|
|
167
154
|
status: t.status,
|
|
168
155
|
statusText: t.statusText,
|
|
169
156
|
headers: t.headers
|
|
@@ -175,27 +162,27 @@ const Ie = (t) => new ge(t), Be = {
|
|
|
175
162
|
return new Request(t, {
|
|
176
163
|
// @ts-expect-error - Types are outdated.
|
|
177
164
|
duplex: "half",
|
|
178
|
-
body:
|
|
165
|
+
body: ge(t.body, r, e)
|
|
179
166
|
});
|
|
180
|
-
},
|
|
167
|
+
}, b = (t) => t !== null && typeof t == "object", N = (...t) => {
|
|
181
168
|
for (const e of t)
|
|
182
|
-
if ((!
|
|
169
|
+
if ((!b(e) || Array.isArray(e)) && e !== void 0)
|
|
183
170
|
throw new TypeError("The `options` argument must be an object");
|
|
184
171
|
return Y({}, ...t);
|
|
185
|
-
},
|
|
172
|
+
}, me = (t = {}, e = {}) => {
|
|
186
173
|
const s = new globalThis.Headers(t), r = e instanceof globalThis.Headers, n = new globalThis.Headers(e);
|
|
187
174
|
for (const [i, o] of n.entries())
|
|
188
175
|
r && o === "undefined" || o === void 0 ? s.delete(i) : s.set(i, o);
|
|
189
176
|
return s;
|
|
190
177
|
};
|
|
191
|
-
function
|
|
178
|
+
function q(t, e, s) {
|
|
192
179
|
return Object.hasOwn(e, s) && e[s] === void 0 ? [] : Y(t[s] ?? [], e[s] ?? []);
|
|
193
180
|
}
|
|
194
|
-
const
|
|
195
|
-
beforeRequest:
|
|
196
|
-
beforeRetry:
|
|
197
|
-
afterResponse:
|
|
198
|
-
beforeError:
|
|
181
|
+
const we = (t = {}, e = {}) => ({
|
|
182
|
+
beforeRequest: q(t, e, "beforeRequest"),
|
|
183
|
+
beforeRetry: q(t, e, "beforeRetry"),
|
|
184
|
+
afterResponse: q(t, e, "afterResponse"),
|
|
185
|
+
beforeError: q(t, e, "beforeError")
|
|
199
186
|
}), Ye = (t, e) => {
|
|
200
187
|
const s = new URLSearchParams();
|
|
201
188
|
for (const r of [t, e])
|
|
@@ -209,7 +196,7 @@ const Te = (t = {}, e = {}) => ({
|
|
|
209
196
|
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
210
197
|
s.append(String(n[0]), String(n[1]));
|
|
211
198
|
}
|
|
212
|
-
else if (
|
|
199
|
+
else if (b(r))
|
|
213
200
|
for (const [n, i] of Object.entries(r))
|
|
214
201
|
i !== void 0 && s.append(n, String(i));
|
|
215
202
|
else {
|
|
@@ -224,14 +211,14 @@ const Te = (t = {}, e = {}) => ({
|
|
|
224
211
|
for (const o of t)
|
|
225
212
|
if (Array.isArray(o))
|
|
226
213
|
Array.isArray(e) || (e = []), e = [...e, ...o];
|
|
227
|
-
else if (
|
|
214
|
+
else if (b(o)) {
|
|
228
215
|
for (let [a, c] of Object.entries(o)) {
|
|
229
216
|
if (a === "signal" && c instanceof globalThis.AbortSignal) {
|
|
230
217
|
i.push(c);
|
|
231
218
|
continue;
|
|
232
219
|
}
|
|
233
220
|
if (a === "context") {
|
|
234
|
-
if (c != null && (!
|
|
221
|
+
if (c != null && (!b(c) || Array.isArray(c)))
|
|
235
222
|
throw new TypeError("The `context` option must be an object");
|
|
236
223
|
e = {
|
|
237
224
|
...e,
|
|
@@ -243,12 +230,12 @@ const Te = (t = {}, e = {}) => ({
|
|
|
243
230
|
c == null ? n = void 0 : n = n === void 0 ? c : Ye(n, c);
|
|
244
231
|
continue;
|
|
245
232
|
}
|
|
246
|
-
|
|
233
|
+
b(c) && a in e && (c = Y(e[a], c)), e = { ...e, [a]: c };
|
|
247
234
|
}
|
|
248
|
-
|
|
235
|
+
b(o.hooks) && (r = we(r, o.hooks), e.hooks = r), b(o.headers) && (s = me(s, o.headers), e.headers = s);
|
|
249
236
|
}
|
|
250
|
-
return n !== void 0 && (e.searchParams = n), i.length > 0 && (i.length === 1 ? e.signal = i[0] :
|
|
251
|
-
}, ze = (t) =>
|
|
237
|
+
return n !== void 0 && (e.searchParams = n), i.length > 0 && (i.length === 1 ? e.signal = i[0] : he ? e.signal = AbortSignal.any(i) : e.signal = i.at(-1)), e.context === void 0 && (e.context = {}), e;
|
|
238
|
+
}, ze = (t) => de.includes(t) ? t.toUpperCase() : t, Ve = ["get", "put", "head", "delete", "options", "trace"], Je = [408, 413, 429, 500, 502, 503, 504], Ge = [413, 429, 503], ne = {
|
|
252
239
|
limit: 2,
|
|
253
240
|
methods: Ve,
|
|
254
241
|
statusCodes: Je,
|
|
@@ -312,20 +299,20 @@ function st(t) {
|
|
|
312
299
|
function rt(t) {
|
|
313
300
|
return t instanceof I || t?.name === I.name;
|
|
314
301
|
}
|
|
315
|
-
class
|
|
302
|
+
class O {
|
|
316
303
|
static create(e, s) {
|
|
317
|
-
const r = new
|
|
304
|
+
const r = new O(e, s), n = async () => {
|
|
318
305
|
if (typeof r.#e.timeout == "number" && r.#e.timeout > x)
|
|
319
306
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${x}`);
|
|
320
307
|
await Promise.resolve();
|
|
321
308
|
let o = await r.#y();
|
|
322
309
|
for (const a of r.#e.hooks.afterResponse) {
|
|
323
310
|
const c = r.#l(o.clone()), u = await a(r.request, r.#a(), c, { retryCount: r.#s });
|
|
324
|
-
if (u instanceof globalThis.Response && (o = u), u instanceof
|
|
311
|
+
if (u instanceof globalThis.Response && (o = u), u instanceof ye)
|
|
325
312
|
throw await Promise.all([
|
|
326
313
|
c.body?.cancel(),
|
|
327
314
|
o.body?.cancel()
|
|
328
|
-
]), new
|
|
315
|
+
]), new M(u.options);
|
|
329
316
|
}
|
|
330
317
|
if (r.#l(o), !o.ok && (typeof r.#e.throwHttpErrors == "function" ? r.#e.throwHttpErrors(o.status) : r.#e.throwHttpErrors)) {
|
|
331
318
|
let a = new D(o, r.request, r.#a());
|
|
@@ -336,7 +323,7 @@ class v {
|
|
|
336
323
|
if (r.#e.onDownloadProgress) {
|
|
337
324
|
if (typeof r.#e.onDownloadProgress != "function")
|
|
338
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
339
|
-
if (!
|
|
326
|
+
if (!Me)
|
|
340
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
341
328
|
return We(o.clone(), r.#e.onDownloadProgress);
|
|
342
329
|
}
|
|
@@ -376,8 +363,8 @@ class v {
|
|
|
376
363
|
constructor(e, s = {}) {
|
|
377
364
|
if (this.#t = e, this.#e = {
|
|
378
365
|
...s,
|
|
379
|
-
headers:
|
|
380
|
-
hooks:
|
|
366
|
+
headers: me(this.#t.headers, s.headers),
|
|
367
|
+
hooks: we({
|
|
381
368
|
beforeRequest: [],
|
|
382
369
|
beforeRetry: [],
|
|
383
370
|
beforeError: [],
|
|
@@ -398,10 +385,10 @@ class v {
|
|
|
398
385
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
399
386
|
this.#e.prefixUrl.endsWith("/") || (this.#e.prefixUrl += "/"), this.#t = this.#e.prefixUrl + this.#t;
|
|
400
387
|
}
|
|
401
|
-
|
|
388
|
+
je && he && (this.#n = this.#e.signal ?? this.#t.signal, this.#r = new globalThis.AbortController(), this.#e.signal = this.#n ? AbortSignal.any([this.#n, this.#r.signal]) : this.#r.signal), re && (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"));
|
|
402
389
|
const r = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
403
390
|
if (this.#t instanceof globalThis.Request && (xe && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !r && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), tt(this.#e.searchParams)) {
|
|
404
|
-
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(O.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
405
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
406
393
|
}
|
|
407
394
|
if (this.#e.onUploadProgress) {
|
|
@@ -420,8 +407,8 @@ class v {
|
|
|
420
407
|
async #p(e) {
|
|
421
408
|
if (this.#s++, this.#s > this.#e.retry.limit)
|
|
422
409
|
throw e;
|
|
423
|
-
const s = e instanceof Error ? e : new
|
|
424
|
-
if (s instanceof
|
|
410
|
+
const s = e instanceof Error ? e : new fe(e);
|
|
411
|
+
if (s instanceof M)
|
|
425
412
|
return s.customDelay ?? this.#c();
|
|
426
413
|
if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
|
|
427
414
|
throw e;
|
|
@@ -459,7 +446,7 @@ class v {
|
|
|
459
446
|
const r = Math.min(await this.#p(s), x);
|
|
460
447
|
if (this.#s < 1)
|
|
461
448
|
throw s;
|
|
462
|
-
if (await Qe(r, this.#n ? { signal: this.#n } : {}), s instanceof
|
|
449
|
+
if (await Qe(r, this.#n ? { signal: this.#n } : {}), s instanceof M && s.customRequest) {
|
|
463
450
|
const n = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
|
|
464
451
|
this.#u(n);
|
|
465
452
|
}
|
|
@@ -476,7 +463,7 @@ class v {
|
|
|
476
463
|
}
|
|
477
464
|
if (i instanceof globalThis.Response)
|
|
478
465
|
return i;
|
|
479
|
-
if (i ===
|
|
466
|
+
if (i === pe)
|
|
480
467
|
return;
|
|
481
468
|
}
|
|
482
469
|
return this.#f(e);
|
|
@@ -512,23 +499,23 @@ class v {
|
|
|
512
499
|
}
|
|
513
500
|
/*! MIT License © Sindre Sorhus */
|
|
514
501
|
const B = (t) => {
|
|
515
|
-
const e = (s, r) =>
|
|
516
|
-
for (const s of
|
|
517
|
-
e[s] = (r, n) =>
|
|
518
|
-
return e.create = (s) => B(
|
|
502
|
+
const e = (s, r) => O.create(s, N(t, r));
|
|
503
|
+
for (const s of de)
|
|
504
|
+
e[s] = (r, n) => O.create(r, N(t, n, { method: s }));
|
|
505
|
+
return e.create = (s) => B(N(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), B(N(t, s))), e.stop = pe, e.retry = Ie, e;
|
|
519
506
|
}, nt = B();
|
|
520
507
|
var ot = /* @__PURE__ */ ((t) => (t.ARBITRUM = "ARBITRUM_MAINNET", t.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", t.AVALANCHE = "AVALANCHE_MAINNET", t.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", t.BASE = "BASE_MAINNET", t.BASE_TESTNET = "BASE_TESTNET", t.BSC = "BSC_MAINNET", t.ETHEREUM = "ETHEREUM_MAINNET", t.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", t.STARKNET = "STARKNET_MAINNET", t))(ot || {}), it = /* @__PURE__ */ ((t) => (t.USDC = "USDC", t))(it || {}), z = /* @__PURE__ */ ((t) => (t.PRODUCTION = "production", t.STAGING = "staging", t))(z || {});
|
|
521
|
-
class
|
|
508
|
+
class h {
|
|
522
509
|
constructor({ api_key: e, env: s }) {
|
|
523
510
|
this.api_key = e, this.jwt = "", this.env = s ?? z.PRODUCTION;
|
|
524
511
|
}
|
|
525
512
|
static async config(e) {
|
|
526
|
-
if (!
|
|
513
|
+
if (!h.app) {
|
|
527
514
|
if (!e)
|
|
528
515
|
throw new Error("Please provide an api_key");
|
|
529
|
-
|
|
516
|
+
h.app = new h(e);
|
|
530
517
|
}
|
|
531
|
-
return e && (
|
|
518
|
+
return e && (h.app.api_key = e.api_key, e.env !== void 0 && (h.app.env = e.env), await this.updateJWT(), setInterval(this.updateJWT.bind(this), 1500 * 1e3)), h.app;
|
|
532
519
|
}
|
|
533
520
|
static async updateJWT() {
|
|
534
521
|
try {
|
|
@@ -538,7 +525,7 @@ class d {
|
|
|
538
525
|
"content-type": "application/json"
|
|
539
526
|
},
|
|
540
527
|
body: JSON.stringify({
|
|
541
|
-
apiKey:
|
|
528
|
+
apiKey: h.app.api_key
|
|
542
529
|
})
|
|
543
530
|
})).json();
|
|
544
531
|
this.app.jwt = e.token;
|
|
@@ -546,22 +533,22 @@ class d {
|
|
|
546
533
|
}
|
|
547
534
|
}
|
|
548
535
|
static getApiKey() {
|
|
549
|
-
if (!
|
|
536
|
+
if (!h.app)
|
|
550
537
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
551
|
-
return
|
|
538
|
+
return h.app.api_key;
|
|
552
539
|
}
|
|
553
540
|
static getSessionKey() {
|
|
554
|
-
return
|
|
541
|
+
return h.app.jwt;
|
|
555
542
|
}
|
|
556
543
|
static getEnv() {
|
|
557
|
-
if (!
|
|
544
|
+
if (!h.app)
|
|
558
545
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
559
|
-
return
|
|
546
|
+
return h.app.env === "internal" ? "staging" : h.app.env;
|
|
560
547
|
}
|
|
561
548
|
static getBaseUrl() {
|
|
562
|
-
if (!
|
|
549
|
+
if (!h.app)
|
|
563
550
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
564
|
-
switch (
|
|
551
|
+
switch (h.app.env) {
|
|
565
552
|
case "production":
|
|
566
553
|
return "https://api.chainrails.io/api/v1";
|
|
567
554
|
case "staging":
|
|
@@ -573,23 +560,23 @@ class d {
|
|
|
573
560
|
}
|
|
574
561
|
}
|
|
575
562
|
static getPayModalUrl(e, s, r, n) {
|
|
576
|
-
if (!
|
|
563
|
+
if (!h.app)
|
|
577
564
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
578
|
-
const i =
|
|
565
|
+
const i = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = n && n > 0 ? "/pay/" : "/deposit/", a = `_chain_/${e}/_token_/${s}/_to_/${r}${n ? "/_amount_/" + n * 100 : ""}`;
|
|
579
566
|
return i + o + a;
|
|
580
567
|
}
|
|
581
568
|
}
|
|
582
569
|
let H = null;
|
|
583
570
|
function at() {
|
|
584
571
|
H = nt.create({
|
|
585
|
-
prefixUrl:
|
|
572
|
+
prefixUrl: h.getBaseUrl(),
|
|
586
573
|
headers: {
|
|
587
574
|
"Content-Type": "application/json"
|
|
588
575
|
},
|
|
589
576
|
hooks: {
|
|
590
577
|
beforeRequest: [
|
|
591
578
|
(t) => {
|
|
592
|
-
const e =
|
|
579
|
+
const e = h.getSessionKey();
|
|
593
580
|
t.headers.set("Authorization", `Bearer ${e}`);
|
|
594
581
|
}
|
|
595
582
|
],
|
|
@@ -600,117 +587,129 @@ function at() {
|
|
|
600
587
|
}
|
|
601
588
|
});
|
|
602
589
|
}
|
|
603
|
-
function
|
|
590
|
+
function y() {
|
|
604
591
|
return H || at(), H;
|
|
605
592
|
}
|
|
606
593
|
class ct {
|
|
607
594
|
async getById(e) {
|
|
608
|
-
return await
|
|
595
|
+
return await y().get("intents/" + e).json();
|
|
609
596
|
}
|
|
610
597
|
async getForSender(e) {
|
|
611
|
-
return await
|
|
598
|
+
return await y().get("intents/user/" + e).json();
|
|
612
599
|
}
|
|
613
600
|
async getForAddress(e) {
|
|
614
|
-
return await
|
|
601
|
+
return await y().get("intents/address/" + e).json();
|
|
615
602
|
}
|
|
616
603
|
async getAll(e) {
|
|
617
|
-
return await
|
|
604
|
+
return await y().get("intents", { searchParams: e }).json();
|
|
618
605
|
}
|
|
619
606
|
async create(e) {
|
|
620
|
-
return await
|
|
607
|
+
return await y().post("intents", { json: e }).json();
|
|
621
608
|
}
|
|
622
609
|
async update(e, s) {
|
|
623
|
-
return await
|
|
610
|
+
return await y().post("intents", { json: s }).json();
|
|
624
611
|
}
|
|
625
612
|
async triggerProcessing(e) {
|
|
626
|
-
return await
|
|
613
|
+
return await y().post(`intents/${e}/trigger-processing`).json();
|
|
627
614
|
}
|
|
628
615
|
}
|
|
629
616
|
class ut {
|
|
630
617
|
async getFromSpecificBridge(e) {
|
|
631
|
-
return await
|
|
618
|
+
return await y().get("quotes/single", { searchParams: e }).json();
|
|
632
619
|
}
|
|
633
620
|
async getFromAllBridges(e) {
|
|
634
|
-
return await
|
|
621
|
+
return await y().get("quotes/multiple", { searchParams: e }).json();
|
|
635
622
|
}
|
|
636
623
|
async getBestAcrossBridges(e) {
|
|
637
|
-
return await
|
|
624
|
+
return await y().get("quotes/best", { searchParams: e }).json();
|
|
638
625
|
}
|
|
639
626
|
async getAll(e) {
|
|
640
|
-
return await
|
|
627
|
+
return await y().get("quotes/multi-source", { searchParams: e }).json();
|
|
641
628
|
}
|
|
642
629
|
}
|
|
643
630
|
class lt {
|
|
644
631
|
async getOptimalRoutes(e) {
|
|
645
|
-
return await
|
|
632
|
+
return await y().get("router/optimal-route", { searchParams: e }).json();
|
|
646
633
|
}
|
|
647
634
|
async getAllSupportedBridges() {
|
|
648
|
-
return await
|
|
635
|
+
return await y().get("router/supported-bridges/all").json();
|
|
649
636
|
}
|
|
650
637
|
async getSupportedBridges(e) {
|
|
651
|
-
return await
|
|
638
|
+
return await y().get("router/supported-bridges/route", { searchParams: e }).json();
|
|
652
639
|
}
|
|
653
640
|
async getSupportedRoutes(e, s) {
|
|
654
|
-
return await
|
|
641
|
+
return await y().get("router/supported-bridges/bridge/" + e, { searchParams: s }).json();
|
|
655
642
|
}
|
|
656
643
|
}
|
|
657
644
|
class ft {
|
|
658
645
|
async getSupported(e) {
|
|
659
|
-
return await
|
|
646
|
+
return await y().get("chains", { searchParams: e }).json();
|
|
660
647
|
}
|
|
661
648
|
}
|
|
662
649
|
class ht {
|
|
663
650
|
async getClientInfo() {
|
|
664
|
-
return await
|
|
651
|
+
return await y().get("client/auth/client-info").json();
|
|
665
652
|
}
|
|
666
653
|
}
|
|
667
|
-
const
|
|
654
|
+
const xt = {
|
|
668
655
|
router: new lt(),
|
|
669
656
|
quotes: new ut(),
|
|
670
657
|
intents: new ct(),
|
|
671
658
|
chains: new ft(),
|
|
672
659
|
client: new ht()
|
|
673
660
|
};
|
|
674
|
-
function
|
|
661
|
+
function Te(t) {
|
|
662
|
+
var e, s, r = "";
|
|
663
|
+
if (typeof t == "string" || typeof t == "number") r += t;
|
|
664
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
665
|
+
var n = t.length;
|
|
666
|
+
for (e = 0; e < n; e++) t[e] && (s = Te(t[e])) && (r && (r += " "), r += s);
|
|
667
|
+
} else for (s in t) t[s] && (r && (r += " "), r += s);
|
|
668
|
+
return r;
|
|
669
|
+
}
|
|
670
|
+
function dt() {
|
|
671
|
+
for (var t, e, s = 0, r = "", n = arguments.length; s < n; s++) (t = arguments[s]) && (e = Te(t)) && (r && (r += " "), r += e);
|
|
672
|
+
return r;
|
|
673
|
+
}
|
|
674
|
+
function Lt(t) {
|
|
675
675
|
const {
|
|
676
676
|
to: e,
|
|
677
677
|
token: s,
|
|
678
678
|
chain: r,
|
|
679
679
|
amount: n,
|
|
680
680
|
isOpen: i,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
} = t, [y, T] = le(!0), R = W(null);
|
|
681
|
+
open: o,
|
|
682
|
+
close: a,
|
|
683
|
+
onCancel: c,
|
|
684
|
+
onSuccess: u,
|
|
685
|
+
session_token: p
|
|
686
|
+
} = t, [m, g] = le(!0), w = W(null);
|
|
688
687
|
F(() => {
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
692
|
-
const
|
|
693
|
-
|
|
688
|
+
C();
|
|
689
|
+
const l = document.body.style.overflow;
|
|
690
|
+
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = l || "";
|
|
691
|
+
const d = (f) => {
|
|
692
|
+
f.data === "closed" && (a(), c?.()), f.data === "completed" && (window.setTimeout(a, 2e3), u?.());
|
|
694
693
|
};
|
|
695
|
-
return window.addEventListener("message",
|
|
696
|
-
document.body.style.overflow =
|
|
694
|
+
return window.addEventListener("message", d), () => {
|
|
695
|
+
document.body.style.overflow = l || "", window.removeEventListener("message", d);
|
|
697
696
|
};
|
|
698
|
-
}, [i, c,
|
|
699
|
-
function
|
|
700
|
-
|
|
697
|
+
}, [i, c, u]);
|
|
698
|
+
function P() {
|
|
699
|
+
g(!1), C();
|
|
701
700
|
}
|
|
702
|
-
function
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
701
|
+
function C() {
|
|
702
|
+
if (!p) return;
|
|
703
|
+
const l = {
|
|
704
|
+
type: "session",
|
|
705
|
+
session_token: p,
|
|
706
|
+
environment: h.getEnv() || z.PRODUCTION
|
|
707
707
|
};
|
|
708
|
-
|
|
708
|
+
w.current?.contentWindow?.postMessage(l, "https://app.chainrails.io"), w.current?.contentWindow?.postMessage(l, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
709
709
|
}
|
|
710
|
-
return /* @__PURE__ */ se("div", {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
children: [y && /* @__PURE__ */ O("div", {
|
|
710
|
+
return p ? /* @__PURE__ */ se("div", {
|
|
711
|
+
className: dt("payment-modal-wrapper", m ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
712
|
+
children: [m && /* @__PURE__ */ S("div", {
|
|
714
713
|
role: "status",
|
|
715
714
|
className: "payment-modal-loader",
|
|
716
715
|
children: /* @__PURE__ */ se("svg", {
|
|
@@ -719,99 +718,62 @@ function xt(t) {
|
|
|
719
718
|
viewBox: "0 0 100 101",
|
|
720
719
|
fill: "none",
|
|
721
720
|
xmlns: "http://www.w3.org/2000/svg",
|
|
722
|
-
children: [/* @__PURE__ */
|
|
721
|
+
children: [/* @__PURE__ */ S("path", {
|
|
723
722
|
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",
|
|
724
723
|
fill: "currentColor"
|
|
725
|
-
}), /* @__PURE__ */
|
|
724
|
+
}), /* @__PURE__ */ S("path", {
|
|
726
725
|
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",
|
|
727
726
|
fill: "currentFill"
|
|
728
727
|
})]
|
|
729
728
|
})
|
|
730
|
-
}), /* @__PURE__ */
|
|
729
|
+
}), /* @__PURE__ */ S("iframe", {
|
|
731
730
|
allow: "clipboard-read *; clipboard-write *",
|
|
732
|
-
src:
|
|
733
|
-
onLoad:
|
|
734
|
-
className: `payment-modal ${
|
|
731
|
+
src: h.getPayModalUrl(r, s, e, n),
|
|
732
|
+
onLoad: P,
|
|
733
|
+
className: `payment-modal ${m ? "invisible" : "visible"}`,
|
|
735
734
|
"data-id": n,
|
|
736
|
-
ref:
|
|
735
|
+
ref: w
|
|
737
736
|
})]
|
|
738
|
-
});
|
|
737
|
+
}) : /* @__PURE__ */ S(Ue, {});
|
|
739
738
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
onSuccess: s,
|
|
744
|
-
onChainSelect: r,
|
|
745
|
-
onIntentCreate: n,
|
|
746
|
-
...i
|
|
747
|
-
} = t, [o, a] = le(!1);
|
|
748
|
-
function c() {
|
|
749
|
-
a(!0);
|
|
750
|
-
}
|
|
751
|
-
function u() {
|
|
752
|
-
a(!1);
|
|
753
|
-
}
|
|
754
|
-
function p() {
|
|
755
|
-
u(), e?.();
|
|
756
|
-
}
|
|
757
|
-
function w() {
|
|
758
|
-
window.setTimeout(u, 2e3), s?.();
|
|
759
|
-
}
|
|
760
|
-
function y() {
|
|
761
|
-
r?.();
|
|
762
|
-
}
|
|
763
|
-
function T() {
|
|
764
|
-
n?.();
|
|
765
|
-
}
|
|
766
|
-
return {
|
|
767
|
-
open: c,
|
|
768
|
-
close: u,
|
|
769
|
-
complete: w,
|
|
770
|
-
cancel: p,
|
|
771
|
-
chainSelected: y,
|
|
772
|
-
intentCreated: T,
|
|
773
|
-
isOpen: o,
|
|
774
|
-
...i
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
const dt = Symbol(), V = Symbol(), S = "a", Re = "f", oe = "p", be = "c", Ee = "t", J = "h", A = "w", G = "o", X = "k";
|
|
778
|
-
let pt = (t, e) => new Proxy(t, e);
|
|
779
|
-
const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) => t && ($.has(t) ? $.get(t) : K(t) === Object.prototype || K(t) === Array.prototype), q = (t) => typeof t == "object" && t !== null, yt = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), gt = (t) => {
|
|
739
|
+
const pt = Symbol(), V = Symbol(), A = "a", Re = "f", oe = "p", be = "c", Ee = "t", J = "h", v = "w", G = "o", X = "k";
|
|
740
|
+
let yt = (t, e) => new Proxy(t, e);
|
|
741
|
+
const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) => t && ($.has(t) ? $.get(t) : K(t) === Object.prototype || K(t) === Array.prototype), _ = (t) => typeof t == "object" && t !== null, gt = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), mt = (t) => {
|
|
780
742
|
if (Array.isArray(t))
|
|
781
743
|
return Array.from(t);
|
|
782
744
|
const e = Object.getOwnPropertyDescriptors(t);
|
|
783
745
|
return Object.values(e).forEach((s) => {
|
|
784
746
|
s.configurable = !0;
|
|
785
747
|
}), Object.create(K(t), e);
|
|
786
|
-
},
|
|
748
|
+
}, wt = (t, e) => {
|
|
787
749
|
const s = {
|
|
788
750
|
[Re]: e
|
|
789
751
|
};
|
|
790
752
|
let r = !1;
|
|
791
753
|
const n = (a, c) => {
|
|
792
754
|
if (!r) {
|
|
793
|
-
let u = s[
|
|
794
|
-
if (u || (u = {}, s[
|
|
795
|
-
u[
|
|
755
|
+
let u = s[A].get(t);
|
|
756
|
+
if (u || (u = {}, s[A].set(t, u)), a === v)
|
|
757
|
+
u[v] = !0;
|
|
796
758
|
else {
|
|
797
759
|
let p = u[a];
|
|
798
760
|
p || (p = /* @__PURE__ */ new Set(), u[a] = p), p.add(c);
|
|
799
761
|
}
|
|
800
762
|
}
|
|
801
763
|
}, i = () => {
|
|
802
|
-
r = !0, s[
|
|
764
|
+
r = !0, s[A].delete(t);
|
|
803
765
|
}, o = {
|
|
804
766
|
get(a, c) {
|
|
805
|
-
return c === V ? t : (n(X, c), Se(Reflect.get(a, c), s[
|
|
767
|
+
return c === V ? t : (n(X, c), Se(Reflect.get(a, c), s[A], s[be], s[Ee]));
|
|
806
768
|
},
|
|
807
769
|
has(a, c) {
|
|
808
|
-
return c ===
|
|
770
|
+
return c === pt ? (i(), !0) : (n(J, c), Reflect.has(a, c));
|
|
809
771
|
},
|
|
810
772
|
getOwnPropertyDescriptor(a, c) {
|
|
811
773
|
return n(G, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
812
774
|
},
|
|
813
775
|
ownKeys(a) {
|
|
814
|
-
return n(
|
|
776
|
+
return n(v), Reflect.ownKeys(a);
|
|
815
777
|
}
|
|
816
778
|
};
|
|
817
779
|
return e && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
@@ -825,18 +787,18 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
825
787
|
let n = r && r.get(t);
|
|
826
788
|
if (!n) {
|
|
827
789
|
const c = Z(t);
|
|
828
|
-
|
|
790
|
+
gt(c) ? n = [c, mt(c)] : n = [c], r?.set(t, n);
|
|
829
791
|
}
|
|
830
792
|
const [i, o] = n;
|
|
831
793
|
let a = s && s.get(i);
|
|
832
|
-
return (!a || a[1][Re] !== !!o) && (a =
|
|
833
|
-
},
|
|
794
|
+
return (!a || a[1][Re] !== !!o) && (a = wt(i, !!o), a[1][oe] = yt(o || i, a[0]), s && s.set(i, a)), a[1][A] = e, a[1][be] = s, a[1][Ee] = r, a[1][oe];
|
|
795
|
+
}, Tt = (t, e) => {
|
|
834
796
|
const s = Reflect.ownKeys(t), r = Reflect.ownKeys(e);
|
|
835
797
|
return s.length !== r.length || s.some((n, i) => n !== r[i]);
|
|
836
798
|
}, Ae = (t, e, s, r, n = Object.is) => {
|
|
837
799
|
if (n(t, e))
|
|
838
800
|
return !1;
|
|
839
|
-
if (!
|
|
801
|
+
if (!_(t) || !_(e))
|
|
840
802
|
return !0;
|
|
841
803
|
const i = s.get(Z(t));
|
|
842
804
|
if (!i)
|
|
@@ -850,8 +812,8 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
850
812
|
for (const a of i[J] || [])
|
|
851
813
|
if (o = Reflect.has(t, a) !== Reflect.has(e, a), o)
|
|
852
814
|
return o;
|
|
853
|
-
if (i[
|
|
854
|
-
if (o =
|
|
815
|
+
if (i[v] === !0) {
|
|
816
|
+
if (o = Tt(t, e), o)
|
|
855
817
|
return o;
|
|
856
818
|
} else
|
|
857
819
|
for (const a of i[G] || []) {
|
|
@@ -865,34 +827,34 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
865
827
|
if (o === null)
|
|
866
828
|
throw new Error("invalid used");
|
|
867
829
|
return o;
|
|
868
|
-
},
|
|
830
|
+
}, Rt = (t) => Pe(t) && t[V] || null, ie = (t, e = !0) => {
|
|
869
831
|
$.set(t, e);
|
|
870
|
-
},
|
|
832
|
+
}, bt = (t, e, s) => {
|
|
871
833
|
const r = [], n = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
872
834
|
var c, u, p;
|
|
873
835
|
if (n.has(o))
|
|
874
836
|
return;
|
|
875
|
-
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
878
|
-
if ((c =
|
|
879
|
-
const
|
|
880
|
-
r.push(a ? [...a,
|
|
881
|
-
}),
|
|
882
|
-
const
|
|
883
|
-
r.push(a ? [...a,
|
|
837
|
+
_(o) && n.add(o);
|
|
838
|
+
const m = _(o) && e.get(Z(o));
|
|
839
|
+
if (m) {
|
|
840
|
+
if ((c = m[J]) === null || c === void 0 || c.forEach((g) => {
|
|
841
|
+
const w = `:has(${String(g)})`;
|
|
842
|
+
r.push(a ? [...a, w] : [w]);
|
|
843
|
+
}), m[v] === !0) {
|
|
844
|
+
const g = ":ownKeys";
|
|
845
|
+
r.push(a ? [...a, g] : [g]);
|
|
884
846
|
} else
|
|
885
|
-
(u =
|
|
886
|
-
const
|
|
887
|
-
r.push(a ? [...a,
|
|
847
|
+
(u = m[G]) === null || u === void 0 || u.forEach((g) => {
|
|
848
|
+
const w = `:hasOwn(${String(g)})`;
|
|
849
|
+
r.push(a ? [...a, w] : [w]);
|
|
888
850
|
});
|
|
889
|
-
(p =
|
|
890
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
851
|
+
(p = m[X]) === null || p === void 0 || p.forEach((g) => {
|
|
852
|
+
"value" in (Object.getOwnPropertyDescriptor(o, g) || {}) && i(o[g], a ? [...a, g] : [g]);
|
|
891
853
|
});
|
|
892
854
|
} else a && r.push(a);
|
|
893
855
|
};
|
|
894
856
|
return i(t), r;
|
|
895
|
-
},
|
|
857
|
+
}, U = {}, Q = (t) => typeof t == "object" && t !== null, Et = (t) => Q(t) && !ee.has(t) && (Array.isArray(t) || !(Symbol.iterator in t)) && !(t instanceof WeakMap) && !(t instanceof WeakSet) && !(t instanceof Error) && !(t instanceof Number) && !(t instanceof Date) && !(t instanceof String) && !(t instanceof RegExp) && !(t instanceof ArrayBuffer) && !(t instanceof Promise), ve = (t, e) => {
|
|
896
858
|
const s = ae.get(t);
|
|
897
859
|
if (s?.[0] === e)
|
|
898
860
|
return s[1];
|
|
@@ -912,15 +874,15 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
912
874
|
};
|
|
913
875
|
if (ee.has(i))
|
|
914
876
|
ie(i, !1);
|
|
915
|
-
else if (
|
|
916
|
-
const [c, u] =
|
|
877
|
+
else if (E.has(i)) {
|
|
878
|
+
const [c, u] = E.get(
|
|
917
879
|
i
|
|
918
880
|
);
|
|
919
881
|
a.value = ve(c, u());
|
|
920
882
|
}
|
|
921
883
|
Object.defineProperty(r, n, a);
|
|
922
884
|
}), Object.preventExtensions(r);
|
|
923
|
-
},
|
|
885
|
+
}, Pt = (t, e, s, r) => ({
|
|
924
886
|
deleteProperty(n, i) {
|
|
925
887
|
const o = Reflect.get(n, i);
|
|
926
888
|
s(i);
|
|
@@ -929,76 +891,76 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
929
891
|
},
|
|
930
892
|
set(n, i, o, a) {
|
|
931
893
|
const c = !t() && Reflect.has(n, i), u = Reflect.get(n, i, a);
|
|
932
|
-
if (c && (ce(u, o) ||
|
|
894
|
+
if (c && (ce(u, o) || j.has(o) && ce(u, j.get(o))))
|
|
933
895
|
return !0;
|
|
934
|
-
s(i), Q(o) && (o =
|
|
935
|
-
const p = !
|
|
896
|
+
s(i), Q(o) && (o = Rt(o) || o);
|
|
897
|
+
const p = !E.has(o) && At(o) ? Oe(o) : o;
|
|
936
898
|
return e(i, p), Reflect.set(n, i, p, a), r(["set", [i], o, u]), !0;
|
|
937
899
|
}
|
|
938
|
-
}),
|
|
939
|
-
let ce = Object.is,
|
|
940
|
-
function
|
|
900
|
+
}), E = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakSet(), ae = /* @__PURE__ */ new WeakMap(), L = [1], j = /* @__PURE__ */ new WeakMap();
|
|
901
|
+
let ce = Object.is, St = (t, e) => new Proxy(t, e), At = Et, vt = ve, Ot = Pt;
|
|
902
|
+
function Oe(t = {}) {
|
|
941
903
|
if (!Q(t))
|
|
942
904
|
throw new Error("object required");
|
|
943
|
-
const e =
|
|
905
|
+
const e = j.get(t);
|
|
944
906
|
if (e)
|
|
945
907
|
return e;
|
|
946
908
|
let s = L[0];
|
|
947
|
-
const r = /* @__PURE__ */ new Set(), n = (l,
|
|
948
|
-
s !==
|
|
909
|
+
const r = /* @__PURE__ */ new Set(), n = (l, d = ++L[0]) => {
|
|
910
|
+
s !== d && (i = s = d, r.forEach((f) => f(l, d)));
|
|
949
911
|
};
|
|
950
912
|
let i = s;
|
|
951
|
-
const o = (l = L[0]) => (i !== l && (i = l, c.forEach(([
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
})), s), a = (l) => (
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
}, c = /* @__PURE__ */ new Map(), u = (l,
|
|
958
|
-
const
|
|
959
|
-
if (
|
|
960
|
-
if ((
|
|
913
|
+
const o = (l = L[0]) => (i !== l && (i = l, c.forEach(([d]) => {
|
|
914
|
+
const f = d[1](l);
|
|
915
|
+
f > s && (s = f);
|
|
916
|
+
})), s), a = (l) => (d, f) => {
|
|
917
|
+
const T = [...d];
|
|
918
|
+
T[1] = [l, ...T[1]], n(T, f);
|
|
919
|
+
}, c = /* @__PURE__ */ new Map(), u = (l, d) => {
|
|
920
|
+
const f = !ee.has(d) && E.get(d);
|
|
921
|
+
if (f) {
|
|
922
|
+
if ((U ? "production" : void 0) !== "production" && c.has(l))
|
|
961
923
|
throw new Error("prop listener already exists");
|
|
962
924
|
if (r.size) {
|
|
963
|
-
const
|
|
964
|
-
c.set(l, [
|
|
925
|
+
const T = f[2](a(l));
|
|
926
|
+
c.set(l, [f, T]);
|
|
965
927
|
} else
|
|
966
|
-
c.set(l, [
|
|
928
|
+
c.set(l, [f]);
|
|
967
929
|
}
|
|
968
930
|
}, p = (l) => {
|
|
969
|
-
var
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
},
|
|
973
|
-
if ((
|
|
931
|
+
var d;
|
|
932
|
+
const f = c.get(l);
|
|
933
|
+
f && (c.delete(l), (d = f[1]) == null || d.call(f));
|
|
934
|
+
}, m = (l) => (r.add(l), r.size === 1 && c.forEach(([f, T], k) => {
|
|
935
|
+
if ((U ? "production" : void 0) !== "production" && T)
|
|
974
936
|
throw new Error("remove already exists");
|
|
975
|
-
const
|
|
976
|
-
c.set(
|
|
937
|
+
const Ce = f[2](a(k));
|
|
938
|
+
c.set(k, [f, Ce]);
|
|
977
939
|
}), () => {
|
|
978
|
-
r.delete(l), r.size === 0 && c.forEach(([
|
|
979
|
-
|
|
940
|
+
r.delete(l), r.size === 0 && c.forEach(([f, T], k) => {
|
|
941
|
+
T && (T(), c.set(k, [f]));
|
|
980
942
|
});
|
|
981
943
|
});
|
|
982
|
-
let
|
|
983
|
-
const
|
|
984
|
-
() =>
|
|
944
|
+
let g = !0;
|
|
945
|
+
const w = Ot(
|
|
946
|
+
() => g,
|
|
985
947
|
u,
|
|
986
948
|
p,
|
|
987
949
|
n
|
|
988
|
-
),
|
|
989
|
-
|
|
990
|
-
const
|
|
991
|
-
return
|
|
992
|
-
const
|
|
950
|
+
), P = St(t, w);
|
|
951
|
+
j.set(t, P);
|
|
952
|
+
const C = [t, o, m];
|
|
953
|
+
return E.set(P, C), Reflect.ownKeys(t).forEach((l) => {
|
|
954
|
+
const d = Object.getOwnPropertyDescriptor(
|
|
993
955
|
t,
|
|
994
956
|
l
|
|
995
957
|
);
|
|
996
|
-
"value" in
|
|
997
|
-
}),
|
|
958
|
+
"value" in d && d.writable && (P[l] = t[l]);
|
|
959
|
+
}), g = !1, P;
|
|
998
960
|
}
|
|
999
961
|
function Ct(t, e, s) {
|
|
1000
|
-
const r =
|
|
1001
|
-
(
|
|
962
|
+
const r = E.get(t);
|
|
963
|
+
(U ? "production" : void 0) !== "production" && !r && console.warn("Please use proxy object");
|
|
1002
964
|
let n;
|
|
1003
965
|
const i = [], o = r[2];
|
|
1004
966
|
let a = !1;
|
|
@@ -1012,18 +974,18 @@ function Ct(t, e, s) {
|
|
|
1012
974
|
};
|
|
1013
975
|
}
|
|
1014
976
|
function ue(t) {
|
|
1015
|
-
const e =
|
|
1016
|
-
(
|
|
977
|
+
const e = E.get(t);
|
|
978
|
+
(U ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
|
|
1017
979
|
const [s, r] = e;
|
|
1018
|
-
return
|
|
980
|
+
return vt(s, r());
|
|
1019
981
|
}
|
|
1020
|
-
const
|
|
982
|
+
const kt = {}, Nt = (t, e) => {
|
|
1021
983
|
const s = W(void 0);
|
|
1022
984
|
F(() => {
|
|
1023
|
-
s.current =
|
|
985
|
+
s.current = bt(t, e);
|
|
1024
986
|
}), _e(s.current);
|
|
1025
|
-
},
|
|
1026
|
-
function
|
|
987
|
+
}, qt = Nt, _t = /* @__PURE__ */ new WeakMap();
|
|
988
|
+
function Ut(t, e) {
|
|
1027
989
|
const r = te(
|
|
1028
990
|
() => t && /* @__PURE__ */ new WeakMap(),
|
|
1029
991
|
[t]
|
|
@@ -1055,11 +1017,11 @@ function _t(t, e) {
|
|
|
1055
1017
|
);
|
|
1056
1018
|
i = !1, qe(() => {
|
|
1057
1019
|
n.current = o;
|
|
1058
|
-
}), (
|
|
1020
|
+
}), (kt ? "production" : void 0) !== "production" && qt(o, r);
|
|
1059
1021
|
const a = te(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1060
|
-
return Se(o, r, a,
|
|
1022
|
+
return Se(o, r, a, _t);
|
|
1061
1023
|
}
|
|
1062
|
-
const
|
|
1024
|
+
const R = Oe({
|
|
1063
1025
|
data: null,
|
|
1064
1026
|
isPending: !1,
|
|
1065
1027
|
error: null
|
|
@@ -1069,8 +1031,15 @@ function Dt({
|
|
|
1069
1031
|
params: e,
|
|
1070
1032
|
callbacks: s
|
|
1071
1033
|
}) {
|
|
1072
|
-
const r =
|
|
1073
|
-
|
|
1034
|
+
const r = Ut(R), [n, i] = le(!1);
|
|
1035
|
+
function o() {
|
|
1036
|
+
i(!0);
|
|
1037
|
+
}
|
|
1038
|
+
function a() {
|
|
1039
|
+
i(!1);
|
|
1040
|
+
}
|
|
1041
|
+
const c = () => {
|
|
1042
|
+
R.isPending = !0, R.error = null, fetch(t, {
|
|
1074
1043
|
method: "POST",
|
|
1075
1044
|
headers: {
|
|
1076
1045
|
"Content-Type": "application/json"
|
|
@@ -1078,23 +1047,25 @@ function Dt({
|
|
|
1078
1047
|
body: JSON.stringify({
|
|
1079
1048
|
amount: e?.amount
|
|
1080
1049
|
})
|
|
1081
|
-
}).then((
|
|
1082
|
-
|
|
1083
|
-
}).catch((
|
|
1084
|
-
|
|
1050
|
+
}).then((u) => u.json()).then((u) => {
|
|
1051
|
+
R.data = u, s?.onSuccess?.(), R.isPending = !1;
|
|
1052
|
+
}).catch((u) => {
|
|
1053
|
+
R.error = u?.toString(), s?.onError?.(), R.isPending = !1;
|
|
1085
1054
|
});
|
|
1086
1055
|
};
|
|
1087
|
-
return F(
|
|
1056
|
+
return F(c, []), {
|
|
1088
1057
|
...r,
|
|
1089
|
-
|
|
1058
|
+
isOpen: n,
|
|
1059
|
+
open: o,
|
|
1060
|
+
close: a,
|
|
1061
|
+
refetch: c
|
|
1090
1062
|
};
|
|
1091
1063
|
}
|
|
1092
1064
|
export {
|
|
1093
|
-
|
|
1094
|
-
|
|
1065
|
+
h as Chainrails,
|
|
1066
|
+
Lt as PaymentModal,
|
|
1095
1067
|
ot as chains,
|
|
1096
|
-
|
|
1068
|
+
xt as crapi,
|
|
1097
1069
|
it as tokens,
|
|
1098
|
-
Dt as useGetSessionToken
|
|
1099
|
-
Lt as usePaymentModal
|
|
1070
|
+
Dt as useGetSessionToken
|
|
1100
1071
|
};
|