@chainrails/react 0.1.11 → 0.1.13
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.map +1 -1
- package/dist/chainrails-sdk.es.js +524 -524
- package/dist/chainrails-sdk.es.mjs +524 -524
- package/dist/chainrails-sdk.umd.js +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import {
|
|
3
|
-
import './index.css';class
|
|
1
|
+
import { useState as L, useRef as re, useEffect as oe, useMemo as be, useSyncExternalStore as At, useCallback as vt, useLayoutEffect as Pt, useDebugValue as It } from "react";
|
|
2
|
+
import { jsx as k, Fragment as Ut, jsxs as Ee } from "react/jsx-runtime";
|
|
3
|
+
import './index.css';class G extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
6
6
|
options;
|
|
@@ -9,7 +9,7 @@ import './index.css';class J 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 _e extends Error {
|
|
13
13
|
name = "NonError";
|
|
14
14
|
value;
|
|
15
15
|
constructor(t) {
|
|
@@ -21,17 +21,17 @@ class Me extends Error {
|
|
|
21
21
|
super(s), this.value = t;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class K extends Error {
|
|
25
25
|
name = "ForceRetryError";
|
|
26
26
|
customDelay;
|
|
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 _e(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 be = (() => {
|
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
52
|
return e && !t;
|
|
53
|
-
})(),
|
|
53
|
+
})(), Ct = typeof globalThis.AbortController == "function", $e = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", kt = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", Le = ["get", "post", "put", "patch", "head", "delete"], Dt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -59,14 +59,14 @@ const be = (() => {
|
|
|
59
59
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
60
60
|
// We still feature-check at runtime before exposing the shortcut.
|
|
61
61
|
bytes: "*/*"
|
|
62
|
-
},
|
|
63
|
-
class
|
|
62
|
+
}, W = 2147483647, Ot = 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 Nt = (e) => new je(e), Mt = {
|
|
70
70
|
json: !0,
|
|
71
71
|
parseJson: !0,
|
|
72
72
|
stringifyJson: !0,
|
|
@@ -80,10 +80,10 @@ const Dt = (e) => new Le(e), Ot = {
|
|
|
80
80
|
onUploadProgress: !0,
|
|
81
81
|
fetch: !0,
|
|
82
82
|
context: !0
|
|
83
|
-
},
|
|
83
|
+
}, Bt = {
|
|
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 Le(e), Ot = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
101
|
+
}, $t = (e) => {
|
|
102
102
|
if (!e)
|
|
103
103
|
return 0;
|
|
104
104
|
if (e instanceof FormData) {
|
|
105
105
|
let t = 0;
|
|
106
106
|
for (const [s, n] of e)
|
|
107
|
-
t +=
|
|
107
|
+
t += Ot, 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 Le(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 Le(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
|
+
}, Lt = (e, t) => {
|
|
144
144
|
if (!e.body)
|
|
145
145
|
return e;
|
|
146
146
|
if (e.status === 204)
|
|
@@ -150,40 +150,40 @@ const Dt = (e) => new Le(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
|
+
}, zt = (e, t, s) => {
|
|
159
159
|
if (!e.body)
|
|
160
160
|
return e;
|
|
161
|
-
const n =
|
|
161
|
+
const n = $t(s ?? e.body);
|
|
162
162
|
return new Request(e, {
|
|
163
163
|
// @ts-expect-error - Types are outdated.
|
|
164
164
|
duplex: "half",
|
|
165
|
-
body:
|
|
165
|
+
body: qe(e.body, n, t)
|
|
166
166
|
});
|
|
167
|
-
}, U = (e) => e !== null && typeof e == "object",
|
|
167
|
+
}, U = (e) => e !== null && typeof e == "object", B = (...e) => {
|
|
168
168
|
for (const t of e)
|
|
169
169
|
if ((!U(t) || Array.isArray(t)) && t !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
|
-
return
|
|
172
|
-
},
|
|
171
|
+
return ie({}, ...e);
|
|
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);
|
|
176
176
|
return s;
|
|
177
177
|
};
|
|
178
|
-
function
|
|
179
|
-
return Object.hasOwn(t, s) && t[s] === void 0 ? [] :
|
|
180
|
-
}
|
|
181
|
-
const
|
|
182
|
-
beforeRequest:
|
|
183
|
-
beforeRetry:
|
|
184
|
-
afterResponse:
|
|
185
|
-
beforeError:
|
|
186
|
-
}),
|
|
178
|
+
function _(e, t, s) {
|
|
179
|
+
return Object.hasOwn(t, s) && t[s] === void 0 ? [] : ie(e[s] ?? [], t[s] ?? []);
|
|
180
|
+
}
|
|
181
|
+
const He = (e = {}, t = {}) => ({
|
|
182
|
+
beforeRequest: _(e, t, "beforeRequest"),
|
|
183
|
+
beforeRetry: _(e, t, "beforeRetry"),
|
|
184
|
+
afterResponse: _(e, t, "afterResponse"),
|
|
185
|
+
beforeError: _(e, t, "beforeError")
|
|
186
|
+
}), jt = (e, t) => {
|
|
187
187
|
const s = new URLSearchParams();
|
|
188
188
|
for (const n of [e, t])
|
|
189
189
|
if (n !== void 0)
|
|
@@ -205,7 +205,7 @@ const qe = (e = {}, t = {}) => ({
|
|
|
205
205
|
s.append(i, o);
|
|
206
206
|
}
|
|
207
207
|
return s;
|
|
208
|
-
},
|
|
208
|
+
}, ie = (...e) => {
|
|
209
209
|
let t = {}, s = {}, n = {}, r;
|
|
210
210
|
const i = [];
|
|
211
211
|
for (const o of e)
|
|
@@ -227,28 +227,28 @@ const qe = (e = {}, t = {}) => ({
|
|
|
227
227
|
continue;
|
|
228
228
|
}
|
|
229
229
|
if (a === "searchParams") {
|
|
230
|
-
c == null ? r = void 0 : r = r === void 0 ? c :
|
|
230
|
+
c == null ? r = void 0 : r = r === void 0 ? c : jt(r, c);
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
U(c) && a in t && (c =
|
|
233
|
+
U(c) && a in t && (c = ie(t[a], c)), t = { ...t, [a]: c };
|
|
234
234
|
}
|
|
235
|
-
U(o.hooks) && (n =
|
|
235
|
+
U(o.hooks) && (n = He(n, o.hooks), t.hooks = n), U(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
|
+
}, qt = (e) => Le.includes(e) ? e.toUpperCase() : e, Ft = ["get", "put", "head", "delete", "options", "trace"], Ht = [408, 413, 429, 500, 502, 503, 504], Kt = [413, 429, 503], Te = {
|
|
239
239
|
limit: 2,
|
|
240
|
-
methods:
|
|
241
|
-
statusCodes:
|
|
242
|
-
afterStatusCodes:
|
|
240
|
+
methods: Ft,
|
|
241
|
+
statusCodes: Ht,
|
|
242
|
+
afterStatusCodes: Kt,
|
|
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
|
+
}, Wt = (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,27 +256,27 @@ const qe = (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
|
};
|
|
263
|
-
class
|
|
263
|
+
class Z extends Error {
|
|
264
264
|
request;
|
|
265
265
|
constructor(t) {
|
|
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 Vt(e, t, s, n) {
|
|
270
270
|
return new Promise((r, i) => {
|
|
271
271
|
const o = setTimeout(() => {
|
|
272
|
-
s && s.abort(), i(new
|
|
272
|
+
s && s.abort(), i(new Z(e));
|
|
273
273
|
}, n.timeout);
|
|
274
274
|
n.fetch(e, t).then(r).catch(i).then(() => {
|
|
275
275
|
clearTimeout(o);
|
|
276
276
|
});
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
async function
|
|
279
|
+
async function Yt(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,35 +287,35 @@ async function Wt(e, { signal: t }) {
|
|
|
287
287
|
}, e);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const Xt = (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 Mt) && (!(n in e) || n in Bt) && (s[n] = t[n]);
|
|
294
294
|
return s;
|
|
295
|
-
},
|
|
296
|
-
function
|
|
297
|
-
return e instanceof J || e?.name === J.name;
|
|
298
|
-
}
|
|
299
|
-
function Jt(e) {
|
|
295
|
+
}, Jt = (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 Gt(e) {
|
|
300
297
|
return e instanceof G || e?.name === G.name;
|
|
301
298
|
}
|
|
302
|
-
|
|
299
|
+
function Zt(e) {
|
|
300
|
+
return e instanceof Z || e?.name === Z.name;
|
|
301
|
+
}
|
|
302
|
+
class N {
|
|
303
303
|
static create(t, s) {
|
|
304
|
-
const n = new
|
|
305
|
-
if (typeof n.#e.timeout == "number" && n.#e.timeout >
|
|
306
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
304
|
+
const n = new N(t, s), r = async () => {
|
|
305
|
+
if (typeof n.#e.timeout == "number" && n.#e.timeout > W)
|
|
306
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${W}`);
|
|
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()
|
|
315
|
-
]), new
|
|
315
|
+
]), new K(u.options);
|
|
316
316
|
}
|
|
317
317
|
if (n.#l(o), !o.ok && (typeof n.#e.throwHttpErrors == "function" ? n.#e.throwHttpErrors(o.status) : n.#e.throwHttpErrors)) {
|
|
318
|
-
let a = new
|
|
318
|
+
let a = new G(o, n.request, n.#a());
|
|
319
319
|
for (const c of n.#e.hooks.beforeError)
|
|
320
320
|
a = await c(a, { retryCount: n.#s });
|
|
321
321
|
throw a;
|
|
@@ -323,16 +323,16 @@ class O {
|
|
|
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 (!kt)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
|
-
return
|
|
328
|
+
return Lt(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(Dt))
|
|
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 O {
|
|
|
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: qt(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: Wt(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 O {
|
|
|
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
|
+
Ct && $e && (this.#r = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal), Se && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
|
|
389
389
|
const n = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
390
|
-
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 && (xt && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !n && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), Jt(this.#e.searchParams)) {
|
|
391
|
+
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(N.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
392
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
393
393
|
}
|
|
394
394
|
if (this.#e.onUploadProgress) {
|
|
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,8 +407,8 @@ class O {
|
|
|
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
|
|
411
|
-
if (s instanceof
|
|
410
|
+
const s = t instanceof Error ? t : new _e(t);
|
|
411
|
+
if (s instanceof K)
|
|
412
412
|
return s.customDelay ?? this.#c();
|
|
413
413
|
if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
|
|
414
414
|
throw t;
|
|
@@ -419,9 +419,9 @@ class O {
|
|
|
419
419
|
if (n === !0)
|
|
420
420
|
return this.#c();
|
|
421
421
|
}
|
|
422
|
-
if (
|
|
422
|
+
if (Zt(t) && !this.#e.retry.retryOnTimeout)
|
|
423
423
|
throw t;
|
|
424
|
-
if (
|
|
424
|
+
if (Gt(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");
|
|
@@ -443,10 +443,10 @@ class O {
|
|
|
443
443
|
try {
|
|
444
444
|
return await t();
|
|
445
445
|
} catch (s) {
|
|
446
|
-
const n = Math.min(await this.#p(s),
|
|
446
|
+
const n = Math.min(await this.#p(s), W);
|
|
447
447
|
if (this.#s < 1)
|
|
448
448
|
throw s;
|
|
449
|
-
if (await
|
|
449
|
+
if (await Yt(n, this.#r ? { signal: this.#r } : {}), s instanceof K && 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 O {
|
|
|
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 O {
|
|
|
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 = Xt(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) : Vt(this.#o, t, this.#n, this.#e);
|
|
485
485
|
}
|
|
486
486
|
#a() {
|
|
487
487
|
if (!this.#i) {
|
|
@@ -494,72 +494,72 @@ class O {
|
|
|
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 : zt(t, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
|
-
const
|
|
502
|
-
const t = (s, n) =>
|
|
503
|
-
for (const s of
|
|
504
|
-
t[s] = (n, r) =>
|
|
505
|
-
return t.create = (s) =>
|
|
506
|
-
},
|
|
507
|
-
var
|
|
508
|
-
const
|
|
501
|
+
const Q = (e) => {
|
|
502
|
+
const t = (s, n) => N.create(s, B(e, n));
|
|
503
|
+
for (const s of Le)
|
|
504
|
+
t[s] = (n, r) => N.create(n, B(e, r, { method: s }));
|
|
505
|
+
return t.create = (s) => Q(B(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), Q(B(e, s))), t.stop = ze, t.retry = Nt, t;
|
|
506
|
+
}, Qt = Q();
|
|
507
|
+
var E = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(E || {});
|
|
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
|
|
@@ -567,26 +567,26 @@ const Fe = {
|
|
|
567
567
|
cctpDomain: null,
|
|
568
568
|
logoURI: "/images/chains/starknet.svg"
|
|
569
569
|
};
|
|
570
|
-
function
|
|
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
|
|
574
|
-
return
|
|
573
|
+
function Re(e) {
|
|
574
|
+
return ae(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
575
575
|
}
|
|
576
|
-
const
|
|
577
|
-
let
|
|
576
|
+
const tt = "2.43.4";
|
|
577
|
+
let V = {
|
|
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 P extends Error {
|
|
582
582
|
constructor(t, s = {}) {
|
|
583
|
-
const n = s.cause instanceof
|
|
583
|
+
const n = s.cause instanceof P ? s.cause.details : s.cause?.message ? s.cause.message : s.details, r = s.cause instanceof P && s.cause.docsPath || s.docsPath, i = V.getDocsUrl?.({ ...s, docsPath: r }), o = [
|
|
584
584
|
t || "An error occurred.",
|
|
585
585
|
"",
|
|
586
586
|
...s.metaMessages ? [...s.metaMessages, ""] : [],
|
|
587
587
|
...i ? [`Docs: ${i}`] : [],
|
|
588
588
|
...n ? [`Details: ${n}`] : [],
|
|
589
|
-
...
|
|
589
|
+
...V.version ? [`Version: ${V.version}`] : []
|
|
590
590
|
].join(`
|
|
591
591
|
`);
|
|
592
592
|
super(o, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -619,40 +619,40 @@ class v 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 P {
|
|
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
|
-
function
|
|
637
|
-
return typeof e == "string" ?
|
|
636
|
+
function H(e, { dir: t, size: s = 32 } = {}) {
|
|
637
|
+
return typeof e == "string" ? es(e, { dir: t, size: s }) : ts(e, { dir: t, size: s });
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function es(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 ts(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 ss extends P {
|
|
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 ns extends P {
|
|
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
|
-
function
|
|
678
|
-
if (
|
|
679
|
-
throw new
|
|
680
|
-
givenSize:
|
|
677
|
+
function ce(e, { size: t }) {
|
|
678
|
+
if (Re(e) > t)
|
|
679
|
+
throw new ns({
|
|
680
|
+
givenSize: Re(e),
|
|
681
681
|
maxSize: t
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function rs(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 ss({
|
|
692
692
|
max: i ? `${i}${c}` : void 0,
|
|
693
693
|
min: `${o}${c}`,
|
|
694
694
|
signed: s,
|
|
@@ -697,17 +697,17 @@ function ss(e, t = {}) {
|
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
699
|
const a = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`;
|
|
700
|
-
return n ?
|
|
700
|
+
return n ? H(a, { size: n }) : a;
|
|
701
701
|
}
|
|
702
|
-
const
|
|
703
|
-
function
|
|
704
|
-
return typeof e == "number" || typeof e == "bigint" ?
|
|
702
|
+
const os = /* @__PURE__ */ new TextEncoder();
|
|
703
|
+
function is(e, t = {}) {
|
|
704
|
+
return typeof e == "number" || typeof e == "bigint" ? cs(e, t) : typeof e == "boolean" ? as(e, t) : ae(e) ? rt(e, t) : ot(e, t);
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function as(e, t = {}) {
|
|
707
707
|
const s = new Uint8Array(1);
|
|
708
|
-
return s[0] = Number(e), typeof t.size == "number" ? (
|
|
708
|
+
return s[0] = Number(e), typeof t.size == "number" ? (ce(s, { size: t.size }), H(s, { size: t.size })) : s;
|
|
709
709
|
}
|
|
710
|
-
const
|
|
710
|
+
const A = {
|
|
711
711
|
zero: 48,
|
|
712
712
|
nine: 57,
|
|
713
713
|
A: 65,
|
|
@@ -715,129 +715,129 @@ const T = {
|
|
|
715
715
|
a: 97,
|
|
716
716
|
f: 102
|
|
717
717
|
};
|
|
718
|
-
function
|
|
719
|
-
if (e >=
|
|
720
|
-
return e -
|
|
721
|
-
if (e >=
|
|
722
|
-
return e - (
|
|
723
|
-
if (e >=
|
|
724
|
-
return e - (
|
|
725
|
-
}
|
|
726
|
-
function
|
|
718
|
+
function Ae(e) {
|
|
719
|
+
if (e >= A.zero && e <= A.nine)
|
|
720
|
+
return e - A.zero;
|
|
721
|
+
if (e >= A.A && e <= A.F)
|
|
722
|
+
return e - (A.A - 10);
|
|
723
|
+
if (e >= A.a && e <= A.f)
|
|
724
|
+
return e - (A.a - 10);
|
|
725
|
+
}
|
|
726
|
+
function rt(e, t = {}) {
|
|
727
727
|
let s = e;
|
|
728
|
-
t.size && (
|
|
728
|
+
t.size && (ce(s, { size: t.size }), s = H(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 P(`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 cs(e, t) {
|
|
741
|
+
const s = rs(e, t);
|
|
742
|
+
return rt(s);
|
|
743
743
|
}
|
|
744
|
-
function
|
|
745
|
-
const s =
|
|
746
|
-
return typeof t.size == "number" ? (
|
|
744
|
+
function ot(e, t = {}) {
|
|
745
|
+
const s = os.encode(e);
|
|
746
|
+
return typeof t.size == "number" ? (ce(s, { size: t.size }), H(s, { dir: "right", size: t.size })) : s;
|
|
747
747
|
}
|
|
748
|
-
const
|
|
749
|
-
function
|
|
750
|
-
return t ? { h: Number(e &
|
|
748
|
+
const $ = /* @__PURE__ */ BigInt(2 ** 32 - 1), ve = /* @__PURE__ */ BigInt(32);
|
|
749
|
+
function us(e, t = !1) {
|
|
750
|
+
return t ? { h: Number(e & $), l: Number(e >> ve & $) } : { h: Number(e >> ve & $) | 0, l: Number(e & $) | 0 };
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function ls(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 } = us(e[i], t);
|
|
757
757
|
[n[i], r[i]] = [o, a];
|
|
758
758
|
}
|
|
759
759
|
return [n, r];
|
|
760
760
|
}
|
|
761
|
-
const
|
|
761
|
+
const fs = (e, t, s) => e << s | t >>> 32 - s, hs = (e, t, s) => t << s | e >>> 32 - s, ds = (e, t, s) => t << s - 32 | e >>> 64 - s, ps = (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 gs(e) {
|
|
764
764
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function Pe(e) {
|
|
767
767
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
768
768
|
throw new Error("positive integer expected, got " + e);
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
if (!
|
|
770
|
+
function z(e, ...t) {
|
|
771
|
+
if (!gs(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 Ie(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
|
|
783
|
-
|
|
782
|
+
function ms(e, t) {
|
|
783
|
+
z(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 ys(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 ws = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
796
|
+
function bs(e) {
|
|
797
797
|
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
798
798
|
}
|
|
799
|
-
function
|
|
799
|
+
function Es(e) {
|
|
800
800
|
for (let t = 0; t < e.length; t++)
|
|
801
|
-
e[t] =
|
|
801
|
+
e[t] = bs(e[t]);
|
|
802
802
|
return e;
|
|
803
803
|
}
|
|
804
|
-
const
|
|
805
|
-
function
|
|
804
|
+
const Ue = ws ? (e) => e : Es;
|
|
805
|
+
function Ss(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 = Ss(e)), z(e), e;
|
|
812
812
|
}
|
|
813
|
-
class
|
|
813
|
+
class Ts {
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
const t = (n) => e().update(
|
|
815
|
+
function Rs(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 As = BigInt(0), x = BigInt(1), vs = BigInt(2), Ps = BigInt(7), Is = BigInt(256), Us = 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 = As;
|
|
823
823
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
t = (t <<
|
|
825
|
-
|
|
824
|
+
t = (t << x ^ (t >> Ps) * Us) % Is, t & vs && (r ^= x << (x << /* @__PURE__ */ BigInt(i)) - x);
|
|
825
|
+
lt.push(r);
|
|
826
826
|
}
|
|
827
|
-
const
|
|
828
|
-
function
|
|
827
|
+
const ft = ls(lt, !0), Cs = ft[0], ks = ft[1], Ce = (e, t, s) => s > 32 ? ds(e, t, s) : fs(e, t, s), ke = (e, t, s) => s > 32 ? ps(e, t, s) : hs(e, t, s);
|
|
828
|
+
function xs(e, t = 24) {
|
|
829
829
|
const s = new Uint32Array(10);
|
|
830
830
|
for (let n = 24 - t; n < 24; n++) {
|
|
831
831
|
for (let o = 0; o < 10; o++)
|
|
832
832
|
s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
|
|
833
833
|
for (let o = 0; o < 10; o += 2) {
|
|
834
|
-
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], f = s[c + 1], w =
|
|
834
|
+
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], f = s[c + 1], w = Ce(u, f, 1) ^ s[a], d = ke(u, f, 1) ^ s[a + 1];
|
|
835
835
|
for (let y = 0; y < 50; y += 10)
|
|
836
|
-
e[o + y] ^= w, e[o + y + 1] ^=
|
|
836
|
+
e[o + y] ^= w, e[o + y + 1] ^= d;
|
|
837
837
|
}
|
|
838
838
|
let r = e[2], i = e[3];
|
|
839
839
|
for (let o = 0; o < 24; o++) {
|
|
840
|
-
const a =
|
|
840
|
+
const a = ut[o], c = Ce(r, i, a), u = ke(r, i, a), f = ct[o];
|
|
841
841
|
r = e[f], i = e[f + 1], e[f] = c, e[f + 1] = u;
|
|
842
842
|
}
|
|
843
843
|
for (let o = 0; o < 50; o += 10) {
|
|
@@ -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] ^= Cs[n], e[1] ^= ks[n];
|
|
850
850
|
}
|
|
851
|
-
|
|
851
|
+
it(s);
|
|
852
852
|
}
|
|
853
|
-
class
|
|
853
|
+
class ue extends Ts {
|
|
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, Pe(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 = ys(this.state);
|
|
859
859
|
}
|
|
860
860
|
clone() {
|
|
861
861
|
return this._cloneInto();
|
|
862
862
|
}
|
|
863
863
|
keccak() {
|
|
864
|
-
|
|
864
|
+
Ue(this.state32), xs(this.state32, this.rounds), Ue(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
865
|
}
|
|
866
866
|
update(t) {
|
|
867
|
-
|
|
867
|
+
Ie(this), t = at(t), z(t);
|
|
868
868
|
const { blockLen: s, state: n } = this, r = t.length;
|
|
869
869
|
for (let i = 0; i < r; ) {
|
|
870
870
|
const o = Math.min(s - this.pos, r - i);
|
|
@@ -882,7 +882,7 @@ class ce extends Es {
|
|
|
882
882
|
t[n] ^= s, (s & 128) !== 0 && n === r - 1 && this.keccak(), t[r - 1] ^= 128, this.keccak();
|
|
883
883
|
}
|
|
884
884
|
writeInto(t) {
|
|
885
|
-
|
|
885
|
+
Ie(this, !1), z(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 ce extends Es {
|
|
|
897
897
|
return this.writeInto(t);
|
|
898
898
|
}
|
|
899
899
|
xof(t) {
|
|
900
|
-
return
|
|
900
|
+
return Pe(t), this.xofInto(new Uint8Array(t));
|
|
901
901
|
}
|
|
902
902
|
digestInto(t) {
|
|
903
|
-
if (
|
|
903
|
+
if (ms(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 ce 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
|
-
return t || (t = new
|
|
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 Ds = (e, t, s) => Rs(() => new ue(t, e, s)), Os = Ds(1, 136, 256 / 8);
|
|
919
|
+
function Ns(e, t) {
|
|
920
|
+
return Os(ae(e, { strict: !1 }) ? is(e) : e);
|
|
921
921
|
}
|
|
922
|
-
class
|
|
922
|
+
class Ms extends P {
|
|
923
923
|
constructor({ address: t }) {
|
|
924
924
|
super(`Address "${t}" is invalid.`, {
|
|
925
925
|
metaMessages: [
|
|
@@ -930,7 +930,7 @@ class Os extends v {
|
|
|
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 lt extends Map {
|
|
|
951
951
|
return this;
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
|
-
const
|
|
955
|
-
function
|
|
956
|
-
if (
|
|
957
|
-
return
|
|
958
|
-
const s = e.substring(2).toLowerCase(), n =
|
|
954
|
+
const Y = /* @__PURE__ */ new ht(8192);
|
|
955
|
+
function dt(e, t) {
|
|
956
|
+
if (Y.has(`${e}.${t}`))
|
|
957
|
+
return Y.get(`${e}.${t}`);
|
|
958
|
+
const s = e.substring(2).toLowerCase(), n = Ns(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
|
-
return
|
|
962
|
+
return Y.set(`${e}.${t}`, i), i;
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
if (!
|
|
966
|
-
throw new
|
|
967
|
-
return
|
|
964
|
+
function v(e, t) {
|
|
965
|
+
if (!_s(e, { strict: !1 }))
|
|
966
|
+
throw new Ms({ address: e });
|
|
967
|
+
return dt(e, t);
|
|
968
968
|
}
|
|
969
|
-
const
|
|
970
|
-
function
|
|
969
|
+
const Bs = /^0x[a-fA-F0-9]{40}$/, X = /* @__PURE__ */ new ht(8192);
|
|
970
|
+
function _s(e, t) {
|
|
971
971
|
const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
|
|
972
|
-
if (
|
|
973
|
-
return
|
|
974
|
-
const r =
|
|
975
|
-
return
|
|
976
|
-
}
|
|
977
|
-
const
|
|
978
|
-
chainId:
|
|
979
|
-
address:
|
|
972
|
+
if (X.has(n))
|
|
973
|
+
return X.get(n);
|
|
974
|
+
const r = Bs.test(e) ? e.toLowerCase() === e ? !0 : s ? dt(e) === e : !0 : !1;
|
|
975
|
+
return X.set(n, r), r;
|
|
976
|
+
}
|
|
977
|
+
const $s = {
|
|
978
|
+
chainId: We.chainId,
|
|
979
|
+
address: v("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:
|
|
987
|
-
address:
|
|
985
|
+
}, Ls = {
|
|
986
|
+
chainId: Ke.chainId,
|
|
987
|
+
address: v("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:
|
|
995
|
-
address:
|
|
993
|
+
}, zs = {
|
|
994
|
+
chainId: Qe.chainId,
|
|
995
|
+
address: v("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:
|
|
1003
|
-
address:
|
|
1001
|
+
}, js = {
|
|
1002
|
+
chainId: Ze.chainId,
|
|
1003
|
+
address: v("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:
|
|
1011
|
-
address:
|
|
1009
|
+
}, qs = {
|
|
1010
|
+
chainId: Ye.chainId,
|
|
1011
|
+
address: v("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:
|
|
1019
|
-
address:
|
|
1017
|
+
}, Fs = {
|
|
1018
|
+
chainId: Ve.chainId,
|
|
1019
|
+
address: v("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:
|
|
1027
|
-
address:
|
|
1025
|
+
}, Hs = {
|
|
1026
|
+
chainId: Xe.chainId,
|
|
1027
|
+
address: v("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:
|
|
1034
|
-
address:
|
|
1032
|
+
}, Ks = {
|
|
1033
|
+
chainId: Ge.chainId,
|
|
1034
|
+
address: v("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:
|
|
1041
|
-
address:
|
|
1039
|
+
}, Ws = {
|
|
1040
|
+
chainId: Je.chainId,
|
|
1041
|
+
address: v("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
|
+
}, Vs = {
|
|
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
|
+
[E.USDC]: Ls
|
|
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
|
+
[E.USDC]: $s
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
1068
|
AVALANCHE_MAINNET: {
|
|
1069
|
-
...
|
|
1069
|
+
...Ze,
|
|
1070
1070
|
tokens: {
|
|
1071
|
-
[
|
|
1071
|
+
[E.USDC]: js
|
|
1072
1072
|
},
|
|
1073
1073
|
explorer: "https://snowtrace.io"
|
|
1074
1074
|
},
|
|
1075
1075
|
AVALANCHE_TESTNET: {
|
|
1076
|
-
...
|
|
1076
|
+
...Qe,
|
|
1077
1077
|
tokens: {
|
|
1078
|
-
[
|
|
1078
|
+
[E.USDC]: zs
|
|
1079
1079
|
},
|
|
1080
1080
|
explorer: "https://testnet.snowtrace.io"
|
|
1081
1081
|
},
|
|
1082
1082
|
BASE_MAINNET: {
|
|
1083
|
-
...
|
|
1083
|
+
...Ve,
|
|
1084
1084
|
tokens: {
|
|
1085
|
-
[
|
|
1085
|
+
[E.USDC]: Fs
|
|
1086
1086
|
},
|
|
1087
1087
|
explorer: "https://basescan.org"
|
|
1088
1088
|
},
|
|
1089
1089
|
BASE_TESTNET: {
|
|
1090
|
-
...
|
|
1090
|
+
...Ye,
|
|
1091
1091
|
tokens: {
|
|
1092
|
-
[
|
|
1092
|
+
[E.USDC]: qs
|
|
1093
1093
|
},
|
|
1094
1094
|
explorer: "https://sepolia.basescan.org"
|
|
1095
1095
|
},
|
|
1096
1096
|
BSC_MAINNET: {
|
|
1097
|
-
...
|
|
1097
|
+
...Xe,
|
|
1098
1098
|
tokens: {
|
|
1099
|
-
[
|
|
1099
|
+
[E.USDC]: Hs
|
|
1100
1100
|
},
|
|
1101
1101
|
explorer: "https://bscscan.com"
|
|
1102
1102
|
},
|
|
1103
1103
|
ETHEREUM_MAINNET: {
|
|
1104
|
-
...
|
|
1104
|
+
...Je,
|
|
1105
1105
|
tokens: {
|
|
1106
|
-
[
|
|
1106
|
+
[E.USDC]: Ws
|
|
1107
1107
|
},
|
|
1108
1108
|
explorer: "https://etherscan.io"
|
|
1109
1109
|
},
|
|
1110
1110
|
ETHEREUM_TESTNET: {
|
|
1111
|
-
...
|
|
1111
|
+
...Ge,
|
|
1112
1112
|
tokens: {
|
|
1113
|
-
[
|
|
1113
|
+
[E.USDC]: Ks
|
|
1114
1114
|
},
|
|
1115
1115
|
explorer: "https://sepolia.etherscan.io"
|
|
1116
1116
|
},
|
|
1117
1117
|
STARKNET_MAINNET: {
|
|
1118
|
-
...
|
|
1118
|
+
...et,
|
|
1119
1119
|
tokens: {
|
|
1120
|
-
[
|
|
1120
|
+
[E.USDC]: Vs
|
|
1121
1121
|
},
|
|
1122
1122
|
explorer: ""
|
|
1123
1123
|
}
|
|
1124
1124
|
};
|
|
1125
|
-
var
|
|
1126
|
-
const
|
|
1125
|
+
var ee = /* @__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))(ee || {}), pt = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(pt || {});
|
|
1126
|
+
const Ys = (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 Xs(e, t) {
|
|
1132
|
+
return Ys(e)?.tokens[t]?.address;
|
|
1133
1133
|
}
|
|
1134
|
-
var
|
|
1135
|
-
class
|
|
1134
|
+
var le = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(le || {});
|
|
1135
|
+
class h {
|
|
1136
1136
|
constructor({ api_key: t, env: s, seesion_token: n }) {
|
|
1137
|
-
this.api_key = t || "", this.sessionToken = n || "", this.env = s ??
|
|
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 (!h.app) {
|
|
1141
1141
|
if (!t)
|
|
1142
1142
|
throw new Error("Please provide an api_key");
|
|
1143
|
-
|
|
1143
|
+
h.app = new h(t);
|
|
1144
1144
|
}
|
|
1145
|
-
return t && (t.api_key !== void 0 && (
|
|
1145
|
+
return t && (t.api_key !== void 0 && (h.app.api_key = t.api_key), t.seesion_token !== void 0 && (h.app.sessionToken = t.seesion_token), t.env !== void 0 && (h.app.env = t.env)), h.app;
|
|
1146
1146
|
}
|
|
1147
1147
|
static getApiKey() {
|
|
1148
|
-
if (!
|
|
1148
|
+
if (!h.app)
|
|
1149
1149
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1150
|
-
return
|
|
1150
|
+
return h.app.api_key;
|
|
1151
1151
|
}
|
|
1152
1152
|
static getSessionToken() {
|
|
1153
|
-
if (!
|
|
1153
|
+
if (!h.app)
|
|
1154
1154
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1155
|
-
return
|
|
1155
|
+
return h.app.sessionToken;
|
|
1156
1156
|
}
|
|
1157
1157
|
static getEnv() {
|
|
1158
|
-
if (!
|
|
1158
|
+
if (!h.app)
|
|
1159
1159
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1160
|
-
return
|
|
1160
|
+
return h.app.env === "internal" ? "staging" : h.app.env;
|
|
1161
1161
|
}
|
|
1162
1162
|
static getBaseUrl() {
|
|
1163
|
-
if (!
|
|
1163
|
+
if (!h.app)
|
|
1164
1164
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1165
|
-
switch (
|
|
1165
|
+
switch (h.app.env) {
|
|
1166
1166
|
case "production":
|
|
1167
1167
|
return "https://api.chainrails.io/api/v1";
|
|
1168
1168
|
case "staging":
|
|
@@ -1174,23 +1174,23 @@ class d {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
static getPayModalUrl(t, s, n, r) {
|
|
1177
|
-
if (!
|
|
1177
|
+
if (!h.app)
|
|
1178
1178
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1179
|
-
const i =
|
|
1179
|
+
const i = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = r && r > 0 ? "/pay/" : "/deposit/", a = `_chain_/${t}/_token_/${s}/_to_/${n}${r ? "/_amount_/" + r * 100 : ""}`;
|
|
1180
1180
|
return i + o + a;
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
|
-
let
|
|
1184
|
-
function
|
|
1185
|
-
|
|
1186
|
-
prefixUrl:
|
|
1183
|
+
let te = null;
|
|
1184
|
+
function Js() {
|
|
1185
|
+
te = Qt.create({
|
|
1186
|
+
prefixUrl: h.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 = h.getSessionToken() || h.getApiKey();
|
|
1194
1194
|
e.headers.set("Authorization", `Bearer ${t}`);
|
|
1195
1195
|
}
|
|
1196
1196
|
],
|
|
@@ -1201,118 +1201,118 @@ function Ys() {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return
|
|
1204
|
+
function m() {
|
|
1205
|
+
return te || Js(), te;
|
|
1206
1206
|
}
|
|
1207
|
-
class
|
|
1207
|
+
class Gs {
|
|
1208
1208
|
async getById(t) {
|
|
1209
|
-
return await
|
|
1209
|
+
return await m().get("intents/" + t).json();
|
|
1210
1210
|
}
|
|
1211
1211
|
async getForSender(t) {
|
|
1212
|
-
return await
|
|
1212
|
+
return await m().get("intents/user/" + t).json();
|
|
1213
1213
|
}
|
|
1214
1214
|
async getForAddress(t) {
|
|
1215
|
-
return await
|
|
1215
|
+
return await m().get("intents/address/" + t).json();
|
|
1216
1216
|
}
|
|
1217
1217
|
async getForSession(t) {
|
|
1218
|
-
return await
|
|
1218
|
+
return await m().get("modal/sessions/intents/" + t).json();
|
|
1219
1219
|
}
|
|
1220
1220
|
async getAll(t) {
|
|
1221
|
-
return await
|
|
1221
|
+
return await m().get("intents", { searchParams: t }).json();
|
|
1222
1222
|
}
|
|
1223
1223
|
async create(t) {
|
|
1224
|
-
return await
|
|
1224
|
+
return await m().post("intents", { json: t }).json();
|
|
1225
1225
|
}
|
|
1226
1226
|
async createForSession(t) {
|
|
1227
|
-
return await
|
|
1227
|
+
return await m().post("modal/sessions/intents", { json: t }).json();
|
|
1228
1228
|
}
|
|
1229
1229
|
async update(t, s) {
|
|
1230
|
-
return await
|
|
1230
|
+
return await m().post("intents", { json: s }).json();
|
|
1231
1231
|
}
|
|
1232
1232
|
async triggerProcessing(t) {
|
|
1233
|
-
return await
|
|
1233
|
+
return await m().post(`intents/${t}/trigger-processing`).json();
|
|
1234
1234
|
}
|
|
1235
1235
|
async triggerProcessingForSession(t) {
|
|
1236
|
-
return await
|
|
1236
|
+
return await m().post(`modal/sessions/intents/${t}/process`).json();
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
class
|
|
1239
|
+
class Zs {
|
|
1240
1240
|
async getFromSpecificBridge(t) {
|
|
1241
|
-
return await
|
|
1241
|
+
return await m().get("quotes/single", { searchParams: t }).json();
|
|
1242
1242
|
}
|
|
1243
1243
|
async getFromAllBridges(t) {
|
|
1244
|
-
return await
|
|
1244
|
+
return await m().get("quotes/multiple", { searchParams: t }).json();
|
|
1245
1245
|
}
|
|
1246
1246
|
async getBestAcrossBridges(t) {
|
|
1247
|
-
return await
|
|
1247
|
+
return await m().get("quotes/best", { searchParams: t }).json();
|
|
1248
1248
|
}
|
|
1249
1249
|
async getAll(t) {
|
|
1250
|
-
return await
|
|
1250
|
+
return await m().get("quotes/multi-source", { searchParams: t }).json();
|
|
1251
1251
|
}
|
|
1252
1252
|
async getAllForSession(t) {
|
|
1253
|
-
return await
|
|
1253
|
+
return await m().get("modal/sessions/quotes", { searchParams: t }).json();
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
|
-
class
|
|
1256
|
+
class Qs {
|
|
1257
1257
|
async getOptimalRoutes(t) {
|
|
1258
|
-
return await
|
|
1258
|
+
return await m().get("router/optimal-route", { searchParams: t }).json();
|
|
1259
1259
|
}
|
|
1260
1260
|
async getAllSupportedBridges() {
|
|
1261
|
-
return await
|
|
1261
|
+
return await m().get("router/supported-bridges/all").json();
|
|
1262
1262
|
}
|
|
1263
1263
|
async getSupportedBridges(t) {
|
|
1264
|
-
return await
|
|
1264
|
+
return await m().get("router/supported-bridges/route", { searchParams: t }).json();
|
|
1265
1265
|
}
|
|
1266
1266
|
async getSupportedRoutes(t, s) {
|
|
1267
|
-
return await
|
|
1267
|
+
return await m().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
|
-
class
|
|
1270
|
+
class en {
|
|
1271
1271
|
async getSupported(t) {
|
|
1272
|
-
return await
|
|
1272
|
+
return await m().get("chains", { searchParams: t }).json();
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
|
-
class
|
|
1275
|
+
class tn {
|
|
1276
1276
|
async getClientInfo() {
|
|
1277
|
-
return await
|
|
1277
|
+
return await m().get("client/auth/client-info").json();
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
-
class
|
|
1280
|
+
class sn {
|
|
1281
1281
|
getSessionToken(t) {
|
|
1282
1282
|
const s = {
|
|
1283
1283
|
recipient: t.recipient,
|
|
1284
|
-
tokenOut:
|
|
1285
|
-
|
|
1286
|
-
|
|
1284
|
+
tokenOut: Xs(
|
|
1285
|
+
ee[t.destinationChain],
|
|
1286
|
+
pt[t.token]
|
|
1287
1287
|
),
|
|
1288
|
-
destinationChain:
|
|
1288
|
+
destinationChain: ee[t.destinationChain],
|
|
1289
1289
|
amount: t.amount
|
|
1290
1290
|
};
|
|
1291
|
-
return
|
|
1291
|
+
return m().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 Un = {
|
|
1295
|
+
router: new Qs(),
|
|
1296
|
+
quotes: new Zs(),
|
|
1297
|
+
intents: new Gs(),
|
|
1298
|
+
chains: new en(),
|
|
1299
|
+
client: new tn(),
|
|
1300
|
+
auth: new sn()
|
|
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 nn() {
|
|
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 Cn(e) {
|
|
1316
1316
|
const {
|
|
1317
1317
|
recipient: t,
|
|
1318
1318
|
token: s,
|
|
@@ -1325,132 +1325,132 @@ function In(e) {
|
|
|
1325
1325
|
onCancel: u,
|
|
1326
1326
|
onSuccess: f,
|
|
1327
1327
|
session_url: w,
|
|
1328
|
-
data:
|
|
1329
|
-
} = e, [y,
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
const
|
|
1333
|
-
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1328
|
+
data: d
|
|
1329
|
+
} = e, [y, S] = L(!0), [R, l] = L(null), p = re(null);
|
|
1330
|
+
oe(() => {
|
|
1331
|
+
b();
|
|
1332
|
+
const T = document.body.style.overflow;
|
|
1333
|
+
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = T || "";
|
|
1334
|
+
const M = (we) => {
|
|
1335
|
+
we.data === "closed" && (c(), u?.()), we.data === "completed" && (window.setTimeout(c, 2e3), f?.());
|
|
1336
1336
|
};
|
|
1337
|
-
return window.addEventListener("message",
|
|
1338
|
-
document.body.style.overflow =
|
|
1337
|
+
return window.addEventListener("message", M), () => {
|
|
1338
|
+
document.body.style.overflow = T || "", window.removeEventListener("message", M);
|
|
1339
1339
|
};
|
|
1340
|
-
}, [i, u, f,
|
|
1341
|
-
function
|
|
1342
|
-
|
|
1343
|
-
}
|
|
1344
|
-
function
|
|
1345
|
-
if (!
|
|
1346
|
-
|
|
1347
|
-
api_key:
|
|
1340
|
+
}, [i, u, f, d?.sessionToken]);
|
|
1341
|
+
function g() {
|
|
1342
|
+
S(!1), b();
|
|
1343
|
+
}
|
|
1344
|
+
function b() {
|
|
1345
|
+
if (!d?.sessionToken) return;
|
|
1346
|
+
h.config({
|
|
1347
|
+
api_key: d?.sessionToken || "",
|
|
1348
1348
|
env: w === "https://chainrails-sdk-server.vercel.app/test/create-session" ? "internal" : "production"
|
|
1349
|
-
});
|
|
1350
|
-
const
|
|
1349
|
+
}), l(h.getPayModalUrl(n, s, t, r));
|
|
1350
|
+
const T = {
|
|
1351
1351
|
type: "session",
|
|
1352
|
-
session_token:
|
|
1353
|
-
environment:
|
|
1352
|
+
session_token: d.sessionToken,
|
|
1353
|
+
environment: h.getEnv() || le.PRODUCTION
|
|
1354
1354
|
};
|
|
1355
|
-
console.log(
|
|
1355
|
+
console.log(p.current, p.current?.contentWindow, p.current?.src), p.current?.contentWindow?.postMessage(T, "https://app.chainrails.io"), p.current?.contentWindow?.postMessage(T, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1356
1356
|
}
|
|
1357
|
-
return /* @__PURE__ */
|
|
1358
|
-
className:
|
|
1359
|
-
children: [(y || o) && /* @__PURE__ */
|
|
1357
|
+
return d?.sessionToken ? /* @__PURE__ */ Ee("div", {
|
|
1358
|
+
className: nn("payment-modal-wrapper", y || o ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
1359
|
+
children: [(y || o) && /* @__PURE__ */ k("div", {
|
|
1360
1360
|
role: "status",
|
|
1361
1361
|
className: "payment-modal-loader",
|
|
1362
|
-
children: /* @__PURE__ */
|
|
1362
|
+
children: /* @__PURE__ */ Ee("svg", {
|
|
1363
1363
|
"aria-hidden": "true",
|
|
1364
1364
|
className: "icon",
|
|
1365
1365
|
viewBox: "0 0 100 101",
|
|
1366
1366
|
fill: "none",
|
|
1367
1367
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1368
|
-
children: [/* @__PURE__ */
|
|
1368
|
+
children: [/* @__PURE__ */ k("path", {
|
|
1369
1369
|
d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
|
|
1370
1370
|
fill: "currentColor"
|
|
1371
|
-
}), /* @__PURE__ */
|
|
1371
|
+
}), /* @__PURE__ */ k("path", {
|
|
1372
1372
|
d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
|
|
1373
1373
|
fill: "currentFill"
|
|
1374
1374
|
})]
|
|
1375
1375
|
})
|
|
1376
|
-
}), /* @__PURE__ */
|
|
1376
|
+
}), R ? /* @__PURE__ */ k("iframe", {
|
|
1377
1377
|
allow: "clipboard-read *; clipboard-write *",
|
|
1378
|
-
src:
|
|
1379
|
-
onLoad:
|
|
1378
|
+
src: R,
|
|
1379
|
+
onLoad: g,
|
|
1380
1380
|
className: `payment-modal ${y || o ? "invisible" : "visible"}`,
|
|
1381
1381
|
"data-id": r,
|
|
1382
|
-
ref:
|
|
1383
|
-
})]
|
|
1384
|
-
});
|
|
1382
|
+
ref: p
|
|
1383
|
+
}) : null]
|
|
1384
|
+
}) : /* @__PURE__ */ k(Ut, {});
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function rn(e) {
|
|
1387
1387
|
return BigInt(e).toString();
|
|
1388
1388
|
}
|
|
1389
|
-
const
|
|
1390
|
-
let
|
|
1391
|
-
const
|
|
1389
|
+
const on = Symbol(), fe = Symbol(), D = "a", mt = "f", De = "p", yt = "c", wt = "t", he = "h", O = "w", de = "o", pe = "k";
|
|
1390
|
+
let an = (e, t) => new Proxy(e, t);
|
|
1391
|
+
const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), bt = (e) => e && (ne.has(e) ? ne.get(e) : se(e) === Object.prototype || se(e) === Array.prototype), j = (e) => typeof e == "object" && e !== null, cn = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), un = (e) => {
|
|
1392
1392
|
if (Array.isArray(e))
|
|
1393
1393
|
return Array.from(e);
|
|
1394
1394
|
const t = Object.getOwnPropertyDescriptors(e);
|
|
1395
1395
|
return Object.values(t).forEach((s) => {
|
|
1396
1396
|
s.configurable = !0;
|
|
1397
|
-
}), Object.create(
|
|
1398
|
-
},
|
|
1397
|
+
}), Object.create(se(e), t);
|
|
1398
|
+
}, ln = (e, t) => {
|
|
1399
1399
|
const s = {
|
|
1400
|
-
[
|
|
1400
|
+
[mt]: t
|
|
1401
1401
|
};
|
|
1402
1402
|
let n = !1;
|
|
1403
1403
|
const r = (a, c) => {
|
|
1404
1404
|
if (!n) {
|
|
1405
|
-
let u = s[
|
|
1406
|
-
if (u || (u = {}, s[
|
|
1407
|
-
u[
|
|
1405
|
+
let u = s[D].get(e);
|
|
1406
|
+
if (u || (u = {}, s[D].set(e, u)), a === O)
|
|
1407
|
+
u[O] = !0;
|
|
1408
1408
|
else {
|
|
1409
1409
|
let f = u[a];
|
|
1410
1410
|
f || (f = /* @__PURE__ */ new Set(), u[a] = f), f.add(c);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
}, i = () => {
|
|
1414
|
-
n = !0, s[
|
|
1414
|
+
n = !0, s[D].delete(e);
|
|
1415
1415
|
}, o = {
|
|
1416
1416
|
get(a, c) {
|
|
1417
|
-
return c ===
|
|
1417
|
+
return c === fe ? e : (r(pe, c), Et(Reflect.get(a, c), s[D], s[yt], s[wt]));
|
|
1418
1418
|
},
|
|
1419
1419
|
has(a, c) {
|
|
1420
|
-
return c ===
|
|
1420
|
+
return c === on ? (i(), !0) : (r(he, c), Reflect.has(a, c));
|
|
1421
1421
|
},
|
|
1422
1422
|
getOwnPropertyDescriptor(a, c) {
|
|
1423
|
-
return r(
|
|
1423
|
+
return r(de, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
1424
1424
|
},
|
|
1425
1425
|
ownKeys(a) {
|
|
1426
|
-
return r(
|
|
1426
|
+
return r(O), Reflect.ownKeys(a);
|
|
1427
1427
|
}
|
|
1428
1428
|
};
|
|
1429
1429
|
return t && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
1430
|
-
},
|
|
1430
|
+
}, ge = (e) => (
|
|
1431
1431
|
// unwrap proxy
|
|
1432
|
-
e[
|
|
1432
|
+
e[fe] || // otherwise
|
|
1433
1433
|
e
|
|
1434
|
-
),
|
|
1435
|
-
if (!
|
|
1434
|
+
), Et = (e, t, s, n) => {
|
|
1435
|
+
if (!bt(e))
|
|
1436
1436
|
return e;
|
|
1437
1437
|
let r = n && n.get(e);
|
|
1438
1438
|
if (!r) {
|
|
1439
|
-
const c =
|
|
1440
|
-
|
|
1439
|
+
const c = ge(e);
|
|
1440
|
+
cn(c) ? r = [c, un(c)] : r = [c], n?.set(e, r);
|
|
1441
1441
|
}
|
|
1442
1442
|
const [i, o] = r;
|
|
1443
1443
|
let a = s && s.get(i);
|
|
1444
|
-
return (!a || a[1][
|
|
1445
|
-
},
|
|
1444
|
+
return (!a || a[1][mt] !== !!o) && (a = ln(i, !!o), a[1][De] = an(o || i, a[0]), s && s.set(i, a)), a[1][D] = t, a[1][yt] = s, a[1][wt] = n, a[1][De];
|
|
1445
|
+
}, fn = (e, t) => {
|
|
1446
1446
|
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1447
1447
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
1448
|
-
},
|
|
1448
|
+
}, St = (e, t, s, n, r = Object.is) => {
|
|
1449
1449
|
if (r(e, t))
|
|
1450
1450
|
return !1;
|
|
1451
|
-
if (!
|
|
1451
|
+
if (!j(e) || !j(t))
|
|
1452
1452
|
return !0;
|
|
1453
|
-
const i = s.get(
|
|
1453
|
+
const i = s.get(ge(e));
|
|
1454
1454
|
if (!i)
|
|
1455
1455
|
return !0;
|
|
1456
1456
|
if (n) {
|
|
@@ -1459,57 +1459,57 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1459
1459
|
n.set(e, t);
|
|
1460
1460
|
}
|
|
1461
1461
|
let o = null;
|
|
1462
|
-
for (const a of i[
|
|
1462
|
+
for (const a of i[he] || [])
|
|
1463
1463
|
if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
|
|
1464
1464
|
return o;
|
|
1465
|
-
if (i[
|
|
1466
|
-
if (o =
|
|
1465
|
+
if (i[O] === !0) {
|
|
1466
|
+
if (o = fn(e, t), o)
|
|
1467
1467
|
return o;
|
|
1468
1468
|
} else
|
|
1469
|
-
for (const a of i[
|
|
1469
|
+
for (const a of i[de] || []) {
|
|
1470
1470
|
const c = !!Reflect.getOwnPropertyDescriptor(e, a), u = !!Reflect.getOwnPropertyDescriptor(t, a);
|
|
1471
1471
|
if (o = c !== u, o)
|
|
1472
1472
|
return o;
|
|
1473
1473
|
}
|
|
1474
|
-
for (const a of i[
|
|
1475
|
-
if (o =
|
|
1474
|
+
for (const a of i[pe] || [])
|
|
1475
|
+
if (o = St(e[a], t[a], s, n, r), o)
|
|
1476
1476
|
return o;
|
|
1477
1477
|
if (o === null)
|
|
1478
1478
|
throw new Error("invalid used");
|
|
1479
1479
|
return o;
|
|
1480
|
-
},
|
|
1481
|
-
|
|
1482
|
-
},
|
|
1480
|
+
}, hn = (e) => bt(e) && e[fe] || null, Oe = (e, t = !0) => {
|
|
1481
|
+
ne.set(e, t);
|
|
1482
|
+
}, dn = (e, t, s) => {
|
|
1483
1483
|
const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
1484
1484
|
var c, u, f;
|
|
1485
1485
|
if (r.has(o))
|
|
1486
1486
|
return;
|
|
1487
|
-
|
|
1488
|
-
const w =
|
|
1487
|
+
j(o) && r.add(o);
|
|
1488
|
+
const w = j(o) && t.get(ge(o));
|
|
1489
1489
|
if (w) {
|
|
1490
|
-
if ((c = w[
|
|
1491
|
-
const y = `:has(${String(
|
|
1490
|
+
if ((c = w[he]) === null || c === void 0 || c.forEach((d) => {
|
|
1491
|
+
const y = `:has(${String(d)})`;
|
|
1492
1492
|
n.push(a ? [...a, y] : [y]);
|
|
1493
|
-
}), w[
|
|
1494
|
-
const
|
|
1495
|
-
n.push(a ? [...a,
|
|
1493
|
+
}), w[O] === !0) {
|
|
1494
|
+
const d = ":ownKeys";
|
|
1495
|
+
n.push(a ? [...a, d] : [d]);
|
|
1496
1496
|
} else
|
|
1497
|
-
(u = w[
|
|
1498
|
-
const y = `:hasOwn(${String(
|
|
1497
|
+
(u = w[de]) === null || u === void 0 || u.forEach((d) => {
|
|
1498
|
+
const y = `:hasOwn(${String(d)})`;
|
|
1499
1499
|
n.push(a ? [...a, y] : [y]);
|
|
1500
1500
|
});
|
|
1501
|
-
(f = w[
|
|
1502
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
1501
|
+
(f = w[pe]) === null || f === void 0 || f.forEach((d) => {
|
|
1502
|
+
"value" in (Object.getOwnPropertyDescriptor(o, d) || {}) && i(o[d], a ? [...a, d] : [d]);
|
|
1503
1503
|
});
|
|
1504
1504
|
} else a && n.push(a);
|
|
1505
1505
|
};
|
|
1506
1506
|
return i(e), n;
|
|
1507
|
-
},
|
|
1508
|
-
const s =
|
|
1507
|
+
}, q = {}, me = (e) => typeof e == "object" && e !== null, pn = (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) => {
|
|
1508
|
+
const s = Ne.get(e);
|
|
1509
1509
|
if (s?.[0] === t)
|
|
1510
1510
|
return s[1];
|
|
1511
1511
|
const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1512
|
-
return
|
|
1512
|
+
return Oe(n, !0), Ne.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
|
|
1513
1513
|
if (Object.getOwnPropertyDescriptor(n, r))
|
|
1514
1514
|
return;
|
|
1515
1515
|
const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
|
|
@@ -1522,17 +1522,17 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1522
1522
|
// It's still non-writable, so it avoids assigning a value.
|
|
1523
1523
|
configurable: !0
|
|
1524
1524
|
};
|
|
1525
|
-
if (
|
|
1526
|
-
|
|
1525
|
+
if (ye.has(i))
|
|
1526
|
+
Oe(i, !1);
|
|
1527
1527
|
else if (C.has(i)) {
|
|
1528
1528
|
const [c, u] = C.get(
|
|
1529
1529
|
i
|
|
1530
1530
|
);
|
|
1531
|
-
a.value =
|
|
1531
|
+
a.value = Tt(c, u());
|
|
1532
1532
|
}
|
|
1533
1533
|
Object.defineProperty(n, r, a);
|
|
1534
1534
|
}), Object.preventExtensions(n);
|
|
1535
|
-
},
|
|
1535
|
+
}, gn = (e, t, s, n) => ({
|
|
1536
1536
|
deleteProperty(r, i) {
|
|
1537
1537
|
const o = Reflect.get(r, i);
|
|
1538
1538
|
s(i);
|
|
@@ -1541,76 +1541,76 @@ const te = Object.getPrototypeOf, se = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1541
1541
|
},
|
|
1542
1542
|
set(r, i, o, a) {
|
|
1543
1543
|
const c = !e() && Reflect.has(r, i), u = Reflect.get(r, i, a);
|
|
1544
|
-
if (c && (
|
|
1544
|
+
if (c && (Me(u, o) || F.has(o) && Me(u, F.get(o))))
|
|
1545
1545
|
return !0;
|
|
1546
|
-
s(i),
|
|
1547
|
-
const f = !C.has(o) &&
|
|
1546
|
+
s(i), me(o) && (o = hn(o) || o);
|
|
1547
|
+
const f = !C.has(o) && yn(o) ? Rt(o) : o;
|
|
1548
1548
|
return t(i, f), Reflect.set(r, i, f, a), n(["set", [i], o, u]), !0;
|
|
1549
1549
|
}
|
|
1550
|
-
}), C = /* @__PURE__ */ new WeakMap(),
|
|
1551
|
-
let
|
|
1552
|
-
function
|
|
1553
|
-
if (!
|
|
1550
|
+
}), C = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new WeakMap(), J = [1], F = /* @__PURE__ */ new WeakMap();
|
|
1551
|
+
let Me = Object.is, mn = (e, t) => new Proxy(e, t), yn = pn, wn = Tt, bn = gn;
|
|
1552
|
+
function Rt(e = {}) {
|
|
1553
|
+
if (!me(e))
|
|
1554
1554
|
throw new Error("object required");
|
|
1555
|
-
const t =
|
|
1555
|
+
const t = F.get(e);
|
|
1556
1556
|
if (t)
|
|
1557
1557
|
return t;
|
|
1558
|
-
let s =
|
|
1559
|
-
const n = /* @__PURE__ */ new Set(), r = (l,
|
|
1560
|
-
s !==
|
|
1558
|
+
let s = J[0];
|
|
1559
|
+
const n = /* @__PURE__ */ new Set(), r = (l, p = ++J[0]) => {
|
|
1560
|
+
s !== p && (i = s = p, n.forEach((g) => g(l, p)));
|
|
1561
1561
|
};
|
|
1562
1562
|
let i = s;
|
|
1563
|
-
const o = (l =
|
|
1564
|
-
const
|
|
1565
|
-
|
|
1566
|
-
})), s), a = (l) => (
|
|
1567
|
-
const
|
|
1568
|
-
|
|
1569
|
-
}, c = /* @__PURE__ */ new Map(), u = (l,
|
|
1570
|
-
const
|
|
1571
|
-
if (
|
|
1572
|
-
if ((
|
|
1563
|
+
const o = (l = J[0]) => (i !== l && (i = l, c.forEach(([p]) => {
|
|
1564
|
+
const g = p[1](l);
|
|
1565
|
+
g > s && (s = g);
|
|
1566
|
+
})), s), a = (l) => (p, g) => {
|
|
1567
|
+
const b = [...p];
|
|
1568
|
+
b[1] = [l, ...b[1]], r(b, g);
|
|
1569
|
+
}, c = /* @__PURE__ */ new Map(), u = (l, p) => {
|
|
1570
|
+
const g = !ye.has(p) && C.get(p);
|
|
1571
|
+
if (g) {
|
|
1572
|
+
if ((q ? "production" : void 0) !== "production" && c.has(l))
|
|
1573
1573
|
throw new Error("prop listener already exists");
|
|
1574
1574
|
if (n.size) {
|
|
1575
|
-
const
|
|
1576
|
-
c.set(l, [
|
|
1575
|
+
const b = g[2](a(l));
|
|
1576
|
+
c.set(l, [g, b]);
|
|
1577
1577
|
} else
|
|
1578
|
-
c.set(l, [
|
|
1578
|
+
c.set(l, [g]);
|
|
1579
1579
|
}
|
|
1580
1580
|
}, f = (l) => {
|
|
1581
|
-
var
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
}, w = (l) => (n.add(l), n.size === 1 && c.forEach(([
|
|
1585
|
-
if ((
|
|
1581
|
+
var p;
|
|
1582
|
+
const g = c.get(l);
|
|
1583
|
+
g && (c.delete(l), (p = g[1]) == null || p.call(g));
|
|
1584
|
+
}, w = (l) => (n.add(l), n.size === 1 && c.forEach(([g, b], T) => {
|
|
1585
|
+
if ((q ? "production" : void 0) !== "production" && b)
|
|
1586
1586
|
throw new Error("remove already exists");
|
|
1587
|
-
const
|
|
1588
|
-
c.set(
|
|
1587
|
+
const M = g[2](a(T));
|
|
1588
|
+
c.set(T, [g, M]);
|
|
1589
1589
|
}), () => {
|
|
1590
|
-
n.delete(l), n.size === 0 && c.forEach(([
|
|
1591
|
-
|
|
1590
|
+
n.delete(l), n.size === 0 && c.forEach(([g, b], T) => {
|
|
1591
|
+
b && (b(), c.set(T, [g]));
|
|
1592
1592
|
});
|
|
1593
1593
|
});
|
|
1594
|
-
let
|
|
1595
|
-
const y =
|
|
1596
|
-
() =>
|
|
1594
|
+
let d = !0;
|
|
1595
|
+
const y = bn(
|
|
1596
|
+
() => d,
|
|
1597
1597
|
u,
|
|
1598
1598
|
f,
|
|
1599
1599
|
r
|
|
1600
|
-
),
|
|
1601
|
-
|
|
1602
|
-
const
|
|
1603
|
-
return C.set(
|
|
1604
|
-
const
|
|
1600
|
+
), S = mn(e, y);
|
|
1601
|
+
F.set(e, S);
|
|
1602
|
+
const R = [e, o, w];
|
|
1603
|
+
return C.set(S, R), Reflect.ownKeys(e).forEach((l) => {
|
|
1604
|
+
const p = Object.getOwnPropertyDescriptor(
|
|
1605
1605
|
e,
|
|
1606
1606
|
l
|
|
1607
1607
|
);
|
|
1608
|
-
"value" in
|
|
1609
|
-
}),
|
|
1608
|
+
"value" in p && p.writable && (S[l] = e[l]);
|
|
1609
|
+
}), d = !1, S;
|
|
1610
1610
|
}
|
|
1611
|
-
function
|
|
1611
|
+
function En(e, t, s) {
|
|
1612
1612
|
const n = C.get(e);
|
|
1613
|
-
(
|
|
1613
|
+
(q ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1614
1614
|
let r;
|
|
1615
1615
|
const i = [], o = n[2];
|
|
1616
1616
|
let a = !1;
|
|
@@ -1623,36 +1623,36 @@ function wn(e, t, s) {
|
|
|
1623
1623
|
a = !1, u();
|
|
1624
1624
|
};
|
|
1625
1625
|
}
|
|
1626
|
-
function
|
|
1626
|
+
function Be(e) {
|
|
1627
1627
|
const t = C.get(e);
|
|
1628
|
-
(
|
|
1628
|
+
(q ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1629
1629
|
const [s, n] = t;
|
|
1630
|
-
return
|
|
1631
|
-
}
|
|
1632
|
-
const
|
|
1633
|
-
const s =
|
|
1634
|
-
|
|
1635
|
-
s.current =
|
|
1636
|
-
}),
|
|
1637
|
-
},
|
|
1638
|
-
function
|
|
1639
|
-
const n =
|
|
1630
|
+
return wn(s, n());
|
|
1631
|
+
}
|
|
1632
|
+
const Sn = {}, Tn = (e, t) => {
|
|
1633
|
+
const s = re(void 0);
|
|
1634
|
+
oe(() => {
|
|
1635
|
+
s.current = dn(e, t);
|
|
1636
|
+
}), It(s.current);
|
|
1637
|
+
}, Rn = Tn, An = /* @__PURE__ */ new WeakMap();
|
|
1638
|
+
function vn(e, t) {
|
|
1639
|
+
const n = be(
|
|
1640
1640
|
() => e && /* @__PURE__ */ new WeakMap(),
|
|
1641
1641
|
[e]
|
|
1642
|
-
), r =
|
|
1642
|
+
), r = re(void 0);
|
|
1643
1643
|
let i = !0;
|
|
1644
|
-
const o =
|
|
1645
|
-
|
|
1644
|
+
const o = At(
|
|
1645
|
+
vt(
|
|
1646
1646
|
(c) => {
|
|
1647
|
-
const u =
|
|
1647
|
+
const u = En(e, c);
|
|
1648
1648
|
return c(), u;
|
|
1649
1649
|
},
|
|
1650
1650
|
[e, void 0]
|
|
1651
1651
|
),
|
|
1652
1652
|
() => {
|
|
1653
|
-
const c =
|
|
1653
|
+
const c = Be(e);
|
|
1654
1654
|
try {
|
|
1655
|
-
if (!i && r.current && !
|
|
1655
|
+
if (!i && r.current && !St(
|
|
1656
1656
|
r.current,
|
|
1657
1657
|
c,
|
|
1658
1658
|
n,
|
|
@@ -1663,20 +1663,20 @@ function Tn(e, t) {
|
|
|
1663
1663
|
}
|
|
1664
1664
|
return c;
|
|
1665
1665
|
},
|
|
1666
|
-
() =>
|
|
1666
|
+
() => Be(e)
|
|
1667
1667
|
);
|
|
1668
|
-
i = !1,
|
|
1668
|
+
i = !1, Pt(() => {
|
|
1669
1669
|
r.current = o;
|
|
1670
|
-
}), (
|
|
1671
|
-
const a =
|
|
1672
|
-
return
|
|
1670
|
+
}), (Sn ? "production" : void 0) !== "production" && Rn(o, n);
|
|
1671
|
+
const a = be(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1672
|
+
return Et(o, n, a, An);
|
|
1673
1673
|
}
|
|
1674
|
-
const I =
|
|
1674
|
+
const I = Rt({
|
|
1675
1675
|
data: null,
|
|
1676
1676
|
isPending: !1,
|
|
1677
1677
|
error: null
|
|
1678
1678
|
});
|
|
1679
|
-
function
|
|
1679
|
+
function kn({
|
|
1680
1680
|
session_url: e,
|
|
1681
1681
|
destinationChain: t,
|
|
1682
1682
|
token: s,
|
|
@@ -1685,15 +1685,15 @@ function Un({
|
|
|
1685
1685
|
onCancel: i,
|
|
1686
1686
|
onSuccess: o
|
|
1687
1687
|
}) {
|
|
1688
|
-
const a =
|
|
1689
|
-
function
|
|
1688
|
+
const a = vn(I), [c, u] = L(!1), [f, w] = L(Date.now());
|
|
1689
|
+
function d() {
|
|
1690
1690
|
u(!0);
|
|
1691
1691
|
}
|
|
1692
1692
|
function y() {
|
|
1693
|
-
u(!1),
|
|
1693
|
+
u(!1), S();
|
|
1694
1694
|
}
|
|
1695
|
-
const
|
|
1696
|
-
const
|
|
1695
|
+
const S = () => {
|
|
1696
|
+
const R = Date.now();
|
|
1697
1697
|
I.isPending = !0, I.error = null, fetch(e, {
|
|
1698
1698
|
method: "POST",
|
|
1699
1699
|
headers: {
|
|
@@ -1702,35 +1702,35 @@ function Un({
|
|
|
1702
1702
|
body: JSON.stringify({
|
|
1703
1703
|
destinationChain: t?.replace("_MAINNET", ""),
|
|
1704
1704
|
token: s,
|
|
1705
|
-
amount: n ?
|
|
1705
|
+
amount: n ? rn(n) : "0",
|
|
1706
1706
|
recipient: r
|
|
1707
1707
|
})
|
|
1708
1708
|
}).then((l) => l.json()).then((l) => {
|
|
1709
|
-
|
|
1709
|
+
R < f || (I.data = l, I.isPending = !1, w(R));
|
|
1710
1710
|
}).catch((l) => {
|
|
1711
|
-
|
|
1711
|
+
R < f || (I.error = l?.toString(), I.isPending = !1, w(R));
|
|
1712
1712
|
});
|
|
1713
1713
|
};
|
|
1714
|
-
return
|
|
1715
|
-
|
|
1714
|
+
return oe(() => {
|
|
1715
|
+
S();
|
|
1716
1716
|
}, [t, s, n, r, e]), {
|
|
1717
1717
|
...a,
|
|
1718
1718
|
destinationChain: t,
|
|
1719
1719
|
token: s,
|
|
1720
1720
|
recipient: r,
|
|
1721
1721
|
isOpen: c,
|
|
1722
|
-
open:
|
|
1722
|
+
open: d,
|
|
1723
1723
|
close: y,
|
|
1724
|
-
refetch:
|
|
1724
|
+
refetch: S,
|
|
1725
1725
|
onSuccess: o,
|
|
1726
1726
|
onCancel: i
|
|
1727
1727
|
};
|
|
1728
1728
|
}
|
|
1729
1729
|
export {
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1730
|
+
h as Chainrails,
|
|
1731
|
+
Cn as PaymentModal,
|
|
1732
|
+
ee as chains,
|
|
1733
|
+
Un as crapi,
|
|
1734
|
+
pt as tokens,
|
|
1735
|
+
kn as usePaymentSession
|
|
1736
1736
|
};
|