@chainrails/react 0.0.35 → 0.0.37
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/chainrails-sdk.es.js +1237 -606
- package/dist/chainrails-sdk.es.mjs +1237 -606
- package/dist/chainrails-sdk.umd.js +3 -2
- package/package.json +2 -2
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import './index.css';class
|
|
1
|
+
import { useState as Ne, useRef as se, useEffect as ne, useMemo as me, useSyncExternalStore as Tt, useCallback as At, useLayoutEffect as vt, useDebugValue as Pt } from "react";
|
|
2
|
+
import { jsx as U, Fragment as It, jsxs as ye } from "react/jsx-runtime";
|
|
3
|
+
import './index.css';class X extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
6
6
|
options;
|
|
7
|
-
constructor(
|
|
8
|
-
const
|
|
9
|
-
super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response =
|
|
7
|
+
constructor(t, s, n) {
|
|
8
|
+
const r = t.status || t.status === 0 ? t.status : "", i = t.statusText ?? "", o = `${r} ${i}`.trim(), a = o ? `status code ${o}` : "an unknown error";
|
|
9
|
+
super(`Request failed with ${a}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response = t, this.request = s, this.options = n;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class Me extends Error {
|
|
13
13
|
name = "NonError";
|
|
14
14
|
value;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(t) {
|
|
16
16
|
let s = "Non-error value was thrown";
|
|
17
17
|
try {
|
|
18
|
-
typeof
|
|
18
|
+
typeof t == "string" ? s = t : t && typeof t == "object" && "message" in t && typeof t.message == "string" && (s = t.message);
|
|
19
19
|
} catch {
|
|
20
20
|
}
|
|
21
|
-
super(s), this.value =
|
|
21
|
+
super(s), this.value = t;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class F extends Error {
|
|
25
25
|
name = "ForceRetryError";
|
|
26
26
|
customDelay;
|
|
27
27
|
code;
|
|
28
28
|
customRequest;
|
|
29
|
-
constructor(
|
|
30
|
-
const s =
|
|
31
|
-
super(
|
|
29
|
+
constructor(t) {
|
|
30
|
+
const s = t?.cause ? t.cause instanceof Error ? t.cause : new Me(t.cause) : void 0;
|
|
31
|
+
super(t?.code ? `Forced retry: ${t.code}` : "Forced retry", s ? { cause: s } : void 0), this.customDelay = t?.delay, this.code = t?.code, this.customRequest = t?.request;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
const s = typeof globalThis.ReadableStream == "function",
|
|
37
|
-
if (s &&
|
|
34
|
+
const we = (() => {
|
|
35
|
+
let e = !1, t = !1;
|
|
36
|
+
const s = typeof globalThis.ReadableStream == "function", n = typeof globalThis.Request == "function";
|
|
37
|
+
if (s && n)
|
|
38
38
|
try {
|
|
39
|
-
|
|
39
|
+
t = new globalThis.Request("https://empty.invalid", {
|
|
40
40
|
body: new globalThis.ReadableStream(),
|
|
41
41
|
method: "POST",
|
|
42
42
|
// @ts-expect-error - Types are outdated.
|
|
43
43
|
get duplex() {
|
|
44
|
-
return
|
|
44
|
+
return e = !0, "half";
|
|
45
45
|
}
|
|
46
46
|
}).headers.has("Content-Type");
|
|
47
|
-
} catch (
|
|
48
|
-
if (
|
|
47
|
+
} catch (r) {
|
|
48
|
+
if (r instanceof Error && r.message === "unsupported BodyInit type")
|
|
49
49
|
return !1;
|
|
50
|
-
throw
|
|
50
|
+
throw r;
|
|
51
51
|
}
|
|
52
|
-
return
|
|
53
|
-
})(),
|
|
52
|
+
return e && !t;
|
|
53
|
+
})(), Ut = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ct = typeof globalThis.ReadableStream == "function", xt = typeof globalThis.FormData == "function", _e = ["get", "post", "put", "patch", "head", "delete"], kt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -59,14 +59,14 @@ const re = (() => {
|
|
|
59
59
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
60
60
|
// We still feature-check at runtime before exposing the shortcut.
|
|
61
61
|
bytes: "*/*"
|
|
62
|
-
},
|
|
63
|
-
class
|
|
62
|
+
}, H = 2147483647, Ot = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, $e = Symbol("stop");
|
|
63
|
+
class Le {
|
|
64
64
|
options;
|
|
65
|
-
constructor(
|
|
66
|
-
this.options =
|
|
65
|
+
constructor(t) {
|
|
66
|
+
this.options = t;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const Dt = (e) => new Le(e), Nt = {
|
|
70
70
|
json: !0,
|
|
71
71
|
parseJson: !0,
|
|
72
72
|
stringifyJson: !0,
|
|
@@ -80,10 +80,10 @@ const Ie = (t) => new ye(t), Be = {
|
|
|
80
80
|
onUploadProgress: !0,
|
|
81
81
|
fetch: !0,
|
|
82
82
|
context: !0
|
|
83
|
-
},
|
|
83
|
+
}, Mt = {
|
|
84
84
|
next: !0
|
|
85
85
|
// Next.js cache revalidation (revalidate, tags)
|
|
86
|
-
},
|
|
86
|
+
}, Bt = {
|
|
87
87
|
method: !0,
|
|
88
88
|
headers: !0,
|
|
89
89
|
body: !0,
|
|
@@ -98,243 +98,243 @@ const Ie = (t) => new ye(t), Be = {
|
|
|
98
98
|
signal: !0,
|
|
99
99
|
window: !0,
|
|
100
100
|
duplex: !0
|
|
101
|
-
},
|
|
102
|
-
if (!
|
|
101
|
+
}, _t = (e) => {
|
|
102
|
+
if (!e)
|
|
103
103
|
return 0;
|
|
104
|
-
if (
|
|
105
|
-
let
|
|
106
|
-
for (const [s,
|
|
107
|
-
|
|
108
|
-
return
|
|
104
|
+
if (e instanceof FormData) {
|
|
105
|
+
let t = 0;
|
|
106
|
+
for (const [s, n] of e)
|
|
107
|
+
t += Ot, t += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, t += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
|
|
108
|
+
return t;
|
|
109
109
|
}
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
return
|
|
114
|
-
if (typeof
|
|
115
|
-
return new TextEncoder().encode(
|
|
116
|
-
if (
|
|
117
|
-
return new TextEncoder().encode(
|
|
118
|
-
if ("byteLength" in
|
|
119
|
-
return
|
|
120
|
-
if (typeof
|
|
110
|
+
if (e instanceof Blob)
|
|
111
|
+
return e.size;
|
|
112
|
+
if (e instanceof ArrayBuffer)
|
|
113
|
+
return e.byteLength;
|
|
114
|
+
if (typeof e == "string")
|
|
115
|
+
return new TextEncoder().encode(e).length;
|
|
116
|
+
if (e instanceof URLSearchParams)
|
|
117
|
+
return new TextEncoder().encode(e.toString()).length;
|
|
118
|
+
if ("byteLength" in e)
|
|
119
|
+
return e.byteLength;
|
|
120
|
+
if (typeof e == "object" && e !== null)
|
|
121
121
|
try {
|
|
122
|
-
const
|
|
123
|
-
return new TextEncoder().encode(
|
|
122
|
+
const t = JSON.stringify(e);
|
|
123
|
+
return new TextEncoder().encode(t).length;
|
|
124
124
|
} catch {
|
|
125
125
|
return 0;
|
|
126
126
|
}
|
|
127
127
|
return 0;
|
|
128
|
-
},
|
|
129
|
-
let
|
|
130
|
-
return
|
|
128
|
+
}, ze = (e, t, s) => {
|
|
129
|
+
let n, r = 0;
|
|
130
|
+
return e.pipeThrough(new TransformStream({
|
|
131
131
|
transform(i, o) {
|
|
132
|
-
if (o.enqueue(i),
|
|
133
|
-
|
|
134
|
-
let a =
|
|
135
|
-
a >= 1 && (a = 1 - Number.EPSILON), s?.({ percent: a, totalBytes: Math.max(
|
|
132
|
+
if (o.enqueue(i), n) {
|
|
133
|
+
r += n.byteLength;
|
|
134
|
+
let a = t === 0 ? 0 : r / t;
|
|
135
|
+
a >= 1 && (a = 1 - Number.EPSILON), s?.({ percent: a, totalBytes: Math.max(t, r), transferredBytes: r }, n);
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
n = i;
|
|
138
138
|
},
|
|
139
139
|
flush() {
|
|
140
|
-
|
|
140
|
+
n && (r += n.byteLength, s?.({ percent: 1, totalBytes: Math.max(t, r), transferredBytes: r }, n));
|
|
141
141
|
}
|
|
142
142
|
}));
|
|
143
|
-
},
|
|
144
|
-
if (!
|
|
145
|
-
return
|
|
146
|
-
if (
|
|
143
|
+
}, $t = (e, t) => {
|
|
144
|
+
if (!e.body)
|
|
145
|
+
return e;
|
|
146
|
+
if (e.status === 204)
|
|
147
147
|
return new Response(null, {
|
|
148
|
-
status:
|
|
149
|
-
statusText:
|
|
150
|
-
headers:
|
|
148
|
+
status: e.status,
|
|
149
|
+
statusText: e.statusText,
|
|
150
|
+
headers: e.headers
|
|
151
151
|
});
|
|
152
|
-
const s = Math.max(0, Number(
|
|
153
|
-
return new Response(
|
|
154
|
-
status:
|
|
155
|
-
statusText:
|
|
156
|
-
headers:
|
|
152
|
+
const s = Math.max(0, Number(e.headers.get("content-length")) || 0);
|
|
153
|
+
return new Response(ze(e.body, s, t), {
|
|
154
|
+
status: e.status,
|
|
155
|
+
statusText: e.statusText,
|
|
156
|
+
headers: e.headers
|
|
157
157
|
});
|
|
158
|
-
},
|
|
159
|
-
if (!
|
|
160
|
-
return
|
|
161
|
-
const
|
|
162
|
-
return new Request(
|
|
158
|
+
}, Lt = (e, t, s) => {
|
|
159
|
+
if (!e.body)
|
|
160
|
+
return e;
|
|
161
|
+
const n = _t(s ?? e.body);
|
|
162
|
+
return new Request(e, {
|
|
163
163
|
// @ts-expect-error - Types are outdated.
|
|
164
164
|
duplex: "half",
|
|
165
|
-
body:
|
|
165
|
+
body: ze(e.body, n, t)
|
|
166
166
|
});
|
|
167
|
-
},
|
|
168
|
-
for (const
|
|
169
|
-
if ((!
|
|
167
|
+
}, P = (e) => e !== null && typeof e == "object", N = (...e) => {
|
|
168
|
+
for (const t of e)
|
|
169
|
+
if ((!P(t) || Array.isArray(t)) && t !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
171
|
-
return
|
|
172
|
-
},
|
|
173
|
-
const s = new globalThis.Headers(
|
|
174
|
-
for (const [i, o] of
|
|
175
|
-
|
|
171
|
+
return re({}, ...e);
|
|
172
|
+
}, qe = (e = {}, t = {}) => {
|
|
173
|
+
const s = new globalThis.Headers(e), n = t instanceof globalThis.Headers, r = new globalThis.Headers(t);
|
|
174
|
+
for (const [i, o] of r.entries())
|
|
175
|
+
n && o === "undefined" || o === void 0 ? s.delete(i) : s.set(i, o);
|
|
176
176
|
return s;
|
|
177
177
|
};
|
|
178
|
-
function
|
|
179
|
-
return Object.hasOwn(
|
|
180
|
-
}
|
|
181
|
-
const
|
|
182
|
-
beforeRequest:
|
|
183
|
-
beforeRetry:
|
|
184
|
-
afterResponse:
|
|
185
|
-
beforeError:
|
|
186
|
-
}),
|
|
178
|
+
function M(e, t, s) {
|
|
179
|
+
return Object.hasOwn(t, s) && t[s] === void 0 ? [] : re(e[s] ?? [], t[s] ?? []);
|
|
180
|
+
}
|
|
181
|
+
const je = (e = {}, t = {}) => ({
|
|
182
|
+
beforeRequest: M(e, t, "beforeRequest"),
|
|
183
|
+
beforeRetry: M(e, t, "beforeRetry"),
|
|
184
|
+
afterResponse: M(e, t, "afterResponse"),
|
|
185
|
+
beforeError: M(e, t, "beforeError")
|
|
186
|
+
}), zt = (e, t) => {
|
|
187
187
|
const s = new URLSearchParams();
|
|
188
|
-
for (const
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
for (const [
|
|
192
|
-
s.append(
|
|
193
|
-
else if (Array.isArray(
|
|
194
|
-
for (const
|
|
195
|
-
if (!Array.isArray(
|
|
188
|
+
for (const n of [e, t])
|
|
189
|
+
if (n !== void 0)
|
|
190
|
+
if (n instanceof URLSearchParams)
|
|
191
|
+
for (const [r, i] of n.entries())
|
|
192
|
+
s.append(r, i);
|
|
193
|
+
else if (Array.isArray(n))
|
|
194
|
+
for (const r of n) {
|
|
195
|
+
if (!Array.isArray(r) || r.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(r[0]), String(r[1]));
|
|
198
198
|
}
|
|
199
|
-
else if (
|
|
200
|
-
for (const [
|
|
201
|
-
i !== void 0 && s.append(
|
|
199
|
+
else if (P(n))
|
|
200
|
+
for (const [r, i] of Object.entries(n))
|
|
201
|
+
i !== void 0 && s.append(r, String(i));
|
|
202
202
|
else {
|
|
203
|
-
const
|
|
204
|
-
for (const [i, o] of
|
|
203
|
+
const r = new URLSearchParams(n);
|
|
204
|
+
for (const [i, o] of r.entries())
|
|
205
205
|
s.append(i, o);
|
|
206
206
|
}
|
|
207
207
|
return s;
|
|
208
|
-
},
|
|
209
|
-
let
|
|
208
|
+
}, re = (...e) => {
|
|
209
|
+
let t = {}, s = {}, n = {}, r;
|
|
210
210
|
const i = [];
|
|
211
|
-
for (const o of
|
|
211
|
+
for (const o of e)
|
|
212
212
|
if (Array.isArray(o))
|
|
213
|
-
Array.isArray(
|
|
214
|
-
else if (
|
|
213
|
+
Array.isArray(t) || (t = []), t = [...t, ...o];
|
|
214
|
+
else if (P(o)) {
|
|
215
215
|
for (let [a, c] of Object.entries(o)) {
|
|
216
216
|
if (a === "signal" && c instanceof globalThis.AbortSignal) {
|
|
217
217
|
i.push(c);
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
220
|
if (a === "context") {
|
|
221
|
-
if (c != null && (!
|
|
221
|
+
if (c != null && (!P(c) || Array.isArray(c)))
|
|
222
222
|
throw new TypeError("The `context` option must be an object");
|
|
223
|
-
|
|
224
|
-
...
|
|
225
|
-
context: c == null ? {} : { ...
|
|
223
|
+
t = {
|
|
224
|
+
...t,
|
|
225
|
+
context: c == null ? {} : { ...t.context, ...c }
|
|
226
226
|
};
|
|
227
227
|
continue;
|
|
228
228
|
}
|
|
229
229
|
if (a === "searchParams") {
|
|
230
|
-
c == null ?
|
|
230
|
+
c == null ? r = void 0 : r = r === void 0 ? c : zt(r, c);
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
P(c) && a in t && (c = re(t[a], c)), t = { ...t, [a]: c };
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
P(o.hooks) && (n = je(n, o.hooks), t.hooks = n), P(o.headers) && (s = qe(s, o.headers), t.headers = s);
|
|
236
236
|
}
|
|
237
|
-
return
|
|
238
|
-
},
|
|
237
|
+
return r !== void 0 && (t.searchParams = r), i.length > 0 && (i.length === 1 ? t.signal = i[0] : Be ? t.signal = AbortSignal.any(i) : t.signal = i.at(-1)), t.context === void 0 && (t.context = {}), t;
|
|
238
|
+
}, qt = (e) => _e.includes(e) ? e.toUpperCase() : e, jt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], Ht = [413, 429, 503], be = {
|
|
239
239
|
limit: 2,
|
|
240
|
-
methods:
|
|
241
|
-
statusCodes:
|
|
242
|
-
afterStatusCodes:
|
|
240
|
+
methods: jt,
|
|
241
|
+
statusCodes: Ft,
|
|
242
|
+
afterStatusCodes: Ht,
|
|
243
243
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
244
244
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
245
|
-
delay: (
|
|
245
|
+
delay: (e) => 0.3 * 2 ** (e - 1) * 1e3,
|
|
246
246
|
jitter: void 0,
|
|
247
247
|
retryOnTimeout: !1
|
|
248
|
-
},
|
|
249
|
-
if (typeof
|
|
248
|
+
}, Kt = (e = {}) => {
|
|
249
|
+
if (typeof e == "number")
|
|
250
250
|
return {
|
|
251
|
-
...
|
|
252
|
-
limit:
|
|
251
|
+
...be,
|
|
252
|
+
limit: e
|
|
253
253
|
};
|
|
254
|
-
if (
|
|
254
|
+
if (e.methods && !Array.isArray(e.methods))
|
|
255
255
|
throw new Error("retry.methods must be an array");
|
|
256
|
-
if (
|
|
256
|
+
if (e.statusCodes && !Array.isArray(e.statusCodes))
|
|
257
257
|
throw new Error("retry.statusCodes must be an array");
|
|
258
258
|
return {
|
|
259
|
-
...
|
|
260
|
-
...
|
|
259
|
+
...be,
|
|
260
|
+
...e
|
|
261
261
|
};
|
|
262
262
|
};
|
|
263
|
-
class
|
|
263
|
+
class J extends Error {
|
|
264
264
|
request;
|
|
265
|
-
constructor(
|
|
266
|
-
super(`Request timed out: ${
|
|
265
|
+
constructor(t) {
|
|
266
|
+
super(`Request timed out: ${t.method} ${t.url}`), this.name = "TimeoutError", this.request = t;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
270
|
-
return new Promise((
|
|
269
|
+
async function Wt(e, t, s, n) {
|
|
270
|
+
return new Promise((r, i) => {
|
|
271
271
|
const o = setTimeout(() => {
|
|
272
|
-
s && s.abort(), i(new
|
|
273
|
-
},
|
|
274
|
-
|
|
272
|
+
s && s.abort(), i(new J(e));
|
|
273
|
+
}, n.timeout);
|
|
274
|
+
n.fetch(e, t).then(r).catch(i).then(() => {
|
|
275
275
|
clearTimeout(o);
|
|
276
276
|
});
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
async function
|
|
280
|
-
return new Promise((s,
|
|
281
|
-
|
|
282
|
-
function
|
|
283
|
-
clearTimeout(i),
|
|
279
|
+
async function Vt(e, { signal: t }) {
|
|
280
|
+
return new Promise((s, n) => {
|
|
281
|
+
t && (t.throwIfAborted(), t.addEventListener("abort", r, { once: !0 }));
|
|
282
|
+
function r() {
|
|
283
|
+
clearTimeout(i), n(t.reason);
|
|
284
284
|
}
|
|
285
285
|
const i = setTimeout(() => {
|
|
286
|
-
|
|
287
|
-
},
|
|
286
|
+
t?.removeEventListener("abort", r), s();
|
|
287
|
+
}, e);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const Yt = (e, t) => {
|
|
291
291
|
const s = {};
|
|
292
|
-
for (const
|
|
293
|
-
Object.hasOwn(
|
|
292
|
+
for (const n in t)
|
|
293
|
+
Object.hasOwn(t, n) && !(n in Bt) && !(n in Nt) && (!(n in e) || n in Mt) && (s[n] = t[n]);
|
|
294
294
|
return s;
|
|
295
|
-
},
|
|
296
|
-
function
|
|
297
|
-
return
|
|
295
|
+
}, Xt = (e) => e === void 0 ? !1 : Array.isArray(e) ? e.length > 0 : e instanceof URLSearchParams ? e.size > 0 : typeof e == "object" ? Object.keys(e).length > 0 : typeof e == "string" ? e.trim().length > 0 : !!e;
|
|
296
|
+
function Jt(e) {
|
|
297
|
+
return e instanceof X || e?.name === X.name;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
return
|
|
299
|
+
function Gt(e) {
|
|
300
|
+
return e instanceof J || e?.name === J.name;
|
|
301
301
|
}
|
|
302
302
|
class O {
|
|
303
|
-
static create(
|
|
304
|
-
const
|
|
305
|
-
if (typeof
|
|
306
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
303
|
+
static create(t, s) {
|
|
304
|
+
const n = new O(t, s), r = async () => {
|
|
305
|
+
if (typeof n.#e.timeout == "number" && n.#e.timeout > H)
|
|
306
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${H}`);
|
|
307
307
|
await Promise.resolve();
|
|
308
|
-
let o = await
|
|
309
|
-
for (const a of
|
|
310
|
-
const c =
|
|
311
|
-
if (u instanceof globalThis.Response && (o = u), u instanceof
|
|
308
|
+
let o = await n.#g();
|
|
309
|
+
for (const a of n.#e.hooks.afterResponse) {
|
|
310
|
+
const c = n.#l(o.clone()), u = await a(n.request, n.#a(), c, { retryCount: n.#s });
|
|
311
|
+
if (u instanceof globalThis.Response && (o = u), u instanceof Le)
|
|
312
312
|
throw await Promise.all([
|
|
313
313
|
c.body?.cancel(),
|
|
314
314
|
o.body?.cancel()
|
|
315
|
-
]), new
|
|
315
|
+
]), new F(u.options);
|
|
316
316
|
}
|
|
317
|
-
if (
|
|
318
|
-
let a = new
|
|
319
|
-
for (const c of
|
|
320
|
-
a = await c(a, { retryCount:
|
|
317
|
+
if (n.#l(o), !o.ok && (typeof n.#e.throwHttpErrors == "function" ? n.#e.throwHttpErrors(o.status) : n.#e.throwHttpErrors)) {
|
|
318
|
+
let a = new X(o, n.request, n.#a());
|
|
319
|
+
for (const c of n.#e.hooks.beforeError)
|
|
320
|
+
a = await c(a, { retryCount: n.#s });
|
|
321
321
|
throw a;
|
|
322
322
|
}
|
|
323
|
-
if (
|
|
324
|
-
if (typeof
|
|
323
|
+
if (n.#e.onDownloadProgress) {
|
|
324
|
+
if (typeof n.#e.onDownloadProgress != "function")
|
|
325
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
326
|
-
if (!
|
|
326
|
+
if (!Ct)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
|
-
return
|
|
328
|
+
return $t(o.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
330
330
|
return o;
|
|
331
|
-
}, i =
|
|
332
|
-
const o =
|
|
333
|
-
o && !o.bodyUsed && a.push(o.body?.cancel()),
|
|
331
|
+
}, i = n.#f(r).finally(async () => {
|
|
332
|
+
const o = n.#o, a = [];
|
|
333
|
+
o && !o.bodyUsed && a.push(o.body?.cancel()), n.request.bodyUsed || a.push(n.request.body?.cancel()), await Promise.all(a);
|
|
334
334
|
});
|
|
335
|
-
for (const [o, a] of Object.entries(
|
|
335
|
+
for (const [o, a] of Object.entries(kt))
|
|
336
336
|
o === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[o] = async () => {
|
|
337
|
-
|
|
337
|
+
n.request.headers.set("accept", n.request.headers.get("accept") || a);
|
|
338
338
|
const c = await i;
|
|
339
339
|
if (o === "json") {
|
|
340
340
|
if (c.status === 204)
|
|
@@ -347,33 +347,33 @@ class O {
|
|
|
347
347
|
return i;
|
|
348
348
|
}
|
|
349
349
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
350
|
-
static #d(
|
|
351
|
-
return
|
|
350
|
+
static #d(t) {
|
|
351
|
+
return t && typeof t == "object" && !Array.isArray(t) && !(t instanceof URLSearchParams) ? Object.fromEntries(Object.entries(t).filter(([, s]) => s !== void 0)) : t;
|
|
352
352
|
}
|
|
353
353
|
request;
|
|
354
|
-
#
|
|
354
|
+
#n;
|
|
355
355
|
#s = 0;
|
|
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
359
|
#o;
|
|
360
|
-
#
|
|
360
|
+
#r;
|
|
361
361
|
#i;
|
|
362
362
|
// eslint-disable-next-line complexity
|
|
363
|
-
constructor(
|
|
364
|
-
if (this.#t =
|
|
363
|
+
constructor(t, s = {}) {
|
|
364
|
+
if (this.#t = t, this.#e = {
|
|
365
365
|
...s,
|
|
366
|
-
headers:
|
|
367
|
-
hooks:
|
|
366
|
+
headers: qe(this.#t.headers, s.headers),
|
|
367
|
+
hooks: je({
|
|
368
368
|
beforeRequest: [],
|
|
369
369
|
beforeRetry: [],
|
|
370
370
|
beforeError: [],
|
|
371
371
|
afterResponse: []
|
|
372
372
|
}, s.hooks),
|
|
373
|
-
method:
|
|
373
|
+
method: qt(s.method ?? this.#t.method ?? "GET"),
|
|
374
374
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
375
375
|
prefixUrl: String(s.prefixUrl || ""),
|
|
376
|
-
retry:
|
|
376
|
+
retry: Kt(s.retry),
|
|
377
377
|
throwHttpErrors: s.throwHttpErrors ?? !0,
|
|
378
378
|
timeout: s.timeout ?? 1e4,
|
|
379
379
|
fetch: s.fetch ?? globalThis.fetch.bind(globalThis),
|
|
@@ -385,73 +385,73 @@ class O {
|
|
|
385
385
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
386
386
|
this.#e.prefixUrl.endsWith("/") || (this.#e.prefixUrl += "/"), this.#t = this.#e.prefixUrl + this.#t;
|
|
387
387
|
}
|
|
388
|
-
|
|
389
|
-
const
|
|
390
|
-
if (this.#t instanceof globalThis.Request && (
|
|
388
|
+
Ut && Be && (this.#r = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal), we && (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
|
+
const n = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
390
|
+
if (this.#t instanceof globalThis.Request && (xt && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !n && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), Xt(this.#e.searchParams)) {
|
|
391
391
|
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(O.#d(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
392
392
|
this.request = new globalThis.Request(o, this.#e);
|
|
393
393
|
}
|
|
394
394
|
if (this.#e.onUploadProgress) {
|
|
395
395
|
if (typeof this.#e.onUploadProgress != "function")
|
|
396
396
|
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
397
|
-
if (!
|
|
397
|
+
if (!we)
|
|
398
398
|
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
399
399
|
this.request = this.#h(this.request, this.#e.body ?? void 0);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
#c() {
|
|
403
|
-
const
|
|
404
|
-
let s =
|
|
405
|
-
return this.#e.retry.jitter === !0 ? s = Math.random() *
|
|
403
|
+
const t = this.#e.retry.delay(this.#s);
|
|
404
|
+
let s = t;
|
|
405
|
+
return this.#e.retry.jitter === !0 ? s = Math.random() * t : typeof this.#e.retry.jitter == "function" && (s = this.#e.retry.jitter(t), (!Number.isFinite(s) || s < 0) && (s = t)), Math.min(this.#e.retry.backoffLimit, s);
|
|
406
406
|
}
|
|
407
|
-
async #p(
|
|
407
|
+
async #p(t) {
|
|
408
408
|
if (this.#s++, this.#s > this.#e.retry.limit)
|
|
409
|
-
throw
|
|
410
|
-
const s =
|
|
411
|
-
if (s instanceof
|
|
409
|
+
throw t;
|
|
410
|
+
const s = t instanceof Error ? t : new Me(t);
|
|
411
|
+
if (s instanceof F)
|
|
412
412
|
return s.customDelay ?? this.#c();
|
|
413
413
|
if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
|
|
414
|
-
throw
|
|
414
|
+
throw t;
|
|
415
415
|
if (this.#e.retry.shouldRetry !== void 0) {
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
418
|
-
throw
|
|
419
|
-
if (
|
|
416
|
+
const n = await this.#e.retry.shouldRetry({ error: s, retryCount: this.#s });
|
|
417
|
+
if (n === !1)
|
|
418
|
+
throw t;
|
|
419
|
+
if (n === !0)
|
|
420
420
|
return this.#c();
|
|
421
421
|
}
|
|
422
|
-
if (
|
|
423
|
-
throw
|
|
424
|
-
if (
|
|
425
|
-
if (!this.#e.retry.statusCodes.includes(
|
|
426
|
-
throw
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
429
|
-
let
|
|
430
|
-
Number.isNaN(
|
|
431
|
-
const i = this.#e.retry.maxRetryAfter ??
|
|
432
|
-
return
|
|
422
|
+
if (Gt(t) && !this.#e.retry.retryOnTimeout)
|
|
423
|
+
throw t;
|
|
424
|
+
if (Jt(t)) {
|
|
425
|
+
if (!this.#e.retry.statusCodes.includes(t.response.status))
|
|
426
|
+
throw t;
|
|
427
|
+
const n = t.response.headers.get("Retry-After") ?? t.response.headers.get("RateLimit-Reset") ?? t.response.headers.get("X-RateLimit-Retry-After") ?? t.response.headers.get("X-RateLimit-Reset") ?? t.response.headers.get("X-Rate-Limit-Reset");
|
|
428
|
+
if (n && this.#e.retry.afterStatusCodes.includes(t.response.status)) {
|
|
429
|
+
let r = Number(n) * 1e3;
|
|
430
|
+
Number.isNaN(r) ? r = Date.parse(n) - Date.now() : r >= Date.parse("2024-01-01") && (r -= Date.now());
|
|
431
|
+
const i = this.#e.retry.maxRetryAfter ?? r;
|
|
432
|
+
return r < i ? r : i;
|
|
433
433
|
}
|
|
434
|
-
if (
|
|
435
|
-
throw
|
|
434
|
+
if (t.response.status === 413)
|
|
435
|
+
throw t;
|
|
436
436
|
}
|
|
437
437
|
return this.#c();
|
|
438
438
|
}
|
|
439
|
-
#l(
|
|
440
|
-
return this.#e.parseJson && (
|
|
439
|
+
#l(t) {
|
|
440
|
+
return this.#e.parseJson && (t.json = async () => this.#e.parseJson(await t.text())), t;
|
|
441
441
|
}
|
|
442
|
-
async #f(
|
|
442
|
+
async #f(t) {
|
|
443
443
|
try {
|
|
444
|
-
return await
|
|
444
|
+
return await t();
|
|
445
445
|
} catch (s) {
|
|
446
|
-
const
|
|
446
|
+
const n = Math.min(await this.#p(s), H);
|
|
447
447
|
if (this.#s < 1)
|
|
448
448
|
throw s;
|
|
449
|
-
if (await
|
|
450
|
-
const
|
|
451
|
-
this.#u(
|
|
449
|
+
if (await Vt(n, this.#r ? { signal: this.#r } : {}), s instanceof F && s.customRequest) {
|
|
450
|
+
const r = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
|
|
451
|
+
this.#u(r);
|
|
452
452
|
}
|
|
453
|
-
for (const
|
|
454
|
-
const i = await
|
|
453
|
+
for (const r of this.#e.hooks.beforeRetry) {
|
|
454
|
+
const i = await r({
|
|
455
455
|
request: this.request,
|
|
456
456
|
options: this.#a(),
|
|
457
457
|
error: s,
|
|
@@ -463,92 +463,706 @@ class O {
|
|
|
463
463
|
}
|
|
464
464
|
if (i instanceof globalThis.Response)
|
|
465
465
|
return i;
|
|
466
|
-
if (i ===
|
|
466
|
+
if (i === $e)
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
|
-
return this.#f(
|
|
469
|
+
return this.#f(t);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
async #
|
|
473
|
-
this.#
|
|
472
|
+
async #g() {
|
|
473
|
+
this.#n?.signal.aborted && (this.#n = new globalThis.AbortController(), this.#e.signal = this.#r ? AbortSignal.any([this.#r, this.#n.signal]) : this.#n.signal, this.request = new globalThis.Request(this.request, { signal: this.#e.signal }));
|
|
474
474
|
for (const s of this.#e.hooks.beforeRequest) {
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
return
|
|
478
|
-
if (
|
|
479
|
-
this.#u(
|
|
475
|
+
const n = await s(this.request, this.#a(), { retryCount: this.#s });
|
|
476
|
+
if (n instanceof Response)
|
|
477
|
+
return n;
|
|
478
|
+
if (n instanceof globalThis.Request) {
|
|
479
|
+
this.#u(n);
|
|
480
480
|
break;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
const
|
|
484
|
-
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o,
|
|
483
|
+
const t = Yt(this.request, this.#e);
|
|
484
|
+
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, t) : Wt(this.#o, t, this.#n, this.#e);
|
|
485
485
|
}
|
|
486
486
|
#a() {
|
|
487
487
|
if (!this.#i) {
|
|
488
|
-
const { hooks:
|
|
488
|
+
const { hooks: t, ...s } = this.#e;
|
|
489
489
|
this.#i = Object.freeze(s);
|
|
490
490
|
}
|
|
491
491
|
return this.#i;
|
|
492
492
|
}
|
|
493
|
-
#u(
|
|
494
|
-
this.#i = void 0, this.request = this.#h(
|
|
493
|
+
#u(t) {
|
|
494
|
+
this.#i = void 0, this.request = this.#h(t);
|
|
495
495
|
}
|
|
496
|
-
#h(
|
|
497
|
-
return !this.#e.onUploadProgress || !
|
|
496
|
+
#h(t, s) {
|
|
497
|
+
return !this.#e.onUploadProgress || !t.body ? t : Lt(t, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
|
-
const
|
|
502
|
-
const
|
|
503
|
-
for (const s of
|
|
504
|
-
|
|
505
|
-
return
|
|
506
|
-
},
|
|
507
|
-
var
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
501
|
+
const G = (e) => {
|
|
502
|
+
const t = (s, n) => O.create(s, N(e, n));
|
|
503
|
+
for (const s of _e)
|
|
504
|
+
t[s] = (n, r) => O.create(n, N(e, r, { method: s }));
|
|
505
|
+
return t.create = (s) => G(N(s)), t.extend = (s) => (typeof s == "function" && (s = s(e ?? {})), G(N(e, s))), t.stop = $e, t.retry = Dt, t;
|
|
506
|
+
}, Zt = G();
|
|
507
|
+
var E = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(E || {});
|
|
508
|
+
const Fe = {
|
|
509
|
+
type: "evm",
|
|
510
|
+
chainId: 42161,
|
|
511
|
+
name: "Arbitrum",
|
|
512
|
+
cctpDomain: 3,
|
|
513
|
+
logoURI: "/images/chains/arbitrum.svg"
|
|
514
|
+
}, He = {
|
|
515
|
+
type: "evm",
|
|
516
|
+
chainId: 421614,
|
|
517
|
+
name: "Arbitrum Sepolia",
|
|
518
|
+
cctpDomain: 3,
|
|
519
|
+
logoURI: "/images/chains/arbitrum.svg"
|
|
520
|
+
}, Ke = {
|
|
521
|
+
type: "evm",
|
|
522
|
+
chainId: 8453,
|
|
523
|
+
name: "Base",
|
|
524
|
+
cctpDomain: 6,
|
|
525
|
+
logoURI: "/images/chains/base.webp"
|
|
526
|
+
}, We = {
|
|
527
|
+
type: "evm",
|
|
528
|
+
chainId: 84532,
|
|
529
|
+
name: "Base Sepolia",
|
|
530
|
+
cctpDomain: 6,
|
|
531
|
+
logoURI: "/images/chains/base.webp"
|
|
532
|
+
}, Ve = {
|
|
533
|
+
type: "evm",
|
|
534
|
+
chainId: 56,
|
|
535
|
+
name: "BNB Chain",
|
|
536
|
+
cctpDomain: null,
|
|
537
|
+
logoURI: "/images/chains/bsc.webp"
|
|
538
|
+
}, Ye = {
|
|
539
|
+
type: "evm",
|
|
540
|
+
chainId: 1,
|
|
541
|
+
name: "Ethereum",
|
|
542
|
+
cctpDomain: 0,
|
|
543
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
544
|
+
}, Xe = {
|
|
545
|
+
type: "evm",
|
|
546
|
+
chainId: 11155111,
|
|
547
|
+
name: "Ethereum Sepolia",
|
|
548
|
+
cctpDomain: 0,
|
|
549
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
550
|
+
}, Je = {
|
|
551
|
+
type: "evm",
|
|
552
|
+
chainId: 43114,
|
|
553
|
+
name: "Avalanche",
|
|
554
|
+
cctpDomain: 1,
|
|
555
|
+
logoURI: "/images/chains/avalanche.svg"
|
|
556
|
+
}, Ge = {
|
|
557
|
+
type: "evm",
|
|
558
|
+
chainId: 43113,
|
|
559
|
+
name: "Avalanche Fuji",
|
|
560
|
+
cctpDomain: 1,
|
|
561
|
+
logoURI: "/images/chains/avalanche.svg"
|
|
562
|
+
}, Ze = {
|
|
563
|
+
type: "starknet",
|
|
564
|
+
chainId: "0x534e5f4d41494e",
|
|
565
|
+
// SN_MAIN
|
|
566
|
+
name: "Starknet",
|
|
567
|
+
cctpDomain: null,
|
|
568
|
+
logoURI: "/images/chains/starknet.svg"
|
|
569
|
+
};
|
|
570
|
+
function oe(e, { strict: t = !0 } = {}) {
|
|
571
|
+
return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
572
|
+
}
|
|
573
|
+
function Ee(e) {
|
|
574
|
+
return oe(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
575
|
+
}
|
|
576
|
+
const Qe = "2.43.4";
|
|
577
|
+
let K = {
|
|
578
|
+
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0,
|
|
579
|
+
version: `viem@${Qe}`
|
|
580
|
+
};
|
|
581
|
+
class A extends Error {
|
|
582
|
+
constructor(t, s = {}) {
|
|
583
|
+
const n = s.cause instanceof A ? s.cause.details : s.cause?.message ? s.cause.message : s.details, r = s.cause instanceof A && s.cause.docsPath || s.docsPath, i = K.getDocsUrl?.({ ...s, docsPath: r }), o = [
|
|
584
|
+
t || "An error occurred.",
|
|
585
|
+
"",
|
|
586
|
+
...s.metaMessages ? [...s.metaMessages, ""] : [],
|
|
587
|
+
...i ? [`Docs: ${i}`] : [],
|
|
588
|
+
...n ? [`Details: ${n}`] : [],
|
|
589
|
+
...K.version ? [`Version: ${K.version}`] : []
|
|
590
|
+
].join(`
|
|
591
|
+
`);
|
|
592
|
+
super(o, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
|
|
593
|
+
enumerable: !0,
|
|
594
|
+
configurable: !0,
|
|
595
|
+
writable: !0,
|
|
596
|
+
value: void 0
|
|
597
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
598
|
+
enumerable: !0,
|
|
599
|
+
configurable: !0,
|
|
600
|
+
writable: !0,
|
|
601
|
+
value: void 0
|
|
602
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
603
|
+
enumerable: !0,
|
|
604
|
+
configurable: !0,
|
|
605
|
+
writable: !0,
|
|
606
|
+
value: void 0
|
|
607
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
608
|
+
enumerable: !0,
|
|
609
|
+
configurable: !0,
|
|
610
|
+
writable: !0,
|
|
611
|
+
value: void 0
|
|
612
|
+
}), Object.defineProperty(this, "version", {
|
|
613
|
+
enumerable: !0,
|
|
614
|
+
configurable: !0,
|
|
615
|
+
writable: !0,
|
|
616
|
+
value: void 0
|
|
617
|
+
}), Object.defineProperty(this, "name", {
|
|
618
|
+
enumerable: !0,
|
|
619
|
+
configurable: !0,
|
|
620
|
+
writable: !0,
|
|
621
|
+
value: "BaseError"
|
|
622
|
+
}), this.details = n, this.docsPath = r, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = Qe;
|
|
623
|
+
}
|
|
624
|
+
walk(t) {
|
|
625
|
+
return et(this, t);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function et(e, t) {
|
|
629
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? et(e.cause, t) : t ? null : e;
|
|
630
|
+
}
|
|
631
|
+
class tt extends A {
|
|
632
|
+
constructor({ size: t, targetSize: s, type: n }) {
|
|
633
|
+
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function q(e, { dir: t, size: s = 32 } = {}) {
|
|
637
|
+
return typeof e == "string" ? Qt(e, { dir: t, size: s }) : es(e, { dir: t, size: s });
|
|
638
|
+
}
|
|
639
|
+
function Qt(e, { dir: t, size: s = 32 } = {}) {
|
|
640
|
+
if (s === null)
|
|
641
|
+
return e;
|
|
642
|
+
const n = e.replace("0x", "");
|
|
643
|
+
if (n.length > s * 2)
|
|
644
|
+
throw new tt({
|
|
645
|
+
size: Math.ceil(n.length / 2),
|
|
646
|
+
targetSize: s,
|
|
647
|
+
type: "hex"
|
|
648
|
+
});
|
|
649
|
+
return `0x${n[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
|
|
650
|
+
}
|
|
651
|
+
function es(e, { dir: t, size: s = 32 } = {}) {
|
|
652
|
+
if (s === null)
|
|
653
|
+
return e;
|
|
654
|
+
if (e.length > s)
|
|
655
|
+
throw new tt({
|
|
656
|
+
size: e.length,
|
|
657
|
+
targetSize: s,
|
|
658
|
+
type: "bytes"
|
|
659
|
+
});
|
|
660
|
+
const n = new Uint8Array(s);
|
|
661
|
+
for (let r = 0; r < s; r++) {
|
|
662
|
+
const i = t === "right";
|
|
663
|
+
n[i ? r : s - r - 1] = e[i ? r : e.length - r - 1];
|
|
664
|
+
}
|
|
665
|
+
return n;
|
|
666
|
+
}
|
|
667
|
+
class ts extends A {
|
|
668
|
+
constructor({ max: t, min: s, signed: n, size: r, value: i }) {
|
|
669
|
+
super(`Number "${i}" is not in safe ${r ? `${r * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${s} to ${t})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
class ss extends A {
|
|
673
|
+
constructor({ givenSize: t, maxSize: s }) {
|
|
674
|
+
super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function ie(e, { size: t }) {
|
|
678
|
+
if (Ee(e) > t)
|
|
679
|
+
throw new ss({
|
|
680
|
+
givenSize: Ee(e),
|
|
681
|
+
maxSize: t
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
function ns(e, t = {}) {
|
|
685
|
+
const { signed: s, size: n } = t, r = BigInt(e);
|
|
686
|
+
let i;
|
|
687
|
+
n ? s ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
|
|
688
|
+
const o = typeof i == "bigint" && s ? -i - 1n : 0;
|
|
689
|
+
if (i && r > i || r < o) {
|
|
690
|
+
const c = typeof e == "bigint" ? "n" : "";
|
|
691
|
+
throw new ts({
|
|
692
|
+
max: i ? `${i}${c}` : void 0,
|
|
693
|
+
min: `${o}${c}`,
|
|
694
|
+
signed: s,
|
|
695
|
+
size: n,
|
|
696
|
+
value: `${e}${c}`
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
const a = `0x${(s && r < 0 ? (1n << BigInt(n * 8)) + BigInt(r) : r).toString(16)}`;
|
|
700
|
+
return n ? q(a, { size: n }) : a;
|
|
701
|
+
}
|
|
702
|
+
const rs = /* @__PURE__ */ new TextEncoder();
|
|
703
|
+
function os(e, t = {}) {
|
|
704
|
+
return typeof e == "number" || typeof e == "bigint" ? as(e, t) : typeof e == "boolean" ? is(e, t) : oe(e) ? st(e, t) : nt(e, t);
|
|
705
|
+
}
|
|
706
|
+
function is(e, t = {}) {
|
|
707
|
+
const s = new Uint8Array(1);
|
|
708
|
+
return s[0] = Number(e), typeof t.size == "number" ? (ie(s, { size: t.size }), q(s, { size: t.size })) : s;
|
|
709
|
+
}
|
|
710
|
+
const S = {
|
|
711
|
+
zero: 48,
|
|
712
|
+
nine: 57,
|
|
713
|
+
A: 65,
|
|
714
|
+
F: 70,
|
|
715
|
+
a: 97,
|
|
716
|
+
f: 102
|
|
717
|
+
};
|
|
718
|
+
function Se(e) {
|
|
719
|
+
if (e >= S.zero && e <= S.nine)
|
|
720
|
+
return e - S.zero;
|
|
721
|
+
if (e >= S.A && e <= S.F)
|
|
722
|
+
return e - (S.A - 10);
|
|
723
|
+
if (e >= S.a && e <= S.f)
|
|
724
|
+
return e - (S.a - 10);
|
|
725
|
+
}
|
|
726
|
+
function st(e, t = {}) {
|
|
727
|
+
let s = e;
|
|
728
|
+
t.size && (ie(s, { size: t.size }), s = q(s, { dir: "right", size: t.size }));
|
|
729
|
+
let n = s.slice(2);
|
|
730
|
+
n.length % 2 && (n = `0${n}`);
|
|
731
|
+
const r = n.length / 2, i = new Uint8Array(r);
|
|
732
|
+
for (let o = 0, a = 0; o < r; o++) {
|
|
733
|
+
const c = Se(n.charCodeAt(a++)), u = Se(n.charCodeAt(a++));
|
|
734
|
+
if (c === void 0 || u === void 0)
|
|
735
|
+
throw new A(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
|
|
736
|
+
i[o] = c * 16 + u;
|
|
737
|
+
}
|
|
738
|
+
return i;
|
|
739
|
+
}
|
|
740
|
+
function as(e, t) {
|
|
741
|
+
const s = ns(e, t);
|
|
742
|
+
return st(s);
|
|
743
|
+
}
|
|
744
|
+
function nt(e, t = {}) {
|
|
745
|
+
const s = rs.encode(e);
|
|
746
|
+
return typeof t.size == "number" ? (ie(s, { size: t.size }), q(s, { dir: "right", size: t.size })) : s;
|
|
747
|
+
}
|
|
748
|
+
const B = /* @__PURE__ */ BigInt(2 ** 32 - 1), Re = /* @__PURE__ */ BigInt(32);
|
|
749
|
+
function cs(e, t = !1) {
|
|
750
|
+
return t ? { h: Number(e & B), l: Number(e >> Re & B) } : { h: Number(e >> Re & B) | 0, l: Number(e & B) | 0 };
|
|
751
|
+
}
|
|
752
|
+
function us(e, t = !1) {
|
|
753
|
+
const s = e.length;
|
|
754
|
+
let n = new Uint32Array(s), r = new Uint32Array(s);
|
|
755
|
+
for (let i = 0; i < s; i++) {
|
|
756
|
+
const { h: o, l: a } = cs(e[i], t);
|
|
757
|
+
[n[i], r[i]] = [o, a];
|
|
758
|
+
}
|
|
759
|
+
return [n, r];
|
|
760
|
+
}
|
|
761
|
+
const ls = (e, t, s) => e << s | t >>> 32 - s, fs = (e, t, s) => t << s | e >>> 32 - s, hs = (e, t, s) => t << s - 32 | e >>> 64 - s, ds = (e, t, s) => e << s - 32 | t >>> 64 - s;
|
|
762
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
763
|
+
function ps(e) {
|
|
764
|
+
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
765
|
+
}
|
|
766
|
+
function Te(e) {
|
|
767
|
+
if (!Number.isSafeInteger(e) || e < 0)
|
|
768
|
+
throw new Error("positive integer expected, got " + e);
|
|
769
|
+
}
|
|
770
|
+
function _(e, ...t) {
|
|
771
|
+
if (!ps(e))
|
|
772
|
+
throw new Error("Uint8Array expected");
|
|
773
|
+
if (t.length > 0 && !t.includes(e.length))
|
|
774
|
+
throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
775
|
+
}
|
|
776
|
+
function Ae(e, t = !0) {
|
|
777
|
+
if (e.destroyed)
|
|
778
|
+
throw new Error("Hash instance has been destroyed");
|
|
779
|
+
if (t && e.finished)
|
|
780
|
+
throw new Error("Hash#digest() has already been called");
|
|
781
|
+
}
|
|
782
|
+
function gs(e, t) {
|
|
783
|
+
_(e);
|
|
784
|
+
const s = t.outputLen;
|
|
785
|
+
if (e.length < s)
|
|
786
|
+
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
787
|
+
}
|
|
788
|
+
function ms(e) {
|
|
789
|
+
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
790
|
+
}
|
|
791
|
+
function rt(...e) {
|
|
792
|
+
for (let t = 0; t < e.length; t++)
|
|
793
|
+
e[t].fill(0);
|
|
794
|
+
}
|
|
795
|
+
const ys = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
796
|
+
function ws(e) {
|
|
797
|
+
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
798
|
+
}
|
|
799
|
+
function bs(e) {
|
|
800
|
+
for (let t = 0; t < e.length; t++)
|
|
801
|
+
e[t] = ws(e[t]);
|
|
802
|
+
return e;
|
|
803
|
+
}
|
|
804
|
+
const ve = ys ? (e) => e : bs;
|
|
805
|
+
function Es(e) {
|
|
806
|
+
if (typeof e != "string")
|
|
807
|
+
throw new Error("string expected");
|
|
808
|
+
return new Uint8Array(new TextEncoder().encode(e));
|
|
809
|
+
}
|
|
810
|
+
function ot(e) {
|
|
811
|
+
return typeof e == "string" && (e = Es(e)), _(e), e;
|
|
812
|
+
}
|
|
813
|
+
class Ss {
|
|
814
|
+
}
|
|
815
|
+
function Rs(e) {
|
|
816
|
+
const t = (n) => e().update(ot(n)).digest(), s = e();
|
|
817
|
+
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
818
|
+
}
|
|
819
|
+
const Ts = BigInt(0), C = BigInt(1), As = BigInt(2), vs = BigInt(7), Ps = BigInt(256), Is = BigInt(113), it = [], at = [], ct = [];
|
|
820
|
+
for (let e = 0, t = C, s = 1, n = 0; e < 24; e++) {
|
|
821
|
+
[s, n] = [n, (2 * s + 3 * n) % 5], it.push(2 * (5 * n + s)), at.push((e + 1) * (e + 2) / 2 % 64);
|
|
822
|
+
let r = Ts;
|
|
823
|
+
for (let i = 0; i < 7; i++)
|
|
824
|
+
t = (t << C ^ (t >> vs) * Is) % Ps, t & As && (r ^= C << (C << /* @__PURE__ */ BigInt(i)) - C);
|
|
825
|
+
ct.push(r);
|
|
826
|
+
}
|
|
827
|
+
const ut = us(ct, !0), Us = ut[0], Cs = ut[1], Pe = (e, t, s) => s > 32 ? hs(e, t, s) : ls(e, t, s), Ie = (e, t, s) => s > 32 ? ds(e, t, s) : fs(e, t, s);
|
|
828
|
+
function xs(e, t = 24) {
|
|
829
|
+
const s = new Uint32Array(10);
|
|
830
|
+
for (let n = 24 - t; n < 24; n++) {
|
|
831
|
+
for (let o = 0; o < 10; o++)
|
|
832
|
+
s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
|
|
833
|
+
for (let o = 0; o < 10; o += 2) {
|
|
834
|
+
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Pe(u, l, 1) ^ s[a], d = Ie(u, l, 1) ^ s[a + 1];
|
|
835
|
+
for (let m = 0; m < 50; m += 10)
|
|
836
|
+
e[o + m] ^= w, e[o + m + 1] ^= d;
|
|
837
|
+
}
|
|
838
|
+
let r = e[2], i = e[3];
|
|
839
|
+
for (let o = 0; o < 24; o++) {
|
|
840
|
+
const a = at[o], c = Pe(r, i, a), u = Ie(r, i, a), l = it[o];
|
|
841
|
+
r = e[l], i = e[l + 1], e[l] = c, e[l + 1] = u;
|
|
517
842
|
}
|
|
518
|
-
|
|
843
|
+
for (let o = 0; o < 50; o += 10) {
|
|
844
|
+
for (let a = 0; a < 10; a++)
|
|
845
|
+
s[a] = e[o + a];
|
|
846
|
+
for (let a = 0; a < 10; a++)
|
|
847
|
+
e[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
848
|
+
}
|
|
849
|
+
e[0] ^= Us[n], e[1] ^= Cs[n];
|
|
519
850
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
851
|
+
rt(s);
|
|
852
|
+
}
|
|
853
|
+
class ae extends Ss {
|
|
854
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
855
|
+
constructor(t, s, n, r = !1, i = 24) {
|
|
856
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = r, this.rounds = i, Te(n), !(0 < t && t < 200))
|
|
857
|
+
throw new Error("only keccak-f1600 function is supported");
|
|
858
|
+
this.state = new Uint8Array(200), this.state32 = ms(this.state);
|
|
859
|
+
}
|
|
860
|
+
clone() {
|
|
861
|
+
return this._cloneInto();
|
|
862
|
+
}
|
|
863
|
+
keccak() {
|
|
864
|
+
ve(this.state32), xs(this.state32, this.rounds), ve(this.state32), this.posOut = 0, this.pos = 0;
|
|
865
|
+
}
|
|
866
|
+
update(t) {
|
|
867
|
+
Ae(this), t = ot(t), _(t);
|
|
868
|
+
const { blockLen: s, state: n } = this, r = t.length;
|
|
869
|
+
for (let i = 0; i < r; ) {
|
|
870
|
+
const o = Math.min(s - this.pos, r - i);
|
|
871
|
+
for (let a = 0; a < o; a++)
|
|
872
|
+
n[this.pos++] ^= t[i++];
|
|
873
|
+
this.pos === s && this.keccak();
|
|
874
|
+
}
|
|
875
|
+
return this;
|
|
876
|
+
}
|
|
877
|
+
finish() {
|
|
878
|
+
if (this.finished)
|
|
879
|
+
return;
|
|
880
|
+
this.finished = !0;
|
|
881
|
+
const { state: t, suffix: s, pos: n, blockLen: r } = this;
|
|
882
|
+
t[n] ^= s, (s & 128) !== 0 && n === r - 1 && this.keccak(), t[r - 1] ^= 128, this.keccak();
|
|
883
|
+
}
|
|
884
|
+
writeInto(t) {
|
|
885
|
+
Ae(this, !1), _(t), this.finish();
|
|
886
|
+
const s = this.state, { blockLen: n } = this;
|
|
887
|
+
for (let r = 0, i = t.length; r < i; ) {
|
|
888
|
+
this.posOut >= n && this.keccak();
|
|
889
|
+
const o = Math.min(n - this.posOut, i - r);
|
|
890
|
+
t.set(s.subarray(this.posOut, this.posOut + o), r), this.posOut += o, r += o;
|
|
891
|
+
}
|
|
892
|
+
return t;
|
|
893
|
+
}
|
|
894
|
+
xofInto(t) {
|
|
895
|
+
if (!this.enableXOF)
|
|
896
|
+
throw new Error("XOF is not possible for this instance");
|
|
897
|
+
return this.writeInto(t);
|
|
898
|
+
}
|
|
899
|
+
xof(t) {
|
|
900
|
+
return Te(t), this.xofInto(new Uint8Array(t));
|
|
901
|
+
}
|
|
902
|
+
digestInto(t) {
|
|
903
|
+
if (gs(t, this), this.finished)
|
|
904
|
+
throw new Error("digest() was already called");
|
|
905
|
+
return this.writeInto(t), this.destroy(), t;
|
|
906
|
+
}
|
|
907
|
+
digest() {
|
|
908
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
909
|
+
}
|
|
910
|
+
destroy() {
|
|
911
|
+
this.destroyed = !0, rt(this.state);
|
|
912
|
+
}
|
|
913
|
+
_cloneInto(t) {
|
|
914
|
+
const { blockLen: s, suffix: n, outputLen: r, rounds: i, enableXOF: o } = this;
|
|
915
|
+
return t || (t = new ae(s, n, r, o, i)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = i, t.suffix = n, t.outputLen = r, t.enableXOF = o, t.destroyed = this.destroyed, t;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
const ks = (e, t, s) => Rs(() => new ae(t, e, s)), Os = ks(1, 136, 256 / 8);
|
|
919
|
+
function Ds(e, t) {
|
|
920
|
+
return Os(oe(e, { strict: !1 }) ? os(e) : e);
|
|
921
|
+
}
|
|
922
|
+
class Ns extends A {
|
|
923
|
+
constructor({ address: t }) {
|
|
924
|
+
super(`Address "${t}" is invalid.`, {
|
|
925
|
+
metaMessages: [
|
|
926
|
+
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
927
|
+
"- Address must match its checksum counterpart."
|
|
928
|
+
],
|
|
929
|
+
name: "InvalidAddressError"
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
class lt extends Map {
|
|
934
|
+
constructor(t) {
|
|
935
|
+
super(), Object.defineProperty(this, "maxSize", {
|
|
936
|
+
enumerable: !0,
|
|
937
|
+
configurable: !0,
|
|
938
|
+
writable: !0,
|
|
939
|
+
value: void 0
|
|
940
|
+
}), this.maxSize = t;
|
|
941
|
+
}
|
|
942
|
+
get(t) {
|
|
943
|
+
const s = super.get(t);
|
|
944
|
+
return super.has(t) && s !== void 0 && (this.delete(t), super.set(t, s)), s;
|
|
945
|
+
}
|
|
946
|
+
set(t, s) {
|
|
947
|
+
if (super.set(t, s), this.maxSize && this.size > this.maxSize) {
|
|
948
|
+
const n = this.keys().next().value;
|
|
949
|
+
n && this.delete(n);
|
|
950
|
+
}
|
|
951
|
+
return this;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
const W = /* @__PURE__ */ new lt(8192);
|
|
955
|
+
function ft(e, t) {
|
|
956
|
+
if (W.has(`${e}.${t}`))
|
|
957
|
+
return W.get(`${e}.${t}`);
|
|
958
|
+
const s = e.substring(2).toLowerCase(), n = Ds(nt(s)), r = s.split("");
|
|
959
|
+
for (let o = 0; o < 40; o += 2)
|
|
960
|
+
n[o >> 1] >> 4 >= 8 && r[o] && (r[o] = r[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && r[o + 1] && (r[o + 1] = r[o + 1].toUpperCase());
|
|
961
|
+
const i = `0x${r.join("")}`;
|
|
962
|
+
return W.set(`${e}.${t}`, i), i;
|
|
963
|
+
}
|
|
964
|
+
function R(e, t) {
|
|
965
|
+
if (!Bs(e, { strict: !1 }))
|
|
966
|
+
throw new Ns({ address: e });
|
|
967
|
+
return ft(e, t);
|
|
968
|
+
}
|
|
969
|
+
const Ms = /^0x[a-fA-F0-9]{40}$/, V = /* @__PURE__ */ new lt(8192);
|
|
970
|
+
function Bs(e, t) {
|
|
971
|
+
const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
|
|
972
|
+
if (V.has(n))
|
|
973
|
+
return V.get(n);
|
|
974
|
+
const r = Ms.test(e) ? e.toLowerCase() === e ? !0 : s ? ft(e) === e : !0 : !1;
|
|
975
|
+
return V.set(n, r), r;
|
|
976
|
+
}
|
|
977
|
+
const _s = {
|
|
978
|
+
chainId: He.chainId,
|
|
979
|
+
address: R("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
980
|
+
symbol: "USDC",
|
|
981
|
+
fiatISO: "USD",
|
|
982
|
+
decimals: 6,
|
|
983
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
984
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
985
|
+
}, $s = {
|
|
986
|
+
chainId: Fe.chainId,
|
|
987
|
+
address: R("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
988
|
+
symbol: "USDC",
|
|
989
|
+
name: "USD Coin",
|
|
990
|
+
decimals: 6,
|
|
991
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
992
|
+
/* USDC */
|
|
993
|
+
}, Ls = {
|
|
994
|
+
chainId: Ge.chainId,
|
|
995
|
+
address: R("0x5425890298aed601595a70ab815c96711a31bc65"),
|
|
996
|
+
symbol: "USDC",
|
|
997
|
+
fiatISO: "USD",
|
|
998
|
+
decimals: 6,
|
|
999
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1000
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1001
|
+
}, zs = {
|
|
1002
|
+
chainId: Je.chainId,
|
|
1003
|
+
address: R("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
1004
|
+
symbol: "USDC",
|
|
1005
|
+
fiatISO: "USD",
|
|
1006
|
+
decimals: 6,
|
|
1007
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1008
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1009
|
+
}, qs = {
|
|
1010
|
+
chainId: We.chainId,
|
|
1011
|
+
address: R("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
1012
|
+
symbol: "USDC",
|
|
1013
|
+
fiatISO: "USD",
|
|
1014
|
+
decimals: 6,
|
|
1015
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1016
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1017
|
+
}, js = {
|
|
1018
|
+
chainId: Ke.chainId,
|
|
1019
|
+
address: R("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
1020
|
+
symbol: "USDC",
|
|
1021
|
+
fiatISO: "USD",
|
|
1022
|
+
decimals: 6,
|
|
1023
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1024
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1025
|
+
}, Fs = {
|
|
1026
|
+
chainId: Ve.chainId,
|
|
1027
|
+
address: R("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1028
|
+
symbol: "USDC",
|
|
1029
|
+
decimals: 18,
|
|
1030
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1031
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1032
|
+
}, Hs = {
|
|
1033
|
+
chainId: Xe.chainId,
|
|
1034
|
+
address: R("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1035
|
+
symbol: "USDC",
|
|
1036
|
+
decimals: 6,
|
|
1037
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1038
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1039
|
+
}, Ks = {
|
|
1040
|
+
chainId: Ye.chainId,
|
|
1041
|
+
address: R("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1042
|
+
symbol: "USDC",
|
|
1043
|
+
decimals: 6,
|
|
1044
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1045
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1046
|
+
}, Ws = {
|
|
1047
|
+
chainId: Ze.chainId,
|
|
1048
|
+
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
1049
|
+
symbol: "USDC",
|
|
1050
|
+
decimals: 6,
|
|
1051
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
1052
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
1053
|
+
}, Ue = {
|
|
1054
|
+
ARBITRUM_MAINNET: {
|
|
1055
|
+
...Fe,
|
|
1056
|
+
tokens: {
|
|
1057
|
+
[E.USDC]: $s
|
|
1058
|
+
},
|
|
1059
|
+
explorer: "https://arbiscan.io"
|
|
1060
|
+
},
|
|
1061
|
+
ARBITRUM_TESTNET: {
|
|
1062
|
+
...He,
|
|
1063
|
+
explorer: "https://sepolia.arbiscan.io",
|
|
1064
|
+
tokens: {
|
|
1065
|
+
[E.USDC]: _s
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
AVALANCHE_MAINNET: {
|
|
1069
|
+
...Je,
|
|
1070
|
+
tokens: {
|
|
1071
|
+
[E.USDC]: zs
|
|
1072
|
+
},
|
|
1073
|
+
explorer: "https://snowtrace.io"
|
|
1074
|
+
},
|
|
1075
|
+
AVALANCHE_TESTNET: {
|
|
1076
|
+
...Ge,
|
|
1077
|
+
tokens: {
|
|
1078
|
+
[E.USDC]: Ls
|
|
1079
|
+
},
|
|
1080
|
+
explorer: "https://testnet.snowtrace.io"
|
|
1081
|
+
},
|
|
1082
|
+
BASE_MAINNET: {
|
|
1083
|
+
...Ke,
|
|
1084
|
+
tokens: {
|
|
1085
|
+
[E.USDC]: js
|
|
1086
|
+
},
|
|
1087
|
+
explorer: "https://basescan.org"
|
|
1088
|
+
},
|
|
1089
|
+
BASE_TESTNET: {
|
|
1090
|
+
...We,
|
|
1091
|
+
tokens: {
|
|
1092
|
+
[E.USDC]: qs
|
|
1093
|
+
},
|
|
1094
|
+
explorer: "https://sepolia.basescan.org"
|
|
1095
|
+
},
|
|
1096
|
+
BSC_MAINNET: {
|
|
1097
|
+
...Ve,
|
|
1098
|
+
tokens: {
|
|
1099
|
+
[E.USDC]: Fs
|
|
1100
|
+
},
|
|
1101
|
+
explorer: "https://bscscan.com"
|
|
1102
|
+
},
|
|
1103
|
+
ETHEREUM_MAINNET: {
|
|
1104
|
+
...Ye,
|
|
1105
|
+
tokens: {
|
|
1106
|
+
[E.USDC]: Ks
|
|
1107
|
+
},
|
|
1108
|
+
explorer: "https://etherscan.io"
|
|
1109
|
+
},
|
|
1110
|
+
ETHEREUM_TESTNET: {
|
|
1111
|
+
...Xe,
|
|
1112
|
+
tokens: {
|
|
1113
|
+
[E.USDC]: Hs
|
|
1114
|
+
},
|
|
1115
|
+
explorer: "https://sepolia.etherscan.io"
|
|
1116
|
+
},
|
|
1117
|
+
STARKNET_MAINNET: {
|
|
1118
|
+
...Ze,
|
|
1119
|
+
tokens: {
|
|
1120
|
+
[E.USDC]: Ws
|
|
1121
|
+
},
|
|
1122
|
+
explorer: ""
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
var Z = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(Z || {}), ht = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ht || {});
|
|
1126
|
+
const Vs = (e) => {
|
|
1127
|
+
const t = e?.trim().toUpperCase();
|
|
1128
|
+
if (Ue[t])
|
|
1129
|
+
return Ue[t];
|
|
1130
|
+
};
|
|
1131
|
+
function Ys(e, t) {
|
|
1132
|
+
return Vs(e)?.tokens[t]?.address;
|
|
1133
|
+
}
|
|
1134
|
+
var ce = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(ce || {});
|
|
1135
|
+
class h {
|
|
1136
|
+
constructor({ api_key: t, env: s, seesion_token: n }) {
|
|
1137
|
+
this.api_key = t || "", this.sessionToken = n || "", this.env = s ?? ce.PRODUCTION;
|
|
1138
|
+
}
|
|
1139
|
+
static async config(t) {
|
|
1140
|
+
if (!h.app) {
|
|
1141
|
+
if (!t)
|
|
1142
|
+
throw new Error("Please provide an api_key");
|
|
1143
|
+
h.app = new h(t);
|
|
533
1144
|
}
|
|
1145
|
+
return t && (t.api_key !== void 0 && (h.app.api_key = t.api_key), t.seesion_token !== void 0 && (h.app.sessionToken = t.seesion_token), t.env !== void 0 && (h.app.env = t.env)), h.app;
|
|
534
1146
|
}
|
|
535
1147
|
static getApiKey() {
|
|
536
|
-
if (!
|
|
1148
|
+
if (!h.app)
|
|
537
1149
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
538
|
-
return
|
|
1150
|
+
return h.app.api_key;
|
|
539
1151
|
}
|
|
540
|
-
static
|
|
541
|
-
|
|
1152
|
+
static getSessionToken() {
|
|
1153
|
+
if (!h.app)
|
|
1154
|
+
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1155
|
+
return h.app.sessionToken;
|
|
542
1156
|
}
|
|
543
1157
|
static getEnv() {
|
|
544
|
-
if (!
|
|
1158
|
+
if (!h.app)
|
|
545
1159
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
546
|
-
return
|
|
1160
|
+
return h.app.env === "internal" ? "staging" : h.app.env;
|
|
547
1161
|
}
|
|
548
1162
|
static getBaseUrl() {
|
|
549
|
-
if (!
|
|
1163
|
+
if (!h.app)
|
|
550
1164
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
551
|
-
switch (
|
|
1165
|
+
switch (h.app.env) {
|
|
552
1166
|
case "production":
|
|
553
1167
|
return "https://api.chainrails.io/api/v1";
|
|
554
1168
|
case "staging":
|
|
@@ -559,313 +1173,328 @@ class d {
|
|
|
559
1173
|
return "https://api.chainrails.io/api/v1";
|
|
560
1174
|
}
|
|
561
1175
|
}
|
|
562
|
-
static getPayModalUrl(
|
|
563
|
-
if (!
|
|
1176
|
+
static getPayModalUrl(t, s, n, r) {
|
|
1177
|
+
if (!h.app)
|
|
564
1178
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
565
|
-
const i =
|
|
1179
|
+
const i = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = r && r > 0 ? "/pay/" : "/deposit/", a = `_chain_/${t}/_token_/${s}/_to_/${n}${r ? "/_amount_/" + r * 100 : ""}`;
|
|
566
1180
|
return i + o + a;
|
|
567
1181
|
}
|
|
568
1182
|
}
|
|
569
|
-
let
|
|
570
|
-
function
|
|
571
|
-
|
|
572
|
-
prefixUrl:
|
|
1183
|
+
let Q = null;
|
|
1184
|
+
function Xs() {
|
|
1185
|
+
Q = Zt.create({
|
|
1186
|
+
prefixUrl: h.getBaseUrl(),
|
|
573
1187
|
headers: {
|
|
574
1188
|
"Content-Type": "application/json"
|
|
575
1189
|
},
|
|
576
1190
|
hooks: {
|
|
577
1191
|
beforeRequest: [
|
|
578
|
-
(
|
|
579
|
-
const
|
|
580
|
-
|
|
1192
|
+
(e) => {
|
|
1193
|
+
const t = h.getSessionToken() || h.getApiKey();
|
|
1194
|
+
e.headers.set("Authorization", `Bearer ${t}`);
|
|
581
1195
|
}
|
|
582
1196
|
],
|
|
583
|
-
afterResponse: [(
|
|
1197
|
+
afterResponse: [(e, t, s) => s]
|
|
584
1198
|
},
|
|
585
1199
|
retry: {
|
|
586
1200
|
limit: 2
|
|
587
1201
|
}
|
|
588
1202
|
});
|
|
589
1203
|
}
|
|
590
|
-
function
|
|
591
|
-
return
|
|
1204
|
+
function y() {
|
|
1205
|
+
return Q || Xs(), Q;
|
|
592
1206
|
}
|
|
593
|
-
class
|
|
594
|
-
async getById(
|
|
595
|
-
return await
|
|
1207
|
+
class Js {
|
|
1208
|
+
async getById(t) {
|
|
1209
|
+
return await y().get("intents/" + t).json();
|
|
596
1210
|
}
|
|
597
|
-
async getForSender(
|
|
598
|
-
return await
|
|
1211
|
+
async getForSender(t) {
|
|
1212
|
+
return await y().get("intents/user/" + t).json();
|
|
599
1213
|
}
|
|
600
|
-
async getForAddress(
|
|
601
|
-
return await
|
|
1214
|
+
async getForAddress(t) {
|
|
1215
|
+
return await y().get("intents/address/" + t).json();
|
|
602
1216
|
}
|
|
603
|
-
async getAll(
|
|
604
|
-
return await
|
|
1217
|
+
async getAll(t) {
|
|
1218
|
+
return await y().get("intents", { searchParams: t }).json();
|
|
605
1219
|
}
|
|
606
|
-
async create(
|
|
607
|
-
return await
|
|
1220
|
+
async create(t) {
|
|
1221
|
+
return await y().post("intents", { json: t }).json();
|
|
608
1222
|
}
|
|
609
|
-
async update(
|
|
610
|
-
return await
|
|
1223
|
+
async update(t, s) {
|
|
1224
|
+
return await y().post("intents", { json: s }).json();
|
|
611
1225
|
}
|
|
612
|
-
async triggerProcessing(
|
|
613
|
-
return await
|
|
1226
|
+
async triggerProcessing(t) {
|
|
1227
|
+
return await y().post(`intents/${t}/trigger-processing`).json();
|
|
614
1228
|
}
|
|
615
1229
|
}
|
|
616
|
-
class
|
|
617
|
-
async getFromSpecificBridge(
|
|
618
|
-
return await
|
|
1230
|
+
class Gs {
|
|
1231
|
+
async getFromSpecificBridge(t) {
|
|
1232
|
+
return await y().get("quotes/single", { searchParams: t }).json();
|
|
619
1233
|
}
|
|
620
|
-
async getFromAllBridges(
|
|
621
|
-
return await
|
|
1234
|
+
async getFromAllBridges(t) {
|
|
1235
|
+
return await y().get("quotes/multiple", { searchParams: t }).json();
|
|
622
1236
|
}
|
|
623
|
-
async getBestAcrossBridges(
|
|
624
|
-
return await
|
|
1237
|
+
async getBestAcrossBridges(t) {
|
|
1238
|
+
return await y().get("quotes/best", { searchParams: t }).json();
|
|
625
1239
|
}
|
|
626
|
-
async getAll(
|
|
627
|
-
return await
|
|
1240
|
+
async getAll(t) {
|
|
1241
|
+
return await y().get("quotes/multi-source", { searchParams: t }).json();
|
|
628
1242
|
}
|
|
629
1243
|
}
|
|
630
|
-
class
|
|
631
|
-
async getOptimalRoutes(
|
|
632
|
-
return await
|
|
1244
|
+
class Zs {
|
|
1245
|
+
async getOptimalRoutes(t) {
|
|
1246
|
+
return await y().get("router/optimal-route", { searchParams: t }).json();
|
|
633
1247
|
}
|
|
634
1248
|
async getAllSupportedBridges() {
|
|
635
|
-
return await
|
|
1249
|
+
return await y().get("router/supported-bridges/all").json();
|
|
636
1250
|
}
|
|
637
|
-
async getSupportedBridges(
|
|
638
|
-
return await
|
|
1251
|
+
async getSupportedBridges(t) {
|
|
1252
|
+
return await y().get("router/supported-bridges/route", { searchParams: t }).json();
|
|
639
1253
|
}
|
|
640
|
-
async getSupportedRoutes(
|
|
641
|
-
return await
|
|
1254
|
+
async getSupportedRoutes(t, s) {
|
|
1255
|
+
return await y().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
|
|
642
1256
|
}
|
|
643
1257
|
}
|
|
644
|
-
class
|
|
645
|
-
async getSupported(
|
|
646
|
-
return await
|
|
1258
|
+
class Qs {
|
|
1259
|
+
async getSupported(t) {
|
|
1260
|
+
return await y().get("chains", { searchParams: t }).json();
|
|
647
1261
|
}
|
|
648
1262
|
}
|
|
649
|
-
class
|
|
1263
|
+
class en {
|
|
650
1264
|
async getClientInfo() {
|
|
651
|
-
return await
|
|
1265
|
+
return await y().get("client/auth/client-info").json();
|
|
652
1266
|
}
|
|
653
1267
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
1268
|
+
class tn {
|
|
1269
|
+
getSessionToken(t) {
|
|
1270
|
+
const s = {
|
|
1271
|
+
recipient: t.recipient,
|
|
1272
|
+
tokenOut: Ys(
|
|
1273
|
+
Z[t.destinationChain],
|
|
1274
|
+
ht[t.token]
|
|
1275
|
+
),
|
|
1276
|
+
destinationChain: Z[t.destinationChain],
|
|
1277
|
+
amount: t.amount
|
|
1278
|
+
};
|
|
1279
|
+
return y().post("modal/sessions", { json: s }).json();
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
const Pn = {
|
|
1283
|
+
router: new Zs(),
|
|
1284
|
+
quotes: new Gs(),
|
|
1285
|
+
intents: new Js(),
|
|
1286
|
+
chains: new Qs(),
|
|
1287
|
+
client: new en(),
|
|
1288
|
+
auth: new tn()
|
|
660
1289
|
};
|
|
661
|
-
function
|
|
662
|
-
var
|
|
663
|
-
if (typeof
|
|
664
|
-
else if (typeof
|
|
665
|
-
var
|
|
666
|
-
for (
|
|
667
|
-
} else for (s in
|
|
668
|
-
return
|
|
669
|
-
}
|
|
670
|
-
function
|
|
671
|
-
for (var
|
|
672
|
-
return
|
|
673
|
-
}
|
|
674
|
-
function
|
|
1290
|
+
function dt(e) {
|
|
1291
|
+
var t, s, n = "";
|
|
1292
|
+
if (typeof e == "string" || typeof e == "number") n += e;
|
|
1293
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
1294
|
+
var r = e.length;
|
|
1295
|
+
for (t = 0; t < r; t++) e[t] && (s = dt(e[t])) && (n && (n += " "), n += s);
|
|
1296
|
+
} else for (s in e) e[s] && (n && (n += " "), n += s);
|
|
1297
|
+
return n;
|
|
1298
|
+
}
|
|
1299
|
+
function sn() {
|
|
1300
|
+
for (var e, t, s = 0, n = "", r = arguments.length; s < r; s++) (e = arguments[s]) && (t = dt(e)) && (n && (n += " "), n += t);
|
|
1301
|
+
return n;
|
|
1302
|
+
}
|
|
1303
|
+
function In(e) {
|
|
675
1304
|
const {
|
|
676
|
-
to:
|
|
1305
|
+
to: t,
|
|
677
1306
|
token: s,
|
|
678
|
-
chain:
|
|
679
|
-
amount:
|
|
1307
|
+
chain: n,
|
|
1308
|
+
amount: r,
|
|
680
1309
|
isOpen: i,
|
|
681
1310
|
isPending: o,
|
|
682
1311
|
open: a,
|
|
683
1312
|
close: c,
|
|
684
1313
|
onCancel: u,
|
|
685
|
-
onSuccess:
|
|
1314
|
+
onSuccess: l,
|
|
686
1315
|
data: w
|
|
687
|
-
} =
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
692
|
-
const
|
|
693
|
-
|
|
1316
|
+
} = e, [d, m] = Ne(!0), T = se(null);
|
|
1317
|
+
ne(() => {
|
|
1318
|
+
f();
|
|
1319
|
+
const p = document.body.style.overflow;
|
|
1320
|
+
i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = p || "";
|
|
1321
|
+
const g = (b) => {
|
|
1322
|
+
b.data === "closed" && (c(), u?.()), b.data === "completed" && (window.setTimeout(c, 2e3), l?.());
|
|
694
1323
|
};
|
|
695
|
-
return window.addEventListener("message",
|
|
696
|
-
document.body.style.overflow =
|
|
1324
|
+
return window.addEventListener("message", g), () => {
|
|
1325
|
+
document.body.style.overflow = p || "", window.removeEventListener("message", g);
|
|
697
1326
|
};
|
|
698
|
-
}, [i, u,
|
|
1327
|
+
}, [i, u, l]);
|
|
699
1328
|
function j() {
|
|
700
|
-
m(!1),
|
|
1329
|
+
m(!1), f();
|
|
701
1330
|
}
|
|
702
|
-
function
|
|
1331
|
+
function f() {
|
|
703
1332
|
if (!w?.sessionToken) return;
|
|
704
|
-
const
|
|
1333
|
+
const p = {
|
|
705
1334
|
type: "session",
|
|
706
1335
|
session_token: w.sessionToken,
|
|
707
|
-
environment:
|
|
1336
|
+
environment: h.getEnv() || ce.PRODUCTION
|
|
708
1337
|
};
|
|
709
|
-
|
|
1338
|
+
T.current?.contentWindow?.postMessage(p, "https://app.chainrails.io"), T.current?.contentWindow?.postMessage(p, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
710
1339
|
}
|
|
711
|
-
return w?.sessionToken ? /* @__PURE__ */
|
|
712
|
-
className:
|
|
713
|
-
children: [(
|
|
1340
|
+
return w?.sessionToken ? /* @__PURE__ */ ye("div", {
|
|
1341
|
+
className: sn("payment-modal-wrapper", d || o ? "loading" : "not-loading", i ? "open" : "closed"),
|
|
1342
|
+
children: [(d || o) && /* @__PURE__ */ U("div", {
|
|
714
1343
|
role: "status",
|
|
715
1344
|
className: "payment-modal-loader",
|
|
716
|
-
children: /* @__PURE__ */
|
|
1345
|
+
children: /* @__PURE__ */ ye("svg", {
|
|
717
1346
|
"aria-hidden": "true",
|
|
718
1347
|
className: "icon",
|
|
719
1348
|
viewBox: "0 0 100 101",
|
|
720
1349
|
fill: "none",
|
|
721
1350
|
xmlns: "http://www.w3.org/2000/svg",
|
|
722
|
-
children: [/* @__PURE__ */
|
|
1351
|
+
children: [/* @__PURE__ */ U("path", {
|
|
723
1352
|
d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
|
|
724
1353
|
fill: "currentColor"
|
|
725
|
-
}), /* @__PURE__ */
|
|
1354
|
+
}), /* @__PURE__ */ U("path", {
|
|
726
1355
|
d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
|
|
727
1356
|
fill: "currentFill"
|
|
728
1357
|
})]
|
|
729
1358
|
})
|
|
730
|
-
}), /* @__PURE__ */
|
|
1359
|
+
}), /* @__PURE__ */ U("iframe", {
|
|
731
1360
|
allow: "clipboard-read *; clipboard-write *",
|
|
732
|
-
src:
|
|
1361
|
+
src: h.getPayModalUrl(n, s, t, r),
|
|
733
1362
|
onLoad: j,
|
|
734
|
-
className: `payment-modal ${
|
|
735
|
-
"data-id":
|
|
736
|
-
ref:
|
|
1363
|
+
className: `payment-modal ${d || o ? "invisible" : "visible"}`,
|
|
1364
|
+
"data-id": r,
|
|
1365
|
+
ref: T
|
|
737
1366
|
})]
|
|
738
|
-
}) : /* @__PURE__ */
|
|
739
|
-
}
|
|
740
|
-
const
|
|
741
|
-
let
|
|
742
|
-
const
|
|
743
|
-
if (Array.isArray(
|
|
744
|
-
return Array.from(
|
|
745
|
-
const
|
|
746
|
-
return Object.values(
|
|
1367
|
+
}) : /* @__PURE__ */ U(It, {});
|
|
1368
|
+
}
|
|
1369
|
+
const nn = Symbol(), ue = Symbol(), x = "a", pt = "f", Ce = "p", gt = "c", mt = "t", le = "h", k = "w", fe = "o", he = "k";
|
|
1370
|
+
let rn = (e, t) => new Proxy(e, t);
|
|
1371
|
+
const ee = Object.getPrototypeOf, te = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (te.has(e) ? te.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype), $ = (e) => typeof e == "object" && e !== null, on = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), an = (e) => {
|
|
1372
|
+
if (Array.isArray(e))
|
|
1373
|
+
return Array.from(e);
|
|
1374
|
+
const t = Object.getOwnPropertyDescriptors(e);
|
|
1375
|
+
return Object.values(t).forEach((s) => {
|
|
747
1376
|
s.configurable = !0;
|
|
748
|
-
}), Object.create(
|
|
749
|
-
},
|
|
1377
|
+
}), Object.create(ee(e), t);
|
|
1378
|
+
}, cn = (e, t) => {
|
|
750
1379
|
const s = {
|
|
751
|
-
[
|
|
1380
|
+
[pt]: t
|
|
752
1381
|
};
|
|
753
|
-
let
|
|
754
|
-
const
|
|
755
|
-
if (!
|
|
756
|
-
let u = s[
|
|
757
|
-
if (u || (u = {}, s[
|
|
758
|
-
u[
|
|
1382
|
+
let n = !1;
|
|
1383
|
+
const r = (a, c) => {
|
|
1384
|
+
if (!n) {
|
|
1385
|
+
let u = s[x].get(e);
|
|
1386
|
+
if (u || (u = {}, s[x].set(e, u)), a === k)
|
|
1387
|
+
u[k] = !0;
|
|
759
1388
|
else {
|
|
760
|
-
let
|
|
761
|
-
|
|
1389
|
+
let l = u[a];
|
|
1390
|
+
l || (l = /* @__PURE__ */ new Set(), u[a] = l), l.add(c);
|
|
762
1391
|
}
|
|
763
1392
|
}
|
|
764
1393
|
}, i = () => {
|
|
765
|
-
|
|
1394
|
+
n = !0, s[x].delete(e);
|
|
766
1395
|
}, o = {
|
|
767
1396
|
get(a, c) {
|
|
768
|
-
return c ===
|
|
1397
|
+
return c === ue ? e : (r(he, c), wt(Reflect.get(a, c), s[x], s[gt], s[mt]));
|
|
769
1398
|
},
|
|
770
1399
|
has(a, c) {
|
|
771
|
-
return c ===
|
|
1400
|
+
return c === nn ? (i(), !0) : (r(le, c), Reflect.has(a, c));
|
|
772
1401
|
},
|
|
773
1402
|
getOwnPropertyDescriptor(a, c) {
|
|
774
|
-
return
|
|
1403
|
+
return r(fe, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
775
1404
|
},
|
|
776
1405
|
ownKeys(a) {
|
|
777
|
-
return
|
|
1406
|
+
return r(k), Reflect.ownKeys(a);
|
|
778
1407
|
}
|
|
779
1408
|
};
|
|
780
|
-
return
|
|
781
|
-
},
|
|
1409
|
+
return t && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
1410
|
+
}, de = (e) => (
|
|
782
1411
|
// unwrap proxy
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
),
|
|
786
|
-
if (!
|
|
787
|
-
return
|
|
788
|
-
let
|
|
789
|
-
if (!
|
|
790
|
-
const c =
|
|
791
|
-
|
|
1412
|
+
e[ue] || // otherwise
|
|
1413
|
+
e
|
|
1414
|
+
), wt = (e, t, s, n) => {
|
|
1415
|
+
if (!yt(e))
|
|
1416
|
+
return e;
|
|
1417
|
+
let r = n && n.get(e);
|
|
1418
|
+
if (!r) {
|
|
1419
|
+
const c = de(e);
|
|
1420
|
+
on(c) ? r = [c, an(c)] : r = [c], n?.set(e, r);
|
|
792
1421
|
}
|
|
793
|
-
const [i, o] =
|
|
1422
|
+
const [i, o] = r;
|
|
794
1423
|
let a = s && s.get(i);
|
|
795
|
-
return (!a || a[1][
|
|
796
|
-
},
|
|
797
|
-
const s = Reflect.ownKeys(
|
|
798
|
-
return s.length !==
|
|
799
|
-
},
|
|
800
|
-
if (
|
|
1424
|
+
return (!a || a[1][pt] !== !!o) && (a = cn(i, !!o), a[1][Ce] = rn(o || i, a[0]), s && s.set(i, a)), a[1][x] = t, a[1][gt] = s, a[1][mt] = n, a[1][Ce];
|
|
1425
|
+
}, un = (e, t) => {
|
|
1426
|
+
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1427
|
+
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
1428
|
+
}, bt = (e, t, s, n, r = Object.is) => {
|
|
1429
|
+
if (r(e, t))
|
|
801
1430
|
return !1;
|
|
802
|
-
if (
|
|
1431
|
+
if (!$(e) || !$(t))
|
|
803
1432
|
return !0;
|
|
804
|
-
const i = s.get(
|
|
1433
|
+
const i = s.get(de(e));
|
|
805
1434
|
if (!i)
|
|
806
1435
|
return !0;
|
|
807
|
-
if (
|
|
808
|
-
if (
|
|
1436
|
+
if (n) {
|
|
1437
|
+
if (n.get(e) === t)
|
|
809
1438
|
return !1;
|
|
810
|
-
|
|
1439
|
+
n.set(e, t);
|
|
811
1440
|
}
|
|
812
1441
|
let o = null;
|
|
813
|
-
for (const a of i[
|
|
814
|
-
if (o = Reflect.has(
|
|
1442
|
+
for (const a of i[le] || [])
|
|
1443
|
+
if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
|
|
815
1444
|
return o;
|
|
816
|
-
if (i[
|
|
817
|
-
if (o =
|
|
1445
|
+
if (i[k] === !0) {
|
|
1446
|
+
if (o = un(e, t), o)
|
|
818
1447
|
return o;
|
|
819
1448
|
} else
|
|
820
|
-
for (const a of i[
|
|
821
|
-
const c = !!Reflect.getOwnPropertyDescriptor(
|
|
1449
|
+
for (const a of i[fe] || []) {
|
|
1450
|
+
const c = !!Reflect.getOwnPropertyDescriptor(e, a), u = !!Reflect.getOwnPropertyDescriptor(t, a);
|
|
822
1451
|
if (o = c !== u, o)
|
|
823
1452
|
return o;
|
|
824
1453
|
}
|
|
825
|
-
for (const a of i[
|
|
826
|
-
if (o =
|
|
1454
|
+
for (const a of i[he] || [])
|
|
1455
|
+
if (o = bt(e[a], t[a], s, n, r), o)
|
|
827
1456
|
return o;
|
|
828
1457
|
if (o === null)
|
|
829
1458
|
throw new Error("invalid used");
|
|
830
1459
|
return o;
|
|
831
|
-
},
|
|
832
|
-
|
|
833
|
-
},
|
|
834
|
-
const
|
|
835
|
-
var c, u,
|
|
836
|
-
if (
|
|
1460
|
+
}, ln = (e) => yt(e) && e[ue] || null, xe = (e, t = !0) => {
|
|
1461
|
+
te.set(e, t);
|
|
1462
|
+
}, fn = (e, t, s) => {
|
|
1463
|
+
const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
1464
|
+
var c, u, l;
|
|
1465
|
+
if (r.has(o))
|
|
837
1466
|
return;
|
|
838
|
-
|
|
839
|
-
const w =
|
|
1467
|
+
$(o) && r.add(o);
|
|
1468
|
+
const w = $(o) && t.get(de(o));
|
|
840
1469
|
if (w) {
|
|
841
|
-
if ((c = w[
|
|
842
|
-
const m = `:has(${String(
|
|
843
|
-
|
|
844
|
-
}), w[
|
|
845
|
-
const
|
|
846
|
-
|
|
1470
|
+
if ((c = w[le]) === null || c === void 0 || c.forEach((d) => {
|
|
1471
|
+
const m = `:has(${String(d)})`;
|
|
1472
|
+
n.push(a ? [...a, m] : [m]);
|
|
1473
|
+
}), w[k] === !0) {
|
|
1474
|
+
const d = ":ownKeys";
|
|
1475
|
+
n.push(a ? [...a, d] : [d]);
|
|
847
1476
|
} else
|
|
848
|
-
(u = w[
|
|
849
|
-
const m = `:hasOwn(${String(
|
|
850
|
-
|
|
1477
|
+
(u = w[fe]) === null || u === void 0 || u.forEach((d) => {
|
|
1478
|
+
const m = `:hasOwn(${String(d)})`;
|
|
1479
|
+
n.push(a ? [...a, m] : [m]);
|
|
851
1480
|
});
|
|
852
|
-
(
|
|
853
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
1481
|
+
(l = w[he]) === null || l === void 0 || l.forEach((d) => {
|
|
1482
|
+
"value" in (Object.getOwnPropertyDescriptor(o, d) || {}) && i(o[d], a ? [...a, d] : [d]);
|
|
854
1483
|
});
|
|
855
|
-
} else a &&
|
|
1484
|
+
} else a && n.push(a);
|
|
856
1485
|
};
|
|
857
|
-
return i(
|
|
858
|
-
},
|
|
859
|
-
const s =
|
|
860
|
-
if (s?.[0] ===
|
|
1486
|
+
return i(e), n;
|
|
1487
|
+
}, L = {}, pe = (e) => typeof e == "object" && e !== null, hn = (e) => pe(e) && !ge.has(e) && (Array.isArray(e) || !(Symbol.iterator in e)) && !(e instanceof WeakMap) && !(e instanceof WeakSet) && !(e instanceof Error) && !(e instanceof Number) && !(e instanceof Date) && !(e instanceof String) && !(e instanceof RegExp) && !(e instanceof ArrayBuffer) && !(e instanceof Promise), Et = (e, t) => {
|
|
1488
|
+
const s = ke.get(e);
|
|
1489
|
+
if (s?.[0] === t)
|
|
861
1490
|
return s[1];
|
|
862
|
-
const
|
|
863
|
-
return
|
|
864
|
-
if (Object.getOwnPropertyDescriptor(
|
|
1491
|
+
const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1492
|
+
return xe(n, !0), ke.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
|
|
1493
|
+
if (Object.getOwnPropertyDescriptor(n, r))
|
|
865
1494
|
return;
|
|
866
|
-
const i = Reflect.get(
|
|
867
|
-
|
|
868
|
-
|
|
1495
|
+
const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
|
|
1496
|
+
e,
|
|
1497
|
+
r
|
|
869
1498
|
), a = {
|
|
870
1499
|
value: i,
|
|
871
1500
|
enumerable: o,
|
|
@@ -873,214 +1502,216 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
|
|
|
873
1502
|
// It's still non-writable, so it avoids assigning a value.
|
|
874
1503
|
configurable: !0
|
|
875
1504
|
};
|
|
876
|
-
if (
|
|
877
|
-
|
|
878
|
-
else if (
|
|
879
|
-
const [c, u] =
|
|
1505
|
+
if (ge.has(i))
|
|
1506
|
+
xe(i, !1);
|
|
1507
|
+
else if (I.has(i)) {
|
|
1508
|
+
const [c, u] = I.get(
|
|
880
1509
|
i
|
|
881
1510
|
);
|
|
882
|
-
a.value =
|
|
1511
|
+
a.value = Et(c, u());
|
|
883
1512
|
}
|
|
884
|
-
Object.defineProperty(
|
|
885
|
-
}), Object.preventExtensions(
|
|
886
|
-
},
|
|
887
|
-
deleteProperty(
|
|
888
|
-
const o = Reflect.get(
|
|
1513
|
+
Object.defineProperty(n, r, a);
|
|
1514
|
+
}), Object.preventExtensions(n);
|
|
1515
|
+
}, dn = (e, t, s, n) => ({
|
|
1516
|
+
deleteProperty(r, i) {
|
|
1517
|
+
const o = Reflect.get(r, i);
|
|
889
1518
|
s(i);
|
|
890
|
-
const a = Reflect.deleteProperty(
|
|
891
|
-
return a &&
|
|
1519
|
+
const a = Reflect.deleteProperty(r, i);
|
|
1520
|
+
return a && n(["delete", [i], o]), a;
|
|
892
1521
|
},
|
|
893
|
-
set(
|
|
894
|
-
const c = !
|
|
895
|
-
if (c && (
|
|
1522
|
+
set(r, i, o, a) {
|
|
1523
|
+
const c = !e() && Reflect.has(r, i), u = Reflect.get(r, i, a);
|
|
1524
|
+
if (c && (Oe(u, o) || z.has(o) && Oe(u, z.get(o))))
|
|
896
1525
|
return !0;
|
|
897
|
-
s(i),
|
|
898
|
-
const
|
|
899
|
-
return
|
|
900
|
-
}
|
|
901
|
-
}),
|
|
902
|
-
let
|
|
903
|
-
function
|
|
904
|
-
if (!
|
|
1526
|
+
s(i), pe(o) && (o = ln(o) || o);
|
|
1527
|
+
const l = !I.has(o) && gn(o) ? St(o) : o;
|
|
1528
|
+
return t(i, l), Reflect.set(r, i, l, a), n(["set", [i], o, u]), !0;
|
|
1529
|
+
}
|
|
1530
|
+
}), I = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakSet(), ke = /* @__PURE__ */ new WeakMap(), Y = [1], z = /* @__PURE__ */ new WeakMap();
|
|
1531
|
+
let Oe = Object.is, pn = (e, t) => new Proxy(e, t), gn = hn, mn = Et, yn = dn;
|
|
1532
|
+
function St(e = {}) {
|
|
1533
|
+
if (!pe(e))
|
|
905
1534
|
throw new Error("object required");
|
|
906
|
-
const
|
|
907
|
-
if (
|
|
908
|
-
return
|
|
909
|
-
let s =
|
|
910
|
-
const
|
|
911
|
-
s !==
|
|
1535
|
+
const t = z.get(e);
|
|
1536
|
+
if (t)
|
|
1537
|
+
return t;
|
|
1538
|
+
let s = Y[0];
|
|
1539
|
+
const n = /* @__PURE__ */ new Set(), r = (f, p = ++Y[0]) => {
|
|
1540
|
+
s !== p && (i = s = p, n.forEach((g) => g(f, p)));
|
|
912
1541
|
};
|
|
913
1542
|
let i = s;
|
|
914
|
-
const o = (
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
})), s), a = (
|
|
918
|
-
const
|
|
919
|
-
|
|
920
|
-
}, c = /* @__PURE__ */ new Map(), u = (
|
|
921
|
-
const
|
|
922
|
-
if (
|
|
923
|
-
if ((
|
|
1543
|
+
const o = (f = Y[0]) => (i !== f && (i = f, c.forEach(([p]) => {
|
|
1544
|
+
const g = p[1](f);
|
|
1545
|
+
g > s && (s = g);
|
|
1546
|
+
})), s), a = (f) => (p, g) => {
|
|
1547
|
+
const b = [...p];
|
|
1548
|
+
b[1] = [f, ...b[1]], r(b, g);
|
|
1549
|
+
}, c = /* @__PURE__ */ new Map(), u = (f, p) => {
|
|
1550
|
+
const g = !ge.has(p) && I.get(p);
|
|
1551
|
+
if (g) {
|
|
1552
|
+
if ((L ? "production" : void 0) !== "production" && c.has(f))
|
|
924
1553
|
throw new Error("prop listener already exists");
|
|
925
|
-
if (
|
|
926
|
-
const
|
|
927
|
-
c.set(
|
|
1554
|
+
if (n.size) {
|
|
1555
|
+
const b = g[2](a(f));
|
|
1556
|
+
c.set(f, [g, b]);
|
|
928
1557
|
} else
|
|
929
|
-
c.set(
|
|
1558
|
+
c.set(f, [g]);
|
|
930
1559
|
}
|
|
931
|
-
},
|
|
932
|
-
var
|
|
933
|
-
const
|
|
934
|
-
|
|
935
|
-
}, w = (
|
|
936
|
-
if ((
|
|
1560
|
+
}, l = (f) => {
|
|
1561
|
+
var p;
|
|
1562
|
+
const g = c.get(f);
|
|
1563
|
+
g && (c.delete(f), (p = g[1]) == null || p.call(g));
|
|
1564
|
+
}, w = (f) => (n.add(f), n.size === 1 && c.forEach(([g, b], D) => {
|
|
1565
|
+
if ((L ? "production" : void 0) !== "production" && b)
|
|
937
1566
|
throw new Error("remove already exists");
|
|
938
|
-
const
|
|
939
|
-
c.set(
|
|
1567
|
+
const Rt = g[2](a(D));
|
|
1568
|
+
c.set(D, [g, Rt]);
|
|
940
1569
|
}), () => {
|
|
941
|
-
|
|
942
|
-
|
|
1570
|
+
n.delete(f), n.size === 0 && c.forEach(([g, b], D) => {
|
|
1571
|
+
b && (b(), c.set(D, [g]));
|
|
943
1572
|
});
|
|
944
1573
|
});
|
|
945
|
-
let
|
|
946
|
-
const m =
|
|
947
|
-
() =>
|
|
1574
|
+
let d = !0;
|
|
1575
|
+
const m = yn(
|
|
1576
|
+
() => d,
|
|
948
1577
|
u,
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
),
|
|
952
|
-
|
|
953
|
-
const j = [
|
|
954
|
-
return
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
|
|
1578
|
+
l,
|
|
1579
|
+
r
|
|
1580
|
+
), T = pn(e, m);
|
|
1581
|
+
z.set(e, T);
|
|
1582
|
+
const j = [e, o, w];
|
|
1583
|
+
return I.set(T, j), Reflect.ownKeys(e).forEach((f) => {
|
|
1584
|
+
const p = Object.getOwnPropertyDescriptor(
|
|
1585
|
+
e,
|
|
1586
|
+
f
|
|
958
1587
|
);
|
|
959
|
-
"value" in
|
|
960
|
-
}),
|
|
961
|
-
}
|
|
962
|
-
function
|
|
963
|
-
const
|
|
964
|
-
(
|
|
965
|
-
let
|
|
966
|
-
const i = [], o =
|
|
1588
|
+
"value" in p && p.writable && (T[f] = e[f]);
|
|
1589
|
+
}), d = !1, T;
|
|
1590
|
+
}
|
|
1591
|
+
function wn(e, t, s) {
|
|
1592
|
+
const n = I.get(e);
|
|
1593
|
+
(L ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1594
|
+
let r;
|
|
1595
|
+
const i = [], o = n[2];
|
|
967
1596
|
let a = !1;
|
|
968
|
-
const u = o((
|
|
969
|
-
i.push(
|
|
970
|
-
|
|
1597
|
+
const u = o((l) => {
|
|
1598
|
+
i.push(l), r || (r = Promise.resolve().then(() => {
|
|
1599
|
+
r = void 0, a && t(i.splice(0));
|
|
971
1600
|
}));
|
|
972
1601
|
});
|
|
973
1602
|
return a = !0, () => {
|
|
974
1603
|
a = !1, u();
|
|
975
1604
|
};
|
|
976
1605
|
}
|
|
977
|
-
function
|
|
978
|
-
const
|
|
979
|
-
(
|
|
980
|
-
const [s,
|
|
981
|
-
return
|
|
982
|
-
}
|
|
983
|
-
const
|
|
984
|
-
const s =
|
|
985
|
-
|
|
986
|
-
s.current =
|
|
987
|
-
}),
|
|
988
|
-
},
|
|
989
|
-
function
|
|
990
|
-
const
|
|
991
|
-
() =>
|
|
992
|
-
[
|
|
993
|
-
),
|
|
1606
|
+
function De(e) {
|
|
1607
|
+
const t = I.get(e);
|
|
1608
|
+
(L ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1609
|
+
const [s, n] = t;
|
|
1610
|
+
return mn(s, n());
|
|
1611
|
+
}
|
|
1612
|
+
const bn = {}, En = (e, t) => {
|
|
1613
|
+
const s = se(void 0);
|
|
1614
|
+
ne(() => {
|
|
1615
|
+
s.current = fn(e, t);
|
|
1616
|
+
}), Pt(s.current);
|
|
1617
|
+
}, Sn = En, Rn = /* @__PURE__ */ new WeakMap();
|
|
1618
|
+
function Tn(e, t) {
|
|
1619
|
+
const n = me(
|
|
1620
|
+
() => e && /* @__PURE__ */ new WeakMap(),
|
|
1621
|
+
[e]
|
|
1622
|
+
), r = se(void 0);
|
|
994
1623
|
let i = !0;
|
|
995
|
-
const o =
|
|
996
|
-
|
|
1624
|
+
const o = Tt(
|
|
1625
|
+
At(
|
|
997
1626
|
(c) => {
|
|
998
|
-
const u =
|
|
1627
|
+
const u = wn(e, c);
|
|
999
1628
|
return c(), u;
|
|
1000
1629
|
},
|
|
1001
|
-
[
|
|
1630
|
+
[e, void 0]
|
|
1002
1631
|
),
|
|
1003
1632
|
() => {
|
|
1004
|
-
const c =
|
|
1633
|
+
const c = De(e);
|
|
1005
1634
|
try {
|
|
1006
|
-
if (!i &&
|
|
1007
|
-
|
|
1635
|
+
if (!i && r.current && !bt(
|
|
1636
|
+
r.current,
|
|
1008
1637
|
c,
|
|
1009
|
-
|
|
1638
|
+
n,
|
|
1010
1639
|
/* @__PURE__ */ new WeakMap()
|
|
1011
1640
|
))
|
|
1012
|
-
return
|
|
1641
|
+
return r.current;
|
|
1013
1642
|
} catch {
|
|
1014
1643
|
}
|
|
1015
1644
|
return c;
|
|
1016
1645
|
},
|
|
1017
|
-
() =>
|
|
1646
|
+
() => De(e)
|
|
1018
1647
|
);
|
|
1019
|
-
i = !1,
|
|
1020
|
-
|
|
1021
|
-
}), (
|
|
1022
|
-
const a =
|
|
1023
|
-
return
|
|
1648
|
+
i = !1, vt(() => {
|
|
1649
|
+
r.current = o;
|
|
1650
|
+
}), (bn ? "production" : void 0) !== "production" && Sn(o, n);
|
|
1651
|
+
const a = me(() => /* @__PURE__ */ new WeakMap(), []);
|
|
1652
|
+
return wt(o, n, a, Rn);
|
|
1024
1653
|
}
|
|
1025
|
-
const
|
|
1654
|
+
const v = St({
|
|
1026
1655
|
data: null,
|
|
1027
1656
|
isPending: !1,
|
|
1028
1657
|
error: null
|
|
1029
1658
|
});
|
|
1030
|
-
function
|
|
1031
|
-
auth_url:
|
|
1032
|
-
chain:
|
|
1659
|
+
function Un({
|
|
1660
|
+
auth_url: e,
|
|
1661
|
+
chain: t,
|
|
1033
1662
|
token: s,
|
|
1034
|
-
amount:
|
|
1035
|
-
to:
|
|
1663
|
+
amount: n,
|
|
1664
|
+
to: r,
|
|
1036
1665
|
onCancel: i,
|
|
1037
1666
|
onSuccess: o
|
|
1038
1667
|
}) {
|
|
1039
|
-
const a =
|
|
1040
|
-
function
|
|
1668
|
+
const a = Tn(v), [c, u] = Ne(!1);
|
|
1669
|
+
function l() {
|
|
1041
1670
|
u(!0);
|
|
1042
1671
|
}
|
|
1043
1672
|
function w() {
|
|
1044
1673
|
u(!1);
|
|
1045
1674
|
}
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1675
|
+
const d = () => {
|
|
1676
|
+
v.isPending = !0, v.error = null, fetch(e, {
|
|
1048
1677
|
method: "POST",
|
|
1049
1678
|
headers: {
|
|
1050
1679
|
"Content-Type": "application/json"
|
|
1051
1680
|
},
|
|
1052
1681
|
body: JSON.stringify({
|
|
1053
|
-
chain:
|
|
1682
|
+
chain: t,
|
|
1054
1683
|
token: s,
|
|
1055
|
-
amount:
|
|
1056
|
-
to:
|
|
1684
|
+
amount: n,
|
|
1685
|
+
to: r
|
|
1057
1686
|
})
|
|
1058
1687
|
}).then((m) => m.json()).then((m) => {
|
|
1059
|
-
|
|
1688
|
+
v.data = m, h.config({
|
|
1689
|
+
api_key: m.sessionToken
|
|
1690
|
+
}), v.isPending = !1;
|
|
1060
1691
|
}).catch((m) => {
|
|
1061
|
-
|
|
1692
|
+
v.error = m?.toString(), v.isPending = !1;
|
|
1062
1693
|
});
|
|
1063
1694
|
};
|
|
1064
|
-
return
|
|
1065
|
-
d
|
|
1066
|
-
}, [
|
|
1695
|
+
return ne(() => {
|
|
1696
|
+
d();
|
|
1697
|
+
}, [t, s, n, r]), {
|
|
1067
1698
|
...a,
|
|
1068
|
-
chain:
|
|
1699
|
+
chain: t,
|
|
1069
1700
|
token: s,
|
|
1070
|
-
to:
|
|
1701
|
+
to: r,
|
|
1071
1702
|
isOpen: c,
|
|
1072
|
-
open:
|
|
1703
|
+
open: l,
|
|
1073
1704
|
close: w,
|
|
1074
|
-
refetch:
|
|
1705
|
+
refetch: d,
|
|
1075
1706
|
onSuccess: o,
|
|
1076
1707
|
onCancel: i
|
|
1077
1708
|
};
|
|
1078
1709
|
}
|
|
1079
1710
|
export {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1711
|
+
h as Chainrails,
|
|
1712
|
+
In as PaymentModal,
|
|
1713
|
+
Z as chains,
|
|
1714
|
+
Pn as crapi,
|
|
1715
|
+
ht as tokens,
|
|
1716
|
+
Un as usePaymentSession
|
|
1086
1717
|
};
|