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