@aurum-sdk/core 0.1.5 → 0.2.1
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/README.md +3 -3
- package/dist/{chunk-HPH3VJRX.js → chunk-AFVK5GA5.js} +2 -2
- package/dist/chunk-AFVK5GA5.js.map +1 -0
- package/dist/{chunk-5NXCRO5Q.mjs → chunk-BSMOPBPL.mjs} +2 -2
- package/dist/chunk-BSMOPBPL.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/widgets.d.mts +2 -51
- package/dist/widgets.d.ts +2 -51
- package/dist/widgets.js +16 -20
- package/dist/widgets.js.map +1 -1
- package/dist/widgets.mjs +3 -7
- package/dist/widgets.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-5NXCRO5Q.mjs.map +0 -1
- package/dist/chunk-HPH3VJRX.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkAFVK5GA5js = require('./chunk-AFVK5GA5.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 } = _chunkAFVK5GA5js.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
|
+
_chunkAFVK5GA5js.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, _chunkAFVK5GA5js.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>${_chunkAFVK5GA5js.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 = _chunkAFVK5GA5js.sortWallets.call(void 0, displayedWallets, { filterHidden: false });
|
|
113
113
|
const hasAppKit = sortedWallets.some((w) => w.id === _types.WalletId.AppKit);
|
|
114
|
-
if (
|
|
114
|
+
if (_chunkAFVK5GA5js.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, _chunkAFVK5GA5js.ThemeContainer, { theme: brandConfig.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAFVK5GA5js.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
|
+
_chunkAFVK5GA5js.sentryLogger.warn("Failed to get provider from wagmi connector", { error });
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
} catch (error) {
|
|
246
|
-
|
|
246
|
+
_chunkAFVK5GA5js.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 _chunkAFVK5GA5js.createConfigError.call(void 0, "AppKit");
|
|
255
255
|
}
|
|
256
256
|
await this.ensureInitialized();
|
|
257
257
|
if (!this.modal) {
|
|
258
|
-
|
|
258
|
+
_chunkAFVK5GA5js.sentryLogger.error("AppKit is not available");
|
|
259
259
|
throw new Error("AppKit is not available");
|
|
260
260
|
}
|
|
261
261
|
const existingAddress = this.modal.getAddress();
|
|
@@ -457,7 +457,7 @@ var RabbyAdapter = class {
|
|
|
457
457
|
await this.providerPromise;
|
|
458
458
|
}
|
|
459
459
|
if (!this.provider) {
|
|
460
|
-
|
|
460
|
+
_chunkAFVK5GA5js.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
|
+
_chunkAFVK5GA5js.sentryLogger.error("No accounts returned from Rabby");
|
|
474
474
|
throw new Error("No accounts returned from Rabby");
|
|
475
475
|
}
|
|
476
476
|
return {
|
|
@@ -607,7 +607,7 @@ var BraveAdapter = class {
|
|
|
607
607
|
await this.providerPromise;
|
|
608
608
|
}
|
|
609
609
|
if (!this.provider) {
|
|
610
|
-
|
|
610
|
+
_chunkAFVK5GA5js.sentryLogger.error("Brave Wallet is not available");
|
|
611
611
|
throw new Error("Brave Wallet is not available");
|
|
612
612
|
}
|
|
613
613
|
try {
|
|
@@ -620,7 +620,7 @@ var BraveAdapter = class {
|
|
|
620
620
|
params: []
|
|
621
621
|
});
|
|
622
622
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
623
|
-
|
|
623
|
+
_chunkAFVK5GA5js.sentryLogger.error("No accounts returned from Brave Wallet");
|
|
624
624
|
throw new Error("No accounts returned from Brave Wallet");
|
|
625
625
|
}
|
|
626
626
|
return {
|
|
@@ -701,7 +701,7 @@ var LedgerAdapter = class {
|
|
|
701
701
|
async connect() {
|
|
702
702
|
try {
|
|
703
703
|
if (!this.walletConnectProjectId) {
|
|
704
|
-
throw
|
|
704
|
+
throw _chunkAFVK5GA5js.createConfigError.call(void 0, "Ledger");
|
|
705
705
|
}
|
|
706
706
|
const { loadConnectKit } = await Promise.resolve().then(() => _interopRequireWildcard(require("@ledgerhq/connect-kit-loader")));
|
|
707
707
|
const connectKit = await loadConnectKit();
|
|
@@ -715,7 +715,7 @@ var LedgerAdapter = class {
|
|
|
715
715
|
});
|
|
716
716
|
this.provider = await connectKit.getProvider();
|
|
717
717
|
if (!this.provider) {
|
|
718
|
-
|
|
718
|
+
_chunkAFVK5GA5js.sentryLogger.error("Failed to get Ledger provider");
|
|
719
719
|
throw new Error("Failed to get Ledger provider");
|
|
720
720
|
}
|
|
721
721
|
const accounts = await this.provider.request({
|
|
@@ -723,7 +723,7 @@ var LedgerAdapter = class {
|
|
|
723
723
|
params: []
|
|
724
724
|
});
|
|
725
725
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
726
|
-
|
|
726
|
+
_chunkAFVK5GA5js.sentryLogger.error("No accounts returned from Ledger");
|
|
727
727
|
throw new Error("No accounts returned from Ledger");
|
|
728
728
|
}
|
|
729
729
|
return {
|
|
@@ -774,7 +774,7 @@ var LedgerAdapter = class {
|
|
|
774
774
|
}
|
|
775
775
|
this.provider = null;
|
|
776
776
|
} catch (error) {
|
|
777
|
-
|
|
777
|
+
_chunkAFVK5GA5js.sentryLogger.warn("Failed to disconnect from Ledger", { error });
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
780
|
getProvider() {
|
|
@@ -867,7 +867,7 @@ var PhantomAdapter = class {
|
|
|
867
867
|
await this.providerPromise;
|
|
868
868
|
}
|
|
869
869
|
if (!this.provider) {
|
|
870
|
-
|
|
870
|
+
_chunkAFVK5GA5js.sentryLogger.error("Phantom is not available");
|
|
871
871
|
throw new Error("Phantom is not available");
|
|
872
872
|
}
|
|
873
873
|
try {
|
|
@@ -880,7 +880,7 @@ var PhantomAdapter = class {
|
|
|
880
880
|
params: []
|
|
881
881
|
});
|
|
882
882
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
883
|
-
|
|
883
|
+
_chunkAFVK5GA5js.sentryLogger.error("No accounts returned from Phantom");
|
|
884
884
|
throw new Error("No accounts returned from Phantom");
|
|
885
885
|
}
|
|
886
886
|
return {
|
|
@@ -963,7 +963,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
963
963
|
});
|
|
964
964
|
return coinbaseSdk.getProvider();
|
|
965
965
|
} catch (error) {
|
|
966
|
-
|
|
966
|
+
_chunkAFVK5GA5js.sentryLogger.warn("Failed to initialize Coinbase Wallet provider", { error });
|
|
967
967
|
return null;
|
|
968
968
|
}
|
|
969
969
|
}
|
|
@@ -972,7 +972,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
972
972
|
}
|
|
973
973
|
async connect() {
|
|
974
974
|
if (!this.isInstalled() || !this.provider) {
|
|
975
|
-
|
|
975
|
+
_chunkAFVK5GA5js.sentryLogger.error("Coinbase Wallet is not available");
|
|
976
976
|
throw new Error("Coinbase Wallet is not available");
|
|
977
977
|
}
|
|
978
978
|
try {
|
|
@@ -981,7 +981,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
981
981
|
params: []
|
|
982
982
|
});
|
|
983
983
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
984
|
-
|
|
984
|
+
_chunkAFVK5GA5js.sentryLogger.error("No accounts returned from Coinbase Wallet");
|
|
985
985
|
throw new Error("No accounts returned from Coinbase Wallet");
|
|
986
986
|
}
|
|
987
987
|
return {
|
|
@@ -1022,7 +1022,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
1022
1022
|
await this.provider.disconnect();
|
|
1023
1023
|
}
|
|
1024
1024
|
} catch (error) {
|
|
1025
|
-
|
|
1025
|
+
_chunkAFVK5GA5js.sentryLogger.warn("Error disconnecting from Coinbase Wallet", { error });
|
|
1026
1026
|
} finally {
|
|
1027
1027
|
this.clearLocalStorage();
|
|
1028
1028
|
}
|
|
@@ -1133,7 +1133,7 @@ var MetaMaskAdapter = class {
|
|
|
1133
1133
|
await this.providerPromise;
|
|
1134
1134
|
}
|
|
1135
1135
|
if (!this.provider) {
|
|
1136
|
-
|
|
1136
|
+
_chunkAFVK5GA5js.sentryLogger.error("MetaMask is not available");
|
|
1137
1137
|
throw new Error("MetaMask is not available");
|
|
1138
1138
|
}
|
|
1139
1139
|
try {
|
|
@@ -1146,7 +1146,7 @@ var MetaMaskAdapter = class {
|
|
|
1146
1146
|
params: []
|
|
1147
1147
|
});
|
|
1148
1148
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
1149
|
-
|
|
1149
|
+
_chunkAFVK5GA5js.sentryLogger.error("No accounts returned from MetaMask");
|
|
1150
1150
|
throw new Error("No accounts returned from MetaMask");
|
|
1151
1151
|
}
|
|
1152
1152
|
return {
|
|
@@ -1270,17 +1270,17 @@ var WalletConnectAdapter = class {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
async connect() {
|
|
1272
1272
|
if (!this.config.projectId) {
|
|
1273
|
-
throw
|
|
1273
|
+
throw _chunkAFVK5GA5js.createConfigError.call(void 0, "WalletConnect");
|
|
1274
1274
|
}
|
|
1275
1275
|
try {
|
|
1276
1276
|
await this.ensureInitialized();
|
|
1277
1277
|
if (!this.provider) {
|
|
1278
|
-
|
|
1278
|
+
_chunkAFVK5GA5js.sentryLogger.error("connect: WalletConnect is not available");
|
|
1279
1279
|
throw new Error("WalletConnect is not available");
|
|
1280
1280
|
}
|
|
1281
1281
|
const accounts = await this.provider.enable();
|
|
1282
1282
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
1283
|
-
|
|
1283
|
+
_chunkAFVK5GA5js.sentryLogger.error("connect: No accounts returned from WalletConnect");
|
|
1284
1284
|
throw new Error("No accounts returned from WalletConnect");
|
|
1285
1285
|
}
|
|
1286
1286
|
return {
|
|
@@ -1306,7 +1306,7 @@ var WalletConnectAdapter = class {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
await this.ensureInitialized();
|
|
1308
1308
|
if (!this.provider) {
|
|
1309
|
-
|
|
1309
|
+
_chunkAFVK5GA5js.sentryLogger.error("startSession: WalletConnect is not available");
|
|
1310
1310
|
throw new Error("WalletConnect is not available");
|
|
1311
1311
|
}
|
|
1312
1312
|
this.connectionUri = null;
|
|
@@ -1323,7 +1323,7 @@ var WalletConnectAdapter = class {
|
|
|
1323
1323
|
const connectionPromise = (async () => {
|
|
1324
1324
|
const accounts = await this.provider.enable();
|
|
1325
1325
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
1326
|
-
|
|
1326
|
+
_chunkAFVK5GA5js.sentryLogger.error("startSession: No accounts returned from WalletConnect");
|
|
1327
1327
|
throw new Error("No accounts returned from WalletConnect");
|
|
1328
1328
|
}
|
|
1329
1329
|
return {
|
|
@@ -1423,11 +1423,11 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1423
1423
|
}
|
|
1424
1424
|
async emailAuthStart(email) {
|
|
1425
1425
|
if (!this.projectId) {
|
|
1426
|
-
throw
|
|
1426
|
+
throw _chunkAFVK5GA5js.createConfigError.call(void 0, "Email");
|
|
1427
1427
|
}
|
|
1428
1428
|
await this.ensureInitialized();
|
|
1429
1429
|
if (!this.provider) {
|
|
1430
|
-
|
|
1430
|
+
_chunkAFVK5GA5js.sentryLogger.error("Email is not available");
|
|
1431
1431
|
throw new Error("Email is not available");
|
|
1432
1432
|
}
|
|
1433
1433
|
try {
|
|
@@ -1435,7 +1435,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1435
1435
|
const authResult = await signInWithEmail({ email });
|
|
1436
1436
|
return authResult;
|
|
1437
1437
|
} catch (error) {
|
|
1438
|
-
|
|
1438
|
+
_chunkAFVK5GA5js.sentryLogger.error("Failed to start email authentication", { error });
|
|
1439
1439
|
throw error;
|
|
1440
1440
|
}
|
|
1441
1441
|
}
|
|
@@ -1445,14 +1445,14 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
await this.ensureInitialized();
|
|
1447
1447
|
if (!this.provider) {
|
|
1448
|
-
|
|
1448
|
+
_chunkAFVK5GA5js.sentryLogger.error("Email provider not initialized");
|
|
1449
1449
|
throw new Error("Email provider not initialized");
|
|
1450
1450
|
}
|
|
1451
1451
|
const { verifyEmailOTP } = await Promise.resolve().then(() => _interopRequireWildcard(require("@coinbase/cdp-core")));
|
|
1452
1452
|
return verifyEmailOTP({ flowId, otp });
|
|
1453
1453
|
}
|
|
1454
1454
|
async connect() {
|
|
1455
|
-
|
|
1455
|
+
_chunkAFVK5GA5js.sentryLogger.error("EmailAdapter.connect() is not implemented");
|
|
1456
1456
|
throw new Error("EmailAdapter.connect() is not implemented");
|
|
1457
1457
|
}
|
|
1458
1458
|
async tryRestoreConnection() {
|
|
@@ -1564,7 +1564,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1564
1564
|
const chainIdHex = await base.request({ method: "eth_chainId", params: [] });
|
|
1565
1565
|
chainId = parseInt(chainIdHex, 16);
|
|
1566
1566
|
} catch (e20) {
|
|
1567
|
-
|
|
1567
|
+
_chunkAFVK5GA5js.sentryLogger.error("Failed to get chainId for fallback request");
|
|
1568
1568
|
throw new Error("Failed to get chainId for fallback request");
|
|
1569
1569
|
}
|
|
1570
1570
|
const publicClient = await getPublicClient(chainId);
|
|
@@ -1579,7 +1579,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1579
1579
|
};
|
|
1580
1580
|
return wrapped;
|
|
1581
1581
|
} catch (error) {
|
|
1582
|
-
|
|
1582
|
+
_chunkAFVK5GA5js.sentryLogger.error("Failed to initialize Email provider", { error });
|
|
1583
1583
|
return null;
|
|
1584
1584
|
}
|
|
1585
1585
|
}
|
|
@@ -1679,7 +1679,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1679
1679
|
return _AurumCore.instance;
|
|
1680
1680
|
}
|
|
1681
1681
|
const telemetryEnabled = config.telemetry !== false;
|
|
1682
|
-
|
|
1682
|
+
_chunkAFVK5GA5js.initSentry.call(void 0, telemetryEnabled);
|
|
1683
1683
|
this.brandConfig = this.resolveBrandConfig(config);
|
|
1684
1684
|
this.excludedWallets = new Set(_nullishCoalesce(_optionalChain([config, 'access', _117 => _117.wallets, 'optionalAccess', _118 => _118.exclude]), () => ( [])));
|
|
1685
1685
|
this.wallets = createWalletAdapters({
|
|
@@ -1744,19 +1744,19 @@ var _AurumCore = class _AurumCore {
|
|
|
1744
1744
|
const displayedWallets = this.wallets.filter((w) => !this.excludedWallets.has(w.id));
|
|
1745
1745
|
const modalResult = await renderConnectModal({ displayedWallets, brandConfig: this.brandConfig });
|
|
1746
1746
|
if (!modalResult) {
|
|
1747
|
-
|
|
1747
|
+
_chunkAFVK5GA5js.sentryLogger.error("Missing modal result");
|
|
1748
1748
|
throw new Error("Missing modal result");
|
|
1749
1749
|
}
|
|
1750
1750
|
adapter = this.wallets.find((w) => w.id === modalResult.walletId) || null;
|
|
1751
1751
|
if (!adapter) {
|
|
1752
|
-
|
|
1752
|
+
_chunkAFVK5GA5js.sentryLogger.error(`Selected wallet adapter not found: ${modalResult.walletId}`);
|
|
1753
1753
|
throw new Error("Selected wallet adapter not found");
|
|
1754
1754
|
}
|
|
1755
1755
|
result = modalResult;
|
|
1756
1756
|
}
|
|
1757
1757
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1758
1758
|
if (!provider) {
|
|
1759
|
-
|
|
1759
|
+
_chunkAFVK5GA5js.sentryLogger.error(`Error fetching provider on login: ${adapter.id}`);
|
|
1760
1760
|
throw new Error("Error fetching provider. Please try again.");
|
|
1761
1761
|
}
|
|
1762
1762
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1773,7 +1773,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1773
1773
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1774
1774
|
this.emitConnect(chainId);
|
|
1775
1775
|
this.emitAccountsChanged([checksumAdr]);
|
|
1776
|
-
|
|
1776
|
+
_chunkAFVK5GA5js.sentryLogger.info(`Wallet connected: ${adapter.id} (${walletId ? "headless" : "modal"})`);
|
|
1777
1777
|
return checksumAdr;
|
|
1778
1778
|
}
|
|
1779
1779
|
async disconnect() {
|
|
@@ -1802,7 +1802,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1802
1802
|
if (!adapter) throw new Error("Selected wallet adapter not found");
|
|
1803
1803
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1804
1804
|
if (!provider) {
|
|
1805
|
-
|
|
1805
|
+
_chunkAFVK5GA5js.sentryLogger.error(`Error fetching provider on widget login: ${_optionalChain([result, 'optionalAccess', _131 => _131.walletId])}`);
|
|
1806
1806
|
throw new Error("Error fetching provider. Please try again.");
|
|
1807
1807
|
}
|
|
1808
1808
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1819,7 +1819,8 @@ var _AurumCore = class _AurumCore {
|
|
|
1819
1819
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1820
1820
|
this.emitConnect(chainId);
|
|
1821
1821
|
this.emitAccountsChanged([checksumAdr]);
|
|
1822
|
-
|
|
1822
|
+
_chunkAFVK5GA5js.sentryLogger.info(`Wallet connected: ${adapter.id} (widget)`);
|
|
1823
|
+
return this.userInfo;
|
|
1823
1824
|
}
|
|
1824
1825
|
async getChainId() {
|
|
1825
1826
|
await this.whenReady();
|
|
@@ -1837,7 +1838,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1837
1838
|
}
|
|
1838
1839
|
}
|
|
1839
1840
|
updateBrandConfig(newConfig) {
|
|
1840
|
-
const defaultTheme =
|
|
1841
|
+
const defaultTheme = _chunkAFVK5GA5js.getDefaultThemeConfig.call(void 0, _nullishCoalesce(newConfig.theme, () => ( this.brandConfig.theme)));
|
|
1841
1842
|
this.brandConfig = {
|
|
1842
1843
|
logo: "logo" in newConfig ? _nullishCoalesce(newConfig.logo, () => ( defaultTheme.logo)) : this.brandConfig.logo,
|
|
1843
1844
|
theme: "theme" in newConfig ? _nullishCoalesce(newConfig.theme, () => ( defaultTheme.theme)) : this.brandConfig.theme,
|
|
@@ -1884,13 +1885,13 @@ var _AurumCore = class _AurumCore {
|
|
|
1884
1885
|
const verifyResult = await emailAdapter.emailAuthVerify(flowId, otp);
|
|
1885
1886
|
const provider = emailAdapter.getProvider();
|
|
1886
1887
|
if (!provider) {
|
|
1887
|
-
|
|
1888
|
+
_chunkAFVK5GA5js.sentryLogger.error("Failed to get provider after email verification");
|
|
1888
1889
|
throw new Error("Failed to get provider after email verification");
|
|
1889
1890
|
}
|
|
1890
1891
|
const address = _optionalChain([verifyResult, 'access', _132 => _132.user, 'optionalAccess', _133 => _133.evmAccounts, 'optionalAccess', _134 => _134[0]]);
|
|
1891
1892
|
const email = _optionalChain([verifyResult, 'access', _135 => _135.user, 'optionalAccess', _136 => _136.authenticationMethods, 'optionalAccess', _137 => _137.email, 'optionalAccess', _138 => _138.email]);
|
|
1892
1893
|
if (!address || !email) {
|
|
1893
|
-
|
|
1894
|
+
_chunkAFVK5GA5js.sentryLogger.error("Address or email not found after email verification");
|
|
1894
1895
|
throw new Error("Address or email not found after email verification");
|
|
1895
1896
|
}
|
|
1896
1897
|
const checksumAdr = _viem.checksumAddress.call(void 0, address);
|
|
@@ -1907,7 +1908,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1907
1908
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1908
1909
|
this.emitConnect(chainId);
|
|
1909
1910
|
this.emitAccountsChanged([checksumAdr]);
|
|
1910
|
-
|
|
1911
|
+
_chunkAFVK5GA5js.sentryLogger.info(`Wallet connected: ${emailAdapter.id} (headless)`);
|
|
1911
1912
|
return { address: checksumAdr, email: _nullishCoalesce(email, () => ( "")), isNewUser: _nullishCoalesce(verifyResult.isNewUser, () => ( false)) };
|
|
1912
1913
|
}
|
|
1913
1914
|
/**
|
|
@@ -1927,7 +1928,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1927
1928
|
const result = await session.waitForConnection();
|
|
1928
1929
|
const provider = _nullishCoalesce(result.provider, () => ( wcAdapter.getProvider()));
|
|
1929
1930
|
if (!provider) {
|
|
1930
|
-
|
|
1931
|
+
_chunkAFVK5GA5js.sentryLogger.error("Failed to get provider after WalletConnect connection");
|
|
1931
1932
|
throw new Error("Failed to get provider after WalletConnect connection");
|
|
1932
1933
|
}
|
|
1933
1934
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1943,7 +1944,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1943
1944
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1944
1945
|
this.emitConnect(chainId);
|
|
1945
1946
|
this.emitAccountsChanged([checksumAdr]);
|
|
1946
|
-
|
|
1947
|
+
_chunkAFVK5GA5js.sentryLogger.info(`Wallet connected: ${wcAdapter.id} (headless)`);
|
|
1947
1948
|
return checksumAdr;
|
|
1948
1949
|
}
|
|
1949
1950
|
};
|
|
@@ -2000,7 +2001,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2000
2001
|
/* BRAND & THEME METHODS */
|
|
2001
2002
|
resolveBrandConfig(config) {
|
|
2002
2003
|
const { brand = {} } = config || {};
|
|
2003
|
-
const themeConfig =
|
|
2004
|
+
const themeConfig = _chunkAFVK5GA5js.getDefaultThemeConfig.call(void 0, brand.theme || _chunkAFVK5GA5js.DEFAULT_THEME);
|
|
2004
2005
|
return {
|
|
2005
2006
|
logo: _nullishCoalesce(brand.logo, () => ( themeConfig.logo)),
|
|
2006
2007
|
theme: _nullishCoalesce(brand.theme, () => ( themeConfig.theme)),
|
|
@@ -2015,8 +2016,8 @@ var _AurumCore = class _AurumCore {
|
|
|
2015
2016
|
}
|
|
2016
2017
|
async tryRestoreConnection() {
|
|
2017
2018
|
try {
|
|
2018
|
-
await
|
|
2019
|
-
const store =
|
|
2019
|
+
await _chunkAFVK5GA5js.waitForStoreHydration.call(void 0, );
|
|
2020
|
+
const store = _chunkAFVK5GA5js.useAurumStore.getState();
|
|
2020
2021
|
if (!store.isConnected || !store.walletId || !store.address || !store.walletName) {
|
|
2021
2022
|
return;
|
|
2022
2023
|
}
|
|
@@ -2046,7 +2047,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2046
2047
|
}
|
|
2047
2048
|
}
|
|
2048
2049
|
persistConnectionState(adapter, address, email) {
|
|
2049
|
-
|
|
2050
|
+
_chunkAFVK5GA5js.useAurumStore.getState().setConnection(adapter.id, _viem.checksumAddress.call(void 0, address), adapter.name, email);
|
|
2050
2051
|
}
|
|
2051
2052
|
/* INTERNAL LISTENER METHODS */
|
|
2052
2053
|
setInternalAccountChangeListener(adapter) {
|
|
@@ -2144,7 +2145,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2144
2145
|
}
|
|
2145
2146
|
/* REST */
|
|
2146
2147
|
resetConnectionState() {
|
|
2147
|
-
|
|
2148
|
+
_chunkAFVK5GA5js.useAurumStore.getState().clearConnection();
|
|
2148
2149
|
this.connectedWalletAdapter = null;
|
|
2149
2150
|
this.updateProvider(this.skeletonProvider);
|
|
2150
2151
|
this.userInfo = void 0;
|