@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
|
_types.WalletId.WalletConnect,
|
|
92
92
|
_types.WalletId.Brave,
|
|
93
93
|
_types.WalletId.Rabby,
|
|
94
|
-
_types.WalletId.CoinbaseWallet
|
|
95
|
-
_types.WalletId.Ledger
|
|
94
|
+
_types.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
|
-
var _mobiledetect = require('mobile-detect'); var _mobiledetect2 = _interopRequireDefault(_mobiledetect);
|
|
124
|
-
function isMobile() {
|
|
125
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
const md = new (0, _mobiledetect2.default)(window.navigator.userAgent);
|
|
129
|
-
return md.mobile() !== null || md.tablet() !== null;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
121
|
// src/contexts/NavigationContext.tsx
|
|
133
122
|
|
|
134
123
|
|
|
@@ -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
|
|
|
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] = _react.useState.call(void 0, false);
|
|
1318
1311
|
_react.useEffect.call(void 0, () => {
|
|
@@ -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__ */ _jsxruntime.jsx.call(void 0, "div", { className: "success-icon-large", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleCheck, { color: "var(--aurum-primary-color)", size: 46 }) });
|
|
1343
1339
|
}
|
|
1344
1340
|
if (error) {
|
|
1341
|
+
if (errorCode === ERROR_CODE.REQUEST_PENDING) {
|
|
1342
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, 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__ */ _jsxruntime.jsxs.call(void 0, Text, { align: "center", size: "sm", variant: "secondary", children: [
|
|
1346
1349
|
"Please try again or select a ",
|
|
1347
1350
|
"\n",
|
|
@@ -1386,15 +1389,17 @@ var ConnectionStatusBase = ({
|
|
|
1386
1389
|
|
|
1387
1390
|
// src/components/ConnectModal/ConnectionStatus/Desktop.tsx
|
|
1388
1391
|
|
|
1389
|
-
|
|
1390
1392
|
var ConnectionStatusPage = () => {
|
|
1391
1393
|
const { selectedWallet } = useConnectModal();
|
|
1392
1394
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1393
1395
|
ConnectionStatusBase,
|
|
1394
1396
|
{
|
|
1395
1397
|
pendingHeaderText: `Approve in ${_optionalChain([selectedWallet, 'optionalAccess', _18 => _18.name])}`,
|
|
1396
|
-
pendingSubContent: /* @__PURE__ */ _jsxruntime.
|
|
1397
|
-
|
|
1398
|
+
pendingSubContent: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, 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
|
};
|
|
@@ -1412,11 +1417,11 @@ var ConnectionStatusMobilePage = () => {
|
|
|
1412
1417
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1413
1418
|
ConnectionStatusBase,
|
|
1414
1419
|
{
|
|
1415
|
-
title: _optionalChain([selectedWallet, 'optionalAccess',
|
|
1416
|
-
pendingHeaderText: `Opening ${_optionalChain([selectedWallet, 'optionalAccess',
|
|
1420
|
+
title: _optionalChain([selectedWallet, 'optionalAccess', _19 => _19.name]),
|
|
1421
|
+
pendingHeaderText: `Opening ${_optionalChain([selectedWallet, 'optionalAccess', _20 => _20.name])}`,
|
|
1417
1422
|
pendingSubContent: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Text, { size: "sm", variant: "secondary", align: "center", style: { maxWidth: "18.75rem" }, children: [
|
|
1418
1423
|
"If ",
|
|
1419
|
-
_optionalChain([selectedWallet, 'optionalAccess',
|
|
1424
|
+
_optionalChain([selectedWallet, 'optionalAccess', _21 => _21.name]),
|
|
1420
1425
|
" doesn't open automatically, click the button below"
|
|
1421
1426
|
] }),
|
|
1422
1427
|
extraContent: showLaunchButton && !success && !error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "tertiary", size: "md", onClick: retryConnection, style: { width: "100%", marginTop: "0.5rem" }, children: "Launch App" }) : void 0
|
|
@@ -1428,14 +1433,13 @@ var ConnectionStatusMobilePage = () => {
|
|
|
1428
1433
|
|
|
1429
1434
|
|
|
1430
1435
|
// src/components/QRCodeDisplay/QRCodeDisplay.tsx
|
|
1431
|
-
|
|
1432
1436
|
var _reactqrcodelogo = require('react-qrcode-logo');
|
|
1433
1437
|
|
|
1434
1438
|
// src/utils/generateQrCodeWalletLogo.tsx
|
|
1435
1439
|
var _logos = require('@aurum-sdk/logos');
|
|
1436
1440
|
|
|
1437
1441
|
var generateQrCodeWalletLogo = (walletAdapter) => {
|
|
1438
|
-
if (walletAdapter
|
|
1442
|
+
if (_optionalChain([walletAdapter, 'optionalAccess', _22 => _22.icon])) {
|
|
1439
1443
|
return walletAdapter.icon;
|
|
1440
1444
|
}
|
|
1441
1445
|
return _nullishCoalesce(_logos.getLogoDataUri.call(void 0, _types.WalletId.WalletConnect), () => ( ""));
|
|
@@ -1601,22 +1605,10 @@ var QRCodeSkeleton = ({ size = 128 }) => {
|
|
|
1601
1605
|
|
|
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
|
-
_react.useEffect.call(void 0, () => {
|
|
1609
|
-
if (selectedWallet && selectedWallet.id !== _types.WalletId.AppKit) {
|
|
1610
|
-
logoWalletRef.current = selectedWallet;
|
|
1611
|
-
}
|
|
1612
|
-
}, [selectedWallet]);
|
|
1613
|
-
const logoWallet = logoWalletRef.current || selectedWallet;
|
|
1614
|
-
const appKitAdapter = displayedWallets.find(({ id }) => id === _types.WalletId.AppKit);
|
|
1615
|
-
const handleAppKitConnect = async () => {
|
|
1616
|
-
if (appKitAdapter) {
|
|
1617
|
-
connectWallet(appKitAdapter);
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1611
|
+
const wcAdapter = displayedWallets.find(({ id }) => id === _types.WalletId.WalletConnect);
|
|
1620
1612
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Column, { align: "center", gap: 16, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Column, { align: "center", gap: 4, children: [
|
|
1621
1613
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1622
1614
|
"div",
|
|
@@ -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__ */ _jsxruntime.jsxs.call(void 0, Row, { justify:
|
|
1640
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Row, { justify: _optionalChain([wcAdapter, 'optionalAccess', _23 => _23.openModal]) ? "space-between" : "center", style: { width: "100%" }, children: [
|
|
1649
1641
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CopyButton, { text: uri || "", disabled: !uri, variant: "secondary", label: "Copy URI" }),
|
|
1650
|
-
|
|
1642
|
+
_optionalChain([wcAdapter, 'optionalAccess', _24 => _24.openModal]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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
|
}
|
|
@@ -1670,17 +1662,10 @@ var QRCodePage = () => {
|
|
|
1670
1662
|
const { navigateTo } = useNavigation();
|
|
1671
1663
|
const { selectedWallet, error, configError, retryConnection, qrSuccess } = useConnectModal();
|
|
1672
1664
|
const [connectionUri, setConnectionUri] = _react.useState.call(void 0, null);
|
|
1673
|
-
const originalWalletRef = _react.useRef.call(void 0, null);
|
|
1674
|
-
_react.useEffect.call(void 0, () => {
|
|
1675
|
-
if (selectedWallet && selectedWallet.id !== _types.WalletId.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 = _optionalChain([
|
|
1668
|
+
const title = _optionalChain([selectedWallet, 'optionalAccess', _25 => _25.name]) === _types.WalletName.WalletConnect ? "Scan QR code" : `Scan with ${_optionalChain([selectedWallet, 'optionalAccess', _26 => _26.name])} app`;
|
|
1684
1669
|
_react.useEffect.call(void 0, () => {
|
|
1685
1670
|
const handleWalletConnectURI = (event) => {
|
|
1686
1671
|
setConnectionUri(event.detail.uri);
|
|
@@ -1710,19 +1695,19 @@ var QRCodePage = () => {
|
|
|
1710
1695
|
),
|
|
1711
1696
|
qrSuccess ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Column, { align: "center", style: { height: "8rem" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleCheck, { color: "var(--aurum-primary-color)", size: 46 }) }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1712
1697
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Column, { align: "center", gap: 24, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCodeDisplay, { uri: error ? null : connectionUri }) }),
|
|
1713
|
-
_optionalChain([
|
|
1698
|
+
_optionalChain([selectedWallet, 'optionalAccess', _27 => _27.downloadUrl]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1714
1699
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spacer, { size: 15 }),
|
|
1715
1700
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1716
1701
|
Button,
|
|
1717
1702
|
{
|
|
1718
1703
|
variant: "tertiary",
|
|
1719
1704
|
expand: true,
|
|
1720
|
-
onClick: () => window.open(_nullishCoalesce(
|
|
1705
|
+
onClick: () => window.open(_nullishCoalesce(selectedWallet.downloadUrl, () => ( "")), "_blank", "noopener,noreferrer"),
|
|
1721
1706
|
children: [
|
|
1722
1707
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SquareArrowOutUpRight, { size: 16, color: "var(--color-foreground-muted)" }),
|
|
1723
1708
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Text, { size: "sm", weight: "semibold", variant: "secondary", children: [
|
|
1724
1709
|
"Download ",
|
|
1725
|
-
|
|
1710
|
+
selectedWallet.name
|
|
1726
1711
|
] })
|
|
1727
1712
|
]
|
|
1728
1713
|
}
|
|
@@ -1885,12 +1870,12 @@ var useOtpInputs = ({
|
|
|
1885
1870
|
newOtp[index] = value.slice(-1);
|
|
1886
1871
|
setOtp(newOtp);
|
|
1887
1872
|
if (value && index < OTP_LENGTH - 1) {
|
|
1888
|
-
_optionalChain([inputRefs, 'access',
|
|
1873
|
+
_optionalChain([inputRefs, 'access', _28 => _28.current, 'access', _29 => _29[index + 1], 'optionalAccess', _30 => _30.focus, 'call', _31 => _31()]);
|
|
1889
1874
|
}
|
|
1890
1875
|
};
|
|
1891
1876
|
const handleKeyDown = (index, e) => {
|
|
1892
1877
|
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1893
|
-
_optionalChain([inputRefs, 'access',
|
|
1878
|
+
_optionalChain([inputRefs, 'access', _32 => _32.current, 'access', _33 => _33[index - 1], 'optionalAccess', _34 => _34.focus, 'call', _35 => _35()]);
|
|
1894
1879
|
}
|
|
1895
1880
|
};
|
|
1896
1881
|
const handlePaste = (e) => {
|
|
@@ -1902,7 +1887,7 @@ var useOtpInputs = ({
|
|
|
1902
1887
|
setOtp(newOtp);
|
|
1903
1888
|
const nextEmptyIndex = newOtp.findIndex((digit) => !digit);
|
|
1904
1889
|
if (nextEmptyIndex !== -1) {
|
|
1905
|
-
_optionalChain([inputRefs, 'access',
|
|
1890
|
+
_optionalChain([inputRefs, 'access', _36 => _36.current, 'access', _37 => _37[nextEmptyIndex], 'optionalAccess', _38 => _38.focus, 'call', _39 => _39()]);
|
|
1906
1891
|
}
|
|
1907
1892
|
};
|
|
1908
1893
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1911,16 +1896,16 @@ var useOtpInputs = ({
|
|
|
1911
1896
|
}
|
|
1912
1897
|
}, [otp]);
|
|
1913
1898
|
_react.useEffect.call(void 0, () => {
|
|
1914
|
-
_optionalChain([inputRefs, 'access',
|
|
1899
|
+
_optionalChain([inputRefs, 'access', _40 => _40.current, 'access', _41 => _41[0], 'optionalAccess', _42 => _42.focus, 'call', _43 => _43()]);
|
|
1915
1900
|
const timer = setTimeout(() => {
|
|
1916
|
-
_optionalChain([inputRefs, 'access',
|
|
1901
|
+
_optionalChain([inputRefs, 'access', _44 => _44.current, 'access', _45 => _45[0], 'optionalAccess', _46 => _46.focus, 'call', _47 => _47()]);
|
|
1917
1902
|
}, 100);
|
|
1918
1903
|
return () => clearTimeout(timer);
|
|
1919
1904
|
}, []);
|
|
1920
1905
|
_react.useEffect.call(void 0, () => {
|
|
1921
1906
|
if (error) {
|
|
1922
1907
|
setOtp(Array(OTP_LENGTH).fill(""));
|
|
1923
|
-
_optionalChain([inputRefs, 'access',
|
|
1908
|
+
_optionalChain([inputRefs, 'access', _48 => _48.current, 'access', _49 => _49[0], 'optionalAccess', _50 => _50.focus, 'call', _51 => _51()]);
|
|
1924
1909
|
}
|
|
1925
1910
|
}, [error]);
|
|
1926
1911
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1969,7 +1954,7 @@ var EmailVerifyOTP = () => {
|
|
|
1969
1954
|
startCountdown(RESEND_COUNTDOWN_SECONDS);
|
|
1970
1955
|
await sendEmailOTP(emailAuthState.email);
|
|
1971
1956
|
setOtp(Array(OTP_LENGTH).fill(""));
|
|
1972
|
-
_optionalChain([inputRefs, 'access',
|
|
1957
|
+
_optionalChain([inputRefs, 'access', _52 => _52.current, 'access', _53 => _53[0], 'optionalAccess', _54 => _54.focus, 'call', _55 => _55()]);
|
|
1973
1958
|
};
|
|
1974
1959
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1975
1960
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2118,6 +2103,16 @@ var PAGE_COMPONENTS = {
|
|
|
2118
2103
|
[PAGE_IDS.CONFIG_ERROR]: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ConfigErrorPage, {})
|
|
2119
2104
|
};
|
|
2120
2105
|
|
|
2106
|
+
// src/utils/platform/isMobile.ts
|
|
2107
|
+
var _mobiledetect = require('mobile-detect'); var _mobiledetect2 = _interopRequireDefault(_mobiledetect);
|
|
2108
|
+
function isMobile() {
|
|
2109
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
2110
|
+
return false;
|
|
2111
|
+
}
|
|
2112
|
+
const md = new (0, _mobiledetect2.default)(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 = _nullishCoalesce(window.__aurumDeepLinkListeners, () => ( []));
|
|
@@ -2156,7 +2151,7 @@ var registerGlobalCleanup = (cleanupFn) => {
|
|
|
2156
2151
|
if (index > -1) cleanupList.splice(index, 1);
|
|
2157
2152
|
cleanupFn();
|
|
2158
2153
|
};
|
|
2159
|
-
_optionalChain([window, 'access',
|
|
2154
|
+
_optionalChain([window, 'access', _56 => _56.__aurumDeepLinkListeners, 'optionalAccess', _57 => _57.push, 'call', _58 => _58(cleanup)]);
|
|
2160
2155
|
return cleanup;
|
|
2161
2156
|
};
|
|
2162
2157
|
|
|
@@ -2168,7 +2163,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2168
2163
|
navigateTo(PAGE_IDS.CONNECTING);
|
|
2169
2164
|
try {
|
|
2170
2165
|
const { address, provider } = await adapter.connect();
|
|
2171
|
-
_optionalChain([setSuccess, 'optionalCall',
|
|
2166
|
+
_optionalChain([setSuccess, 'optionalCall', _59 => _59(true)]);
|
|
2172
2167
|
setTimeout(() => {
|
|
2173
2168
|
onConnect({ walletId: adapter.id, address, provider });
|
|
2174
2169
|
}, 1e3);
|
|
@@ -2181,7 +2176,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2181
2176
|
}
|
|
2182
2177
|
};
|
|
2183
2178
|
const connectUninstalledWalletQRCode = async ({ displayedWallets, onConnect, setSuccess }) => {
|
|
2184
|
-
const walletConnectAdapter = _optionalChain([displayedWallets, 'optionalAccess',
|
|
2179
|
+
const walletConnectAdapter = _optionalChain([displayedWallets, 'optionalAccess', _60 => _60.find, 'call', _61 => _61(({ id }) => id === _types.WalletId.WalletConnect)]);
|
|
2185
2180
|
if (!walletConnectAdapter) {
|
|
2186
2181
|
sentryLogger.error("connectUninstalledWalletQRCode: WalletConnect adapter not found");
|
|
2187
2182
|
throw new Error("WalletConnect adapter not found");
|
|
@@ -2189,7 +2184,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2189
2184
|
navigateTo(PAGE_IDS.QR_CODE);
|
|
2190
2185
|
try {
|
|
2191
2186
|
const { address, provider } = await walletConnectAdapter.connect();
|
|
2192
|
-
_optionalChain([setSuccess, 'optionalCall',
|
|
2187
|
+
_optionalChain([setSuccess, 'optionalCall', _62 => _62(true)]);
|
|
2193
2188
|
setTimeout(() => {
|
|
2194
2189
|
onConnect({ walletId: walletConnectAdapter.id, address, provider });
|
|
2195
2190
|
}, 1e3);
|
|
@@ -2207,7 +2202,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2207
2202
|
onConnect,
|
|
2208
2203
|
setSuccess
|
|
2209
2204
|
}) => {
|
|
2210
|
-
const walletConnectAdapter = _optionalChain([displayedWallets, 'optionalAccess',
|
|
2205
|
+
const walletConnectAdapter = _optionalChain([displayedWallets, 'optionalAccess', _63 => _63.find, 'call', _64 => _64(({ id }) => id === _types.WalletId.WalletConnect)]);
|
|
2211
2206
|
if (!walletConnectAdapter) {
|
|
2212
2207
|
sentryLogger.error("connectWithMobileDeepLink: WalletConnect adapter not found");
|
|
2213
2208
|
throw new Error("WalletConnect adapter not found");
|
|
@@ -2226,7 +2221,7 @@ var useConnectSelectedWallet = () => {
|
|
|
2226
2221
|
if (isRejected) {
|
|
2227
2222
|
return;
|
|
2228
2223
|
}
|
|
2229
|
-
_optionalChain([setSuccess, 'optionalCall',
|
|
2224
|
+
_optionalChain([setSuccess, 'optionalCall', _65 => _65(true)]);
|
|
2230
2225
|
setTimeout(() => {
|
|
2231
2226
|
onConnect({ walletId: walletConnectAdapter.id, address, provider });
|
|
2232
2227
|
}, 1e3);
|
|
@@ -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
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2239
|
+
if (!adapter.openModal) {
|
|
2240
|
+
throw new Error("Adapter does not support openModal");
|
|
2241
|
+
}
|
|
2242
|
+
const { address, provider } = await adapter.openModal();
|
|
2243
|
+
_optionalChain([setSuccess, 'optionalCall', _66 => _66(true)]);
|
|
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,
|
|
@@ -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] = _react.useState.call(void 0, false);
|
|
2294
|
+
const [errorCode, setErrorCode] = _react.useState.call(void 0, null);
|
|
2292
2295
|
const [configError, setConfigError] = _react.useState.call(void 0, false);
|
|
2293
2296
|
const [success, setSuccess] = _react.useState.call(void 0, false);
|
|
2294
2297
|
const [qrSuccess, setQrSuccess] = _react.useState.call(void 0, 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,8 +2308,6 @@ 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 === _types.WalletId.AppKit)
|
|
2308
|
-
return await connectAppKit({ adapter: wallet, onConnect, setSuccess: setQrSuccess });
|
|
2309
2311
|
if (!wallet.isInstalled() && !hasDeepLink) {
|
|
2310
2312
|
return await redirectToDownloadPage();
|
|
2311
2313
|
}
|
|
@@ -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 === _types.WalletId.WalletConnect
|
|
2323
|
-
const
|
|
2324
|
-
if (!
|
|
2325
|
-
sentryLogger.error("
|
|
2326
|
-
throw new Error("
|
|
2324
|
+
if (wallet.id === _types.WalletId.WalletConnect) {
|
|
2325
|
+
const wcAdapter = _optionalChain([displayedWallets, 'optionalAccess', _67 => _67.find, 'call', _68 => _68(({ id }) => id === _types.WalletId.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(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _69 => _69.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 = _optionalChain([displayedWallets, 'optionalAccess', _70 => _70.find, 'call', _71 => _71(({ id }) => id === _types.WalletId.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 (e4) {
|
|
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,
|
|
@@ -2434,6 +2451,5 @@ ${generateBrandCssVariables(brandConfig)}`;
|
|
|
2434
2451
|
|
|
2435
2452
|
|
|
2436
2453
|
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
//# sourceMappingURL=chunk-AFVK5GA5.js.map
|
|
2454
|
+
exports.useAurumStore = useAurumStore; exports.waitForStoreHydration = waitForStoreHydration; exports.useWidgetContext = useWidgetContext; exports.WidgetProvider = WidgetProvider; exports.DEFAULT_THEME = DEFAULT_THEME; exports.getDefaultThemeConfig = getDefaultThemeConfig; exports.POWERED_BY_SPACER_REM = POWERED_BY_SPACER_REM; exports.PageTransitionContainer = PageTransitionContainer; exports.PoweredBy = PoweredBy; exports.Modal = Modal; exports.Spacer = Spacer; exports.ThemeContainer = ThemeContainer; exports.useNavigation = useNavigation; exports.sortWallets = sortWallets; exports.initSentry = initSentry; exports.sentryLogger = sentryLogger; exports.createConfigError = createConfigError; exports.ConnectUIProviders = ConnectUIProviders; exports.ConnectPages = ConnectPages; exports.generateCompleteStyles = generateCompleteStyles;
|
|
2455
|
+
//# sourceMappingURL=chunk-FRA6K6V4.js.map
|