@chainrails/react 0.0.9 → 0.0.11
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/README.md +1 -1
- package/dist/chainrails-sdk.es.js +271 -275
- package/dist/chainrails-sdk.es.mjs +271 -275
- package/dist/chainrails-sdk.umd.js +2 -2
- package/dist/hooks/usePaymentModal.d.ts.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -3
|
@@ -1,40 +1,53 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import './index.css';
|
|
1
|
+
import { useState as v, useEffect as F } from "react";
|
|
2
|
+
import { jsxs as k, jsx as g } from "react/jsx-runtime";
|
|
3
|
+
import './index.css';function O(t) {
|
|
4
|
+
var e, s, r = "";
|
|
5
|
+
if (typeof t == "string" || typeof t == "number") r += t;
|
|
6
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
7
|
+
var n = t.length;
|
|
8
|
+
for (e = 0; e < n; e++) t[e] && (s = O(t[e])) && (r && (r += " "), r += s);
|
|
9
|
+
} else for (s in t) t[s] && (r && (r += " "), r += s);
|
|
10
|
+
return r;
|
|
11
|
+
}
|
|
12
|
+
function z() {
|
|
13
|
+
for (var t, e, s = 0, r = "", n = arguments.length; s < n; s++) (t = arguments[s]) && (e = O(t)) && (r && (r += " "), r += e);
|
|
14
|
+
return r;
|
|
15
|
+
}
|
|
16
|
+
class S extends Error {
|
|
4
17
|
response;
|
|
5
18
|
request;
|
|
6
19
|
options;
|
|
7
|
-
constructor(e,
|
|
20
|
+
constructor(e, s, r) {
|
|
8
21
|
const n = e.status || e.status === 0 ? e.status : "", o = e.statusText ?? "", i = `${n} ${o}`.trim(), u = i ? `status code ${i}` : "an unknown error";
|
|
9
|
-
super(`Request failed with ${u}: ${
|
|
22
|
+
super(`Request failed with ${u}: ${s.method} ${s.url}`), this.name = "HTTPError", this.response = e, this.request = s, this.options = r;
|
|
10
23
|
}
|
|
11
24
|
}
|
|
12
25
|
class L extends Error {
|
|
13
26
|
name = "NonError";
|
|
14
27
|
value;
|
|
15
28
|
constructor(e) {
|
|
16
|
-
let
|
|
29
|
+
let s = "Non-error value was thrown";
|
|
17
30
|
try {
|
|
18
|
-
typeof e == "string" ?
|
|
31
|
+
typeof e == "string" ? s = e : e && typeof e == "object" && "message" in e && typeof e.message == "string" && (s = e.message);
|
|
19
32
|
} catch {
|
|
20
33
|
}
|
|
21
|
-
super(
|
|
34
|
+
super(s), this.value = e;
|
|
22
35
|
}
|
|
23
36
|
}
|
|
24
|
-
class
|
|
37
|
+
class E extends Error {
|
|
25
38
|
name = "ForceRetryError";
|
|
26
39
|
customDelay;
|
|
27
40
|
code;
|
|
28
41
|
customRequest;
|
|
29
42
|
constructor(e) {
|
|
30
|
-
const
|
|
31
|
-
super(e?.code ? `Forced retry: ${e.code}` : "Forced retry",
|
|
43
|
+
const s = e?.cause ? e.cause instanceof Error ? e.cause : new L(e.cause) : void 0;
|
|
44
|
+
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
45
|
}
|
|
33
46
|
}
|
|
34
|
-
const
|
|
47
|
+
const N = (() => {
|
|
35
48
|
let t = !1, e = !1;
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
49
|
+
const s = typeof globalThis.ReadableStream == "function", r = typeof globalThis.Request == "function";
|
|
50
|
+
if (s && r)
|
|
38
51
|
try {
|
|
39
52
|
e = new globalThis.Request("https://empty.invalid", {
|
|
40
53
|
body: new globalThis.ReadableStream(),
|
|
@@ -50,7 +63,7 @@ const v = (() => {
|
|
|
50
63
|
throw n;
|
|
51
64
|
}
|
|
52
65
|
return t && !e;
|
|
53
|
-
})(), J = typeof globalThis.AbortController == "function", M = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", V = typeof globalThis.ReadableStream == "function", K = typeof globalThis.FormData == "function",
|
|
66
|
+
})(), J = typeof globalThis.AbortController == "function", M = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", V = typeof globalThis.ReadableStream == "function", K = typeof globalThis.FormData == "function", I = ["get", "post", "put", "patch", "head", "delete"], W = {
|
|
54
67
|
json: "application/json",
|
|
55
68
|
text: "text/*",
|
|
56
69
|
formData: "multipart/form-data",
|
|
@@ -59,14 +72,14 @@ const v = (() => {
|
|
|
59
72
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
60
73
|
// We still feature-check at runtime before exposing the shortcut.
|
|
61
74
|
bytes: "*/*"
|
|
62
|
-
}, A = 2147483647, X = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,
|
|
63
|
-
class
|
|
75
|
+
}, A = 2147483647, X = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, B = Symbol("stop");
|
|
76
|
+
class _ {
|
|
64
77
|
options;
|
|
65
78
|
constructor(e) {
|
|
66
79
|
this.options = e;
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
|
-
const Z = (t) => new
|
|
82
|
+
const Z = (t) => new _(t), Y = {
|
|
70
83
|
json: !0,
|
|
71
84
|
parseJson: !0,
|
|
72
85
|
stringifyJson: !0,
|
|
@@ -103,8 +116,8 @@ const Z = (t) => new H(t), Y = {
|
|
|
103
116
|
return 0;
|
|
104
117
|
if (t instanceof FormData) {
|
|
105
118
|
let e = 0;
|
|
106
|
-
for (const [
|
|
107
|
-
e += X, e += new TextEncoder().encode(`Content-Disposition: form-data; name="${
|
|
119
|
+
for (const [s, r] of t)
|
|
120
|
+
e += X, e += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, e += typeof r == "string" ? new TextEncoder().encode(r).length : r.size;
|
|
108
121
|
return e;
|
|
109
122
|
}
|
|
110
123
|
if (t instanceof Blob)
|
|
@@ -125,19 +138,19 @@ const Z = (t) => new H(t), Y = {
|
|
|
125
138
|
return 0;
|
|
126
139
|
}
|
|
127
140
|
return 0;
|
|
128
|
-
},
|
|
129
|
-
let
|
|
141
|
+
}, H = (t, e, s) => {
|
|
142
|
+
let r, n = 0;
|
|
130
143
|
return t.pipeThrough(new TransformStream({
|
|
131
144
|
transform(o, i) {
|
|
132
|
-
if (i.enqueue(o),
|
|
133
|
-
n +=
|
|
145
|
+
if (i.enqueue(o), r) {
|
|
146
|
+
n += r.byteLength;
|
|
134
147
|
let u = e === 0 ? 0 : n / e;
|
|
135
|
-
u >= 1 && (u = 1 - Number.EPSILON),
|
|
148
|
+
u >= 1 && (u = 1 - Number.EPSILON), s?.({ percent: u, totalBytes: Math.max(e, n), transferredBytes: n }, r);
|
|
136
149
|
}
|
|
137
|
-
|
|
150
|
+
r = o;
|
|
138
151
|
},
|
|
139
152
|
flush() {
|
|
140
|
-
|
|
153
|
+
r && (n += r.byteLength, s?.({ percent: 1, totalBytes: Math.max(e, n), transferredBytes: n }, r));
|
|
141
154
|
}
|
|
142
155
|
}));
|
|
143
156
|
}, te = (t, e) => {
|
|
@@ -149,76 +162,76 @@ const Z = (t) => new H(t), Y = {
|
|
|
149
162
|
statusText: t.statusText,
|
|
150
163
|
headers: t.headers
|
|
151
164
|
});
|
|
152
|
-
const
|
|
153
|
-
return new Response(
|
|
165
|
+
const s = Math.max(0, Number(t.headers.get("content-length")) || 0);
|
|
166
|
+
return new Response(H(t.body, s, e), {
|
|
154
167
|
status: t.status,
|
|
155
168
|
statusText: t.statusText,
|
|
156
169
|
headers: t.headers
|
|
157
170
|
});
|
|
158
|
-
},
|
|
171
|
+
}, se = (t, e, s) => {
|
|
159
172
|
if (!t.body)
|
|
160
173
|
return t;
|
|
161
|
-
const
|
|
174
|
+
const r = ee(s ?? t.body);
|
|
162
175
|
return new Request(t, {
|
|
163
176
|
// @ts-expect-error - Types are outdated.
|
|
164
177
|
duplex: "half",
|
|
165
|
-
body:
|
|
178
|
+
body: H(t.body, r, e)
|
|
166
179
|
});
|
|
167
|
-
},
|
|
180
|
+
}, f = (t) => t !== null && typeof t == "object", w = (...t) => {
|
|
168
181
|
for (const e of t)
|
|
169
|
-
if ((!
|
|
182
|
+
if ((!f(e) || Array.isArray(e)) && e !== void 0)
|
|
170
183
|
throw new TypeError("The `options` argument must be an object");
|
|
171
|
-
return
|
|
184
|
+
return q({}, ...t);
|
|
172
185
|
}, D = (t = {}, e = {}) => {
|
|
173
|
-
const
|
|
186
|
+
const s = new globalThis.Headers(t), r = e instanceof globalThis.Headers, n = new globalThis.Headers(e);
|
|
174
187
|
for (const [o, i] of n.entries())
|
|
175
|
-
|
|
176
|
-
return
|
|
188
|
+
r && i === "undefined" || i === void 0 ? s.delete(o) : s.set(o, i);
|
|
189
|
+
return s;
|
|
177
190
|
};
|
|
178
|
-
function
|
|
179
|
-
return Object.hasOwn(e,
|
|
191
|
+
function b(t, e, s) {
|
|
192
|
+
return Object.hasOwn(e, s) && e[s] === void 0 ? [] : q(t[s] ?? [], e[s] ?? []);
|
|
180
193
|
}
|
|
181
194
|
const $ = (t = {}, e = {}) => ({
|
|
182
|
-
beforeRequest:
|
|
183
|
-
beforeRetry:
|
|
184
|
-
afterResponse:
|
|
185
|
-
beforeError:
|
|
186
|
-
}),
|
|
187
|
-
const
|
|
188
|
-
for (const
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
for (const [n, o] of
|
|
192
|
-
|
|
193
|
-
else if (Array.isArray(
|
|
194
|
-
for (const n of
|
|
195
|
+
beforeRequest: b(t, e, "beforeRequest"),
|
|
196
|
+
beforeRetry: b(t, e, "beforeRetry"),
|
|
197
|
+
afterResponse: b(t, e, "afterResponse"),
|
|
198
|
+
beforeError: b(t, e, "beforeError")
|
|
199
|
+
}), re = (t, e) => {
|
|
200
|
+
const s = new URLSearchParams();
|
|
201
|
+
for (const r of [t, e])
|
|
202
|
+
if (r !== void 0)
|
|
203
|
+
if (r instanceof URLSearchParams)
|
|
204
|
+
for (const [n, o] of r.entries())
|
|
205
|
+
s.append(n, o);
|
|
206
|
+
else if (Array.isArray(r))
|
|
207
|
+
for (const n of r) {
|
|
195
208
|
if (!Array.isArray(n) || n.length !== 2)
|
|
196
209
|
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
197
|
-
|
|
210
|
+
s.append(String(n[0]), String(n[1]));
|
|
198
211
|
}
|
|
199
|
-
else if (
|
|
200
|
-
for (const [n, o] of Object.entries(
|
|
201
|
-
o !== void 0 &&
|
|
212
|
+
else if (f(r))
|
|
213
|
+
for (const [n, o] of Object.entries(r))
|
|
214
|
+
o !== void 0 && s.append(n, String(o));
|
|
202
215
|
else {
|
|
203
|
-
const n = new URLSearchParams(
|
|
216
|
+
const n = new URLSearchParams(r);
|
|
204
217
|
for (const [o, i] of n.entries())
|
|
205
|
-
|
|
218
|
+
s.append(o, i);
|
|
206
219
|
}
|
|
207
|
-
return
|
|
208
|
-
},
|
|
209
|
-
let e = {},
|
|
220
|
+
return s;
|
|
221
|
+
}, q = (...t) => {
|
|
222
|
+
let e = {}, s = {}, r = {}, n;
|
|
210
223
|
const o = [];
|
|
211
224
|
for (const i of t)
|
|
212
225
|
if (Array.isArray(i))
|
|
213
226
|
Array.isArray(e) || (e = []), e = [...e, ...i];
|
|
214
|
-
else if (
|
|
227
|
+
else if (f(i)) {
|
|
215
228
|
for (let [u, a] of Object.entries(i)) {
|
|
216
229
|
if (u === "signal" && a instanceof globalThis.AbortSignal) {
|
|
217
230
|
o.push(a);
|
|
218
231
|
continue;
|
|
219
232
|
}
|
|
220
233
|
if (u === "context") {
|
|
221
|
-
if (a != null && (!
|
|
234
|
+
if (a != null && (!f(a) || Array.isArray(a)))
|
|
222
235
|
throw new TypeError("The `context` option must be an object");
|
|
223
236
|
e = {
|
|
224
237
|
...e,
|
|
@@ -227,15 +240,15 @@ const $ = (t = {}, e = {}) => ({
|
|
|
227
240
|
continue;
|
|
228
241
|
}
|
|
229
242
|
if (u === "searchParams") {
|
|
230
|
-
a == null ? n = void 0 : n = n === void 0 ? a :
|
|
243
|
+
a == null ? n = void 0 : n = n === void 0 ? a : re(n, a);
|
|
231
244
|
continue;
|
|
232
245
|
}
|
|
233
|
-
|
|
246
|
+
f(a) && u in e && (a = q(e[u], a)), e = { ...e, [u]: a };
|
|
234
247
|
}
|
|
235
|
-
|
|
248
|
+
f(i.hooks) && (r = $(r, i.hooks), e.hooks = r), f(i.headers) && (s = D(s, i.headers), e.headers = s);
|
|
236
249
|
}
|
|
237
250
|
return n !== void 0 && (e.searchParams = n), o.length > 0 && (o.length === 1 ? e.signal = o[0] : M ? e.signal = AbortSignal.any(o) : e.signal = o.at(-1)), e.context === void 0 && (e.context = {}), e;
|
|
238
|
-
}, ne = (t) =>
|
|
251
|
+
}, ne = (t) => I.includes(t) ? t.toUpperCase() : t, oe = ["get", "put", "head", "delete", "options", "trace"], ie = [408, 413, 429, 500, 502, 503, 504], ae = [413, 429, 503], U = {
|
|
239
252
|
limit: 2,
|
|
240
253
|
methods: oe,
|
|
241
254
|
statusCodes: ie,
|
|
@@ -248,7 +261,7 @@ const $ = (t = {}, e = {}) => ({
|
|
|
248
261
|
}, ue = (t = {}) => {
|
|
249
262
|
if (typeof t == "number")
|
|
250
263
|
return {
|
|
251
|
-
...
|
|
264
|
+
...U,
|
|
252
265
|
limit: t
|
|
253
266
|
};
|
|
254
267
|
if (t.methods && !Array.isArray(t.methods))
|
|
@@ -256,91 +269,91 @@ const $ = (t = {}, e = {}) => ({
|
|
|
256
269
|
if (t.statusCodes && !Array.isArray(t.statusCodes))
|
|
257
270
|
throw new Error("retry.statusCodes must be an array");
|
|
258
271
|
return {
|
|
259
|
-
...
|
|
272
|
+
...U,
|
|
260
273
|
...t
|
|
261
274
|
};
|
|
262
275
|
};
|
|
263
|
-
class
|
|
276
|
+
class C extends Error {
|
|
264
277
|
request;
|
|
265
278
|
constructor(e) {
|
|
266
279
|
super(`Request timed out: ${e.method} ${e.url}`), this.name = "TimeoutError", this.request = e;
|
|
267
280
|
}
|
|
268
281
|
}
|
|
269
|
-
async function ce(t, e,
|
|
282
|
+
async function ce(t, e, s, r) {
|
|
270
283
|
return new Promise((n, o) => {
|
|
271
284
|
const i = setTimeout(() => {
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
|
|
285
|
+
s && s.abort(), o(new C(t));
|
|
286
|
+
}, r.timeout);
|
|
287
|
+
r.fetch(t, e).then(n).catch(o).then(() => {
|
|
275
288
|
clearTimeout(i);
|
|
276
289
|
});
|
|
277
290
|
});
|
|
278
291
|
}
|
|
279
292
|
async function he(t, { signal: e }) {
|
|
280
|
-
return new Promise((
|
|
293
|
+
return new Promise((s, r) => {
|
|
281
294
|
e && (e.throwIfAborted(), e.addEventListener("abort", n, { once: !0 }));
|
|
282
295
|
function n() {
|
|
283
|
-
clearTimeout(o),
|
|
296
|
+
clearTimeout(o), r(e.reason);
|
|
284
297
|
}
|
|
285
298
|
const o = setTimeout(() => {
|
|
286
|
-
e?.removeEventListener("abort", n),
|
|
299
|
+
e?.removeEventListener("abort", n), s();
|
|
287
300
|
}, t);
|
|
288
301
|
});
|
|
289
302
|
}
|
|
290
303
|
const le = (t, e) => {
|
|
291
|
-
const
|
|
292
|
-
for (const
|
|
293
|
-
Object.hasOwn(e,
|
|
294
|
-
return
|
|
304
|
+
const s = {};
|
|
305
|
+
for (const r in e)
|
|
306
|
+
Object.hasOwn(e, r) && !(r in Q) && !(r in Y) && (!(r in t) || r in G) && (s[r] = e[r]);
|
|
307
|
+
return s;
|
|
295
308
|
}, fe = (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
309
|
function de(t) {
|
|
297
|
-
return t instanceof
|
|
310
|
+
return t instanceof S || t?.name === S.name;
|
|
298
311
|
}
|
|
299
312
|
function pe(t) {
|
|
300
|
-
return t instanceof
|
|
313
|
+
return t instanceof C || t?.name === C.name;
|
|
301
314
|
}
|
|
302
|
-
class
|
|
303
|
-
static create(e,
|
|
304
|
-
const
|
|
305
|
-
if (typeof
|
|
315
|
+
class p {
|
|
316
|
+
static create(e, s) {
|
|
317
|
+
const r = new p(e, s), n = async () => {
|
|
318
|
+
if (typeof r.#e.timeout == "number" && r.#e.timeout > A)
|
|
306
319
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${A}`);
|
|
307
320
|
await Promise.resolve();
|
|
308
|
-
let i = await
|
|
309
|
-
for (const u of
|
|
310
|
-
const a =
|
|
311
|
-
if (
|
|
321
|
+
let i = await r.#y();
|
|
322
|
+
for (const u of r.#e.hooks.afterResponse) {
|
|
323
|
+
const a = r.#h(i.clone()), h = await u(r.request, r.#a(), a, { retryCount: r.#s });
|
|
324
|
+
if (h instanceof globalThis.Response && (i = h), h instanceof _)
|
|
312
325
|
throw await Promise.all([
|
|
313
326
|
a.body?.cancel(),
|
|
314
327
|
i.body?.cancel()
|
|
315
|
-
]), new
|
|
328
|
+
]), new E(h.options);
|
|
316
329
|
}
|
|
317
|
-
if (
|
|
318
|
-
let u = new
|
|
319
|
-
for (const a of
|
|
320
|
-
u = await a(u, { retryCount: s
|
|
330
|
+
if (r.#h(i), !i.ok && (typeof r.#e.throwHttpErrors == "function" ? r.#e.throwHttpErrors(i.status) : r.#e.throwHttpErrors)) {
|
|
331
|
+
let u = new S(i, r.request, r.#a());
|
|
332
|
+
for (const a of r.#e.hooks.beforeError)
|
|
333
|
+
u = await a(u, { retryCount: r.#s });
|
|
321
334
|
throw u;
|
|
322
335
|
}
|
|
323
|
-
if (
|
|
324
|
-
if (typeof
|
|
336
|
+
if (r.#e.onDownloadProgress) {
|
|
337
|
+
if (typeof r.#e.onDownloadProgress != "function")
|
|
325
338
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
326
339
|
if (!V)
|
|
327
340
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
|
-
return te(i.clone(),
|
|
341
|
+
return te(i.clone(), r.#e.onDownloadProgress);
|
|
329
342
|
}
|
|
330
343
|
return i;
|
|
331
|
-
}, o =
|
|
332
|
-
const i =
|
|
333
|
-
i && !i.bodyUsed && u.push(i.body?.cancel()),
|
|
344
|
+
}, o = r.#l(n).finally(async () => {
|
|
345
|
+
const i = r.#o, u = [];
|
|
346
|
+
i && !i.bodyUsed && u.push(i.body?.cancel()), r.request.bodyUsed || u.push(r.request.body?.cancel()), await Promise.all(u);
|
|
334
347
|
});
|
|
335
348
|
for (const [i, u] of Object.entries(W))
|
|
336
349
|
i === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (o[i] = async () => {
|
|
337
|
-
|
|
350
|
+
r.request.headers.set("accept", r.request.headers.get("accept") || u);
|
|
338
351
|
const a = await o;
|
|
339
352
|
if (i === "json") {
|
|
340
353
|
if (a.status === 204)
|
|
341
354
|
return "";
|
|
342
|
-
const
|
|
343
|
-
return
|
|
355
|
+
const h = await a.text();
|
|
356
|
+
return h === "" ? "" : s.parseJson ? s.parseJson(h) : JSON.parse(h);
|
|
344
357
|
}
|
|
345
358
|
return a[i]();
|
|
346
359
|
});
|
|
@@ -348,11 +361,11 @@ class y {
|
|
|
348
361
|
}
|
|
349
362
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
350
363
|
static #d(e) {
|
|
351
|
-
return e && typeof e == "object" && !Array.isArray(e) && !(e instanceof URLSearchParams) ? Object.fromEntries(Object.entries(e).filter(([,
|
|
364
|
+
return e && typeof e == "object" && !Array.isArray(e) && !(e instanceof URLSearchParams) ? Object.fromEntries(Object.entries(e).filter(([, s]) => s !== void 0)) : e;
|
|
352
365
|
}
|
|
353
366
|
request;
|
|
354
|
-
#
|
|
355
|
-
#
|
|
367
|
+
#r;
|
|
368
|
+
#s = 0;
|
|
356
369
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly -- False positive: #input is reassigned on line 202
|
|
357
370
|
#t;
|
|
358
371
|
#e;
|
|
@@ -360,24 +373,24 @@ class y {
|
|
|
360
373
|
#n;
|
|
361
374
|
#i;
|
|
362
375
|
// eslint-disable-next-line complexity
|
|
363
|
-
constructor(e,
|
|
376
|
+
constructor(e, s = {}) {
|
|
364
377
|
if (this.#t = e, this.#e = {
|
|
365
|
-
...
|
|
366
|
-
headers: D(this.#t.headers,
|
|
378
|
+
...s,
|
|
379
|
+
headers: D(this.#t.headers, s.headers),
|
|
367
380
|
hooks: $({
|
|
368
381
|
beforeRequest: [],
|
|
369
382
|
beforeRetry: [],
|
|
370
383
|
beforeError: [],
|
|
371
384
|
afterResponse: []
|
|
372
|
-
},
|
|
373
|
-
method: ne(
|
|
385
|
+
}, s.hooks),
|
|
386
|
+
method: ne(s.method ?? this.#t.method ?? "GET"),
|
|
374
387
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
375
|
-
prefixUrl: String(
|
|
376
|
-
retry: ue(
|
|
377
|
-
throwHttpErrors:
|
|
378
|
-
timeout:
|
|
379
|
-
fetch:
|
|
380
|
-
context:
|
|
388
|
+
prefixUrl: String(s.prefixUrl || ""),
|
|
389
|
+
retry: ue(s.retry),
|
|
390
|
+
throwHttpErrors: s.throwHttpErrors ?? !0,
|
|
391
|
+
timeout: s.timeout ?? 1e4,
|
|
392
|
+
fetch: s.fetch ?? globalThis.fetch.bind(globalThis),
|
|
393
|
+
context: s.context ?? {}
|
|
381
394
|
}, typeof this.#t != "string" && !(this.#t instanceof URL || this.#t instanceof globalThis.Request))
|
|
382
395
|
throw new TypeError("`input` must be a string, URL, or Request");
|
|
383
396
|
if (this.#e.prefixUrl && typeof this.#t == "string") {
|
|
@@ -385,38 +398,38 @@ class y {
|
|
|
385
398
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
386
399
|
this.#e.prefixUrl.endsWith("/") || (this.#e.prefixUrl += "/"), this.#t = this.#e.prefixUrl + this.#t;
|
|
387
400
|
}
|
|
388
|
-
J && M && (this.#n = this.#e.signal ?? this.#t.signal, this.#
|
|
389
|
-
const
|
|
390
|
-
if (this.#t instanceof globalThis.Request && (K && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !
|
|
391
|
-
const o = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(
|
|
401
|
+
J && M && (this.#n = this.#e.signal ?? this.#t.signal, this.#r = new globalThis.AbortController(), this.#e.signal = this.#n ? AbortSignal.any([this.#n, this.#r.signal]) : this.#r.signal), N && (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"));
|
|
402
|
+
const r = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
403
|
+
if (this.#t instanceof globalThis.Request && (K && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !r && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), fe(this.#e.searchParams)) {
|
|
404
|
+
const o = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(p.#d(this.#e.searchParams)).toString()), i = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, o);
|
|
392
405
|
this.request = new globalThis.Request(i, this.#e);
|
|
393
406
|
}
|
|
394
407
|
if (this.#e.onUploadProgress) {
|
|
395
408
|
if (typeof this.#e.onUploadProgress != "function")
|
|
396
409
|
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
397
|
-
if (!
|
|
410
|
+
if (!N)
|
|
398
411
|
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
399
412
|
this.request = this.#f(this.request, this.#e.body ?? void 0);
|
|
400
413
|
}
|
|
401
414
|
}
|
|
402
415
|
#u() {
|
|
403
|
-
const e = this.#e.retry.delay(this.#
|
|
404
|
-
let
|
|
405
|
-
return this.#e.retry.jitter === !0 ?
|
|
416
|
+
const e = this.#e.retry.delay(this.#s);
|
|
417
|
+
let s = e;
|
|
418
|
+
return this.#e.retry.jitter === !0 ? s = Math.random() * e : typeof this.#e.retry.jitter == "function" && (s = this.#e.retry.jitter(e), (!Number.isFinite(s) || s < 0) && (s = e)), Math.min(this.#e.retry.backoffLimit, s);
|
|
406
419
|
}
|
|
407
420
|
async #p(e) {
|
|
408
|
-
if (this.#
|
|
421
|
+
if (this.#s++, this.#s > this.#e.retry.limit)
|
|
409
422
|
throw e;
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
return
|
|
423
|
+
const s = e instanceof Error ? e : new L(e);
|
|
424
|
+
if (s instanceof E)
|
|
425
|
+
return s.customDelay ?? this.#u();
|
|
413
426
|
if (!this.#e.retry.methods.includes(this.request.method.toLowerCase()))
|
|
414
427
|
throw e;
|
|
415
428
|
if (this.#e.retry.shouldRetry !== void 0) {
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
429
|
+
const r = await this.#e.retry.shouldRetry({ error: s, retryCount: this.#s });
|
|
430
|
+
if (r === !1)
|
|
418
431
|
throw e;
|
|
419
|
-
if (
|
|
432
|
+
if (r === !0)
|
|
420
433
|
return this.#u();
|
|
421
434
|
}
|
|
422
435
|
if (pe(e) && !this.#e.retry.retryOnTimeout)
|
|
@@ -424,10 +437,10 @@ class y {
|
|
|
424
437
|
if (de(e)) {
|
|
425
438
|
if (!this.#e.retry.statusCodes.includes(e.response.status))
|
|
426
439
|
throw e;
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
429
|
-
let n = Number(
|
|
430
|
-
Number.isNaN(n) ? n = Date.parse(
|
|
440
|
+
const r = 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");
|
|
441
|
+
if (r && this.#e.retry.afterStatusCodes.includes(e.response.status)) {
|
|
442
|
+
let n = Number(r) * 1e3;
|
|
443
|
+
Number.isNaN(n) ? n = Date.parse(r) - Date.now() : n >= Date.parse("2024-01-01") && (n -= Date.now());
|
|
431
444
|
const o = this.#e.retry.maxRetryAfter ?? n;
|
|
432
445
|
return n < o ? n : o;
|
|
433
446
|
}
|
|
@@ -442,20 +455,20 @@ class y {
|
|
|
442
455
|
async #l(e) {
|
|
443
456
|
try {
|
|
444
457
|
return await e();
|
|
445
|
-
} catch (
|
|
446
|
-
const
|
|
447
|
-
if (this.#
|
|
448
|
-
throw
|
|
449
|
-
if (await he(
|
|
450
|
-
const n = this.#e.signal ? new globalThis.Request(
|
|
458
|
+
} catch (s) {
|
|
459
|
+
const r = Math.min(await this.#p(s), A);
|
|
460
|
+
if (this.#s < 1)
|
|
461
|
+
throw s;
|
|
462
|
+
if (await he(r, this.#n ? { signal: this.#n } : {}), s instanceof E && s.customRequest) {
|
|
463
|
+
const n = this.#e.signal ? new globalThis.Request(s.customRequest, { signal: this.#e.signal }) : new globalThis.Request(s.customRequest);
|
|
451
464
|
this.#c(n);
|
|
452
465
|
}
|
|
453
466
|
for (const n of this.#e.hooks.beforeRetry) {
|
|
454
467
|
const o = await n({
|
|
455
468
|
request: this.request,
|
|
456
469
|
options: this.#a(),
|
|
457
|
-
error:
|
|
458
|
-
retryCount: this.#
|
|
470
|
+
error: s,
|
|
471
|
+
retryCount: this.#s
|
|
459
472
|
});
|
|
460
473
|
if (o instanceof globalThis.Request) {
|
|
461
474
|
this.#c(o);
|
|
@@ -463,64 +476,65 @@ class y {
|
|
|
463
476
|
}
|
|
464
477
|
if (o instanceof globalThis.Response)
|
|
465
478
|
return o;
|
|
466
|
-
if (o ===
|
|
479
|
+
if (o === B)
|
|
467
480
|
return;
|
|
468
481
|
}
|
|
469
482
|
return this.#l(e);
|
|
470
483
|
}
|
|
471
484
|
}
|
|
472
485
|
async #y() {
|
|
473
|
-
this.#
|
|
474
|
-
for (const
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
return
|
|
478
|
-
if (
|
|
479
|
-
this.#c(
|
|
486
|
+
this.#r?.signal.aborted && (this.#r = new globalThis.AbortController(), this.#e.signal = this.#n ? AbortSignal.any([this.#n, this.#r.signal]) : this.#r.signal, this.request = new globalThis.Request(this.request, { signal: this.#e.signal }));
|
|
487
|
+
for (const s of this.#e.hooks.beforeRequest) {
|
|
488
|
+
const r = await s(this.request, this.#a(), { retryCount: this.#s });
|
|
489
|
+
if (r instanceof Response)
|
|
490
|
+
return r;
|
|
491
|
+
if (r instanceof globalThis.Request) {
|
|
492
|
+
this.#c(r);
|
|
480
493
|
break;
|
|
481
494
|
}
|
|
482
495
|
}
|
|
483
496
|
const e = le(this.request, this.#e);
|
|
484
|
-
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, e) : ce(this.#o, e, this.#
|
|
497
|
+
return this.#o = this.request, this.request = this.#o.clone(), this.#e.timeout === !1 ? this.#e.fetch(this.#o, e) : ce(this.#o, e, this.#r, this.#e);
|
|
485
498
|
}
|
|
486
499
|
#a() {
|
|
487
500
|
if (!this.#i) {
|
|
488
|
-
const { hooks: e, ...
|
|
489
|
-
this.#i = Object.freeze(
|
|
501
|
+
const { hooks: e, ...s } = this.#e;
|
|
502
|
+
this.#i = Object.freeze(s);
|
|
490
503
|
}
|
|
491
504
|
return this.#i;
|
|
492
505
|
}
|
|
493
506
|
#c(e) {
|
|
494
507
|
this.#i = void 0, this.request = this.#f(e);
|
|
495
508
|
}
|
|
496
|
-
#f(e,
|
|
497
|
-
return !this.#e.onUploadProgress || !e.body ? e :
|
|
509
|
+
#f(e, s) {
|
|
510
|
+
return !this.#e.onUploadProgress || !e.body ? e : se(e, this.#e.onUploadProgress, s ?? this.#e.body ?? void 0);
|
|
498
511
|
}
|
|
499
512
|
}
|
|
500
513
|
/*! MIT License © Sindre Sorhus */
|
|
501
|
-
const
|
|
502
|
-
const e = (
|
|
503
|
-
for (const
|
|
504
|
-
e[
|
|
505
|
-
return e.create = (
|
|
506
|
-
}, ye =
|
|
507
|
-
|
|
514
|
+
const x = (t) => {
|
|
515
|
+
const e = (s, r) => p.create(s, w(t, r));
|
|
516
|
+
for (const s of I)
|
|
517
|
+
e[s] = (r, n) => p.create(r, w(t, n, { method: s }));
|
|
518
|
+
return e.create = (s) => x(w(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), x(w(t, s))), e.stop = B, e.retry = Z, e;
|
|
519
|
+
}, ye = x();
|
|
520
|
+
var me = /* @__PURE__ */ ((t) => (t.ARBITRUM = "ARBITRUM_MAINNET", t.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", t.BASE = "BASE_MAINNET", t.BASE_TESTNET = "BASE_TESTNET", t.AVALANCHE = "AVALANCHE_MAINNET", t.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", t.BSC = "BSC_MAINNET", t.ETHEREUM = "ETHEREUM_MAINNET", t.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", t.STARKNET = "STARKNET_MAINNET", t))(me || {}), ge = /* @__PURE__ */ ((t) => (t.USDC = "USDC", t))(ge || {});
|
|
521
|
+
class l {
|
|
508
522
|
constructor({ api_key: e }) {
|
|
509
523
|
this.api_key = e;
|
|
510
524
|
}
|
|
511
525
|
static config(e) {
|
|
512
|
-
if (!
|
|
526
|
+
if (!l.app) {
|
|
513
527
|
if (!e)
|
|
514
528
|
throw new Error("Please provide an api_key");
|
|
515
|
-
|
|
529
|
+
l.app = new l(e);
|
|
516
530
|
}
|
|
517
|
-
return e && (this.app.api_key = e.api_key),
|
|
531
|
+
return e && (this.app.api_key = e.api_key), l.app;
|
|
518
532
|
}
|
|
519
533
|
static getApiKey() {
|
|
520
|
-
return
|
|
534
|
+
return l.app.api_key;
|
|
521
535
|
}
|
|
522
|
-
}
|
|
523
|
-
const
|
|
536
|
+
}
|
|
537
|
+
const c = ye.create({
|
|
524
538
|
prefixUrl: "https://dev.chainrails.io/api/v1",
|
|
525
539
|
headers: {
|
|
526
540
|
"Content-Type": "application/json"
|
|
@@ -528,195 +542,177 @@ const h = ye.create({
|
|
|
528
542
|
hooks: {
|
|
529
543
|
beforeRequest: [
|
|
530
544
|
(t) => {
|
|
531
|
-
const e =
|
|
545
|
+
const e = l.getApiKey();
|
|
532
546
|
t.headers.set("Authorization", `Bearer ${e}`);
|
|
533
547
|
}
|
|
534
548
|
],
|
|
535
|
-
afterResponse: [(t, e,
|
|
549
|
+
afterResponse: [(t, e, s) => s]
|
|
536
550
|
},
|
|
537
551
|
retry: {
|
|
538
552
|
limit: 2
|
|
539
553
|
}
|
|
540
554
|
});
|
|
541
|
-
class ge {
|
|
542
|
-
async getClientInfo() {
|
|
543
|
-
return await h.get("client/auth/client-info").json();
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
555
|
class we {
|
|
547
556
|
async getById(e) {
|
|
548
|
-
return await
|
|
557
|
+
return await c.get("intents/" + e).json();
|
|
549
558
|
}
|
|
550
559
|
async getForSender(e) {
|
|
551
|
-
return await
|
|
560
|
+
return await c.get("intents/user/" + e).json();
|
|
552
561
|
}
|
|
553
562
|
async getForAddress(e) {
|
|
554
|
-
return await
|
|
563
|
+
return await c.get("intents/address/" + e).json();
|
|
555
564
|
}
|
|
556
565
|
async getAll(e) {
|
|
557
|
-
return await
|
|
566
|
+
return await c.get("intents", { searchParams: e }).json();
|
|
558
567
|
}
|
|
559
568
|
async create(e) {
|
|
560
|
-
return await
|
|
569
|
+
return await c.post("intents", { json: e }).json();
|
|
561
570
|
}
|
|
562
|
-
async update(e,
|
|
563
|
-
return await
|
|
571
|
+
async update(e, s) {
|
|
572
|
+
return await c.post("intents", { json: s }).json();
|
|
564
573
|
}
|
|
565
574
|
//Calculate Destination
|
|
566
575
|
}
|
|
567
576
|
class be {
|
|
577
|
+
async getFromSpecificBridge(e) {
|
|
578
|
+
return await c.get("quotes/single", { searchParams: e }).json();
|
|
579
|
+
}
|
|
580
|
+
async getFromAllBridges(e) {
|
|
581
|
+
return await c.get("quotes/multiple", { searchParams: e }).json();
|
|
582
|
+
}
|
|
583
|
+
async getBestAcrossBridges(e) {
|
|
584
|
+
return await c.get("quotes/best", { searchParams: e }).json();
|
|
585
|
+
}
|
|
568
586
|
async getAll(e) {
|
|
569
|
-
return await
|
|
587
|
+
return await c.get("quotes/multi-source", { searchParams: e }).json();
|
|
570
588
|
}
|
|
571
589
|
}
|
|
572
590
|
class Te {
|
|
573
591
|
async getOptimalRoutes(e) {
|
|
574
|
-
return await
|
|
592
|
+
return await c.get("router/optimal-route", { searchParams: e }).json();
|
|
575
593
|
}
|
|
576
594
|
async getAllSupportedBridges() {
|
|
577
|
-
return await
|
|
595
|
+
return await c.get("router/supported-bridges/all").json();
|
|
578
596
|
}
|
|
579
597
|
async getSupportedBridges(e) {
|
|
580
|
-
return await
|
|
598
|
+
return await c.get("router/supported-bridges/route", { searchParams: e }).json();
|
|
581
599
|
}
|
|
582
|
-
async getSupportedRoutes(e,
|
|
583
|
-
return await
|
|
600
|
+
async getSupportedRoutes(e, s) {
|
|
601
|
+
return await c.get("router/supported-bridges/bridge/" + e, { searchParams: s }).json();
|
|
584
602
|
}
|
|
585
603
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
intents: new we(),
|
|
590
|
-
client: new ge()
|
|
591
|
-
}, Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
592
|
-
__proto__: null,
|
|
593
|
-
default: Re
|
|
594
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
595
|
-
function F(t) {
|
|
596
|
-
var e, r, s = "";
|
|
597
|
-
if (typeof t == "string" || typeof t == "number") s += t;
|
|
598
|
-
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
599
|
-
var n = t.length;
|
|
600
|
-
for (e = 0; e < n; e++) t[e] && (r = F(t[e])) && (s && (s += " "), s += r);
|
|
601
|
-
} else for (r in t) t[r] && (s && (s += " "), s += r);
|
|
602
|
-
return s;
|
|
603
|
-
}
|
|
604
|
-
function Ee() {
|
|
605
|
-
for (var t, e, r = 0, s = "", n = arguments.length; r < n; r++) (t = arguments[r]) && (e = F(t)) && (s && (s += " "), s += e);
|
|
606
|
-
return s;
|
|
607
|
-
}
|
|
608
|
-
var Se = /* @__PURE__ */ ((t) => (t.ARBITRUM = "ARBITRUM_MAINNET", t.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", t.BASE = "BASE_MAINNET", t.BASE_TESTNET = "BASE_TESTNET", t.AVALANCHE = "AVALANCHE_MAINNET", t.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", t.BSC = "BSC_MAINNET", t.ETHEREUM = "ETHEREUM_MAINNET", t.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", t.STARKNET = "STARKNET_MAINNET", t))(Se || {}), Ae = /* @__PURE__ */ ((t) => (t.USDC = "USDC", t))(Ae || {});
|
|
609
|
-
class f {
|
|
610
|
-
constructor({ api_key: e }) {
|
|
611
|
-
this.api_key = e;
|
|
612
|
-
}
|
|
613
|
-
static config(e) {
|
|
614
|
-
if (!f.app) {
|
|
615
|
-
if (!e)
|
|
616
|
-
throw new Error("Please provide an api_key");
|
|
617
|
-
f.app = new f(e);
|
|
618
|
-
}
|
|
619
|
-
return e && (this.app.api_key = e.api_key), f.app;
|
|
604
|
+
class Re {
|
|
605
|
+
async getSupported(e) {
|
|
606
|
+
return await c.get("chains", { searchParams: e }).json();
|
|
620
607
|
}
|
|
621
|
-
|
|
622
|
-
|
|
608
|
+
}
|
|
609
|
+
class Ee {
|
|
610
|
+
async getClientInfo() {
|
|
611
|
+
return await c.get("client/auth/client-info").json();
|
|
623
612
|
}
|
|
624
613
|
}
|
|
625
|
-
|
|
614
|
+
const Ce = {
|
|
615
|
+
router: new Te(),
|
|
616
|
+
quotes: new be(),
|
|
617
|
+
intents: new we(),
|
|
618
|
+
chains: new Re(),
|
|
619
|
+
client: new Ee()
|
|
620
|
+
};
|
|
621
|
+
function xe(t) {
|
|
626
622
|
const {
|
|
627
623
|
to: e,
|
|
628
|
-
token:
|
|
629
|
-
chain:
|
|
624
|
+
token: s,
|
|
625
|
+
chain: r,
|
|
630
626
|
amount: n,
|
|
631
627
|
isOpen: o,
|
|
632
628
|
close: i,
|
|
633
629
|
complete: u,
|
|
634
630
|
cancel: a,
|
|
635
|
-
chainSelected:
|
|
636
|
-
intentCreated:
|
|
637
|
-
...
|
|
638
|
-
} = t, [
|
|
639
|
-
return
|
|
640
|
-
const
|
|
641
|
-
o ? document.body.style.overflow = "hidden" : document.body.style.overflow =
|
|
642
|
-
const
|
|
643
|
-
|
|
631
|
+
chainSelected: h,
|
|
632
|
+
intentCreated: y,
|
|
633
|
+
...T
|
|
634
|
+
} = t, [d, R] = v(!0);
|
|
635
|
+
return F(() => {
|
|
636
|
+
const P = document.body.style.overflow;
|
|
637
|
+
o ? document.body.style.overflow = "hidden" : document.body.style.overflow = P || "";
|
|
638
|
+
const j = (m) => {
|
|
639
|
+
m.data === "closed" && a(), m.data === "completed" && u(), m.data === "chainSelected" && h(), m.data === "intentCreated" && y();
|
|
644
640
|
};
|
|
645
|
-
return window.addEventListener("message",
|
|
646
|
-
document.body.style.overflow =
|
|
641
|
+
return window.addEventListener("message", j), () => {
|
|
642
|
+
document.body.style.overflow = P || "", window.removeEventListener("message", j);
|
|
647
643
|
};
|
|
648
|
-
}, [o, a, u,
|
|
649
|
-
...
|
|
650
|
-
className:
|
|
651
|
-
children: [
|
|
644
|
+
}, [o, a, u, h, y]), /* @__PURE__ */ k("div", {
|
|
645
|
+
...T,
|
|
646
|
+
className: z("payment-modal-wrapper", d ? "loading" : "not-loading", o ? "open" : "closed"),
|
|
647
|
+
children: [d && /* @__PURE__ */ g("div", {
|
|
652
648
|
role: "status",
|
|
653
649
|
className: "payment-modal-loader",
|
|
654
|
-
children: /* @__PURE__ */
|
|
650
|
+
children: /* @__PURE__ */ k("svg", {
|
|
655
651
|
"aria-hidden": "true",
|
|
656
652
|
className: "icon",
|
|
657
653
|
viewBox: "0 0 100 101",
|
|
658
654
|
fill: "none",
|
|
659
655
|
xmlns: "http://www.w3.org/2000/svg",
|
|
660
|
-
children: [/* @__PURE__ */
|
|
656
|
+
children: [/* @__PURE__ */ g("path", {
|
|
661
657
|
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",
|
|
662
658
|
fill: "currentColor"
|
|
663
|
-
}), /* @__PURE__ */
|
|
659
|
+
}), /* @__PURE__ */ g("path", {
|
|
664
660
|
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",
|
|
665
661
|
fill: "currentFill"
|
|
666
662
|
})]
|
|
667
663
|
})
|
|
668
|
-
}), /* @__PURE__ */
|
|
664
|
+
}), /* @__PURE__ */ g("iframe", {
|
|
669
665
|
allow: "clipboard-read *; clipboard-write *",
|
|
670
|
-
src: `https://chainrails
|
|
666
|
+
src: `https://app.chainrails.io/pay/_chain_/${r}/_token_/${s}/_to_/${e}/_amount_/${n * 100}?id=${l.getApiKey()}`,
|
|
671
667
|
onLoad: () => {
|
|
672
|
-
|
|
668
|
+
R(!1);
|
|
673
669
|
},
|
|
674
|
-
className: `payment-modal ${
|
|
670
|
+
className: `payment-modal ${d ? "invisible" : "visible"}`
|
|
675
671
|
})]
|
|
676
672
|
});
|
|
677
673
|
}
|
|
678
674
|
function qe(t) {
|
|
679
675
|
const {
|
|
680
676
|
onCancel: e,
|
|
681
|
-
onSuccess:
|
|
682
|
-
onChainSelect:
|
|
677
|
+
onSuccess: s,
|
|
678
|
+
onChainSelect: r,
|
|
683
679
|
onIntentCreate: n,
|
|
684
680
|
...o
|
|
685
|
-
} = t, [i, u] =
|
|
681
|
+
} = t, [i, u] = v(!1);
|
|
686
682
|
function a() {
|
|
687
683
|
u(!0);
|
|
688
684
|
}
|
|
689
|
-
function
|
|
685
|
+
function h() {
|
|
690
686
|
u(!1);
|
|
691
687
|
}
|
|
692
|
-
function
|
|
693
|
-
|
|
688
|
+
function y() {
|
|
689
|
+
h(), e?.();
|
|
694
690
|
}
|
|
695
|
-
function
|
|
696
|
-
window.setTimeout(
|
|
691
|
+
function T() {
|
|
692
|
+
window.setTimeout(h, 2e3), s?.();
|
|
697
693
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
694
|
+
function d() {
|
|
695
|
+
r?.();
|
|
700
696
|
}
|
|
701
|
-
function
|
|
697
|
+
function R() {
|
|
702
698
|
n?.();
|
|
703
699
|
}
|
|
704
700
|
return {
|
|
705
701
|
open: a,
|
|
706
|
-
close:
|
|
707
|
-
complete:
|
|
708
|
-
cancel:
|
|
709
|
-
chainSelected:
|
|
710
|
-
intentCreated:
|
|
702
|
+
close: h,
|
|
703
|
+
complete: T,
|
|
704
|
+
cancel: y,
|
|
705
|
+
chainSelected: d,
|
|
706
|
+
intentCreated: R,
|
|
711
707
|
isOpen: i,
|
|
712
708
|
...o
|
|
713
709
|
};
|
|
714
710
|
}
|
|
715
711
|
export {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
712
|
+
l as Chainrails,
|
|
713
|
+
xe as PaymentModal,
|
|
714
|
+
me as chains,
|
|
715
|
+
Ce as crapi,
|
|
716
|
+
ge as tokens,
|
|
721
717
|
qe as usePaymentModal
|
|
722
718
|
};
|