@tomo-inc/wallet-connect-kit 0.0.22 → 0.0.23
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/index.d.ts +1 -0
- package/dist/index.js +368 -347
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
})();
|
|
13
13
|
|
|
14
14
|
import { jsxs as C, jsx as o, Fragment as En } from "react/jsx-runtime";
|
|
15
|
-
import { createContext as Wt, useState as Y, useRef as ae, useEffect as F, useMemo as y, useContext as V, useCallback as
|
|
16
|
-
import { Button as
|
|
15
|
+
import { createContext as Wt, useState as Y, useRef as ae, useEffect as F, useMemo as y, useContext as V, useCallback as k } from "react";
|
|
16
|
+
import { Button as L, BackIcon as Mt, CloseIcon as Vt, OkIcon as Xt, CopyIcon as Lr, Image as ue, PowerIcon as kr, DownIcon as Yr, Spinner as ge, Skeleton as Zr, Modal as Nt, Link as zn, TomoLogoIcon as Fr, Card as Jr, CardBody as Dr, Tabs as Hr, Tab as Qr, Chip as nt, SearchIcon as Kr, Input as jt, SearchOutlinedIcon as qr, RightArrowIcon as Tt, ModalHeader as Ur, ModalBody as Gr, ModalContent as Rr, TomoUIProvider as _r, ToastProvider as $r } from "@tomo-inc/tomo-ui";
|
|
17
17
|
import { isMobile as Et, loadConnectors as St, isWagmiConnector as es, connect as Ot, switchChain as tt, addChain as ns, signInWithWallet as ts, signMessage as rs, setWalletConnectConfig as ss } from "@tomo-inc/wallet-adaptor-base";
|
|
18
18
|
import { useQuery as Sn, useMutation as On, QueryClientProvider as is, QueryClient as os } from "@tanstack/react-query";
|
|
19
19
|
import cs from "copy-to-clipboard";
|
|
@@ -1541,13 +1541,13 @@ class Ei extends hi {
|
|
|
1541
1541
|
for (let f = 0; f < 16; f++, t += 4)
|
|
1542
1542
|
re[f] = n.getUint32(t, !1);
|
|
1543
1543
|
for (let f = 16; f < 64; f++) {
|
|
1544
|
-
const
|
|
1545
|
-
re[f] =
|
|
1544
|
+
const g = re[f - 15], m = re[f - 2], v = K(g, 7) ^ K(g, 18) ^ g >>> 3, u = K(m, 17) ^ K(m, 19) ^ m >>> 10;
|
|
1545
|
+
re[f] = u + re[f - 7] + v + re[f - 16] | 0;
|
|
1546
1546
|
}
|
|
1547
1547
|
let { A: r, B: s, C: i, D: a, E: c, F: l, G: A, H: d } = this;
|
|
1548
1548
|
for (let f = 0; f < 64; f++) {
|
|
1549
|
-
const
|
|
1550
|
-
d = A, A = l, l = c, c = a + m | 0, a = i, i = s, s = r, r = m +
|
|
1549
|
+
const g = K(c, 6) ^ K(c, 11) ^ K(c, 25), m = d + g + yi(c, l, A) + Ti[f] + re[f] | 0, u = (K(r, 2) ^ K(r, 13) ^ K(r, 22)) + Bi(r, s, i) | 0;
|
|
1550
|
+
d = A, A = l, l = c, c = a + m | 0, a = i, i = s, s = r, r = m + u | 0;
|
|
1551
1551
|
}
|
|
1552
1552
|
r = r + this.A | 0, s = s + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, c = c + this.E | 0, l = l + this.F | 0, A = A + this.G | 0, d = d + this.H | 0, this.set(r, s, i, a, c, l, A, d);
|
|
1553
1553
|
}
|
|
@@ -1879,9 +1879,9 @@ function $i(e, n = 24) {
|
|
|
1879
1879
|
for (let a = 0; a < 10; a++)
|
|
1880
1880
|
t[a] = e[a] ^ e[a + 10] ^ e[a + 20] ^ e[a + 30] ^ e[a + 40];
|
|
1881
1881
|
for (let a = 0; a < 10; a += 2) {
|
|
1882
|
-
const c = (a + 8) % 10, l = (a + 2) % 10, A = t[l], d = t[l + 1], f = vt(A, d, 1) ^ t[c],
|
|
1882
|
+
const c = (a + 8) % 10, l = (a + 2) % 10, A = t[l], d = t[l + 1], f = vt(A, d, 1) ^ t[c], g = mt(A, d, 1) ^ t[c + 1];
|
|
1883
1883
|
for (let m = 0; m < 50; m += 10)
|
|
1884
|
-
e[a + m] ^= f, e[a + m + 1] ^=
|
|
1884
|
+
e[a + m] ^= f, e[a + m + 1] ^= g;
|
|
1885
1885
|
}
|
|
1886
1886
|
let s = e[2], i = e[3];
|
|
1887
1887
|
for (let a = 0; a < 24; a++) {
|
|
@@ -2106,7 +2106,7 @@ function go(e, n) {
|
|
|
2106
2106
|
function vo(e, n) {
|
|
2107
2107
|
const { authorizationList: t, chainId: r, gas: s, nonce: i, to: a, value: c, maxFeePerGas: l, maxPriorityFeePerGas: A, accessList: d, data: f } = e;
|
|
2108
2108
|
ao(e);
|
|
2109
|
-
const
|
|
2109
|
+
const g = an(d), m = pi(t);
|
|
2110
2110
|
return Le([
|
|
2111
2111
|
"0x04",
|
|
2112
2112
|
Ae([
|
|
@@ -2118,7 +2118,7 @@ function vo(e, n) {
|
|
|
2118
2118
|
a ?? "0x",
|
|
2119
2119
|
c ? P(c) : "0x",
|
|
2120
2120
|
f ?? "0x",
|
|
2121
|
-
|
|
2121
|
+
g,
|
|
2122
2122
|
m,
|
|
2123
2123
|
...ke(e, n)
|
|
2124
2124
|
])
|
|
@@ -2127,20 +2127,20 @@ function vo(e, n) {
|
|
|
2127
2127
|
function mo(e, n) {
|
|
2128
2128
|
const { chainId: t, gas: r, nonce: s, to: i, value: a, maxFeePerBlobGas: c, maxFeePerGas: l, maxPriorityFeePerGas: A, accessList: d, data: f } = e;
|
|
2129
2129
|
lo(e);
|
|
2130
|
-
let
|
|
2131
|
-
if (e.blobs && (typeof
|
|
2132
|
-
const w = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((I) => ne(I)),
|
|
2130
|
+
let g = e.blobVersionedHashes, m = e.sidecars;
|
|
2131
|
+
if (e.blobs && (typeof g > "u" || typeof m > "u")) {
|
|
2132
|
+
const w = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((I) => ne(I)), O = e.kzg, z = tr({
|
|
2133
2133
|
blobs: w,
|
|
2134
|
-
kzg:
|
|
2134
|
+
kzg: O
|
|
2135
2135
|
});
|
|
2136
|
-
if (typeof
|
|
2136
|
+
if (typeof g > "u" && (g = Yi({
|
|
2137
2137
|
commitments: z
|
|
2138
2138
|
})), typeof m > "u") {
|
|
2139
|
-
const I = rr({ blobs: w, commitments: z, kzg:
|
|
2139
|
+
const I = rr({ blobs: w, commitments: z, kzg: O });
|
|
2140
2140
|
m = Hi({ blobs: w, commitments: z, proofs: I });
|
|
2141
2141
|
}
|
|
2142
2142
|
}
|
|
2143
|
-
const v = an(d),
|
|
2143
|
+
const v = an(d), u = [
|
|
2144
2144
|
P(t),
|
|
2145
2145
|
s ? P(s) : "0x",
|
|
2146
2146
|
A ? P(A) : "0x",
|
|
@@ -2151,24 +2151,24 @@ function mo(e, n) {
|
|
|
2151
2151
|
f ?? "0x",
|
|
2152
2152
|
v,
|
|
2153
2153
|
c ? P(c) : "0x",
|
|
2154
|
-
|
|
2154
|
+
g ?? [],
|
|
2155
2155
|
...ke(e, n)
|
|
2156
|
-
], p = [],
|
|
2156
|
+
], p = [], b = [], x = [];
|
|
2157
2157
|
if (m)
|
|
2158
2158
|
for (let w = 0; w < m.length; w++) {
|
|
2159
|
-
const { blob:
|
|
2160
|
-
p.push(
|
|
2159
|
+
const { blob: O, commitment: z, proof: I } = m[w];
|
|
2160
|
+
p.push(O), b.push(z), x.push(I);
|
|
2161
2161
|
}
|
|
2162
2162
|
return Le([
|
|
2163
2163
|
"0x03",
|
|
2164
2164
|
// If sidecars are enabled, envelope turns into a "wrapper":
|
|
2165
|
-
Ae(m ? [
|
|
2165
|
+
Ae(m ? [u, p, b, x] : u)
|
|
2166
2166
|
]);
|
|
2167
2167
|
}
|
|
2168
2168
|
function po(e, n) {
|
|
2169
2169
|
const { chainId: t, gas: r, nonce: s, to: i, value: a, maxFeePerGas: c, maxPriorityFeePerGas: l, accessList: A, data: d } = e;
|
|
2170
2170
|
qn(e);
|
|
2171
|
-
const f = an(A),
|
|
2171
|
+
const f = an(A), g = [
|
|
2172
2172
|
P(t),
|
|
2173
2173
|
s ? P(s) : "0x",
|
|
2174
2174
|
l ? P(l) : "0x",
|
|
@@ -2182,7 +2182,7 @@ function po(e, n) {
|
|
|
2182
2182
|
];
|
|
2183
2183
|
return Le([
|
|
2184
2184
|
"0x02",
|
|
2185
|
-
Ae(
|
|
2185
|
+
Ae(g)
|
|
2186
2186
|
]);
|
|
2187
2187
|
}
|
|
2188
2188
|
function Co(e, n) {
|
|
@@ -2225,12 +2225,12 @@ function xo(e, n) {
|
|
|
2225
2225
|
if (n.v !== m)
|
|
2226
2226
|
throw new gi({ v: n.v });
|
|
2227
2227
|
return m;
|
|
2228
|
-
})(), f = _e(n.r),
|
|
2228
|
+
})(), f = _e(n.r), g = _e(n.s);
|
|
2229
2229
|
A = [
|
|
2230
2230
|
...A,
|
|
2231
2231
|
P(d),
|
|
2232
2232
|
f === "0x00" ? "0x" : f,
|
|
2233
|
-
|
|
2233
|
+
g === "0x00" ? "0x" : g
|
|
2234
2234
|
];
|
|
2235
2235
|
} else t > 0 && (A = [
|
|
2236
2236
|
...A,
|
|
@@ -2465,12 +2465,12 @@ function Wo(e) {
|
|
|
2465
2465
|
`).slice(0, -1);
|
|
2466
2466
|
}
|
|
2467
2467
|
class Mo extends h {
|
|
2468
|
-
constructor(n, { account: t, docsPath: r, chain: s, data: i, gas: a, gasPrice: c, maxFeePerGas: l, maxPriorityFeePerGas: A, nonce: d, to: f, value:
|
|
2468
|
+
constructor(n, { account: t, docsPath: r, chain: s, data: i, gas: a, gasPrice: c, maxFeePerGas: l, maxPriorityFeePerGas: A, nonce: d, to: f, value: g, stateOverride: m }) {
|
|
2469
2469
|
const v = t ? Gn(t) : void 0;
|
|
2470
|
-
let
|
|
2470
|
+
let u = nr({
|
|
2471
2471
|
from: v?.address,
|
|
2472
2472
|
to: f,
|
|
2473
|
-
value: typeof
|
|
2473
|
+
value: typeof g < "u" && `${fi(g)} ${s?.nativeCurrency?.symbol || "ETH"}`,
|
|
2474
2474
|
data: i,
|
|
2475
2475
|
gas: a,
|
|
2476
2476
|
gasPrice: typeof c < "u" && `${ce(c)} gwei`,
|
|
@@ -2478,14 +2478,14 @@ class Mo extends h {
|
|
|
2478
2478
|
maxPriorityFeePerGas: typeof A < "u" && `${ce(A)} gwei`,
|
|
2479
2479
|
nonce: d
|
|
2480
2480
|
});
|
|
2481
|
-
m && (
|
|
2481
|
+
m && (u += `
|
|
2482
2482
|
${Wo(m)}`), super(n.shortMessage, {
|
|
2483
2483
|
cause: n,
|
|
2484
2484
|
docsPath: r,
|
|
2485
2485
|
metaMessages: [
|
|
2486
2486
|
...n.metaMessages ? [...n.metaMessages, " "] : [],
|
|
2487
2487
|
"Raw Call Arguments:",
|
|
2488
|
-
|
|
2488
|
+
u
|
|
2489
2489
|
].filter(Boolean),
|
|
2490
2490
|
name: "CallExecutionError"
|
|
2491
2491
|
}), Object.defineProperty(this, "cause", {
|
|
@@ -2559,11 +2559,11 @@ async function To(e, n) {
|
|
|
2559
2559
|
throw new ho();
|
|
2560
2560
|
const r = Gn(t);
|
|
2561
2561
|
try {
|
|
2562
|
-
const { accessList: s, blockNumber: i, blockTag: a, data: c, gas: l, gasPrice: A, maxFeePerGas: d, maxPriorityFeePerGas: f, nonce:
|
|
2562
|
+
const { accessList: s, blockNumber: i, blockTag: a, data: c, gas: l, gasPrice: A, maxFeePerGas: d, maxPriorityFeePerGas: f, nonce: g, to: m, value: v, ...u } = n, b = (typeof i == "bigint" ? P(i) : void 0) || a;
|
|
2563
2563
|
jo(n);
|
|
2564
|
-
const
|
|
2564
|
+
const x = e.chain?.formatters?.transactionRequest?.format, O = (x || ri)({
|
|
2565
2565
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
2566
|
-
...No(
|
|
2566
|
+
...No(u, { format: x }),
|
|
2567
2567
|
from: r?.address,
|
|
2568
2568
|
accessList: s,
|
|
2569
2569
|
data: c,
|
|
@@ -2571,12 +2571,12 @@ async function To(e, n) {
|
|
|
2571
2571
|
gasPrice: A,
|
|
2572
2572
|
maxFeePerGas: d,
|
|
2573
2573
|
maxPriorityFeePerGas: f,
|
|
2574
|
-
nonce:
|
|
2574
|
+
nonce: g,
|
|
2575
2575
|
to: m,
|
|
2576
2576
|
value: v
|
|
2577
2577
|
}, "estimateGas"), { baseFeePerGas: z, gasLimit: I, priorityFeePerGas: W } = await e.request({
|
|
2578
2578
|
method: "linea_estimateGas",
|
|
2579
|
-
params:
|
|
2579
|
+
params: b ? [O, b] : [O]
|
|
2580
2580
|
});
|
|
2581
2581
|
return {
|
|
2582
2582
|
baseFeePerGas: BigInt(z),
|
|
@@ -2807,7 +2807,7 @@ const br = /* @__PURE__ */ oe({
|
|
|
2807
2807
|
}, Pr = (e, n, t) => {
|
|
2808
2808
|
const { apiChains: r = [] } = t || {}, s = r.length > 0 ? Dt(r) : le, i = [], a = e?.aptos || [];
|
|
2809
2809
|
a.length > 0 ? a.forEach((d) => {
|
|
2810
|
-
const f = r.find((
|
|
2810
|
+
const f = r.find((g) => H(g.chainId) === "aptos");
|
|
2811
2811
|
i.push({
|
|
2812
2812
|
...d,
|
|
2813
2813
|
chainId: f?.chainId || "aptos:1",
|
|
@@ -2837,29 +2837,29 @@ const br = /* @__PURE__ */ oe({
|
|
|
2837
2837
|
});
|
|
2838
2838
|
const c = e?.evm || ie?.evm || [];
|
|
2839
2839
|
c.length > 0 ? c.forEach((d) => {
|
|
2840
|
-
const f = `eip155:${d.id}`,
|
|
2840
|
+
const f = `eip155:${d.id}`, g = r.find((b) => b.chainId === f), m = `evm_${d.id}`, v = s[m] || le[m], u = g?.icon || (typeof v == "string" ? v : null), p = g?.rpcUrls || {
|
|
2841
2841
|
default: {
|
|
2842
2842
|
http: Array.isArray(d.rpcUrls?.default?.http) ? [...d.rpcUrls.default.http] : [],
|
|
2843
2843
|
webSocket: d.rpcUrls?.default?.webSocket ? [...d.rpcUrls.default.webSocket] : void 0
|
|
2844
2844
|
}
|
|
2845
2845
|
};
|
|
2846
2846
|
i.push({
|
|
2847
|
-
...
|
|
2847
|
+
...g,
|
|
2848
2848
|
...d,
|
|
2849
2849
|
chainId: f,
|
|
2850
|
-
icon:
|
|
2850
|
+
icon: u || "",
|
|
2851
2851
|
chainInfo: {
|
|
2852
|
-
icon:
|
|
2853
|
-
name:
|
|
2852
|
+
icon: u || null,
|
|
2853
|
+
name: g?.name || d.name || q?.evm?.name,
|
|
2854
2854
|
chainType: "evm"
|
|
2855
2855
|
},
|
|
2856
2856
|
chainType: "evm",
|
|
2857
2857
|
provider: n?.evm || null,
|
|
2858
|
-
nativeCurrency:
|
|
2858
|
+
nativeCurrency: g?.nativeCurrency || d.nativeCurrency,
|
|
2859
2859
|
rpcUrls: p,
|
|
2860
|
-
blockExplorers:
|
|
2861
|
-
contracts:
|
|
2862
|
-
blockTime:
|
|
2860
|
+
blockExplorers: g?.blockExplorers || d.blockExplorers,
|
|
2861
|
+
contracts: g?.contracts || d.contracts,
|
|
2862
|
+
blockTime: g?.blockTime || d.blockTime
|
|
2863
2863
|
});
|
|
2864
2864
|
}) : r.length > 0 && r.filter((d) => H(d.chainId) === "evm").forEach((d) => {
|
|
2865
2865
|
i.push({
|
|
@@ -2875,7 +2875,7 @@ const br = /* @__PURE__ */ oe({
|
|
|
2875
2875
|
});
|
|
2876
2876
|
const l = e?.solana || [];
|
|
2877
2877
|
l.length > 0 ? l.forEach((d) => {
|
|
2878
|
-
const f = r.find((
|
|
2878
|
+
const f = r.find((g) => H(g.chainId) === "solana");
|
|
2879
2879
|
i.push({
|
|
2880
2880
|
...d,
|
|
2881
2881
|
chainId: f?.chainId || "solana:mainnet-beta",
|
|
@@ -2905,7 +2905,7 @@ const br = /* @__PURE__ */ oe({
|
|
|
2905
2905
|
});
|
|
2906
2906
|
const A = e?.dogecoin || [];
|
|
2907
2907
|
return A.length > 0 ? A.forEach((d) => {
|
|
2908
|
-
const f = r.find((
|
|
2908
|
+
const f = r.find((g) => H(g.chainId) === "dogecoin");
|
|
2909
2909
|
i.push({
|
|
2910
2910
|
...d,
|
|
2911
2911
|
chainId: f?.chainId || "dogecoin:mainnet",
|
|
@@ -2936,13 +2936,13 @@ const br = /* @__PURE__ */ oe({
|
|
|
2936
2936
|
};
|
|
2937
2937
|
var M = /* @__PURE__ */ ((e) => (e.Loading = "LOADING", e.WalletList = "WALLET_LIST", e.WalletSearch = "WALLET_SEARCH", e.WalletSelectProviders = "WALLET_SELECT_PROVIDERS", e.WalletInstallGuide = "WALLET_INSTALL_GUIDE", e.Connecting = "CONNECTING", e.Error = "ERROR", e.Account = "ACCOUNT", e.SelectChains = "SELECT_CHAINS", e.ChangeNetwork = "CHANGE_NETWORK", e.SignInWallet = "SIGN_IN_WALLET", e.WalletConnect = "WALLET_CONNECT", e.UnsupportChain = "UNSUPPORT_CHAIN", e.WalletHome = "WALLET_HOME", e))(M || {});
|
|
2938
2938
|
const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton: s }) => {
|
|
2939
|
-
const i = y(() => n ? /* @__PURE__ */ o(
|
|
2939
|
+
const i = y(() => n ? /* @__PURE__ */ o(L, { isIconOnly: !0, color: "default", size: "sm", variant: "light", onPress: n, radius: "full", className: "p-0", children: /* @__PURE__ */ o(Mt, {}) }) : null, [n]);
|
|
2940
2940
|
return /* @__PURE__ */ C("div", { className: "flex items-center justify-between px-0 py-3", children: [
|
|
2941
2941
|
i,
|
|
2942
2942
|
/* @__PURE__ */ o("div", { className: "font-medium text-lg", children: e }),
|
|
2943
2943
|
/* @__PURE__ */ C("div", { className: "flex items-center gap-3", children: [
|
|
2944
2944
|
r,
|
|
2945
|
-
s ? null : /* @__PURE__ */ o(
|
|
2945
|
+
s ? null : /* @__PURE__ */ o(L, { isIconOnly: !0, color: "default", size: "sm", variant: "light", onPress: t, radius: "full", className: "p-0", children: /* @__PURE__ */ o(Vt, { className: "text-xl" }) })
|
|
2946
2946
|
] })
|
|
2947
2947
|
] });
|
|
2948
2948
|
}, D = ({
|
|
@@ -2975,41 +2975,41 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
2975
2975
|
const e = V(N);
|
|
2976
2976
|
if (!e)
|
|
2977
2977
|
throw new Error("WalletConnectContext not found");
|
|
2978
|
-
const { copied: n, copy: t } = Zn(), { chains: r } = Ft(), { account: s, disconnect: i } = e, a = s.currentWallet?.info?.name || "Wallet", c = s.currentWallet?.info?.icon, l = s.address, A = s.chainType, d = s.chainId, f = d
|
|
2978
|
+
const { copied: n, copy: t } = Zn(), { chains: r } = Ft(), { account: s, disconnect: i } = e, a = s.currentWallet?.info?.name || "Wallet", c = s.currentWallet?.info?.icon, l = s.address, A = s.chainType, d = s.chainId, f = d && /^\d+$/.test(d) ? Number(d) : void 0, g = s.currentWallet, m = k(async () => {
|
|
2979
2979
|
try {
|
|
2980
2980
|
if (!l) return;
|
|
2981
2981
|
t(l);
|
|
2982
|
-
} catch (
|
|
2983
|
-
console.error("Failed to copy address:",
|
|
2982
|
+
} catch (b) {
|
|
2983
|
+
console.error("Failed to copy address:", b);
|
|
2984
2984
|
}
|
|
2985
|
-
}, [l, t]), v = y(() => /* @__PURE__ */ o(
|
|
2986
|
-
if (!
|
|
2985
|
+
}, [l, t]), v = y(() => /* @__PURE__ */ o(L, { isIconOnly: !0, variant: "light", color: "default", className: "size-10", onPress: m, children: n ? /* @__PURE__ */ o(Xt, { className: "text-success size-6" }) : /* @__PURE__ */ o(Lr, { className: "text-foreground size-4" }) }), [m, n]);
|
|
2986
|
+
if (!g)
|
|
2987
2987
|
return null;
|
|
2988
|
-
const
|
|
2988
|
+
const u = Pr(e.config?.chains, g?.connectors, {
|
|
2989
2989
|
apiChains: r
|
|
2990
|
-
}), p =
|
|
2991
|
-
if (
|
|
2990
|
+
}), p = u.find((b) => {
|
|
2991
|
+
if (b.chainType !== A) return !1;
|
|
2992
2992
|
if (A === "evm" && f !== void 0)
|
|
2993
|
-
return
|
|
2993
|
+
return b.id === f || b.chainId === `eip155:${f}`;
|
|
2994
2994
|
{
|
|
2995
|
-
const
|
|
2996
|
-
if (
|
|
2995
|
+
const x = b.chainType === s.chainType;
|
|
2996
|
+
if (x) return x;
|
|
2997
2997
|
}
|
|
2998
|
-
return
|
|
2998
|
+
return b.chainId === d;
|
|
2999
2999
|
});
|
|
3000
3000
|
return console.log("--- AccountView ---", {
|
|
3001
3001
|
account: s,
|
|
3002
3002
|
config: e.config,
|
|
3003
|
-
chains:
|
|
3003
|
+
chains: u,
|
|
3004
3004
|
currentChainType: A,
|
|
3005
3005
|
chainNumber: f,
|
|
3006
|
-
currentWallet:
|
|
3006
|
+
currentWallet: g,
|
|
3007
3007
|
currentChain: p
|
|
3008
3008
|
}), /* @__PURE__ */ o(
|
|
3009
3009
|
D,
|
|
3010
3010
|
{
|
|
3011
3011
|
title: /* @__PURE__ */ o(
|
|
3012
|
-
|
|
3012
|
+
L,
|
|
3013
3013
|
{
|
|
3014
3014
|
variant: "light",
|
|
3015
3015
|
color: "default",
|
|
@@ -3041,7 +3041,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3041
3041
|
v
|
|
3042
3042
|
] }),
|
|
3043
3043
|
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
3044
|
-
|
|
3044
|
+
L,
|
|
3045
3045
|
{
|
|
3046
3046
|
color: "default",
|
|
3047
3047
|
variant: "light",
|
|
@@ -3099,7 +3099,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3099
3099
|
" network. You need to connect with a new wallet."
|
|
3100
3100
|
] })
|
|
3101
3101
|
] }),
|
|
3102
|
-
/* @__PURE__ */ C(
|
|
3102
|
+
/* @__PURE__ */ C(L, { className: "w-full my-4", disabled: l, onPress: () => c(), children: [
|
|
3103
3103
|
"Connect ",
|
|
3104
3104
|
s,
|
|
3105
3105
|
" wallet"
|
|
@@ -3108,7 +3108,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3108
3108
|
}, Ye = () => {
|
|
3109
3109
|
const e = V(N);
|
|
3110
3110
|
return {
|
|
3111
|
-
connectWallet:
|
|
3111
|
+
connectWallet: k(
|
|
3112
3112
|
async (t, r, s = "") => {
|
|
3113
3113
|
if (!e) {
|
|
3114
3114
|
console.error("WalletConnectContext not found");
|
|
@@ -3164,19 +3164,19 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3164
3164
|
const m = e?.modal?.state || {
|
|
3165
3165
|
chainType: e.account.chainType || "evm",
|
|
3166
3166
|
chainId: ""
|
|
3167
|
-
}, v = m.chainType,
|
|
3167
|
+
}, v = m.chainType, u = m.chainId || "";
|
|
3168
3168
|
if (!n || !v) {
|
|
3169
3169
|
e.modal.setView(e.modal.mainView);
|
|
3170
3170
|
return;
|
|
3171
3171
|
}
|
|
3172
3172
|
try {
|
|
3173
|
-
a(!0), await s(n, v,
|
|
3173
|
+
a(!0), await s(n, v, u), a(!1);
|
|
3174
3174
|
} catch (p) {
|
|
3175
3175
|
console.error("handleRetry::", p), await In(1e3), a(!1);
|
|
3176
3176
|
}
|
|
3177
3177
|
}, l = () => {
|
|
3178
3178
|
e.connection.setError(""), e.modal.backView();
|
|
3179
|
-
}, A = t === "connected", d = !!r && t === "disconnected", f = A ? "success" : d ? "error" : "connecting",
|
|
3179
|
+
}, A = t === "connected", d = !!r && t === "disconnected", f = A ? "success" : d ? "error" : "connecting", g = () => A ? /* @__PURE__ */ C("div", { className: "flex flex-col items-center gap-2", children: [
|
|
3180
3180
|
/* @__PURE__ */ o("p", { className: "text-lg font-semibold text-foreground", children: "Successfully Connected!" }),
|
|
3181
3181
|
/* @__PURE__ */ C("p", { className: "text-sm text-foreground/60", children: [
|
|
3182
3182
|
"Connected to ",
|
|
@@ -3191,9 +3191,9 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3191
3191
|
) }) });
|
|
3192
3192
|
return /* @__PURE__ */ o(D, { title: n?.info?.name || "Wallet", onBack: l, children: /* @__PURE__ */ C("div", { className: "flex flex-col items-center justify-center py-12 gap-6 flex-1", children: [
|
|
3193
3193
|
/* @__PURE__ */ o(Fo, { iconSrc: n?.info?.icon, iconAlt: n?.info?.name, variant: f }),
|
|
3194
|
-
|
|
3194
|
+
g(),
|
|
3195
3195
|
d ? /* @__PURE__ */ o("div", { className: "w-full px-4", children: /* @__PURE__ */ o(
|
|
3196
|
-
|
|
3196
|
+
L,
|
|
3197
3197
|
{
|
|
3198
3198
|
isDisabled: i,
|
|
3199
3199
|
startContent: i ? /* @__PURE__ */ o(
|
|
@@ -3227,7 +3227,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3227
3227
|
/* @__PURE__ */ o("div", { className: "text-danger text-5xl mb-4", children: "⚠️" }),
|
|
3228
3228
|
/* @__PURE__ */ o("p", { className: "text-lg font-semibold mb-2 text-danger", children: "Connection Failed" }),
|
|
3229
3229
|
/* @__PURE__ */ o("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 text-center", children: n }),
|
|
3230
|
-
/* @__PURE__ */ o(
|
|
3230
|
+
/* @__PURE__ */ o(L, { variant: "solid", color: "primary", onPress: () => {
|
|
3231
3231
|
e.connection.setError(""), e.modal.setView(M.Connecting);
|
|
3232
3232
|
}, children: "Try Again" })
|
|
3233
3233
|
] });
|
|
@@ -3237,7 +3237,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3237
3237
|
if (n === 0)
|
|
3238
3238
|
r = s = i = t;
|
|
3239
3239
|
else {
|
|
3240
|
-
const c = (d, f,
|
|
3240
|
+
const c = (d, f, g) => (g < 0 && (g += 1), g > 1 && (g -= 1), g < 0.16666666666666666 ? d + (f - d) * 6 * g : g < 0.5 ? f : g < 0.6666666666666666 ? d + (f - d) * (0.6666666666666666 - g) * 6 : d), l = t < 0.5 ? t * (1 + n) : t + n - t * n, A = 2 * t - l;
|
|
3241
3241
|
r = c(A, l, e + 1 / 3), s = c(A, l, e), i = c(A, l, e - 1 / 3);
|
|
3242
3242
|
}
|
|
3243
3243
|
const a = (c) => {
|
|
@@ -3351,7 +3351,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3351
3351
|
return /* @__PURE__ */ o(Nt, { isOpen: e, onClose: n, onBack: t, title: a, children: /* @__PURE__ */ C("div", { className: "flex flex-col items-center justify-center px-5 pb-6 gap-4", children: [
|
|
3352
3352
|
/* @__PURE__ */ o("p", { className: "text-sm text-foreground/80 text-center", children: "Scan the QR code with your camera phone to get the app on iOS or Android." }),
|
|
3353
3353
|
/* @__PURE__ */ o(Br, { content: r, logo: s, logoBackground: i }),
|
|
3354
|
-
/* @__PURE__ */ o(
|
|
3354
|
+
/* @__PURE__ */ o(L, { variant: "bordered", size: "lg", fullWidth: !0, onPress: () => {
|
|
3355
3355
|
c(r);
|
|
3356
3356
|
}, children: l ? "Copied!" : "Copy Link" })
|
|
3357
3357
|
] }) });
|
|
@@ -3395,7 +3395,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3395
3395
|
isOpen: !1,
|
|
3396
3396
|
url: ""
|
|
3397
3397
|
});
|
|
3398
|
-
},
|
|
3398
|
+
}, g = () => {
|
|
3399
3399
|
l({
|
|
3400
3400
|
isOpen: !1,
|
|
3401
3401
|
url: ""
|
|
@@ -3410,13 +3410,13 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3410
3410
|
s.name,
|
|
3411
3411
|
", please install the wallet extension or app."
|
|
3412
3412
|
] }),
|
|
3413
|
-
i && /* @__PURE__ */ C(
|
|
3413
|
+
i && /* @__PURE__ */ C(L, { variant: "solid", color: "primary", size: "lg", fullWidth: !0, onPress: A, className: "mb-4", children: [
|
|
3414
3414
|
"Install ",
|
|
3415
3415
|
s.name
|
|
3416
3416
|
] }),
|
|
3417
3417
|
a.length > 1 && /* @__PURE__ */ C("div", { className: "w-full", children: [
|
|
3418
3418
|
/* @__PURE__ */ o("p", { className: "text-xs text-foreground/60 mb-2 text-center", children: "Or download from:" }),
|
|
3419
|
-
/* @__PURE__ */ o("div", { className: "flex flex-wrap gap-2 justify-center", children: a.map((m, v) => /* @__PURE__ */ o(
|
|
3419
|
+
/* @__PURE__ */ o("div", { className: "flex flex-wrap gap-2 justify-center", children: a.map((m, v) => /* @__PURE__ */ o(L, { variant: "bordered", size: "sm", onPress: () => d(m), children: m.label }, v)) })
|
|
3420
3420
|
] }),
|
|
3421
3421
|
/* @__PURE__ */ o("p", { className: "text-xs text-foreground/40 mt-6 text-center px-4", children: "After installing, refresh the page and try connecting again." })
|
|
3422
3422
|
] }),
|
|
@@ -3426,7 +3426,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3426
3426
|
title: r,
|
|
3427
3427
|
isOpen: c.isOpen,
|
|
3428
3428
|
onClose: f,
|
|
3429
|
-
onBack:
|
|
3429
|
+
onBack: g,
|
|
3430
3430
|
url: c.url,
|
|
3431
3431
|
logo: s?.icon,
|
|
3432
3432
|
logoBackground: s?.iconBackground
|
|
@@ -3455,7 +3455,7 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3455
3455
|
}, hr = () => {
|
|
3456
3456
|
const e = V(N), { connectWallet: n } = Ye();
|
|
3457
3457
|
return {
|
|
3458
|
-
handleSelectWallet:
|
|
3458
|
+
handleSelectWallet: k(
|
|
3459
3459
|
(r, s) => {
|
|
3460
3460
|
if (!e) {
|
|
3461
3461
|
console.error("WalletConnectContext not found");
|
|
@@ -3534,7 +3534,6 @@ const ko = ({ title: e, onBack: n, onClose: t, rightContent: r, hideCloseButton:
|
|
|
3534
3534
|
xClientId: Xe[xe].x,
|
|
3535
3535
|
googleClientId: Xe[xe].google,
|
|
3536
3536
|
walletBaseUrl: "https://embedded-wallet.tomo.inc/embed"
|
|
3537
|
-
// walletBaseUrl: "http://localhost:5173/embed",
|
|
3538
3537
|
}, It = {
|
|
3539
3538
|
basicLogins: ["email", "externalWallets"],
|
|
3540
3539
|
socialLogins: [
|
|
@@ -3774,7 +3773,7 @@ const oc = {
|
|
|
3774
3773
|
typeof e == "string" ? /* @__PURE__ */ o(ue, { src: e, alt: n, width: 32, height: 32, radius: "md" }) : e,
|
|
3775
3774
|
/* @__PURE__ */ o("span", { className: "text-sm font-medium text-foreground", children: n })
|
|
3776
3775
|
] }), Vr = (e) => /* @__PURE__ */ o(
|
|
3777
|
-
|
|
3776
|
+
L,
|
|
3778
3777
|
{
|
|
3779
3778
|
fullWidth: !0,
|
|
3780
3779
|
size: "2xl",
|
|
@@ -3847,9 +3846,9 @@ const dc = () => {
|
|
|
3847
3846
|
n.current && (n.current.scrollTop = 0);
|
|
3848
3847
|
}, e), n;
|
|
3849
3848
|
}, uc = jt, gc = () => {
|
|
3850
|
-
const e = V(N), { handleSelectWallet: n } = hr(), t = e?.modal.state, r = y(() => t?.chainType || "all", [t?.chainType]), { data: s, isLoading: i } = Ze(r, e?.config?.connectors), a = y(() => s?.all || [], [s]), [c, l] = Y(""), { isKeyboardVisible: A, keyboardHeight: d } = Ac(), f = y(() => a.filter((
|
|
3851
|
-
(
|
|
3852
|
-
e?.modal.setCurrentViewState({ chainType:
|
|
3849
|
+
const e = V(N), { handleSelectWallet: n } = hr(), t = e?.modal.state, r = y(() => t?.chainType || "all", [t?.chainType]), { data: s, isLoading: i } = Ze(r, e?.config?.connectors), a = y(() => s?.all || [], [s]), [c, l] = Y(""), { isKeyboardVisible: A, keyboardHeight: d } = Ac(), f = y(() => a.filter((u) => u.info?.name?.toLowerCase().includes(c.toLowerCase())).filter((u) => !u.isEmbeddedWallet), [a, c]), g = fc([r]), m = y(() => A && d > 0 ? `${Math.max(180, 340 - d * 0.6)}px` : "340px", [A, d]), v = k(
|
|
3850
|
+
(u) => {
|
|
3851
|
+
e?.modal.setCurrentViewState({ chainType: u });
|
|
3853
3852
|
},
|
|
3854
3853
|
[e]
|
|
3855
3854
|
);
|
|
@@ -3858,7 +3857,7 @@ const dc = () => {
|
|
|
3858
3857
|
cc,
|
|
3859
3858
|
{
|
|
3860
3859
|
selectedKey: t?.chainType || "all",
|
|
3861
|
-
onSelectionChange: (
|
|
3860
|
+
onSelectionChange: (u) => v(u)
|
|
3862
3861
|
}
|
|
3863
3862
|
),
|
|
3864
3863
|
/* @__PURE__ */ o(
|
|
@@ -3866,7 +3865,7 @@ const dc = () => {
|
|
|
3866
3865
|
{
|
|
3867
3866
|
placeholder: "Search wallet",
|
|
3868
3867
|
value: c,
|
|
3869
|
-
onChange: (
|
|
3868
|
+
onChange: (u) => l(u.target.value),
|
|
3870
3869
|
startContent: /* @__PURE__ */ o(qr, {}),
|
|
3871
3870
|
classNames: {
|
|
3872
3871
|
inputWrapper: "rounded-full h-11"
|
|
@@ -3876,7 +3875,7 @@ const dc = () => {
|
|
|
3876
3875
|
/* @__PURE__ */ o(
|
|
3877
3876
|
"div",
|
|
3878
3877
|
{
|
|
3879
|
-
ref:
|
|
3878
|
+
ref: g,
|
|
3880
3879
|
className: "space-y-2 shrink-0 overflow-y-auto transition-all duration-200 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
|
3881
3880
|
style: {
|
|
3882
3881
|
height: m,
|
|
@@ -3887,7 +3886,7 @@ const dc = () => {
|
|
|
3887
3886
|
{
|
|
3888
3887
|
loading: i,
|
|
3889
3888
|
wallets: f,
|
|
3890
|
-
onSelectWallet: (
|
|
3889
|
+
onSelectWallet: (u) => n(u, r)
|
|
3891
3890
|
}
|
|
3892
3891
|
) })
|
|
3893
3892
|
}
|
|
@@ -3923,7 +3922,7 @@ const dc = () => {
|
|
|
3923
3922
|
return { connectors: n, currentProvider: t };
|
|
3924
3923
|
};
|
|
3925
3924
|
function mc(e = !1) {
|
|
3926
|
-
const [n, t] = Y(e), r =
|
|
3925
|
+
const [n, t] = Y(e), r = k(() => t(!0), []), s = k(() => t(!1), []), i = k(() => t((c) => !c), []), a = k((c) => t(c), []);
|
|
3927
3926
|
return {
|
|
3928
3927
|
isOpen: n,
|
|
3929
3928
|
onOpen: r,
|
|
@@ -3937,31 +3936,31 @@ const pc = (e) => {
|
|
|
3937
3936
|
F(() => {
|
|
3938
3937
|
s !== e && i(e);
|
|
3939
3938
|
}, [e]);
|
|
3940
|
-
const d =
|
|
3941
|
-
(
|
|
3942
|
-
s ===
|
|
3939
|
+
const d = k(
|
|
3940
|
+
(b, x, w) => {
|
|
3941
|
+
s === b && !w || (w || A((O) => [...O, { view: s, state: a }]), i(b), c(x || null));
|
|
3943
3942
|
},
|
|
3944
3943
|
[s, a]
|
|
3945
|
-
), f =
|
|
3944
|
+
), f = k(() => {
|
|
3946
3945
|
i(e), setTimeout(() => {
|
|
3947
3946
|
c(null), A([]);
|
|
3948
3947
|
}, 400);
|
|
3949
|
-
}, [e]),
|
|
3948
|
+
}, [e]), g = k(() => {
|
|
3950
3949
|
r?.(), f();
|
|
3951
|
-
}, [r, f]), m =
|
|
3952
|
-
(
|
|
3953
|
-
A((w) => [...w, { view: s, state: a }]), i(
|
|
3950
|
+
}, [r, f]), m = k(
|
|
3951
|
+
(b, x) => {
|
|
3952
|
+
A((w) => [...w, { view: s, state: a }]), i(b), c(x || null), t();
|
|
3954
3953
|
},
|
|
3955
3954
|
[s, a, t]
|
|
3956
|
-
), v =
|
|
3957
|
-
A((
|
|
3958
|
-
if (
|
|
3959
|
-
return i(e), c(null),
|
|
3960
|
-
const
|
|
3961
|
-
return i(
|
|
3955
|
+
), v = k(() => {
|
|
3956
|
+
A((b) => {
|
|
3957
|
+
if (b.length === 0)
|
|
3958
|
+
return i(e), c(null), b;
|
|
3959
|
+
const x = b[b.length - 1], w = b.slice(0, -1);
|
|
3960
|
+
return i(x.view), c(x.state), w;
|
|
3962
3961
|
});
|
|
3963
|
-
}, [e]),
|
|
3964
|
-
c(
|
|
3962
|
+
}, [e]), u = k((b) => {
|
|
3963
|
+
c(b || null);
|
|
3965
3964
|
}, []), p = l.length > 0 ? l[l.length - 1].view : null;
|
|
3966
3965
|
return {
|
|
3967
3966
|
isOpen: n,
|
|
@@ -3969,11 +3968,11 @@ const pc = (e) => {
|
|
|
3969
3968
|
prevView: p,
|
|
3970
3969
|
openModal: t,
|
|
3971
3970
|
openModalWithState: m,
|
|
3972
|
-
closeModal:
|
|
3971
|
+
closeModal: g,
|
|
3973
3972
|
setView: d,
|
|
3974
3973
|
backView: v,
|
|
3975
3974
|
state: a,
|
|
3976
|
-
setCurrentViewState:
|
|
3975
|
+
setCurrentViewState: u
|
|
3977
3976
|
};
|
|
3978
3977
|
}, Cc = () => V(ln) || {
|
|
3979
3978
|
wallet: null,
|
|
@@ -3989,41 +3988,53 @@ const pc = (e) => {
|
|
|
3989
3988
|
);
|
|
3990
3989
|
if (!s)
|
|
3991
3990
|
throw new Error("WalletConnectContext not found");
|
|
3992
|
-
const { isWalletReady: A } = s.walletReady, d = (
|
|
3991
|
+
const { isWalletReady: A } = s.walletReady, d = (u) => {
|
|
3993
3992
|
s.modal.setView(
|
|
3994
3993
|
s.modal.mainView,
|
|
3995
3994
|
{
|
|
3996
3995
|
isLoading: !1,
|
|
3997
3996
|
email: s.modal.state?.email || "",
|
|
3998
|
-
error:
|
|
3997
|
+
error: u
|
|
3999
3998
|
},
|
|
4000
3999
|
!0
|
|
4001
4000
|
), r(!1);
|
|
4002
4001
|
}, f = () => {
|
|
4003
|
-
const
|
|
4004
|
-
if (!
|
|
4002
|
+
const u = l;
|
|
4003
|
+
if (!u) {
|
|
4005
4004
|
d("Embedded wallet connector not available");
|
|
4006
4005
|
return;
|
|
4007
4006
|
}
|
|
4008
|
-
i.wallet?.onLoginStatusChanged(({ type:
|
|
4009
|
-
|
|
4007
|
+
i.wallet?.onLoginStatusChanged(({ type: w }) => {
|
|
4008
|
+
w === "logout" && s.disconnect?.();
|
|
4010
4009
|
}), s.modal.openModal();
|
|
4011
|
-
const p = s.config?.defaultConnectChain
|
|
4012
|
-
|
|
4010
|
+
const p = s.config?.defaultConnectChain;
|
|
4011
|
+
if (p) {
|
|
4012
|
+
c(u, p);
|
|
4013
|
+
return;
|
|
4014
|
+
}
|
|
4015
|
+
const b = s.config?.chains || {}, x = Object.entries(u.connectors || {}).filter(
|
|
4016
|
+
([w, O]) => O && b[w]
|
|
4017
|
+
);
|
|
4018
|
+
if (x.length > 1)
|
|
4019
|
+
s._setCurrentWallet(u), s.modal.setView(M.WalletSelectProviders);
|
|
4020
|
+
else {
|
|
4021
|
+
const w = x[0]?.[0] ?? T.EVM;
|
|
4022
|
+
c(u, w);
|
|
4023
|
+
}
|
|
4013
4024
|
};
|
|
4014
4025
|
return {
|
|
4015
4026
|
isLoading: t,
|
|
4016
|
-
handleEmailLogin: async (
|
|
4027
|
+
handleEmailLogin: async (u) => {
|
|
4017
4028
|
try {
|
|
4018
|
-
const p = Vs(
|
|
4029
|
+
const p = Vs(u);
|
|
4019
4030
|
if (p && d(p), r(!0), !A || !i.wallet)
|
|
4020
4031
|
return d("Embedded wallet initialization failed");
|
|
4021
|
-
const
|
|
4032
|
+
const b = i.wallet;
|
|
4022
4033
|
n && s.modal.closeModal();
|
|
4023
|
-
const
|
|
4024
|
-
if (!
|
|
4034
|
+
const x = await b?.loginByEmail?.({ email: u });
|
|
4035
|
+
if (!x)
|
|
4025
4036
|
return d("Failed to login into email");
|
|
4026
|
-
if (!(await
|
|
4037
|
+
if (!(await b.login(x)).isAvailable)
|
|
4027
4038
|
return d("Failed to login with email");
|
|
4028
4039
|
f();
|
|
4029
4040
|
} catch (p) {
|
|
@@ -4034,14 +4045,14 @@ const pc = (e) => {
|
|
|
4034
4045
|
try {
|
|
4035
4046
|
if (r(!0), !A || !i.wallet)
|
|
4036
4047
|
return d("Embedded wallet initialization failed");
|
|
4037
|
-
const
|
|
4048
|
+
const u = i.wallet, p = await u?.loginByGoogle?.();
|
|
4038
4049
|
if (!p)
|
|
4039
4050
|
return d("Failed to login into Google");
|
|
4040
|
-
if (!(await
|
|
4051
|
+
if (!(await u.login(p)).isAvailable)
|
|
4041
4052
|
return d("Failed to login with Google");
|
|
4042
4053
|
f();
|
|
4043
|
-
} catch (
|
|
4044
|
-
console.error("Google login error:",
|
|
4054
|
+
} catch (u) {
|
|
4055
|
+
console.error("Google login error:", u), d("Failed to login with Google");
|
|
4045
4056
|
} finally {
|
|
4046
4057
|
r(!1);
|
|
4047
4058
|
}
|
|
@@ -4050,14 +4061,14 @@ const pc = (e) => {
|
|
|
4050
4061
|
try {
|
|
4051
4062
|
if (r(!0), !A || !i.wallet)
|
|
4052
4063
|
return d("Embedded wallet initialization failed");
|
|
4053
|
-
const
|
|
4064
|
+
const u = i.wallet, p = await u?.loginByX?.();
|
|
4054
4065
|
if (!p)
|
|
4055
4066
|
return d("Failed to login into X");
|
|
4056
|
-
if (!(await
|
|
4067
|
+
if (!(await u.login(p)).isAvailable)
|
|
4057
4068
|
return d("Failed to login with X");
|
|
4058
4069
|
f();
|
|
4059
|
-
} catch (
|
|
4060
|
-
console.error("X login error:",
|
|
4070
|
+
} catch (u) {
|
|
4071
|
+
console.error("X login error:", u), d(u instanceof Error ? u.message : u);
|
|
4061
4072
|
} finally {
|
|
4062
4073
|
r(!1);
|
|
4063
4074
|
}
|
|
@@ -4138,7 +4149,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4138
4149
|
resetWalletState: s,
|
|
4139
4150
|
setMainView: i
|
|
4140
4151
|
}) => {
|
|
4141
|
-
const { currentProvider: a, currentWallet: c, isConnected: l, actionsLoading: A } = e, f = V(ln)?.connectedInfo ?? null,
|
|
4152
|
+
const { currentProvider: a, currentWallet: c, isConnected: l, actionsLoading: A } = e, f = V(ln)?.connectedInfo ?? null, g = Tr(), m = zc(), v = Nr(), u = k(
|
|
4142
4153
|
async (z) => {
|
|
4143
4154
|
const { wallet: I, chainType: W } = z, S = (I.connectors[W] || null)?.provider || null;
|
|
4144
4155
|
if (l && c?.info?.uuid === I.info.uuid && W === e.chainType)
|
|
@@ -4167,12 +4178,12 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4167
4178
|
chainId: B.chainId || "",
|
|
4168
4179
|
chainType: W
|
|
4169
4180
|
};
|
|
4170
|
-
if (await In(800),
|
|
4181
|
+
if (await In(800), g && W === T.EVM && v)
|
|
4171
4182
|
try {
|
|
4172
4183
|
const X = jn(I.info.uuid, I.info.rdns, v);
|
|
4173
4184
|
if (X) {
|
|
4174
4185
|
const Z = B.chainId ? parseInt(B.chainId, 16) : void 0;
|
|
4175
|
-
await
|
|
4186
|
+
await g.connectAsync({
|
|
4176
4187
|
connector: X,
|
|
4177
4188
|
chainId: Z
|
|
4178
4189
|
});
|
|
@@ -4283,10 +4294,10 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4283
4294
|
r,
|
|
4284
4295
|
t,
|
|
4285
4296
|
n,
|
|
4286
|
-
|
|
4297
|
+
g,
|
|
4287
4298
|
v
|
|
4288
4299
|
]
|
|
4289
|
-
), p =
|
|
4300
|
+
), p = k(async () => {
|
|
4290
4301
|
t((z) => ({ ...z, actionsLoading: !0 }));
|
|
4291
4302
|
try {
|
|
4292
4303
|
if (n.closeModal(), a?.disconnect?.(), m)
|
|
@@ -4312,7 +4323,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4312
4323
|
c,
|
|
4313
4324
|
s,
|
|
4314
4325
|
i
|
|
4315
|
-
]),
|
|
4326
|
+
]), b = k(
|
|
4316
4327
|
async ({ chainInfo: z, chainType: I }) => {
|
|
4317
4328
|
xn(A, r);
|
|
4318
4329
|
const W = z.id.toString(), E = {
|
|
@@ -4343,7 +4354,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4343
4354
|
}
|
|
4344
4355
|
},
|
|
4345
4356
|
[t, e, A, r]
|
|
4346
|
-
),
|
|
4357
|
+
), x = k(
|
|
4347
4358
|
async (z) => {
|
|
4348
4359
|
if (xn(A, r), !e.isConnected || !e.currentProvider || !e.chainType)
|
|
4349
4360
|
throw new Error("Wallet not connected");
|
|
@@ -4388,7 +4399,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4388
4399
|
t,
|
|
4389
4400
|
r
|
|
4390
4401
|
]
|
|
4391
|
-
), w =
|
|
4402
|
+
), w = k(
|
|
4392
4403
|
async (z) => {
|
|
4393
4404
|
if (xn(A, r), !e.isConnected || !e.currentProvider || !e.chainType)
|
|
4394
4405
|
throw new Error("Wallet not connected");
|
|
@@ -4425,20 +4436,20 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4425
4436
|
t,
|
|
4426
4437
|
r
|
|
4427
4438
|
]
|
|
4428
|
-
),
|
|
4439
|
+
), O = k(
|
|
4429
4440
|
(z) => t((I) => ({ ...I, currentWallet: z })),
|
|
4430
4441
|
[t]
|
|
4431
4442
|
);
|
|
4432
4443
|
return {
|
|
4433
|
-
connect:
|
|
4444
|
+
connect: u,
|
|
4434
4445
|
disconnect: p,
|
|
4435
|
-
switchChain:
|
|
4436
|
-
signInWithWallet:
|
|
4446
|
+
switchChain: b,
|
|
4447
|
+
signInWithWallet: x,
|
|
4437
4448
|
signMessage: w,
|
|
4438
4449
|
// signTransaction,
|
|
4439
4450
|
// signAndSendTransaction,
|
|
4440
4451
|
// sendTransaction,
|
|
4441
|
-
_setCurrentWallet:
|
|
4452
|
+
_setCurrentWallet: O
|
|
4442
4453
|
};
|
|
4443
4454
|
}, ya = () => {
|
|
4444
4455
|
const e = V(N);
|
|
@@ -4472,17 +4483,22 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4472
4483
|
const { currentWallet: a } = s.account;
|
|
4473
4484
|
if (!a)
|
|
4474
4485
|
throw new Error("Current wallet not found");
|
|
4475
|
-
const { chainType: c, chainId: l } = _n(), A =
|
|
4486
|
+
const { chainType: c, chainId: l } = _n(), A = y(() => {
|
|
4487
|
+
if (l) {
|
|
4488
|
+
if (/^\d+$/.test(l)) return Number(l);
|
|
4489
|
+
if (l.startsWith("0x")) return parseInt(l, 16);
|
|
4490
|
+
}
|
|
4491
|
+
}, [l]), d = y(() => {
|
|
4476
4492
|
const v = c?.toLowerCase() === e?.toLowerCase();
|
|
4477
4493
|
if (c === "evm") {
|
|
4478
|
-
const
|
|
4479
|
-
return v && A ===
|
|
4494
|
+
const u = Number(n?.chainId?.split(":")[1] || "0");
|
|
4495
|
+
return A !== void 0 ? v && A === u : !1;
|
|
4480
4496
|
}
|
|
4481
4497
|
return v;
|
|
4482
4498
|
}, [n?.chainId, A, e, c]), f = y(
|
|
4483
4499
|
() => a?.connectors?.[e]?.provider,
|
|
4484
4500
|
[a, e]
|
|
4485
|
-
),
|
|
4501
|
+
), g = y(() => d ? /* @__PURE__ */ o("div", { className: "size-5 bg-[#079555] rounded-full flex items-center justify-center", children: /* @__PURE__ */ o(Xt, { className: "size-3", color: "white" }) }) : r ? /* @__PURE__ */ o(
|
|
4486
4502
|
ge,
|
|
4487
4503
|
{
|
|
4488
4504
|
size: "sm",
|
|
@@ -4508,7 +4524,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4508
4524
|
}
|
|
4509
4525
|
};
|
|
4510
4526
|
return /* @__PURE__ */ o(
|
|
4511
|
-
|
|
4527
|
+
L,
|
|
4512
4528
|
{
|
|
4513
4529
|
fullWidth: !0,
|
|
4514
4530
|
size: "lg",
|
|
@@ -4525,7 +4541,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4525
4541
|
className: "size-8 overflow-hidden rounded-full"
|
|
4526
4542
|
}
|
|
4527
4543
|
),
|
|
4528
|
-
endContent:
|
|
4544
|
+
endContent: g,
|
|
4529
4545
|
onPress: m,
|
|
4530
4546
|
children: /* @__PURE__ */ o("span", { className: "flex-1 text-left text-sm font-medium", children: n?.chainInfo?.name })
|
|
4531
4547
|
}
|
|
@@ -4569,7 +4585,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4569
4585
|
if (!t)
|
|
4570
4586
|
throw new Error(`Chain ${e} not found`);
|
|
4571
4587
|
return /* @__PURE__ */ o(
|
|
4572
|
-
|
|
4588
|
+
L,
|
|
4573
4589
|
{
|
|
4574
4590
|
fullWidth: !0,
|
|
4575
4591
|
color: "default",
|
|
@@ -4603,7 +4619,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4603
4619
|
...A,
|
|
4604
4620
|
chainType: l
|
|
4605
4621
|
}));
|
|
4606
|
-
}, [t?.connectors, e.config?.chains]), i =
|
|
4622
|
+
}, [t?.connectors, e.config?.chains]), i = k(
|
|
4607
4623
|
async (a) => {
|
|
4608
4624
|
if (!t) {
|
|
4609
4625
|
console.error("Current wallet not found");
|
|
@@ -4650,7 +4666,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4650
4666
|
t ? /* @__PURE__ */ o("p", { className: "text-foreground/60", children: t }) : e ? null : /* @__PURE__ */ o("p", { className: "text-foreground/60", children: "Please sign the message request in your wallet to continue." })
|
|
4651
4667
|
] }),
|
|
4652
4668
|
/* @__PURE__ */ o("div", { className: "w-full px-4", children: /* @__PURE__ */ o(
|
|
4653
|
-
|
|
4669
|
+
L,
|
|
4654
4670
|
{
|
|
4655
4671
|
fullWidth: !0,
|
|
4656
4672
|
size: "lg",
|
|
@@ -4750,7 +4766,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4750
4766
|
});
|
|
4751
4767
|
if (!t)
|
|
4752
4768
|
throw new Error("WalletConnectContext not found");
|
|
4753
|
-
const { isWalletReady: c } = t.walletReady, l = t.modal.state?.error, { login: A } = t.config, d = A.basicLogins?.includes("email") ?? !1, f = A.basicLogins?.includes("externalWallets") ?? !1,
|
|
4769
|
+
const { isWalletReady: c } = t.walletReady, l = t.modal.state?.error, { login: A } = t.config, d = A.basicLogins?.includes("email") ?? !1, f = A.basicLogins?.includes("externalWallets") ?? !1, g = A.socialLogins?.some((b) => b.type === "google") ?? !1, m = A.socialLogins?.some((b) => b.type === "x") ?? !1, v = g || m;
|
|
4754
4770
|
return /* @__PURE__ */ C(D, { title: "Log in or sign up", children: [
|
|
4755
4771
|
/* @__PURE__ */ o(jc, { isLoading: r }),
|
|
4756
4772
|
/* @__PURE__ */ C("div", { className: "flex flex-col justify-between min-h-0 flex-1 pb-4", children: [
|
|
@@ -4764,7 +4780,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4764
4780
|
type: "email",
|
|
4765
4781
|
placeholder: "Enter your email",
|
|
4766
4782
|
value: e,
|
|
4767
|
-
onChange: (
|
|
4783
|
+
onChange: (b) => n(b.target.value),
|
|
4768
4784
|
classNames: {
|
|
4769
4785
|
inputWrapper: "rounded-full h-11"
|
|
4770
4786
|
},
|
|
@@ -4772,7 +4788,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4772
4788
|
}
|
|
4773
4789
|
),
|
|
4774
4790
|
/* @__PURE__ */ o(
|
|
4775
|
-
|
|
4791
|
+
L,
|
|
4776
4792
|
{
|
|
4777
4793
|
isIconOnly: !0,
|
|
4778
4794
|
variant: "solid",
|
|
@@ -4799,8 +4815,8 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4799
4815
|
v && /* @__PURE__ */ o(Bt, {})
|
|
4800
4816
|
] }),
|
|
4801
4817
|
v && /* @__PURE__ */ C("div", { className: "flex flex-col gap-3", children: [
|
|
4802
|
-
|
|
4803
|
-
|
|
4818
|
+
g && /* @__PURE__ */ o(
|
|
4819
|
+
L,
|
|
4804
4820
|
{
|
|
4805
4821
|
fullWidth: !0,
|
|
4806
4822
|
size: "lg",
|
|
@@ -4812,7 +4828,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4812
4828
|
}
|
|
4813
4829
|
),
|
|
4814
4830
|
m && /* @__PURE__ */ o(
|
|
4815
|
-
|
|
4831
|
+
L,
|
|
4816
4832
|
{
|
|
4817
4833
|
fullWidth: !0,
|
|
4818
4834
|
size: "lg",
|
|
@@ -4826,7 +4842,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4826
4842
|
] }),
|
|
4827
4843
|
(d || v) && f && /* @__PURE__ */ o(Bt, {}),
|
|
4828
4844
|
f && /* @__PURE__ */ o(
|
|
4829
|
-
|
|
4845
|
+
L,
|
|
4830
4846
|
{
|
|
4831
4847
|
fullWidth: !0,
|
|
4832
4848
|
size: "lg",
|
|
@@ -4860,7 +4876,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4860
4876
|
] }),
|
|
4861
4877
|
/* @__PURE__ */ o("div", { className: "text-[#A9A29D] mt-2 text-sm text-center", children: Lc })
|
|
4862
4878
|
] }),
|
|
4863
|
-
/* @__PURE__ */ o(
|
|
4879
|
+
/* @__PURE__ */ o(L, { className: "w-full my-4", onPress: t, children: "Got it" })
|
|
4864
4880
|
] }) });
|
|
4865
4881
|
}, Zc = () => {
|
|
4866
4882
|
const e = V(N);
|
|
@@ -4902,7 +4918,7 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4902
4918
|
logoBackground: n.info.iconBackground
|
|
4903
4919
|
}
|
|
4904
4920
|
),
|
|
4905
|
-
/* @__PURE__ */ o(
|
|
4921
|
+
/* @__PURE__ */ o(L, { variant: "light", size: "lg", fullWidth: !0, onPress: a, children: i ? "Copied!" : "Copy Link" })
|
|
4906
4922
|
] }) });
|
|
4907
4923
|
}, Er = {
|
|
4908
4924
|
[M.Loading]: () => /* @__PURE__ */ o(ec, {}),
|
|
@@ -4920,10 +4936,10 @@ const xn = (e, n, t = "Wallet is performing an action, please wait...") => {
|
|
|
4920
4936
|
[M.UnsupportChain]: () => /* @__PURE__ */ o(Yc, {}),
|
|
4921
4937
|
[M.WalletHome]: () => /* @__PURE__ */ o(Oc, {})
|
|
4922
4938
|
}, Fc = (e) => {
|
|
4923
|
-
const { hideHeader: n, hideBody: t, onBack: r, ...s } = e, i = y(() => r ? /* @__PURE__ */ o(
|
|
4939
|
+
const { hideHeader: n, hideBody: t, onBack: r, ...s } = e, i = y(() => r ? /* @__PURE__ */ o(L, { isIconOnly: !0, size: "sm", variant: "light", onPress: r, radius: "full", children: /* @__PURE__ */ o(Mt, {}) }) : null, [r]), a = y(() => n ? null : /* @__PURE__ */ C(Ur, { className: "flex items-center justify-between", children: [
|
|
4924
4940
|
i,
|
|
4925
4941
|
/* @__PURE__ */ o("span", { children: e.title }),
|
|
4926
|
-
/* @__PURE__ */ o(
|
|
4942
|
+
/* @__PURE__ */ o(L, { isIconOnly: !0, size: "sm", variant: "light", onPress: e.onClose, radius: "full", children: /* @__PURE__ */ o(Vt, {}) })
|
|
4927
4943
|
] }), [n, e.title, e.onClose, i]), c = y(() => t ? null : /* @__PURE__ */ o(Gr, { className: "px-5", children: e.children }), [t, e.children]);
|
|
4928
4944
|
return /* @__PURE__ */ o(
|
|
4929
4945
|
Nt,
|
|
@@ -5037,21 +5053,21 @@ const Uc = ({
|
|
|
5037
5053
|
a.current = !0;
|
|
5038
5054
|
return;
|
|
5039
5055
|
}
|
|
5040
|
-
let
|
|
5041
|
-
if (console.log("Attempting to restore wallet connection...", v), !
|
|
5056
|
+
let u = l.find((z) => z.info.uuid === v.walletInfo?.uuid) || null;
|
|
5057
|
+
if (console.log("Attempting to restore wallet connection...", v), !u && m?.isAvailable && (u = m), !u) {
|
|
5042
5058
|
console.log("Stored wallet not found in available wallets"), m && (a.current = !0);
|
|
5043
5059
|
return;
|
|
5044
5060
|
}
|
|
5045
5061
|
e((z) => ({
|
|
5046
5062
|
...z,
|
|
5047
|
-
currentWallet:
|
|
5063
|
+
currentWallet: u
|
|
5048
5064
|
}));
|
|
5049
|
-
const p = v.chainType || T.EVM,
|
|
5050
|
-
if (!
|
|
5065
|
+
const p = v.chainType || T.EVM, b = u?.connectors[p] || null;
|
|
5066
|
+
if (!b) {
|
|
5051
5067
|
console.log("Provider not available for stored chain type"), a.current = !0;
|
|
5052
5068
|
return;
|
|
5053
5069
|
}
|
|
5054
|
-
if (
|
|
5070
|
+
if (u?.isEmbeddedWallet) {
|
|
5055
5071
|
const z = s?.connectedInfo;
|
|
5056
5072
|
if (!z) {
|
|
5057
5073
|
console.log("No connectedInfo available for embedded wallet"), a.current = !0;
|
|
@@ -5062,7 +5078,7 @@ const Uc = ({
|
|
|
5062
5078
|
console.log("No connected provider found in connectedInfo"), a.current = !0;
|
|
5063
5079
|
return;
|
|
5064
5080
|
}
|
|
5065
|
-
const W =
|
|
5081
|
+
const W = u?.connectors[I]?.provider;
|
|
5066
5082
|
if (!W) {
|
|
5067
5083
|
console.log("Provider not available for connected chain type:", I), a.current = !0;
|
|
5068
5084
|
return;
|
|
@@ -5091,7 +5107,7 @@ const Uc = ({
|
|
|
5091
5107
|
provider: W,
|
|
5092
5108
|
address: B,
|
|
5093
5109
|
connectedAt: Date.now(),
|
|
5094
|
-
walletId:
|
|
5110
|
+
walletId: u.info.uuid
|
|
5095
5111
|
}), e((j) => ({
|
|
5096
5112
|
...j,
|
|
5097
5113
|
isConnected: !0,
|
|
@@ -5099,11 +5115,11 @@ const Uc = ({
|
|
|
5099
5115
|
chainId: v.chainId,
|
|
5100
5116
|
chainType: I,
|
|
5101
5117
|
balance: v.balance || "0.0",
|
|
5102
|
-
currentWallet:
|
|
5118
|
+
currentWallet: u,
|
|
5103
5119
|
currentProvider: W,
|
|
5104
5120
|
providers: J
|
|
5105
5121
|
})), A && I === T.EVM && i && d && !d.isConnected) {
|
|
5106
|
-
const j = jn(
|
|
5122
|
+
const j = jn(u.info.uuid, u.info.rdns, void 0);
|
|
5107
5123
|
if (j?.ready) {
|
|
5108
5124
|
const U = v.chainId ? parseInt(v.chainId, 16) : void 0;
|
|
5109
5125
|
A.connectAsync({ connector: j, chainId: U }).catch((X) => console.warn("Failed to restore wagmi connection:", X));
|
|
@@ -5112,7 +5128,7 @@ const Uc = ({
|
|
|
5112
5128
|
a.current = !0;
|
|
5113
5129
|
return;
|
|
5114
5130
|
}
|
|
5115
|
-
const
|
|
5131
|
+
const x = v.chainType, w = {};
|
|
5116
5132
|
if (v.providers && Array.isArray(v.providers))
|
|
5117
5133
|
for (const z of v.providers) {
|
|
5118
5134
|
const I = z.chainType, W = l.find((E) => E.info.uuid === z.walletId);
|
|
@@ -5126,23 +5142,23 @@ const Uc = ({
|
|
|
5126
5142
|
});
|
|
5127
5143
|
}
|
|
5128
5144
|
}
|
|
5129
|
-
|
|
5130
|
-
provider:
|
|
5145
|
+
b.provider && x && (w[x] = {
|
|
5146
|
+
provider: b.provider,
|
|
5131
5147
|
address: v.address,
|
|
5132
5148
|
connectedAt: Date.now(),
|
|
5133
|
-
walletId:
|
|
5149
|
+
walletId: u.info.uuid
|
|
5134
5150
|
}), e((z) => ({
|
|
5135
5151
|
...z,
|
|
5136
5152
|
isConnected: !0,
|
|
5137
5153
|
address: v.address,
|
|
5138
5154
|
chainId: v.chainId,
|
|
5139
|
-
chainType:
|
|
5155
|
+
chainType: x,
|
|
5140
5156
|
balance: v.balance || "0.0",
|
|
5141
|
-
currentWallet:
|
|
5142
|
-
currentProvider:
|
|
5157
|
+
currentWallet: u,
|
|
5158
|
+
currentProvider: b.provider,
|
|
5143
5159
|
providers: w
|
|
5144
5160
|
}));
|
|
5145
|
-
const
|
|
5161
|
+
const O = () => {
|
|
5146
5162
|
e((z) => ({
|
|
5147
5163
|
...z,
|
|
5148
5164
|
isConnected: !1,
|
|
@@ -5157,16 +5173,16 @@ const Uc = ({
|
|
|
5157
5173
|
if (Ot(
|
|
5158
5174
|
{ dappLink: typeof window < "u" ? window.location.href : "" },
|
|
5159
5175
|
{
|
|
5160
|
-
provider:
|
|
5161
|
-
chainType:
|
|
5162
|
-
walletInfo:
|
|
5176
|
+
provider: b.provider,
|
|
5177
|
+
chainType: x,
|
|
5178
|
+
walletInfo: u.info
|
|
5163
5179
|
}
|
|
5164
5180
|
).then((z) => {
|
|
5165
|
-
z?.address && z.address.toLowerCase() === v.address.toLowerCase() ? console.log("Restoring plugin wallet connection for:",
|
|
5181
|
+
z?.address && z.address.toLowerCase() === v.address.toLowerCase() ? console.log("Restoring plugin wallet connection for:", u.info.name) : O();
|
|
5166
5182
|
}).catch(() => {
|
|
5167
|
-
|
|
5183
|
+
O(), console.log("Failed to verify wallet connection");
|
|
5168
5184
|
}), A && v.chainType === T.EVM && i && d && !d.isConnected) {
|
|
5169
|
-
const z = jn(
|
|
5185
|
+
const z = jn(u.info.uuid, u.info.rdns, void 0);
|
|
5170
5186
|
if (z?.ready) {
|
|
5171
5187
|
const I = v.chainId ? parseInt(v.chainId, 16) : void 0;
|
|
5172
5188
|
A.connectAsync({ connector: z, chainId: I }).catch((W) => console.warn("Failed to restore wagmi connection:", W));
|
|
@@ -5203,10 +5219,10 @@ function _c() {
|
|
|
5203
5219
|
function s(l, A, d) {
|
|
5204
5220
|
this.fn = l, this.context = A, this.once = d || !1;
|
|
5205
5221
|
}
|
|
5206
|
-
function i(l, A, d, f,
|
|
5222
|
+
function i(l, A, d, f, g) {
|
|
5207
5223
|
if (typeof d != "function")
|
|
5208
5224
|
throw new TypeError("The listener must be a function");
|
|
5209
|
-
var m = new s(d, f || l,
|
|
5225
|
+
var m = new s(d, f || l, g), v = t ? t + A : A;
|
|
5210
5226
|
return l._events[v] ? l._events[v].fn ? l._events[v] = [l._events[v], m] : l._events[v].push(m) : (l._events[v] = m, l._eventsCount++), l;
|
|
5211
5227
|
}
|
|
5212
5228
|
function a(l, A) {
|
|
@@ -5225,18 +5241,18 @@ function _c() {
|
|
|
5225
5241
|
var d = t ? t + A : A, f = this._events[d];
|
|
5226
5242
|
if (!f) return [];
|
|
5227
5243
|
if (f.fn) return [f.fn];
|
|
5228
|
-
for (var
|
|
5229
|
-
v[
|
|
5244
|
+
for (var g = 0, m = f.length, v = new Array(m); g < m; g++)
|
|
5245
|
+
v[g] = f[g].fn;
|
|
5230
5246
|
return v;
|
|
5231
5247
|
}, c.prototype.listenerCount = function(A) {
|
|
5232
5248
|
var d = t ? t + A : A, f = this._events[d];
|
|
5233
5249
|
return f ? f.fn ? 1 : f.length : 0;
|
|
5234
|
-
}, c.prototype.emit = function(A, d, f,
|
|
5235
|
-
var
|
|
5236
|
-
if (!this._events[
|
|
5237
|
-
var p = this._events[
|
|
5250
|
+
}, c.prototype.emit = function(A, d, f, g, m, v) {
|
|
5251
|
+
var u = t ? t + A : A;
|
|
5252
|
+
if (!this._events[u]) return !1;
|
|
5253
|
+
var p = this._events[u], b = arguments.length, x, w;
|
|
5238
5254
|
if (p.fn) {
|
|
5239
|
-
switch (p.once && this.removeListener(A, p.fn, void 0, !0),
|
|
5255
|
+
switch (p.once && this.removeListener(A, p.fn, void 0, !0), b) {
|
|
5240
5256
|
case 1:
|
|
5241
5257
|
return p.fn.call(p.context), !0;
|
|
5242
5258
|
case 2:
|
|
@@ -5244,19 +5260,19 @@ function _c() {
|
|
|
5244
5260
|
case 3:
|
|
5245
5261
|
return p.fn.call(p.context, d, f), !0;
|
|
5246
5262
|
case 4:
|
|
5247
|
-
return p.fn.call(p.context, d, f,
|
|
5263
|
+
return p.fn.call(p.context, d, f, g), !0;
|
|
5248
5264
|
case 5:
|
|
5249
|
-
return p.fn.call(p.context, d, f,
|
|
5265
|
+
return p.fn.call(p.context, d, f, g, m), !0;
|
|
5250
5266
|
case 6:
|
|
5251
|
-
return p.fn.call(p.context, d, f,
|
|
5267
|
+
return p.fn.call(p.context, d, f, g, m, v), !0;
|
|
5252
5268
|
}
|
|
5253
|
-
for (w = 1,
|
|
5254
|
-
|
|
5255
|
-
p.fn.apply(p.context,
|
|
5269
|
+
for (w = 1, x = new Array(b - 1); w < b; w++)
|
|
5270
|
+
x[w - 1] = arguments[w];
|
|
5271
|
+
p.fn.apply(p.context, x);
|
|
5256
5272
|
} else {
|
|
5257
|
-
var
|
|
5258
|
-
for (w = 0; w <
|
|
5259
|
-
switch (p[w].once && this.removeListener(A, p[w].fn, void 0, !0),
|
|
5273
|
+
var O = p.length, z;
|
|
5274
|
+
for (w = 0; w < O; w++)
|
|
5275
|
+
switch (p[w].once && this.removeListener(A, p[w].fn, void 0, !0), b) {
|
|
5260
5276
|
case 1:
|
|
5261
5277
|
p[w].fn.call(p[w].context);
|
|
5262
5278
|
break;
|
|
@@ -5267,12 +5283,12 @@ function _c() {
|
|
|
5267
5283
|
p[w].fn.call(p[w].context, d, f);
|
|
5268
5284
|
break;
|
|
5269
5285
|
case 4:
|
|
5270
|
-
p[w].fn.call(p[w].context, d, f,
|
|
5286
|
+
p[w].fn.call(p[w].context, d, f, g);
|
|
5271
5287
|
break;
|
|
5272
5288
|
default:
|
|
5273
|
-
if (!
|
|
5274
|
-
|
|
5275
|
-
p[w].fn.apply(p[w].context,
|
|
5289
|
+
if (!x) for (z = 1, x = new Array(b - 1); z < b; z++)
|
|
5290
|
+
x[z - 1] = arguments[z];
|
|
5291
|
+
p[w].fn.apply(p[w].context, x);
|
|
5276
5292
|
}
|
|
5277
5293
|
}
|
|
5278
5294
|
return !0;
|
|
@@ -5280,17 +5296,17 @@ function _c() {
|
|
|
5280
5296
|
return i(this, A, d, f, !1);
|
|
5281
5297
|
}, c.prototype.once = function(A, d, f) {
|
|
5282
5298
|
return i(this, A, d, f, !0);
|
|
5283
|
-
}, c.prototype.removeListener = function(A, d, f,
|
|
5299
|
+
}, c.prototype.removeListener = function(A, d, f, g) {
|
|
5284
5300
|
var m = t ? t + A : A;
|
|
5285
5301
|
if (!this._events[m]) return this;
|
|
5286
5302
|
if (!d)
|
|
5287
5303
|
return a(this, m), this;
|
|
5288
5304
|
var v = this._events[m];
|
|
5289
5305
|
if (v.fn)
|
|
5290
|
-
v.fn === d && (!
|
|
5306
|
+
v.fn === d && (!g || v.once) && (!f || v.context === f) && a(this, m);
|
|
5291
5307
|
else {
|
|
5292
|
-
for (var
|
|
5293
|
-
(v[
|
|
5308
|
+
for (var u = 0, p = [], b = v.length; u < b; u++)
|
|
5309
|
+
(v[u].fn !== d || g && !v[u].once || f && v[u].context !== f) && p.push(v[u]);
|
|
5294
5310
|
p.length ? this._events[m] = p.length === 1 ? p[0] : p : a(this, m);
|
|
5295
5311
|
}
|
|
5296
5312
|
return this;
|
|
@@ -5471,41 +5487,41 @@ function et(e = {}) {
|
|
|
5471
5487
|
A?.on && e.target && (a || (a = this.onConnect.bind(this), A.on("connect", a)), s || (s = this.onAccountsChanged.bind(this), A.on("accountsChanged", s)));
|
|
5472
5488
|
},
|
|
5473
5489
|
async connect({ chainId: A, isReconnecting: d, withCapabilities: f } = {}) {
|
|
5474
|
-
const
|
|
5475
|
-
if (!
|
|
5490
|
+
const g = await this.getProvider();
|
|
5491
|
+
if (!g)
|
|
5476
5492
|
throw new me();
|
|
5477
5493
|
let m = [];
|
|
5478
5494
|
if (d)
|
|
5479
5495
|
m = await this.getAccounts().catch(() => []);
|
|
5480
5496
|
else if (n)
|
|
5481
5497
|
try {
|
|
5482
|
-
m = (await
|
|
5498
|
+
m = (await g.request({
|
|
5483
5499
|
method: "wallet_requestPermissions",
|
|
5484
5500
|
params: [{ eth_accounts: {} }]
|
|
5485
|
-
}))[0]?.caveats?.[0]?.value?.map((
|
|
5501
|
+
}))[0]?.caveats?.[0]?.value?.map((u) => He(u)), m.length > 0 && (m = await this.getAccounts());
|
|
5486
5502
|
} catch (v) {
|
|
5487
|
-
const
|
|
5488
|
-
if (
|
|
5489
|
-
throw new G(
|
|
5490
|
-
if (
|
|
5491
|
-
throw
|
|
5503
|
+
const u = v;
|
|
5504
|
+
if (u.code === G.code)
|
|
5505
|
+
throw new G(u);
|
|
5506
|
+
if (u.code === fn.code)
|
|
5507
|
+
throw u;
|
|
5492
5508
|
}
|
|
5493
5509
|
try {
|
|
5494
|
-
!m?.length && !d && (m = (await
|
|
5510
|
+
!m?.length && !d && (m = (await g.request({
|
|
5495
5511
|
method: "eth_requestAccounts"
|
|
5496
|
-
})).map((p) => He(p))), a && (
|
|
5512
|
+
})).map((p) => He(p))), a && (g.removeListener("connect", a), a = void 0), s || (s = this.onAccountsChanged.bind(this), g.on("accountsChanged", s)), i || (i = this.onChainChanged.bind(this), g.on("chainChanged", i)), c || (c = this.onDisconnect.bind(this), g.on("disconnect", c));
|
|
5497
5513
|
let v = await this.getChainId();
|
|
5498
5514
|
return A && v !== A && (v = (await this.switchChain({ chainId: A }).catch((p) => {
|
|
5499
5515
|
if (p.code === G.code)
|
|
5500
5516
|
throw p;
|
|
5501
5517
|
return { id: v };
|
|
5502
5518
|
}))?.id ?? v), n && await l.storage?.removeItem(`${this.id}.disconnected`), e.target || await l.storage?.setItem("injected.connected", !0), {
|
|
5503
|
-
accounts: f ? m.map((
|
|
5519
|
+
accounts: f ? m.map((u) => ({ address: u, capabilities: {} })) : m,
|
|
5504
5520
|
chainId: v
|
|
5505
5521
|
};
|
|
5506
5522
|
} catch (v) {
|
|
5507
|
-
const
|
|
5508
|
-
throw
|
|
5523
|
+
const u = v;
|
|
5524
|
+
throw u.code === G.code ? new G(u) : u.code === fn.code ? new fn(u) : u;
|
|
5509
5525
|
}
|
|
5510
5526
|
},
|
|
5511
5527
|
async disconnect() {
|
|
@@ -5554,12 +5570,12 @@ function et(e = {}) {
|
|
|
5554
5570
|
return !1;
|
|
5555
5571
|
if (!await this.getProvider()) {
|
|
5556
5572
|
if (t !== void 0 && t !== !1) {
|
|
5557
|
-
const
|
|
5573
|
+
const g = async () => (typeof window < "u" && window.removeEventListener("ethereum#initialized", g), !!await this.getProvider()), m = typeof t == "number" ? t : 1e3;
|
|
5558
5574
|
if (await Promise.race([
|
|
5559
5575
|
...typeof window < "u" ? [
|
|
5560
|
-
new Promise((
|
|
5576
|
+
new Promise((u) => window.addEventListener("ethereum#initialized", () => u(g()), { once: !0 }))
|
|
5561
5577
|
] : [],
|
|
5562
|
-
new Promise((
|
|
5578
|
+
new Promise((u) => setTimeout(() => u(g()), m))
|
|
5563
5579
|
]))
|
|
5564
5580
|
return !0;
|
|
5565
5581
|
}
|
|
@@ -5574,14 +5590,14 @@ function et(e = {}) {
|
|
|
5574
5590
|
const f = await this.getProvider();
|
|
5575
5591
|
if (!f)
|
|
5576
5592
|
throw new me();
|
|
5577
|
-
const
|
|
5578
|
-
if (!
|
|
5593
|
+
const g = l.chains.find((v) => v.id === d);
|
|
5594
|
+
if (!g)
|
|
5579
5595
|
throw new st(new oa());
|
|
5580
5596
|
const m = new Promise((v) => {
|
|
5581
|
-
const
|
|
5582
|
-
"chainId" in p && p.chainId === d && (l.emitter.off("change",
|
|
5597
|
+
const u = (p) => {
|
|
5598
|
+
"chainId" in p && p.chainId === d && (l.emitter.off("change", u), v());
|
|
5583
5599
|
};
|
|
5584
|
-
l.emitter.on("change",
|
|
5600
|
+
l.emitter.on("change", u);
|
|
5585
5601
|
});
|
|
5586
5602
|
try {
|
|
5587
5603
|
return await Promise.all([
|
|
@@ -5592,33 +5608,33 @@ function et(e = {}) {
|
|
|
5592
5608
|
await this.getChainId() === d && l.emitter.emit("change", { chainId: d });
|
|
5593
5609
|
}),
|
|
5594
5610
|
m
|
|
5595
|
-
]),
|
|
5611
|
+
]), g;
|
|
5596
5612
|
} catch (v) {
|
|
5597
|
-
const
|
|
5598
|
-
if (
|
|
5613
|
+
const u = v;
|
|
5614
|
+
if (u.code === 4902 || // Unwrapping for MetaMask Mobile
|
|
5599
5615
|
// https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719
|
|
5600
|
-
|
|
5616
|
+
u?.data?.originalError?.code === 4902)
|
|
5601
5617
|
try {
|
|
5602
|
-
const { default: p, ...
|
|
5603
|
-
let
|
|
5604
|
-
A?.blockExplorerUrls ?
|
|
5618
|
+
const { default: p, ...b } = g.blockExplorers ?? {};
|
|
5619
|
+
let x;
|
|
5620
|
+
A?.blockExplorerUrls ? x = A.blockExplorerUrls : p && (x = [
|
|
5605
5621
|
p.url,
|
|
5606
|
-
...Object.values(
|
|
5622
|
+
...Object.values(b).map((z) => z.url)
|
|
5607
5623
|
]);
|
|
5608
5624
|
let w;
|
|
5609
|
-
A?.rpcUrls?.length ? w = A.rpcUrls : w = [
|
|
5610
|
-
const
|
|
5611
|
-
blockExplorerUrls:
|
|
5625
|
+
A?.rpcUrls?.length ? w = A.rpcUrls : w = [g.rpcUrls.default?.http[0] ?? ""];
|
|
5626
|
+
const O = {
|
|
5627
|
+
blockExplorerUrls: x,
|
|
5612
5628
|
chainId: it(d),
|
|
5613
|
-
chainName: A?.chainName ??
|
|
5629
|
+
chainName: A?.chainName ?? g.name,
|
|
5614
5630
|
iconUrls: A?.iconUrls,
|
|
5615
|
-
nativeCurrency: A?.nativeCurrency ??
|
|
5631
|
+
nativeCurrency: A?.nativeCurrency ?? g.nativeCurrency,
|
|
5616
5632
|
rpcUrls: w
|
|
5617
5633
|
};
|
|
5618
5634
|
return await Promise.all([
|
|
5619
5635
|
f.request({
|
|
5620
5636
|
method: "wallet_addEthereumChain",
|
|
5621
|
-
params: [
|
|
5637
|
+
params: [O]
|
|
5622
5638
|
}).then(async () => {
|
|
5623
5639
|
if (await this.getChainId() === d)
|
|
5624
5640
|
l.emitter.emit("change", { chainId: d });
|
|
@@ -5626,11 +5642,11 @@ function et(e = {}) {
|
|
|
5626
5642
|
throw new G(new Error("User rejected switch after adding network."));
|
|
5627
5643
|
}),
|
|
5628
5644
|
m
|
|
5629
|
-
]),
|
|
5645
|
+
]), g;
|
|
5630
5646
|
} catch (p) {
|
|
5631
5647
|
throw new G(p);
|
|
5632
5648
|
}
|
|
5633
|
-
throw
|
|
5649
|
+
throw u.code === G.code ? new G(u) : new st(u);
|
|
5634
5650
|
}
|
|
5635
5651
|
},
|
|
5636
5652
|
async onAccountsChanged(A) {
|
|
@@ -5654,8 +5670,8 @@ function et(e = {}) {
|
|
|
5654
5670
|
return;
|
|
5655
5671
|
const f = Number(A.chainId);
|
|
5656
5672
|
l.emitter.emit("connect", { accounts: d, chainId: f });
|
|
5657
|
-
const
|
|
5658
|
-
|
|
5673
|
+
const g = await this.getProvider();
|
|
5674
|
+
g && (a && (g.removeListener("connect", a), a = void 0), s || (s = this.onAccountsChanged.bind(this), g.on("accountsChanged", s)), i || (i = this.onChainChanged.bind(this), g.on("chainChanged", i)), c || (c = this.onDisconnect.bind(this), g.on("disconnect", c)));
|
|
5659
5675
|
},
|
|
5660
5676
|
async onDisconnect(A) {
|
|
5661
5677
|
const d = await this.getProvider();
|
|
@@ -5778,12 +5794,12 @@ const Aa = ({
|
|
|
5778
5794
|
socialLoginEnabled: s
|
|
5779
5795
|
}) => {
|
|
5780
5796
|
const [i, a] = Y(M.Loading), { walletState: c, setWalletState: l, error: A, setError: d, resetWalletState: f } = yr(), {
|
|
5781
|
-
wallet:
|
|
5797
|
+
wallet: g,
|
|
5782
5798
|
isAvailable: m,
|
|
5783
5799
|
isLoading: v,
|
|
5784
|
-
connectedInfo:
|
|
5800
|
+
connectedInfo: u,
|
|
5785
5801
|
message: p,
|
|
5786
|
-
error:
|
|
5802
|
+
error: b
|
|
5787
5803
|
} = Uc({
|
|
5788
5804
|
config: n.embeddedWalletConfig,
|
|
5789
5805
|
setMainView: a,
|
|
@@ -5791,33 +5807,33 @@ const Aa = ({
|
|
|
5791
5807
|
enabled: s,
|
|
5792
5808
|
defaultTheme: t,
|
|
5793
5809
|
themeMode: n.themeMode
|
|
5794
|
-
}),
|
|
5795
|
-
|
|
5796
|
-
}, [
|
|
5810
|
+
}), x = pc(i), w = k(() => {
|
|
5811
|
+
x.setView(c.isConnected ? M.Account : i), x.openModal();
|
|
5812
|
+
}, [x, c.isConnected, i]), O = y(
|
|
5797
5813
|
() => ({
|
|
5798
|
-
isOpen:
|
|
5799
|
-
view:
|
|
5800
|
-
prevView:
|
|
5814
|
+
isOpen: x.isOpen,
|
|
5815
|
+
view: x.view,
|
|
5816
|
+
prevView: x.prevView,
|
|
5801
5817
|
openModal: w,
|
|
5802
|
-
closeModal:
|
|
5803
|
-
setView:
|
|
5804
|
-
openModalWithState:
|
|
5805
|
-
backView:
|
|
5806
|
-
state:
|
|
5807
|
-
setCurrentViewState:
|
|
5818
|
+
closeModal: x.closeModal,
|
|
5819
|
+
setView: x.setView,
|
|
5820
|
+
openModalWithState: x.openModalWithState,
|
|
5821
|
+
backView: x.backView,
|
|
5822
|
+
state: x.state,
|
|
5823
|
+
setCurrentViewState: x.setCurrentViewState,
|
|
5808
5824
|
mainView: i,
|
|
5809
5825
|
setMainView: a
|
|
5810
5826
|
}),
|
|
5811
5827
|
[
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5828
|
+
x.isOpen,
|
|
5829
|
+
x.view,
|
|
5830
|
+
x.prevView,
|
|
5831
|
+
x.closeModal,
|
|
5832
|
+
x.setView,
|
|
5833
|
+
x.backView,
|
|
5834
|
+
x.state,
|
|
5835
|
+
x.setCurrentViewState,
|
|
5836
|
+
x.openModalWithState,
|
|
5821
5837
|
w,
|
|
5822
5838
|
i
|
|
5823
5839
|
]
|
|
@@ -5850,14 +5866,14 @@ const Aa = ({
|
|
|
5850
5866
|
]
|
|
5851
5867
|
), E = y(
|
|
5852
5868
|
() => ({
|
|
5853
|
-
wallet:
|
|
5869
|
+
wallet: g,
|
|
5854
5870
|
isAvailable: m,
|
|
5855
5871
|
isLoading: v,
|
|
5856
|
-
connectedInfo:
|
|
5872
|
+
connectedInfo: u,
|
|
5857
5873
|
message: p,
|
|
5858
|
-
error:
|
|
5874
|
+
error: b
|
|
5859
5875
|
}),
|
|
5860
|
-
[
|
|
5876
|
+
[g, m, v, u, p, b]
|
|
5861
5877
|
), S = y(
|
|
5862
5878
|
() => Hc(E, s),
|
|
5863
5879
|
[E, s]
|
|
@@ -5871,13 +5887,13 @@ const Aa = ({
|
|
|
5871
5887
|
), J = y(
|
|
5872
5888
|
() => ({
|
|
5873
5889
|
config: n,
|
|
5874
|
-
modal:
|
|
5890
|
+
modal: O,
|
|
5875
5891
|
connection: I,
|
|
5876
5892
|
account: W,
|
|
5877
5893
|
walletReady: B
|
|
5878
5894
|
}),
|
|
5879
|
-
[n,
|
|
5880
|
-
), j = Ze("all", n?.connectors || [], { embeddedWallet:
|
|
5895
|
+
[n, O, I, W, B]
|
|
5896
|
+
), j = Ze("all", n?.connectors || [], { embeddedWallet: g }), U = n?.wagmi, X = U?.config;
|
|
5881
5897
|
return F(() => {
|
|
5882
5898
|
if (!X || !j.data) {
|
|
5883
5899
|
Cn(null);
|
|
@@ -5900,15 +5916,24 @@ const Aa = ({
|
|
|
5900
5916
|
const Je = (De) => {
|
|
5901
5917
|
l((An) => An.chainId === De ? An : { ...An, chainId: De });
|
|
5902
5918
|
}, ve = Fe;
|
|
5903
|
-
if (typeof ve.on == "function")
|
|
5904
|
-
|
|
5905
|
-
ve.
|
|
5919
|
+
if (typeof ve.on == "function") {
|
|
5920
|
+
try {
|
|
5921
|
+
ve.on("chainChanged", Je);
|
|
5922
|
+
} catch {
|
|
5923
|
+
return;
|
|
5924
|
+
}
|
|
5925
|
+
return () => {
|
|
5926
|
+
try {
|
|
5927
|
+
ve.removeListener?.("chainChanged", Je);
|
|
5928
|
+
} catch {
|
|
5929
|
+
}
|
|
5906
5930
|
};
|
|
5907
|
-
|
|
5931
|
+
}
|
|
5932
|
+
}, [c.isConnected, c.chainType, c.currentProvider, l]), /* @__PURE__ */ o(ln.Provider, { value: E, children: /* @__PURE__ */ o(N.Provider, { value: J, children: /* @__PURE__ */ o(
|
|
5908
5933
|
fa,
|
|
5909
5934
|
{
|
|
5910
5935
|
walletState: c,
|
|
5911
|
-
modalState:
|
|
5936
|
+
modalState: x,
|
|
5912
5937
|
setWalletState: l,
|
|
5913
5938
|
resetWalletState: f,
|
|
5914
5939
|
setError: d,
|
|
@@ -5988,12 +6013,12 @@ const ua = new os({
|
|
|
5988
6013
|
...Nn.metadata,
|
|
5989
6014
|
...c.metadata
|
|
5990
6015
|
}
|
|
5991
|
-
},
|
|
6016
|
+
}, g = c.theme && c.theme.themes ? { ...c.theme, prefix: "heroui" } : { ..._.theme, prefix: "heroui" }, m = {
|
|
5992
6017
|
...n,
|
|
5993
6018
|
connectors: c.connectors || _.connectors,
|
|
5994
6019
|
chains: c.chains || _.chains,
|
|
5995
6020
|
login: l,
|
|
5996
|
-
theme:
|
|
6021
|
+
theme: g,
|
|
5997
6022
|
clientId: _.clientId,
|
|
5998
6023
|
walletConnectConfig: f,
|
|
5999
6024
|
embeddedWalletConfig: {
|
|
@@ -6014,15 +6039,15 @@ const ua = new os({
|
|
|
6014
6039
|
}, [n, t]), s = M.WalletHome, i = y(() => Dc(n?.login), [n?.login]), a = y(() => {
|
|
6015
6040
|
const c = Ko(), l = n?.theme;
|
|
6016
6041
|
if (!l) return c;
|
|
6017
|
-
const A = c.themes ?? {}, d = l.themes ?? {}, f = (
|
|
6018
|
-
if (!m) return
|
|
6019
|
-
if (!
|
|
6020
|
-
const v =
|
|
6021
|
-
for (const [
|
|
6022
|
-
const w = v[
|
|
6023
|
-
|
|
6042
|
+
const A = c.themes ?? {}, d = l.themes ?? {}, f = (g, m) => {
|
|
6043
|
+
if (!m) return g ?? {};
|
|
6044
|
+
if (!g) return m;
|
|
6045
|
+
const v = g.colors ?? {}, u = m.colors ?? {}, p = { ...v };
|
|
6046
|
+
for (const [b, x] of Object.entries(u)) {
|
|
6047
|
+
const w = v[b];
|
|
6048
|
+
x && typeof x == "object" && !Array.isArray(x) && w && typeof w == "object" && !Array.isArray(w) ? p[b] = { ...w, ...x } : p[b] = x;
|
|
6024
6049
|
}
|
|
6025
|
-
return { ...
|
|
6050
|
+
return { ...g, ...m, colors: p };
|
|
6026
6051
|
};
|
|
6027
6052
|
return {
|
|
6028
6053
|
...c,
|
|
@@ -6065,68 +6090,64 @@ async function Wa() {
|
|
|
6065
6090
|
let e = [];
|
|
6066
6091
|
try {
|
|
6067
6092
|
e = await Zt();
|
|
6068
|
-
} catch (
|
|
6069
|
-
console.warn("Failed to fetch chains from API, using default chains:",
|
|
6093
|
+
} catch (s) {
|
|
6094
|
+
console.warn("Failed to fetch chains from API, using default chains:", s);
|
|
6070
6095
|
}
|
|
6071
6096
|
const n = e.length > 0 ? Dt(e) : le, t = {};
|
|
6072
6097
|
if (e.length > 0) {
|
|
6073
|
-
const
|
|
6074
|
-
|
|
6075
|
-
id:
|
|
6076
|
-
name:
|
|
6077
|
-
nativeCurrency:
|
|
6078
|
-
rpcUrls:
|
|
6079
|
-
blockExplorers:
|
|
6098
|
+
const s = e.filter((i) => H(i.chainId) === "aptos");
|
|
6099
|
+
s.length > 0 && (t.aptos = s.map((i) => ({
|
|
6100
|
+
id: i.chainId,
|
|
6101
|
+
name: i.name,
|
|
6102
|
+
nativeCurrency: i.nativeCurrency,
|
|
6103
|
+
rpcUrls: i.rpcUrls,
|
|
6104
|
+
blockExplorers: i.blockExplorers,
|
|
6080
6105
|
chainInfo: {
|
|
6081
|
-
icon:
|
|
6082
|
-
name:
|
|
6106
|
+
icon: i.icon,
|
|
6107
|
+
name: i.name
|
|
6083
6108
|
}
|
|
6084
6109
|
})));
|
|
6085
6110
|
} else
|
|
6086
6111
|
t.aptos = ie.aptos || [];
|
|
6087
6112
|
if (e.length > 0) {
|
|
6088
|
-
const
|
|
6089
|
-
|
|
6090
|
-
const
|
|
6113
|
+
const s = e.filter((i) => H(i.chainId) === "evm");
|
|
6114
|
+
s.length > 0 && (t.evm = s.map((i) => {
|
|
6115
|
+
const a = i.chainId.match(/^eip155:(\d+)$/), c = a ? parseInt(a[1], 10) : 1, l = `evm_${c}`, A = n[l] || le[l], d = i.icon || (typeof A == "string" ? A : null);
|
|
6091
6116
|
return {
|
|
6092
|
-
id:
|
|
6093
|
-
name:
|
|
6094
|
-
nativeCurrency:
|
|
6095
|
-
rpcUrls:
|
|
6096
|
-
blockExplorers:
|
|
6097
|
-
contracts:
|
|
6098
|
-
blockTime:
|
|
6099
|
-
...
|
|
6117
|
+
id: c,
|
|
6118
|
+
name: i.name,
|
|
6119
|
+
nativeCurrency: i.nativeCurrency,
|
|
6120
|
+
rpcUrls: i.rpcUrls,
|
|
6121
|
+
blockExplorers: i.blockExplorers,
|
|
6122
|
+
contracts: i.contracts,
|
|
6123
|
+
blockTime: i.blockTime,
|
|
6124
|
+
...d && { icon: d }
|
|
6100
6125
|
};
|
|
6101
6126
|
}));
|
|
6102
6127
|
} else
|
|
6103
6128
|
t.evm = ie.evm || [];
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
name: s.name,
|
|
6124
|
-
nativeCurrency: s.nativeCurrency,
|
|
6125
|
-
rpcUrls: s.rpcUrls,
|
|
6126
|
-
blockExplorers: s.blockExplorers,
|
|
6129
|
+
const r = e.filter((s) => H(s.chainId) === "solana");
|
|
6130
|
+
if (r.length > 0 ? t.solana = r.map((s) => ({
|
|
6131
|
+
id: s.chainId,
|
|
6132
|
+
name: s.name,
|
|
6133
|
+
nativeCurrency: s.nativeCurrency,
|
|
6134
|
+
rpcUrls: s.rpcUrls,
|
|
6135
|
+
blockExplorers: s.blockExplorers,
|
|
6136
|
+
chainInfo: {
|
|
6137
|
+
icon: s.icon,
|
|
6138
|
+
name: s.name
|
|
6139
|
+
}
|
|
6140
|
+
})) : t.solana = ie.solana || [], e.length > 0) {
|
|
6141
|
+
const s = e.filter((i) => H(i.chainId) === "dogecoin");
|
|
6142
|
+
s.length > 0 && (t.dogecoin = s.map((i) => ({
|
|
6143
|
+
id: i.chainId,
|
|
6144
|
+
name: i.name,
|
|
6145
|
+
nativeCurrency: i.nativeCurrency,
|
|
6146
|
+
rpcUrls: i.rpcUrls,
|
|
6147
|
+
blockExplorers: i.blockExplorers,
|
|
6127
6148
|
chainInfo: {
|
|
6128
|
-
icon:
|
|
6129
|
-
name:
|
|
6149
|
+
icon: i.icon,
|
|
6150
|
+
name: i.name
|
|
6130
6151
|
}
|
|
6131
6152
|
})));
|
|
6132
6153
|
} else
|