@chainrails/react 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PaymentModal/index.d.ts.map +1 -1
- package/dist/chainrails-sdk.es.js +101 -111
- package/dist/chainrails-sdk.es.mjs +101 -111
- package/dist/chainrails-sdk.umd.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaymentModal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaymentModal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAiIpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useState as k, useRef as le, useEffect as x, useMemo as
|
|
2
|
-
import { jsxs as Ae, jsx as
|
|
1
|
+
import { useState as k, useRef as le, useEffect as x, useMemo as Re, useSyncExternalStore as bt, useCallback as Et, useLayoutEffect as St, useDebugValue as wt } from "react";
|
|
2
|
+
import { jsxs as Ae, jsx as F } from "react/jsx-runtime";
|
|
3
3
|
import './index.css';class oe extends Error {
|
|
4
4
|
response;
|
|
5
5
|
request;
|
|
@@ -50,7 +50,7 @@ const De = (() => {
|
|
|
50
50
|
throw o;
|
|
51
51
|
}
|
|
52
52
|
return t && !e;
|
|
53
|
-
})(),
|
|
53
|
+
})(), Ct = typeof globalThis.AbortController == "function", ze = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Rt = typeof globalThis.ReadableStream == "function", At = typeof globalThis.FormData == "function", qe = ["get", "post", "put", "patch", "head", "delete"], Dt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -164,7 +164,7 @@ const vt = (t) => new We(t), kt = {
|
|
|
164
164
|
duplex: "half",
|
|
165
165
|
body: Ve(t.body, n, e)
|
|
166
166
|
});
|
|
167
|
-
}, P = (t) => t !== null && typeof t == "object",
|
|
167
|
+
}, P = (t) => t !== null && typeof t == "object", _ = (...t) => {
|
|
168
168
|
for (const e of t)
|
|
169
169
|
if ((!P(e) || Array.isArray(e)) && e !== void 0)
|
|
170
170
|
throw new TypeError("The `options` argument must be an object");
|
|
@@ -235,11 +235,11 @@ const Ge = (t = {}, e = {}) => ({
|
|
|
235
235
|
P(r.hooks) && (n = Ge(n, r.hooks), e.hooks = n), P(r.headers) && (s = Ye(s, r.headers), e.headers = s);
|
|
236
236
|
}
|
|
237
237
|
return o !== void 0 && (e.searchParams = o), i.length > 0 && (i.length === 1 ? e.signal = i[0] : ze ? e.signal = AbortSignal.any(i) : e.signal = i.at(-1)), e.context === void 0 && (e.context = {}), e;
|
|
238
|
-
}, Mt = (t) => qe.includes(t) ? t.toUpperCase() : t, Lt = ["get", "put", "head", "delete", "options", "trace"],
|
|
238
|
+
}, Mt = (t) => qe.includes(t) ? t.toUpperCase() : t, Lt = ["get", "put", "head", "delete", "options", "trace"], Ft = [408, 413, 429, 500, 502, 503, 504], _t = [413, 429, 503], Ue = {
|
|
239
239
|
limit: 2,
|
|
240
240
|
methods: Lt,
|
|
241
|
-
statusCodes:
|
|
242
|
-
afterStatusCodes:
|
|
241
|
+
statusCodes: Ft,
|
|
242
|
+
afterStatusCodes: _t,
|
|
243
243
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
244
244
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
245
245
|
delay: (t) => 0.3 * 2 ** (t - 1) * 1e3,
|
|
@@ -323,7 +323,7 @@ class L {
|
|
|
323
323
|
if (n.#e.onDownloadProgress) {
|
|
324
324
|
if (typeof n.#e.onDownloadProgress != "function")
|
|
325
325
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
326
|
-
if (!
|
|
326
|
+
if (!Rt)
|
|
327
327
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
328
328
|
return Nt(r.clone(), n.#e.onDownloadProgress);
|
|
329
329
|
}
|
|
@@ -385,7 +385,7 @@ class L {
|
|
|
385
385
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
386
386
|
this.#e.prefixUrl.endsWith("/") || (this.#e.prefixUrl += "/"), this.#t = this.#e.prefixUrl + this.#t;
|
|
387
387
|
}
|
|
388
|
-
|
|
388
|
+
Ct && ze && (this.#o = this.#e.signal ?? this.#t.signal, this.#n = new globalThis.AbortController(), this.#e.signal = this.#o ? AbortSignal.any([this.#o, this.#n.signal]) : this.#n.signal), De && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
|
|
389
389
|
const n = s.headers && new globalThis.Headers(s.headers).has("content-type");
|
|
390
390
|
if (this.#t instanceof globalThis.Request && (At && 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), qt(this.#e.searchParams)) {
|
|
391
391
|
const i = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(L.#h(this.#e.searchParams)).toString()), r = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
|
|
@@ -499,10 +499,10 @@ class L {
|
|
|
499
499
|
}
|
|
500
500
|
/*! MIT License © Sindre Sorhus */
|
|
501
501
|
const ie = (t) => {
|
|
502
|
-
const e = (s, n) => L.create(s,
|
|
502
|
+
const e = (s, n) => L.create(s, _(t, n));
|
|
503
503
|
for (const s of qe)
|
|
504
|
-
e[s] = (n, o) => L.create(n,
|
|
505
|
-
return e.create = (s) => ie(
|
|
504
|
+
e[s] = (n, o) => L.create(n, _(t, o, { method: s }));
|
|
505
|
+
return e.create = (s) => ie(_(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), ie(_(t, s))), e.stop = Ke, e.retry = vt, e;
|
|
506
506
|
}, Vt = ie(), b = {
|
|
507
507
|
ARBITRUM: "ARBITRUM_MAINNET",
|
|
508
508
|
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
@@ -799,7 +799,7 @@ for (let t = 0, e = O, s = 1, n = 0; t < 24; t++) {
|
|
|
799
799
|
e = (e << O ^ (e >> Es) * ws) % Ss, e & bs && (o ^= O << (O << /* @__PURE__ */ BigInt(i)) - O);
|
|
800
800
|
rt.push(o);
|
|
801
801
|
}
|
|
802
|
-
const it = os(rt, !0),
|
|
802
|
+
const it = os(rt, !0), Cs = it[0], Rs = it[1], Oe = (t, e, s) => s > 32 ? as(t, e, s) : rs(t, e, s), Be = (t, e, s) => s > 32 ? cs(t, e, s) : is(t, e, s);
|
|
803
803
|
function As(t, e = 24) {
|
|
804
804
|
const s = new Uint32Array(10);
|
|
805
805
|
for (let n = 24 - e; n < 24; n++) {
|
|
@@ -821,7 +821,7 @@ function As(t, e = 24) {
|
|
|
821
821
|
for (let a = 0; a < 10; a++)
|
|
822
822
|
t[r + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
823
823
|
}
|
|
824
|
-
t[0] ^=
|
|
824
|
+
t[0] ^= Cs[n], t[1] ^= Rs[n];
|
|
825
825
|
}
|
|
826
826
|
tt(s);
|
|
827
827
|
}
|
|
@@ -936,7 +936,7 @@ function ct(t, e) {
|
|
|
936
936
|
const i = `0x${o.join("")}`;
|
|
937
937
|
return ee.set(`${t}.${e}`, i), i;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function S(t, e) {
|
|
940
940
|
if (!Ps(t, { strict: !1 }))
|
|
941
941
|
throw new ks({ address: t });
|
|
942
942
|
return ct(t, e);
|
|
@@ -965,7 +965,7 @@ c.USDC;
|
|
|
965
965
|
const ut = {
|
|
966
966
|
[b.ARBITRUM]: {
|
|
967
967
|
[c.DAI]: {
|
|
968
|
-
address:
|
|
968
|
+
address: S("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
969
969
|
symbol: c.DAI,
|
|
970
970
|
name: "Dai Stablecoin",
|
|
971
971
|
decimals: 18,
|
|
@@ -981,7 +981,7 @@ const ut = {
|
|
|
981
981
|
nativeToken: !0
|
|
982
982
|
},
|
|
983
983
|
[c.USDC]: {
|
|
984
|
-
address:
|
|
984
|
+
address: S("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
985
985
|
symbol: c.USDC,
|
|
986
986
|
name: "USD Coin",
|
|
987
987
|
decimals: 6,
|
|
@@ -989,7 +989,7 @@ const ut = {
|
|
|
989
989
|
nativeToken: !1
|
|
990
990
|
},
|
|
991
991
|
[c.USDT]: {
|
|
992
|
-
address:
|
|
992
|
+
address: S("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
993
993
|
symbol: c.USDT,
|
|
994
994
|
name: "Tether USD",
|
|
995
995
|
decimals: 6,
|
|
@@ -997,7 +997,7 @@ const ut = {
|
|
|
997
997
|
nativeToken: !1
|
|
998
998
|
},
|
|
999
999
|
[c.WETH]: {
|
|
1000
|
-
address:
|
|
1000
|
+
address: S("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
1001
1001
|
symbol: c.WETH,
|
|
1002
1002
|
name: "Wrapped Ether",
|
|
1003
1003
|
decimals: 18,
|
|
@@ -1007,7 +1007,7 @@ const ut = {
|
|
|
1007
1007
|
},
|
|
1008
1008
|
[b.ARBITRUM_TESTNET]: {
|
|
1009
1009
|
[c.USDC]: {
|
|
1010
|
-
address:
|
|
1010
|
+
address: S("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
1011
1011
|
symbol: c.USDC,
|
|
1012
1012
|
name: "USD Coin",
|
|
1013
1013
|
fiatISO: "USD",
|
|
@@ -1027,7 +1027,7 @@ const ut = {
|
|
|
1027
1027
|
nativeToken: !1
|
|
1028
1028
|
},
|
|
1029
1029
|
[c.USDC]: {
|
|
1030
|
-
address:
|
|
1030
|
+
address: S("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
1031
1031
|
symbol: c.USDC,
|
|
1032
1032
|
name: "USD Coin",
|
|
1033
1033
|
fiatISO: "USD",
|
|
@@ -1055,7 +1055,7 @@ const ut = {
|
|
|
1055
1055
|
},
|
|
1056
1056
|
[b.AVALANCHE_TESTNET]: {
|
|
1057
1057
|
[c.USDC]: {
|
|
1058
|
-
address:
|
|
1058
|
+
address: S("0x5425890298aed601595a70AB815c96711a31Bc65"),
|
|
1059
1059
|
symbol: c.USDC,
|
|
1060
1060
|
name: "USD Coin",
|
|
1061
1061
|
fiatISO: "USD",
|
|
@@ -1091,7 +1091,7 @@ const ut = {
|
|
|
1091
1091
|
nativeToken: !1
|
|
1092
1092
|
},
|
|
1093
1093
|
[c.USDC]: {
|
|
1094
|
-
address:
|
|
1094
|
+
address: S("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
1095
1095
|
symbol: c.USDC,
|
|
1096
1096
|
name: "USD Coin",
|
|
1097
1097
|
fiatISO: "USD",
|
|
@@ -1101,7 +1101,7 @@ const ut = {
|
|
|
1101
1101
|
nativeToken: !1
|
|
1102
1102
|
},
|
|
1103
1103
|
[c.WETH]: {
|
|
1104
|
-
address:
|
|
1104
|
+
address: S("0x4200000000000000000000000000000000000006"),
|
|
1105
1105
|
symbol: c.WETH,
|
|
1106
1106
|
name: "Wrapped Ether",
|
|
1107
1107
|
decimals: 18,
|
|
@@ -1111,7 +1111,7 @@ const ut = {
|
|
|
1111
1111
|
},
|
|
1112
1112
|
[b.BASE_TESTNET]: {
|
|
1113
1113
|
[c.USDC]: {
|
|
1114
|
-
address:
|
|
1114
|
+
address: S("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
1115
1115
|
symbol: c.USDC,
|
|
1116
1116
|
name: "USD Coin",
|
|
1117
1117
|
fiatISO: "USD",
|
|
@@ -1155,7 +1155,7 @@ const ut = {
|
|
|
1155
1155
|
nativeToken: !1
|
|
1156
1156
|
},
|
|
1157
1157
|
[c.USDC]: {
|
|
1158
|
-
address:
|
|
1158
|
+
address: S("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1159
1159
|
symbol: c.USDC,
|
|
1160
1160
|
decimals: 18,
|
|
1161
1161
|
name: "USD Coin",
|
|
@@ -1182,7 +1182,7 @@ const ut = {
|
|
|
1182
1182
|
nativeToken: !1
|
|
1183
1183
|
},
|
|
1184
1184
|
[c.DAI]: {
|
|
1185
|
-
address:
|
|
1185
|
+
address: S("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
|
|
1186
1186
|
symbol: c.DAI,
|
|
1187
1187
|
name: "Dai Stablecoin",
|
|
1188
1188
|
decimals: 18,
|
|
@@ -1214,7 +1214,7 @@ const ut = {
|
|
|
1214
1214
|
nativeToken: !1
|
|
1215
1215
|
},
|
|
1216
1216
|
[c.USDC]: {
|
|
1217
|
-
address:
|
|
1217
|
+
address: S("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1218
1218
|
symbol: c.USDC,
|
|
1219
1219
|
name: "USD Coin",
|
|
1220
1220
|
decimals: 6,
|
|
@@ -1223,7 +1223,7 @@ const ut = {
|
|
|
1223
1223
|
nativeToken: !1
|
|
1224
1224
|
},
|
|
1225
1225
|
[c.USDT]: {
|
|
1226
|
-
address:
|
|
1226
|
+
address: S("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
1227
1227
|
symbol: c.USDT,
|
|
1228
1228
|
name: "Tether USD",
|
|
1229
1229
|
decimals: 6,
|
|
@@ -1231,7 +1231,7 @@ const ut = {
|
|
|
1231
1231
|
nativeToken: !1
|
|
1232
1232
|
},
|
|
1233
1233
|
[c.WETH]: {
|
|
1234
|
-
address:
|
|
1234
|
+
address: S("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
1235
1235
|
symbol: c.WETH,
|
|
1236
1236
|
name: "Wrapped Ether",
|
|
1237
1237
|
decimals: 18,
|
|
@@ -1241,7 +1241,7 @@ const ut = {
|
|
|
1241
1241
|
},
|
|
1242
1242
|
[b.ETHEREUM_TESTNET]: {
|
|
1243
1243
|
[c.USDC]: {
|
|
1244
|
-
address:
|
|
1244
|
+
address: S("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1245
1245
|
symbol: c.USDC,
|
|
1246
1246
|
decimals: 6,
|
|
1247
1247
|
name: "USD Coin",
|
|
@@ -1438,7 +1438,7 @@ const ut = {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
}, xs = new Set(Object.values(b));
|
|
1441
|
-
function
|
|
1441
|
+
function w(t) {
|
|
1442
1442
|
if (Ns(t))
|
|
1443
1443
|
return t;
|
|
1444
1444
|
const e = b[t];
|
|
@@ -1578,7 +1578,7 @@ class Ls {
|
|
|
1578
1578
|
return await p().get("intents", { searchParams: e }).json();
|
|
1579
1579
|
}
|
|
1580
1580
|
async create(e) {
|
|
1581
|
-
const s =
|
|
1581
|
+
const s = w(e.source_chain), n = w(e.destination_chain);
|
|
1582
1582
|
return await p().post("intents", {
|
|
1583
1583
|
json: {
|
|
1584
1584
|
...e,
|
|
@@ -1588,7 +1588,7 @@ class Ls {
|
|
|
1588
1588
|
}).json();
|
|
1589
1589
|
}
|
|
1590
1590
|
async createForSession(e) {
|
|
1591
|
-
const s =
|
|
1591
|
+
const s = w(e.sourceChain);
|
|
1592
1592
|
return await p().post("modal/sessions/intents", {
|
|
1593
1593
|
json: { ...e, sourceChain: s }
|
|
1594
1594
|
}).json();
|
|
@@ -1603,11 +1603,11 @@ class Ls {
|
|
|
1603
1603
|
return await p().post(`modal/sessions/intents/${e}/process`).json();
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
class
|
|
1606
|
+
class Fs {
|
|
1607
1607
|
async getFromSpecificBridge(e) {
|
|
1608
|
-
const s =
|
|
1608
|
+
const s = w(e.sourceChain);
|
|
1609
1609
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1610
|
-
const n =
|
|
1610
|
+
const n = w(e.destinationChain);
|
|
1611
1611
|
return await p().get("quotes/single", {
|
|
1612
1612
|
searchParams: {
|
|
1613
1613
|
...e,
|
|
@@ -1617,9 +1617,9 @@ class _s {
|
|
|
1617
1617
|
}).json();
|
|
1618
1618
|
}
|
|
1619
1619
|
async getFromAllBridges(e) {
|
|
1620
|
-
const s =
|
|
1620
|
+
const s = w(e.sourceChain);
|
|
1621
1621
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1622
|
-
const n =
|
|
1622
|
+
const n = w(e.destinationChain);
|
|
1623
1623
|
return await p().get("quotes/multiple", {
|
|
1624
1624
|
searchParams: {
|
|
1625
1625
|
...e,
|
|
@@ -1629,9 +1629,9 @@ class _s {
|
|
|
1629
1629
|
}).json();
|
|
1630
1630
|
}
|
|
1631
1631
|
async getBestAcrossBridges(e) {
|
|
1632
|
-
const s =
|
|
1632
|
+
const s = w(e.sourceChain);
|
|
1633
1633
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1634
|
-
const n =
|
|
1634
|
+
const n = w(e.destinationChain);
|
|
1635
1635
|
return await p().get("quotes/best", { searchParams: {
|
|
1636
1636
|
...e,
|
|
1637
1637
|
sourceChain: s,
|
|
@@ -1639,7 +1639,7 @@ class _s {
|
|
|
1639
1639
|
} }).json();
|
|
1640
1640
|
}
|
|
1641
1641
|
async getAll(e) {
|
|
1642
|
-
const s =
|
|
1642
|
+
const s = w(e.destinationChain);
|
|
1643
1643
|
return await p().get("quotes/multi-source", { searchParams: {
|
|
1644
1644
|
...e,
|
|
1645
1645
|
destinationChain: s
|
|
@@ -1649,9 +1649,9 @@ class _s {
|
|
|
1649
1649
|
return await p().get("modal/sessions/quotes", { searchParams: e }).json();
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
|
-
class
|
|
1652
|
+
class _s {
|
|
1653
1653
|
async getOptimalRoutes(e) {
|
|
1654
|
-
const s =
|
|
1654
|
+
const s = w(e.sourceChain), n = w(e.destinationChain);
|
|
1655
1655
|
return await p().get("router/optimal-route", {
|
|
1656
1656
|
searchParams: {
|
|
1657
1657
|
...e,
|
|
@@ -1664,7 +1664,7 @@ class Fs {
|
|
|
1664
1664
|
return await p().get("router/supported-bridges/all").json();
|
|
1665
1665
|
}
|
|
1666
1666
|
async getSupportedBridges(e) {
|
|
1667
|
-
const s =
|
|
1667
|
+
const s = w(e.sourceChain), n = w(e.destinationChain);
|
|
1668
1668
|
return await p().get("router/supported-bridges/route", { searchParams: {
|
|
1669
1669
|
...e,
|
|
1670
1670
|
sourceChain: s,
|
|
@@ -1693,7 +1693,7 @@ class $s {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
class js {
|
|
1695
1695
|
async getSessionToken(e) {
|
|
1696
|
-
const s =
|
|
1696
|
+
const s = w(e.destinationChain);
|
|
1697
1697
|
let n = Me(s, e.token);
|
|
1698
1698
|
n || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), n = Me(s, "USDC"));
|
|
1699
1699
|
const o = {
|
|
@@ -1706,8 +1706,8 @@ class js {
|
|
|
1706
1706
|
}
|
|
1707
1707
|
}
|
|
1708
1708
|
const gn = {
|
|
1709
|
-
router: new
|
|
1710
|
-
quotes: new
|
|
1709
|
+
router: new _s(),
|
|
1710
|
+
quotes: new Fs(),
|
|
1711
1711
|
intents: new Ls(),
|
|
1712
1712
|
chains: new Hs(),
|
|
1713
1713
|
client: new $s(),
|
|
@@ -1740,7 +1740,7 @@ function pn(t) {
|
|
|
1740
1740
|
onSuccess: l,
|
|
1741
1741
|
session_url: f,
|
|
1742
1742
|
sessionToken: E
|
|
1743
|
-
} = t, [h, y] = k(0), [C, V] = k(""), [
|
|
1743
|
+
} = t, [h, y] = k(0), [C, V] = k(""), [g, T] = k(null), m = le(null);
|
|
1744
1744
|
d.config({
|
|
1745
1745
|
api_key: "",
|
|
1746
1746
|
// @ts-expect-error
|
|
@@ -1748,46 +1748,36 @@ function pn(t) {
|
|
|
1748
1748
|
}), x(() => {
|
|
1749
1749
|
V(d.getPayModalUrl(e));
|
|
1750
1750
|
}, [e]), x(() => {
|
|
1751
|
-
const
|
|
1752
|
-
if (
|
|
1753
|
-
themeValue: S
|
|
1754
|
-
}), !S || qs.includes(S)) {
|
|
1751
|
+
const R = s?.theme;
|
|
1752
|
+
if (!R || qs.includes(R)) {
|
|
1755
1753
|
T(null);
|
|
1756
1754
|
return;
|
|
1757
1755
|
}
|
|
1758
1756
|
let D = !1;
|
|
1759
1757
|
return (async () => {
|
|
1760
1758
|
try {
|
|
1761
|
-
const G = d.getBaseUrl(),
|
|
1762
|
-
if (!
|
|
1763
|
-
const X = await
|
|
1764
|
-
!D && X.status === "approved" && X.
|
|
1759
|
+
const G = d.getBaseUrl(), Ce = await fetch(`${G}/themes/${R}`);
|
|
1760
|
+
if (!Ce.ok) return;
|
|
1761
|
+
const X = await Ce.json();
|
|
1762
|
+
!D && X.status === "approved" && X.cssContent && T(X.cssContent);
|
|
1765
1763
|
} catch (G) {
|
|
1766
1764
|
console.error("Failed to fetch theme:", G);
|
|
1767
|
-
} finally {
|
|
1768
|
-
console.log({
|
|
1769
|
-
themeCss: m
|
|
1770
|
-
});
|
|
1771
1765
|
}
|
|
1772
1766
|
})(), () => {
|
|
1773
1767
|
D = !0;
|
|
1774
1768
|
};
|
|
1775
1769
|
}, [s?.theme]), x(() => {
|
|
1776
|
-
const
|
|
1777
|
-
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
1770
|
+
const R = document.body.style.overflow;
|
|
1771
|
+
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = R || "";
|
|
1778
1772
|
const D = (Y) => {
|
|
1779
1773
|
Y.data === "closed" && (a(), u?.()), Y.data === "completed" && (window.setTimeout(a, 2e3), l?.());
|
|
1780
1774
|
};
|
|
1781
1775
|
return window.addEventListener("message", D), () => {
|
|
1782
|
-
document.body.style.overflow =
|
|
1776
|
+
document.body.style.overflow = R || "", window.removeEventListener("message", D);
|
|
1783
1777
|
};
|
|
1784
1778
|
}, [o, u, l]), x(() => {
|
|
1785
1779
|
if (!E) return;
|
|
1786
|
-
const
|
|
1787
|
-
console.log({
|
|
1788
|
-
cssToSend: S
|
|
1789
|
-
});
|
|
1790
|
-
const D = {
|
|
1780
|
+
const R = t.css || g || void 0, D = {
|
|
1791
1781
|
type: "session",
|
|
1792
1782
|
session_token: E,
|
|
1793
1783
|
environment: d.getEnv() || ge.PRODUCTION,
|
|
@@ -1795,20 +1785,20 @@ function pn(t) {
|
|
|
1795
1785
|
props: {
|
|
1796
1786
|
excludeChains: n?.join(",")
|
|
1797
1787
|
},
|
|
1798
|
-
...
|
|
1799
|
-
css:
|
|
1788
|
+
...R ? {
|
|
1789
|
+
css: R
|
|
1800
1790
|
} : {}
|
|
1801
1791
|
};
|
|
1802
|
-
|
|
1803
|
-
|
|
1792
|
+
m.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), m.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
|
|
1793
|
+
m.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), m.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1804
1794
|
}, 1e3);
|
|
1805
|
-
}, [E, h, o, s,
|
|
1795
|
+
}, [E, h, o, s, g]);
|
|
1806
1796
|
function A() {
|
|
1807
1797
|
y(Math.random());
|
|
1808
1798
|
}
|
|
1809
1799
|
return /* @__PURE__ */ Ae("div", {
|
|
1810
1800
|
className: zs("payment-modal-wrapper", h === 0 || i ? "loading" : "not-loading", o ? "open" : "closed"),
|
|
1811
|
-
children: [(h === 0 || i) && /* @__PURE__ */
|
|
1801
|
+
children: [(h === 0 || i) && /* @__PURE__ */ F("div", {
|
|
1812
1802
|
role: "status",
|
|
1813
1803
|
className: "payment-modal-loader",
|
|
1814
1804
|
children: /* @__PURE__ */ Ae("svg", {
|
|
@@ -1817,21 +1807,21 @@ function pn(t) {
|
|
|
1817
1807
|
viewBox: "0 0 100 101",
|
|
1818
1808
|
fill: "none",
|
|
1819
1809
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1820
|
-
children: [/* @__PURE__ */
|
|
1810
|
+
children: [/* @__PURE__ */ F("path", {
|
|
1821
1811
|
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",
|
|
1822
1812
|
fill: "currentColor"
|
|
1823
|
-
}), /* @__PURE__ */
|
|
1813
|
+
}), /* @__PURE__ */ F("path", {
|
|
1824
1814
|
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",
|
|
1825
1815
|
fill: "currentFill"
|
|
1826
1816
|
})]
|
|
1827
1817
|
})
|
|
1828
|
-
}), /* @__PURE__ */
|
|
1818
|
+
}), /* @__PURE__ */ F("iframe", {
|
|
1829
1819
|
allow: "clipboard-read *; clipboard-write *",
|
|
1830
1820
|
src: C || void 0,
|
|
1831
1821
|
onLoad: A,
|
|
1832
1822
|
className: `payment-modal ${h === 0 || i ? "invisible" : "visible"}`,
|
|
1833
1823
|
"data-id": e,
|
|
1834
|
-
ref:
|
|
1824
|
+
ref: m
|
|
1835
1825
|
}, e)]
|
|
1836
1826
|
});
|
|
1837
1827
|
}
|
|
@@ -1926,7 +1916,7 @@ const ce = Object.getPrototypeOf, ue = /* @__PURE__ */ new WeakMap(), mt = (t) =
|
|
|
1926
1916
|
if (r === null)
|
|
1927
1917
|
throw new Error("invalid used");
|
|
1928
1918
|
return r;
|
|
1929
|
-
}, Js = (t) => mt(t) && t[pe] || null,
|
|
1919
|
+
}, Js = (t) => mt(t) && t[pe] || null, Fe = (t, e = !0) => {
|
|
1930
1920
|
ue.set(t, e);
|
|
1931
1921
|
}, Zs = (t, e, s) => {
|
|
1932
1922
|
const n = [], o = /* @__PURE__ */ new WeakSet(), i = (r, a) => {
|
|
@@ -1954,11 +1944,11 @@ const ce = Object.getPrototypeOf, ue = /* @__PURE__ */ new WeakMap(), mt = (t) =
|
|
|
1954
1944
|
};
|
|
1955
1945
|
return i(t), n;
|
|
1956
1946
|
}, q = {}, Se = (t) => typeof t == "object" && t !== null, Qs = (t) => Se(t) && !we.has(t) && (Array.isArray(t) || !(Symbol.iterator in t)) && !(t instanceof WeakMap) && !(t instanceof WeakSet) && !(t instanceof Error) && !(t instanceof Number) && !(t instanceof Date) && !(t instanceof String) && !(t instanceof RegExp) && !(t instanceof ArrayBuffer) && !(t instanceof Promise), yt = (t, e) => {
|
|
1957
|
-
const s =
|
|
1947
|
+
const s = _e.get(t);
|
|
1958
1948
|
if (s?.[0] === e)
|
|
1959
1949
|
return s[1];
|
|
1960
1950
|
const n = Array.isArray(t) ? [] : Object.create(Object.getPrototypeOf(t));
|
|
1961
|
-
return
|
|
1951
|
+
return Fe(n, !0), _e.set(t, [e, n]), Reflect.ownKeys(t).forEach((o) => {
|
|
1962
1952
|
if (Object.getOwnPropertyDescriptor(n, o))
|
|
1963
1953
|
return;
|
|
1964
1954
|
const i = Reflect.get(t, o), { enumerable: r } = Reflect.getOwnPropertyDescriptor(
|
|
@@ -1972,7 +1962,7 @@ const ce = Object.getPrototypeOf, ue = /* @__PURE__ */ new WeakMap(), mt = (t) =
|
|
|
1972
1962
|
configurable: !0
|
|
1973
1963
|
};
|
|
1974
1964
|
if (we.has(i))
|
|
1975
|
-
|
|
1965
|
+
Fe(i, !1);
|
|
1976
1966
|
else if (N.has(i)) {
|
|
1977
1967
|
const [u, l] = N.get(
|
|
1978
1968
|
i
|
|
@@ -1996,7 +1986,7 @@ const ce = Object.getPrototypeOf, ue = /* @__PURE__ */ new WeakMap(), mt = (t) =
|
|
|
1996
1986
|
const f = !N.has(r) && sn(r) ? Tt(r) : r;
|
|
1997
1987
|
return e(i, f), Reflect.set(o, i, f, a), n(["set", [i], r, l]), !0;
|
|
1998
1988
|
}
|
|
1999
|
-
}), N = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(),
|
|
1989
|
+
}), N = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), _e = /* @__PURE__ */ new WeakMap(), ne = [1], K = /* @__PURE__ */ new WeakMap();
|
|
2000
1990
|
let He = Object.is, tn = (t, e) => new Proxy(t, e), sn = Qs, nn = yt, on = en;
|
|
2001
1991
|
function Tt(t = {}) {
|
|
2002
1992
|
if (!Se(t))
|
|
@@ -2005,39 +1995,39 @@ function Tt(t = {}) {
|
|
|
2005
1995
|
if (e)
|
|
2006
1996
|
return e;
|
|
2007
1997
|
let s = ne[0];
|
|
2008
|
-
const n = /* @__PURE__ */ new Set(), o = (
|
|
2009
|
-
s !== T && (i = s = T, n.forEach((
|
|
1998
|
+
const n = /* @__PURE__ */ new Set(), o = (g, T = ++ne[0]) => {
|
|
1999
|
+
s !== T && (i = s = T, n.forEach((m) => m(g, T)));
|
|
2010
2000
|
};
|
|
2011
2001
|
let i = s;
|
|
2012
|
-
const r = (
|
|
2013
|
-
const
|
|
2014
|
-
|
|
2015
|
-
})), s), a = (
|
|
2002
|
+
const r = (g = ne[0]) => (i !== g && (i = g, u.forEach(([T]) => {
|
|
2003
|
+
const m = T[1](g);
|
|
2004
|
+
m > s && (s = m);
|
|
2005
|
+
})), s), a = (g) => (T, m) => {
|
|
2016
2006
|
const A = [...T];
|
|
2017
|
-
A[1] = [
|
|
2018
|
-
}, u = /* @__PURE__ */ new Map(), l = (
|
|
2019
|
-
const
|
|
2020
|
-
if (
|
|
2021
|
-
if ((q ? "production" : void 0) !== "production" && u.has(
|
|
2007
|
+
A[1] = [g, ...A[1]], o(A, m);
|
|
2008
|
+
}, u = /* @__PURE__ */ new Map(), l = (g, T) => {
|
|
2009
|
+
const m = !we.has(T) && N.get(T);
|
|
2010
|
+
if (m) {
|
|
2011
|
+
if ((q ? "production" : void 0) !== "production" && u.has(g))
|
|
2022
2012
|
throw new Error("prop listener already exists");
|
|
2023
2013
|
if (n.size) {
|
|
2024
|
-
const A =
|
|
2025
|
-
u.set(
|
|
2014
|
+
const A = m[2](a(g));
|
|
2015
|
+
u.set(g, [m, A]);
|
|
2026
2016
|
} else
|
|
2027
|
-
u.set(
|
|
2017
|
+
u.set(g, [m]);
|
|
2028
2018
|
}
|
|
2029
|
-
}, f = (
|
|
2019
|
+
}, f = (g) => {
|
|
2030
2020
|
var T;
|
|
2031
|
-
const
|
|
2032
|
-
|
|
2033
|
-
}, E = (
|
|
2021
|
+
const m = u.get(g);
|
|
2022
|
+
m && (u.delete(g), (T = m[1]) == null || T.call(m));
|
|
2023
|
+
}, E = (g) => (n.add(g), n.size === 1 && u.forEach(([m, A], R) => {
|
|
2034
2024
|
if ((q ? "production" : void 0) !== "production" && A)
|
|
2035
2025
|
throw new Error("remove already exists");
|
|
2036
|
-
const D =
|
|
2037
|
-
u.set(
|
|
2026
|
+
const D = m[2](a(R));
|
|
2027
|
+
u.set(R, [m, D]);
|
|
2038
2028
|
}), () => {
|
|
2039
|
-
n.delete(
|
|
2040
|
-
A && (A(), u.set(
|
|
2029
|
+
n.delete(g), n.size === 0 && u.forEach(([m, A], R) => {
|
|
2030
|
+
A && (A(), u.set(R, [m]));
|
|
2041
2031
|
});
|
|
2042
2032
|
});
|
|
2043
2033
|
let h = !0;
|
|
@@ -2049,12 +2039,12 @@ function Tt(t = {}) {
|
|
|
2049
2039
|
), C = tn(t, y);
|
|
2050
2040
|
K.set(t, C);
|
|
2051
2041
|
const V = [t, r, E];
|
|
2052
|
-
return N.set(C, V), Reflect.ownKeys(t).forEach((
|
|
2042
|
+
return N.set(C, V), Reflect.ownKeys(t).forEach((g) => {
|
|
2053
2043
|
const T = Object.getOwnPropertyDescriptor(
|
|
2054
2044
|
t,
|
|
2055
|
-
|
|
2045
|
+
g
|
|
2056
2046
|
);
|
|
2057
|
-
"value" in T && T.writable && (C[
|
|
2047
|
+
"value" in T && T.writable && (C[g] = t[g]);
|
|
2058
2048
|
}), h = !1, C;
|
|
2059
2049
|
}
|
|
2060
2050
|
function rn(t, e, s) {
|
|
@@ -2085,7 +2075,7 @@ const an = {}, cn = (t, e) => {
|
|
|
2085
2075
|
}), wt(s.current);
|
|
2086
2076
|
}, un = cn, ln = /* @__PURE__ */ new WeakMap();
|
|
2087
2077
|
function dn(t, e) {
|
|
2088
|
-
const n =
|
|
2078
|
+
const n = Re(
|
|
2089
2079
|
() => t && /* @__PURE__ */ new WeakMap(),
|
|
2090
2080
|
[t]
|
|
2091
2081
|
), o = le(void 0);
|
|
@@ -2117,7 +2107,7 @@ function dn(t, e) {
|
|
|
2117
2107
|
i = !1, St(() => {
|
|
2118
2108
|
o.current = r;
|
|
2119
2109
|
}), (an ? "production" : void 0) !== "production" && un(r, n);
|
|
2120
|
-
const a =
|
|
2110
|
+
const a = Re(() => /* @__PURE__ */ new WeakMap(), []);
|
|
2121
2111
|
return gt(r, n, a, ln);
|
|
2122
2112
|
}
|
|
2123
2113
|
const v = Tt({
|