@chainrails/react 0.1.26 → 0.1.27
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 +1 -0
- package/dist/PaymentModal/index.d.ts.map +1 -1
- package/dist/chainrails-sdk.es.js +440 -432
- package/dist/chainrails-sdk.es.mjs +440 -432
- package/dist/chainrails-sdk.umd.js +3 -3
- package/dist/hooks/usePaymentSession.d.ts +3 -1
- package/dist/hooks/usePaymentSession.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useState as z, useRef as oe, useEffect as
|
|
2
|
-
import { jsxs as
|
|
1
|
+
import { useState as z, useRef as oe, useEffect as O, useMemo as be, useSyncExternalStore as At, useCallback as vt, useLayoutEffect as It, useDebugValue as Pt } from "react";
|
|
2
|
+
import { jsxs as Ee, jsx as _ } from "react/jsx-runtime";
|
|
3
3
|
import './index.css';class Z extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
@@ -9,7 +9,7 @@ import './index.css';class Z extends Error {
|
|
|
9
9
|
super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response = t, this.request = s, this.options = n;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class Be extends Error {
|
|
13
13
|
name = "NonError";
|
|
14
14
|
value;
|
|
15
15
|
constructor(t) {
|
|
@@ -27,11 +27,11 @@ class W extends Error {
|
|
|
27
27
|
code;
|
|
28
28
|
customRequest;
|
|
29
29
|
constructor(t) {
|
|
30
|
-
const s = t?.cause ? t.cause instanceof Error ? t.cause : new
|
|
30
|
+
const s = t?.cause ? t.cause instanceof Error ? t.cause : new Be(t.cause) : void 0;
|
|
31
31
|
super(t?.code ? `Forced retry: ${t.code}` : "Forced retry", s ? { cause: s } : void 0), this.customDelay = t?.delay, this.code = t?.code, this.customRequest = t?.request;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const Se = (() => {
|
|
35
35
|
let e = !1, t = !1;
|
|
36
36
|
const s = typeof globalThis.ReadableStream == "function", n = typeof globalThis.Request == "function";
|
|
37
37
|
if (s && n)
|
|
@@ -50,7 +50,7 @@ const Ee = (() => {
|
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
52
|
return e && !t;
|
|
53
|
-
})(),
|
|
53
|
+
})(), Ut = typeof globalThis.AbortController == "function", $e = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", kt = typeof globalThis.FormData == "function", Le = ["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 Ee = (() => {
|
|
|
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
|
-
}, V = 2147483647,
|
|
63
|
-
class
|
|
62
|
+
}, V = 2147483647, Dt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, ze = Symbol("stop");
|
|
63
|
+
class je {
|
|
64
64
|
options;
|
|
65
65
|
constructor(t) {
|
|
66
66
|
this.options = t;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const Ot = (e) => new je(e), Nt = {
|
|
70
70
|
json: !0,
|
|
71
71
|
parseJson: !0,
|
|
72
72
|
stringifyJson: !0,
|
|
@@ -80,10 +80,10 @@ const Dt = (e) => new ze(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
|
+
}, _t = {
|
|
87
87
|
method: !0,
|
|
88
88
|
headers: !0,
|
|
89
89
|
body: !0,
|
|
@@ -98,13 +98,13 @@ const Dt = (e) => new ze(e), Ot = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
101
|
+
}, Bt = (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)
|
|
@@ -125,7 +125,7 @@ const Dt = (e) => new ze(e), Ot = {
|
|
|
125
125
|
return 0;
|
|
126
126
|
}
|
|
127
127
|
return 0;
|
|
128
|
-
},
|
|
128
|
+
}, qe = (e, t, s) => {
|
|
129
129
|
let n, r = 0;
|
|
130
130
|
return e.pipeThrough(new TransformStream({
|
|
131
131
|
transform(i, o) {
|
|
@@ -140,7 +140,7 @@ const Dt = (e) => new ze(e), Ot = {
|
|
|
140
140
|
n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(t, r), transferredBytes: r }, n));
|
|
141
141
|
}
|
|
142
142
|
}));
|
|
143
|
-
},
|
|
143
|
+
}, $t = (e, t) => {
|
|
144
144
|
if (!e.body)
|
|
145
145
|
return e;
|
|
146
146
|
if (e.status === 204)
|
|
@@ -150,26 +150,26 @@ const Dt = (e) => new ze(e), Ot = {
|
|
|
150
150
|
headers: e.headers
|
|
151
151
|
});
|
|
152
152
|
const s = Math.max(0, Number(e.headers.get("content-length")) || 0);
|
|
153
|
-
return new Response(
|
|
153
|
+
return new Response(qe(e.body, s, t), {
|
|
154
154
|
status: e.status,
|
|
155
155
|
statusText: e.statusText,
|
|
156
156
|
headers: e.headers
|
|
157
157
|
});
|
|
158
|
-
},
|
|
158
|
+
}, Lt = (e, t, s) => {
|
|
159
159
|
if (!e.body)
|
|
160
160
|
return e;
|
|
161
|
-
const n =
|
|
161
|
+
const n = Bt(s ?? e.body);
|
|
162
162
|
return new Request(e, {
|
|
163
163
|
// @ts-expect-error - Types are outdated.
|
|
164
164
|
duplex: "half",
|
|
165
|
-
body:
|
|
165
|
+
body: qe(e.body, n, t)
|
|
166
166
|
});
|
|
167
|
-
},
|
|
167
|
+
}, P = (e) => e !== null && typeof e == "object", B = (...e) => {
|
|
168
168
|
for (const t of e)
|
|
169
|
-
if ((!
|
|
169
|
+
if ((!P(t) || Array.isArray(t)) && t !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
171
|
return ie({}, ...e);
|
|
172
|
-
},
|
|
172
|
+
}, Fe = (e = {}, t = {}) => {
|
|
173
173
|
const s = new globalThis.Headers(e), n = t instanceof globalThis.Headers, r = new globalThis.Headers(t);
|
|
174
174
|
for (const [i, o] of r.entries())
|
|
175
175
|
n && o === "undefined" || o === void 0 ? s.delete(i) : s.set(i, o);
|
|
@@ -178,12 +178,12 @@ const Dt = (e) => new ze(e), Ot = {
|
|
|
178
178
|
function $(e, t, s) {
|
|
179
179
|
return Object.hasOwn(t, s) && t[s] === void 0 ? [] : ie(e[s] ?? [], t[s] ?? []);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const He = (e = {}, t = {}) => ({
|
|
182
182
|
beforeRequest: $(e, t, "beforeRequest"),
|
|
183
183
|
beforeRetry: $(e, t, "beforeRetry"),
|
|
184
184
|
afterResponse: $(e, t, "afterResponse"),
|
|
185
185
|
beforeError: $(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 Fe = (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 (P(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 Fe = (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 (P(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 && (!P(c) || Array.isArray(c)))
|
|
222
222
|
throw new TypeError("The `context` option must be an object");
|
|
223
223
|
t = {
|
|
224
224
|
...t,
|
|
@@ -227,28 +227,28 @@ const Fe = (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
|
+
P(c) && a in t && (c = ie(t[a], c)), t = { ...t, [a]: c };
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
P(o.hooks) && (n = He(n, o.hooks), t.hooks = n), P(o.headers) && (s = Fe(s, o.headers), t.headers = s);
|
|
236
236
|
}
|
|
237
|
-
return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] :
|
|
238
|
-
},
|
|
237
|
+
return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] : $e ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
|
|
238
|
+
}, jt = (e) => Le.includes(e) ? e.toUpperCase() : e, qt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], Ht = [413, 429, 503], Te = {
|
|
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
|
+
...Te,
|
|
252
252
|
limit: e
|
|
253
253
|
};
|
|
254
254
|
if (e.methods && !Array.isArray(e.methods))
|
|
@@ -256,7 +256,7 @@ const Fe = (e = {}, t = {}) => ({
|
|
|
256
256
|
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
257
257
|
throw new Error("retry.statusCodes must be an array");
|
|
258
258
|
return {
|
|
259
|
-
...
|
|
259
|
+
...Te,
|
|
260
260
|
...e
|
|
261
261
|
};
|
|
262
262
|
};
|
|
@@ -266,7 +266,7 @@ class Q 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 Q(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 _t) && !(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 Z || e?.name === Z.name;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Gt(e) {
|
|
300
300
|
return e instanceof Q || e?.name === Q.name;
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class M {
|
|
303
303
|
static create(t, s) {
|
|
304
|
-
const n = new
|
|
304
|
+
const n = new M(t, s), r = async () => {
|
|
305
305
|
if (typeof n.#e.timeout == "number" && n.#e.timeout > V)
|
|
306
306
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${V}`);
|
|
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 je)
|
|
312
312
|
throw await Promise.all([
|
|
313
313
|
c.body?.cancel(),
|
|
314
314
|
o.body?.cancel()
|
|
@@ -323,16 +323,16 @@ class N {
|
|
|
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
|
-
return
|
|
328
|
+
return $t(o.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
330
330
|
return o;
|
|
331
331
|
}, i = n.#f(r).finally(async () => {
|
|
332
332
|
const o = n.#o, a = [];
|
|
333
333
|
o && !o.bodyUsed && a.push(o.body?.cancel()), n.request.bodyUsed || a.push(n.request.body?.cancel()), await Promise.all(a);
|
|
334
334
|
});
|
|
335
|
-
for (const [o, a] of Object.entries(
|
|
335
|
+
for (const [o, a] of Object.entries(xt))
|
|
336
336
|
o === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[o] = async () => {
|
|
337
337
|
n.request.headers.set("accept", n.request.headers.get("accept") || a);
|
|
338
338
|
const c = await i;
|
|
@@ -363,17 +363,17 @@ class N {
|
|
|
363
363
|
constructor(t, s = {}) {
|
|
364
364
|
if (this.#t = t, this.#e = {
|
|
365
365
|
...s,
|
|
366
|
-
headers:
|
|
367
|
-
hooks:
|
|
366
|
+
headers: Fe(this.#t.headers, s.headers),
|
|
367
|
+
hooks: He({
|
|
368
368
|
beforeRequest: [],
|
|
369
369
|
beforeRetry: [],
|
|
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,16 +385,16 @@ class N {
|
|
|
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 && $e && (this.#r = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal), Se && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
|
|
389
389
|
const n = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
390
|
-
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(M.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
392
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
393
393
|
}
|
|
394
394
|
if (this.#e.onUploadProgress) {
|
|
395
395
|
if (typeof this.#e.onUploadProgress != "function")
|
|
396
396
|
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
397
|
-
if (!
|
|
397
|
+
if (!Se)
|
|
398
398
|
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
399
399
|
this.request = this.#h(this.request, this.#e.body ?? void 0);
|
|
400
400
|
}
|
|
@@ -407,7 +407,7 @@ class N {
|
|
|
407
407
|
async #p(t) {
|
|
408
408
|
if (this.#s++, this.#s > this.#e.retry.limit)
|
|
409
409
|
throw t;
|
|
410
|
-
const s = t instanceof Error ? t : new
|
|
410
|
+
const s = t instanceof Error ? t : new Be(t);
|
|
411
411
|
if (s instanceof W)
|
|
412
412
|
return s.customDelay ?? this.#c();
|
|
413
413
|
if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
|
|
@@ -419,9 +419,9 @@ class N {
|
|
|
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 N {
|
|
|
446
446
|
const n = Math.min(await this.#p(s), V);
|
|
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 W && 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 N {
|
|
|
463
463
|
}
|
|
464
464
|
if (i instanceof globalThis.Response)
|
|
465
465
|
return i;
|
|
466
|
-
if (i ===
|
|
466
|
+
if (i === ze)
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
return this.#f(t);
|
|
@@ -480,8 +480,8 @@ class N {
|
|
|
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) {
|
|
@@ -494,72 +494,72 @@ class N {
|
|
|
494
494
|
this.#i = void 0, this.request = this.#h(t);
|
|
495
495
|
}
|
|
496
496
|
#h(t, s) {
|
|
497
|
-
return !this.#e.onUploadProgress || !t.body ? t :
|
|
497
|
+
return !this.#e.onUploadProgress || !t.body ? t : Lt(t, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const ee = (e) => {
|
|
502
|
-
const t = (s, n) =>
|
|
503
|
-
for (const s of
|
|
504
|
-
t[s] = (n, r) =>
|
|
505
|
-
return t.create = (s) => ee(B(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), ee(B(e, s))), t.stop =
|
|
506
|
-
},
|
|
507
|
-
var
|
|
508
|
-
const
|
|
502
|
+
const t = (s, n) => M.create(s, B(e, n));
|
|
503
|
+
for (const s of Le)
|
|
504
|
+
t[s] = (n, r) => M.create(n, B(e, r, { method: s }));
|
|
505
|
+
return t.create = (s) => ee(B(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), ee(B(e, s))), t.stop = ze, t.retry = Ot, t;
|
|
506
|
+
}, Zt = ee();
|
|
507
|
+
var T = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(T || {});
|
|
508
|
+
const Ke = {
|
|
509
509
|
type: "evm",
|
|
510
510
|
chainId: 42161,
|
|
511
511
|
name: "Arbitrum",
|
|
512
512
|
cctpDomain: 3,
|
|
513
513
|
logoURI: "/images/chains/arbitrum.svg"
|
|
514
|
-
},
|
|
514
|
+
}, We = {
|
|
515
515
|
type: "evm",
|
|
516
516
|
chainId: 421614,
|
|
517
517
|
name: "Arbitrum Sepolia",
|
|
518
518
|
cctpDomain: 3,
|
|
519
519
|
logoURI: "/images/chains/arbitrum.svg"
|
|
520
|
-
},
|
|
520
|
+
}, Ve = {
|
|
521
521
|
type: "evm",
|
|
522
522
|
chainId: 8453,
|
|
523
523
|
name: "Base",
|
|
524
524
|
cctpDomain: 6,
|
|
525
525
|
logoURI: "/images/chains/base.webp"
|
|
526
|
-
},
|
|
526
|
+
}, Ye = {
|
|
527
527
|
type: "evm",
|
|
528
528
|
chainId: 84532,
|
|
529
529
|
name: "Base Sepolia",
|
|
530
530
|
cctpDomain: 6,
|
|
531
531
|
logoURI: "/images/chains/base.webp"
|
|
532
|
-
},
|
|
532
|
+
}, Xe = {
|
|
533
533
|
type: "evm",
|
|
534
534
|
chainId: 56,
|
|
535
535
|
name: "BNB Chain",
|
|
536
536
|
cctpDomain: null,
|
|
537
537
|
logoURI: "/images/chains/bsc.webp"
|
|
538
|
-
},
|
|
538
|
+
}, Je = {
|
|
539
539
|
type: "evm",
|
|
540
540
|
chainId: 1,
|
|
541
541
|
name: "Ethereum",
|
|
542
542
|
cctpDomain: 0,
|
|
543
543
|
logoURI: "/images/chains/ethereum.svg"
|
|
544
|
-
},
|
|
544
|
+
}, Ge = {
|
|
545
545
|
type: "evm",
|
|
546
546
|
chainId: 11155111,
|
|
547
547
|
name: "Ethereum Sepolia",
|
|
548
548
|
cctpDomain: 0,
|
|
549
549
|
logoURI: "/images/chains/ethereum.svg"
|
|
550
|
-
},
|
|
550
|
+
}, Ze = {
|
|
551
551
|
type: "evm",
|
|
552
552
|
chainId: 43114,
|
|
553
553
|
name: "Avalanche",
|
|
554
554
|
cctpDomain: 1,
|
|
555
555
|
logoURI: "/images/chains/avalanche.svg"
|
|
556
|
-
},
|
|
556
|
+
}, Qe = {
|
|
557
557
|
type: "evm",
|
|
558
558
|
chainId: 43113,
|
|
559
559
|
name: "Avalanche Fuji",
|
|
560
560
|
cctpDomain: 1,
|
|
561
561
|
logoURI: "/images/chains/avalanche.svg"
|
|
562
|
-
},
|
|
562
|
+
}, et = {
|
|
563
563
|
type: "starknet",
|
|
564
564
|
chainId: "0x534e5f4d41494e",
|
|
565
565
|
// SN_MAIN
|
|
@@ -570,17 +570,17 @@ const He = {
|
|
|
570
570
|
function ae(e, { strict: t = !0 } = {}) {
|
|
571
571
|
return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Re(e) {
|
|
574
574
|
return ae(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
575
575
|
}
|
|
576
|
-
const
|
|
576
|
+
const tt = "2.43.4";
|
|
577
577
|
let Y = {
|
|
578
578
|
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0,
|
|
579
|
-
version: `viem@${
|
|
579
|
+
version: `viem@${tt}`
|
|
580
580
|
};
|
|
581
|
-
class
|
|
581
|
+
class v extends Error {
|
|
582
582
|
constructor(t, s = {}) {
|
|
583
|
-
const n = s.cause instanceof
|
|
583
|
+
const n = s.cause instanceof v ? s.cause.details : s.cause?.message ? s.cause.message : s.details, r = s.cause instanceof v && s.cause.docsPath || s.docsPath, i = Y.getDocsUrl?.({ ...s, docsPath: r }), o = [
|
|
584
584
|
t || "An error occurred.",
|
|
585
585
|
"",
|
|
586
586
|
...s.metaMessages ? [...s.metaMessages, ""] : [],
|
|
@@ -619,40 +619,40 @@ class I extends Error {
|
|
|
619
619
|
configurable: !0,
|
|
620
620
|
writable: !0,
|
|
621
621
|
value: "BaseError"
|
|
622
|
-
}), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version =
|
|
622
|
+
}), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = tt;
|
|
623
623
|
}
|
|
624
624
|
walk(t) {
|
|
625
|
-
return
|
|
625
|
+
return st(this, t);
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
function
|
|
629
|
-
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ?
|
|
628
|
+
function st(e, t) {
|
|
629
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? st(e.cause, t) : t ? null : e;
|
|
630
630
|
}
|
|
631
|
-
class
|
|
631
|
+
class nt extends v {
|
|
632
632
|
constructor({ size: t, targetSize: s, type: n }) {
|
|
633
633
|
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
function K(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", "");
|
|
643
643
|
if (n.length > s * 2)
|
|
644
|
-
throw new
|
|
644
|
+
throw new nt({
|
|
645
645
|
size: Math.ceil(n.length / 2),
|
|
646
646
|
targetSize: s,
|
|
647
647
|
type: "hex"
|
|
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)
|
|
655
|
-
throw new
|
|
655
|
+
throw new nt({
|
|
656
656
|
size: e.length,
|
|
657
657
|
targetSize: s,
|
|
658
658
|
type: "bytes"
|
|
@@ -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 ce(e, { size: t }) {
|
|
678
|
-
if (
|
|
679
|
-
throw new
|
|
680
|
-
givenSize:
|
|
678
|
+
if (Re(e) > t)
|
|
679
|
+
throw new ss({
|
|
680
|
+
givenSize: Re(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 ? K(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) : ae(e) ? nt(e, t) : rt(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) : ae(e) ? rt(e, t) : ot(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" ? (ce(s, { size: t.size }), K(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 Ae(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)
|
|
@@ -723,122 +723,122 @@ function Re(e) {
|
|
|
723
723
|
if (e >= R.a && e <= R.f)
|
|
724
724
|
return e - (R.a - 10);
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function rt(e, t = {}) {
|
|
727
727
|
let s = e;
|
|
728
728
|
t.size && (ce(s, { size: t.size }), s = K(s, { dir: "right", size: t.size }));
|
|
729
729
|
let n = s.slice(2);
|
|
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 = Ae(n.charCodeAt(a++)), u = Ae(n.charCodeAt(a++));
|
|
734
734
|
if (c === void 0 || u === void 0)
|
|
735
|
-
throw new
|
|
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 =
|
|
742
|
-
return
|
|
740
|
+
function as(e, t) {
|
|
741
|
+
const s = ns(e, t);
|
|
742
|
+
return rt(s);
|
|
743
743
|
}
|
|
744
|
-
function
|
|
745
|
-
const s =
|
|
744
|
+
function ot(e, t = {}) {
|
|
745
|
+
const s = rs.encode(e);
|
|
746
746
|
return typeof t.size == "number" ? (ce(s, { size: t.size }), K(s, { dir: "right", size: t.size })) : s;
|
|
747
747
|
}
|
|
748
|
-
const L = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
749
|
-
function as(e, t = !1) {
|
|
750
|
-
return t ? { h: Number(e & L), l: Number(e >> Ae & L) } : { h: Number(e >> Ae & L) | 0, l: Number(e & L) | 0 };
|
|
751
|
-
}
|
|
748
|
+
const L = /* @__PURE__ */ BigInt(2 ** 32 - 1), ve = /* @__PURE__ */ BigInt(32);
|
|
752
749
|
function cs(e, t = !1) {
|
|
750
|
+
return t ? { h: Number(e & L), l: Number(e >> ve & L) } : { h: Number(e >> ve & L) | 0, l: Number(e & L) | 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
|
-
function
|
|
766
|
+
function Ie(e) {
|
|
767
767
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
768
768
|
throw new Error("positive integer expected, got " + e);
|
|
769
769
|
}
|
|
770
770
|
function j(e, ...t) {
|
|
771
|
-
if (!
|
|
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);
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Pe(e, t = !0) {
|
|
777
777
|
if (e.destroyed)
|
|
778
778
|
throw new Error("Hash instance has been destroyed");
|
|
779
779
|
if (t && e.finished)
|
|
780
780
|
throw new Error("Hash#digest() has already been called");
|
|
781
781
|
}
|
|
782
|
-
function
|
|
782
|
+
function gs(e, t) {
|
|
783
783
|
j(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
|
-
function
|
|
791
|
+
function it(...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
|
|
805
|
-
function
|
|
804
|
+
const Ue = 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
|
-
function
|
|
811
|
-
return typeof e == "string" && (e =
|
|
810
|
+
function at(e) {
|
|
811
|
+
return typeof e == "string" && (e = Es(e)), j(e), e;
|
|
812
812
|
}
|
|
813
|
-
class
|
|
813
|
+
class Ss {
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
const t = (n) => e().update(
|
|
815
|
+
function Ts(e) {
|
|
816
|
+
const t = (n) => e().update(at(n)).digest(), s = e();
|
|
817
817
|
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
818
818
|
}
|
|
819
|
-
const
|
|
820
|
-
for (let e = 0, t =
|
|
821
|
-
[s, n] = [n, (2 * s + 3 * n) % 5],
|
|
822
|
-
let r =
|
|
819
|
+
const Rs = BigInt(0), x = BigInt(1), As = BigInt(2), vs = BigInt(7), Is = BigInt(256), Ps = BigInt(113), ct = [], ut = [], lt = [];
|
|
820
|
+
for (let e = 0, t = x, s = 1, n = 0; e < 24; e++) {
|
|
821
|
+
[s, n] = [n, (2 * s + 3 * n) % 5], ct.push(2 * (5 * n + s)), ut.push((e + 1) * (e + 2) / 2 % 64);
|
|
822
|
+
let r = Rs;
|
|
823
823
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
t = (t <<
|
|
825
|
-
|
|
824
|
+
t = (t << x ^ (t >> vs) * Ps) % Is, t & As && (r ^= x << (x << /* @__PURE__ */ BigInt(i)) - x);
|
|
825
|
+
lt.push(r);
|
|
826
826
|
}
|
|
827
|
-
const
|
|
828
|
-
function
|
|
827
|
+
const ft = us(lt, !0), Us = ft[0], Cs = ft[1], Ce = (e, t, s) => s > 32 ? hs(e, t, s) : ls(e, t, s), ke = (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],
|
|
834
|
+
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Ce(u, l, 1) ^ s[a], m = ke(u, l, 1) ^ s[a + 1];
|
|
835
835
|
for (let y = 0; y < 50; y += 10)
|
|
836
|
-
e[o + y] ^=
|
|
836
|
+
e[o + y] ^= w, e[o + y + 1] ^= m;
|
|
837
837
|
}
|
|
838
838
|
let r = e[2], i = e[3];
|
|
839
839
|
for (let o = 0; o < 24; o++) {
|
|
840
|
-
const a =
|
|
841
|
-
r = e[
|
|
840
|
+
const a = ut[o], c = Ce(r, i, a), u = ke(r, i, a), l = ct[o];
|
|
841
|
+
r = e[l], i = e[l + 1], e[l] = c, e[l + 1] = u;
|
|
842
842
|
}
|
|
843
843
|
for (let o = 0; o < 50; o += 10) {
|
|
844
844
|
for (let a = 0; a < 10; a++)
|
|
@@ -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
|
+
it(s);
|
|
852
852
|
}
|
|
853
|
-
class ue extends
|
|
853
|
+
class ue 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
|
-
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,
|
|
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, Ie(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
|
-
|
|
864
|
+
Ue(this.state32), ks(this.state32, this.rounds), Ue(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
865
|
}
|
|
866
866
|
update(t) {
|
|
867
|
-
|
|
867
|
+
Pe(this), t = at(t), j(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 ue 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
|
-
|
|
885
|
+
Pe(this, !1), j(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();
|
|
@@ -897,10 +897,10 @@ class ue extends Es {
|
|
|
897
897
|
return this.writeInto(t);
|
|
898
898
|
}
|
|
899
899
|
xof(t) {
|
|
900
|
-
return
|
|
900
|
+
return Ie(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
|
}
|
|
@@ -908,18 +908,18 @@ class ue extends Es {
|
|
|
908
908
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
909
909
|
}
|
|
910
910
|
destroy() {
|
|
911
|
-
this.destroyed = !0,
|
|
911
|
+
this.destroyed = !0, it(this.state);
|
|
912
912
|
}
|
|
913
913
|
_cloneInto(t) {
|
|
914
914
|
const { blockLen: s, suffix: n, outputLen: r, rounds: i, enableXOF: o } = this;
|
|
915
915
|
return t || (t = new ue(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
|
|
919
|
-
function
|
|
920
|
-
return
|
|
918
|
+
const xs = (e, t, s) => Ts(() => new ue(t, e, s)), Ds = xs(1, 136, 256 / 8);
|
|
919
|
+
function Os(e, t) {
|
|
920
|
+
return Ds(ae(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: [
|
|
@@ -930,7 +930,7 @@ class Os extends I {
|
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
class
|
|
933
|
+
class ht extends Map {
|
|
934
934
|
constructor(t) {
|
|
935
935
|
super(), Object.defineProperty(this, "maxSize", {
|
|
936
936
|
enumerable: !0,
|
|
@@ -951,218 +951,218 @@ class ft extends Map {
|
|
|
951
951
|
return this;
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
|
-
const X = /* @__PURE__ */ new
|
|
955
|
-
function
|
|
954
|
+
const X = /* @__PURE__ */ new ht(8192);
|
|
955
|
+
function dt(e, t) {
|
|
956
956
|
if (X.has(`${e}.${t}`))
|
|
957
957
|
return X.get(`${e}.${t}`);
|
|
958
|
-
const s = e.substring(2).toLowerCase(), n =
|
|
958
|
+
const s = e.substring(2).toLowerCase(), n = Os(ot(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 X.set(`${e}.${t}`, i), i;
|
|
963
963
|
}
|
|
964
964
|
function A(e, t) {
|
|
965
|
-
if (!
|
|
966
|
-
throw new
|
|
967
|
-
return
|
|
965
|
+
if (!_s(e, { strict: !1 }))
|
|
966
|
+
throw new Ns({ address: e });
|
|
967
|
+
return dt(e, t);
|
|
968
968
|
}
|
|
969
|
-
const
|
|
970
|
-
function
|
|
969
|
+
const Ms = /^0x[a-fA-F0-9]{40}$/, J = /* @__PURE__ */ new ht(8192);
|
|
970
|
+
function _s(e, t) {
|
|
971
971
|
const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
|
|
972
972
|
if (J.has(n))
|
|
973
973
|
return J.get(n);
|
|
974
|
-
const r =
|
|
974
|
+
const r = Ms.test(e) ? e.toLowerCase() === e ? !0 : s ? dt(e) === e : !0 : !1;
|
|
975
975
|
return J.set(n, r), r;
|
|
976
976
|
}
|
|
977
|
-
const
|
|
978
|
-
chainId:
|
|
977
|
+
const Bs = {
|
|
978
|
+
chainId: We.chainId,
|
|
979
979
|
address: A("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
980
980
|
symbol: "USDC",
|
|
981
981
|
fiatISO: "USD",
|
|
982
982
|
decimals: 6,
|
|
983
983
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
984
984
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
985
|
-
},
|
|
986
|
-
chainId:
|
|
985
|
+
}, $s = {
|
|
986
|
+
chainId: Ke.chainId,
|
|
987
987
|
address: A("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
988
988
|
symbol: "USDC",
|
|
989
989
|
name: "USD Coin",
|
|
990
990
|
decimals: 6,
|
|
991
991
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
992
992
|
/* USDC */
|
|
993
|
-
},
|
|
994
|
-
chainId:
|
|
993
|
+
}, Ls = {
|
|
994
|
+
chainId: Qe.chainId,
|
|
995
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
|
-
},
|
|
1002
|
-
chainId:
|
|
1001
|
+
}, zs = {
|
|
1002
|
+
chainId: Ze.chainId,
|
|
1003
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
|
-
},
|
|
1010
|
-
chainId:
|
|
1009
|
+
}, js = {
|
|
1010
|
+
chainId: Ye.chainId,
|
|
1011
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
|
-
},
|
|
1018
|
-
chainId:
|
|
1017
|
+
}, qs = {
|
|
1018
|
+
chainId: Ve.chainId,
|
|
1019
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
|
-
},
|
|
1026
|
-
chainId:
|
|
1025
|
+
}, Fs = {
|
|
1026
|
+
chainId: Xe.chainId,
|
|
1027
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
|
-
},
|
|
1033
|
-
chainId:
|
|
1032
|
+
}, Hs = {
|
|
1033
|
+
chainId: Ge.chainId,
|
|
1034
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
|
-
},
|
|
1040
|
-
chainId:
|
|
1039
|
+
}, Ks = {
|
|
1040
|
+
chainId: Je.chainId,
|
|
1041
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
|
-
},
|
|
1047
|
-
chainId:
|
|
1046
|
+
}, Ws = {
|
|
1047
|
+
chainId: et.chainId,
|
|
1048
1048
|
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
1049
1049
|
symbol: "USDC",
|
|
1050
1050
|
decimals: 6,
|
|
1051
1051
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1052
1052
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1053
|
-
},
|
|
1053
|
+
}, xe = {
|
|
1054
1054
|
ARBITRUM_MAINNET: {
|
|
1055
|
-
...
|
|
1055
|
+
...Ke,
|
|
1056
1056
|
tokens: {
|
|
1057
|
-
[
|
|
1057
|
+
[T.USDC]: $s
|
|
1058
1058
|
},
|
|
1059
1059
|
explorer: "https://arbiscan.io"
|
|
1060
1060
|
},
|
|
1061
1061
|
ARBITRUM_TESTNET: {
|
|
1062
|
-
...
|
|
1062
|
+
...We,
|
|
1063
1063
|
explorer: "https://sepolia.arbiscan.io",
|
|
1064
1064
|
tokens: {
|
|
1065
|
-
[
|
|
1065
|
+
[T.USDC]: Bs
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
1068
|
AVALANCHE_MAINNET: {
|
|
1069
|
-
...
|
|
1069
|
+
...Ze,
|
|
1070
1070
|
tokens: {
|
|
1071
|
-
[
|
|
1071
|
+
[T.USDC]: zs
|
|
1072
1072
|
},
|
|
1073
1073
|
explorer: "https://snowtrace.io"
|
|
1074
1074
|
},
|
|
1075
1075
|
AVALANCHE_TESTNET: {
|
|
1076
|
-
...
|
|
1076
|
+
...Qe,
|
|
1077
1077
|
tokens: {
|
|
1078
|
-
[
|
|
1078
|
+
[T.USDC]: Ls
|
|
1079
1079
|
},
|
|
1080
1080
|
explorer: "https://testnet.snowtrace.io"
|
|
1081
1081
|
},
|
|
1082
1082
|
BASE_MAINNET: {
|
|
1083
|
-
...
|
|
1083
|
+
...Ve,
|
|
1084
1084
|
tokens: {
|
|
1085
|
-
[
|
|
1085
|
+
[T.USDC]: qs
|
|
1086
1086
|
},
|
|
1087
1087
|
explorer: "https://basescan.org"
|
|
1088
1088
|
},
|
|
1089
1089
|
BASE_TESTNET: {
|
|
1090
|
-
...
|
|
1090
|
+
...Ye,
|
|
1091
1091
|
tokens: {
|
|
1092
|
-
[
|
|
1092
|
+
[T.USDC]: js
|
|
1093
1093
|
},
|
|
1094
1094
|
explorer: "https://sepolia.basescan.org"
|
|
1095
1095
|
},
|
|
1096
1096
|
BSC_MAINNET: {
|
|
1097
|
-
...
|
|
1097
|
+
...Xe,
|
|
1098
1098
|
tokens: {
|
|
1099
|
-
[
|
|
1099
|
+
[T.USDC]: Fs
|
|
1100
1100
|
},
|
|
1101
1101
|
explorer: "https://bscscan.com"
|
|
1102
1102
|
},
|
|
1103
1103
|
ETHEREUM_MAINNET: {
|
|
1104
|
-
...
|
|
1104
|
+
...Je,
|
|
1105
1105
|
tokens: {
|
|
1106
|
-
[
|
|
1106
|
+
[T.USDC]: Ks
|
|
1107
1107
|
},
|
|
1108
1108
|
explorer: "https://etherscan.io"
|
|
1109
1109
|
},
|
|
1110
1110
|
ETHEREUM_TESTNET: {
|
|
1111
|
-
...
|
|
1111
|
+
...Ge,
|
|
1112
1112
|
tokens: {
|
|
1113
|
-
[
|
|
1113
|
+
[T.USDC]: Hs
|
|
1114
1114
|
},
|
|
1115
1115
|
explorer: "https://sepolia.etherscan.io"
|
|
1116
1116
|
},
|
|
1117
1117
|
STARKNET_MAINNET: {
|
|
1118
|
-
...
|
|
1118
|
+
...et,
|
|
1119
1119
|
tokens: {
|
|
1120
|
-
[
|
|
1120
|
+
[T.USDC]: Ws
|
|
1121
1121
|
},
|
|
1122
1122
|
explorer: ""
|
|
1123
1123
|
}
|
|
1124
1124
|
};
|
|
1125
|
-
var te = /* @__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))(te || {}),
|
|
1126
|
-
const
|
|
1125
|
+
var te = /* @__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))(te || {}), pt = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(pt || {});
|
|
1126
|
+
const Vs = (e) => {
|
|
1127
1127
|
const t = e?.trim().toUpperCase();
|
|
1128
|
-
if (
|
|
1129
|
-
return
|
|
1128
|
+
if (xe[t])
|
|
1129
|
+
return xe[t];
|
|
1130
1130
|
};
|
|
1131
|
-
function
|
|
1132
|
-
return
|
|
1131
|
+
function Ys(e, t) {
|
|
1132
|
+
return Vs(e)?.tokens[t]?.address;
|
|
1133
1133
|
}
|
|
1134
1134
|
var le = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(le || {});
|
|
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 ?? le.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 se = null;
|
|
1184
|
-
function
|
|
1185
|
-
se =
|
|
1186
|
-
prefixUrl:
|
|
1184
|
+
function Xs() {
|
|
1185
|
+
se = 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
|
],
|
|
@@ -1202,9 +1202,9 @@ function Ys() {
|
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
1204
|
function g() {
|
|
1205
|
-
return se ||
|
|
1205
|
+
return se || Xs(), se;
|
|
1206
1206
|
}
|
|
1207
|
-
class
|
|
1207
|
+
class Js {
|
|
1208
1208
|
async getById(t) {
|
|
1209
1209
|
return await g().get("intents/" + t).json();
|
|
1210
1210
|
}
|
|
@@ -1236,7 +1236,7 @@ class Xs {
|
|
|
1236
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
1241
|
return await g().get("quotes/single", { searchParams: t }).json();
|
|
1242
1242
|
}
|
|
@@ -1253,7 +1253,7 @@ class Js {
|
|
|
1253
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
1258
|
return await g().get("router/optimal-route", { searchParams: t }).json();
|
|
1259
1259
|
}
|
|
@@ -1267,23 +1267,23 @@ class Gs {
|
|
|
1267
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
1272
|
return await g().get("chains", { searchParams: t }).json();
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
|
-
class
|
|
1275
|
+
class en {
|
|
1276
1276
|
async getClientInfo() {
|
|
1277
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
|
te[t.destinationChain],
|
|
1286
|
-
|
|
1286
|
+
pt[t.token]
|
|
1287
1287
|
),
|
|
1288
1288
|
destinationChain: te[t.destinationChain],
|
|
1289
1289
|
amount: t.amount
|
|
@@ -1291,78 +1291,84 @@ class en {
|
|
|
1291
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 Pn = {
|
|
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
|
-
function
|
|
1302
|
+
function gt(e) {
|
|
1303
1303
|
var t, s, n = "";
|
|
1304
1304
|
if (typeof e == "string" || typeof e == "number") n += e;
|
|
1305
1305
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
1306
1306
|
var r = e.length;
|
|
1307
|
-
for (t = 0; t < r; t++) e[t] && (s =
|
|
1307
|
+
for (t = 0; t < r; t++) e[t] && (s = gt(e[t])) && (n && (n += " "), n += s);
|
|
1308
1308
|
} else for (s in e) e[s] && (n && (n += " "), n += s);
|
|
1309
1309
|
return n;
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1312
|
-
for (var e, t, s = 0, n = "", r = arguments.length; s < r; s++) (e = arguments[s]) && (t =
|
|
1311
|
+
function sn() {
|
|
1312
|
+
for (var e, t, s = 0, n = "", r = arguments.length; s < r; s++) (e = arguments[s]) && (t = gt(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,
|
|
1319
1319
|
destinationChain: n,
|
|
1320
1320
|
amount: r,
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1321
|
+
ctaColor: i,
|
|
1322
|
+
isOpen: o,
|
|
1323
|
+
isPending: a,
|
|
1324
|
+
open: c,
|
|
1325
|
+
close: u,
|
|
1326
|
+
onCancel: l,
|
|
1327
|
+
onSuccess: w,
|
|
1328
|
+
session_url: m,
|
|
1329
|
+
data: y
|
|
1330
|
+
} = e, [S, C] = z(!0), [f, h] = z(""), p = oe(null);
|
|
1331
|
+
O(() => {
|
|
1332
|
+
const E = document.body.style.overflow;
|
|
1333
|
+
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = E || "";
|
|
1334
|
+
const k = (we) => {
|
|
1335
|
+
we.data === "closed" && (u(), l?.()), we.data === "completed" && (window.setTimeout(u, 2e3), w?.());
|
|
1335
1336
|
};
|
|
1336
|
-
return window.addEventListener("message",
|
|
1337
|
-
document.body.style.overflow =
|
|
1337
|
+
return window.addEventListener("message", k), () => {
|
|
1338
|
+
document.body.style.overflow = E || "", window.removeEventListener("message", k);
|
|
1338
1339
|
};
|
|
1339
|
-
}, [
|
|
1340
|
-
|
|
1341
|
-
api_key:
|
|
1342
|
-
env:
|
|
1343
|
-
}).then((
|
|
1344
|
-
window.chainrails =
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1340
|
+
}, [o, l, w]), O(() => {
|
|
1341
|
+
d.config({
|
|
1342
|
+
api_key: y?.sessionToken || "",
|
|
1343
|
+
env: m === "https://chainrails-sdk-server.vercel.app/test/create-session" ? "internal" : "production"
|
|
1344
|
+
}).then((E) => {
|
|
1345
|
+
window.chainrails = E;
|
|
1346
|
+
const k = n.includes("_") ? n : n + "_MAINNET";
|
|
1347
|
+
h(d.getPayModalUrl(k, s, t, r));
|
|
1347
1348
|
});
|
|
1348
|
-
}, [
|
|
1349
|
-
if (!
|
|
1350
|
-
const
|
|
1349
|
+
}, [o, n, s, r, t]), O(() => {
|
|
1350
|
+
if (!y?.sessionToken) return;
|
|
1351
|
+
const E = {
|
|
1351
1352
|
type: "session",
|
|
1352
|
-
session_token:
|
|
1353
|
-
environment:
|
|
1353
|
+
session_token: y.sessionToken,
|
|
1354
|
+
environment: d.getEnv() || le.PRODUCTION,
|
|
1355
|
+
...i && {
|
|
1356
|
+
styles: {
|
|
1357
|
+
ctaColor: i
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1354
1360
|
};
|
|
1355
|
-
|
|
1356
|
-
}, [
|
|
1357
|
-
function
|
|
1358
|
-
|
|
1359
|
-
}
|
|
1360
|
-
return /* @__PURE__ */
|
|
1361
|
-
className:
|
|
1362
|
-
children: [(
|
|
1361
|
+
p.current?.contentWindow?.postMessage(E, "https://app.chainrails.io"), p.current?.contentWindow?.postMessage(E, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1362
|
+
}, [y?.sessionToken, S, o, n, s, r, t, i]);
|
|
1363
|
+
function b() {
|
|
1364
|
+
C(!1);
|
|
1365
|
+
}
|
|
1366
|
+
return /* @__PURE__ */ Ee("div", {
|
|
1367
|
+
className: sn("payment-modal-wrapper", S || a ? "loading" : "not-loading", o ? "open" : "closed"),
|
|
1368
|
+
children: [(S || a) && /* @__PURE__ */ _("div", {
|
|
1363
1369
|
role: "status",
|
|
1364
1370
|
className: "payment-modal-loader",
|
|
1365
|
-
children: /* @__PURE__ */
|
|
1371
|
+
children: /* @__PURE__ */ Ee("svg", {
|
|
1366
1372
|
"aria-hidden": "true",
|
|
1367
1373
|
className: "icon",
|
|
1368
1374
|
viewBox: "0 0 100 101",
|
|
@@ -1378,20 +1384,17 @@ function Pn(e) {
|
|
|
1378
1384
|
})
|
|
1379
1385
|
}), /* @__PURE__ */ _("iframe", {
|
|
1380
1386
|
allow: "clipboard-read *; clipboard-write *",
|
|
1381
|
-
src:
|
|
1382
|
-
onLoad:
|
|
1383
|
-
className: `payment-modal ${
|
|
1387
|
+
src: f,
|
|
1388
|
+
onLoad: b,
|
|
1389
|
+
className: `payment-modal ${S || a ? "invisible" : "visible"}`,
|
|
1384
1390
|
"data-id": r,
|
|
1385
|
-
ref:
|
|
1391
|
+
ref: p
|
|
1386
1392
|
})]
|
|
1387
1393
|
});
|
|
1388
1394
|
}
|
|
1389
|
-
|
|
1390
|
-
return typeof e == "number" && Number.isInteger(e) ? BigInt(e).toString() : String(e);
|
|
1391
|
-
}
|
|
1392
|
-
const nn = Symbol(), fe = Symbol(), x = "a", gt = "f", xe = "p", mt = "c", yt = "t", he = "h", O = "w", de = "o", pe = "k";
|
|
1395
|
+
const nn = Symbol(), fe = Symbol(), D = "a", mt = "f", De = "p", yt = "c", wt = "t", he = "h", N = "w", de = "o", pe = "k";
|
|
1393
1396
|
let rn = (e, t) => new Proxy(e, t);
|
|
1394
|
-
const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(),
|
|
1397
|
+
const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), bt = (e) => e && (re.has(e) ? re.get(e) : ne(e) === Object.prototype || ne(e) === Array.prototype), q = (e) => typeof e == "object" && e !== null, on = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), an = (e) => {
|
|
1395
1398
|
if (Array.isArray(e))
|
|
1396
1399
|
return Array.from(e);
|
|
1397
1400
|
const t = Object.getOwnPropertyDescriptors(e);
|
|
@@ -1400,24 +1403,24 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1400
1403
|
}), Object.create(ne(e), t);
|
|
1401
1404
|
}, cn = (e, t) => {
|
|
1402
1405
|
const s = {
|
|
1403
|
-
[
|
|
1406
|
+
[mt]: t
|
|
1404
1407
|
};
|
|
1405
1408
|
let n = !1;
|
|
1406
1409
|
const r = (a, c) => {
|
|
1407
1410
|
if (!n) {
|
|
1408
|
-
let u = s[
|
|
1409
|
-
if (u || (u = {}, s[
|
|
1410
|
-
u[
|
|
1411
|
+
let u = s[D].get(e);
|
|
1412
|
+
if (u || (u = {}, s[D].set(e, u)), a === N)
|
|
1413
|
+
u[N] = !0;
|
|
1411
1414
|
else {
|
|
1412
|
-
let
|
|
1413
|
-
|
|
1415
|
+
let l = u[a];
|
|
1416
|
+
l || (l = /* @__PURE__ */ new Set(), u[a] = l), l.add(c);
|
|
1414
1417
|
}
|
|
1415
1418
|
}
|
|
1416
1419
|
}, i = () => {
|
|
1417
|
-
n = !0, s[
|
|
1420
|
+
n = !0, s[D].delete(e);
|
|
1418
1421
|
}, o = {
|
|
1419
1422
|
get(a, c) {
|
|
1420
|
-
return c === fe ? e : (r(pe, c),
|
|
1423
|
+
return c === fe ? e : (r(pe, c), Et(Reflect.get(a, c), s[D], s[yt], s[wt]));
|
|
1421
1424
|
},
|
|
1422
1425
|
has(a, c) {
|
|
1423
1426
|
return c === nn ? (i(), !0) : (r(he, c), Reflect.has(a, c));
|
|
@@ -1426,7 +1429,7 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1426
1429
|
return r(de, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
1427
1430
|
},
|
|
1428
1431
|
ownKeys(a) {
|
|
1429
|
-
return r(
|
|
1432
|
+
return r(N), Reflect.ownKeys(a);
|
|
1430
1433
|
}
|
|
1431
1434
|
};
|
|
1432
1435
|
return t && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
@@ -1434,8 +1437,8 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1434
1437
|
// unwrap proxy
|
|
1435
1438
|
e[fe] || // otherwise
|
|
1436
1439
|
e
|
|
1437
|
-
),
|
|
1438
|
-
if (!
|
|
1440
|
+
), Et = (e, t, s, n) => {
|
|
1441
|
+
if (!bt(e))
|
|
1439
1442
|
return e;
|
|
1440
1443
|
let r = n && n.get(e);
|
|
1441
1444
|
if (!r) {
|
|
@@ -1444,11 +1447,11 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1444
1447
|
}
|
|
1445
1448
|
const [i, o] = r;
|
|
1446
1449
|
let a = s && s.get(i);
|
|
1447
|
-
return (!a || a[1][
|
|
1450
|
+
return (!a || a[1][mt] !== !!o) && (a = cn(i, !!o), a[1][De] = rn(o || i, a[0]), s && s.set(i, a)), a[1][D] = t, a[1][yt] = s, a[1][wt] = n, a[1][De];
|
|
1448
1451
|
}, un = (e, t) => {
|
|
1449
1452
|
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1450
1453
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
1451
|
-
},
|
|
1454
|
+
}, St = (e, t, s, n, r = Object.is) => {
|
|
1452
1455
|
if (r(e, t))
|
|
1453
1456
|
return !1;
|
|
1454
1457
|
if (!q(e) || !q(t))
|
|
@@ -1465,7 +1468,7 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1465
1468
|
for (const a of i[he] || [])
|
|
1466
1469
|
if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
|
|
1467
1470
|
return o;
|
|
1468
|
-
if (i[
|
|
1471
|
+
if (i[N] === !0) {
|
|
1469
1472
|
if (o = un(e, t), o)
|
|
1470
1473
|
return o;
|
|
1471
1474
|
} else
|
|
@@ -1475,44 +1478,44 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1475
1478
|
return o;
|
|
1476
1479
|
}
|
|
1477
1480
|
for (const a of i[pe] || [])
|
|
1478
|
-
if (o =
|
|
1481
|
+
if (o = St(e[a], t[a], s, n, r), o)
|
|
1479
1482
|
return o;
|
|
1480
1483
|
if (o === null)
|
|
1481
1484
|
throw new Error("invalid used");
|
|
1482
1485
|
return o;
|
|
1483
|
-
}, ln = (e) =>
|
|
1486
|
+
}, ln = (e) => bt(e) && e[fe] || null, Oe = (e, t = !0) => {
|
|
1484
1487
|
re.set(e, t);
|
|
1485
1488
|
}, fn = (e, t, s) => {
|
|
1486
1489
|
const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
1487
|
-
var c, u,
|
|
1490
|
+
var c, u, l;
|
|
1488
1491
|
if (r.has(o))
|
|
1489
1492
|
return;
|
|
1490
1493
|
q(o) && r.add(o);
|
|
1491
|
-
const
|
|
1492
|
-
if (
|
|
1493
|
-
if ((c =
|
|
1494
|
-
const y = `:has(${String(
|
|
1494
|
+
const w = q(o) && t.get(ge(o));
|
|
1495
|
+
if (w) {
|
|
1496
|
+
if ((c = w[he]) === null || c === void 0 || c.forEach((m) => {
|
|
1497
|
+
const y = `:has(${String(m)})`;
|
|
1495
1498
|
n.push(a ? [...a, y] : [y]);
|
|
1496
|
-
}),
|
|
1497
|
-
const
|
|
1498
|
-
n.push(a ? [...a,
|
|
1499
|
+
}), w[N] === !0) {
|
|
1500
|
+
const m = ":ownKeys";
|
|
1501
|
+
n.push(a ? [...a, m] : [m]);
|
|
1499
1502
|
} else
|
|
1500
|
-
(u =
|
|
1501
|
-
const y = `:hasOwn(${String(
|
|
1503
|
+
(u = w[de]) === null || u === void 0 || u.forEach((m) => {
|
|
1504
|
+
const y = `:hasOwn(${String(m)})`;
|
|
1502
1505
|
n.push(a ? [...a, y] : [y]);
|
|
1503
1506
|
});
|
|
1504
|
-
(
|
|
1505
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
1507
|
+
(l = w[pe]) === null || l === void 0 || l.forEach((m) => {
|
|
1508
|
+
"value" in (Object.getOwnPropertyDescriptor(o, m) || {}) && i(o[m], a ? [...a, m] : [m]);
|
|
1506
1509
|
});
|
|
1507
1510
|
} else a && n.push(a);
|
|
1508
1511
|
};
|
|
1509
1512
|
return i(e), n;
|
|
1510
|
-
}, F = {}, me = (e) => typeof e == "object" && e !== null, hn = (e) => me(e) && !ye.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),
|
|
1511
|
-
const s =
|
|
1513
|
+
}, F = {}, me = (e) => typeof e == "object" && e !== null, hn = (e) => me(e) && !ye.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), Tt = (e, t) => {
|
|
1514
|
+
const s = Ne.get(e);
|
|
1512
1515
|
if (s?.[0] === t)
|
|
1513
1516
|
return s[1];
|
|
1514
1517
|
const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1515
|
-
return
|
|
1518
|
+
return Oe(n, !0), Ne.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
|
|
1516
1519
|
if (Object.getOwnPropertyDescriptor(n, r))
|
|
1517
1520
|
return;
|
|
1518
1521
|
const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
|
|
@@ -1526,12 +1529,12 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1526
1529
|
configurable: !0
|
|
1527
1530
|
};
|
|
1528
1531
|
if (ye.has(i))
|
|
1529
|
-
|
|
1530
|
-
else if (
|
|
1531
|
-
const [c, u] =
|
|
1532
|
+
Oe(i, !1);
|
|
1533
|
+
else if (U.has(i)) {
|
|
1534
|
+
const [c, u] = U.get(
|
|
1532
1535
|
i
|
|
1533
1536
|
);
|
|
1534
|
-
a.value =
|
|
1537
|
+
a.value = Tt(c, u());
|
|
1535
1538
|
}
|
|
1536
1539
|
Object.defineProperty(n, r, a);
|
|
1537
1540
|
}), Object.preventExtensions(n);
|
|
@@ -1544,81 +1547,81 @@ const ne = Object.getPrototypeOf, re = /* @__PURE__ */ new WeakMap(), wt = (e) =
|
|
|
1544
1547
|
},
|
|
1545
1548
|
set(r, i, o, a) {
|
|
1546
1549
|
const c = !e() && Reflect.has(r, i), u = Reflect.get(r, i, a);
|
|
1547
|
-
if (c && (
|
|
1550
|
+
if (c && (Me(u, o) || H.has(o) && Me(u, H.get(o))))
|
|
1548
1551
|
return !0;
|
|
1549
1552
|
s(i), me(o) && (o = ln(o) || o);
|
|
1550
|
-
const
|
|
1551
|
-
return t(i,
|
|
1553
|
+
const l = !U.has(o) && gn(o) ? Rt(o) : o;
|
|
1554
|
+
return t(i, l), Reflect.set(r, i, l, a), n(["set", [i], o, u]), !0;
|
|
1552
1555
|
}
|
|
1553
|
-
}),
|
|
1554
|
-
let
|
|
1555
|
-
function
|
|
1556
|
+
}), U = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new WeakMap(), G = [1], H = /* @__PURE__ */ new WeakMap();
|
|
1557
|
+
let Me = Object.is, pn = (e, t) => new Proxy(e, t), gn = hn, mn = Tt, yn = dn;
|
|
1558
|
+
function Rt(e = {}) {
|
|
1556
1559
|
if (!me(e))
|
|
1557
1560
|
throw new Error("object required");
|
|
1558
1561
|
const t = H.get(e);
|
|
1559
1562
|
if (t)
|
|
1560
1563
|
return t;
|
|
1561
1564
|
let s = G[0];
|
|
1562
|
-
const n = /* @__PURE__ */ new Set(), r = (
|
|
1563
|
-
s !==
|
|
1565
|
+
const n = /* @__PURE__ */ new Set(), r = (f, h = ++G[0]) => {
|
|
1566
|
+
s !== h && (i = s = h, n.forEach((p) => p(f, h)));
|
|
1564
1567
|
};
|
|
1565
1568
|
let i = s;
|
|
1566
|
-
const o = (
|
|
1567
|
-
const p =
|
|
1569
|
+
const o = (f = G[0]) => (i !== f && (i = f, c.forEach(([h]) => {
|
|
1570
|
+
const p = h[1](f);
|
|
1568
1571
|
p > s && (s = p);
|
|
1569
|
-
})), s), a = (
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1572
|
-
}, c = /* @__PURE__ */ new Map(), u = (
|
|
1573
|
-
const p = !ye.has(
|
|
1572
|
+
})), s), a = (f) => (h, p) => {
|
|
1573
|
+
const b = [...h];
|
|
1574
|
+
b[1] = [f, ...b[1]], r(b, p);
|
|
1575
|
+
}, c = /* @__PURE__ */ new Map(), u = (f, h) => {
|
|
1576
|
+
const p = !ye.has(h) && U.get(h);
|
|
1574
1577
|
if (p) {
|
|
1575
|
-
if ((F ? "production" : void 0) !== "production" && c.has(
|
|
1578
|
+
if ((F ? "production" : void 0) !== "production" && c.has(f))
|
|
1576
1579
|
throw new Error("prop listener already exists");
|
|
1577
1580
|
if (n.size) {
|
|
1578
|
-
const
|
|
1579
|
-
c.set(
|
|
1581
|
+
const b = p[2](a(f));
|
|
1582
|
+
c.set(f, [p, b]);
|
|
1580
1583
|
} else
|
|
1581
|
-
c.set(
|
|
1584
|
+
c.set(f, [p]);
|
|
1582
1585
|
}
|
|
1583
|
-
},
|
|
1584
|
-
var
|
|
1585
|
-
const p = c.get(
|
|
1586
|
-
p && (c.delete(
|
|
1587
|
-
},
|
|
1588
|
-
if ((F ? "production" : void 0) !== "production" &&
|
|
1586
|
+
}, l = (f) => {
|
|
1587
|
+
var h;
|
|
1588
|
+
const p = c.get(f);
|
|
1589
|
+
p && (c.delete(f), (h = p[1]) == null || h.call(p));
|
|
1590
|
+
}, w = (f) => (n.add(f), n.size === 1 && c.forEach(([p, b], E) => {
|
|
1591
|
+
if ((F ? "production" : void 0) !== "production" && b)
|
|
1589
1592
|
throw new Error("remove already exists");
|
|
1590
|
-
const
|
|
1591
|
-
c.set(
|
|
1593
|
+
const k = p[2](a(E));
|
|
1594
|
+
c.set(E, [p, k]);
|
|
1592
1595
|
}), () => {
|
|
1593
|
-
n.delete(
|
|
1594
|
-
|
|
1596
|
+
n.delete(f), n.size === 0 && c.forEach(([p, b], E) => {
|
|
1597
|
+
b && (b(), c.set(E, [p]));
|
|
1595
1598
|
});
|
|
1596
1599
|
});
|
|
1597
|
-
let
|
|
1600
|
+
let m = !0;
|
|
1598
1601
|
const y = yn(
|
|
1599
|
-
() =>
|
|
1602
|
+
() => m,
|
|
1600
1603
|
u,
|
|
1601
|
-
|
|
1604
|
+
l,
|
|
1602
1605
|
r
|
|
1603
1606
|
), S = pn(e, y);
|
|
1604
1607
|
H.set(e, S);
|
|
1605
|
-
const
|
|
1606
|
-
return
|
|
1607
|
-
const
|
|
1608
|
+
const C = [e, o, w];
|
|
1609
|
+
return U.set(S, C), Reflect.ownKeys(e).forEach((f) => {
|
|
1610
|
+
const h = Object.getOwnPropertyDescriptor(
|
|
1608
1611
|
e,
|
|
1609
|
-
|
|
1612
|
+
f
|
|
1610
1613
|
);
|
|
1611
|
-
"value" in
|
|
1612
|
-
}),
|
|
1614
|
+
"value" in h && h.writable && (S[f] = e[f]);
|
|
1615
|
+
}), m = !1, S;
|
|
1613
1616
|
}
|
|
1614
1617
|
function wn(e, t, s) {
|
|
1615
|
-
const n =
|
|
1618
|
+
const n = U.get(e);
|
|
1616
1619
|
(F ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1617
1620
|
let r;
|
|
1618
1621
|
const i = [], o = n[2];
|
|
1619
1622
|
let a = !1;
|
|
1620
|
-
const u = o((
|
|
1621
|
-
i.push(
|
|
1623
|
+
const u = o((l) => {
|
|
1624
|
+
i.push(l), r || (r = Promise.resolve().then(() => {
|
|
1622
1625
|
r = void 0, a && t(i.splice(0));
|
|
1623
1626
|
}));
|
|
1624
1627
|
});
|
|
@@ -1626,26 +1629,26 @@ function wn(e, t, s) {
|
|
|
1626
1629
|
a = !1, u();
|
|
1627
1630
|
};
|
|
1628
1631
|
}
|
|
1629
|
-
function
|
|
1630
|
-
const t =
|
|
1632
|
+
function _e(e) {
|
|
1633
|
+
const t = U.get(e);
|
|
1631
1634
|
(F ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1632
1635
|
const [s, n] = t;
|
|
1633
1636
|
return mn(s, n());
|
|
1634
1637
|
}
|
|
1635
1638
|
const bn = {}, En = (e, t) => {
|
|
1636
1639
|
const s = oe(void 0);
|
|
1637
|
-
|
|
1640
|
+
O(() => {
|
|
1638
1641
|
s.current = fn(e, t);
|
|
1639
|
-
}),
|
|
1642
|
+
}), Pt(s.current);
|
|
1640
1643
|
}, Sn = En, Tn = /* @__PURE__ */ new WeakMap();
|
|
1641
1644
|
function Rn(e, t) {
|
|
1642
|
-
const n =
|
|
1645
|
+
const n = be(
|
|
1643
1646
|
() => e && /* @__PURE__ */ new WeakMap(),
|
|
1644
1647
|
[e]
|
|
1645
1648
|
), r = oe(void 0);
|
|
1646
1649
|
let i = !0;
|
|
1647
|
-
const o =
|
|
1648
|
-
|
|
1650
|
+
const o = At(
|
|
1651
|
+
vt(
|
|
1649
1652
|
(c) => {
|
|
1650
1653
|
const u = wn(e, c);
|
|
1651
1654
|
return c(), u;
|
|
@@ -1653,9 +1656,9 @@ function Rn(e, t) {
|
|
|
1653
1656
|
[e, void 0]
|
|
1654
1657
|
),
|
|
1655
1658
|
() => {
|
|
1656
|
-
const c =
|
|
1659
|
+
const c = _e(e);
|
|
1657
1660
|
try {
|
|
1658
|
-
if (!i && r.current && !
|
|
1661
|
+
if (!i && r.current && !St(
|
|
1659
1662
|
r.current,
|
|
1660
1663
|
c,
|
|
1661
1664
|
n,
|
|
@@ -1666,38 +1669,42 @@ function Rn(e, t) {
|
|
|
1666
1669
|
}
|
|
1667
1670
|
return c;
|
|
1668
1671
|
},
|
|
1669
|
-
() =>
|
|
1672
|
+
() => _e(e)
|
|
1670
1673
|
);
|
|
1671
|
-
i = !1,
|
|
1674
|
+
i = !1, It(() => {
|
|
1672
1675
|
r.current = o;
|
|
1673
1676
|
}), (bn ? "production" : void 0) !== "production" && Sn(o, n);
|
|
1674
|
-
const a =
|
|
1675
|
-
return
|
|
1677
|
+
const a = be(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1678
|
+
return Et(o, n, a, Tn);
|
|
1679
|
+
}
|
|
1680
|
+
function An(e) {
|
|
1681
|
+
return typeof e == "number" && Number.isInteger(e) ? BigInt(e).toString() : String(e);
|
|
1676
1682
|
}
|
|
1677
|
-
const
|
|
1683
|
+
const I = Rt({
|
|
1678
1684
|
data: null,
|
|
1679
1685
|
isPending: !1,
|
|
1680
1686
|
error: null
|
|
1681
1687
|
});
|
|
1682
|
-
function
|
|
1688
|
+
function Cn({
|
|
1683
1689
|
session_url: e,
|
|
1684
1690
|
destinationChain: t,
|
|
1685
1691
|
token: s,
|
|
1686
1692
|
amount: n,
|
|
1687
1693
|
recipient: r,
|
|
1688
|
-
|
|
1689
|
-
|
|
1694
|
+
ctaColor: i,
|
|
1695
|
+
onCancel: o,
|
|
1696
|
+
onSuccess: a
|
|
1690
1697
|
}) {
|
|
1691
|
-
const
|
|
1692
|
-
function d() {
|
|
1693
|
-
u(!0);
|
|
1694
|
-
}
|
|
1698
|
+
const c = Rn(I), [u, l] = z(!1), [w, m] = z(Date.now());
|
|
1695
1699
|
function y() {
|
|
1696
|
-
|
|
1700
|
+
l(!0);
|
|
1701
|
+
}
|
|
1702
|
+
function S() {
|
|
1703
|
+
l(!1);
|
|
1697
1704
|
}
|
|
1698
|
-
const
|
|
1699
|
-
const
|
|
1700
|
-
|
|
1705
|
+
const C = () => {
|
|
1706
|
+
const f = Date.now();
|
|
1707
|
+
I.isPending = !0, I.error = null, fetch(e, {
|
|
1701
1708
|
method: "POST",
|
|
1702
1709
|
headers: {
|
|
1703
1710
|
"Content-Type": "application/json"
|
|
@@ -1705,37 +1712,38 @@ function Un({
|
|
|
1705
1712
|
body: JSON.stringify({
|
|
1706
1713
|
destinationChain: t?.replace("_MAINNET", ""),
|
|
1707
1714
|
token: s,
|
|
1708
|
-
amount: n ?
|
|
1715
|
+
amount: n ? An(n) : "0",
|
|
1709
1716
|
recipient: r
|
|
1710
1717
|
})
|
|
1711
|
-
}).then((
|
|
1712
|
-
|
|
1713
|
-
}).catch((
|
|
1714
|
-
|
|
1718
|
+
}).then((h) => h.json()).then((h) => {
|
|
1719
|
+
f < w || (I.data = h, I.isPending = !1, m(f));
|
|
1720
|
+
}).catch((h) => {
|
|
1721
|
+
f < w || (I.error = h?.toString(), I.isPending = !1, m(f));
|
|
1715
1722
|
});
|
|
1716
1723
|
};
|
|
1717
|
-
return
|
|
1718
|
-
|
|
1724
|
+
return O(() => {
|
|
1725
|
+
C();
|
|
1719
1726
|
}, [t, s, n, r, e]), {
|
|
1720
|
-
...
|
|
1727
|
+
...c,
|
|
1721
1728
|
amount: n,
|
|
1722
1729
|
destinationChain: t,
|
|
1723
1730
|
token: s,
|
|
1724
1731
|
recipient: r,
|
|
1725
|
-
|
|
1732
|
+
ctaColor: i,
|
|
1733
|
+
isOpen: u,
|
|
1726
1734
|
session_url: e,
|
|
1727
|
-
open:
|
|
1728
|
-
close:
|
|
1729
|
-
refetch:
|
|
1730
|
-
onSuccess:
|
|
1731
|
-
onCancel:
|
|
1735
|
+
open: y,
|
|
1736
|
+
close: S,
|
|
1737
|
+
refetch: C,
|
|
1738
|
+
onSuccess: a,
|
|
1739
|
+
onCancel: o
|
|
1732
1740
|
};
|
|
1733
1741
|
}
|
|
1734
1742
|
export {
|
|
1735
|
-
|
|
1736
|
-
|
|
1743
|
+
d as Chainrails,
|
|
1744
|
+
Un as PaymentModal,
|
|
1737
1745
|
te as chains,
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1746
|
+
Pn as crapi,
|
|
1747
|
+
pt as tokens,
|
|
1748
|
+
Cn as usePaymentSession
|
|
1741
1749
|
};
|