@chainrails/react 0.0.29 → 0.0.30
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 +5 -6
- package/dist/PaymentModal/index.d.ts.map +1 -1
- package/dist/chainrails-sdk.es.js +277 -305
- package/dist/chainrails-sdk.es.mjs +277 -305
- 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 { jsxs as se, jsx as
|
|
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 { jsxs as se, jsx as k } 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
|
-
})(), Ue = typeof globalThis.AbortController == "function",
|
|
53
|
+
})(), Ue = typeof globalThis.AbortController == "function", he = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", je = typeof globalThis.ReadableStream == "function", Me = typeof globalThis.FormData == "function", de = ["get", "post", "put", "patch", "head", "delete"], xe = {
|
|
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,
|
|
76
|
-
class
|
|
62
|
+
}, x = 2147483647, Le = 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
|
|
69
|
+
const De = (t) => new ye(t), Ie = {
|
|
83
70
|
json: !0,
|
|
84
71
|
parseJson: !0,
|
|
85
72
|
stringifyJson: !0,
|
|
@@ -93,10 +80,10 @@ const Ie = (t) => new ge(t), Be = {
|
|
|
93
80
|
onUploadProgress: !0,
|
|
94
81
|
fetch: !0,
|
|
95
82
|
context: !0
|
|
96
|
-
},
|
|
83
|
+
}, Be = {
|
|
97
84
|
next: !0
|
|
98
85
|
// Next.js cache revalidation (revalidate, tags)
|
|
99
|
-
},
|
|
86
|
+
}, He = {
|
|
100
87
|
method: !0,
|
|
101
88
|
headers: !0,
|
|
102
89
|
body: !0,
|
|
@@ -111,13 +98,13 @@ const Ie = (t) => new ge(t), Be = {
|
|
|
111
98
|
signal: !0,
|
|
112
99
|
window: !0,
|
|
113
100
|
duplex: !0
|
|
114
|
-
},
|
|
101
|
+
}, Ke = (t) => {
|
|
115
102
|
if (!t)
|
|
116
103
|
return 0;
|
|
117
104
|
if (t instanceof FormData) {
|
|
118
105
|
let e = 0;
|
|
119
106
|
for (const [s, r] of t)
|
|
120
|
-
e +=
|
|
107
|
+
e += Le, e += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, e += typeof r == "string" ? new TextEncoder().encode(r).length : r.size;
|
|
121
108
|
return e;
|
|
122
109
|
}
|
|
123
110
|
if (t instanceof Blob)
|
|
@@ -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) {
|
|
@@ -153,7 +140,7 @@ const Ie = (t) => new ge(t), Be = {
|
|
|
153
140
|
r && (n += r.byteLength, s?.({ percent: 1, totalBytes: Math.max(e, n), transferredBytes: n }, r));
|
|
154
141
|
}
|
|
155
142
|
}));
|
|
156
|
-
},
|
|
143
|
+
}, $e = (t, e) => {
|
|
157
144
|
if (!t.body)
|
|
158
145
|
return t;
|
|
159
146
|
if (t.status === 204)
|
|
@@ -163,40 +150,40 @@ 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
|
|
170
157
|
});
|
|
171
|
-
},
|
|
158
|
+
}, We = (t, e, s) => {
|
|
172
159
|
if (!t.body)
|
|
173
160
|
return t;
|
|
174
|
-
const r =
|
|
161
|
+
const r = Ke(s ?? t.body);
|
|
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:
|
|
199
|
-
}),
|
|
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")
|
|
186
|
+
}), Fe = (t, e) => {
|
|
200
187
|
const s = new URLSearchParams();
|
|
201
188
|
for (const r of [t, e])
|
|
202
189
|
if (r !== void 0)
|
|
@@ -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,
|
|
@@ -240,25 +227,25 @@ const Te = (t = {}, e = {}) => ({
|
|
|
240
227
|
continue;
|
|
241
228
|
}
|
|
242
229
|
if (a === "searchParams") {
|
|
243
|
-
c == null ? n = void 0 : n = n === void 0 ? c :
|
|
230
|
+
c == null ? n = void 0 : n = n === void 0 ? c : Fe(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
|
-
},
|
|
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
|
+
}, Ye = (t) => de.includes(t) ? t.toUpperCase() : t, ze = ["get", "put", "head", "delete", "options", "trace"], Ve = [408, 413, 429, 500, 502, 503, 504], Je = [413, 429, 503], ne = {
|
|
252
239
|
limit: 2,
|
|
253
|
-
methods:
|
|
254
|
-
statusCodes:
|
|
255
|
-
afterStatusCodes:
|
|
240
|
+
methods: ze,
|
|
241
|
+
statusCodes: Ve,
|
|
242
|
+
afterStatusCodes: Je,
|
|
256
243
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
257
244
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
258
245
|
delay: (t) => 0.3 * 2 ** (t - 1) * 1e3,
|
|
259
246
|
jitter: void 0,
|
|
260
247
|
retryOnTimeout: !1
|
|
261
|
-
},
|
|
248
|
+
}, Ge = (t = {}) => {
|
|
262
249
|
if (typeof t == "number")
|
|
263
250
|
return {
|
|
264
251
|
...ne,
|
|
@@ -279,7 +266,7 @@ class I extends Error {
|
|
|
279
266
|
super(`Request timed out: ${e.method} ${e.url}`), this.name = "TimeoutError", this.request = e;
|
|
280
267
|
}
|
|
281
268
|
}
|
|
282
|
-
async function
|
|
269
|
+
async function Xe(t, e, s, r) {
|
|
283
270
|
return new Promise((n, i) => {
|
|
284
271
|
const o = setTimeout(() => {
|
|
285
272
|
s && s.abort(), i(new I(t));
|
|
@@ -289,7 +276,7 @@ async function Ze(t, e, s, r) {
|
|
|
289
276
|
});
|
|
290
277
|
});
|
|
291
278
|
}
|
|
292
|
-
async function
|
|
279
|
+
async function Ze(t, { signal: e }) {
|
|
293
280
|
return new Promise((s, r) => {
|
|
294
281
|
e && (e.throwIfAborted(), e.addEventListener("abort", n, { once: !0 }));
|
|
295
282
|
function n() {
|
|
@@ -300,16 +287,16 @@ async function Qe(t, { signal: e }) {
|
|
|
300
287
|
}, t);
|
|
301
288
|
});
|
|
302
289
|
}
|
|
303
|
-
const
|
|
290
|
+
const Qe = (t, e) => {
|
|
304
291
|
const s = {};
|
|
305
292
|
for (const r in e)
|
|
306
|
-
Object.hasOwn(e, r) && !(r in
|
|
293
|
+
Object.hasOwn(e, r) && !(r in He) && !(r in Ie) && (!(r in t) || r in Be) && (s[r] = e[r]);
|
|
307
294
|
return s;
|
|
308
|
-
},
|
|
309
|
-
function
|
|
295
|
+
}, et = (t) => t === void 0 ? !1 : Array.isArray(t) ? t.length > 0 : t instanceof URLSearchParams ? t.size > 0 : typeof t == "object" ? Object.keys(t).length > 0 : typeof t == "string" ? t.trim().length > 0 : !!t;
|
|
296
|
+
function tt(t) {
|
|
310
297
|
return t instanceof D || t?.name === D.name;
|
|
311
298
|
}
|
|
312
|
-
function
|
|
299
|
+
function st(t) {
|
|
313
300
|
return t instanceof I || t?.name === I.name;
|
|
314
301
|
}
|
|
315
302
|
class v {
|
|
@@ -321,11 +308,11 @@ class v {
|
|
|
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());
|
|
@@ -338,14 +325,14 @@ class v {
|
|
|
338
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
339
326
|
if (!je)
|
|
340
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
341
|
-
return
|
|
328
|
+
return $e(o.clone(), r.#e.onDownloadProgress);
|
|
342
329
|
}
|
|
343
330
|
return o;
|
|
344
331
|
}, i = r.#f(n).finally(async () => {
|
|
345
332
|
const o = r.#o, a = [];
|
|
346
333
|
o && !o.bodyUsed && a.push(o.body?.cancel()), r.request.bodyUsed || a.push(r.request.body?.cancel()), await Promise.all(a);
|
|
347
334
|
});
|
|
348
|
-
for (const [o, a] of Object.entries(
|
|
335
|
+
for (const [o, a] of Object.entries(xe))
|
|
349
336
|
o === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[o] = async () => {
|
|
350
337
|
r.request.headers.set("accept", r.request.headers.get("accept") || a);
|
|
351
338
|
const c = await i;
|
|
@@ -376,17 +363,17 @@ 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: [],
|
|
384
371
|
afterResponse: []
|
|
385
372
|
}, s.hooks),
|
|
386
|
-
method:
|
|
373
|
+
method: Ye(s.method ?? this.#t.method ?? "GET"),
|
|
387
374
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
388
375
|
prefixUrl: String(s.prefixUrl || ""),
|
|
389
|
-
retry:
|
|
376
|
+
retry: Ge(s.retry),
|
|
390
377
|
throwHttpErrors: s.throwHttpErrors ?? !0,
|
|
391
378
|
timeout: s.timeout ?? 1e4,
|
|
392
379
|
fetch: s.fetch ?? globalThis.fetch.bind(globalThis),
|
|
@@ -398,9 +385,9 @@ 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
|
-
Ue &&
|
|
388
|
+
Ue && 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
|
-
if (this.#t instanceof globalThis.Request && (
|
|
390
|
+
if (this.#t instanceof globalThis.Request && (Me && 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), et(this.#e.searchParams)) {
|
|
404
391
|
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(v.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
405
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
406
393
|
}
|
|
@@ -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;
|
|
@@ -432,9 +419,9 @@ class v {
|
|
|
432
419
|
if (r === !0)
|
|
433
420
|
return this.#c();
|
|
434
421
|
}
|
|
435
|
-
if (
|
|
422
|
+
if (st(e) && !this.#e.retry.retryOnTimeout)
|
|
436
423
|
throw e;
|
|
437
|
-
if (
|
|
424
|
+
if (tt(e)) {
|
|
438
425
|
if (!this.#e.retry.statusCodes.includes(e.response.status))
|
|
439
426
|
throw e;
|
|
440
427
|
const r = e.response.headers.get("Retry-After") ?? e.response.headers.get("RateLimit-Reset") ?? e.response.headers.get("X-RateLimit-Retry-After") ?? e.response.headers.get("X-RateLimit-Reset") ?? e.response.headers.get("X-Rate-Limit-Reset");
|
|
@@ -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
|
|
449
|
+
if (await Ze(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);
|
|
@@ -493,8 +480,8 @@ class v {
|
|
|
493
480
|
break;
|
|
494
481
|
}
|
|
495
482
|
}
|
|
496
|
-
const e =
|
|
497
|
-
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, e) :
|
|
483
|
+
const e = Qe(this.request, this.#e);
|
|
484
|
+
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, e) : Xe(this.#o, e, this.#r, this.#e);
|
|
498
485
|
}
|
|
499
486
|
#a() {
|
|
500
487
|
if (!this.#i) {
|
|
@@ -507,28 +494,28 @@ class v {
|
|
|
507
494
|
this.#i = void 0, this.request = this.#h(e);
|
|
508
495
|
}
|
|
509
496
|
#h(e, s) {
|
|
510
|
-
return !this.#e.onUploadProgress || !e.body ? e :
|
|
497
|
+
return !this.#e.onUploadProgress || !e.body ? e : We(e, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
|
|
511
498
|
}
|
|
512
499
|
}
|
|
513
500
|
/*! MIT License © Sindre Sorhus */
|
|
514
501
|
const B = (t) => {
|
|
515
|
-
const e = (s, r) => v.create(s,
|
|
516
|
-
for (const s of
|
|
517
|
-
e[s] = (r, n) => v.create(r,
|
|
518
|
-
return e.create = (s) => B(
|
|
519
|
-
},
|
|
520
|
-
var
|
|
521
|
-
class
|
|
502
|
+
const e = (s, r) => v.create(s, N(t, r));
|
|
503
|
+
for (const s of de)
|
|
504
|
+
e[s] = (r, n) => v.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 = De, e;
|
|
506
|
+
}, rt = B();
|
|
507
|
+
var nt = /* @__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))(nt || {}), ot = /* @__PURE__ */ ((t) => (t.USDC = "USDC", t))(ot || {}), z = /* @__PURE__ */ ((t) => (t.PRODUCTION = "production", t.STAGING = "staging", t))(z || {});
|
|
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
|
-
function
|
|
584
|
-
H =
|
|
585
|
-
prefixUrl:
|
|
570
|
+
function it() {
|
|
571
|
+
H = rt.create({
|
|
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,77 +587,90 @@ function at() {
|
|
|
600
587
|
}
|
|
601
588
|
});
|
|
602
589
|
}
|
|
603
|
-
function
|
|
604
|
-
return H ||
|
|
590
|
+
function y() {
|
|
591
|
+
return H || it(), H;
|
|
605
592
|
}
|
|
606
|
-
class
|
|
593
|
+
class at {
|
|
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
|
-
class
|
|
616
|
+
class ct {
|
|
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
|
-
class
|
|
630
|
+
class ut {
|
|
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
|
-
class
|
|
644
|
+
class lt {
|
|
658
645
|
async getSupported(e) {
|
|
659
|
-
return await
|
|
646
|
+
return await y().get("chains", { searchParams: e }).json();
|
|
660
647
|
}
|
|
661
648
|
}
|
|
662
|
-
class
|
|
649
|
+
class ft {
|
|
663
650
|
async getClientInfo() {
|
|
664
|
-
return await
|
|
651
|
+
return await y().get("client/auth/client-info").json();
|
|
665
652
|
}
|
|
666
653
|
}
|
|
667
|
-
const
|
|
668
|
-
router: new
|
|
669
|
-
quotes: new
|
|
670
|
-
intents: new
|
|
671
|
-
chains: new
|
|
672
|
-
client: new
|
|
654
|
+
const Mt = {
|
|
655
|
+
router: new ut(),
|
|
656
|
+
quotes: new ct(),
|
|
657
|
+
intents: new at(),
|
|
658
|
+
chains: new lt(),
|
|
659
|
+
client: new ft()
|
|
673
660
|
};
|
|
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 ht() {
|
|
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
674
|
function xt(t) {
|
|
675
675
|
const {
|
|
676
676
|
to: e,
|
|
@@ -678,105 +678,68 @@ function xt(t) {
|
|
|
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
|
+
O();
|
|
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), O();
|
|
701
700
|
}
|
|
702
|
-
function
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
701
|
+
function O() {
|
|
702
|
+
if (!p) return;
|
|
703
|
+
const l = {
|
|
704
|
+
type: "session",
|
|
705
|
+
session_token: p,
|
|
706
|
+
environment: h.getEnv() || z.PRODUCTION
|
|
707
707
|
};
|
|
708
|
-
|
|
709
|
-
}
|
|
710
|
-
return /* @__PURE__ */ se("div", {
|
|
711
|
-
...w,
|
|
712
|
-
className: Me("payment-modal-wrapper", y ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
713
|
-
children: [y && /* @__PURE__ */ O("div", {
|
|
714
|
-
role: "status",
|
|
715
|
-
className: "payment-modal-loader",
|
|
716
|
-
children: /* @__PURE__ */ se("svg", {
|
|
717
|
-
"aria-hidden": "true",
|
|
718
|
-
className: "icon",
|
|
719
|
-
viewBox: "0 0 100 101",
|
|
720
|
-
fill: "none",
|
|
721
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
722
|
-
children: [/* @__PURE__ */ O("path", {
|
|
723
|
-
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
|
-
fill: "currentColor"
|
|
725
|
-
}), /* @__PURE__ */ O("path", {
|
|
726
|
-
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
|
-
fill: "currentFill"
|
|
728
|
-
})]
|
|
729
|
-
})
|
|
730
|
-
}), /* @__PURE__ */ O("iframe", {
|
|
731
|
-
allow: "clipboard-read *; clipboard-write *",
|
|
732
|
-
src: d.getPayModalUrl(r, s, e, n),
|
|
733
|
-
onLoad: U,
|
|
734
|
-
className: `payment-modal ${y ? "invisible" : "visible"}`,
|
|
735
|
-
"data-id": n,
|
|
736
|
-
ref: R
|
|
737
|
-
})]
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
function Lt(t) {
|
|
741
|
-
const {
|
|
742
|
-
onCancel: e,
|
|
743
|
-
onSuccess: s,
|
|
744
|
-
onChainSelect: r,
|
|
745
|
-
onIntentCreate: n,
|
|
746
|
-
...i
|
|
747
|
-
} = t, [o, a] = le(!1);
|
|
748
|
-
function c() {
|
|
749
|
-
a(!0);
|
|
708
|
+
w.current?.contentWindow?.postMessage(l, "https://app.chainrails.io"), w.current?.contentWindow?.postMessage(l, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
750
709
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
710
|
+
if (p)
|
|
711
|
+
return /* @__PURE__ */ se("div", {
|
|
712
|
+
className: ht("payment-modal-wrapper", m ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
713
|
+
children: [m && /* @__PURE__ */ k("div", {
|
|
714
|
+
role: "status",
|
|
715
|
+
className: "payment-modal-loader",
|
|
716
|
+
children: /* @__PURE__ */ se("svg", {
|
|
717
|
+
"aria-hidden": "true",
|
|
718
|
+
className: "icon",
|
|
719
|
+
viewBox: "0 0 100 101",
|
|
720
|
+
fill: "none",
|
|
721
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
722
|
+
children: [/* @__PURE__ */ k("path", {
|
|
723
|
+
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
|
+
fill: "currentColor"
|
|
725
|
+
}), /* @__PURE__ */ k("path", {
|
|
726
|
+
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
|
+
fill: "currentFill"
|
|
728
|
+
})]
|
|
729
|
+
})
|
|
730
|
+
}), /* @__PURE__ */ k("iframe", {
|
|
731
|
+
allow: "clipboard-read *; clipboard-write *",
|
|
732
|
+
src: h.getPayModalUrl(r, s, e, n),
|
|
733
|
+
onLoad: P,
|
|
734
|
+
className: `payment-modal ${m ? "invisible" : "visible"}`,
|
|
735
|
+
"data-id": n,
|
|
736
|
+
ref: w
|
|
737
|
+
})]
|
|
738
|
+
});
|
|
776
739
|
}
|
|
777
740
|
const dt = Symbol(), V = Symbol(), S = "a", Re = "f", oe = "p", be = "c", Ee = "t", J = "h", A = "w", G = "o", X = "k";
|
|
778
741
|
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),
|
|
742
|
+
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, yt = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), gt = (t) => {
|
|
780
743
|
if (Array.isArray(t))
|
|
781
744
|
return Array.from(t);
|
|
782
745
|
const e = Object.getOwnPropertyDescriptors(t);
|
|
@@ -836,7 +799,7 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
836
799
|
}, Ae = (t, e, s, r, n = Object.is) => {
|
|
837
800
|
if (n(t, e))
|
|
838
801
|
return !1;
|
|
839
|
-
if (!
|
|
802
|
+
if (!_(t) || !_(e))
|
|
840
803
|
return !0;
|
|
841
804
|
const i = s.get(Z(t));
|
|
842
805
|
if (!i)
|
|
@@ -872,27 +835,27 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
872
835
|
var c, u, p;
|
|
873
836
|
if (n.has(o))
|
|
874
837
|
return;
|
|
875
|
-
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
878
|
-
if ((c =
|
|
879
|
-
const
|
|
880
|
-
r.push(a ? [...a,
|
|
881
|
-
}),
|
|
882
|
-
const
|
|
883
|
-
r.push(a ? [...a,
|
|
838
|
+
_(o) && n.add(o);
|
|
839
|
+
const m = _(o) && e.get(Z(o));
|
|
840
|
+
if (m) {
|
|
841
|
+
if ((c = m[J]) === null || c === void 0 || c.forEach((g) => {
|
|
842
|
+
const w = `:has(${String(g)})`;
|
|
843
|
+
r.push(a ? [...a, w] : [w]);
|
|
844
|
+
}), m[A] === !0) {
|
|
845
|
+
const g = ":ownKeys";
|
|
846
|
+
r.push(a ? [...a, g] : [g]);
|
|
884
847
|
} else
|
|
885
|
-
(u =
|
|
886
|
-
const
|
|
887
|
-
r.push(a ? [...a,
|
|
848
|
+
(u = m[G]) === null || u === void 0 || u.forEach((g) => {
|
|
849
|
+
const w = `:hasOwn(${String(g)})`;
|
|
850
|
+
r.push(a ? [...a, w] : [w]);
|
|
888
851
|
});
|
|
889
|
-
(p =
|
|
890
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
852
|
+
(p = m[X]) === null || p === void 0 || p.forEach((g) => {
|
|
853
|
+
"value" in (Object.getOwnPropertyDescriptor(o, g) || {}) && i(o[g], a ? [...a, g] : [g]);
|
|
891
854
|
});
|
|
892
855
|
} else a && r.push(a);
|
|
893
856
|
};
|
|
894
857
|
return i(t), r;
|
|
895
|
-
},
|
|
858
|
+
}, U = {}, Q = (t) => typeof t == "object" && t !== null, bt = (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
859
|
const s = ae.get(t);
|
|
897
860
|
if (s?.[0] === e)
|
|
898
861
|
return s[1];
|
|
@@ -912,8 +875,8 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
912
875
|
};
|
|
913
876
|
if (ee.has(i))
|
|
914
877
|
ie(i, !1);
|
|
915
|
-
else if (
|
|
916
|
-
const [c, u] =
|
|
878
|
+
else if (E.has(i)) {
|
|
879
|
+
const [c, u] = E.get(
|
|
917
880
|
i
|
|
918
881
|
);
|
|
919
882
|
a.value = ve(c, u());
|
|
@@ -929,76 +892,76 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
929
892
|
},
|
|
930
893
|
set(n, i, o, a) {
|
|
931
894
|
const c = !t() && Reflect.has(n, i), u = Reflect.get(n, i, a);
|
|
932
|
-
if (c && (ce(u, o) ||
|
|
895
|
+
if (c && (ce(u, o) || j.has(o) && ce(u, j.get(o))))
|
|
933
896
|
return !0;
|
|
934
897
|
s(i), Q(o) && (o = Tt(o) || o);
|
|
935
|
-
const p = !
|
|
898
|
+
const p = !E.has(o) && St(o) ? Oe(o) : o;
|
|
936
899
|
return e(i, p), Reflect.set(n, i, p, a), r(["set", [i], o, u]), !0;
|
|
937
900
|
}
|
|
938
|
-
}),
|
|
901
|
+
}), E = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakSet(), ae = /* @__PURE__ */ new WeakMap(), L = [1], j = /* @__PURE__ */ new WeakMap();
|
|
939
902
|
let ce = Object.is, Pt = (t, e) => new Proxy(t, e), St = bt, At = ve, vt = Et;
|
|
940
|
-
function
|
|
903
|
+
function Oe(t = {}) {
|
|
941
904
|
if (!Q(t))
|
|
942
905
|
throw new Error("object required");
|
|
943
|
-
const e =
|
|
906
|
+
const e = j.get(t);
|
|
944
907
|
if (e)
|
|
945
908
|
return e;
|
|
946
909
|
let s = L[0];
|
|
947
|
-
const r = /* @__PURE__ */ new Set(), n = (l,
|
|
948
|
-
s !==
|
|
910
|
+
const r = /* @__PURE__ */ new Set(), n = (l, d = ++L[0]) => {
|
|
911
|
+
s !== d && (i = s = d, r.forEach((f) => f(l, d)));
|
|
949
912
|
};
|
|
950
913
|
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 ((
|
|
914
|
+
const o = (l = L[0]) => (i !== l && (i = l, c.forEach(([d]) => {
|
|
915
|
+
const f = d[1](l);
|
|
916
|
+
f > s && (s = f);
|
|
917
|
+
})), s), a = (l) => (d, f) => {
|
|
918
|
+
const T = [...d];
|
|
919
|
+
T[1] = [l, ...T[1]], n(T, f);
|
|
920
|
+
}, c = /* @__PURE__ */ new Map(), u = (l, d) => {
|
|
921
|
+
const f = !ee.has(d) && E.get(d);
|
|
922
|
+
if (f) {
|
|
923
|
+
if ((U ? "production" : void 0) !== "production" && c.has(l))
|
|
961
924
|
throw new Error("prop listener already exists");
|
|
962
925
|
if (r.size) {
|
|
963
|
-
const
|
|
964
|
-
c.set(l, [
|
|
926
|
+
const T = f[2](a(l));
|
|
927
|
+
c.set(l, [f, T]);
|
|
965
928
|
} else
|
|
966
|
-
c.set(l, [
|
|
929
|
+
c.set(l, [f]);
|
|
967
930
|
}
|
|
968
931
|
}, p = (l) => {
|
|
969
|
-
var
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
},
|
|
973
|
-
if ((
|
|
932
|
+
var d;
|
|
933
|
+
const f = c.get(l);
|
|
934
|
+
f && (c.delete(l), (d = f[1]) == null || d.call(f));
|
|
935
|
+
}, m = (l) => (r.add(l), r.size === 1 && c.forEach(([f, T], C) => {
|
|
936
|
+
if ((U ? "production" : void 0) !== "production" && T)
|
|
974
937
|
throw new Error("remove already exists");
|
|
975
|
-
const
|
|
976
|
-
c.set(C, [
|
|
938
|
+
const Ce = f[2](a(C));
|
|
939
|
+
c.set(C, [f, Ce]);
|
|
977
940
|
}), () => {
|
|
978
|
-
r.delete(l), r.size === 0 && c.forEach(([
|
|
979
|
-
|
|
941
|
+
r.delete(l), r.size === 0 && c.forEach(([f, T], C) => {
|
|
942
|
+
T && (T(), c.set(C, [f]));
|
|
980
943
|
});
|
|
981
944
|
});
|
|
982
|
-
let
|
|
983
|
-
const
|
|
984
|
-
() =>
|
|
945
|
+
let g = !0;
|
|
946
|
+
const w = vt(
|
|
947
|
+
() => g,
|
|
985
948
|
u,
|
|
986
949
|
p,
|
|
987
950
|
n
|
|
988
|
-
),
|
|
989
|
-
|
|
990
|
-
const
|
|
991
|
-
return
|
|
992
|
-
const
|
|
951
|
+
), P = Pt(t, w);
|
|
952
|
+
j.set(t, P);
|
|
953
|
+
const O = [t, o, m];
|
|
954
|
+
return E.set(P, O), Reflect.ownKeys(t).forEach((l) => {
|
|
955
|
+
const d = Object.getOwnPropertyDescriptor(
|
|
993
956
|
t,
|
|
994
957
|
l
|
|
995
958
|
);
|
|
996
|
-
"value" in
|
|
997
|
-
}),
|
|
959
|
+
"value" in d && d.writable && (P[l] = t[l]);
|
|
960
|
+
}), g = !1, P;
|
|
998
961
|
}
|
|
999
|
-
function
|
|
1000
|
-
const r =
|
|
1001
|
-
(
|
|
962
|
+
function Ot(t, e, s) {
|
|
963
|
+
const r = E.get(t);
|
|
964
|
+
(U ? "production" : void 0) !== "production" && !r && console.warn("Please use proxy object");
|
|
1002
965
|
let n;
|
|
1003
966
|
const i = [], o = r[2];
|
|
1004
967
|
let a = !1;
|
|
@@ -1012,12 +975,12 @@ function Ct(t, e, s) {
|
|
|
1012
975
|
};
|
|
1013
976
|
}
|
|
1014
977
|
function ue(t) {
|
|
1015
|
-
const e =
|
|
1016
|
-
(
|
|
978
|
+
const e = E.get(t);
|
|
979
|
+
(U ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
|
|
1017
980
|
const [s, r] = e;
|
|
1018
981
|
return At(s, r());
|
|
1019
982
|
}
|
|
1020
|
-
const
|
|
983
|
+
const Ct = {}, kt = (t, e) => {
|
|
1021
984
|
const s = W(void 0);
|
|
1022
985
|
F(() => {
|
|
1023
986
|
s.current = Rt(t, e);
|
|
@@ -1032,7 +995,7 @@ function _t(t, e) {
|
|
|
1032
995
|
const o = ke(
|
|
1033
996
|
Ne(
|
|
1034
997
|
(c) => {
|
|
1035
|
-
const u =
|
|
998
|
+
const u = Ot(t, c);
|
|
1036
999
|
return c(), u;
|
|
1037
1000
|
},
|
|
1038
1001
|
[t, void 0]
|
|
@@ -1055,22 +1018,29 @@ function _t(t, e) {
|
|
|
1055
1018
|
);
|
|
1056
1019
|
i = !1, qe(() => {
|
|
1057
1020
|
n.current = o;
|
|
1058
|
-
}), (
|
|
1021
|
+
}), (Ct ? "production" : void 0) !== "production" && Nt(o, r);
|
|
1059
1022
|
const a = te(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1060
1023
|
return Se(o, r, a, qt);
|
|
1061
1024
|
}
|
|
1062
|
-
const
|
|
1025
|
+
const R = Oe({
|
|
1063
1026
|
data: null,
|
|
1064
1027
|
isPending: !1,
|
|
1065
1028
|
error: null
|
|
1066
1029
|
});
|
|
1067
|
-
function
|
|
1030
|
+
function Lt({
|
|
1068
1031
|
url: t,
|
|
1069
1032
|
params: e,
|
|
1070
1033
|
callbacks: s
|
|
1071
1034
|
}) {
|
|
1072
|
-
const r = _t(
|
|
1073
|
-
|
|
1035
|
+
const r = _t(R), [n, i] = le(!1);
|
|
1036
|
+
function o() {
|
|
1037
|
+
i(!0);
|
|
1038
|
+
}
|
|
1039
|
+
function a() {
|
|
1040
|
+
i(!1);
|
|
1041
|
+
}
|
|
1042
|
+
const c = () => {
|
|
1043
|
+
R.isPending = !0, R.error = null, fetch(t, {
|
|
1074
1044
|
method: "POST",
|
|
1075
1045
|
headers: {
|
|
1076
1046
|
"Content-Type": "application/json"
|
|
@@ -1078,23 +1048,25 @@ function Dt({
|
|
|
1078
1048
|
body: JSON.stringify({
|
|
1079
1049
|
amount: e?.amount
|
|
1080
1050
|
})
|
|
1081
|
-
}).then((
|
|
1082
|
-
|
|
1083
|
-
}).catch((
|
|
1084
|
-
|
|
1051
|
+
}).then((u) => u.json()).then((u) => {
|
|
1052
|
+
R.data = u, s?.onSuccess?.(), R.isPending = !1;
|
|
1053
|
+
}).catch((u) => {
|
|
1054
|
+
R.error = u?.toString(), s?.onError?.(), R.isPending = !1;
|
|
1085
1055
|
});
|
|
1086
1056
|
};
|
|
1087
|
-
return F(
|
|
1057
|
+
return F(c, []), {
|
|
1088
1058
|
...r,
|
|
1089
|
-
|
|
1059
|
+
isOpen: n,
|
|
1060
|
+
open: o,
|
|
1061
|
+
close: a,
|
|
1062
|
+
refetch: c
|
|
1090
1063
|
};
|
|
1091
1064
|
}
|
|
1092
1065
|
export {
|
|
1093
|
-
|
|
1066
|
+
h as Chainrails,
|
|
1094
1067
|
xt as PaymentModal,
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
Lt as usePaymentModal
|
|
1068
|
+
nt as chains,
|
|
1069
|
+
Mt as crapi,
|
|
1070
|
+
ot as tokens,
|
|
1071
|
+
Lt as useGetSessionToken
|
|
1100
1072
|
};
|