@aurum-sdk/core 0.1.0 → 0.1.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/LICENSE +21 -0
- package/dist/{chunk-U5BSED2R.mjs → chunk-EQEZQPHH.mjs} +4 -4
- package/dist/{chunk-U5BSED2R.mjs.map → chunk-EQEZQPHH.mjs.map} +1 -1
- package/dist/{chunk-DHEVW7CR.js → chunk-LTGSWCPM.js} +4 -4
- package/dist/chunk-LTGSWCPM.js.map +1 -0
- package/dist/index.js +69 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +1 -1
- package/dist/widgets.js +13 -13
- package/dist/widgets.js.map +1 -1
- package/dist/widgets.mjs +1 -1
- package/package.json +14 -15
- package/dist/chunk-DHEVW7CR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkLTGSWCPMjs = require('./chunk-LTGSWCPM.js');
|
|
18
18
|
|
|
19
19
|
// src/AurumCore.ts
|
|
20
20
|
var _viem = require('viem');
|
|
@@ -46,20 +46,20 @@ var _react = require('react');
|
|
|
46
46
|
var _jsxruntime = require('react/jsx-runtime');
|
|
47
47
|
var ModalShell = ({ onClose, brandConfig }) => {
|
|
48
48
|
const [isOpen, setIsOpen] = _react.useState.call(void 0, true);
|
|
49
|
-
const { currentPage } =
|
|
49
|
+
const { currentPage } = _chunkLTGSWCPMjs.useNavigation.call(void 0, );
|
|
50
50
|
const handleClose = () => {
|
|
51
51
|
setIsOpen(false);
|
|
52
52
|
onClose();
|
|
53
53
|
};
|
|
54
54
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
55
|
-
|
|
55
|
+
_chunkLTGSWCPMjs.Modal,
|
|
56
56
|
{
|
|
57
57
|
isOpen,
|
|
58
58
|
closeOnOverlayClick: true,
|
|
59
59
|
onCloseComplete: handleClose,
|
|
60
60
|
brandConfig,
|
|
61
61
|
transitionKey: currentPage,
|
|
62
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
62
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLTGSWCPMjs.ConnectPages, {})
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
65
|
};
|
|
@@ -71,7 +71,7 @@ var _client = require('react-dom/client');
|
|
|
71
71
|
function createShadowRoot(container, brandConfig) {
|
|
72
72
|
const shadowRoot = container.attachShadow({ mode: "open" });
|
|
73
73
|
shadowRoot.innerHTML = `
|
|
74
|
-
<style>${
|
|
74
|
+
<style>${_chunkLTGSWCPMjs.generateCompleteStyles.call(void 0, brandConfig)}</style>
|
|
75
75
|
<div class="aurum-modal-root"></div>
|
|
76
76
|
`;
|
|
77
77
|
return shadowRoot.querySelector(".aurum-modal-root");
|
|
@@ -109,9 +109,9 @@ function renderConnectModal({
|
|
|
109
109
|
brandConfig
|
|
110
110
|
}) {
|
|
111
111
|
return new Promise((resolve, reject) => {
|
|
112
|
-
let sortedWallets =
|
|
112
|
+
let sortedWallets = _chunkLTGSWCPMjs.sortWallets.call(void 0, displayedWallets, { filterHidden: false });
|
|
113
113
|
const hasAppKit = sortedWallets.some((w) => w.id === _types.WalletId.AppKit);
|
|
114
|
-
if (
|
|
114
|
+
if (_chunkLTGSWCPMjs.isMobile.call(void 0, ) && !hasAppKit) {
|
|
115
115
|
sortedWallets = sortedWallets.filter((w) => w.id !== _types.WalletId.WalletConnect);
|
|
116
116
|
}
|
|
117
117
|
const { root, cleanup } = createModalContainer(CONTAINER_ID, brandConfig);
|
|
@@ -124,7 +124,7 @@ function renderConnectModal({
|
|
|
124
124
|
reject(new Error("User rejected request"));
|
|
125
125
|
};
|
|
126
126
|
root.render(
|
|
127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLTGSWCPMjs.ThemeContainer, { theme: brandConfig.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLTGSWCPMjs.ConnectUIProviders, { onConnect, displayedWallets: sortedWallets, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalShell, { onClose, brandConfig }) }) })
|
|
128
128
|
);
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -237,13 +237,13 @@ var AppKitAdapter = class {
|
|
|
237
237
|
this.provider = provider;
|
|
238
238
|
}
|
|
239
239
|
} catch (error) {
|
|
240
|
-
|
|
240
|
+
_chunkLTGSWCPMjs.sentryLogger.warn("Failed to get provider from wagmi connector", { error });
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
} catch (error) {
|
|
246
|
-
|
|
246
|
+
_chunkLTGSWCPMjs.sentryLogger.warn("Failed to get provider from AppKit", { error });
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
isInstalled() {
|
|
@@ -251,11 +251,11 @@ var AppKitAdapter = class {
|
|
|
251
251
|
}
|
|
252
252
|
async connect() {
|
|
253
253
|
if (!this.config.projectId) {
|
|
254
|
-
throw
|
|
254
|
+
throw _chunkLTGSWCPMjs.createConfigError.call(void 0, "AppKit");
|
|
255
255
|
}
|
|
256
256
|
await this.ensureInitialized();
|
|
257
257
|
if (!this.modal) {
|
|
258
|
-
|
|
258
|
+
_chunkLTGSWCPMjs.sentryLogger.error("AppKit is not available");
|
|
259
259
|
throw new Error("AppKit is not available");
|
|
260
260
|
}
|
|
261
261
|
const existingAddress = this.modal.getAddress();
|
|
@@ -271,7 +271,7 @@ var AppKitAdapter = class {
|
|
|
271
271
|
}
|
|
272
272
|
await this.disconnect();
|
|
273
273
|
}
|
|
274
|
-
this.modal.open({ view: "
|
|
274
|
+
this.modal.open({ view: "AllWallets" });
|
|
275
275
|
return await this.waitForConnection();
|
|
276
276
|
}
|
|
277
277
|
waitForConnection(timeout = 6e4) {
|
|
@@ -457,7 +457,7 @@ var RabbyAdapter = class {
|
|
|
457
457
|
await this.providerPromise;
|
|
458
458
|
}
|
|
459
459
|
if (!this.provider) {
|
|
460
|
-
|
|
460
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Rabby is not available");
|
|
461
461
|
throw new Error("Rabby is not available");
|
|
462
462
|
}
|
|
463
463
|
try {
|
|
@@ -470,7 +470,7 @@ var RabbyAdapter = class {
|
|
|
470
470
|
params: []
|
|
471
471
|
});
|
|
472
472
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
473
|
-
|
|
473
|
+
_chunkLTGSWCPMjs.sentryLogger.error("No accounts returned from Rabby");
|
|
474
474
|
throw new Error("No accounts returned from Rabby");
|
|
475
475
|
}
|
|
476
476
|
return {
|
|
@@ -531,11 +531,15 @@ var RabbyAdapter = class {
|
|
|
531
531
|
// src/wallet-adapters/BraveAdapter.ts
|
|
532
532
|
|
|
533
533
|
|
|
534
|
-
|
|
534
|
+
|
|
535
|
+
// src/utils/platform/isBraveBrowser.ts
|
|
535
536
|
function isBraveBrowser() {
|
|
536
537
|
if (typeof navigator === "undefined") return false;
|
|
537
538
|
return navigator.brave !== void 0;
|
|
538
539
|
}
|
|
540
|
+
|
|
541
|
+
// src/wallet-adapters/BraveAdapter.ts
|
|
542
|
+
var BRAVE_RDNS = "com.brave.wallet";
|
|
539
543
|
var BraveAdapter = class {
|
|
540
544
|
constructor() {
|
|
541
545
|
this.id = _types.WalletId.Brave;
|
|
@@ -546,9 +550,13 @@ var BraveAdapter = class {
|
|
|
546
550
|
this.provider = null;
|
|
547
551
|
this.accountsChangedCallback = null;
|
|
548
552
|
this.providerPromise = null;
|
|
549
|
-
this.hide = !isBraveBrowser();
|
|
550
553
|
this.providerPromise = this.discoverProvider();
|
|
551
554
|
}
|
|
555
|
+
get hide() {
|
|
556
|
+
if (this.provider) return false;
|
|
557
|
+
if (isBraveBrowser()) return false;
|
|
558
|
+
return true;
|
|
559
|
+
}
|
|
552
560
|
/**
|
|
553
561
|
* Uses EIP-6963 to discover the Brave Wallet provider by its RDNS identifier.
|
|
554
562
|
* Falls back to window.ethereum for legacy detection.
|
|
@@ -599,7 +607,7 @@ var BraveAdapter = class {
|
|
|
599
607
|
await this.providerPromise;
|
|
600
608
|
}
|
|
601
609
|
if (!this.provider) {
|
|
602
|
-
|
|
610
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Brave Wallet is not available");
|
|
603
611
|
throw new Error("Brave Wallet is not available");
|
|
604
612
|
}
|
|
605
613
|
try {
|
|
@@ -612,7 +620,7 @@ var BraveAdapter = class {
|
|
|
612
620
|
params: []
|
|
613
621
|
});
|
|
614
622
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
615
|
-
|
|
623
|
+
_chunkLTGSWCPMjs.sentryLogger.error("No accounts returned from Brave Wallet");
|
|
616
624
|
throw new Error("No accounts returned from Brave Wallet");
|
|
617
625
|
}
|
|
618
626
|
return {
|
|
@@ -693,7 +701,7 @@ var LedgerAdapter = class {
|
|
|
693
701
|
async connect() {
|
|
694
702
|
try {
|
|
695
703
|
if (!this.walletConnectProjectId) {
|
|
696
|
-
throw
|
|
704
|
+
throw _chunkLTGSWCPMjs.createConfigError.call(void 0, "Ledger");
|
|
697
705
|
}
|
|
698
706
|
const { loadConnectKit } = await Promise.resolve().then(() => _interopRequireWildcard(require("@ledgerhq/connect-kit-loader")));
|
|
699
707
|
const connectKit = await loadConnectKit();
|
|
@@ -707,7 +715,7 @@ var LedgerAdapter = class {
|
|
|
707
715
|
});
|
|
708
716
|
this.provider = await connectKit.getProvider();
|
|
709
717
|
if (!this.provider) {
|
|
710
|
-
|
|
718
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Failed to get Ledger provider");
|
|
711
719
|
throw new Error("Failed to get Ledger provider");
|
|
712
720
|
}
|
|
713
721
|
const accounts = await this.provider.request({
|
|
@@ -715,7 +723,7 @@ var LedgerAdapter = class {
|
|
|
715
723
|
params: []
|
|
716
724
|
});
|
|
717
725
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
718
|
-
|
|
726
|
+
_chunkLTGSWCPMjs.sentryLogger.error("No accounts returned from Ledger");
|
|
719
727
|
throw new Error("No accounts returned from Ledger");
|
|
720
728
|
}
|
|
721
729
|
return {
|
|
@@ -766,7 +774,7 @@ var LedgerAdapter = class {
|
|
|
766
774
|
}
|
|
767
775
|
this.provider = null;
|
|
768
776
|
} catch (error) {
|
|
769
|
-
|
|
777
|
+
_chunkLTGSWCPMjs.sentryLogger.warn("Failed to disconnect from Ledger", { error });
|
|
770
778
|
}
|
|
771
779
|
}
|
|
772
780
|
getProvider() {
|
|
@@ -859,7 +867,7 @@ var PhantomAdapter = class {
|
|
|
859
867
|
await this.providerPromise;
|
|
860
868
|
}
|
|
861
869
|
if (!this.provider) {
|
|
862
|
-
|
|
870
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Phantom is not available");
|
|
863
871
|
throw new Error("Phantom is not available");
|
|
864
872
|
}
|
|
865
873
|
try {
|
|
@@ -872,7 +880,7 @@ var PhantomAdapter = class {
|
|
|
872
880
|
params: []
|
|
873
881
|
});
|
|
874
882
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
875
|
-
|
|
883
|
+
_chunkLTGSWCPMjs.sentryLogger.error("No accounts returned from Phantom");
|
|
876
884
|
throw new Error("No accounts returned from Phantom");
|
|
877
885
|
}
|
|
878
886
|
return {
|
|
@@ -955,7 +963,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
955
963
|
});
|
|
956
964
|
return coinbaseSdk.getProvider();
|
|
957
965
|
} catch (error) {
|
|
958
|
-
|
|
966
|
+
_chunkLTGSWCPMjs.sentryLogger.warn("Failed to initialize Coinbase Wallet provider", { error });
|
|
959
967
|
return null;
|
|
960
968
|
}
|
|
961
969
|
}
|
|
@@ -964,7 +972,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
964
972
|
}
|
|
965
973
|
async connect() {
|
|
966
974
|
if (!this.isInstalled() || !this.provider) {
|
|
967
|
-
|
|
975
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Coinbase Wallet is not available");
|
|
968
976
|
throw new Error("Coinbase Wallet is not available");
|
|
969
977
|
}
|
|
970
978
|
try {
|
|
@@ -973,7 +981,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
973
981
|
params: []
|
|
974
982
|
});
|
|
975
983
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
976
|
-
|
|
984
|
+
_chunkLTGSWCPMjs.sentryLogger.error("No accounts returned from Coinbase Wallet");
|
|
977
985
|
throw new Error("No accounts returned from Coinbase Wallet");
|
|
978
986
|
}
|
|
979
987
|
return {
|
|
@@ -1014,7 +1022,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
1014
1022
|
await this.provider.disconnect();
|
|
1015
1023
|
}
|
|
1016
1024
|
} catch (error) {
|
|
1017
|
-
|
|
1025
|
+
_chunkLTGSWCPMjs.sentryLogger.warn("Error disconnecting from Coinbase Wallet", { error });
|
|
1018
1026
|
} finally {
|
|
1019
1027
|
this.clearLocalStorage();
|
|
1020
1028
|
}
|
|
@@ -1125,7 +1133,7 @@ var MetaMaskAdapter = class {
|
|
|
1125
1133
|
await this.providerPromise;
|
|
1126
1134
|
}
|
|
1127
1135
|
if (!this.provider) {
|
|
1128
|
-
|
|
1136
|
+
_chunkLTGSWCPMjs.sentryLogger.error("MetaMask is not available");
|
|
1129
1137
|
throw new Error("MetaMask is not available");
|
|
1130
1138
|
}
|
|
1131
1139
|
try {
|
|
@@ -1138,7 +1146,7 @@ var MetaMaskAdapter = class {
|
|
|
1138
1146
|
params: []
|
|
1139
1147
|
});
|
|
1140
1148
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
1141
|
-
|
|
1149
|
+
_chunkLTGSWCPMjs.sentryLogger.error("No accounts returned from MetaMask");
|
|
1142
1150
|
throw new Error("No accounts returned from MetaMask");
|
|
1143
1151
|
}
|
|
1144
1152
|
return {
|
|
@@ -1262,17 +1270,17 @@ var WalletConnectAdapter = class {
|
|
|
1262
1270
|
}
|
|
1263
1271
|
async connect() {
|
|
1264
1272
|
if (!this.config.projectId) {
|
|
1265
|
-
throw
|
|
1273
|
+
throw _chunkLTGSWCPMjs.createConfigError.call(void 0, "WalletConnect");
|
|
1266
1274
|
}
|
|
1267
1275
|
try {
|
|
1268
1276
|
await this.ensureInitialized();
|
|
1269
1277
|
if (!this.provider) {
|
|
1270
|
-
|
|
1278
|
+
_chunkLTGSWCPMjs.sentryLogger.error("connect: WalletConnect is not available");
|
|
1271
1279
|
throw new Error("WalletConnect is not available");
|
|
1272
1280
|
}
|
|
1273
1281
|
const accounts = await this.provider.enable();
|
|
1274
1282
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
1275
|
-
|
|
1283
|
+
_chunkLTGSWCPMjs.sentryLogger.error("connect: No accounts returned from WalletConnect");
|
|
1276
1284
|
throw new Error("No accounts returned from WalletConnect");
|
|
1277
1285
|
}
|
|
1278
1286
|
return {
|
|
@@ -1298,7 +1306,7 @@ var WalletConnectAdapter = class {
|
|
|
1298
1306
|
}
|
|
1299
1307
|
await this.ensureInitialized();
|
|
1300
1308
|
if (!this.provider) {
|
|
1301
|
-
|
|
1309
|
+
_chunkLTGSWCPMjs.sentryLogger.error("startSession: WalletConnect is not available");
|
|
1302
1310
|
throw new Error("WalletConnect is not available");
|
|
1303
1311
|
}
|
|
1304
1312
|
this.connectionUri = null;
|
|
@@ -1315,7 +1323,7 @@ var WalletConnectAdapter = class {
|
|
|
1315
1323
|
const connectionPromise = (async () => {
|
|
1316
1324
|
const accounts = await this.provider.enable();
|
|
1317
1325
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
1318
|
-
|
|
1326
|
+
_chunkLTGSWCPMjs.sentryLogger.error("startSession: No accounts returned from WalletConnect");
|
|
1319
1327
|
throw new Error("No accounts returned from WalletConnect");
|
|
1320
1328
|
}
|
|
1321
1329
|
return {
|
|
@@ -1415,11 +1423,11 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1415
1423
|
}
|
|
1416
1424
|
async emailAuthStart(email) {
|
|
1417
1425
|
if (!this.projectId) {
|
|
1418
|
-
throw
|
|
1426
|
+
throw _chunkLTGSWCPMjs.createConfigError.call(void 0, "Email");
|
|
1419
1427
|
}
|
|
1420
1428
|
await this.ensureInitialized();
|
|
1421
1429
|
if (!this.provider) {
|
|
1422
|
-
|
|
1430
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Email is not available");
|
|
1423
1431
|
throw new Error("Email is not available");
|
|
1424
1432
|
}
|
|
1425
1433
|
try {
|
|
@@ -1427,7 +1435,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1427
1435
|
const authResult = await signInWithEmail({ email });
|
|
1428
1436
|
return authResult;
|
|
1429
1437
|
} catch (error) {
|
|
1430
|
-
|
|
1438
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Failed to start email authentication", { error });
|
|
1431
1439
|
throw error;
|
|
1432
1440
|
}
|
|
1433
1441
|
}
|
|
@@ -1437,14 +1445,14 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1437
1445
|
}
|
|
1438
1446
|
await this.ensureInitialized();
|
|
1439
1447
|
if (!this.provider) {
|
|
1440
|
-
|
|
1448
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Email provider not initialized");
|
|
1441
1449
|
throw new Error("Email provider not initialized");
|
|
1442
1450
|
}
|
|
1443
1451
|
const { verifyEmailOTP } = await Promise.resolve().then(() => _interopRequireWildcard(require("@coinbase/cdp-core")));
|
|
1444
1452
|
return verifyEmailOTP({ flowId, otp });
|
|
1445
1453
|
}
|
|
1446
1454
|
async connect() {
|
|
1447
|
-
|
|
1455
|
+
_chunkLTGSWCPMjs.sentryLogger.error("EmailAdapter.connect() is not implemented");
|
|
1448
1456
|
throw new Error("EmailAdapter.connect() is not implemented");
|
|
1449
1457
|
}
|
|
1450
1458
|
async tryRestoreConnection() {
|
|
@@ -1556,7 +1564,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1556
1564
|
const chainIdHex = await base.request({ method: "eth_chainId", params: [] });
|
|
1557
1565
|
chainId = parseInt(chainIdHex, 16);
|
|
1558
1566
|
} catch (e20) {
|
|
1559
|
-
|
|
1567
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Failed to get chainId for fallback request");
|
|
1560
1568
|
throw new Error("Failed to get chainId for fallback request");
|
|
1561
1569
|
}
|
|
1562
1570
|
const publicClient = await getPublicClient(chainId);
|
|
@@ -1571,7 +1579,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1571
1579
|
};
|
|
1572
1580
|
return wrapped;
|
|
1573
1581
|
} catch (error) {
|
|
1574
|
-
|
|
1582
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Failed to initialize Email provider", { error });
|
|
1575
1583
|
return null;
|
|
1576
1584
|
}
|
|
1577
1585
|
}
|
|
@@ -1671,7 +1679,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1671
1679
|
return _AurumCore.instance;
|
|
1672
1680
|
}
|
|
1673
1681
|
const telemetryEnabled = config.telemetry !== false;
|
|
1674
|
-
|
|
1682
|
+
_chunkLTGSWCPMjs.initSentry.call(void 0, telemetryEnabled);
|
|
1675
1683
|
this.brandConfig = this.resolveBrandConfig(config);
|
|
1676
1684
|
this.excludedWallets = new Set(_nullishCoalesce(_optionalChain([config, 'access', _117 => _117.wallets, 'optionalAccess', _118 => _118.exclude]), () => ( [])));
|
|
1677
1685
|
this.wallets = createWalletAdapters({
|
|
@@ -1736,19 +1744,19 @@ var _AurumCore = class _AurumCore {
|
|
|
1736
1744
|
const displayedWallets = this.wallets.filter((w) => !this.excludedWallets.has(w.id));
|
|
1737
1745
|
const modalResult = await renderConnectModal({ displayedWallets, brandConfig: this.brandConfig });
|
|
1738
1746
|
if (!modalResult) {
|
|
1739
|
-
|
|
1747
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Missing modal result");
|
|
1740
1748
|
throw new Error("Missing modal result");
|
|
1741
1749
|
}
|
|
1742
1750
|
adapter = this.wallets.find((w) => w.id === modalResult.walletId) || null;
|
|
1743
1751
|
if (!adapter) {
|
|
1744
|
-
|
|
1752
|
+
_chunkLTGSWCPMjs.sentryLogger.error(`Selected wallet adapter not found: ${modalResult.walletId}`);
|
|
1745
1753
|
throw new Error("Selected wallet adapter not found");
|
|
1746
1754
|
}
|
|
1747
1755
|
result = modalResult;
|
|
1748
1756
|
}
|
|
1749
1757
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1750
1758
|
if (!provider) {
|
|
1751
|
-
|
|
1759
|
+
_chunkLTGSWCPMjs.sentryLogger.error(`Error fetching provider on login: ${adapter.id}`);
|
|
1752
1760
|
throw new Error("Error fetching provider. Please try again.");
|
|
1753
1761
|
}
|
|
1754
1762
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1765,7 +1773,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1765
1773
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1766
1774
|
this.emitConnect(chainId);
|
|
1767
1775
|
this.emitAccountsChanged([checksumAdr]);
|
|
1768
|
-
|
|
1776
|
+
_chunkLTGSWCPMjs.sentryLogger.info(`Wallet connected: ${adapter.id} (${walletId ? "headless" : "modal"})`);
|
|
1769
1777
|
return checksumAdr;
|
|
1770
1778
|
}
|
|
1771
1779
|
async disconnect() {
|
|
@@ -1794,7 +1802,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1794
1802
|
if (!adapter) throw new Error("Selected wallet adapter not found");
|
|
1795
1803
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1796
1804
|
if (!provider) {
|
|
1797
|
-
|
|
1805
|
+
_chunkLTGSWCPMjs.sentryLogger.error(`Error fetching provider on widget login: ${_optionalChain([result, 'optionalAccess', _131 => _131.walletId])}`);
|
|
1798
1806
|
throw new Error("Error fetching provider. Please try again.");
|
|
1799
1807
|
}
|
|
1800
1808
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1811,7 +1819,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1811
1819
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1812
1820
|
this.emitConnect(chainId);
|
|
1813
1821
|
this.emitAccountsChanged([checksumAdr]);
|
|
1814
|
-
|
|
1822
|
+
_chunkLTGSWCPMjs.sentryLogger.info(`Wallet connected: ${adapter.id} (widget)`);
|
|
1815
1823
|
}
|
|
1816
1824
|
async getChainId() {
|
|
1817
1825
|
await this.whenReady();
|
|
@@ -1829,7 +1837,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1829
1837
|
}
|
|
1830
1838
|
}
|
|
1831
1839
|
updateBrandConfig(newConfig) {
|
|
1832
|
-
const defaultTheme =
|
|
1840
|
+
const defaultTheme = _chunkLTGSWCPMjs.getDefaultThemeConfig.call(void 0, _nullishCoalesce(newConfig.theme, () => ( this.brandConfig.theme)));
|
|
1833
1841
|
this.brandConfig = {
|
|
1834
1842
|
logo: "logo" in newConfig ? _nullishCoalesce(newConfig.logo, () => ( defaultTheme.logo)) : this.brandConfig.logo,
|
|
1835
1843
|
theme: "theme" in newConfig ? _nullishCoalesce(newConfig.theme, () => ( defaultTheme.theme)) : this.brandConfig.theme,
|
|
@@ -1876,13 +1884,13 @@ var _AurumCore = class _AurumCore {
|
|
|
1876
1884
|
const verifyResult = await emailAdapter.emailAuthVerify(flowId, otp);
|
|
1877
1885
|
const provider = emailAdapter.getProvider();
|
|
1878
1886
|
if (!provider) {
|
|
1879
|
-
|
|
1887
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Failed to get provider after email verification");
|
|
1880
1888
|
throw new Error("Failed to get provider after email verification");
|
|
1881
1889
|
}
|
|
1882
1890
|
const address = _optionalChain([verifyResult, 'access', _132 => _132.user, 'optionalAccess', _133 => _133.evmAccounts, 'optionalAccess', _134 => _134[0]]);
|
|
1883
1891
|
const email = _optionalChain([verifyResult, 'access', _135 => _135.user, 'optionalAccess', _136 => _136.authenticationMethods, 'optionalAccess', _137 => _137.email, 'optionalAccess', _138 => _138.email]);
|
|
1884
1892
|
if (!address || !email) {
|
|
1885
|
-
|
|
1893
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Address or email not found after email verification");
|
|
1886
1894
|
throw new Error("Address or email not found after email verification");
|
|
1887
1895
|
}
|
|
1888
1896
|
const checksumAdr = _viem.checksumAddress.call(void 0, address);
|
|
@@ -1899,7 +1907,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1899
1907
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1900
1908
|
this.emitConnect(chainId);
|
|
1901
1909
|
this.emitAccountsChanged([checksumAdr]);
|
|
1902
|
-
|
|
1910
|
+
_chunkLTGSWCPMjs.sentryLogger.info(`Wallet connected: ${emailAdapter.id} (headless)`);
|
|
1903
1911
|
return { address: checksumAdr, email: _nullishCoalesce(email, () => ( "")), isNewUser: _nullishCoalesce(verifyResult.isNewUser, () => ( false)) };
|
|
1904
1912
|
}
|
|
1905
1913
|
/**
|
|
@@ -1919,7 +1927,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1919
1927
|
const result = await session.waitForConnection();
|
|
1920
1928
|
const provider = _nullishCoalesce(result.provider, () => ( wcAdapter.getProvider()));
|
|
1921
1929
|
if (!provider) {
|
|
1922
|
-
|
|
1930
|
+
_chunkLTGSWCPMjs.sentryLogger.error("Failed to get provider after WalletConnect connection");
|
|
1923
1931
|
throw new Error("Failed to get provider after WalletConnect connection");
|
|
1924
1932
|
}
|
|
1925
1933
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1935,7 +1943,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1935
1943
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1936
1944
|
this.emitConnect(chainId);
|
|
1937
1945
|
this.emitAccountsChanged([checksumAdr]);
|
|
1938
|
-
|
|
1946
|
+
_chunkLTGSWCPMjs.sentryLogger.info(`Wallet connected: ${wcAdapter.id} (headless)`);
|
|
1939
1947
|
return checksumAdr;
|
|
1940
1948
|
}
|
|
1941
1949
|
};
|
|
@@ -1992,7 +2000,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1992
2000
|
/* BRAND & THEME METHODS */
|
|
1993
2001
|
resolveBrandConfig(config) {
|
|
1994
2002
|
const { brand = {} } = config || {};
|
|
1995
|
-
const themeConfig =
|
|
2003
|
+
const themeConfig = _chunkLTGSWCPMjs.getDefaultThemeConfig.call(void 0, brand.theme || _chunkLTGSWCPMjs.DEFAULT_THEME);
|
|
1996
2004
|
return {
|
|
1997
2005
|
logo: _nullishCoalesce(brand.logo, () => ( themeConfig.logo)),
|
|
1998
2006
|
theme: _nullishCoalesce(brand.theme, () => ( themeConfig.theme)),
|
|
@@ -2007,8 +2015,8 @@ var _AurumCore = class _AurumCore {
|
|
|
2007
2015
|
}
|
|
2008
2016
|
async tryRestoreConnection() {
|
|
2009
2017
|
try {
|
|
2010
|
-
await
|
|
2011
|
-
const store =
|
|
2018
|
+
await _chunkLTGSWCPMjs.waitForStoreHydration.call(void 0, );
|
|
2019
|
+
const store = _chunkLTGSWCPMjs.useAurumStore.getState();
|
|
2012
2020
|
if (!store.isConnected || !store.walletId || !store.address || !store.walletName) {
|
|
2013
2021
|
return;
|
|
2014
2022
|
}
|
|
@@ -2038,7 +2046,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2038
2046
|
}
|
|
2039
2047
|
}
|
|
2040
2048
|
persistConnectionState(adapter, address, email) {
|
|
2041
|
-
|
|
2049
|
+
_chunkLTGSWCPMjs.useAurumStore.getState().setConnection(adapter.id, _viem.checksumAddress.call(void 0, address), adapter.name, email);
|
|
2042
2050
|
}
|
|
2043
2051
|
/* INTERNAL LISTENER METHODS */
|
|
2044
2052
|
setInternalAccountChangeListener(adapter) {
|
|
@@ -2136,7 +2144,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2136
2144
|
}
|
|
2137
2145
|
/* REST */
|
|
2138
2146
|
resetConnectionState() {
|
|
2139
|
-
|
|
2147
|
+
_chunkLTGSWCPMjs.useAurumStore.getState().clearConnection();
|
|
2140
2148
|
this.connectedWalletAdapter = null;
|
|
2141
2149
|
this.updateProvider(this.skeletonProvider);
|
|
2142
2150
|
this.userInfo = void 0;
|