@aurum-sdk/core 0.2.1 → 0.2.2
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/{chunk-BSMOPBPL.mjs → chunk-DPFIEHZ6.mjs} +138 -122
- package/dist/chunk-DPFIEHZ6.mjs.map +1 -0
- package/dist/{chunk-AFVK5GA5.js → chunk-FRA6K6V4.js} +100 -84
- package/dist/chunk-FRA6K6V4.js.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +688 -719
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +630 -661
- package/dist/index.mjs.map +1 -1
- package/dist/widgets.js +13 -20
- package/dist/widgets.js.map +1 -1
- package/dist/widgets.mjs +3 -10
- package/dist/widgets.mjs.map +1 -1
- package/package.json +8 -11
- package/dist/chunk-AFVK5GA5.js.map +0 -1
- package/dist/chunk-BSMOPBPL.mjs.map +0 -1
|
@@ -91,8 +91,7 @@ var WALLET_PRIORITY = [
|
|
|
91
91
|
WalletId.WalletConnect,
|
|
92
92
|
WalletId.Brave,
|
|
93
93
|
WalletId.Rabby,
|
|
94
|
-
WalletId.CoinbaseWallet
|
|
95
|
-
WalletId.Ledger
|
|
94
|
+
WalletId.CoinbaseWallet
|
|
96
95
|
];
|
|
97
96
|
function sortWallets(wallets, options = {}) {
|
|
98
97
|
const { filterHidden = true } = options;
|
|
@@ -119,16 +118,6 @@ function sortWallets(wallets, options = {}) {
|
|
|
119
118
|
return result;
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
// src/utils/platform/isMobile.ts
|
|
123
|
-
import MobileDetect from "mobile-detect";
|
|
124
|
-
function isMobile() {
|
|
125
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
const md = new MobileDetect(window.navigator.userAgent);
|
|
129
|
-
return md.mobile() !== null || md.tablet() !== null;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
121
|
// src/contexts/NavigationContext.tsx
|
|
133
122
|
import { createContext as createContext2, useContext as useContext2, useState } from "react";
|
|
134
123
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
@@ -756,7 +745,7 @@ function initSentry(enabled = true) {
|
|
|
756
745
|
Sentry.init({
|
|
757
746
|
dsn: "https://0bb16fd7057ac7b45ae0ab416cdbea8b@o4505953815494656.ingest.us.sentry.io/4509747448184832",
|
|
758
747
|
environment: getEnvironment(),
|
|
759
|
-
release: `@aurum-sdk/core@${"0.2.
|
|
748
|
+
release: `@aurum-sdk/core@${"0.2.2"}`,
|
|
760
749
|
sendDefaultPii: false,
|
|
761
750
|
enableLogs: true
|
|
762
751
|
});
|
|
@@ -1306,13 +1295,17 @@ var ConnectionIconsRow = ({
|
|
|
1306
1295
|
|
|
1307
1296
|
// src/components/ConnectModal/ConnectionStatus/ConnectionStatusBase.tsx
|
|
1308
1297
|
import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1298
|
+
var ERROR_CODE = {
|
|
1299
|
+
USER_REJECTED: 4001,
|
|
1300
|
+
REQUEST_PENDING: -32002
|
|
1301
|
+
};
|
|
1309
1302
|
var ConnectionStatusBase = ({
|
|
1310
1303
|
title,
|
|
1311
1304
|
pendingHeaderText,
|
|
1312
1305
|
pendingSubContent,
|
|
1313
1306
|
extraContent
|
|
1314
1307
|
}) => {
|
|
1315
|
-
const { selectedWallet, error, success, goBackToHome, retryConnection } = useConnectModal();
|
|
1308
|
+
const { selectedWallet, error, errorCode, success, goBackToHome, retryConnection } = useConnectModal();
|
|
1316
1309
|
const { onDismiss, brandConfig } = useWidgetContext();
|
|
1317
1310
|
const [shouldShake, setShouldShake] = useState8(false);
|
|
1318
1311
|
useEffect5(() => {
|
|
@@ -1329,12 +1322,15 @@ var ConnectionStatusBase = ({
|
|
|
1329
1322
|
}
|
|
1330
1323
|
const getHeaderVariant = () => {
|
|
1331
1324
|
if (success) return "success";
|
|
1332
|
-
if (error) return "error";
|
|
1325
|
+
if (error && errorCode !== ERROR_CODE.REQUEST_PENDING) return "error";
|
|
1333
1326
|
return "primary";
|
|
1334
1327
|
};
|
|
1335
1328
|
const getHeaderText = () => {
|
|
1336
1329
|
if (success) return "";
|
|
1337
|
-
if (error)
|
|
1330
|
+
if (error) {
|
|
1331
|
+
if (errorCode === ERROR_CODE.REQUEST_PENDING) return "Request Pending";
|
|
1332
|
+
return "Request Rejected";
|
|
1333
|
+
}
|
|
1338
1334
|
return pendingHeaderText;
|
|
1339
1335
|
};
|
|
1340
1336
|
const renderSubContent = () => {
|
|
@@ -1342,6 +1338,13 @@ var ConnectionStatusBase = ({
|
|
|
1342
1338
|
return /* @__PURE__ */ jsx30("div", { className: "success-icon-large", children: /* @__PURE__ */ jsx30(CircleCheck, { color: "var(--aurum-primary-color)", size: 46 }) });
|
|
1343
1339
|
}
|
|
1344
1340
|
if (error) {
|
|
1341
|
+
if (errorCode === ERROR_CODE.REQUEST_PENDING) {
|
|
1342
|
+
return /* @__PURE__ */ jsxs14(Text, { align: "center", size: "sm", variant: "secondary", children: [
|
|
1343
|
+
"Check your wallet for a ",
|
|
1344
|
+
"\n",
|
|
1345
|
+
"pending connection request"
|
|
1346
|
+
] });
|
|
1347
|
+
}
|
|
1345
1348
|
return /* @__PURE__ */ jsxs14(Text, { align: "center", size: "sm", variant: "secondary", children: [
|
|
1346
1349
|
"Please try again or select a ",
|
|
1347
1350
|
"\n",
|
|
@@ -1385,23 +1388,25 @@ var ConnectionStatusBase = ({
|
|
|
1385
1388
|
};
|
|
1386
1389
|
|
|
1387
1390
|
// src/components/ConnectModal/ConnectionStatus/Desktop.tsx
|
|
1388
|
-
import {
|
|
1389
|
-
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1391
|
+
import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1390
1392
|
var ConnectionStatusPage = () => {
|
|
1391
1393
|
const { selectedWallet } = useConnectModal();
|
|
1392
1394
|
return /* @__PURE__ */ jsx31(
|
|
1393
1395
|
ConnectionStatusBase,
|
|
1394
1396
|
{
|
|
1395
1397
|
pendingHeaderText: `Approve in ${selectedWallet?.name}`,
|
|
1396
|
-
pendingSubContent: /* @__PURE__ */
|
|
1397
|
-
|
|
1398
|
+
pendingSubContent: /* @__PURE__ */ jsxs15(Text, { align: "center", size: "sm", variant: "secondary", children: [
|
|
1399
|
+
"Please check your wallet to",
|
|
1400
|
+
"\n",
|
|
1401
|
+
"approve the connection"
|
|
1402
|
+
] })
|
|
1398
1403
|
}
|
|
1399
1404
|
);
|
|
1400
1405
|
};
|
|
1401
1406
|
|
|
1402
1407
|
// src/components/ConnectModal/ConnectionStatus/Mobile.tsx
|
|
1403
1408
|
import { useState as useState9, useEffect as useEffect6 } from "react";
|
|
1404
|
-
import { jsx as jsx32, jsxs as
|
|
1409
|
+
import { jsx as jsx32, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1405
1410
|
var ConnectionStatusMobilePage = () => {
|
|
1406
1411
|
const { selectedWallet, error, success, retryConnection } = useConnectModal();
|
|
1407
1412
|
const [showLaunchButton, setShowLaunchButton] = useState9(false);
|
|
@@ -1414,7 +1419,7 @@ var ConnectionStatusMobilePage = () => {
|
|
|
1414
1419
|
{
|
|
1415
1420
|
title: selectedWallet?.name,
|
|
1416
1421
|
pendingHeaderText: `Opening ${selectedWallet?.name}`,
|
|
1417
|
-
pendingSubContent: /* @__PURE__ */
|
|
1422
|
+
pendingSubContent: /* @__PURE__ */ jsxs16(Text, { size: "sm", variant: "secondary", align: "center", style: { maxWidth: "18.75rem" }, children: [
|
|
1418
1423
|
"If ",
|
|
1419
1424
|
selectedWallet?.name,
|
|
1420
1425
|
" doesn't open automatically, click the button below"
|
|
@@ -1425,28 +1430,27 @@ var ConnectionStatusMobilePage = () => {
|
|
|
1425
1430
|
};
|
|
1426
1431
|
|
|
1427
1432
|
// src/components/ConnectModal/QRCodePage.tsx
|
|
1428
|
-
import { useEffect as
|
|
1433
|
+
import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
1429
1434
|
|
|
1430
1435
|
// src/components/QRCodeDisplay/QRCodeDisplay.tsx
|
|
1431
|
-
import { useRef as useRef4, useEffect as useEffect7 } from "react";
|
|
1432
1436
|
import { QRCode } from "react-qrcode-logo";
|
|
1433
1437
|
|
|
1434
1438
|
// src/utils/generateQrCodeWalletLogo.tsx
|
|
1435
1439
|
import { getLogoDataUri } from "@aurum-sdk/logos";
|
|
1436
|
-
import { WalletId as
|
|
1440
|
+
import { WalletId as WalletId4 } from "@aurum-sdk/types";
|
|
1437
1441
|
var generateQrCodeWalletLogo = (walletAdapter) => {
|
|
1438
|
-
if (walletAdapter
|
|
1442
|
+
if (walletAdapter?.icon) {
|
|
1439
1443
|
return walletAdapter.icon;
|
|
1440
1444
|
}
|
|
1441
|
-
return getLogoDataUri(
|
|
1445
|
+
return getLogoDataUri(WalletId4.WalletConnect) ?? "";
|
|
1442
1446
|
};
|
|
1443
1447
|
|
|
1444
1448
|
// src/components/QRCodeDisplay/QREye.tsx
|
|
1445
|
-
import { jsx as jsx33, jsxs as
|
|
1449
|
+
import { jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1446
1450
|
var QREye = ({ x, y, eyeSize, eyeRadius, dotSize, fillColor, bgColor }) => {
|
|
1447
1451
|
const padding = dotSize * 0.8;
|
|
1448
1452
|
const centerRadius = (eyeSize - 4 * padding) / 2 * 1.1;
|
|
1449
|
-
return /* @__PURE__ */
|
|
1453
|
+
return /* @__PURE__ */ jsxs17("g", { children: [
|
|
1450
1454
|
/* @__PURE__ */ jsx33(
|
|
1451
1455
|
"rect",
|
|
1452
1456
|
{
|
|
@@ -1520,7 +1524,7 @@ var generateSkeletonDots = ({
|
|
|
1520
1524
|
};
|
|
1521
1525
|
|
|
1522
1526
|
// src/components/QRCodeDisplay/QRCodeSkeleton.tsx
|
|
1523
|
-
import { jsx as jsx35, jsxs as
|
|
1527
|
+
import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1524
1528
|
var QRCodeSkeleton = ({ size = 128 }) => {
|
|
1525
1529
|
const { brandConfig } = useWidgetContext();
|
|
1526
1530
|
const { selectedWallet } = useConnectModal();
|
|
@@ -1531,7 +1535,7 @@ var QRCodeSkeleton = ({ size = 128 }) => {
|
|
|
1531
1535
|
const dotSize = size / 40;
|
|
1532
1536
|
const eyeSize = 32;
|
|
1533
1537
|
const gridSize = 40;
|
|
1534
|
-
return /* @__PURE__ */ jsx35("div", { className: "qr-skeleton-container", style: { height: size }, children: /* @__PURE__ */
|
|
1538
|
+
return /* @__PURE__ */ jsx35("div", { className: "qr-skeleton-container", style: { height: size }, children: /* @__PURE__ */ jsxs18("svg", { width: size, height: size, className: "qr-skeleton-svg", children: [
|
|
1535
1539
|
/* @__PURE__ */ jsx35("rect", { width: size, height: size, fill: bgColor }),
|
|
1536
1540
|
generateSkeletonDots({ logoSize, dotSize, eyeSize, gridSize, fillColor }),
|
|
1537
1541
|
/* @__PURE__ */ jsx35(
|
|
@@ -1597,27 +1601,15 @@ var QRCodeSkeleton = ({ size = 128 }) => {
|
|
|
1597
1601
|
};
|
|
1598
1602
|
|
|
1599
1603
|
// src/components/QRCodeDisplay/QRCodeDisplay.tsx
|
|
1600
|
-
import { WalletId as
|
|
1601
|
-
import { jsx as jsx36, jsxs as
|
|
1604
|
+
import { WalletId as WalletId5 } from "@aurum-sdk/types";
|
|
1605
|
+
import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1602
1606
|
var QRCodeDisplay = ({ uri, size = 256 }) => {
|
|
1603
1607
|
const { brandConfig } = useWidgetContext();
|
|
1604
|
-
const { selectedWallet, displayedWallets,
|
|
1608
|
+
const { selectedWallet, displayedWallets, openWalletConnectModal } = useConnectModal();
|
|
1605
1609
|
const qrCodeDisplayColor = brandConfig.theme === "light" ? "#000000" : "#6b7280";
|
|
1606
1610
|
const bgColor = brandConfig.theme === "light" ? "#ffffff" : "#121212";
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1609
|
-
if (selectedWallet && selectedWallet.id !== WalletId6.AppKit) {
|
|
1610
|
-
logoWalletRef.current = selectedWallet;
|
|
1611
|
-
}
|
|
1612
|
-
}, [selectedWallet]);
|
|
1613
|
-
const logoWallet = logoWalletRef.current || selectedWallet;
|
|
1614
|
-
const appKitAdapter = displayedWallets.find(({ id }) => id === WalletId6.AppKit);
|
|
1615
|
-
const handleAppKitConnect = async () => {
|
|
1616
|
-
if (appKitAdapter) {
|
|
1617
|
-
connectWallet(appKitAdapter);
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1620
|
-
return /* @__PURE__ */ jsx36(Column, { align: "center", gap: 16, children: /* @__PURE__ */ jsxs18(Column, { align: "center", gap: 4, children: [
|
|
1611
|
+
const wcAdapter = displayedWallets.find(({ id }) => id === WalletId5.WalletConnect);
|
|
1612
|
+
return /* @__PURE__ */ jsx36(Column, { align: "center", gap: 16, children: /* @__PURE__ */ jsxs19(Column, { align: "center", gap: 4, children: [
|
|
1621
1613
|
/* @__PURE__ */ jsx36(
|
|
1622
1614
|
"div",
|
|
1623
1615
|
{
|
|
@@ -1634,7 +1626,7 @@ var QRCodeDisplay = ({ uri, size = 256 }) => {
|
|
|
1634
1626
|
quietZone: 0,
|
|
1635
1627
|
bgColor,
|
|
1636
1628
|
fgColor: qrCodeDisplayColor,
|
|
1637
|
-
logoImage: generateQrCodeWalletLogo(
|
|
1629
|
+
logoImage: generateQrCodeWalletLogo(selectedWallet || void 0),
|
|
1638
1630
|
logoWidth: size * 0.2,
|
|
1639
1631
|
logoHeight: size * 0.2,
|
|
1640
1632
|
removeQrCodeBehindLogo: true,
|
|
@@ -1645,14 +1637,14 @@ var QRCodeDisplay = ({ uri, size = 256 }) => {
|
|
|
1645
1637
|
)
|
|
1646
1638
|
}
|
|
1647
1639
|
),
|
|
1648
|
-
/* @__PURE__ */
|
|
1640
|
+
/* @__PURE__ */ jsxs19(Row, { justify: wcAdapter?.openModal ? "space-between" : "center", style: { width: "100%" }, children: [
|
|
1649
1641
|
/* @__PURE__ */ jsx36(CopyButton, { text: uri || "", disabled: !uri, variant: "secondary", label: "Copy URI" }),
|
|
1650
|
-
|
|
1642
|
+
wcAdapter?.openModal && /* @__PURE__ */ jsx36(
|
|
1651
1643
|
Button,
|
|
1652
1644
|
{
|
|
1653
1645
|
variant: "text",
|
|
1654
1646
|
size: "sm",
|
|
1655
|
-
onClick:
|
|
1647
|
+
onClick: openWalletConnectModal,
|
|
1656
1648
|
style: { color: "var(--color-foreground-muted)", fontWeight: "500" },
|
|
1657
1649
|
children: "Open Modal"
|
|
1658
1650
|
}
|
|
@@ -1663,25 +1655,18 @@ var QRCodeDisplay = ({ uri, size = 256 }) => {
|
|
|
1663
1655
|
|
|
1664
1656
|
// src/components/ConnectModal/QRCodePage.tsx
|
|
1665
1657
|
import { ChevronLeft as ChevronLeft2, X as X4, SquareArrowOutUpRight, CircleCheck as CircleCheck2 } from "lucide-react";
|
|
1666
|
-
import {
|
|
1667
|
-
import { Fragment as Fragment5, jsx as jsx37, jsxs as
|
|
1658
|
+
import { WalletName } from "@aurum-sdk/types";
|
|
1659
|
+
import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1668
1660
|
var QRCodePage = () => {
|
|
1669
1661
|
const { onDismiss } = useWidgetContext();
|
|
1670
1662
|
const { navigateTo } = useNavigation();
|
|
1671
1663
|
const { selectedWallet, error, configError, retryConnection, qrSuccess } = useConnectModal();
|
|
1672
1664
|
const [connectionUri, setConnectionUri] = useState10(null);
|
|
1673
|
-
const originalWalletRef = useRef5(null);
|
|
1674
|
-
useEffect8(() => {
|
|
1675
|
-
if (selectedWallet && selectedWallet.id !== WalletId7.AppKit) {
|
|
1676
|
-
originalWalletRef.current = selectedWallet;
|
|
1677
|
-
}
|
|
1678
|
-
}, [selectedWallet]);
|
|
1679
|
-
const displayWallet = originalWalletRef.current || selectedWallet;
|
|
1680
1665
|
const goBackToHome = () => {
|
|
1681
1666
|
navigateTo(PAGE_IDS.SELECT_WALLET);
|
|
1682
1667
|
};
|
|
1683
|
-
const title =
|
|
1684
|
-
|
|
1668
|
+
const title = selectedWallet?.name === WalletName.WalletConnect ? "Scan QR code" : `Scan with ${selectedWallet?.name} app`;
|
|
1669
|
+
useEffect7(() => {
|
|
1685
1670
|
const handleWalletConnectURI = (event) => {
|
|
1686
1671
|
setConnectionUri(event.detail.uri);
|
|
1687
1672
|
};
|
|
@@ -1690,7 +1675,7 @@ var QRCodePage = () => {
|
|
|
1690
1675
|
window.removeEventListener("walletconnect:uri", handleWalletConnectURI);
|
|
1691
1676
|
};
|
|
1692
1677
|
}, []);
|
|
1693
|
-
|
|
1678
|
+
useEffect7(() => {
|
|
1694
1679
|
if (error && !configError) {
|
|
1695
1680
|
setConnectionUri(null);
|
|
1696
1681
|
retryConnection();
|
|
@@ -1699,7 +1684,7 @@ var QRCodePage = () => {
|
|
|
1699
1684
|
if (!selectedWallet) {
|
|
1700
1685
|
return null;
|
|
1701
1686
|
}
|
|
1702
|
-
return /* @__PURE__ */
|
|
1687
|
+
return /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
1703
1688
|
/* @__PURE__ */ jsx37(
|
|
1704
1689
|
ModalHeader,
|
|
1705
1690
|
{
|
|
@@ -1708,21 +1693,21 @@ var QRCodePage = () => {
|
|
|
1708
1693
|
rightAction: qrSuccess ? null : /* @__PURE__ */ jsx37(Button, { size: "sm", variant: "close", onClick: onDismiss, "aria-label": "Close", children: /* @__PURE__ */ jsx37(X4, { size: 20, color: "var(--color-foreground-muted)" }) })
|
|
1709
1694
|
}
|
|
1710
1695
|
),
|
|
1711
|
-
qrSuccess ? /* @__PURE__ */ jsx37(Column, { align: "center", style: { height: "8rem" }, children: /* @__PURE__ */ jsx37(CircleCheck2, { color: "var(--aurum-primary-color)", size: 46 }) }) : /* @__PURE__ */
|
|
1696
|
+
qrSuccess ? /* @__PURE__ */ jsx37(Column, { align: "center", style: { height: "8rem" }, children: /* @__PURE__ */ jsx37(CircleCheck2, { color: "var(--aurum-primary-color)", size: 46 }) }) : /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
1712
1697
|
/* @__PURE__ */ jsx37(Column, { align: "center", gap: 24, children: /* @__PURE__ */ jsx37(QRCodeDisplay, { uri: error ? null : connectionUri }) }),
|
|
1713
|
-
|
|
1698
|
+
selectedWallet?.downloadUrl && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
1714
1699
|
/* @__PURE__ */ jsx37(Spacer, { size: 15 }),
|
|
1715
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsxs20(
|
|
1716
1701
|
Button,
|
|
1717
1702
|
{
|
|
1718
1703
|
variant: "tertiary",
|
|
1719
1704
|
expand: true,
|
|
1720
|
-
onClick: () => window.open(
|
|
1705
|
+
onClick: () => window.open(selectedWallet.downloadUrl ?? "", "_blank", "noopener,noreferrer"),
|
|
1721
1706
|
children: [
|
|
1722
1707
|
/* @__PURE__ */ jsx37(SquareArrowOutUpRight, { size: 16, color: "var(--color-foreground-muted)" }),
|
|
1723
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ jsxs20(Text, { size: "sm", weight: "semibold", variant: "secondary", children: [
|
|
1724
1709
|
"Download ",
|
|
1725
|
-
|
|
1710
|
+
selectedWallet.name
|
|
1726
1711
|
] })
|
|
1727
1712
|
]
|
|
1728
1713
|
}
|
|
@@ -1735,7 +1720,7 @@ var QRCodePage = () => {
|
|
|
1735
1720
|
// src/components/ConnectModal/AllWallets.tsx
|
|
1736
1721
|
import { useMemo as useMemo4 } from "react";
|
|
1737
1722
|
import { X as X5, ChevronLeft as ChevronLeft3 } from "lucide-react";
|
|
1738
|
-
import { Fragment as Fragment6, jsx as jsx38, jsxs as
|
|
1723
|
+
import { Fragment as Fragment6, jsx as jsx38, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1739
1724
|
var AllWalletsPage = () => {
|
|
1740
1725
|
const { onDismiss } = useWidgetContext();
|
|
1741
1726
|
const { navigateTo } = useNavigation();
|
|
@@ -1745,7 +1730,7 @@ var AllWalletsPage = () => {
|
|
|
1745
1730
|
const goBackToSelectWallet = () => {
|
|
1746
1731
|
navigateTo(PAGE_IDS.SELECT_WALLET);
|
|
1747
1732
|
};
|
|
1748
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
1749
1734
|
/* @__PURE__ */ jsx38(
|
|
1750
1735
|
ModalHeader,
|
|
1751
1736
|
{
|
|
@@ -1770,7 +1755,7 @@ var AllWalletsPage = () => {
|
|
|
1770
1755
|
|
|
1771
1756
|
// src/components/ConnectModal/DownloadWalletPage.tsx
|
|
1772
1757
|
import { X as X6, SquareArrowOutUpRight as SquareArrowOutUpRight2, ChevronLeft as ChevronLeft4 } from "lucide-react";
|
|
1773
|
-
import { Fragment as Fragment7, jsx as jsx39, jsxs as
|
|
1758
|
+
import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1774
1759
|
var DownloadWalletPage = () => {
|
|
1775
1760
|
const { selectedWallet, goBackToHome } = useConnectModal();
|
|
1776
1761
|
const { onDismiss } = useWidgetContext();
|
|
@@ -1783,7 +1768,7 @@ var DownloadWalletPage = () => {
|
|
|
1783
1768
|
window.open(downloadUrl, "_blank", "noopener,noreferrer");
|
|
1784
1769
|
}
|
|
1785
1770
|
};
|
|
1786
|
-
return /* @__PURE__ */
|
|
1771
|
+
return /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
1787
1772
|
/* @__PURE__ */ jsx39(
|
|
1788
1773
|
ModalHeader,
|
|
1789
1774
|
{
|
|
@@ -1792,21 +1777,21 @@ var DownloadWalletPage = () => {
|
|
|
1792
1777
|
title: `Install ${selectedWallet.name}`
|
|
1793
1778
|
}
|
|
1794
1779
|
),
|
|
1795
|
-
/* @__PURE__ */
|
|
1780
|
+
/* @__PURE__ */ jsxs22(Column, { align: "center", gap: 24, justify: "center", children: [
|
|
1796
1781
|
/* @__PURE__ */ jsx39(WalletLogoWrapper, { id: selectedWallet.id, size: 64, sizeSlot: "lg", title: selectedWallet.name }),
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1782
|
+
/* @__PURE__ */ jsxs22(Column, { align: "center", gap: 12, children: [
|
|
1783
|
+
/* @__PURE__ */ jsxs22(Text, { size: "lg", weight: "semibold", align: "center", children: [
|
|
1799
1784
|
"Install ",
|
|
1800
1785
|
selectedWallet.name
|
|
1801
1786
|
] }),
|
|
1802
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsxs22(Text, { size: "md", variant: "secondary", align: "center", style: { maxWidth: "20rem" }, children: [
|
|
1803
1788
|
selectedWallet.name,
|
|
1804
1789
|
" not installed. Please download then try again."
|
|
1805
1790
|
] })
|
|
1806
1791
|
] }),
|
|
1807
|
-
downloadUrl && /* @__PURE__ */ jsx39(Fragment7, { children: /* @__PURE__ */
|
|
1792
|
+
downloadUrl && /* @__PURE__ */ jsx39(Fragment7, { children: /* @__PURE__ */ jsxs22(Button, { variant: "tertiary", onClick: handleDownload, expand: true, children: [
|
|
1808
1793
|
/* @__PURE__ */ jsx39(SquareArrowOutUpRight2, { size: 16, color: "var(--color-foreground-muted)" }),
|
|
1809
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ jsxs22(Text, { size: "sm", weight: "semibold", variant: "secondary", children: [
|
|
1810
1795
|
"Download ",
|
|
1811
1796
|
selectedWallet.name
|
|
1812
1797
|
] })
|
|
@@ -1843,7 +1828,7 @@ var emailHighlightStyles = {
|
|
|
1843
1828
|
};
|
|
1844
1829
|
|
|
1845
1830
|
// src/components/ConnectModal/EmailVerifyOtp/useCountdown.ts
|
|
1846
|
-
import { useState as useState11, useEffect as
|
|
1831
|
+
import { useState as useState11, useEffect as useEffect8 } from "react";
|
|
1847
1832
|
var useCountdown = () => {
|
|
1848
1833
|
const [countdown, setCountdown] = useState11(0);
|
|
1849
1834
|
const [canResend, setCanResend] = useState11(true);
|
|
@@ -1851,7 +1836,7 @@ var useCountdown = () => {
|
|
|
1851
1836
|
setCanResend(false);
|
|
1852
1837
|
setCountdown(seconds);
|
|
1853
1838
|
};
|
|
1854
|
-
|
|
1839
|
+
useEffect8(() => {
|
|
1855
1840
|
if (countdown <= 0) return;
|
|
1856
1841
|
const timer = setTimeout(() => {
|
|
1857
1842
|
const newCountdown = countdown - 1;
|
|
@@ -1866,7 +1851,7 @@ var useCountdown = () => {
|
|
|
1866
1851
|
};
|
|
1867
1852
|
|
|
1868
1853
|
// src/components/ConnectModal/EmailVerifyOtp/useOtpInputs.ts
|
|
1869
|
-
import { useState as useState12, useRef as
|
|
1854
|
+
import { useState as useState12, useRef as useRef4, useEffect as useEffect9 } from "react";
|
|
1870
1855
|
var useOtpInputs = ({
|
|
1871
1856
|
emailAuthState,
|
|
1872
1857
|
error,
|
|
@@ -1876,7 +1861,7 @@ var useOtpInputs = ({
|
|
|
1876
1861
|
}) => {
|
|
1877
1862
|
const [otp, setOtp] = useState12(Array(OTP_LENGTH).fill(""));
|
|
1878
1863
|
const [focusedIndex, setFocusedIndex] = useState12(0);
|
|
1879
|
-
const inputRefs =
|
|
1864
|
+
const inputRefs = useRef4([]);
|
|
1880
1865
|
const isOtpComplete = otp.every((digit) => digit !== "");
|
|
1881
1866
|
const handleInputChange = (index, value) => {
|
|
1882
1867
|
if (error) clearError();
|
|
@@ -1905,25 +1890,25 @@ var useOtpInputs = ({
|
|
|
1905
1890
|
inputRefs.current[nextEmptyIndex]?.focus();
|
|
1906
1891
|
}
|
|
1907
1892
|
};
|
|
1908
|
-
|
|
1893
|
+
useEffect9(() => {
|
|
1909
1894
|
if (isOtpComplete && otp.join("").length === OTP_LENGTH) {
|
|
1910
1895
|
onComplete(otp.join(""));
|
|
1911
1896
|
}
|
|
1912
1897
|
}, [otp]);
|
|
1913
|
-
|
|
1898
|
+
useEffect9(() => {
|
|
1914
1899
|
inputRefs.current[0]?.focus();
|
|
1915
1900
|
const timer = setTimeout(() => {
|
|
1916
1901
|
inputRefs.current[0]?.focus();
|
|
1917
1902
|
}, 100);
|
|
1918
1903
|
return () => clearTimeout(timer);
|
|
1919
1904
|
}, []);
|
|
1920
|
-
|
|
1905
|
+
useEffect9(() => {
|
|
1921
1906
|
if (error) {
|
|
1922
1907
|
setOtp(Array(OTP_LENGTH).fill(""));
|
|
1923
1908
|
inputRefs.current[0]?.focus();
|
|
1924
1909
|
}
|
|
1925
1910
|
}, [error]);
|
|
1926
|
-
|
|
1911
|
+
useEffect9(() => {
|
|
1927
1912
|
if (isVerifying) {
|
|
1928
1913
|
setFocusedIndex(0);
|
|
1929
1914
|
}
|
|
@@ -1941,7 +1926,7 @@ var useOtpInputs = ({
|
|
|
1941
1926
|
};
|
|
1942
1927
|
|
|
1943
1928
|
// src/components/ConnectModal/EmailVerifyOtp/EmailVerifyOtp.tsx
|
|
1944
|
-
import { jsx as jsx40, jsxs as
|
|
1929
|
+
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1945
1930
|
var EmailVerifyOTP = () => {
|
|
1946
1931
|
const { onDismiss } = useWidgetContext();
|
|
1947
1932
|
const { goBackToHome } = useConnectModal();
|
|
@@ -1971,7 +1956,7 @@ var EmailVerifyOTP = () => {
|
|
|
1971
1956
|
setOtp(Array(OTP_LENGTH).fill(""));
|
|
1972
1957
|
inputRefs.current[0]?.focus();
|
|
1973
1958
|
};
|
|
1974
|
-
return /* @__PURE__ */
|
|
1959
|
+
return /* @__PURE__ */ jsxs23("div", { children: [
|
|
1975
1960
|
/* @__PURE__ */ jsx40(
|
|
1976
1961
|
ModalHeader,
|
|
1977
1962
|
{
|
|
@@ -1980,15 +1965,15 @@ var EmailVerifyOTP = () => {
|
|
|
1980
1965
|
title: "Verify Email"
|
|
1981
1966
|
}
|
|
1982
1967
|
),
|
|
1983
|
-
/* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ jsxs23(Column, { gap: 24, children: [
|
|
1969
|
+
/* @__PURE__ */ jsxs23(Text, { align: "center", variant: "secondary", children: [
|
|
1985
1970
|
"Enter the 6-digit code sent to",
|
|
1986
1971
|
/* @__PURE__ */ jsx40("br", {}),
|
|
1987
1972
|
" ",
|
|
1988
1973
|
/* @__PURE__ */ jsx40("span", { style: emailHighlightStyles, children: emailAuthState.email })
|
|
1989
1974
|
] }),
|
|
1990
|
-
/* @__PURE__ */
|
|
1991
|
-
/* @__PURE__ */
|
|
1975
|
+
/* @__PURE__ */ jsxs23(Column, { align: "center", gap: 12, children: [
|
|
1976
|
+
/* @__PURE__ */ jsxs23("div", { style: { position: "relative", height: "3rem" }, children: [
|
|
1992
1977
|
/* @__PURE__ */ jsx40(
|
|
1993
1978
|
Row,
|
|
1994
1979
|
{
|
|
@@ -2034,7 +2019,7 @@ var EmailVerifyOTP = () => {
|
|
|
2034
2019
|
}
|
|
2035
2020
|
)
|
|
2036
2021
|
] }),
|
|
2037
|
-
!isSuccess && /* @__PURE__ */ jsx40(Column, { align: "center", justify: "center", children: /* @__PURE__ */ jsx40(Row, { align: "center", justify: "center", style: { minHeight: "2rem" }, children: canResend ? /* @__PURE__ */
|
|
2022
|
+
!isSuccess && /* @__PURE__ */ jsx40(Column, { align: "center", justify: "center", children: /* @__PURE__ */ jsx40(Row, { align: "center", justify: "center", style: { minHeight: "2rem" }, children: canResend ? /* @__PURE__ */ jsxs23(Row, { align: "baseline", gap: 2, children: [
|
|
2038
2023
|
/* @__PURE__ */ jsx40(Text, { size: "sm", variant: "secondary", children: "Didn't receive the code?" }),
|
|
2039
2024
|
/* @__PURE__ */ jsx40(
|
|
2040
2025
|
Button,
|
|
@@ -2047,7 +2032,7 @@ var EmailVerifyOTP = () => {
|
|
|
2047
2032
|
children: "Resend"
|
|
2048
2033
|
}
|
|
2049
2034
|
)
|
|
2050
|
-
] }) : /* @__PURE__ */
|
|
2035
|
+
] }) : /* @__PURE__ */ jsxs23(Row, { align: "center", gap: 4, children: [
|
|
2051
2036
|
/* @__PURE__ */ jsx40(Text, { size: "sm", variant: "secondary", children: "Email re-sent" }),
|
|
2052
2037
|
/* @__PURE__ */ jsx40(Check, { size: 14, color: "var(--color-foreground-muted)" })
|
|
2053
2038
|
] }) }) })
|
|
@@ -2057,11 +2042,11 @@ var EmailVerifyOTP = () => {
|
|
|
2057
2042
|
|
|
2058
2043
|
// src/components/ConnectModal/ConfigErrorPage.tsx
|
|
2059
2044
|
import { X as X8, AlertTriangle, ChevronLeft as ChevronLeft6 } from "lucide-react";
|
|
2060
|
-
import { Fragment as Fragment8, jsx as jsx41, jsxs as
|
|
2045
|
+
import { Fragment as Fragment8, jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2061
2046
|
var ConfigErrorPage = () => {
|
|
2062
2047
|
const { onDismiss } = useWidgetContext();
|
|
2063
2048
|
const { goBackToHome } = useConnectModal();
|
|
2064
|
-
return /* @__PURE__ */
|
|
2049
|
+
return /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
2065
2050
|
/* @__PURE__ */ jsx41(
|
|
2066
2051
|
ModalHeader,
|
|
2067
2052
|
{
|
|
@@ -2070,7 +2055,7 @@ var ConfigErrorPage = () => {
|
|
|
2070
2055
|
title: "Error"
|
|
2071
2056
|
}
|
|
2072
2057
|
),
|
|
2073
|
-
/* @__PURE__ */
|
|
2058
|
+
/* @__PURE__ */ jsxs24(Column, { align: "center", gap: 24, justify: "center", children: [
|
|
2074
2059
|
/* @__PURE__ */ jsx41(
|
|
2075
2060
|
"div",
|
|
2076
2061
|
{
|
|
@@ -2086,7 +2071,7 @@ var ConfigErrorPage = () => {
|
|
|
2086
2071
|
children: /* @__PURE__ */ jsx41(AlertTriangle, { size: 32, color: "white" })
|
|
2087
2072
|
}
|
|
2088
2073
|
),
|
|
2089
|
-
/* @__PURE__ */
|
|
2074
|
+
/* @__PURE__ */ jsxs24(Column, { align: "center", gap: 12, children: [
|
|
2090
2075
|
/* @__PURE__ */ jsx41(Text, { size: "lg", weight: "semibold", align: "center", children: "Configuration Error" }),
|
|
2091
2076
|
/* @__PURE__ */ jsx41(Text, { size: "md", variant: "secondary", align: "center", style: { maxWidth: "20rem" }, children: "Missing required project ID" })
|
|
2092
2077
|
] }),
|
|
@@ -2118,6 +2103,16 @@ var PAGE_COMPONENTS = {
|
|
|
2118
2103
|
[PAGE_IDS.CONFIG_ERROR]: /* @__PURE__ */ jsx42(ConfigErrorPage, {})
|
|
2119
2104
|
};
|
|
2120
2105
|
|
|
2106
|
+
// src/utils/platform/isMobile.ts
|
|
2107
|
+
import MobileDetect from "mobile-detect";
|
|
2108
|
+
function isMobile() {
|
|
2109
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
2110
|
+
return false;
|
|
2111
|
+
}
|
|
2112
|
+
const md = new MobileDetect(window.navigator.userAgent);
|
|
2113
|
+
return md.mobile() !== null || md.tablet() !== null;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2121
2116
|
// src/utils/walletConnectDeepLink.ts
|
|
2122
2117
|
var clearExistingDeepLinkListeners = () => {
|
|
2123
2118
|
const existingListeners = window.__aurumDeepLinkListeners ?? [];
|
|
@@ -2161,7 +2156,7 @@ var registerGlobalCleanup = (cleanupFn) => {
|
|
|
2161
2156
|
};
|
|
2162
2157
|
|
|
2163
2158
|
// src/hooks/useConnectSelectedWallet.tsx
|
|
2164
|
-
import { WalletId as
|
|
2159
|
+
import { WalletId as WalletId6 } from "@aurum-sdk/types";
|
|
2165
2160
|
var useConnectSelectedWallet = () => {
|
|
2166
2161
|
const { navigateTo } = useNavigation();
|
|
2167
2162
|
const connectInstalledWallet = async ({ adapter, onConnect, setSuccess }) => {
|
|
@@ -2181,7 +2176,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2181
2176
|
}
|
|
2182
2177
|
};
|
|
2183
2178
|
const connectUninstalledWalletQRCode = async ({ displayedWallets, onConnect, setSuccess }) => {
|
|
2184
|
-
const walletConnectAdapter = displayedWallets?.find(({ id }) => id ===
|
|
2179
|
+
const walletConnectAdapter = displayedWallets?.find(({ id }) => id === WalletId6.WalletConnect);
|
|
2185
2180
|
if (!walletConnectAdapter) {
|
|
2186
2181
|
sentryLogger.error("connectUninstalledWalletQRCode: WalletConnect adapter not found");
|
|
2187
2182
|
throw new Error("WalletConnect adapter not found");
|
|
@@ -2207,7 +2202,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2207
2202
|
onConnect,
|
|
2208
2203
|
setSuccess
|
|
2209
2204
|
}) => {
|
|
2210
|
-
const walletConnectAdapter = displayedWallets?.find(({ id }) => id ===
|
|
2205
|
+
const walletConnectAdapter = displayedWallets?.find(({ id }) => id === WalletId6.WalletConnect);
|
|
2211
2206
|
if (!walletConnectAdapter) {
|
|
2212
2207
|
sentryLogger.error("connectWithMobileDeepLink: WalletConnect adapter not found");
|
|
2213
2208
|
throw new Error("WalletConnect adapter not found");
|
|
@@ -2239,13 +2234,20 @@ var useConnectSelectedWallet = () => {
|
|
|
2239
2234
|
throw error;
|
|
2240
2235
|
}
|
|
2241
2236
|
};
|
|
2242
|
-
const
|
|
2237
|
+
const connectWalletConnectModal = async ({ adapter, onConnect, setSuccess }) => {
|
|
2243
2238
|
try {
|
|
2244
|
-
|
|
2239
|
+
if (!adapter.openModal) {
|
|
2240
|
+
throw new Error("Adapter does not support openModal");
|
|
2241
|
+
}
|
|
2242
|
+
const { address, provider } = await adapter.openModal();
|
|
2245
2243
|
setSuccess?.(true);
|
|
2246
|
-
|
|
2244
|
+
if (isMobile()) {
|
|
2247
2245
|
onConnect({ walletId: adapter.id, address, provider });
|
|
2248
|
-
}
|
|
2246
|
+
} else {
|
|
2247
|
+
setTimeout(() => {
|
|
2248
|
+
onConnect({ walletId: adapter.id, address, provider });
|
|
2249
|
+
}, 1e3);
|
|
2250
|
+
}
|
|
2249
2251
|
} catch (error) {
|
|
2250
2252
|
if (isConfigError(error)) {
|
|
2251
2253
|
navigateTo(PAGE_IDS.CONFIG_ERROR);
|
|
@@ -2259,7 +2261,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2259
2261
|
return {
|
|
2260
2262
|
// Both mobile and desktop
|
|
2261
2263
|
connectInstalledWallet,
|
|
2262
|
-
|
|
2264
|
+
connectWalletConnectModal,
|
|
2263
2265
|
redirectToDownloadPage,
|
|
2264
2266
|
// Desktop only
|
|
2265
2267
|
connectUninstalledWalletQRCode,
|
|
@@ -2269,7 +2271,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2269
2271
|
};
|
|
2270
2272
|
|
|
2271
2273
|
// src/contexts/ConnectModalContext.tsx
|
|
2272
|
-
import { WalletId as
|
|
2274
|
+
import { WalletId as WalletId7 } from "@aurum-sdk/types";
|
|
2273
2275
|
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2274
2276
|
var ConnectModalContext = createContext4(null);
|
|
2275
2277
|
var useConnectModal = () => {
|
|
@@ -2286,9 +2288,10 @@ var ConnectModalProvider = ({ children, displayedWallets, onConnect }) => {
|
|
|
2286
2288
|
connectInstalledWallet,
|
|
2287
2289
|
connectWithMobileDeepLink,
|
|
2288
2290
|
connectUninstalledWalletQRCode,
|
|
2289
|
-
|
|
2291
|
+
connectWalletConnectModal
|
|
2290
2292
|
} = useConnectSelectedWallet();
|
|
2291
2293
|
const [error, setError] = useState13(false);
|
|
2294
|
+
const [errorCode, setErrorCode] = useState13(null);
|
|
2292
2295
|
const [configError, setConfigError] = useState13(false);
|
|
2293
2296
|
const [success, setSuccess] = useState13(false);
|
|
2294
2297
|
const [qrSuccess, setQrSuccess] = useState13(false);
|
|
@@ -2296,6 +2299,7 @@ var ConnectModalProvider = ({ children, displayedWallets, onConnect }) => {
|
|
|
2296
2299
|
const connectWallet = async (wallet) => {
|
|
2297
2300
|
try {
|
|
2298
2301
|
setError(false);
|
|
2302
|
+
setErrorCode(null);
|
|
2299
2303
|
setConfigError(false);
|
|
2300
2304
|
setSuccess(false);
|
|
2301
2305
|
setQrSuccess(false);
|
|
@@ -2304,12 +2308,10 @@ var ConnectModalProvider = ({ children, displayedWallets, onConnect }) => {
|
|
|
2304
2308
|
const isDesktop = !isOnMobile;
|
|
2305
2309
|
const hasDeepLink = Boolean(wallet.wcDeepLinkUrl);
|
|
2306
2310
|
if (isDesktop) {
|
|
2307
|
-
if (wallet.id === WalletId9.AppKit)
|
|
2308
|
-
return await connectAppKit({ adapter: wallet, onConnect, setSuccess: setQrSuccess });
|
|
2309
2311
|
if (!wallet.isInstalled() && !hasDeepLink) {
|
|
2310
2312
|
return await redirectToDownloadPage();
|
|
2311
2313
|
}
|
|
2312
|
-
if (wallet.id ===
|
|
2314
|
+
if (wallet.id === WalletId7.WalletConnect || !wallet.isInstalled())
|
|
2313
2315
|
return await connectUninstalledWalletQRCode({
|
|
2314
2316
|
adapter: wallet,
|
|
2315
2317
|
displayedWallets,
|
|
@@ -2319,13 +2321,13 @@ var ConnectModalProvider = ({ children, displayedWallets, onConnect }) => {
|
|
|
2319
2321
|
return await connectInstalledWallet({ adapter: wallet, onConnect, setSuccess });
|
|
2320
2322
|
}
|
|
2321
2323
|
if (isOnMobile) {
|
|
2322
|
-
if (wallet.id ===
|
|
2323
|
-
const
|
|
2324
|
-
if (!
|
|
2325
|
-
sentryLogger.error("
|
|
2326
|
-
throw new Error("
|
|
2324
|
+
if (wallet.id === WalletId7.WalletConnect) {
|
|
2325
|
+
const wcAdapter = displayedWallets?.find(({ id }) => id === WalletId7.WalletConnect);
|
|
2326
|
+
if (!wcAdapter) {
|
|
2327
|
+
sentryLogger.error("WalletConnect adapter not found");
|
|
2328
|
+
throw new Error("WalletConnect adapter not found");
|
|
2327
2329
|
}
|
|
2328
|
-
return await
|
|
2330
|
+
return await connectWalletConnectModal({ adapter: wcAdapter, onConnect, setSuccess: setQrSuccess });
|
|
2329
2331
|
}
|
|
2330
2332
|
if (wallet.isInstalled()) return await connectInstalledWallet({ adapter: wallet, onConnect, setSuccess });
|
|
2331
2333
|
if (hasDeepLink) {
|
|
@@ -2335,6 +2337,7 @@ var ConnectModalProvider = ({ children, displayedWallets, onConnect }) => {
|
|
|
2335
2337
|
}
|
|
2336
2338
|
} catch (err) {
|
|
2337
2339
|
setError(true);
|
|
2340
|
+
setErrorCode(err?.code ?? null);
|
|
2338
2341
|
if (isConfigError(err)) {
|
|
2339
2342
|
setConfigError(true);
|
|
2340
2343
|
}
|
|
@@ -2343,16 +2346,29 @@ var ConnectModalProvider = ({ children, displayedWallets, onConnect }) => {
|
|
|
2343
2346
|
const retryConnection = () => {
|
|
2344
2347
|
if (selectedWallet) connectWallet(selectedWallet);
|
|
2345
2348
|
};
|
|
2349
|
+
const openWalletConnectModal = async () => {
|
|
2350
|
+
const wcAdapter = displayedWallets?.find(({ id }) => id === WalletId7.WalletConnect);
|
|
2351
|
+
if (!wcAdapter) {
|
|
2352
|
+
sentryLogger.error("WalletConnect adapter not found");
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
try {
|
|
2356
|
+
await connectWalletConnectModal({ adapter: wcAdapter, onConnect, setSuccess: setQrSuccess });
|
|
2357
|
+
} catch {
|
|
2358
|
+
}
|
|
2359
|
+
};
|
|
2346
2360
|
const goBackToHome = () => {
|
|
2347
2361
|
navigateTo(PAGE_IDS.SELECT_WALLET);
|
|
2348
2362
|
setSelectedWallet(null);
|
|
2349
2363
|
setError(false);
|
|
2364
|
+
setErrorCode(null);
|
|
2350
2365
|
setConfigError(false);
|
|
2351
2366
|
setSuccess(false);
|
|
2352
2367
|
setQrSuccess(false);
|
|
2353
2368
|
};
|
|
2354
2369
|
const contextValue = {
|
|
2355
2370
|
error,
|
|
2371
|
+
errorCode,
|
|
2356
2372
|
configError,
|
|
2357
2373
|
success,
|
|
2358
2374
|
qrSuccess,
|
|
@@ -2360,6 +2376,7 @@ var ConnectModalProvider = ({ children, displayedWallets, onConnect }) => {
|
|
|
2360
2376
|
displayedWallets,
|
|
2361
2377
|
goBackToHome,
|
|
2362
2378
|
connectWallet,
|
|
2379
|
+
openWalletConnectModal,
|
|
2363
2380
|
retryConnection,
|
|
2364
2381
|
setSelectedWallet,
|
|
2365
2382
|
setSuccess,
|
|
@@ -2431,9 +2448,8 @@ export {
|
|
|
2431
2448
|
initSentry,
|
|
2432
2449
|
sentryLogger,
|
|
2433
2450
|
createConfigError,
|
|
2434
|
-
isMobile,
|
|
2435
2451
|
ConnectUIProviders,
|
|
2436
2452
|
ConnectPages,
|
|
2437
2453
|
generateCompleteStyles
|
|
2438
2454
|
};
|
|
2439
|
-
//# sourceMappingURL=chunk-
|
|
2455
|
+
//# sourceMappingURL=chunk-DPFIEHZ6.mjs.map
|