@chainrails/react 0.2.26 → 0.2.28
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 +2 -2
- package/dist/PaymentModal/index.d.ts.map +1 -1
- package/dist/chainrails-sdk.es.js +1390 -988
- package/dist/chainrails-sdk.es.mjs +1390 -988
- package/dist/chainrails-sdk.umd.js +3 -3
- package/dist/hooks/usePaymentSession.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import './index.css';class
|
|
1
|
+
import { useState as v, useRef as ie, useEffect as x, useMemo as Ee, useSyncExternalStore as gt, useCallback as mt, useLayoutEffect as pt, useDebugValue as yt } from "react";
|
|
2
|
+
import { jsxs as Te, jsx as L } from "react/jsx-runtime";
|
|
3
|
+
import './index.css';class ee extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
6
6
|
options;
|
|
7
|
-
constructor(
|
|
8
|
-
const r =
|
|
9
|
-
super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response =
|
|
7
|
+
constructor(e, s, n) {
|
|
8
|
+
const r = e.status || e.status === 0 ? e.status : "", i = e.statusText ?? "", o = `${r} ${i}`.trim(), a = o ? `status code ${o}` : "an unknown error";
|
|
9
|
+
super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response = e, this.request = s, this.options = n;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
class Me extends Error {
|
|
13
13
|
name = "NonError";
|
|
14
14
|
value;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(e) {
|
|
16
16
|
let s = "Non-error value was thrown";
|
|
17
17
|
try {
|
|
18
|
-
typeof
|
|
18
|
+
typeof e == "string" ? s = e : e && typeof e == "object" && "message" in e && typeof e.message == "string" && (s = e.message);
|
|
19
19
|
} catch {
|
|
20
20
|
}
|
|
21
|
-
super(s), this.value =
|
|
21
|
+
super(s), this.value = e;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class V extends Error {
|
|
25
25
|
name = "ForceRetryError";
|
|
26
26
|
customDelay;
|
|
27
27
|
code;
|
|
28
28
|
customRequest;
|
|
29
|
-
constructor(
|
|
30
|
-
const s =
|
|
31
|
-
super(
|
|
29
|
+
constructor(e) {
|
|
30
|
+
const s = e?.cause ? e.cause instanceof Error ? e.cause : new Me(e.cause) : void 0;
|
|
31
|
+
super(e?.code ? `Forced retry: ${e.code}` : "Forced retry", s ? { cause: s } : void 0), this.customDelay = e?.delay, this.code = e?.code, this.customRequest = e?.request;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
let
|
|
34
|
+
const Se = (() => {
|
|
35
|
+
let t = !1, e = !1;
|
|
36
36
|
const s = typeof globalThis.ReadableStream == "function", n = typeof globalThis.Request == "function";
|
|
37
37
|
if (s && n)
|
|
38
38
|
try {
|
|
39
|
-
|
|
39
|
+
e = new globalThis.Request("https://empty.invalid", {
|
|
40
40
|
body: new globalThis.ReadableStream(),
|
|
41
41
|
method: "POST",
|
|
42
42
|
// @ts-expect-error - Types are outdated.
|
|
43
43
|
get duplex() {
|
|
44
|
-
return
|
|
44
|
+
return t = !0, "half";
|
|
45
45
|
}
|
|
46
46
|
}).headers.has("Content-Type");
|
|
47
47
|
} catch (r) {
|
|
@@ -49,8 +49,8 @@ const be = (() => {
|
|
|
49
49
|
return !1;
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
|
-
return
|
|
53
|
-
})(),
|
|
52
|
+
return t && !e;
|
|
53
|
+
})(), bt = typeof globalThis.AbortController == "function", Le = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Et = typeof globalThis.ReadableStream == "function", Tt = typeof globalThis.FormData == "function", Fe = ["get", "post", "put", "patch", "head", "delete"], St = {
|
|
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
|
+
}, Y = 2147483647, wt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, _e = Symbol("stop");
|
|
63
|
+
class He {
|
|
64
64
|
options;
|
|
65
|
-
constructor(
|
|
66
|
-
this.options =
|
|
65
|
+
constructor(e) {
|
|
66
|
+
this.options = e;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const Rt = (t) => new He(t), Ct = {
|
|
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
|
+
}, At = {
|
|
84
84
|
next: !0
|
|
85
85
|
// Next.js cache revalidation (revalidate, tags)
|
|
86
|
-
},
|
|
86
|
+
}, Dt = {
|
|
87
87
|
method: !0,
|
|
88
88
|
headers: !0,
|
|
89
89
|
body: !0,
|
|
@@ -98,94 +98,94 @@ const Dt = (e) => new Le(e), Ot = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
102
|
-
if (!
|
|
101
|
+
}, Ut = (t) => {
|
|
102
|
+
if (!t)
|
|
103
103
|
return 0;
|
|
104
|
-
if (
|
|
105
|
-
let
|
|
106
|
-
for (const [s, n] of
|
|
107
|
-
|
|
108
|
-
return
|
|
104
|
+
if (t instanceof FormData) {
|
|
105
|
+
let e = 0;
|
|
106
|
+
for (const [s, n] of t)
|
|
107
|
+
e += wt, e += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, e += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
|
|
108
|
+
return e;
|
|
109
109
|
}
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
return
|
|
114
|
-
if (typeof
|
|
115
|
-
return new TextEncoder().encode(
|
|
116
|
-
if (
|
|
117
|
-
return new TextEncoder().encode(
|
|
118
|
-
if ("byteLength" in
|
|
119
|
-
return
|
|
120
|
-
if (typeof
|
|
110
|
+
if (t instanceof Blob)
|
|
111
|
+
return t.size;
|
|
112
|
+
if (t instanceof ArrayBuffer)
|
|
113
|
+
return t.byteLength;
|
|
114
|
+
if (typeof t == "string")
|
|
115
|
+
return new TextEncoder().encode(t).length;
|
|
116
|
+
if (t instanceof URLSearchParams)
|
|
117
|
+
return new TextEncoder().encode(t.toString()).length;
|
|
118
|
+
if ("byteLength" in t)
|
|
119
|
+
return t.byteLength;
|
|
120
|
+
if (typeof t == "object" && t !== null)
|
|
121
121
|
try {
|
|
122
|
-
const
|
|
123
|
-
return new TextEncoder().encode(
|
|
122
|
+
const e = JSON.stringify(t);
|
|
123
|
+
return new TextEncoder().encode(e).length;
|
|
124
124
|
} catch {
|
|
125
125
|
return 0;
|
|
126
126
|
}
|
|
127
127
|
return 0;
|
|
128
|
-
},
|
|
128
|
+
}, $e = (t, e, s) => {
|
|
129
129
|
let n, r = 0;
|
|
130
|
-
return
|
|
130
|
+
return t.pipeThrough(new TransformStream({
|
|
131
131
|
transform(i, o) {
|
|
132
132
|
if (o.enqueue(i), n) {
|
|
133
133
|
r += n.byteLength;
|
|
134
|
-
let a =
|
|
135
|
-
a >= 1 && (a = 1 - Number.EPSILON), s?.({ percent: a, totalBytes: Math.max(
|
|
134
|
+
let a = e === 0 ? 0 : r / e;
|
|
135
|
+
a >= 1 && (a = 1 - Number.EPSILON), s?.({ percent: a, totalBytes: Math.max(e, r), transferredBytes: r }, n);
|
|
136
136
|
}
|
|
137
137
|
n = i;
|
|
138
138
|
},
|
|
139
139
|
flush() {
|
|
140
|
-
n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(
|
|
140
|
+
n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(e, r), transferredBytes: r }, n));
|
|
141
141
|
}
|
|
142
142
|
}));
|
|
143
|
-
},
|
|
144
|
-
if (!
|
|
145
|
-
return
|
|
146
|
-
if (
|
|
143
|
+
}, It = (t, e) => {
|
|
144
|
+
if (!t.body)
|
|
145
|
+
return t;
|
|
146
|
+
if (t.status === 204)
|
|
147
147
|
return new Response(null, {
|
|
148
|
-
status:
|
|
149
|
-
statusText:
|
|
150
|
-
headers:
|
|
148
|
+
status: t.status,
|
|
149
|
+
statusText: t.statusText,
|
|
150
|
+
headers: t.headers
|
|
151
151
|
});
|
|
152
|
-
const s = Math.max(0, Number(
|
|
153
|
-
return new Response(
|
|
154
|
-
status:
|
|
155
|
-
statusText:
|
|
156
|
-
headers:
|
|
152
|
+
const s = Math.max(0, Number(t.headers.get("content-length")) || 0);
|
|
153
|
+
return new Response($e(t.body, s, e), {
|
|
154
|
+
status: t.status,
|
|
155
|
+
statusText: t.statusText,
|
|
156
|
+
headers: t.headers
|
|
157
157
|
});
|
|
158
|
-
},
|
|
159
|
-
if (!
|
|
160
|
-
return
|
|
161
|
-
const n =
|
|
162
|
-
return new Request(
|
|
158
|
+
}, Pt = (t, e, s) => {
|
|
159
|
+
if (!t.body)
|
|
160
|
+
return t;
|
|
161
|
+
const n = Ut(s ?? t.body);
|
|
162
|
+
return new Request(t, {
|
|
163
163
|
// @ts-expect-error - Types are outdated.
|
|
164
164
|
duplex: "half",
|
|
165
|
-
body:
|
|
165
|
+
body: $e(t.body, n, e)
|
|
166
166
|
});
|
|
167
|
-
},
|
|
168
|
-
for (const
|
|
169
|
-
if ((!
|
|
167
|
+
}, P = (t) => t !== null && typeof t == "object", F = (...t) => {
|
|
168
|
+
for (const e of t)
|
|
169
|
+
if ((!P(e) || Array.isArray(e)) && e !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
|
-
return
|
|
172
|
-
},
|
|
173
|
-
const s = new globalThis.Headers(
|
|
171
|
+
return ae({}, ...t);
|
|
172
|
+
}, ze = (t = {}, e = {}) => {
|
|
173
|
+
const s = new globalThis.Headers(t), n = e instanceof globalThis.Headers, r = new globalThis.Headers(e);
|
|
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(
|
|
180
|
-
}
|
|
181
|
-
const
|
|
182
|
-
beforeRequest:
|
|
183
|
-
beforeRetry:
|
|
184
|
-
afterResponse:
|
|
185
|
-
beforeError:
|
|
186
|
-
}),
|
|
178
|
+
function _(t, e, s) {
|
|
179
|
+
return Object.hasOwn(e, s) && e[s] === void 0 ? [] : ae(t[s] ?? [], e[s] ?? []);
|
|
180
|
+
}
|
|
181
|
+
const je = (t = {}, e = {}) => ({
|
|
182
|
+
beforeRequest: _(t, e, "beforeRequest"),
|
|
183
|
+
beforeRetry: _(t, e, "beforeRetry"),
|
|
184
|
+
afterResponse: _(t, e, "afterResponse"),
|
|
185
|
+
beforeError: _(t, e, "beforeError")
|
|
186
|
+
}), vt = (t, e) => {
|
|
187
187
|
const s = new URLSearchParams();
|
|
188
|
-
for (const n of [
|
|
188
|
+
for (const n of [t, e])
|
|
189
189
|
if (n !== void 0)
|
|
190
190
|
if (n instanceof URLSearchParams)
|
|
191
191
|
for (const [r, i] of n.entries())
|
|
@@ -196,7 +196,7 @@ const _e = (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 {
|
|
@@ -205,150 +205,150 @@ const _e = (e = {}, t = {}) => ({
|
|
|
205
205
|
s.append(i, o);
|
|
206
206
|
}
|
|
207
207
|
return s;
|
|
208
|
-
},
|
|
209
|
-
let
|
|
208
|
+
}, ae = (...t) => {
|
|
209
|
+
let e = {}, s = {}, n = {}, r;
|
|
210
210
|
const i = [];
|
|
211
|
-
for (const o of
|
|
211
|
+
for (const o of t)
|
|
212
212
|
if (Array.isArray(o))
|
|
213
|
-
Array.isArray(
|
|
214
|
-
else if (
|
|
215
|
-
for (let [a,
|
|
216
|
-
if (a === "signal" &&
|
|
217
|
-
i.push(
|
|
213
|
+
Array.isArray(e) || (e = []), e = [...e, ...o];
|
|
214
|
+
else if (P(o)) {
|
|
215
|
+
for (let [a, u] of Object.entries(o)) {
|
|
216
|
+
if (a === "signal" && u instanceof globalThis.AbortSignal) {
|
|
217
|
+
i.push(u);
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
220
|
if (a === "context") {
|
|
221
|
-
if (
|
|
221
|
+
if (u != null && (!P(u) || Array.isArray(u)))
|
|
222
222
|
throw new TypeError("The `context` option must be an object");
|
|
223
|
-
|
|
224
|
-
...
|
|
225
|
-
context:
|
|
223
|
+
e = {
|
|
224
|
+
...e,
|
|
225
|
+
context: u == null ? {} : { ...e.context, ...u }
|
|
226
226
|
};
|
|
227
227
|
continue;
|
|
228
228
|
}
|
|
229
229
|
if (a === "searchParams") {
|
|
230
|
-
|
|
230
|
+
u == null ? r = void 0 : r = r === void 0 ? u : vt(r, u);
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
P(u) && a in e && (u = ae(e[a], u)), e = { ...e, [a]: u };
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
P(o.hooks) && (n = je(n, o.hooks), e.hooks = n), P(o.headers) && (s = ze(s, o.headers), e.headers = s);
|
|
236
236
|
}
|
|
237
|
-
return r !== void 0 && (
|
|
238
|
-
},
|
|
237
|
+
return r !== void 0 && (e.searchParams = r), i.length > 0 && (i.length === 1 ? e.signal = i[0] : Le ? e.signal = AbortSignal.any(i) : e.signal = i.at(-1)), e.context === void 0 && (e.context = {}), e;
|
|
238
|
+
}, kt = (t) => Fe.includes(t) ? t.toUpperCase() : t, xt = ["get", "put", "head", "delete", "options", "trace"], Nt = [408, 413, 429, 500, 502, 503, 504], Ot = [413, 429, 503], we = {
|
|
239
239
|
limit: 2,
|
|
240
|
-
methods:
|
|
241
|
-
statusCodes:
|
|
242
|
-
afterStatusCodes:
|
|
240
|
+
methods: xt,
|
|
241
|
+
statusCodes: Nt,
|
|
242
|
+
afterStatusCodes: Ot,
|
|
243
243
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
244
244
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
245
|
-
delay: (
|
|
245
|
+
delay: (t) => 0.3 * 2 ** (t - 1) * 1e3,
|
|
246
246
|
jitter: void 0,
|
|
247
247
|
retryOnTimeout: !1
|
|
248
|
-
},
|
|
249
|
-
if (typeof
|
|
248
|
+
}, Bt = (t = {}) => {
|
|
249
|
+
if (typeof t == "number")
|
|
250
250
|
return {
|
|
251
|
-
...
|
|
252
|
-
limit:
|
|
251
|
+
...we,
|
|
252
|
+
limit: t
|
|
253
253
|
};
|
|
254
|
-
if (
|
|
254
|
+
if (t.methods && !Array.isArray(t.methods))
|
|
255
255
|
throw new Error("retry.methods must be an array");
|
|
256
|
-
if (
|
|
256
|
+
if (t.statusCodes && !Array.isArray(t.statusCodes))
|
|
257
257
|
throw new Error("retry.statusCodes must be an array");
|
|
258
258
|
return {
|
|
259
|
-
...
|
|
260
|
-
...
|
|
259
|
+
...we,
|
|
260
|
+
...t
|
|
261
261
|
};
|
|
262
262
|
};
|
|
263
|
-
class
|
|
263
|
+
class te extends Error {
|
|
264
264
|
request;
|
|
265
|
-
constructor(
|
|
266
|
-
super(`Request timed out: ${
|
|
265
|
+
constructor(e) {
|
|
266
|
+
super(`Request timed out: ${e.method} ${e.url}`), this.name = "TimeoutError", this.request = e;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
269
|
+
async function Mt(t, e, 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 te(t));
|
|
273
273
|
}, n.timeout);
|
|
274
|
-
n.fetch(
|
|
274
|
+
n.fetch(t, e).then(r).catch(i).then(() => {
|
|
275
275
|
clearTimeout(o);
|
|
276
276
|
});
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
async function
|
|
279
|
+
async function Lt(t, { signal: e }) {
|
|
280
280
|
return new Promise((s, n) => {
|
|
281
|
-
|
|
281
|
+
e && (e.throwIfAborted(), e.addEventListener("abort", r, { once: !0 }));
|
|
282
282
|
function r() {
|
|
283
|
-
clearTimeout(i), n(
|
|
283
|
+
clearTimeout(i), n(e.reason);
|
|
284
284
|
}
|
|
285
285
|
const i = setTimeout(() => {
|
|
286
|
-
|
|
287
|
-
},
|
|
286
|
+
e?.removeEventListener("abort", r), s();
|
|
287
|
+
}, t);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const Ft = (t, e) => {
|
|
291
291
|
const s = {};
|
|
292
|
-
for (const n in
|
|
293
|
-
Object.hasOwn(
|
|
292
|
+
for (const n in e)
|
|
293
|
+
Object.hasOwn(e, n) && !(n in Dt) && !(n in Ct) && (!(n in t) || n in At) && (s[n] = e[n]);
|
|
294
294
|
return s;
|
|
295
|
-
},
|
|
296
|
-
function
|
|
297
|
-
return
|
|
298
|
-
}
|
|
299
|
-
function
|
|
300
|
-
return
|
|
301
|
-
}
|
|
302
|
-
class
|
|
303
|
-
static create(
|
|
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 ${
|
|
295
|
+
}, _t = (t) => t === void 0 ? !1 : Array.isArray(t) ? t.length > 0 : t instanceof URLSearchParams ? t.size > 0 : typeof t == "object" ? Object.keys(t).length > 0 : typeof t == "string" ? t.trim().length > 0 : !!t;
|
|
296
|
+
function Ht(t) {
|
|
297
|
+
return t instanceof ee || t?.name === ee.name;
|
|
298
|
+
}
|
|
299
|
+
function $t(t) {
|
|
300
|
+
return t instanceof te || t?.name === te.name;
|
|
301
|
+
}
|
|
302
|
+
class M {
|
|
303
|
+
static create(e, s) {
|
|
304
|
+
const n = new M(e, s), r = async () => {
|
|
305
|
+
if (typeof n.#e.timeout == "number" && n.#e.timeout > Y)
|
|
306
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${Y}`);
|
|
307
307
|
await Promise.resolve();
|
|
308
|
-
let o = await n.#
|
|
308
|
+
let o = await n.#m();
|
|
309
309
|
for (const a of n.#e.hooks.afterResponse) {
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
310
|
+
const u = n.#l(o.clone()), l = await a(n.request, n.#a(), u, { retryCount: n.#s });
|
|
311
|
+
if (l instanceof globalThis.Response && (o = l), l instanceof He)
|
|
312
312
|
throw await Promise.all([
|
|
313
|
-
|
|
313
|
+
u.body?.cancel(),
|
|
314
314
|
o.body?.cancel()
|
|
315
|
-
]), new
|
|
315
|
+
]), new V(l.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
|
|
319
|
-
for (const
|
|
320
|
-
a = await
|
|
318
|
+
let a = new ee(o, n.request, n.#a());
|
|
319
|
+
for (const u of n.#e.hooks.beforeError)
|
|
320
|
+
a = await u(a, { retryCount: n.#s });
|
|
321
321
|
throw a;
|
|
322
322
|
}
|
|
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 (!Et)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
|
-
return
|
|
328
|
+
return It(o.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
330
330
|
return o;
|
|
331
|
-
}, i = n.#
|
|
331
|
+
}, i = n.#d(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(St))
|
|
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
|
-
const
|
|
338
|
+
const u = await i;
|
|
339
339
|
if (o === "json") {
|
|
340
|
-
if (
|
|
340
|
+
if (u.status === 204)
|
|
341
341
|
return "";
|
|
342
|
-
const
|
|
343
|
-
return
|
|
342
|
+
const l = await u.text();
|
|
343
|
+
return l === "" ? "" : s.parseJson ? s.parseJson(l) : JSON.parse(l);
|
|
344
344
|
}
|
|
345
|
-
return
|
|
345
|
+
return u[o]();
|
|
346
346
|
});
|
|
347
347
|
return i;
|
|
348
348
|
}
|
|
349
349
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
350
|
-
static #
|
|
351
|
-
return
|
|
350
|
+
static #h(e) {
|
|
351
|
+
return e && typeof e == "object" && !Array.isArray(e) && !(e instanceof URLSearchParams) ? Object.fromEntries(Object.entries(e).filter(([, s]) => s !== void 0)) : e;
|
|
352
352
|
}
|
|
353
353
|
request;
|
|
354
354
|
#n;
|
|
@@ -360,20 +360,20 @@ class N {
|
|
|
360
360
|
#r;
|
|
361
361
|
#i;
|
|
362
362
|
// eslint-disable-next-line complexity
|
|
363
|
-
constructor(
|
|
364
|
-
if (this.#t =
|
|
363
|
+
constructor(e, s = {}) {
|
|
364
|
+
if (this.#t = e, this.#e = {
|
|
365
365
|
...s,
|
|
366
|
-
headers:
|
|
367
|
-
hooks:
|
|
366
|
+
headers: ze(this.#t.headers, s.headers),
|
|
367
|
+
hooks: je({
|
|
368
368
|
beforeRequest: [],
|
|
369
369
|
beforeRetry: [],
|
|
370
370
|
beforeError: [],
|
|
371
371
|
afterResponse: []
|
|
372
372
|
}, s.hooks),
|
|
373
|
-
method:
|
|
373
|
+
method: kt(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: Bt(s.retry),
|
|
377
377
|
throwHttpErrors: s.throwHttpErrors ?? !0,
|
|
378
378
|
timeout: s.timeout ?? 1e4,
|
|
379
379
|
fetch: s.fetch ?? globalThis.fetch.bind(globalThis),
|
|
@@ -385,68 +385,68 @@ 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
|
+
bt && Le && (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 && (Tt && 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), _t(this.#e.searchParams)) {
|
|
391
|
+
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(M.#h(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
|
-
this.request = this.#
|
|
399
|
+
this.request = this.#f(this.request, this.#e.body ?? void 0);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
#c() {
|
|
403
|
-
const
|
|
404
|
-
let s =
|
|
405
|
-
return this.#e.retry.jitter === !0 ? s = Math.random() *
|
|
403
|
+
const e = this.#e.retry.delay(this.#s);
|
|
404
|
+
let s = e;
|
|
405
|
+
return this.#e.retry.jitter === !0 ? s = Math.random() * e : typeof this.#e.retry.jitter == "function" && (s = this.#e.retry.jitter(e), (!Number.isFinite(s) || s < 0) && (s = e)), Math.min(this.#e.retry.backoffLimit, s);
|
|
406
406
|
}
|
|
407
|
-
async #
|
|
407
|
+
async #g(e) {
|
|
408
408
|
if (this.#s++, this.#s > this.#e.retry.limit)
|
|
409
|
-
throw
|
|
410
|
-
const s =
|
|
411
|
-
if (s instanceof
|
|
409
|
+
throw e;
|
|
410
|
+
const s = e instanceof Error ? e : new Me(e);
|
|
411
|
+
if (s instanceof V)
|
|
412
412
|
return s.customDelay ?? this.#c();
|
|
413
413
|
if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
|
|
414
|
-
throw
|
|
414
|
+
throw e;
|
|
415
415
|
if (this.#e.retry.shouldRetry !== void 0) {
|
|
416
416
|
const n = await this.#e.retry.shouldRetry({ error: s, retryCount: this.#s });
|
|
417
417
|
if (n === !1)
|
|
418
|
-
throw
|
|
418
|
+
throw e;
|
|
419
419
|
if (n === !0)
|
|
420
420
|
return this.#c();
|
|
421
421
|
}
|
|
422
|
-
if (
|
|
423
|
-
throw
|
|
424
|
-
if (
|
|
425
|
-
if (!this.#e.retry.statusCodes.includes(
|
|
426
|
-
throw
|
|
427
|
-
const n =
|
|
428
|
-
if (n && this.#e.retry.afterStatusCodes.includes(
|
|
422
|
+
if ($t(e) && !this.#e.retry.retryOnTimeout)
|
|
423
|
+
throw e;
|
|
424
|
+
if (Ht(e)) {
|
|
425
|
+
if (!this.#e.retry.statusCodes.includes(e.response.status))
|
|
426
|
+
throw e;
|
|
427
|
+
const n = e.response.headers.get("Retry-After") ?? e.response.headers.get("RateLimit-Reset") ?? e.response.headers.get("X-RateLimit-Retry-After") ?? e.response.headers.get("X-RateLimit-Reset") ?? e.response.headers.get("X-Rate-Limit-Reset");
|
|
428
|
+
if (n && this.#e.retry.afterStatusCodes.includes(e.response.status)) {
|
|
429
429
|
let r = Number(n) * 1e3;
|
|
430
430
|
Number.isNaN(r) ? r = Date.parse(n) - Date.now() : r >= Date.parse("2024-01-01") && (r -= Date.now());
|
|
431
431
|
const i = this.#e.retry.maxRetryAfter ?? r;
|
|
432
432
|
return r < i ? r : i;
|
|
433
433
|
}
|
|
434
|
-
if (
|
|
435
|
-
throw
|
|
434
|
+
if (e.response.status === 413)
|
|
435
|
+
throw e;
|
|
436
436
|
}
|
|
437
437
|
return this.#c();
|
|
438
438
|
}
|
|
439
|
-
#l(
|
|
440
|
-
return this.#e.parseJson && (
|
|
439
|
+
#l(e) {
|
|
440
|
+
return this.#e.parseJson && (e.json = async () => this.#e.parseJson(await e.text())), e;
|
|
441
441
|
}
|
|
442
|
-
async #
|
|
442
|
+
async #d(e) {
|
|
443
443
|
try {
|
|
444
|
-
return await
|
|
444
|
+
return await e();
|
|
445
445
|
} catch (s) {
|
|
446
|
-
const n = Math.min(await this.#
|
|
446
|
+
const n = Math.min(await this.#g(s), Y);
|
|
447
447
|
if (this.#s < 1)
|
|
448
448
|
throw s;
|
|
449
|
-
if (await
|
|
449
|
+
if (await Lt(n, this.#r ? { signal: this.#r } : {}), s instanceof V && 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,13 +463,13 @@ class N {
|
|
|
463
463
|
}
|
|
464
464
|
if (i instanceof globalThis.Response)
|
|
465
465
|
return i;
|
|
466
|
-
if (i ===
|
|
466
|
+
if (i === _e)
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
|
-
return this.#
|
|
469
|
+
return this.#d(e);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
async #
|
|
472
|
+
async #m() {
|
|
473
473
|
this.#n?.signal.aborted && (this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal, this.request = new globalThis.Request(this.request, { signal: this.#e.signal }));
|
|
474
474
|
for (const s of this.#e.hooks.beforeRequest) {
|
|
475
475
|
const n = await s(this.request, this.#a(), { retryCount: this.#s });
|
|
@@ -480,113 +480,88 @@ class N {
|
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
const
|
|
484
|
-
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o,
|
|
483
|
+
const e = Ft(this.request, this.#e);
|
|
484
|
+
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, e) : Mt(this.#o, e, this.#n, this.#e);
|
|
485
485
|
}
|
|
486
486
|
#a() {
|
|
487
487
|
if (!this.#i) {
|
|
488
|
-
const { hooks:
|
|
488
|
+
const { hooks: e, ...s } = this.#e;
|
|
489
489
|
this.#i = Object.freeze(s);
|
|
490
490
|
}
|
|
491
491
|
return this.#i;
|
|
492
492
|
}
|
|
493
|
-
#u(
|
|
494
|
-
this.#i = void 0, this.request = this.#
|
|
493
|
+
#u(e) {
|
|
494
|
+
this.#i = void 0, this.request = this.#f(e);
|
|
495
495
|
}
|
|
496
|
-
#
|
|
497
|
-
return !this.#e.onUploadProgress || !
|
|
496
|
+
#f(e, s) {
|
|
497
|
+
return !this.#e.onUploadProgress || !e.body ? e : Pt(e, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
|
-
const
|
|
502
|
-
const
|
|
503
|
-
for (const s of
|
|
504
|
-
|
|
505
|
-
return
|
|
506
|
-
},
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}, Xe = {
|
|
545
|
-
type: "evm",
|
|
546
|
-
chainId: 11155111,
|
|
547
|
-
name: "Ethereum Sepolia",
|
|
548
|
-
cctpDomain: 0,
|
|
549
|
-
logoURI: "/images/chains/ethereum.svg"
|
|
550
|
-
}, Je = {
|
|
551
|
-
type: "evm",
|
|
552
|
-
chainId: 43114,
|
|
553
|
-
name: "Avalanche",
|
|
554
|
-
cctpDomain: 1,
|
|
555
|
-
logoURI: "/images/chains/avalanche.svg"
|
|
556
|
-
}, Ge = {
|
|
557
|
-
type: "evm",
|
|
558
|
-
chainId: 43113,
|
|
559
|
-
name: "Avalanche Fuji",
|
|
560
|
-
cctpDomain: 1,
|
|
561
|
-
logoURI: "/images/chains/avalanche.svg"
|
|
562
|
-
}, Ze = {
|
|
563
|
-
type: "starknet",
|
|
564
|
-
chainId: "0x534e5f4d41494e",
|
|
565
|
-
// SN_MAIN
|
|
566
|
-
name: "Starknet",
|
|
567
|
-
cctpDomain: null,
|
|
568
|
-
logoURI: "/images/chains/starknet.svg"
|
|
501
|
+
const se = (t) => {
|
|
502
|
+
const e = (s, n) => M.create(s, F(t, n));
|
|
503
|
+
for (const s of Fe)
|
|
504
|
+
e[s] = (n, r) => M.create(n, F(t, r, { method: s }));
|
|
505
|
+
return e.create = (s) => se(F(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), se(F(t, s))), e.stop = _e, e.retry = Rt, e;
|
|
506
|
+
}, zt = se(), b = {
|
|
507
|
+
ARBITRUM: "ARBITRUM_MAINNET",
|
|
508
|
+
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
509
|
+
AVALANCHE: "AVALANCHE_MAINNET",
|
|
510
|
+
AVALANCHE_TESTNET: "AVALANCHE_TESTNET",
|
|
511
|
+
BASE: "BASE_MAINNET",
|
|
512
|
+
BASE_TESTNET: "BASE_TESTNET",
|
|
513
|
+
BSC: "BSC_MAINNET",
|
|
514
|
+
ETHEREUM: "ETHEREUM_MAINNET",
|
|
515
|
+
ETHEREUM_TESTNET: "ETHEREUM_TESTNET",
|
|
516
|
+
HYPEREVM: "HYPEREVM_MAINNET",
|
|
517
|
+
LISK: "LISK_MAINNET",
|
|
518
|
+
MONAD: "MONAD_MAINNET",
|
|
519
|
+
MONAD_TESTNET: "MONAD_TESTNET",
|
|
520
|
+
OPTIMISM: "OPTIMISM_MAINNET",
|
|
521
|
+
OPTIMISM_TESTNET: "OPTIMISM_TESTNET",
|
|
522
|
+
POLYGON: "POLYGON_MAINNET",
|
|
523
|
+
STARKNET: "STARKNET_MAINNET",
|
|
524
|
+
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
525
|
+
}, un = {
|
|
526
|
+
ARBITRUM: "ARBITRUM",
|
|
527
|
+
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
528
|
+
AVALANCHE: "AVALANCHE",
|
|
529
|
+
AVALANCHE_TESTNET: "AVALANCHE_TESTNET",
|
|
530
|
+
BASE: "BASE",
|
|
531
|
+
BASE_TESTNET: "BASE_TESTNET",
|
|
532
|
+
BSC: "BSC",
|
|
533
|
+
ETHEREUM: "ETHEREUM",
|
|
534
|
+
ETHEREUM_TESTNET: "ETHEREUM_TESTNET",
|
|
535
|
+
HYPEREVM: "HYPEREVM",
|
|
536
|
+
LISK: "LISK",
|
|
537
|
+
MONAD: "MONAD",
|
|
538
|
+
MONAD_TESTNET: "MONAD_TESTNET",
|
|
539
|
+
OPTIMISM: "OPTIMISM",
|
|
540
|
+
OPTIMISM_TESTNET: "OPTIMISM_TESTNET",
|
|
541
|
+
POLYGON: "POLYGON",
|
|
542
|
+
STARKNET: "STARKNET",
|
|
543
|
+
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
569
544
|
};
|
|
570
|
-
function
|
|
571
|
-
return !
|
|
545
|
+
function ce(t, { strict: e = !0 } = {}) {
|
|
546
|
+
return !t || typeof t != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x");
|
|
572
547
|
}
|
|
573
|
-
function
|
|
574
|
-
return
|
|
548
|
+
function Re(t) {
|
|
549
|
+
return ce(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
|
|
575
550
|
}
|
|
576
|
-
const
|
|
577
|
-
let
|
|
578
|
-
getDocsUrl: ({ docsBaseUrl:
|
|
579
|
-
version: `viem@${
|
|
551
|
+
const qe = "2.43.4";
|
|
552
|
+
let G = {
|
|
553
|
+
getDocsUrl: ({ docsBaseUrl: t, docsPath: e = "", docsSlug: s }) => e ? `${t ?? "https://viem.sh"}${e}${s ? `#${s}` : ""}` : void 0,
|
|
554
|
+
version: `viem@${qe}`
|
|
580
555
|
};
|
|
581
|
-
class
|
|
582
|
-
constructor(
|
|
583
|
-
const n = s.cause instanceof
|
|
584
|
-
|
|
556
|
+
class U extends Error {
|
|
557
|
+
constructor(e, s = {}) {
|
|
558
|
+
const n = s.cause instanceof U ? s.cause.details : s.cause?.message ? s.cause.message : s.details, r = s.cause instanceof U && s.cause.docsPath || s.docsPath, i = G.getDocsUrl?.({ ...s, docsPath: r }), o = [
|
|
559
|
+
e || "An error occurred.",
|
|
585
560
|
"",
|
|
586
561
|
...s.metaMessages ? [...s.metaMessages, ""] : [],
|
|
587
562
|
...i ? [`Docs: ${i}`] : [],
|
|
588
563
|
...n ? [`Details: ${n}`] : [],
|
|
589
|
-
...
|
|
564
|
+
...G.version ? [`Version: ${G.version}`] : []
|
|
590
565
|
].join(`
|
|
591
566
|
`);
|
|
592
567
|
super(o, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -619,95 +594,95 @@ class v extends Error {
|
|
|
619
594
|
configurable: !0,
|
|
620
595
|
writable: !0,
|
|
621
596
|
value: "BaseError"
|
|
622
|
-
}), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage =
|
|
597
|
+
}), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = e, this.version = qe;
|
|
623
598
|
}
|
|
624
|
-
walk(
|
|
625
|
-
return
|
|
599
|
+
walk(e) {
|
|
600
|
+
return Ke(this, e);
|
|
626
601
|
}
|
|
627
602
|
}
|
|
628
|
-
function
|
|
629
|
-
return
|
|
603
|
+
function Ke(t, e) {
|
|
604
|
+
return e?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause !== void 0 ? Ke(t.cause, e) : e ? null : t;
|
|
630
605
|
}
|
|
631
|
-
class
|
|
632
|
-
constructor({ size:
|
|
633
|
-
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${
|
|
606
|
+
class We extends U {
|
|
607
|
+
constructor({ size: e, targetSize: s, type: n }) {
|
|
608
|
+
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
634
609
|
}
|
|
635
610
|
}
|
|
636
|
-
function
|
|
637
|
-
return typeof
|
|
611
|
+
function K(t, { dir: e, size: s = 32 } = {}) {
|
|
612
|
+
return typeof t == "string" ? jt(t, { dir: e, size: s }) : qt(t, { dir: e, size: s });
|
|
638
613
|
}
|
|
639
|
-
function
|
|
614
|
+
function jt(t, { dir: e, size: s = 32 } = {}) {
|
|
640
615
|
if (s === null)
|
|
641
|
-
return
|
|
642
|
-
const n =
|
|
616
|
+
return t;
|
|
617
|
+
const n = t.replace("0x", "");
|
|
643
618
|
if (n.length > s * 2)
|
|
644
|
-
throw new
|
|
619
|
+
throw new We({
|
|
645
620
|
size: Math.ceil(n.length / 2),
|
|
646
621
|
targetSize: s,
|
|
647
622
|
type: "hex"
|
|
648
623
|
});
|
|
649
|
-
return `0x${n[
|
|
624
|
+
return `0x${n[e === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
|
|
650
625
|
}
|
|
651
|
-
function
|
|
626
|
+
function qt(t, { dir: e, size: s = 32 } = {}) {
|
|
652
627
|
if (s === null)
|
|
653
|
-
return
|
|
654
|
-
if (
|
|
655
|
-
throw new
|
|
656
|
-
size:
|
|
628
|
+
return t;
|
|
629
|
+
if (t.length > s)
|
|
630
|
+
throw new We({
|
|
631
|
+
size: t.length,
|
|
657
632
|
targetSize: s,
|
|
658
633
|
type: "bytes"
|
|
659
634
|
});
|
|
660
635
|
const n = new Uint8Array(s);
|
|
661
636
|
for (let r = 0; r < s; r++) {
|
|
662
|
-
const i =
|
|
663
|
-
n[i ? r : s - r - 1] =
|
|
637
|
+
const i = e === "right";
|
|
638
|
+
n[i ? r : s - r - 1] = t[i ? r : t.length - r - 1];
|
|
664
639
|
}
|
|
665
640
|
return n;
|
|
666
641
|
}
|
|
667
|
-
class
|
|
668
|
-
constructor({ max:
|
|
669
|
-
super(`Number "${i}" is not in safe ${r ? `${r * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${
|
|
642
|
+
class Kt extends U {
|
|
643
|
+
constructor({ max: e, min: s, signed: n, size: r, value: i }) {
|
|
644
|
+
super(`Number "${i}" is not in safe ${r ? `${r * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${s} to ${e})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
|
|
670
645
|
}
|
|
671
646
|
}
|
|
672
|
-
class
|
|
673
|
-
constructor({ givenSize:
|
|
674
|
-
super(`Size cannot exceed ${s} bytes. Given size: ${
|
|
647
|
+
class Wt extends U {
|
|
648
|
+
constructor({ givenSize: e, maxSize: s }) {
|
|
649
|
+
super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
|
|
675
650
|
}
|
|
676
651
|
}
|
|
677
|
-
function
|
|
678
|
-
if (
|
|
679
|
-
throw new
|
|
680
|
-
givenSize:
|
|
681
|
-
maxSize:
|
|
652
|
+
function ue(t, { size: e }) {
|
|
653
|
+
if (Re(t) > e)
|
|
654
|
+
throw new Wt({
|
|
655
|
+
givenSize: Re(t),
|
|
656
|
+
maxSize: e
|
|
682
657
|
});
|
|
683
658
|
}
|
|
684
|
-
function
|
|
685
|
-
const { signed: s, size: n } =
|
|
659
|
+
function Vt(t, e = {}) {
|
|
660
|
+
const { signed: s, size: n } = e, r = BigInt(t);
|
|
686
661
|
let i;
|
|
687
|
-
n ? s ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof
|
|
662
|
+
n ? s ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof t == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
|
|
688
663
|
const o = typeof i == "bigint" && s ? -i - 1n : 0;
|
|
689
664
|
if (i && r > i || r < o) {
|
|
690
|
-
const
|
|
691
|
-
throw new
|
|
692
|
-
max: i ? `${i}${
|
|
693
|
-
min: `${o}${
|
|
665
|
+
const u = typeof t == "bigint" ? "n" : "";
|
|
666
|
+
throw new Kt({
|
|
667
|
+
max: i ? `${i}${u}` : void 0,
|
|
668
|
+
min: `${o}${u}`,
|
|
694
669
|
signed: s,
|
|
695
670
|
size: n,
|
|
696
|
-
value: `${
|
|
671
|
+
value: `${t}${u}`
|
|
697
672
|
});
|
|
698
673
|
}
|
|
699
674
|
const a = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`;
|
|
700
|
-
return n ?
|
|
675
|
+
return n ? K(a, { size: n }) : a;
|
|
701
676
|
}
|
|
702
|
-
const
|
|
703
|
-
function
|
|
704
|
-
return typeof
|
|
677
|
+
const Yt = /* @__PURE__ */ new TextEncoder();
|
|
678
|
+
function Gt(t, e = {}) {
|
|
679
|
+
return typeof t == "number" || typeof t == "bigint" ? Jt(t, e) : typeof t == "boolean" ? Xt(t, e) : ce(t) ? Ve(t, e) : Ye(t, e);
|
|
705
680
|
}
|
|
706
|
-
function
|
|
681
|
+
function Xt(t, e = {}) {
|
|
707
682
|
const s = new Uint8Array(1);
|
|
708
|
-
return s[0] = Number(
|
|
683
|
+
return s[0] = Number(t), typeof e.size == "number" ? (ue(s, { size: e.size }), K(s, { size: e.size })) : s;
|
|
709
684
|
}
|
|
710
|
-
const
|
|
685
|
+
const A = {
|
|
711
686
|
zero: 48,
|
|
712
687
|
nine: 57,
|
|
713
688
|
A: 65,
|
|
@@ -715,161 +690,161 @@ const T = {
|
|
|
715
690
|
a: 97,
|
|
716
691
|
f: 102
|
|
717
692
|
};
|
|
718
|
-
function
|
|
719
|
-
if (
|
|
720
|
-
return
|
|
721
|
-
if (
|
|
722
|
-
return
|
|
723
|
-
if (
|
|
724
|
-
return
|
|
725
|
-
}
|
|
726
|
-
function
|
|
727
|
-
let s =
|
|
728
|
-
|
|
693
|
+
function Ce(t) {
|
|
694
|
+
if (t >= A.zero && t <= A.nine)
|
|
695
|
+
return t - A.zero;
|
|
696
|
+
if (t >= A.A && t <= A.F)
|
|
697
|
+
return t - (A.A - 10);
|
|
698
|
+
if (t >= A.a && t <= A.f)
|
|
699
|
+
return t - (A.a - 10);
|
|
700
|
+
}
|
|
701
|
+
function Ve(t, e = {}) {
|
|
702
|
+
let s = t;
|
|
703
|
+
e.size && (ue(s, { size: e.size }), s = K(s, { dir: "right", size: e.size }));
|
|
729
704
|
let n = s.slice(2);
|
|
730
705
|
n.length % 2 && (n = `0${n}`);
|
|
731
706
|
const r = n.length / 2, i = new Uint8Array(r);
|
|
732
707
|
for (let o = 0, a = 0; o < r; o++) {
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
735
|
-
throw new
|
|
736
|
-
i[o] =
|
|
708
|
+
const u = Ce(n.charCodeAt(a++)), l = Ce(n.charCodeAt(a++));
|
|
709
|
+
if (u === void 0 || l === void 0)
|
|
710
|
+
throw new U(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
|
|
711
|
+
i[o] = u * 16 + l;
|
|
737
712
|
}
|
|
738
713
|
return i;
|
|
739
714
|
}
|
|
740
|
-
function
|
|
741
|
-
const s =
|
|
742
|
-
return
|
|
715
|
+
function Jt(t, e) {
|
|
716
|
+
const s = Vt(t, e);
|
|
717
|
+
return Ve(s);
|
|
743
718
|
}
|
|
744
|
-
function
|
|
745
|
-
const s =
|
|
746
|
-
return typeof
|
|
719
|
+
function Ye(t, e = {}) {
|
|
720
|
+
const s = Yt.encode(t);
|
|
721
|
+
return typeof e.size == "number" ? (ue(s, { size: e.size }), K(s, { dir: "right", size: e.size })) : s;
|
|
747
722
|
}
|
|
748
|
-
const
|
|
749
|
-
function
|
|
750
|
-
return
|
|
723
|
+
const H = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ae = /* @__PURE__ */ BigInt(32);
|
|
724
|
+
function Zt(t, e = !1) {
|
|
725
|
+
return e ? { h: Number(t & H), l: Number(t >> Ae & H) } : { h: Number(t >> Ae & H) | 0, l: Number(t & H) | 0 };
|
|
751
726
|
}
|
|
752
|
-
function
|
|
753
|
-
const s =
|
|
727
|
+
function Qt(t, e = !1) {
|
|
728
|
+
const s = t.length;
|
|
754
729
|
let n = new Uint32Array(s), r = new Uint32Array(s);
|
|
755
730
|
for (let i = 0; i < s; i++) {
|
|
756
|
-
const { h: o, l: a } =
|
|
731
|
+
const { h: o, l: a } = Zt(t[i], e);
|
|
757
732
|
[n[i], r[i]] = [o, a];
|
|
758
733
|
}
|
|
759
734
|
return [n, r];
|
|
760
735
|
}
|
|
761
|
-
const
|
|
736
|
+
const es = (t, e, s) => t << s | e >>> 32 - s, ts = (t, e, s) => e << s | t >>> 32 - s, ss = (t, e, s) => e << s - 32 | t >>> 64 - s, ns = (t, e, s) => t << s - 32 | e >>> 64 - s;
|
|
762
737
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
763
|
-
function
|
|
764
|
-
return
|
|
738
|
+
function rs(t) {
|
|
739
|
+
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
765
740
|
}
|
|
766
|
-
function
|
|
767
|
-
if (!Number.isSafeInteger(
|
|
768
|
-
throw new Error("positive integer expected, got " +
|
|
741
|
+
function De(t) {
|
|
742
|
+
if (!Number.isSafeInteger(t) || t < 0)
|
|
743
|
+
throw new Error("positive integer expected, got " + t);
|
|
769
744
|
}
|
|
770
|
-
function
|
|
771
|
-
if (!
|
|
745
|
+
function $(t, ...e) {
|
|
746
|
+
if (!rs(t))
|
|
772
747
|
throw new Error("Uint8Array expected");
|
|
773
|
-
if (
|
|
774
|
-
throw new Error("Uint8Array expected of length " +
|
|
748
|
+
if (e.length > 0 && !e.includes(t.length))
|
|
749
|
+
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
775
750
|
}
|
|
776
|
-
function
|
|
777
|
-
if (
|
|
751
|
+
function Ue(t, e = !0) {
|
|
752
|
+
if (t.destroyed)
|
|
778
753
|
throw new Error("Hash instance has been destroyed");
|
|
779
|
-
if (
|
|
754
|
+
if (e && t.finished)
|
|
780
755
|
throw new Error("Hash#digest() has already been called");
|
|
781
756
|
}
|
|
782
|
-
function
|
|
783
|
-
|
|
784
|
-
const s =
|
|
785
|
-
if (
|
|
757
|
+
function os(t, e) {
|
|
758
|
+
$(t);
|
|
759
|
+
const s = e.outputLen;
|
|
760
|
+
if (t.length < s)
|
|
786
761
|
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
787
762
|
}
|
|
788
|
-
function
|
|
789
|
-
return new Uint32Array(
|
|
763
|
+
function is(t) {
|
|
764
|
+
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
790
765
|
}
|
|
791
|
-
function
|
|
792
|
-
for (let
|
|
793
|
-
e
|
|
766
|
+
function Ge(...t) {
|
|
767
|
+
for (let e = 0; e < t.length; e++)
|
|
768
|
+
t[e].fill(0);
|
|
794
769
|
}
|
|
795
|
-
const
|
|
796
|
-
function
|
|
797
|
-
return
|
|
770
|
+
const as = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
771
|
+
function cs(t) {
|
|
772
|
+
return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
798
773
|
}
|
|
799
|
-
function
|
|
800
|
-
for (let
|
|
801
|
-
e
|
|
802
|
-
return
|
|
774
|
+
function us(t) {
|
|
775
|
+
for (let e = 0; e < t.length; e++)
|
|
776
|
+
t[e] = cs(t[e]);
|
|
777
|
+
return t;
|
|
803
778
|
}
|
|
804
|
-
const
|
|
805
|
-
function
|
|
806
|
-
if (typeof
|
|
779
|
+
const Ie = as ? (t) => t : us;
|
|
780
|
+
function ls(t) {
|
|
781
|
+
if (typeof t != "string")
|
|
807
782
|
throw new Error("string expected");
|
|
808
|
-
return new Uint8Array(new TextEncoder().encode(
|
|
783
|
+
return new Uint8Array(new TextEncoder().encode(t));
|
|
809
784
|
}
|
|
810
|
-
function
|
|
811
|
-
return typeof
|
|
785
|
+
function Xe(t) {
|
|
786
|
+
return typeof t == "string" && (t = ls(t)), $(t), t;
|
|
812
787
|
}
|
|
813
|
-
class
|
|
788
|
+
class ds {
|
|
814
789
|
}
|
|
815
|
-
function
|
|
816
|
-
const
|
|
817
|
-
return
|
|
790
|
+
function fs(t) {
|
|
791
|
+
const e = (n) => t().update(Xe(n)).digest(), s = t();
|
|
792
|
+
return e.outputLen = s.outputLen, e.blockLen = s.blockLen, e.create = () => t(), e;
|
|
818
793
|
}
|
|
819
|
-
const
|
|
820
|
-
for (let
|
|
821
|
-
[s, n] = [n, (2 * s + 3 * n) % 5],
|
|
822
|
-
let r =
|
|
794
|
+
const hs = BigInt(0), N = BigInt(1), gs = BigInt(2), ms = BigInt(7), ps = BigInt(256), ys = BigInt(113), Je = [], Ze = [], Qe = [];
|
|
795
|
+
for (let t = 0, e = N, s = 1, n = 0; t < 24; t++) {
|
|
796
|
+
[s, n] = [n, (2 * s + 3 * n) % 5], Je.push(2 * (5 * n + s)), Ze.push((t + 1) * (t + 2) / 2 % 64);
|
|
797
|
+
let r = hs;
|
|
823
798
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
|
|
825
|
-
|
|
799
|
+
e = (e << N ^ (e >> ms) * ys) % ps, e & gs && (r ^= N << (N << /* @__PURE__ */ BigInt(i)) - N);
|
|
800
|
+
Qe.push(r);
|
|
826
801
|
}
|
|
827
|
-
const
|
|
828
|
-
function
|
|
802
|
+
const et = Qt(Qe, !0), bs = et[0], Es = et[1], Pe = (t, e, s) => s > 32 ? ss(t, e, s) : es(t, e, s), ve = (t, e, s) => s > 32 ? ns(t, e, s) : ts(t, e, s);
|
|
803
|
+
function Ts(t, e = 24) {
|
|
829
804
|
const s = new Uint32Array(10);
|
|
830
|
-
for (let n = 24 -
|
|
805
|
+
for (let n = 24 - e; n < 24; n++) {
|
|
831
806
|
for (let o = 0; o < 10; o++)
|
|
832
|
-
s[o] =
|
|
807
|
+
s[o] = t[o] ^ t[o + 10] ^ t[o + 20] ^ t[o + 30] ^ t[o + 40];
|
|
833
808
|
for (let o = 0; o < 10; o += 2) {
|
|
834
|
-
const a = (o + 8) % 10,
|
|
835
|
-
for (let
|
|
836
|
-
|
|
809
|
+
const a = (o + 8) % 10, u = (o + 2) % 10, l = s[u], d = s[u + 1], T = Pe(l, d, 1) ^ s[a], m = ve(l, d, 1) ^ s[a + 1];
|
|
810
|
+
for (let y = 0; y < 50; y += 10)
|
|
811
|
+
t[o + y] ^= T, t[o + y + 1] ^= m;
|
|
837
812
|
}
|
|
838
|
-
let r =
|
|
813
|
+
let r = t[2], i = t[3];
|
|
839
814
|
for (let o = 0; o < 24; o++) {
|
|
840
|
-
const a =
|
|
841
|
-
r =
|
|
815
|
+
const a = Ze[o], u = Pe(r, i, a), l = ve(r, i, a), d = Je[o];
|
|
816
|
+
r = t[d], i = t[d + 1], t[d] = u, t[d + 1] = l;
|
|
842
817
|
}
|
|
843
818
|
for (let o = 0; o < 50; o += 10) {
|
|
844
819
|
for (let a = 0; a < 10; a++)
|
|
845
|
-
s[a] =
|
|
820
|
+
s[a] = t[o + a];
|
|
846
821
|
for (let a = 0; a < 10; a++)
|
|
847
|
-
|
|
822
|
+
t[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
848
823
|
}
|
|
849
|
-
|
|
824
|
+
t[0] ^= bs[n], t[1] ^= Es[n];
|
|
850
825
|
}
|
|
851
|
-
|
|
826
|
+
Ge(s);
|
|
852
827
|
}
|
|
853
|
-
class
|
|
828
|
+
class le extends ds {
|
|
854
829
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
855
|
-
constructor(
|
|
856
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen =
|
|
830
|
+
constructor(e, s, n, r = !1, i = 24) {
|
|
831
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = s, this.outputLen = n, this.enableXOF = r, this.rounds = i, De(n), !(0 < e && e < 200))
|
|
857
832
|
throw new Error("only keccak-f1600 function is supported");
|
|
858
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
833
|
+
this.state = new Uint8Array(200), this.state32 = is(this.state);
|
|
859
834
|
}
|
|
860
835
|
clone() {
|
|
861
836
|
return this._cloneInto();
|
|
862
837
|
}
|
|
863
838
|
keccak() {
|
|
864
|
-
|
|
839
|
+
Ie(this.state32), Ts(this.state32, this.rounds), Ie(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
840
|
}
|
|
866
|
-
update(
|
|
867
|
-
|
|
868
|
-
const { blockLen: s, state: n } = this, r =
|
|
841
|
+
update(e) {
|
|
842
|
+
Ue(this), e = Xe(e), $(e);
|
|
843
|
+
const { blockLen: s, state: n } = this, r = e.length;
|
|
869
844
|
for (let i = 0; i < r; ) {
|
|
870
845
|
const o = Math.min(s - this.pos, r - i);
|
|
871
846
|
for (let a = 0; a < o; a++)
|
|
872
|
-
n[this.pos++] ^=
|
|
847
|
+
n[this.pos++] ^= e[i++];
|
|
873
848
|
this.pos === s && this.keccak();
|
|
874
849
|
}
|
|
875
850
|
return this;
|
|
@@ -878,50 +853,50 @@ class ce extends Es {
|
|
|
878
853
|
if (this.finished)
|
|
879
854
|
return;
|
|
880
855
|
this.finished = !0;
|
|
881
|
-
const { state:
|
|
882
|
-
|
|
856
|
+
const { state: e, suffix: s, pos: n, blockLen: r } = this;
|
|
857
|
+
e[n] ^= s, (s & 128) !== 0 && n === r - 1 && this.keccak(), e[r - 1] ^= 128, this.keccak();
|
|
883
858
|
}
|
|
884
|
-
writeInto(
|
|
885
|
-
|
|
859
|
+
writeInto(e) {
|
|
860
|
+
Ue(this, !1), $(e), this.finish();
|
|
886
861
|
const s = this.state, { blockLen: n } = this;
|
|
887
|
-
for (let r = 0, i =
|
|
862
|
+
for (let r = 0, i = e.length; r < i; ) {
|
|
888
863
|
this.posOut >= n && this.keccak();
|
|
889
864
|
const o = Math.min(n - this.posOut, i - r);
|
|
890
|
-
|
|
865
|
+
e.set(s.subarray(this.posOut, this.posOut + o), r), this.posOut += o, r += o;
|
|
891
866
|
}
|
|
892
|
-
return
|
|
867
|
+
return e;
|
|
893
868
|
}
|
|
894
|
-
xofInto(
|
|
869
|
+
xofInto(e) {
|
|
895
870
|
if (!this.enableXOF)
|
|
896
871
|
throw new Error("XOF is not possible for this instance");
|
|
897
|
-
return this.writeInto(
|
|
872
|
+
return this.writeInto(e);
|
|
898
873
|
}
|
|
899
|
-
xof(
|
|
900
|
-
return
|
|
874
|
+
xof(e) {
|
|
875
|
+
return De(e), this.xofInto(new Uint8Array(e));
|
|
901
876
|
}
|
|
902
|
-
digestInto(
|
|
903
|
-
if (
|
|
877
|
+
digestInto(e) {
|
|
878
|
+
if (os(e, this), this.finished)
|
|
904
879
|
throw new Error("digest() was already called");
|
|
905
|
-
return this.writeInto(
|
|
880
|
+
return this.writeInto(e), this.destroy(), e;
|
|
906
881
|
}
|
|
907
882
|
digest() {
|
|
908
883
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
909
884
|
}
|
|
910
885
|
destroy() {
|
|
911
|
-
this.destroyed = !0,
|
|
886
|
+
this.destroyed = !0, Ge(this.state);
|
|
912
887
|
}
|
|
913
|
-
_cloneInto(
|
|
888
|
+
_cloneInto(e) {
|
|
914
889
|
const { blockLen: s, suffix: n, outputLen: r, rounds: i, enableXOF: o } = this;
|
|
915
|
-
return
|
|
890
|
+
return e || (e = new le(s, n, r, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = n, e.outputLen = r, e.enableXOF = o, e.destroyed = this.destroyed, e;
|
|
916
891
|
}
|
|
917
892
|
}
|
|
918
|
-
const
|
|
919
|
-
function
|
|
920
|
-
return
|
|
893
|
+
const Ss = (t, e, s) => fs(() => new le(e, t, s)), ws = Ss(1, 136, 256 / 8);
|
|
894
|
+
function Rs(t, e) {
|
|
895
|
+
return ws(ce(t, { strict: !1 }) ? Gt(t) : t);
|
|
921
896
|
}
|
|
922
|
-
class
|
|
923
|
-
constructor({ address:
|
|
924
|
-
super(`Address "${
|
|
897
|
+
class Cs extends U {
|
|
898
|
+
constructor({ address: e }) {
|
|
899
|
+
super(`Address "${e}" is invalid.`, {
|
|
925
900
|
metaMessages: [
|
|
926
901
|
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
927
902
|
"- Address must match its checksum counterpart."
|
|
@@ -930,244 +905,612 @@ class Os extends v {
|
|
|
930
905
|
});
|
|
931
906
|
}
|
|
932
907
|
}
|
|
933
|
-
class
|
|
934
|
-
constructor(
|
|
908
|
+
class tt extends Map {
|
|
909
|
+
constructor(e) {
|
|
935
910
|
super(), Object.defineProperty(this, "maxSize", {
|
|
936
911
|
enumerable: !0,
|
|
937
912
|
configurable: !0,
|
|
938
913
|
writable: !0,
|
|
939
914
|
value: void 0
|
|
940
|
-
}), this.maxSize =
|
|
915
|
+
}), this.maxSize = e;
|
|
941
916
|
}
|
|
942
|
-
get(
|
|
943
|
-
const s = super.get(
|
|
944
|
-
return super.has(
|
|
917
|
+
get(e) {
|
|
918
|
+
const s = super.get(e);
|
|
919
|
+
return super.has(e) && s !== void 0 && (this.delete(e), super.set(e, s)), s;
|
|
945
920
|
}
|
|
946
|
-
set(
|
|
947
|
-
if (super.set(
|
|
921
|
+
set(e, s) {
|
|
922
|
+
if (super.set(e, s), this.maxSize && this.size > this.maxSize) {
|
|
948
923
|
const n = this.keys().next().value;
|
|
949
924
|
n && this.delete(n);
|
|
950
925
|
}
|
|
951
926
|
return this;
|
|
952
927
|
}
|
|
953
928
|
}
|
|
954
|
-
const
|
|
955
|
-
function
|
|
956
|
-
if (
|
|
957
|
-
return
|
|
958
|
-
const s =
|
|
929
|
+
const X = /* @__PURE__ */ new tt(8192);
|
|
930
|
+
function st(t, e) {
|
|
931
|
+
if (X.has(`${t}.${e}`))
|
|
932
|
+
return X.get(`${t}.${e}`);
|
|
933
|
+
const s = t.substring(2).toLowerCase(), n = Rs(Ye(s)), r = s.split("");
|
|
959
934
|
for (let o = 0; o < 40; o += 2)
|
|
960
935
|
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
936
|
const i = `0x${r.join("")}`;
|
|
962
|
-
return
|
|
963
|
-
}
|
|
964
|
-
function
|
|
965
|
-
if (!
|
|
966
|
-
throw new
|
|
967
|
-
return
|
|
968
|
-
}
|
|
969
|
-
const
|
|
970
|
-
function
|
|
971
|
-
const { strict: s = !0 } =
|
|
972
|
-
if (
|
|
973
|
-
return
|
|
974
|
-
const r =
|
|
975
|
-
return
|
|
976
|
-
}
|
|
977
|
-
const
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1024
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1025
|
-
}, _s = {
|
|
1026
|
-
chainId: Ve.chainId,
|
|
1027
|
-
address: R("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1028
|
-
symbol: "USDC",
|
|
1029
|
-
decimals: 18,
|
|
1030
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1031
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1032
|
-
}, Fs = {
|
|
1033
|
-
chainId: Xe.chainId,
|
|
1034
|
-
address: R("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1035
|
-
symbol: "USDC",
|
|
1036
|
-
decimals: 6,
|
|
1037
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1038
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1039
|
-
}, Hs = {
|
|
1040
|
-
chainId: Ye.chainId,
|
|
1041
|
-
address: R("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1042
|
-
symbol: "USDC",
|
|
1043
|
-
decimals: 6,
|
|
1044
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1045
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1046
|
-
}, Ks = {
|
|
1047
|
-
chainId: Ze.chainId,
|
|
1048
|
-
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
1049
|
-
symbol: "USDC",
|
|
1050
|
-
decimals: 6,
|
|
1051
|
-
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1052
|
-
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1053
|
-
}, Ue = {
|
|
1054
|
-
ARBITRUM_MAINNET: {
|
|
1055
|
-
...Fe,
|
|
1056
|
-
tokens: {
|
|
1057
|
-
[S.USDC]: $s
|
|
937
|
+
return X.set(`${t}.${e}`, i), i;
|
|
938
|
+
}
|
|
939
|
+
function w(t, e) {
|
|
940
|
+
if (!Ds(t, { strict: !1 }))
|
|
941
|
+
throw new Cs({ address: t });
|
|
942
|
+
return st(t, e);
|
|
943
|
+
}
|
|
944
|
+
const As = /^0x[a-fA-F0-9]{40}$/, J = /* @__PURE__ */ new tt(8192);
|
|
945
|
+
function Ds(t, e) {
|
|
946
|
+
const { strict: s = !0 } = e ?? {}, n = `${t}.${s}`;
|
|
947
|
+
if (J.has(n))
|
|
948
|
+
return J.get(n);
|
|
949
|
+
const r = As.test(t) ? t.toLowerCase() === t ? !0 : s ? st(t) === t : !0 : !1;
|
|
950
|
+
return J.set(n, r), r;
|
|
951
|
+
}
|
|
952
|
+
const c = {
|
|
953
|
+
USDC: "USDC",
|
|
954
|
+
USDT: "USDT",
|
|
955
|
+
DAI: "DAI",
|
|
956
|
+
BUSD: "BUSD",
|
|
957
|
+
EURC: "EURC",
|
|
958
|
+
ETH: "ETH",
|
|
959
|
+
WETH: "WETH",
|
|
960
|
+
STRK: "STRK",
|
|
961
|
+
BNB: "BNB",
|
|
962
|
+
LORDS: "LORDS"
|
|
963
|
+
};
|
|
964
|
+
c.USDC;
|
|
965
|
+
const nt = {
|
|
966
|
+
[b.ARBITRUM]: {
|
|
967
|
+
[c.DAI]: {
|
|
968
|
+
address: w("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
969
|
+
symbol: c.DAI,
|
|
970
|
+
name: "Dai Stablecoin",
|
|
971
|
+
decimals: 18,
|
|
972
|
+
logoURI: "/images/tokens/dai.png"
|
|
973
|
+
/* DAI */
|
|
974
|
+
},
|
|
975
|
+
[c.ETH]: {
|
|
976
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
977
|
+
symbol: c.ETH,
|
|
978
|
+
name: "Ethereum",
|
|
979
|
+
decimals: 18,
|
|
980
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
981
|
+
/* ETH */
|
|
982
|
+
},
|
|
983
|
+
[c.USDC]: {
|
|
984
|
+
address: w("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
985
|
+
symbol: c.USDC,
|
|
986
|
+
name: "USD Coin",
|
|
987
|
+
decimals: 6,
|
|
988
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
989
|
+
/* USDC */
|
|
990
|
+
},
|
|
991
|
+
[c.USDT]: {
|
|
992
|
+
address: w("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
993
|
+
symbol: c.USDT,
|
|
994
|
+
name: "Tether USD",
|
|
995
|
+
decimals: 6,
|
|
996
|
+
logoURI: "/images/tokens/usdt.png"
|
|
997
|
+
/* USDT */
|
|
1058
998
|
},
|
|
1059
|
-
|
|
999
|
+
[c.WETH]: {
|
|
1000
|
+
address: w("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
1001
|
+
symbol: c.WETH,
|
|
1002
|
+
name: "Wrapped Ether",
|
|
1003
|
+
decimals: 18,
|
|
1004
|
+
logoURI: "/images/tokens/weth.png"
|
|
1005
|
+
/* WETH */
|
|
1006
|
+
}
|
|
1060
1007
|
},
|
|
1061
|
-
ARBITRUM_TESTNET: {
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1008
|
+
[b.ARBITRUM_TESTNET]: {
|
|
1009
|
+
[c.USDC]: {
|
|
1010
|
+
address: w("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
1011
|
+
symbol: c.USDC,
|
|
1012
|
+
name: "USD Coin",
|
|
1013
|
+
fiatISO: "USD",
|
|
1014
|
+
decimals: 6,
|
|
1015
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1016
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1066
1017
|
}
|
|
1067
1018
|
},
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1019
|
+
[b.AVALANCHE]: {
|
|
1020
|
+
[c.DAI]: {
|
|
1021
|
+
address: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
|
|
1022
|
+
symbol: c.DAI,
|
|
1023
|
+
name: "Dai Stablecoin",
|
|
1024
|
+
decimals: 18,
|
|
1025
|
+
logoURI: "/images/tokens/dai.png"
|
|
1026
|
+
/* DAI */
|
|
1072
1027
|
},
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1028
|
+
[c.USDC]: {
|
|
1029
|
+
address: w("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
1030
|
+
symbol: c.USDC,
|
|
1031
|
+
name: "USD Coin",
|
|
1032
|
+
fiatISO: "USD",
|
|
1033
|
+
decimals: 6,
|
|
1034
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1035
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1036
|
+
},
|
|
1037
|
+
[c.USDT]: {
|
|
1038
|
+
address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
|
|
1039
|
+
symbol: c.USDT,
|
|
1040
|
+
name: "Tether USD",
|
|
1041
|
+
decimals: 6,
|
|
1042
|
+
logoURI: "/images/tokens/usdt.png"
|
|
1043
|
+
/* USDT */
|
|
1079
1044
|
},
|
|
1080
|
-
|
|
1045
|
+
[c.WETH]: {
|
|
1046
|
+
address: "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
|
|
1047
|
+
symbol: c.WETH,
|
|
1048
|
+
name: "Wrapped Ether",
|
|
1049
|
+
decimals: 18,
|
|
1050
|
+
logoURI: "/images/tokens/weth.png"
|
|
1051
|
+
/* WETH */
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
[b.AVALANCHE_TESTNET]: {
|
|
1055
|
+
[c.USDC]: {
|
|
1056
|
+
address: w("0x5425890298aed601595a70AB815c96711a31Bc65"),
|
|
1057
|
+
symbol: c.USDC,
|
|
1058
|
+
name: "USD Coin",
|
|
1059
|
+
fiatISO: "USD",
|
|
1060
|
+
decimals: 6,
|
|
1061
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1062
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1063
|
+
}
|
|
1081
1064
|
},
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1065
|
+
[b.BASE]: {
|
|
1066
|
+
[c.DAI]: {
|
|
1067
|
+
address: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
|
|
1068
|
+
symbol: c.DAI,
|
|
1069
|
+
name: "Dai Stablecoin",
|
|
1070
|
+
decimals: 18,
|
|
1071
|
+
logoURI: "/images/tokens/dai.png"
|
|
1072
|
+
/* DAI */
|
|
1073
|
+
},
|
|
1074
|
+
[c.ETH]: {
|
|
1075
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
1076
|
+
symbol: c.ETH,
|
|
1077
|
+
name: "Ethereum",
|
|
1078
|
+
decimals: 18,
|
|
1079
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
1080
|
+
/* ETH */
|
|
1086
1081
|
},
|
|
1087
|
-
|
|
1082
|
+
[c.EURC]: {
|
|
1083
|
+
address: "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
|
|
1084
|
+
symbol: c.EURC,
|
|
1085
|
+
name: "Euro Coin",
|
|
1086
|
+
decimals: 6,
|
|
1087
|
+
logoURI: "/images/tokens/eurc.png"
|
|
1088
|
+
/* EURC */
|
|
1089
|
+
},
|
|
1090
|
+
[c.USDC]: {
|
|
1091
|
+
address: w("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
1092
|
+
symbol: c.USDC,
|
|
1093
|
+
name: "USD Coin",
|
|
1094
|
+
fiatISO: "USD",
|
|
1095
|
+
decimals: 6,
|
|
1096
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1097
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1098
|
+
},
|
|
1099
|
+
[c.WETH]: {
|
|
1100
|
+
address: w("0x4200000000000000000000000000000000000006"),
|
|
1101
|
+
symbol: c.WETH,
|
|
1102
|
+
name: "Wrapped Ether",
|
|
1103
|
+
decimals: 18,
|
|
1104
|
+
logoURI: "/images/tokens/weth.png"
|
|
1105
|
+
/* WETH */
|
|
1106
|
+
}
|
|
1088
1107
|
},
|
|
1089
|
-
BASE_TESTNET: {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1108
|
+
[b.BASE_TESTNET]: {
|
|
1109
|
+
[c.USDC]: {
|
|
1110
|
+
address: w("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
1111
|
+
symbol: c.USDC,
|
|
1112
|
+
name: "USD Coin",
|
|
1113
|
+
fiatISO: "USD",
|
|
1114
|
+
decimals: 6,
|
|
1115
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1116
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
[b.BSC]: {
|
|
1120
|
+
[c.BNB]: {
|
|
1121
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
1122
|
+
symbol: c.BNB,
|
|
1123
|
+
name: "BNB",
|
|
1124
|
+
decimals: 18,
|
|
1125
|
+
logoURI: "/images/chains/bsc.webp"
|
|
1126
|
+
/* BNB */
|
|
1127
|
+
},
|
|
1128
|
+
[c.BUSD]: {
|
|
1129
|
+
address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
|
|
1130
|
+
symbol: c.BUSD,
|
|
1131
|
+
name: "Binance USD",
|
|
1132
|
+
decimals: 18,
|
|
1133
|
+
logoURI: "/images/tokens/busd.png"
|
|
1134
|
+
/* BUSD */
|
|
1135
|
+
},
|
|
1136
|
+
[c.DAI]: {
|
|
1137
|
+
address: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",
|
|
1138
|
+
symbol: c.DAI,
|
|
1139
|
+
name: "Dai Stablecoin",
|
|
1140
|
+
decimals: 18,
|
|
1141
|
+
logoURI: "/images/tokens/dai.png"
|
|
1142
|
+
/* DAI */
|
|
1093
1143
|
},
|
|
1094
|
-
|
|
1144
|
+
[c.ETH]: {
|
|
1145
|
+
address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
|
|
1146
|
+
symbol: c.ETH,
|
|
1147
|
+
name: "Ethereum",
|
|
1148
|
+
decimals: 18,
|
|
1149
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
1150
|
+
/* ETH */
|
|
1151
|
+
},
|
|
1152
|
+
[c.USDC]: {
|
|
1153
|
+
address: w("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1154
|
+
symbol: c.USDC,
|
|
1155
|
+
decimals: 18,
|
|
1156
|
+
name: "USD Coin",
|
|
1157
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1158
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1159
|
+
},
|
|
1160
|
+
[c.USDT]: {
|
|
1161
|
+
address: "0x55d398326f99059fF775485246999027B3197955",
|
|
1162
|
+
symbol: c.USDT,
|
|
1163
|
+
name: "Tether USD",
|
|
1164
|
+
decimals: 18,
|
|
1165
|
+
logoURI: "/images/tokens/usdt.png"
|
|
1166
|
+
/* USDT */
|
|
1167
|
+
}
|
|
1095
1168
|
},
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1169
|
+
[b.ETHEREUM]: {
|
|
1170
|
+
[c.BUSD]: {
|
|
1171
|
+
address: "0x4Fabb145d64652a948d72533023f6E7A623C7C53",
|
|
1172
|
+
symbol: c.BUSD,
|
|
1173
|
+
name: "Binance USD",
|
|
1174
|
+
decimals: 18,
|
|
1175
|
+
logoURI: "/images/tokens/busd.png"
|
|
1176
|
+
/* BUSD */
|
|
1100
1177
|
},
|
|
1101
|
-
|
|
1178
|
+
[c.DAI]: {
|
|
1179
|
+
address: w("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
|
|
1180
|
+
symbol: c.DAI,
|
|
1181
|
+
name: "Dai Stablecoin",
|
|
1182
|
+
decimals: 18,
|
|
1183
|
+
logoURI: "/images/tokens/dai.png"
|
|
1184
|
+
/* DAI */
|
|
1185
|
+
},
|
|
1186
|
+
[c.ETH]: {
|
|
1187
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
1188
|
+
symbol: c.ETH,
|
|
1189
|
+
name: "Ethereum",
|
|
1190
|
+
decimals: 18,
|
|
1191
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
1192
|
+
/* ETH */
|
|
1193
|
+
},
|
|
1194
|
+
[c.EURC]: {
|
|
1195
|
+
address: "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",
|
|
1196
|
+
symbol: c.EURC,
|
|
1197
|
+
name: "Euro Coin",
|
|
1198
|
+
decimals: 6,
|
|
1199
|
+
logoURI: "/images/tokens/eurc.png"
|
|
1200
|
+
/* EURC */
|
|
1201
|
+
},
|
|
1202
|
+
[c.STRK]: {
|
|
1203
|
+
address: "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",
|
|
1204
|
+
symbol: c.STRK,
|
|
1205
|
+
name: "Starknet Token",
|
|
1206
|
+
decimals: 18,
|
|
1207
|
+
logoURI: "/images/chains/starknet.svg"
|
|
1208
|
+
/* STRK */
|
|
1209
|
+
},
|
|
1210
|
+
[c.USDC]: {
|
|
1211
|
+
address: w("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1212
|
+
symbol: c.USDC,
|
|
1213
|
+
name: "USD Coin",
|
|
1214
|
+
decimals: 6,
|
|
1215
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1216
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1217
|
+
},
|
|
1218
|
+
[c.USDT]: {
|
|
1219
|
+
address: w("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
1220
|
+
symbol: c.USDT,
|
|
1221
|
+
name: "Tether USD",
|
|
1222
|
+
decimals: 6,
|
|
1223
|
+
logoURI: "/images/tokens/usdt.png"
|
|
1224
|
+
/* USDT */
|
|
1225
|
+
},
|
|
1226
|
+
[c.WETH]: {
|
|
1227
|
+
address: w("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
1228
|
+
symbol: c.WETH,
|
|
1229
|
+
name: "Wrapped Ether",
|
|
1230
|
+
decimals: 18,
|
|
1231
|
+
logoURI: "/images/tokens/weth.png"
|
|
1232
|
+
/* WETH */
|
|
1233
|
+
}
|
|
1102
1234
|
},
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1235
|
+
[b.ETHEREUM_TESTNET]: {
|
|
1236
|
+
[c.USDC]: {
|
|
1237
|
+
address: w("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1238
|
+
symbol: c.USDC,
|
|
1239
|
+
decimals: 6,
|
|
1240
|
+
name: "USD Coin",
|
|
1241
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1242
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
1245
|
+
[b.HYPEREVM]: {
|
|
1246
|
+
[c.USDC]: {
|
|
1247
|
+
address: "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
1248
|
+
symbol: c.USDC,
|
|
1249
|
+
name: "USD Coin",
|
|
1250
|
+
decimals: 6,
|
|
1251
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1252
|
+
/* USDC */
|
|
1253
|
+
}
|
|
1254
|
+
},
|
|
1255
|
+
[b.LISK]: {
|
|
1256
|
+
[c.USDC]: {
|
|
1257
|
+
address: "0xF242275d3a6527d877f2c927a82D9b057609cc71",
|
|
1258
|
+
symbol: c.USDC,
|
|
1259
|
+
name: "USD Coin",
|
|
1260
|
+
decimals: 6,
|
|
1261
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1262
|
+
/* USDC */
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
[b.MONAD]: {
|
|
1266
|
+
[c.USDC]: {
|
|
1267
|
+
address: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
|
|
1268
|
+
symbol: c.USDC,
|
|
1269
|
+
name: "USD Coin",
|
|
1270
|
+
decimals: 6,
|
|
1271
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1272
|
+
/* USDC */
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
[b.MONAD_TESTNET]: {
|
|
1276
|
+
[c.USDC]: {
|
|
1277
|
+
address: "0x534b2f3A21130d7a60830c2Df862319e593943A3",
|
|
1278
|
+
symbol: c.USDC,
|
|
1279
|
+
name: "USD Coin",
|
|
1280
|
+
decimals: 6,
|
|
1281
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1282
|
+
/* USDC */
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1285
|
+
[b.OPTIMISM]: {
|
|
1286
|
+
[c.DAI]: {
|
|
1287
|
+
address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
|
|
1288
|
+
symbol: c.DAI,
|
|
1289
|
+
name: "Dai Stablecoin",
|
|
1290
|
+
decimals: 18,
|
|
1291
|
+
logoURI: "/images/tokens/dai.png"
|
|
1292
|
+
/* DAI */
|
|
1293
|
+
},
|
|
1294
|
+
[c.ETH]: {
|
|
1295
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
1296
|
+
symbol: c.ETH,
|
|
1297
|
+
name: "Ethereum",
|
|
1298
|
+
decimals: 18,
|
|
1299
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
1300
|
+
/* ETH */
|
|
1107
1301
|
},
|
|
1108
|
-
|
|
1302
|
+
[c.USDC]: {
|
|
1303
|
+
address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
|
1304
|
+
symbol: c.USDC,
|
|
1305
|
+
name: "USD Coin",
|
|
1306
|
+
decimals: 6,
|
|
1307
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1308
|
+
/* USDC */
|
|
1309
|
+
},
|
|
1310
|
+
[c.USDT]: {
|
|
1311
|
+
address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
|
|
1312
|
+
symbol: c.USDT,
|
|
1313
|
+
name: "Tether USD",
|
|
1314
|
+
decimals: 6,
|
|
1315
|
+
logoURI: "/images/tokens/usdt.png"
|
|
1316
|
+
/* USDT */
|
|
1317
|
+
},
|
|
1318
|
+
[c.WETH]: {
|
|
1319
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
1320
|
+
symbol: c.WETH,
|
|
1321
|
+
name: "Wrapped Ether",
|
|
1322
|
+
decimals: 18,
|
|
1323
|
+
logoURI: "/images/tokens/weth.png"
|
|
1324
|
+
/* WETH */
|
|
1325
|
+
}
|
|
1109
1326
|
},
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1327
|
+
[b.OPTIMISM_TESTNET]: {
|
|
1328
|
+
[c.USDC]: {
|
|
1329
|
+
address: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7",
|
|
1330
|
+
symbol: c.USDC,
|
|
1331
|
+
name: "USD Coin",
|
|
1332
|
+
decimals: 6,
|
|
1333
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1334
|
+
/* USDC */
|
|
1335
|
+
}
|
|
1336
|
+
},
|
|
1337
|
+
[b.POLYGON]: {
|
|
1338
|
+
[c.DAI]: {
|
|
1339
|
+
address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
|
|
1340
|
+
symbol: c.DAI,
|
|
1341
|
+
name: "Dai Stablecoin",
|
|
1342
|
+
decimals: 18,
|
|
1343
|
+
logoURI: "/images/tokens/dai.png"
|
|
1344
|
+
/* DAI */
|
|
1345
|
+
},
|
|
1346
|
+
[c.USDC]: {
|
|
1347
|
+
address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
1348
|
+
symbol: c.USDC,
|
|
1349
|
+
name: "USD Coin",
|
|
1350
|
+
decimals: 6,
|
|
1351
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1352
|
+
/* USDC */
|
|
1353
|
+
},
|
|
1354
|
+
[c.USDT]: {
|
|
1355
|
+
address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
|
|
1356
|
+
symbol: c.USDT,
|
|
1357
|
+
name: "Tether USD",
|
|
1358
|
+
decimals: 6,
|
|
1359
|
+
logoURI: "/images/tokens/usdt.png"
|
|
1360
|
+
/* USDT */
|
|
1114
1361
|
},
|
|
1115
|
-
|
|
1362
|
+
[c.WETH]: {
|
|
1363
|
+
address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
|
|
1364
|
+
symbol: c.WETH,
|
|
1365
|
+
name: "Wrapped Ether",
|
|
1366
|
+
decimals: 18,
|
|
1367
|
+
logoURI: "/images/tokens/weth.png"
|
|
1368
|
+
/* WETH */
|
|
1369
|
+
}
|
|
1116
1370
|
},
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1371
|
+
[b.STARKNET]: {
|
|
1372
|
+
[c.DAI]: {
|
|
1373
|
+
address: "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",
|
|
1374
|
+
symbol: c.DAI,
|
|
1375
|
+
name: "Dai Stablecoin",
|
|
1376
|
+
decimals: 18,
|
|
1377
|
+
logoURI: "/images/tokens/dai.png"
|
|
1378
|
+
/* DAI */
|
|
1379
|
+
},
|
|
1380
|
+
[c.ETH]: {
|
|
1381
|
+
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
1382
|
+
symbol: c.ETH,
|
|
1383
|
+
name: "Ethereum",
|
|
1384
|
+
decimals: 18,
|
|
1385
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
1386
|
+
/* ETH */
|
|
1387
|
+
},
|
|
1388
|
+
[c.LORDS]: {
|
|
1389
|
+
address: "0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",
|
|
1390
|
+
symbol: c.LORDS,
|
|
1391
|
+
name: "LORDS Token",
|
|
1392
|
+
decimals: 18,
|
|
1393
|
+
logoURI: "/images/tokens/lords.png"
|
|
1394
|
+
/* LORDS */
|
|
1121
1395
|
},
|
|
1122
|
-
|
|
1396
|
+
[c.STRK]: {
|
|
1397
|
+
address: "0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",
|
|
1398
|
+
symbol: c.STRK,
|
|
1399
|
+
name: "Starknet Token",
|
|
1400
|
+
decimals: 18,
|
|
1401
|
+
logoURI: "/images/chains/starknet.svg"
|
|
1402
|
+
/* STRK */
|
|
1403
|
+
},
|
|
1404
|
+
[c.USDC]: {
|
|
1405
|
+
address: "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
|
|
1406
|
+
symbol: c.USDC,
|
|
1407
|
+
name: "USD Coin",
|
|
1408
|
+
decimals: 6,
|
|
1409
|
+
logoURI: "/images/tokens/usdc.svg",
|
|
1410
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1411
|
+
},
|
|
1412
|
+
[c.USDT]: {
|
|
1413
|
+
address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
|
|
1414
|
+
symbol: c.USDT,
|
|
1415
|
+
name: "Tether USD",
|
|
1416
|
+
decimals: 6,
|
|
1417
|
+
logoURI: "/images/tokens/usdt.png"
|
|
1418
|
+
/* USDT */
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
[b.STARKNET_TESTNET]: {
|
|
1422
|
+
[c.USDC]: {
|
|
1423
|
+
address: "0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",
|
|
1424
|
+
symbol: c.USDC,
|
|
1425
|
+
name: "USD Coin",
|
|
1426
|
+
decimals: 6,
|
|
1427
|
+
logoURI: "/images/tokens/usdc.svg"
|
|
1428
|
+
/* USDC */
|
|
1429
|
+
}
|
|
1123
1430
|
}
|
|
1124
|
-
};
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
};
|
|
1131
|
-
|
|
1132
|
-
|
|
1431
|
+
}, Us = new Set(Object.values(b));
|
|
1432
|
+
function S(t) {
|
|
1433
|
+
if (Is(t))
|
|
1434
|
+
return t;
|
|
1435
|
+
const e = b[t];
|
|
1436
|
+
if (!e)
|
|
1437
|
+
throw new Error(`Invalid chain: ${t}. Chain must be a valid chain alias or internal chain value from Chains.`);
|
|
1438
|
+
return e;
|
|
1439
|
+
}
|
|
1440
|
+
function Is(t) {
|
|
1441
|
+
return Us.has(t);
|
|
1133
1442
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1443
|
+
function Ps(t, e) {
|
|
1444
|
+
const s = e.toLowerCase().trim(), n = nt[t];
|
|
1445
|
+
if (!n)
|
|
1446
|
+
throw new Error(
|
|
1447
|
+
`Chain not found: ${t}. The chain key must be a valid chain identifier.`
|
|
1448
|
+
);
|
|
1449
|
+
let r;
|
|
1450
|
+
for (const i in n) {
|
|
1451
|
+
const o = n[i];
|
|
1452
|
+
if (o && o.address.toLowerCase() === s.toLowerCase()) {
|
|
1453
|
+
r = o;
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1138
1456
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1457
|
+
if (!r)
|
|
1458
|
+
throw new Error(
|
|
1459
|
+
`Token address mismatch: address ${e} does not exist on chain ${t}. The token address must be a valid token address on the specified chain.`
|
|
1460
|
+
);
|
|
1461
|
+
return r;
|
|
1462
|
+
}
|
|
1463
|
+
function Z(t, e, s) {
|
|
1464
|
+
const n = Ps(t, e);
|
|
1465
|
+
if (n.symbol !== s)
|
|
1466
|
+
throw new Error(
|
|
1467
|
+
`Token address and symbol mismatch: address ${e} on chain ${t} corresponds to token "${n.symbol}", but expected "${s}". The token address must correspond to a token with the expected symbol on the specified chain.`
|
|
1468
|
+
);
|
|
1469
|
+
return n;
|
|
1470
|
+
}
|
|
1471
|
+
function vs(t, e) {
|
|
1472
|
+
return nt[t]?.[e];
|
|
1473
|
+
}
|
|
1474
|
+
function ks(t, e) {
|
|
1475
|
+
return vs(t, e)?.address;
|
|
1476
|
+
}
|
|
1477
|
+
var de = /* @__PURE__ */ ((t) => (t.PRODUCTION = "production", t.STAGING = "staging", t))(de || {});
|
|
1478
|
+
class g {
|
|
1479
|
+
constructor({ api_key: e, env: s, seesion_token: n, props: r }) {
|
|
1480
|
+
this.api_key = e || "", this.sessionToken = n || "", this.env = s ?? de.PRODUCTION, this.props = r;
|
|
1481
|
+
}
|
|
1482
|
+
static async config(e) {
|
|
1483
|
+
if (!g.app) {
|
|
1484
|
+
if (!e)
|
|
1142
1485
|
throw new Error("Please provide an api_key");
|
|
1143
|
-
|
|
1486
|
+
g.app = new g(e);
|
|
1144
1487
|
}
|
|
1145
|
-
return
|
|
1488
|
+
return e && (e.api_key !== void 0 && (g.app.api_key = e.api_key), e.seesion_token !== void 0 && (g.app.sessionToken = e.seesion_token), e.env !== void 0 && (g.app.env = e.env), e.props !== void 0 && (g.app.props = e.props)), g.app;
|
|
1146
1489
|
}
|
|
1147
1490
|
static getApiKey() {
|
|
1148
|
-
if (!
|
|
1491
|
+
if (!g.app)
|
|
1149
1492
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1150
|
-
return
|
|
1493
|
+
return g.app.api_key;
|
|
1151
1494
|
}
|
|
1152
1495
|
static getSessionToken() {
|
|
1153
|
-
if (!
|
|
1496
|
+
if (!g.app)
|
|
1154
1497
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1155
|
-
return
|
|
1498
|
+
return g.app.sessionToken;
|
|
1156
1499
|
}
|
|
1157
1500
|
static getProps() {
|
|
1158
|
-
if (!
|
|
1501
|
+
if (!g.app)
|
|
1159
1502
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1160
|
-
return
|
|
1503
|
+
return g.app.props;
|
|
1161
1504
|
}
|
|
1162
1505
|
static getEnv() {
|
|
1163
|
-
if (!
|
|
1506
|
+
if (!g.app)
|
|
1164
1507
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1165
|
-
return
|
|
1508
|
+
return g.app.env === "internal" ? "staging" : g.app.env;
|
|
1166
1509
|
}
|
|
1167
1510
|
static getBaseUrl() {
|
|
1168
|
-
if (!
|
|
1511
|
+
if (!g.app)
|
|
1169
1512
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1170
|
-
switch (
|
|
1513
|
+
switch (g.app.env) {
|
|
1171
1514
|
case "production":
|
|
1172
1515
|
return "https://api.chainrails.io/api/v1";
|
|
1173
1516
|
case "staging":
|
|
@@ -1178,352 +1521,411 @@ class d {
|
|
|
1178
1521
|
return "https://api.chainrails.io/api/v1";
|
|
1179
1522
|
}
|
|
1180
1523
|
}
|
|
1181
|
-
static getPayModalUrl(
|
|
1182
|
-
if (!
|
|
1524
|
+
static getPayModalUrl(e) {
|
|
1525
|
+
if (!g.app)
|
|
1183
1526
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1184
|
-
const s =
|
|
1527
|
+
const s = g.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = Number(e), r = e && !isNaN(Number(e)) && n > 0 ? "/pay/" : "/deposit/", i = `${e && !isNaN(Number(e)) && n > 0 ? n * 100 : ""}`;
|
|
1185
1528
|
return s + r + i;
|
|
1186
1529
|
}
|
|
1187
1530
|
}
|
|
1188
|
-
let
|
|
1189
|
-
function
|
|
1190
|
-
|
|
1191
|
-
prefixUrl:
|
|
1531
|
+
let ne = null;
|
|
1532
|
+
function xs() {
|
|
1533
|
+
ne = zt.create({
|
|
1534
|
+
prefixUrl: g.getBaseUrl(),
|
|
1192
1535
|
headers: {
|
|
1193
1536
|
"Content-Type": "application/json"
|
|
1194
1537
|
},
|
|
1195
1538
|
hooks: {
|
|
1196
1539
|
beforeRequest: [
|
|
1197
|
-
(
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1540
|
+
(t) => {
|
|
1541
|
+
const e = g.getSessionToken() || g.getApiKey();
|
|
1542
|
+
t.headers.set("Authorization", `Bearer ${e}`);
|
|
1200
1543
|
}
|
|
1201
1544
|
],
|
|
1202
|
-
afterResponse: [(
|
|
1545
|
+
afterResponse: [(t, e, s) => s]
|
|
1203
1546
|
},
|
|
1204
1547
|
retry: {
|
|
1205
1548
|
limit: 2
|
|
1206
1549
|
}
|
|
1207
1550
|
});
|
|
1208
1551
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return
|
|
1211
|
-
}
|
|
1212
|
-
class Xs {
|
|
1213
|
-
async getById(t) {
|
|
1214
|
-
return await g().get("intents/" + t).json();
|
|
1215
|
-
}
|
|
1216
|
-
async getForSender(t) {
|
|
1217
|
-
return await g().get("intents/user/" + t).json();
|
|
1218
|
-
}
|
|
1219
|
-
async getForAddress(t) {
|
|
1220
|
-
return await g().get("intents/address/" + t).json();
|
|
1221
|
-
}
|
|
1222
|
-
async getForSession(t) {
|
|
1223
|
-
return await g().get("modal/sessions/intents/" + t).json();
|
|
1224
|
-
}
|
|
1225
|
-
async getAll(t) {
|
|
1226
|
-
return await g().get("intents", { searchParams: t }).json();
|
|
1227
|
-
}
|
|
1228
|
-
async create(t) {
|
|
1229
|
-
return await g().post("intents", { json: t }).json();
|
|
1230
|
-
}
|
|
1231
|
-
async createForSession(t) {
|
|
1232
|
-
return await g().post("modal/sessions/intents", { json: t }).json();
|
|
1233
|
-
}
|
|
1234
|
-
async update(t, s) {
|
|
1235
|
-
return await g().post("intents", { json: s }).json();
|
|
1236
|
-
}
|
|
1237
|
-
async triggerProcessing(t) {
|
|
1238
|
-
return await g().post(`intents/${t}/trigger-processing`).json();
|
|
1239
|
-
}
|
|
1240
|
-
async triggerProcessingForSession(t) {
|
|
1241
|
-
return await g().post(`modal/sessions/intents/${t}/process`).json();
|
|
1242
|
-
}
|
|
1552
|
+
function p() {
|
|
1553
|
+
return ne || xs(), ne;
|
|
1243
1554
|
}
|
|
1244
|
-
class
|
|
1245
|
-
async
|
|
1246
|
-
return await
|
|
1555
|
+
class Ns {
|
|
1556
|
+
async getById(e) {
|
|
1557
|
+
return await p().get("intents/" + e).json();
|
|
1247
1558
|
}
|
|
1248
|
-
async
|
|
1249
|
-
return await
|
|
1559
|
+
async getForSender(e) {
|
|
1560
|
+
return await p().get("intents/user/" + e).json();
|
|
1250
1561
|
}
|
|
1251
|
-
async
|
|
1252
|
-
return await
|
|
1562
|
+
async getForAddress(e) {
|
|
1563
|
+
return await p().get("intents/address/" + e).json();
|
|
1253
1564
|
}
|
|
1254
|
-
async
|
|
1255
|
-
return await
|
|
1565
|
+
async getForSession(e) {
|
|
1566
|
+
return await p().get("modal/sessions/intents/" + e).json();
|
|
1256
1567
|
}
|
|
1257
|
-
async
|
|
1258
|
-
return await
|
|
1568
|
+
async getAll(e) {
|
|
1569
|
+
return await p().get("intents", { searchParams: e }).json();
|
|
1259
1570
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1571
|
+
async create(e) {
|
|
1572
|
+
const s = S(e.source_chain), n = S(e.destination_chain);
|
|
1573
|
+
return await p().post("intents", {
|
|
1574
|
+
json: {
|
|
1575
|
+
...e,
|
|
1576
|
+
source_chain: s,
|
|
1577
|
+
destination_chain: n
|
|
1578
|
+
}
|
|
1579
|
+
}).json();
|
|
1580
|
+
}
|
|
1581
|
+
async createForSession(e) {
|
|
1582
|
+
const s = S(e.sourceChain);
|
|
1583
|
+
return await p().post("modal/sessions/intents", {
|
|
1584
|
+
json: { ...e, sourceChain: s }
|
|
1585
|
+
}).json();
|
|
1586
|
+
}
|
|
1587
|
+
async update(e, s) {
|
|
1588
|
+
return await p().post("intents", { json: s }).json();
|
|
1589
|
+
}
|
|
1590
|
+
async triggerProcessing(e) {
|
|
1591
|
+
return await p().post(`intents/${e}/trigger-processing`).json();
|
|
1592
|
+
}
|
|
1593
|
+
async triggerProcessingForSession(e) {
|
|
1594
|
+
return await p().post(`modal/sessions/intents/${e}/process`).json();
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
class Os {
|
|
1598
|
+
async getFromSpecificBridge(e) {
|
|
1599
|
+
const s = S(e.sourceChain);
|
|
1600
|
+
Z(s, e.tokenIn, e.amountSymbol);
|
|
1601
|
+
const n = S(e.destinationChain);
|
|
1602
|
+
return await p().get("quotes/single", {
|
|
1603
|
+
searchParams: {
|
|
1604
|
+
...e,
|
|
1605
|
+
sourceChain: s,
|
|
1606
|
+
destinationChain: n
|
|
1607
|
+
}
|
|
1608
|
+
}).json();
|
|
1609
|
+
}
|
|
1610
|
+
async getFromAllBridges(e) {
|
|
1611
|
+
const s = S(e.sourceChain);
|
|
1612
|
+
Z(s, e.tokenIn, e.amountSymbol);
|
|
1613
|
+
const n = S(e.destinationChain);
|
|
1614
|
+
return await p().get("quotes/multiple", {
|
|
1615
|
+
searchParams: {
|
|
1616
|
+
...e,
|
|
1617
|
+
sourceChain: s,
|
|
1618
|
+
destinationChain: n
|
|
1619
|
+
}
|
|
1620
|
+
}).json();
|
|
1621
|
+
}
|
|
1622
|
+
async getBestAcrossBridges(e) {
|
|
1623
|
+
const s = S(e.sourceChain);
|
|
1624
|
+
Z(s, e.tokenIn, e.amountSymbol);
|
|
1625
|
+
const n = S(e.destinationChain);
|
|
1626
|
+
return await p().get("quotes/best", { searchParams: {
|
|
1627
|
+
...e,
|
|
1628
|
+
sourceChain: s,
|
|
1629
|
+
destinationChain: n
|
|
1630
|
+
} }).json();
|
|
1631
|
+
}
|
|
1632
|
+
async getAll(e) {
|
|
1633
|
+
const s = S(e.destinationChain);
|
|
1634
|
+
return await p().get("quotes/multi-source", { searchParams: {
|
|
1635
|
+
...e,
|
|
1636
|
+
destinationChain: s
|
|
1637
|
+
} }).json();
|
|
1638
|
+
}
|
|
1639
|
+
async getAllForSession(e) {
|
|
1640
|
+
return await p().get("modal/sessions/quotes", { searchParams: e }).json();
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
class Bs {
|
|
1644
|
+
async getOptimalRoutes(e) {
|
|
1645
|
+
const s = S(e.sourceChain), n = S(e.destinationChain);
|
|
1646
|
+
return await p().get("router/optimal-route", {
|
|
1647
|
+
searchParams: {
|
|
1648
|
+
...e,
|
|
1649
|
+
sourceChain: s,
|
|
1650
|
+
destinationChain: n
|
|
1651
|
+
}
|
|
1652
|
+
}).json();
|
|
1264
1653
|
}
|
|
1265
1654
|
async getAllSupportedBridges() {
|
|
1266
|
-
return await
|
|
1267
|
-
}
|
|
1268
|
-
async getSupportedBridges(
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1655
|
+
return await p().get("router/supported-bridges/all").json();
|
|
1656
|
+
}
|
|
1657
|
+
async getSupportedBridges(e) {
|
|
1658
|
+
const s = S(e.sourceChain), n = S(e.destinationChain);
|
|
1659
|
+
return await p().get("router/supported-bridges/route", { searchParams: {
|
|
1660
|
+
...e,
|
|
1661
|
+
sourceChain: s,
|
|
1662
|
+
destinationChain: n
|
|
1663
|
+
} }).json();
|
|
1664
|
+
}
|
|
1665
|
+
async getSupportedRoutes(e, s) {
|
|
1666
|
+
const n = S(s.sourceChain), r = S(s.destinationChain);
|
|
1667
|
+
return await p().get("router/supported-routes/bridge/" + e, { searchParams: {
|
|
1668
|
+
...s,
|
|
1669
|
+
sourceChain: n,
|
|
1670
|
+
destinationChain: r
|
|
1671
|
+
} }).json();
|
|
1273
1672
|
}
|
|
1274
1673
|
}
|
|
1275
|
-
class
|
|
1276
|
-
async getSupported(
|
|
1277
|
-
return await
|
|
1674
|
+
class Ms {
|
|
1675
|
+
async getSupported(e) {
|
|
1676
|
+
return await p().get("chains", { searchParams: e }).json();
|
|
1677
|
+
}
|
|
1678
|
+
async getBalance(e) {
|
|
1679
|
+
return await p().get(`chains/balances/${e.address}`, { searchParams: e }).json();
|
|
1278
1680
|
}
|
|
1279
1681
|
}
|
|
1280
|
-
class
|
|
1682
|
+
class Ls {
|
|
1281
1683
|
async getClientInfo() {
|
|
1282
|
-
return await
|
|
1684
|
+
return await p().get("client/auth/client-info").json();
|
|
1283
1685
|
}
|
|
1284
1686
|
async getClientInfoForSession() {
|
|
1285
|
-
return await
|
|
1687
|
+
return await p().get("modal/sessions/client").json();
|
|
1286
1688
|
}
|
|
1287
1689
|
}
|
|
1288
|
-
class
|
|
1289
|
-
getSessionToken(
|
|
1290
|
-
const s = {
|
|
1291
|
-
recipient:
|
|
1292
|
-
tokenOut:
|
|
1293
|
-
|
|
1294
|
-
|
|
1690
|
+
class Fs {
|
|
1691
|
+
async getSessionToken(e) {
|
|
1692
|
+
const s = S(e.destinationChain), n = {
|
|
1693
|
+
recipient: e.recipient,
|
|
1694
|
+
tokenOut: ks(
|
|
1695
|
+
s,
|
|
1696
|
+
e.token
|
|
1295
1697
|
),
|
|
1296
|
-
destinationChain:
|
|
1297
|
-
amount:
|
|
1698
|
+
destinationChain: s,
|
|
1699
|
+
amount: e.amount
|
|
1298
1700
|
};
|
|
1299
|
-
return
|
|
1701
|
+
return p().post("modal/sessions", { json: n }).json().then((r) => ({ ...r, amount: n.amount }));
|
|
1300
1702
|
}
|
|
1301
1703
|
}
|
|
1302
|
-
const
|
|
1303
|
-
router: new
|
|
1304
|
-
quotes: new
|
|
1305
|
-
intents: new
|
|
1306
|
-
chains: new
|
|
1307
|
-
client: new
|
|
1308
|
-
auth: new
|
|
1704
|
+
const ln = {
|
|
1705
|
+
router: new Bs(),
|
|
1706
|
+
quotes: new Os(),
|
|
1707
|
+
intents: new Ns(),
|
|
1708
|
+
chains: new Ms(),
|
|
1709
|
+
client: new Ls(),
|
|
1710
|
+
auth: new Fs()
|
|
1309
1711
|
};
|
|
1310
|
-
function
|
|
1311
|
-
var
|
|
1312
|
-
if (typeof
|
|
1313
|
-
else if (typeof
|
|
1314
|
-
var r =
|
|
1315
|
-
for (
|
|
1316
|
-
} else for (s in
|
|
1712
|
+
function rt(t) {
|
|
1713
|
+
var e, s, n = "";
|
|
1714
|
+
if (typeof t == "string" || typeof t == "number") n += t;
|
|
1715
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
1716
|
+
var r = t.length;
|
|
1717
|
+
for (e = 0; e < r; e++) t[e] && (s = rt(t[e])) && (n && (n += " "), n += s);
|
|
1718
|
+
} else for (s in t) t[s] && (n && (n += " "), n += s);
|
|
1317
1719
|
return n;
|
|
1318
1720
|
}
|
|
1319
|
-
function
|
|
1320
|
-
for (var
|
|
1721
|
+
function _s() {
|
|
1722
|
+
for (var t, e, s = 0, n = "", r = arguments.length; s < r; s++) (t = arguments[s]) && (e = rt(t)) && (n && (n += " "), n += e);
|
|
1321
1723
|
return n;
|
|
1322
1724
|
}
|
|
1323
|
-
function
|
|
1725
|
+
function dn(t) {
|
|
1324
1726
|
const {
|
|
1325
|
-
amount:
|
|
1727
|
+
amount: e,
|
|
1326
1728
|
styles: s,
|
|
1327
|
-
|
|
1729
|
+
excludeChains: n,
|
|
1328
1730
|
isOpen: r,
|
|
1329
1731
|
isPending: i,
|
|
1330
1732
|
open: o,
|
|
1331
1733
|
close: a,
|
|
1332
|
-
onCancel:
|
|
1333
|
-
onSuccess:
|
|
1334
|
-
session_url:
|
|
1335
|
-
sessionToken:
|
|
1336
|
-
} =
|
|
1337
|
-
|
|
1734
|
+
onCancel: u,
|
|
1735
|
+
onSuccess: l,
|
|
1736
|
+
session_url: d,
|
|
1737
|
+
sessionToken: T
|
|
1738
|
+
} = t, [m, y] = v(0), [R, W] = v(""), f = ie(null);
|
|
1739
|
+
g.config({
|
|
1338
1740
|
api_key: "",
|
|
1339
1741
|
// @ts-expect-error
|
|
1340
|
-
env:
|
|
1742
|
+
env: t.env === "internal" ? "internal" : "production"
|
|
1341
1743
|
}), x(() => {
|
|
1342
|
-
|
|
1343
|
-
}, [
|
|
1744
|
+
W(g.getPayModalUrl(e));
|
|
1745
|
+
}, [e]), x(() => {
|
|
1344
1746
|
const h = document.body.style.overflow;
|
|
1345
1747
|
r ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = h || "";
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1748
|
+
const C = (I) => {
|
|
1749
|
+
I.data === "closed" && (a(), u?.()), I.data === "completed" && (window.setTimeout(a, 2e3), l?.());
|
|
1348
1750
|
};
|
|
1349
|
-
return window.addEventListener("message",
|
|
1350
|
-
document.body.style.overflow = h || "", window.removeEventListener("message",
|
|
1751
|
+
return window.addEventListener("message", C), () => {
|
|
1752
|
+
document.body.style.overflow = h || "", window.removeEventListener("message", C);
|
|
1351
1753
|
};
|
|
1352
|
-
}, [r,
|
|
1353
|
-
if (!
|
|
1754
|
+
}, [r, u, l]), x(() => {
|
|
1755
|
+
if (!T) return;
|
|
1354
1756
|
const h = {
|
|
1355
1757
|
type: "session",
|
|
1356
|
-
session_token:
|
|
1357
|
-
environment:
|
|
1758
|
+
session_token: T,
|
|
1759
|
+
environment: g.getEnv() || de.PRODUCTION,
|
|
1358
1760
|
styles: s,
|
|
1359
1761
|
props: {
|
|
1360
|
-
|
|
1762
|
+
excludeChains: n?.join(",")
|
|
1361
1763
|
}
|
|
1362
1764
|
};
|
|
1363
1765
|
f.current?.contentWindow?.postMessage(h, "https://app.chainrails.io"), f.current?.contentWindow?.postMessage(h, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
|
|
1364
1766
|
f.current?.contentWindow?.postMessage(h, "https://app.chainrails.io"), f.current?.contentWindow?.postMessage(h, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1365
1767
|
}, 1e3);
|
|
1366
|
-
}, [
|
|
1367
|
-
function
|
|
1368
|
-
|
|
1768
|
+
}, [T, m, r, s]);
|
|
1769
|
+
function E() {
|
|
1770
|
+
y(Math.random());
|
|
1369
1771
|
}
|
|
1370
|
-
return /* @__PURE__ */
|
|
1371
|
-
className:
|
|
1372
|
-
children: [(
|
|
1772
|
+
return /* @__PURE__ */ Te("div", {
|
|
1773
|
+
className: _s("payment-modal-wrapper", m === 0 || i ? "loading" : "not-loading", r ? "open" : "closed"),
|
|
1774
|
+
children: [(m === 0 || i) && /* @__PURE__ */ L("div", {
|
|
1373
1775
|
role: "status",
|
|
1374
1776
|
className: "payment-modal-loader",
|
|
1375
|
-
children: /* @__PURE__ */
|
|
1777
|
+
children: /* @__PURE__ */ Te("svg", {
|
|
1376
1778
|
"aria-hidden": "true",
|
|
1377
1779
|
className: "icon",
|
|
1378
1780
|
viewBox: "0 0 100 101",
|
|
1379
1781
|
fill: "none",
|
|
1380
1782
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1381
|
-
children: [/* @__PURE__ */
|
|
1783
|
+
children: [/* @__PURE__ */ L("path", {
|
|
1382
1784
|
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",
|
|
1383
1785
|
fill: "currentColor"
|
|
1384
|
-
}), /* @__PURE__ */
|
|
1786
|
+
}), /* @__PURE__ */ L("path", {
|
|
1385
1787
|
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",
|
|
1386
1788
|
fill: "currentFill"
|
|
1387
1789
|
})]
|
|
1388
1790
|
})
|
|
1389
|
-
}), /* @__PURE__ */
|
|
1791
|
+
}), /* @__PURE__ */ L("iframe", {
|
|
1390
1792
|
allow: "clipboard-read *; clipboard-write *",
|
|
1391
|
-
src:
|
|
1392
|
-
onLoad:
|
|
1393
|
-
className: `payment-modal ${
|
|
1394
|
-
"data-id":
|
|
1793
|
+
src: R || void 0,
|
|
1794
|
+
onLoad: E,
|
|
1795
|
+
className: `payment-modal ${m === 0 || i ? "invisible" : "visible"}`,
|
|
1796
|
+
"data-id": e,
|
|
1395
1797
|
ref: f
|
|
1396
|
-
},
|
|
1798
|
+
}, e)]
|
|
1397
1799
|
});
|
|
1398
1800
|
}
|
|
1399
|
-
const
|
|
1400
|
-
let
|
|
1401
|
-
const
|
|
1402
|
-
if (Array.isArray(
|
|
1403
|
-
return Array.from(
|
|
1404
|
-
const
|
|
1405
|
-
return Object.values(
|
|
1801
|
+
const Hs = Symbol(), fe = Symbol(), O = "a", ot = "f", ke = "p", it = "c", at = "t", he = "h", B = "w", ge = "o", me = "k";
|
|
1802
|
+
let $s = (t, e) => new Proxy(t, e);
|
|
1803
|
+
const re = Object.getPrototypeOf, oe = /* @__PURE__ */ new WeakMap(), ct = (t) => t && (oe.has(t) ? oe.get(t) : re(t) === Object.prototype || re(t) === Array.prototype), z = (t) => typeof t == "object" && t !== null, zs = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), js = (t) => {
|
|
1804
|
+
if (Array.isArray(t))
|
|
1805
|
+
return Array.from(t);
|
|
1806
|
+
const e = Object.getOwnPropertyDescriptors(t);
|
|
1807
|
+
return Object.values(e).forEach((s) => {
|
|
1406
1808
|
s.configurable = !0;
|
|
1407
|
-
}), Object.create(
|
|
1408
|
-
},
|
|
1809
|
+
}), Object.create(re(t), e);
|
|
1810
|
+
}, qs = (t, e) => {
|
|
1409
1811
|
const s = {
|
|
1410
|
-
[
|
|
1812
|
+
[ot]: e
|
|
1411
1813
|
};
|
|
1412
1814
|
let n = !1;
|
|
1413
|
-
const r = (a,
|
|
1815
|
+
const r = (a, u) => {
|
|
1414
1816
|
if (!n) {
|
|
1415
|
-
let
|
|
1416
|
-
if (
|
|
1417
|
-
|
|
1817
|
+
let l = s[O].get(t);
|
|
1818
|
+
if (l || (l = {}, s[O].set(t, l)), a === B)
|
|
1819
|
+
l[B] = !0;
|
|
1418
1820
|
else {
|
|
1419
|
-
let
|
|
1420
|
-
|
|
1821
|
+
let d = l[a];
|
|
1822
|
+
d || (d = /* @__PURE__ */ new Set(), l[a] = d), d.add(u);
|
|
1421
1823
|
}
|
|
1422
1824
|
}
|
|
1423
1825
|
}, i = () => {
|
|
1424
|
-
n = !0, s[
|
|
1826
|
+
n = !0, s[O].delete(t);
|
|
1425
1827
|
}, o = {
|
|
1426
|
-
get(a,
|
|
1427
|
-
return
|
|
1828
|
+
get(a, u) {
|
|
1829
|
+
return u === fe ? t : (r(me, u), ut(Reflect.get(a, u), s[O], s[it], s[at]));
|
|
1428
1830
|
},
|
|
1429
|
-
has(a,
|
|
1430
|
-
return
|
|
1831
|
+
has(a, u) {
|
|
1832
|
+
return u === Hs ? (i(), !0) : (r(he, u), Reflect.has(a, u));
|
|
1431
1833
|
},
|
|
1432
|
-
getOwnPropertyDescriptor(a,
|
|
1433
|
-
return r(
|
|
1834
|
+
getOwnPropertyDescriptor(a, u) {
|
|
1835
|
+
return r(ge, u), Reflect.getOwnPropertyDescriptor(a, u);
|
|
1434
1836
|
},
|
|
1435
1837
|
ownKeys(a) {
|
|
1436
|
-
return r(
|
|
1838
|
+
return r(B), Reflect.ownKeys(a);
|
|
1437
1839
|
}
|
|
1438
1840
|
};
|
|
1439
|
-
return
|
|
1440
|
-
}, pe = (
|
|
1841
|
+
return e && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
1842
|
+
}, pe = (t) => (
|
|
1441
1843
|
// unwrap proxy
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
),
|
|
1445
|
-
if (!
|
|
1446
|
-
return
|
|
1447
|
-
let r = n && n.get(
|
|
1844
|
+
t[fe] || // otherwise
|
|
1845
|
+
t
|
|
1846
|
+
), ut = (t, e, s, n) => {
|
|
1847
|
+
if (!ct(t))
|
|
1848
|
+
return t;
|
|
1849
|
+
let r = n && n.get(t);
|
|
1448
1850
|
if (!r) {
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1851
|
+
const u = pe(t);
|
|
1852
|
+
zs(u) ? r = [u, js(u)] : r = [u], n?.set(t, r);
|
|
1451
1853
|
}
|
|
1452
1854
|
const [i, o] = r;
|
|
1453
1855
|
let a = s && s.get(i);
|
|
1454
|
-
return (!a || a[1][
|
|
1455
|
-
},
|
|
1456
|
-
const s = Reflect.ownKeys(
|
|
1856
|
+
return (!a || a[1][ot] !== !!o) && (a = qs(i, !!o), a[1][ke] = $s(o || i, a[0]), s && s.set(i, a)), a[1][O] = e, a[1][it] = s, a[1][at] = n, a[1][ke];
|
|
1857
|
+
}, Ks = (t, e) => {
|
|
1858
|
+
const s = Reflect.ownKeys(t), n = Reflect.ownKeys(e);
|
|
1457
1859
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
1458
|
-
},
|
|
1459
|
-
if (r(
|
|
1860
|
+
}, lt = (t, e, s, n, r = Object.is) => {
|
|
1861
|
+
if (r(t, e))
|
|
1460
1862
|
return !1;
|
|
1461
|
-
if (!
|
|
1863
|
+
if (!z(t) || !z(e))
|
|
1462
1864
|
return !0;
|
|
1463
|
-
const i = s.get(pe(
|
|
1865
|
+
const i = s.get(pe(t));
|
|
1464
1866
|
if (!i)
|
|
1465
1867
|
return !0;
|
|
1466
1868
|
if (n) {
|
|
1467
|
-
if (n.get(
|
|
1869
|
+
if (n.get(t) === e)
|
|
1468
1870
|
return !1;
|
|
1469
|
-
n.set(
|
|
1871
|
+
n.set(t, e);
|
|
1470
1872
|
}
|
|
1471
1873
|
let o = null;
|
|
1472
|
-
for (const a of i[
|
|
1473
|
-
if (o = Reflect.has(
|
|
1874
|
+
for (const a of i[he] || [])
|
|
1875
|
+
if (o = Reflect.has(t, a) !== Reflect.has(e, a), o)
|
|
1474
1876
|
return o;
|
|
1475
|
-
if (i[
|
|
1476
|
-
if (o =
|
|
1877
|
+
if (i[B] === !0) {
|
|
1878
|
+
if (o = Ks(t, e), o)
|
|
1477
1879
|
return o;
|
|
1478
1880
|
} else
|
|
1479
|
-
for (const a of i[
|
|
1480
|
-
const
|
|
1481
|
-
if (o =
|
|
1881
|
+
for (const a of i[ge] || []) {
|
|
1882
|
+
const u = !!Reflect.getOwnPropertyDescriptor(t, a), l = !!Reflect.getOwnPropertyDescriptor(e, a);
|
|
1883
|
+
if (o = u !== l, o)
|
|
1482
1884
|
return o;
|
|
1483
1885
|
}
|
|
1484
|
-
for (const a of i[
|
|
1485
|
-
if (o =
|
|
1886
|
+
for (const a of i[me] || [])
|
|
1887
|
+
if (o = lt(t[a], e[a], s, n, r), o)
|
|
1486
1888
|
return o;
|
|
1487
1889
|
if (o === null)
|
|
1488
1890
|
throw new Error("invalid used");
|
|
1489
1891
|
return o;
|
|
1490
|
-
},
|
|
1491
|
-
|
|
1492
|
-
},
|
|
1892
|
+
}, Ws = (t) => ct(t) && t[fe] || null, xe = (t, e = !0) => {
|
|
1893
|
+
oe.set(t, e);
|
|
1894
|
+
}, Vs = (t, e, s) => {
|
|
1493
1895
|
const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
1494
|
-
var
|
|
1896
|
+
var u, l, d;
|
|
1495
1897
|
if (r.has(o))
|
|
1496
1898
|
return;
|
|
1497
|
-
|
|
1498
|
-
const
|
|
1499
|
-
if (
|
|
1500
|
-
if ((
|
|
1501
|
-
const
|
|
1899
|
+
z(o) && r.add(o);
|
|
1900
|
+
const T = z(o) && e.get(pe(o));
|
|
1901
|
+
if (T) {
|
|
1902
|
+
if ((u = T[he]) === null || u === void 0 || u.forEach((m) => {
|
|
1903
|
+
const y = `:has(${String(m)})`;
|
|
1904
|
+
n.push(a ? [...a, y] : [y]);
|
|
1905
|
+
}), T[B] === !0) {
|
|
1906
|
+
const m = ":ownKeys";
|
|
1502
1907
|
n.push(a ? [...a, m] : [m]);
|
|
1503
|
-
}), w[O] === !0) {
|
|
1504
|
-
const p = ":ownKeys";
|
|
1505
|
-
n.push(a ? [...a, p] : [p]);
|
|
1506
1908
|
} else
|
|
1507
|
-
(
|
|
1508
|
-
const
|
|
1509
|
-
n.push(a ? [...a,
|
|
1909
|
+
(l = T[ge]) === null || l === void 0 || l.forEach((m) => {
|
|
1910
|
+
const y = `:hasOwn(${String(m)})`;
|
|
1911
|
+
n.push(a ? [...a, y] : [y]);
|
|
1510
1912
|
});
|
|
1511
|
-
(
|
|
1512
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
1913
|
+
(d = T[me]) === null || d === void 0 || d.forEach((m) => {
|
|
1914
|
+
"value" in (Object.getOwnPropertyDescriptor(o, m) || {}) && i(o[m], a ? [...a, m] : [m]);
|
|
1513
1915
|
});
|
|
1514
1916
|
} else a && n.push(a);
|
|
1515
1917
|
};
|
|
1516
|
-
return i(
|
|
1517
|
-
},
|
|
1518
|
-
const s =
|
|
1519
|
-
if (s?.[0] ===
|
|
1918
|
+
return i(t), n;
|
|
1919
|
+
}, j = {}, ye = (t) => typeof t == "object" && t !== null, Ys = (t) => ye(t) && !be.has(t) && (Array.isArray(t) || !(Symbol.iterator in t)) && !(t instanceof WeakMap) && !(t instanceof WeakSet) && !(t instanceof Error) && !(t instanceof Number) && !(t instanceof Date) && !(t instanceof String) && !(t instanceof RegExp) && !(t instanceof ArrayBuffer) && !(t instanceof Promise), dt = (t, e) => {
|
|
1920
|
+
const s = Ne.get(t);
|
|
1921
|
+
if (s?.[0] === e)
|
|
1520
1922
|
return s[1];
|
|
1521
|
-
const n = Array.isArray(
|
|
1522
|
-
return
|
|
1923
|
+
const n = Array.isArray(t) ? [] : Object.create(Object.getPrototypeOf(t));
|
|
1924
|
+
return xe(n, !0), Ne.set(t, [e, n]), Reflect.ownKeys(t).forEach((r) => {
|
|
1523
1925
|
if (Object.getOwnPropertyDescriptor(n, r))
|
|
1524
1926
|
return;
|
|
1525
|
-
const i = Reflect.get(
|
|
1526
|
-
|
|
1927
|
+
const i = Reflect.get(t, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
|
|
1928
|
+
t,
|
|
1527
1929
|
r
|
|
1528
1930
|
), a = {
|
|
1529
1931
|
value: i,
|
|
@@ -1532,17 +1934,17 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1532
1934
|
// It's still non-writable, so it avoids assigning a value.
|
|
1533
1935
|
configurable: !0
|
|
1534
1936
|
};
|
|
1535
|
-
if (
|
|
1536
|
-
|
|
1537
|
-
else if (
|
|
1538
|
-
const [
|
|
1937
|
+
if (be.has(i))
|
|
1938
|
+
xe(i, !1);
|
|
1939
|
+
else if (k.has(i)) {
|
|
1940
|
+
const [u, l] = k.get(
|
|
1539
1941
|
i
|
|
1540
1942
|
);
|
|
1541
|
-
a.value =
|
|
1943
|
+
a.value = dt(u, l());
|
|
1542
1944
|
}
|
|
1543
1945
|
Object.defineProperty(n, r, a);
|
|
1544
1946
|
}), Object.preventExtensions(n);
|
|
1545
|
-
},
|
|
1947
|
+
}, Gs = (t, e, s, n) => ({
|
|
1546
1948
|
deleteProperty(r, i) {
|
|
1547
1949
|
const o = Reflect.get(r, i);
|
|
1548
1950
|
s(i);
|
|
@@ -1550,225 +1952,225 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1550
1952
|
return a && n(["delete", [i], o]), a;
|
|
1551
1953
|
},
|
|
1552
1954
|
set(r, i, o, a) {
|
|
1553
|
-
const
|
|
1554
|
-
if (
|
|
1955
|
+
const u = !t() && Reflect.has(r, i), l = Reflect.get(r, i, a);
|
|
1956
|
+
if (u && (Oe(l, o) || q.has(o) && Oe(l, q.get(o))))
|
|
1555
1957
|
return !0;
|
|
1556
|
-
s(i),
|
|
1557
|
-
const
|
|
1558
|
-
return
|
|
1559
|
-
}
|
|
1560
|
-
}),
|
|
1561
|
-
let Oe = Object.is,
|
|
1562
|
-
function
|
|
1563
|
-
if (!
|
|
1958
|
+
s(i), ye(o) && (o = Ws(o) || o);
|
|
1959
|
+
const d = !k.has(o) && Js(o) ? ft(o) : o;
|
|
1960
|
+
return e(i, d), Reflect.set(r, i, d, a), n(["set", [i], o, l]), !0;
|
|
1961
|
+
}
|
|
1962
|
+
}), k = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new WeakMap(), Q = [1], q = /* @__PURE__ */ new WeakMap();
|
|
1963
|
+
let Oe = Object.is, Xs = (t, e) => new Proxy(t, e), Js = Ys, Zs = dt, Qs = Gs;
|
|
1964
|
+
function ft(t = {}) {
|
|
1965
|
+
if (!ye(t))
|
|
1564
1966
|
throw new Error("object required");
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1567
|
-
return
|
|
1568
|
-
let s =
|
|
1569
|
-
const n = /* @__PURE__ */ new Set(), r = (f,
|
|
1570
|
-
s !==
|
|
1967
|
+
const e = q.get(t);
|
|
1968
|
+
if (e)
|
|
1969
|
+
return e;
|
|
1970
|
+
let s = Q[0];
|
|
1971
|
+
const n = /* @__PURE__ */ new Set(), r = (f, E = ++Q[0]) => {
|
|
1972
|
+
s !== E && (i = s = E, n.forEach((h) => h(f, E)));
|
|
1571
1973
|
};
|
|
1572
1974
|
let i = s;
|
|
1573
|
-
const o = (f =
|
|
1574
|
-
const h =
|
|
1975
|
+
const o = (f = Q[0]) => (i !== f && (i = f, u.forEach(([E]) => {
|
|
1976
|
+
const h = E[1](f);
|
|
1575
1977
|
h > s && (s = h);
|
|
1576
|
-
})), s), a = (f) => (
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
},
|
|
1580
|
-
const h = !
|
|
1978
|
+
})), s), a = (f) => (E, h) => {
|
|
1979
|
+
const C = [...E];
|
|
1980
|
+
C[1] = [f, ...C[1]], r(C, h);
|
|
1981
|
+
}, u = /* @__PURE__ */ new Map(), l = (f, E) => {
|
|
1982
|
+
const h = !be.has(E) && k.get(E);
|
|
1581
1983
|
if (h) {
|
|
1582
|
-
if ((
|
|
1984
|
+
if ((j ? "production" : void 0) !== "production" && u.has(f))
|
|
1583
1985
|
throw new Error("prop listener already exists");
|
|
1584
1986
|
if (n.size) {
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1987
|
+
const C = h[2](a(f));
|
|
1988
|
+
u.set(f, [h, C]);
|
|
1587
1989
|
} else
|
|
1588
|
-
|
|
1990
|
+
u.set(f, [h]);
|
|
1589
1991
|
}
|
|
1590
|
-
},
|
|
1591
|
-
var
|
|
1592
|
-
const h =
|
|
1593
|
-
h && (
|
|
1594
|
-
},
|
|
1595
|
-
if ((
|
|
1992
|
+
}, d = (f) => {
|
|
1993
|
+
var E;
|
|
1994
|
+
const h = u.get(f);
|
|
1995
|
+
h && (u.delete(f), (E = h[1]) == null || E.call(h));
|
|
1996
|
+
}, T = (f) => (n.add(f), n.size === 1 && u.forEach(([h, C], I) => {
|
|
1997
|
+
if ((j ? "production" : void 0) !== "production" && C)
|
|
1596
1998
|
throw new Error("remove already exists");
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1999
|
+
const ht = h[2](a(I));
|
|
2000
|
+
u.set(I, [h, ht]);
|
|
1599
2001
|
}), () => {
|
|
1600
|
-
n.delete(f), n.size === 0 &&
|
|
1601
|
-
|
|
2002
|
+
n.delete(f), n.size === 0 && u.forEach(([h, C], I) => {
|
|
2003
|
+
C && (C(), u.set(I, [h]));
|
|
1602
2004
|
});
|
|
1603
2005
|
});
|
|
1604
|
-
let
|
|
1605
|
-
const
|
|
1606
|
-
() =>
|
|
1607
|
-
u,
|
|
2006
|
+
let m = !0;
|
|
2007
|
+
const y = Qs(
|
|
2008
|
+
() => m,
|
|
1608
2009
|
l,
|
|
2010
|
+
d,
|
|
1609
2011
|
r
|
|
1610
|
-
),
|
|
1611
|
-
|
|
1612
|
-
const
|
|
1613
|
-
return
|
|
1614
|
-
const
|
|
1615
|
-
|
|
2012
|
+
), R = Xs(t, y);
|
|
2013
|
+
q.set(t, R);
|
|
2014
|
+
const W = [t, o, T];
|
|
2015
|
+
return k.set(R, W), Reflect.ownKeys(t).forEach((f) => {
|
|
2016
|
+
const E = Object.getOwnPropertyDescriptor(
|
|
2017
|
+
t,
|
|
1616
2018
|
f
|
|
1617
2019
|
);
|
|
1618
|
-
"value" in
|
|
1619
|
-
}),
|
|
2020
|
+
"value" in E && E.writable && (R[f] = t[f]);
|
|
2021
|
+
}), m = !1, R;
|
|
1620
2022
|
}
|
|
1621
|
-
function
|
|
1622
|
-
const n =
|
|
1623
|
-
(
|
|
2023
|
+
function en(t, e, s) {
|
|
2024
|
+
const n = k.get(t);
|
|
2025
|
+
(j ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1624
2026
|
let r;
|
|
1625
2027
|
const i = [], o = n[2];
|
|
1626
2028
|
let a = !1;
|
|
1627
|
-
const
|
|
1628
|
-
i.push(
|
|
1629
|
-
r = void 0, a &&
|
|
2029
|
+
const l = o((d) => {
|
|
2030
|
+
i.push(d), r || (r = Promise.resolve().then(() => {
|
|
2031
|
+
r = void 0, a && e(i.splice(0));
|
|
1630
2032
|
}));
|
|
1631
2033
|
});
|
|
1632
2034
|
return a = !0, () => {
|
|
1633
|
-
a = !1,
|
|
2035
|
+
a = !1, l();
|
|
1634
2036
|
};
|
|
1635
2037
|
}
|
|
1636
|
-
function
|
|
1637
|
-
const
|
|
1638
|
-
(
|
|
1639
|
-
const [s, n] =
|
|
1640
|
-
return
|
|
2038
|
+
function Be(t) {
|
|
2039
|
+
const e = k.get(t);
|
|
2040
|
+
(j ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
|
|
2041
|
+
const [s, n] = e;
|
|
2042
|
+
return Zs(s, n());
|
|
1641
2043
|
}
|
|
1642
|
-
const
|
|
1643
|
-
const s =
|
|
2044
|
+
const tn = {}, sn = (t, e) => {
|
|
2045
|
+
const s = ie(void 0);
|
|
1644
2046
|
x(() => {
|
|
1645
|
-
s.current =
|
|
1646
|
-
}),
|
|
1647
|
-
},
|
|
1648
|
-
function
|
|
1649
|
-
const n =
|
|
1650
|
-
() =>
|
|
1651
|
-
[
|
|
1652
|
-
), r =
|
|
2047
|
+
s.current = Vs(t, e);
|
|
2048
|
+
}), yt(s.current);
|
|
2049
|
+
}, nn = sn, rn = /* @__PURE__ */ new WeakMap();
|
|
2050
|
+
function on(t, e) {
|
|
2051
|
+
const n = Ee(
|
|
2052
|
+
() => t && /* @__PURE__ */ new WeakMap(),
|
|
2053
|
+
[t]
|
|
2054
|
+
), r = ie(void 0);
|
|
1653
2055
|
let i = !0;
|
|
1654
|
-
const o =
|
|
1655
|
-
|
|
1656
|
-
(
|
|
1657
|
-
const
|
|
1658
|
-
return
|
|
2056
|
+
const o = gt(
|
|
2057
|
+
mt(
|
|
2058
|
+
(u) => {
|
|
2059
|
+
const l = en(t, u);
|
|
2060
|
+
return u(), l;
|
|
1659
2061
|
},
|
|
1660
|
-
[
|
|
2062
|
+
[t, void 0]
|
|
1661
2063
|
),
|
|
1662
2064
|
() => {
|
|
1663
|
-
const
|
|
2065
|
+
const u = Be(t);
|
|
1664
2066
|
try {
|
|
1665
|
-
if (!i && r.current && !
|
|
2067
|
+
if (!i && r.current && !lt(
|
|
1666
2068
|
r.current,
|
|
1667
|
-
|
|
2069
|
+
u,
|
|
1668
2070
|
n,
|
|
1669
2071
|
/* @__PURE__ */ new WeakMap()
|
|
1670
2072
|
))
|
|
1671
2073
|
return r.current;
|
|
1672
2074
|
} catch {
|
|
1673
2075
|
}
|
|
1674
|
-
return
|
|
2076
|
+
return u;
|
|
1675
2077
|
},
|
|
1676
|
-
() =>
|
|
2078
|
+
() => Be(t)
|
|
1677
2079
|
);
|
|
1678
|
-
i = !1,
|
|
2080
|
+
i = !1, pt(() => {
|
|
1679
2081
|
r.current = o;
|
|
1680
|
-
}), (
|
|
1681
|
-
const a =
|
|
1682
|
-
return
|
|
2082
|
+
}), (tn ? "production" : void 0) !== "production" && nn(o, n);
|
|
2083
|
+
const a = Ee(() => /* @__PURE__ */ new WeakMap(), []);
|
|
2084
|
+
return ut(o, n, a, rn);
|
|
1683
2085
|
}
|
|
1684
|
-
const
|
|
2086
|
+
const D = ft({
|
|
1685
2087
|
data: null,
|
|
1686
2088
|
isPending: !1,
|
|
1687
2089
|
error: null
|
|
1688
2090
|
});
|
|
1689
|
-
function
|
|
1690
|
-
session_url:
|
|
1691
|
-
onCancel:
|
|
2091
|
+
function fn({
|
|
2092
|
+
session_url: t,
|
|
2093
|
+
onCancel: e,
|
|
1692
2094
|
onSuccess: s
|
|
1693
2095
|
}) {
|
|
1694
|
-
const n =
|
|
1695
|
-
function
|
|
1696
|
-
|
|
1697
|
-
|
|
2096
|
+
const n = on(D), [r, i] = v(!1), [o, a] = v(Date.now()), u = n?.data?.sessionToken, l = n?.data?.amount;
|
|
2097
|
+
function d() {
|
|
2098
|
+
u || window.setTimeout(() => {
|
|
2099
|
+
u && i(!0);
|
|
1698
2100
|
}, 200), i(!0);
|
|
1699
2101
|
}
|
|
1700
|
-
function
|
|
2102
|
+
function T() {
|
|
1701
2103
|
i(!1);
|
|
1702
2104
|
}
|
|
1703
|
-
const
|
|
1704
|
-
const
|
|
1705
|
-
|
|
2105
|
+
const m = () => {
|
|
2106
|
+
const y = Date.now();
|
|
2107
|
+
D.isPending = !0, D.error = null, D.data = null, fetch(t, {
|
|
1706
2108
|
headers: {
|
|
1707
2109
|
"Content-Type": "application/json"
|
|
1708
2110
|
}
|
|
1709
|
-
}).then((
|
|
1710
|
-
|
|
1711
|
-
}).catch((
|
|
1712
|
-
|
|
2111
|
+
}).then((R) => R.json()).then((R) => {
|
|
2112
|
+
y < o || (D.data = R, D.isPending = !1, a(y));
|
|
2113
|
+
}).catch((R) => {
|
|
2114
|
+
y < o || (D.error = R?.toString(), D.isPending = !1, a(y), setInterval(m, 5e3));
|
|
1713
2115
|
});
|
|
1714
2116
|
};
|
|
1715
2117
|
return x(() => {
|
|
1716
|
-
|
|
1717
|
-
}, [
|
|
1718
|
-
sessionToken:
|
|
1719
|
-
amount:
|
|
2118
|
+
m();
|
|
2119
|
+
}, [t]), {
|
|
2120
|
+
sessionToken: u,
|
|
2121
|
+
amount: l,
|
|
1720
2122
|
isOpen: r,
|
|
1721
|
-
session_url:
|
|
1722
|
-
open:
|
|
1723
|
-
close:
|
|
2123
|
+
session_url: t,
|
|
2124
|
+
open: d,
|
|
2125
|
+
close: T,
|
|
1724
2126
|
isPending: n.isPending,
|
|
1725
2127
|
error: n.error,
|
|
1726
|
-
refetch:
|
|
2128
|
+
refetch: m,
|
|
1727
2129
|
onSuccess: s,
|
|
1728
|
-
onCancel:
|
|
2130
|
+
onCancel: e
|
|
1729
2131
|
};
|
|
1730
2132
|
}
|
|
1731
|
-
function
|
|
1732
|
-
sessionToken:
|
|
1733
|
-
amount:
|
|
2133
|
+
function hn({
|
|
2134
|
+
sessionToken: t,
|
|
2135
|
+
amount: e,
|
|
1734
2136
|
onCancel: s,
|
|
1735
2137
|
onSuccess: n
|
|
1736
2138
|
}) {
|
|
1737
|
-
const [r, i] =
|
|
1738
|
-
function
|
|
1739
|
-
sessionToken:
|
|
1740
|
-
amount:
|
|
2139
|
+
const [r, i] = v(!1), [o, a] = v(t), [u, l] = v(e);
|
|
2140
|
+
function d({
|
|
2141
|
+
sessionToken: y,
|
|
2142
|
+
amount: R
|
|
1741
2143
|
}) {
|
|
1742
|
-
a(
|
|
2144
|
+
a(y), l(R);
|
|
1743
2145
|
}
|
|
1744
2146
|
x(() => {
|
|
1745
|
-
a(
|
|
1746
|
-
}, [
|
|
1747
|
-
function
|
|
2147
|
+
a(t);
|
|
2148
|
+
}, [t]);
|
|
2149
|
+
function T() {
|
|
1748
2150
|
o || window.setTimeout(() => {
|
|
1749
2151
|
o && i(!0);
|
|
1750
2152
|
}, 200), i(!0);
|
|
1751
2153
|
}
|
|
1752
|
-
function
|
|
2154
|
+
function m() {
|
|
1753
2155
|
i(!1);
|
|
1754
2156
|
}
|
|
1755
2157
|
return {
|
|
1756
2158
|
sessionToken: o,
|
|
1757
|
-
updateSession:
|
|
1758
|
-
amount:
|
|
2159
|
+
updateSession: d,
|
|
2160
|
+
amount: u,
|
|
1759
2161
|
isOpen: r,
|
|
1760
|
-
open:
|
|
1761
|
-
close:
|
|
2162
|
+
open: T,
|
|
2163
|
+
close: m,
|
|
1762
2164
|
onSuccess: n,
|
|
1763
2165
|
onCancel: s
|
|
1764
2166
|
};
|
|
1765
2167
|
}
|
|
1766
2168
|
export {
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
2169
|
+
c as AmountSymbols,
|
|
2170
|
+
g as Chainrails,
|
|
2171
|
+
un as Chains,
|
|
2172
|
+
dn as PaymentModal,
|
|
2173
|
+
ln as crapi,
|
|
2174
|
+
hn as usePaymentModal,
|
|
2175
|
+
fn as usePaymentSession
|
|
1774
2176
|
};
|