@aurum-sdk/core 0.2.3-canary.3 → 0.2.3
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 +6 -0
- package/dist/{chunk-MHRKTE55.js → chunk-JXTTDJRM.js} +4 -4
- package/dist/{chunk-E5UAJURN.mjs → chunk-KAP5LMPM.mjs} +4 -4
- package/dist/index.js +133 -132
- package/dist/index.mjs +29 -28
- package/dist/widgets.js +12 -12
- package/dist/widgets.mjs +1 -1
- package/package.json +4 -3
- package/dist/chunk-E5UAJURN.mjs.map +0 -1
- package/dist/chunk-MHRKTE55.js.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/widgets.css.map +0 -1
- package/dist/widgets.js.map +0 -1
- package/dist/widgets.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkJXTTDJRMjs = require('./chunk-JXTTDJRM.js');
|
|
17
17
|
|
|
18
18
|
// src/AurumCore.ts
|
|
19
19
|
var _viem = require('viem');
|
|
@@ -45,20 +45,20 @@ var _react = require('react');
|
|
|
45
45
|
var _jsxruntime = require('react/jsx-runtime');
|
|
46
46
|
var ModalShell = ({ onClose, brandConfig }) => {
|
|
47
47
|
const [isOpen, setIsOpen] = _react.useState.call(void 0, true);
|
|
48
|
-
const { currentPage } =
|
|
48
|
+
const { currentPage } = _chunkJXTTDJRMjs.useNavigation.call(void 0, );
|
|
49
49
|
const handleClose = () => {
|
|
50
50
|
setIsOpen(false);
|
|
51
51
|
onClose();
|
|
52
52
|
};
|
|
53
53
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
54
|
-
|
|
54
|
+
_chunkJXTTDJRMjs.Modal,
|
|
55
55
|
{
|
|
56
56
|
isOpen,
|
|
57
57
|
closeOnOverlayClick: true,
|
|
58
58
|
onCloseComplete: handleClose,
|
|
59
59
|
brandConfig,
|
|
60
60
|
transitionKey: currentPage,
|
|
61
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
61
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJXTTDJRMjs.ConnectPages, {})
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
64
|
};
|
|
@@ -70,7 +70,7 @@ var _client = require('react-dom/client');
|
|
|
70
70
|
function createShadowRoot(container, brandConfig) {
|
|
71
71
|
const shadowRoot = container.attachShadow({ mode: "open" });
|
|
72
72
|
shadowRoot.innerHTML = `
|
|
73
|
-
<style>${
|
|
73
|
+
<style>${_chunkJXTTDJRMjs.generateCompleteStyles.call(void 0, brandConfig)}</style>
|
|
74
74
|
<div class="aurum-modal-root"></div>
|
|
75
75
|
`;
|
|
76
76
|
return shadowRoot.querySelector(".aurum-modal-root");
|
|
@@ -107,7 +107,7 @@ function renderConnectModal({
|
|
|
107
107
|
brandConfig
|
|
108
108
|
}) {
|
|
109
109
|
return new Promise((resolve, reject) => {
|
|
110
|
-
const sortedWallets =
|
|
110
|
+
const sortedWallets = _chunkJXTTDJRMjs.sortWallets.call(void 0, displayedWallets, { filterHidden: false });
|
|
111
111
|
const { root, cleanup } = createModalContainer(CONTAINER_ID, brandConfig);
|
|
112
112
|
const onConnect = (result) => {
|
|
113
113
|
cleanup();
|
|
@@ -118,7 +118,7 @@ function renderConnectModal({
|
|
|
118
118
|
reject(new Error("User rejected request"));
|
|
119
119
|
};
|
|
120
120
|
root.render(
|
|
121
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
121
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJXTTDJRMjs.ThemeContainer, { theme: brandConfig.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJXTTDJRMjs.ConnectUIProviders, { onConnect, displayedWallets: sortedWallets, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalShell, { onClose, brandConfig }) }) })
|
|
122
122
|
);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
@@ -190,7 +190,7 @@ var RabbyAdapter = class {
|
|
|
190
190
|
await this.providerPromise;
|
|
191
191
|
}
|
|
192
192
|
if (!this.provider) {
|
|
193
|
-
|
|
193
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Rabby is not available");
|
|
194
194
|
throw new Error("Rabby is not available");
|
|
195
195
|
}
|
|
196
196
|
await this.provider.request({
|
|
@@ -202,7 +202,7 @@ var RabbyAdapter = class {
|
|
|
202
202
|
params: []
|
|
203
203
|
});
|
|
204
204
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
205
|
-
|
|
205
|
+
_chunkJXTTDJRMjs.sentryLogger.error("No accounts returned from Rabby");
|
|
206
206
|
throw new Error("No accounts returned from Rabby");
|
|
207
207
|
}
|
|
208
208
|
return {
|
|
@@ -336,7 +336,7 @@ var BraveAdapter = class {
|
|
|
336
336
|
await this.providerPromise;
|
|
337
337
|
}
|
|
338
338
|
if (!this.provider) {
|
|
339
|
-
|
|
339
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Brave Wallet is not available");
|
|
340
340
|
throw new Error("Brave Wallet is not available");
|
|
341
341
|
}
|
|
342
342
|
await this.provider.request({
|
|
@@ -348,7 +348,7 @@ var BraveAdapter = class {
|
|
|
348
348
|
params: []
|
|
349
349
|
});
|
|
350
350
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
351
|
-
|
|
351
|
+
_chunkJXTTDJRMjs.sentryLogger.error("No accounts returned from Brave Wallet");
|
|
352
352
|
throw new Error("No accounts returned from Brave Wallet");
|
|
353
353
|
}
|
|
354
354
|
return {
|
|
@@ -475,7 +475,7 @@ var PhantomAdapter = class {
|
|
|
475
475
|
await this.providerPromise;
|
|
476
476
|
}
|
|
477
477
|
if (!this.provider) {
|
|
478
|
-
|
|
478
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Phantom is not available");
|
|
479
479
|
throw new Error("Phantom is not available");
|
|
480
480
|
}
|
|
481
481
|
await this.provider.request({
|
|
@@ -487,7 +487,7 @@ var PhantomAdapter = class {
|
|
|
487
487
|
params: []
|
|
488
488
|
});
|
|
489
489
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
490
|
-
|
|
490
|
+
_chunkJXTTDJRMjs.sentryLogger.error("No accounts returned from Phantom");
|
|
491
491
|
throw new Error("No accounts returned from Phantom");
|
|
492
492
|
}
|
|
493
493
|
return {
|
|
@@ -543,7 +543,6 @@ var PhantomAdapter = class {
|
|
|
543
543
|
};
|
|
544
544
|
|
|
545
545
|
// src/wallet-adapters/CoinbaseWalletAdapter.ts
|
|
546
|
-
var _walletsdk = require('@coinbase/wallet-sdk');
|
|
547
546
|
|
|
548
547
|
|
|
549
548
|
var CoinbaseWalletAdapter = class {
|
|
@@ -556,35 +555,40 @@ var CoinbaseWalletAdapter = class {
|
|
|
556
555
|
this.wcDeepLinkUrl = "cbwallet://wc?uri=";
|
|
557
556
|
this.provider = null;
|
|
558
557
|
this.accountsChangedCallback = null;
|
|
559
|
-
this.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
558
|
+
this.initPromise = null;
|
|
559
|
+
this.config = { appName, appLogoUrl, telemetry: _nullishCoalesce(telemetry, () => ( false)) };
|
|
560
|
+
}
|
|
561
|
+
async ensureInitialized() {
|
|
562
|
+
if (this.provider) return;
|
|
563
|
+
if (!this.initPromise) {
|
|
564
|
+
this.initPromise = this.initializeProvider();
|
|
565
|
+
}
|
|
566
|
+
await this.initPromise;
|
|
567
|
+
}
|
|
568
|
+
async initializeProvider() {
|
|
569
|
+
if (typeof window === "undefined") return;
|
|
567
570
|
try {
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
+
const { createCoinbaseWalletSDK } = await Promise.resolve().then(() => _interopRequireWildcard(require("@coinbase/wallet-sdk")));
|
|
572
|
+
const coinbaseSdk = createCoinbaseWalletSDK({
|
|
573
|
+
appName: this.config.appName,
|
|
574
|
+
appLogoUrl: this.config.appLogoUrl,
|
|
571
575
|
preference: {
|
|
572
576
|
options: "all",
|
|
573
|
-
telemetry
|
|
577
|
+
telemetry: this.config.telemetry
|
|
574
578
|
}
|
|
575
579
|
});
|
|
576
|
-
|
|
580
|
+
this.provider = coinbaseSdk.getProvider();
|
|
577
581
|
} catch (error) {
|
|
578
|
-
|
|
579
|
-
return null;
|
|
582
|
+
_chunkJXTTDJRMjs.sentryLogger.warn("Failed to initialize Coinbase Wallet provider", { error });
|
|
580
583
|
}
|
|
581
584
|
}
|
|
582
585
|
isInstalled() {
|
|
583
|
-
return
|
|
586
|
+
return true;
|
|
584
587
|
}
|
|
585
588
|
async connect() {
|
|
586
|
-
|
|
587
|
-
|
|
589
|
+
await this.ensureInitialized();
|
|
590
|
+
if (!this.provider) {
|
|
591
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Coinbase Wallet is not available");
|
|
588
592
|
throw new Error("Coinbase Wallet is not available");
|
|
589
593
|
}
|
|
590
594
|
const accounts = await this.provider.request({
|
|
@@ -592,7 +596,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
592
596
|
params: []
|
|
593
597
|
});
|
|
594
598
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
595
|
-
|
|
599
|
+
_chunkJXTTDJRMjs.sentryLogger.error("No accounts returned from Coinbase Wallet");
|
|
596
600
|
throw new Error("No accounts returned from Coinbase Wallet");
|
|
597
601
|
}
|
|
598
602
|
return {
|
|
@@ -602,7 +606,8 @@ var CoinbaseWalletAdapter = class {
|
|
|
602
606
|
};
|
|
603
607
|
}
|
|
604
608
|
async tryRestoreConnection() {
|
|
605
|
-
|
|
609
|
+
await this.ensureInitialized();
|
|
610
|
+
if (!this.provider) {
|
|
606
611
|
return null;
|
|
607
612
|
}
|
|
608
613
|
try {
|
|
@@ -623,14 +628,15 @@ var CoinbaseWalletAdapter = class {
|
|
|
623
628
|
}
|
|
624
629
|
}
|
|
625
630
|
async disconnect() {
|
|
631
|
+
if (!this.provider) return;
|
|
626
632
|
try {
|
|
627
|
-
if (
|
|
633
|
+
if (this.provider.close) {
|
|
628
634
|
await this.provider.close();
|
|
629
|
-
} else if (
|
|
635
|
+
} else if (this.provider.disconnect) {
|
|
630
636
|
await this.provider.disconnect();
|
|
631
637
|
}
|
|
632
638
|
} catch (error) {
|
|
633
|
-
|
|
639
|
+
_chunkJXTTDJRMjs.sentryLogger.warn("Error disconnecting from Coinbase Wallet", { error });
|
|
634
640
|
} finally {
|
|
635
641
|
this.clearLocalStorage();
|
|
636
642
|
}
|
|
@@ -654,15 +660,15 @@ var CoinbaseWalletAdapter = class {
|
|
|
654
660
|
// Called by Aurum when user connects wallet
|
|
655
661
|
// Passes Aurum.ts --> syncStateFromAccountsChanged() to handle the provider accounts changed event
|
|
656
662
|
onAccountsChanged(callback) {
|
|
657
|
-
if (!_optionalChain([this, 'access',
|
|
663
|
+
if (!_optionalChain([this, 'access', _47 => _47.provider, 'optionalAccess', _48 => _48.on])) return;
|
|
658
664
|
if (this.accountsChangedCallback) {
|
|
659
|
-
_optionalChain([this, 'access',
|
|
665
|
+
_optionalChain([this, 'access', _49 => _49.provider, 'access', _50 => _50.removeListener, 'optionalCall', _51 => _51("accountsChanged", this.accountsChangedCallback)]);
|
|
660
666
|
}
|
|
661
667
|
this.accountsChangedCallback = callback;
|
|
662
668
|
this.provider.on("accountsChanged", this.accountsChangedCallback);
|
|
663
669
|
}
|
|
664
670
|
removeListeners() {
|
|
665
|
-
if (!_optionalChain([this, 'access',
|
|
671
|
+
if (!_optionalChain([this, 'access', _52 => _52.provider, 'optionalAccess', _53 => _53.removeListener]) || !this.accountsChangedCallback) return;
|
|
666
672
|
this.provider.removeListener("accountsChanged", this.accountsChangedCallback);
|
|
667
673
|
this.accountsChangedCallback = null;
|
|
668
674
|
}
|
|
@@ -724,7 +730,7 @@ var MetaMaskAdapter = class {
|
|
|
724
730
|
detectLegacyProvider() {
|
|
725
731
|
const ethereum = window.ethereum;
|
|
726
732
|
if (!ethereum) return null;
|
|
727
|
-
if (_optionalChain([ethereum, 'access',
|
|
733
|
+
if (_optionalChain([ethereum, 'access', _54 => _54.providers, 'optionalAccess', _55 => _55.length])) {
|
|
728
734
|
const metaMaskProvider = ethereum.providers.find((p) => p.isMetaMask && !p.isBraveWallet);
|
|
729
735
|
if (metaMaskProvider) return metaMaskProvider;
|
|
730
736
|
}
|
|
@@ -741,7 +747,7 @@ var MetaMaskAdapter = class {
|
|
|
741
747
|
await this.providerPromise;
|
|
742
748
|
}
|
|
743
749
|
if (!this.provider) {
|
|
744
|
-
|
|
750
|
+
_chunkJXTTDJRMjs.sentryLogger.error("MetaMask is not available");
|
|
745
751
|
throw new Error("MetaMask is not available");
|
|
746
752
|
}
|
|
747
753
|
await this.provider.request({
|
|
@@ -753,7 +759,7 @@ var MetaMaskAdapter = class {
|
|
|
753
759
|
params: []
|
|
754
760
|
});
|
|
755
761
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
756
|
-
|
|
762
|
+
_chunkJXTTDJRMjs.sentryLogger.error("No accounts returned from MetaMask");
|
|
757
763
|
throw new Error("No accounts returned from MetaMask");
|
|
758
764
|
}
|
|
759
765
|
return {
|
|
@@ -794,15 +800,15 @@ var MetaMaskAdapter = class {
|
|
|
794
800
|
// Called by Aurum when user connects wallet
|
|
795
801
|
// Passes Aurum.ts --> syncStateFromAccountsChanged() to handle the provider accounts changed event
|
|
796
802
|
onAccountsChanged(callback) {
|
|
797
|
-
if (!_optionalChain([this, 'access',
|
|
803
|
+
if (!_optionalChain([this, 'access', _56 => _56.provider, 'optionalAccess', _57 => _57.on])) return;
|
|
798
804
|
if (this.accountsChangedCallback) {
|
|
799
|
-
_optionalChain([this, 'access',
|
|
805
|
+
_optionalChain([this, 'access', _58 => _58.provider, 'access', _59 => _59.removeListener, 'optionalCall', _60 => _60("accountsChanged", this.accountsChangedCallback)]);
|
|
800
806
|
}
|
|
801
807
|
this.accountsChangedCallback = callback;
|
|
802
808
|
this.provider.on("accountsChanged", this.accountsChangedCallback);
|
|
803
809
|
}
|
|
804
810
|
removeListeners() {
|
|
805
|
-
if (!_optionalChain([this, 'access',
|
|
811
|
+
if (!_optionalChain([this, 'access', _61 => _61.provider, 'optionalAccess', _62 => _62.removeListener]) || !this.accountsChangedCallback) return;
|
|
806
812
|
this.provider.removeListener("accountsChanged", this.accountsChangedCallback);
|
|
807
813
|
this.accountsChangedCallback = null;
|
|
808
814
|
}
|
|
@@ -899,9 +905,9 @@ var WALLETCONNECT_NAMESPACE = {
|
|
|
899
905
|
|
|
900
906
|
// src/wallet-adapters/WalletConnectAdapter.ts
|
|
901
907
|
function extractAddressFromSession(namespaces) {
|
|
902
|
-
const accounts = _optionalChain([namespaces, 'optionalAccess',
|
|
908
|
+
const accounts = _optionalChain([namespaces, 'optionalAccess', _63 => _63.eip155, 'optionalAccess', _64 => _64.accounts]) || [];
|
|
903
909
|
const firstAccount = accounts[0];
|
|
904
|
-
return _nullishCoalesce(_optionalChain([firstAccount, 'optionalAccess',
|
|
910
|
+
return _nullishCoalesce(_optionalChain([firstAccount, 'optionalAccess', _65 => _65.split, 'call', _66 => _66(":"), 'access', _67 => _67[2]]), () => ( null));
|
|
905
911
|
}
|
|
906
912
|
var WalletConnectAdapter = class {
|
|
907
913
|
constructor(config) {
|
|
@@ -1012,11 +1018,11 @@ var WalletConnectAdapter = class {
|
|
|
1012
1018
|
}
|
|
1013
1019
|
}
|
|
1014
1020
|
syncAddressFromWagmi() {
|
|
1015
|
-
if (!_optionalChain([this, 'access',
|
|
1021
|
+
if (!_optionalChain([this, 'access', _68 => _68.wagmiAdapter, 'optionalAccess', _69 => _69.wagmiConfig])) return;
|
|
1016
1022
|
const { state } = this.wagmiAdapter.wagmiConfig;
|
|
1017
1023
|
if (state.current && state.connections) {
|
|
1018
1024
|
const connection = state.connections.get(state.current);
|
|
1019
|
-
if (_optionalChain([connection, 'optionalAccess',
|
|
1025
|
+
if (_optionalChain([connection, 'optionalAccess', _70 => _70.accounts, 'optionalAccess', _71 => _71[0]])) {
|
|
1020
1026
|
this.address = connection.accounts[0];
|
|
1021
1027
|
}
|
|
1022
1028
|
}
|
|
@@ -1027,17 +1033,17 @@ var WalletConnectAdapter = class {
|
|
|
1027
1033
|
const getProvidersFn = this.modal.getProviders;
|
|
1028
1034
|
if (typeof getProvidersFn === "function") {
|
|
1029
1035
|
const providers = getProvidersFn.call(this.modal);
|
|
1030
|
-
const eip155Provider = _optionalChain([providers, 'optionalAccess',
|
|
1036
|
+
const eip155Provider = _optionalChain([providers, 'optionalAccess', _72 => _72["eip155"]]);
|
|
1031
1037
|
if (eip155Provider) {
|
|
1032
1038
|
this.provider = eip155Provider;
|
|
1033
1039
|
return;
|
|
1034
1040
|
}
|
|
1035
1041
|
}
|
|
1036
|
-
if (_optionalChain([this, 'access',
|
|
1042
|
+
if (_optionalChain([this, 'access', _73 => _73.wagmiAdapter, 'optionalAccess', _74 => _74.wagmiConfig])) {
|
|
1037
1043
|
const { state } = this.wagmiAdapter.wagmiConfig;
|
|
1038
1044
|
if (state.current && state.connections) {
|
|
1039
1045
|
const connection = state.connections.get(state.current);
|
|
1040
|
-
const connector = _optionalChain([connection, 'optionalAccess',
|
|
1046
|
+
const connector = _optionalChain([connection, 'optionalAccess', _75 => _75.connector]);
|
|
1041
1047
|
if (connector && typeof connector.getProvider === "function") {
|
|
1042
1048
|
try {
|
|
1043
1049
|
const provider = await connector.getProvider();
|
|
@@ -1045,13 +1051,13 @@ var WalletConnectAdapter = class {
|
|
|
1045
1051
|
this.provider = provider;
|
|
1046
1052
|
}
|
|
1047
1053
|
} catch (error) {
|
|
1048
|
-
|
|
1054
|
+
_chunkJXTTDJRMjs.sentryLogger.warn("Failed to get provider from wagmi connector", { error });
|
|
1049
1055
|
}
|
|
1050
1056
|
}
|
|
1051
1057
|
}
|
|
1052
1058
|
}
|
|
1053
1059
|
} catch (error) {
|
|
1054
|
-
|
|
1060
|
+
_chunkJXTTDJRMjs.sentryLogger.warn("Failed to get provider from WalletConnect", { error });
|
|
1055
1061
|
}
|
|
1056
1062
|
}
|
|
1057
1063
|
isInstalled() {
|
|
@@ -1067,20 +1073,20 @@ var WalletConnectAdapter = class {
|
|
|
1067
1073
|
this.lastKnownAccounts = [];
|
|
1068
1074
|
this.lastKnownChainId = null;
|
|
1069
1075
|
try {
|
|
1070
|
-
const { state } = _optionalChain([this, 'access',
|
|
1071
|
-
const connection = _optionalChain([state, 'optionalAccess',
|
|
1072
|
-
if (connection && typeof connection !== "string" && _optionalChain([connection, 'access',
|
|
1076
|
+
const { state } = _optionalChain([this, 'access', _76 => _76.wagmiAdapter, 'optionalAccess', _77 => _77.wagmiConfig]) || {};
|
|
1077
|
+
const connection = _optionalChain([state, 'optionalAccess', _78 => _78.current]) && _optionalChain([state, 'access', _79 => _79.connections, 'optionalAccess', _80 => _80.get, 'call', _81 => _81(state.current)]);
|
|
1078
|
+
if (connection && typeof connection !== "string" && _optionalChain([connection, 'access', _82 => _82.connector, 'optionalAccess', _83 => _83.disconnect])) {
|
|
1073
1079
|
await connection.connector.disconnect();
|
|
1074
1080
|
}
|
|
1075
1081
|
} catch (e6) {
|
|
1076
1082
|
}
|
|
1077
|
-
if (_optionalChain([this, 'access',
|
|
1083
|
+
if (_optionalChain([this, 'access', _84 => _84.modal, 'optionalAccess', _85 => _85.getIsConnectedState, 'call', _86 => _86()])) {
|
|
1078
1084
|
try {
|
|
1079
1085
|
await this.modal.disconnect("eip155");
|
|
1080
1086
|
} catch (e7) {
|
|
1081
1087
|
}
|
|
1082
1088
|
}
|
|
1083
|
-
if (_optionalChain([this, 'access',
|
|
1089
|
+
if (_optionalChain([this, 'access', _87 => _87.universalProvider, 'optionalAccess', _88 => _88.session])) {
|
|
1084
1090
|
try {
|
|
1085
1091
|
await this.universalProvider.disconnect();
|
|
1086
1092
|
} catch (e8) {
|
|
@@ -1094,7 +1100,7 @@ var WalletConnectAdapter = class {
|
|
|
1094
1100
|
* Emits walletconnect:uri event for QR code display.
|
|
1095
1101
|
*/
|
|
1096
1102
|
async connect() {
|
|
1097
|
-
if (!this.config.projectId) throw
|
|
1103
|
+
if (!this.config.projectId) throw _chunkJXTTDJRMjs.createConfigError.call(void 0, "WalletConnect");
|
|
1098
1104
|
await this.ensureInitialized();
|
|
1099
1105
|
if (!this.universalProvider) throw new Error("WalletConnect is not available");
|
|
1100
1106
|
await this.resetConnectionState();
|
|
@@ -1157,7 +1163,7 @@ var WalletConnectAdapter = class {
|
|
|
1157
1163
|
* Used on mobile and when user clicks "Open Modal" button.
|
|
1158
1164
|
*/
|
|
1159
1165
|
async openModal() {
|
|
1160
|
-
if (!this.config.projectId) throw
|
|
1166
|
+
if (!this.config.projectId) throw _chunkJXTTDJRMjs.createConfigError.call(void 0, "WalletConnect");
|
|
1161
1167
|
await this.ensureInitialized();
|
|
1162
1168
|
if (!this.modal) throw new Error("AppKit is not available");
|
|
1163
1169
|
await this.resetConnectionState();
|
|
@@ -1169,7 +1175,7 @@ var WalletConnectAdapter = class {
|
|
|
1169
1175
|
const startTime = Date.now();
|
|
1170
1176
|
let unsubscribe = null;
|
|
1171
1177
|
let resolved = false;
|
|
1172
|
-
const cleanup = () => _optionalChain([unsubscribe, 'optionalCall',
|
|
1178
|
+
const cleanup = () => _optionalChain([unsubscribe, 'optionalCall', _89 => _89()]);
|
|
1173
1179
|
const checkConnection = async () => {
|
|
1174
1180
|
if (resolved) return true;
|
|
1175
1181
|
this.syncAddressFromWagmi();
|
|
@@ -1177,10 +1183,10 @@ var WalletConnectAdapter = class {
|
|
|
1177
1183
|
if (this.provider && this.address) {
|
|
1178
1184
|
try {
|
|
1179
1185
|
const accounts = await this.provider.request({ method: "eth_accounts" });
|
|
1180
|
-
if (_optionalChain([accounts, 'optionalAccess',
|
|
1186
|
+
if (_optionalChain([accounts, 'optionalAccess', _90 => _90.length])) {
|
|
1181
1187
|
resolved = true;
|
|
1182
1188
|
cleanup();
|
|
1183
|
-
_optionalChain([this, 'access',
|
|
1189
|
+
_optionalChain([this, 'access', _91 => _91.modal, 'optionalAccess', _92 => _92.close, 'call', _93 => _93()]);
|
|
1184
1190
|
this.lastKnownAccounts = accounts;
|
|
1185
1191
|
resolve({ address: this.address, provider: this.provider, walletId: this.id });
|
|
1186
1192
|
return true;
|
|
@@ -1215,9 +1221,9 @@ var WalletConnectAdapter = class {
|
|
|
1215
1221
|
try {
|
|
1216
1222
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
1217
1223
|
const { state } = this.wagmiAdapter.wagmiConfig || {};
|
|
1218
|
-
const connection = _optionalChain([state, 'optionalAccess',
|
|
1224
|
+
const connection = _optionalChain([state, 'optionalAccess', _94 => _94.current]) && _optionalChain([state, 'access', _95 => _95.connections, 'optionalAccess', _96 => _96.get, 'call', _97 => _97(state.current)]);
|
|
1219
1225
|
if (!connection || typeof connection === "string") return null;
|
|
1220
|
-
const address = _optionalChain([connection, 'access',
|
|
1226
|
+
const address = _optionalChain([connection, 'access', _98 => _98.accounts, 'optionalAccess', _99 => _99[0]]);
|
|
1221
1227
|
if (address && this.provider) {
|
|
1222
1228
|
this.address = address;
|
|
1223
1229
|
this.lastKnownAccounts = [...connection.accounts || []];
|
|
@@ -1246,10 +1252,10 @@ var WalletConnectAdapter = class {
|
|
|
1246
1252
|
return this.provider;
|
|
1247
1253
|
}
|
|
1248
1254
|
onAccountsChanged(callback) {
|
|
1249
|
-
if (this.accountsChangedCallback && _optionalChain([this, 'access',
|
|
1255
|
+
if (this.accountsChangedCallback && _optionalChain([this, 'access', _100 => _100.provider, 'optionalAccess', _101 => _101.removeListener])) {
|
|
1250
1256
|
this.provider.removeListener("accountsChanged", this.accountsChangedCallback);
|
|
1251
1257
|
}
|
|
1252
|
-
if (this.sessionUpdateHandler && _optionalChain([this, 'access',
|
|
1258
|
+
if (this.sessionUpdateHandler && _optionalChain([this, 'access', _102 => _102.universalProvider, 'optionalAccess', _103 => _103.removeListener])) {
|
|
1253
1259
|
this.universalProvider.removeListener("session_update", this.sessionUpdateHandler);
|
|
1254
1260
|
}
|
|
1255
1261
|
if (!this.lastKnownAccounts.length && this.address) this.lastKnownAccounts = [this.address];
|
|
@@ -1258,12 +1264,12 @@ var WalletConnectAdapter = class {
|
|
|
1258
1264
|
this.lastKnownAccounts = accounts;
|
|
1259
1265
|
callback(accounts);
|
|
1260
1266
|
};
|
|
1261
|
-
if (_optionalChain([this, 'access',
|
|
1267
|
+
if (_optionalChain([this, 'access', _104 => _104.provider, 'optionalAccess', _105 => _105.on])) {
|
|
1262
1268
|
this.provider.on("accountsChanged", this.accountsChangedCallback);
|
|
1263
1269
|
}
|
|
1264
|
-
if (_optionalChain([this, 'access',
|
|
1270
|
+
if (_optionalChain([this, 'access', _106 => _106.universalProvider, 'optionalAccess', _107 => _107.on])) {
|
|
1265
1271
|
this.sessionUpdateHandler = (args) => {
|
|
1266
|
-
const accounts = this.extractAccountsFromNamespaces(_optionalChain([args, 'optionalAccess',
|
|
1272
|
+
const accounts = this.extractAccountsFromNamespaces(_optionalChain([args, 'optionalAccess', _108 => _108.params, 'optionalAccess', _109 => _109.namespaces]));
|
|
1267
1273
|
if (accounts.length && this.hasAccountsChanged(accounts)) {
|
|
1268
1274
|
this.lastKnownAccounts = accounts;
|
|
1269
1275
|
this.address = accounts[0];
|
|
@@ -1274,8 +1280,8 @@ var WalletConnectAdapter = class {
|
|
|
1274
1280
|
}
|
|
1275
1281
|
}
|
|
1276
1282
|
onChainChanged(callback) {
|
|
1277
|
-
if (!_optionalChain([this, 'access',
|
|
1278
|
-
if (this.chainChangedCallback) _optionalChain([this, 'access',
|
|
1283
|
+
if (!_optionalChain([this, 'access', _110 => _110.provider, 'optionalAccess', _111 => _111.on])) return;
|
|
1284
|
+
if (this.chainChangedCallback) _optionalChain([this, 'access', _112 => _112.provider, 'access', _113 => _113.removeListener, 'optionalCall', _114 => _114("chainChanged", this.chainChangedCallback)]);
|
|
1279
1285
|
this.chainChangedCallback = (chainId) => {
|
|
1280
1286
|
const normalized = typeof chainId === "string" ? chainId : `0x${Number(chainId).toString(16)}`;
|
|
1281
1287
|
if (normalized !== this.lastKnownChainId) {
|
|
@@ -1300,7 +1306,7 @@ var WalletConnectAdapter = class {
|
|
|
1300
1306
|
if (!namespaces) return [];
|
|
1301
1307
|
const accounts = [];
|
|
1302
1308
|
Object.values(namespaces).forEach((ns) => {
|
|
1303
|
-
_optionalChain([ns, 'optionalAccess',
|
|
1309
|
+
_optionalChain([ns, 'optionalAccess', _115 => _115.accounts, 'optionalAccess', _116 => _116.forEach, 'call', _117 => _117((account) => {
|
|
1304
1310
|
const address = account.split(":")[2];
|
|
1305
1311
|
if (address) accounts.push(address);
|
|
1306
1312
|
})]);
|
|
@@ -1309,19 +1315,19 @@ var WalletConnectAdapter = class {
|
|
|
1309
1315
|
}
|
|
1310
1316
|
hasAccountsChanged(newAccounts) {
|
|
1311
1317
|
if (newAccounts.length !== this.lastKnownAccounts.length) return true;
|
|
1312
|
-
return newAccounts.some((acc, i) => acc.toLowerCase() !== _optionalChain([this, 'access',
|
|
1318
|
+
return newAccounts.some((acc, i) => acc.toLowerCase() !== _optionalChain([this, 'access', _118 => _118.lastKnownAccounts, 'access', _119 => _119[i], 'optionalAccess', _120 => _120.toLowerCase, 'call', _121 => _121()]));
|
|
1313
1319
|
}
|
|
1314
1320
|
removeListeners() {
|
|
1315
1321
|
if (this.accountsChangedCallback) {
|
|
1316
|
-
_optionalChain([this, 'access',
|
|
1322
|
+
_optionalChain([this, 'access', _122 => _122.provider, 'optionalAccess', _123 => _123.removeListener, 'optionalCall', _124 => _124("accountsChanged", this.accountsChangedCallback)]);
|
|
1317
1323
|
this.accountsChangedCallback = null;
|
|
1318
1324
|
}
|
|
1319
1325
|
if (this.chainChangedCallback) {
|
|
1320
|
-
_optionalChain([this, 'access',
|
|
1326
|
+
_optionalChain([this, 'access', _125 => _125.provider, 'optionalAccess', _126 => _126.removeListener, 'optionalCall', _127 => _127("chainChanged", this.chainChangedCallback)]);
|
|
1321
1327
|
this.chainChangedCallback = null;
|
|
1322
1328
|
}
|
|
1323
1329
|
if (this.sessionUpdateHandler) {
|
|
1324
|
-
_optionalChain([this, 'access',
|
|
1330
|
+
_optionalChain([this, 'access', _128 => _128.universalProvider, 'optionalAccess', _129 => _129.removeListener, 'optionalCall', _130 => _130("session_update", this.sessionUpdateHandler)]);
|
|
1325
1331
|
this.sessionUpdateHandler = null;
|
|
1326
1332
|
}
|
|
1327
1333
|
this.disconnectCallback = null;
|
|
@@ -1346,8 +1352,8 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1346
1352
|
this.provider = null;
|
|
1347
1353
|
this.initPromise = null;
|
|
1348
1354
|
this.publicClientCache = /* @__PURE__ */ new Map();
|
|
1349
|
-
this.projectId = _optionalChain([config, 'optionalAccess',
|
|
1350
|
-
this.telemetry = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1355
|
+
this.projectId = _optionalChain([config, 'optionalAccess', _131 => _131.projectId]) || "";
|
|
1356
|
+
this.telemetry = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _132 => _132.telemetry]), () => ( false));
|
|
1351
1357
|
}
|
|
1352
1358
|
async ensureInitialized() {
|
|
1353
1359
|
if (this.provider) return;
|
|
@@ -1361,21 +1367,16 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1361
1367
|
}
|
|
1362
1368
|
async emailAuthStart(email) {
|
|
1363
1369
|
if (!this.projectId) {
|
|
1364
|
-
throw
|
|
1370
|
+
throw _chunkJXTTDJRMjs.createConfigError.call(void 0, "Email");
|
|
1365
1371
|
}
|
|
1366
1372
|
await this.ensureInitialized();
|
|
1367
1373
|
if (!this.provider) {
|
|
1368
|
-
|
|
1374
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Email is not available");
|
|
1369
1375
|
throw new Error("Email is not available");
|
|
1370
1376
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
return authResult;
|
|
1375
|
-
} catch (error) {
|
|
1376
|
-
_chunkMHRKTE55js.sentryLogger.error("Failed to start email authentication", { error });
|
|
1377
|
-
throw error;
|
|
1378
|
-
}
|
|
1377
|
+
const { signInWithEmail } = await Promise.resolve().then(() => _interopRequireWildcard(require("@coinbase/cdp-core")));
|
|
1378
|
+
const authResult = await signInWithEmail({ email });
|
|
1379
|
+
return authResult;
|
|
1379
1380
|
}
|
|
1380
1381
|
async emailAuthVerify(flowId, otp) {
|
|
1381
1382
|
if (!flowId || !otp) {
|
|
@@ -1383,14 +1384,14 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1383
1384
|
}
|
|
1384
1385
|
await this.ensureInitialized();
|
|
1385
1386
|
if (!this.provider) {
|
|
1386
|
-
|
|
1387
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Email provider not initialized");
|
|
1387
1388
|
throw new Error("Email provider not initialized");
|
|
1388
1389
|
}
|
|
1389
1390
|
const { verifyEmailOTP } = await Promise.resolve().then(() => _interopRequireWildcard(require("@coinbase/cdp-core")));
|
|
1390
1391
|
return verifyEmailOTP({ flowId, otp });
|
|
1391
1392
|
}
|
|
1392
1393
|
async connect() {
|
|
1393
|
-
|
|
1394
|
+
_chunkJXTTDJRMjs.sentryLogger.error("EmailAdapter.connect() is not implemented");
|
|
1394
1395
|
throw new Error("EmailAdapter.connect() is not implemented");
|
|
1395
1396
|
}
|
|
1396
1397
|
async tryRestoreConnection() {
|
|
@@ -1495,15 +1496,15 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1495
1496
|
try {
|
|
1496
1497
|
return await base.request(args);
|
|
1497
1498
|
} catch (err) {
|
|
1498
|
-
const msg = String(_optionalChain([err, 'optionalAccess',
|
|
1499
|
-
const isUnsupported = msg.includes("not supported") || msg.includes("Unsupported") || _optionalChain([err, 'optionalAccess',
|
|
1499
|
+
const msg = String(_optionalChain([err, 'optionalAccess', _133 => _133.message]) || "");
|
|
1500
|
+
const isUnsupported = msg.includes("not supported") || msg.includes("Unsupported") || _optionalChain([err, 'optionalAccess', _134 => _134.code]) === -32601;
|
|
1500
1501
|
if (isUnsupported) {
|
|
1501
1502
|
let chainId;
|
|
1502
1503
|
try {
|
|
1503
1504
|
const chainIdHex = await base.request({ method: "eth_chainId", params: [] });
|
|
1504
1505
|
chainId = parseInt(chainIdHex, 16);
|
|
1505
1506
|
} catch (e13) {
|
|
1506
|
-
|
|
1507
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Failed to get chainId for fallback request");
|
|
1507
1508
|
throw new Error("Failed to get chainId for fallback request");
|
|
1508
1509
|
}
|
|
1509
1510
|
const publicClient = await getPublicClient(chainId);
|
|
@@ -1518,7 +1519,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1518
1519
|
};
|
|
1519
1520
|
return wrapped;
|
|
1520
1521
|
} catch (error) {
|
|
1521
|
-
|
|
1522
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Failed to initialize Email provider", { error });
|
|
1522
1523
|
return null;
|
|
1523
1524
|
}
|
|
1524
1525
|
}
|
|
@@ -1544,10 +1545,10 @@ function createWalletAdapters({
|
|
|
1544
1545
|
telemetry
|
|
1545
1546
|
}) {
|
|
1546
1547
|
return [
|
|
1547
|
-
new EmailAdapter({ projectId: _optionalChain([walletsConfig, 'optionalAccess',
|
|
1548
|
+
new EmailAdapter({ projectId: _optionalChain([walletsConfig, 'optionalAccess', _135 => _135.embedded, 'optionalAccess', _136 => _136.projectId]), telemetry }),
|
|
1548
1549
|
new MetaMaskAdapter(),
|
|
1549
1550
|
new WalletConnectAdapter({
|
|
1550
|
-
projectId: _optionalChain([walletsConfig, 'optionalAccess',
|
|
1551
|
+
projectId: _optionalChain([walletsConfig, 'optionalAccess', _137 => _137.walletConnect, 'optionalAccess', _138 => _138.projectId]),
|
|
1551
1552
|
appName,
|
|
1552
1553
|
modalZIndex,
|
|
1553
1554
|
theme,
|
|
@@ -1647,9 +1648,9 @@ var _AurumCore = class _AurumCore {
|
|
|
1647
1648
|
return _AurumCore.instance;
|
|
1648
1649
|
}
|
|
1649
1650
|
const telemetryEnabled = config.telemetry !== false;
|
|
1650
|
-
|
|
1651
|
+
_chunkJXTTDJRMjs.initSentry.call(void 0, telemetryEnabled);
|
|
1651
1652
|
this.brandConfig = this.resolveBrandConfig(config);
|
|
1652
|
-
this.excludedWallets = new Set(_nullishCoalesce(_optionalChain([config, 'access',
|
|
1653
|
+
this.excludedWallets = new Set(_nullishCoalesce(_optionalChain([config, 'access', _139 => _139.wallets, 'optionalAccess', _140 => _140.exclude]), () => ( [])));
|
|
1653
1654
|
this.wallets = createWalletAdapters({
|
|
1654
1655
|
walletsConfig: config.wallets,
|
|
1655
1656
|
appName: this.brandConfig.appName,
|
|
@@ -1686,7 +1687,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1686
1687
|
if (walletId === "email") {
|
|
1687
1688
|
throw new Error("Use emailAuthStart() and emailAuthVerify() for email wallet connections");
|
|
1688
1689
|
}
|
|
1689
|
-
if (_optionalChain([this, 'access',
|
|
1690
|
+
if (_optionalChain([this, 'access', _141 => _141.userInfo, 'optionalAccess', _142 => _142.publicAddress]) && _optionalChain([this, 'access', _143 => _143.connectedWalletAdapter, 'optionalAccess', _144 => _144.getProvider, 'call', _145 => _145()])) {
|
|
1690
1691
|
if (!walletId || this.userInfo.walletId === walletId) {
|
|
1691
1692
|
return this.userInfo.publicAddress;
|
|
1692
1693
|
}
|
|
@@ -1714,19 +1715,19 @@ var _AurumCore = class _AurumCore {
|
|
|
1714
1715
|
const displayedWallets = this.wallets.filter((w) => !this.excludedWallets.has(w.id));
|
|
1715
1716
|
const modalResult = await renderConnectModal({ displayedWallets, brandConfig: this.brandConfig });
|
|
1716
1717
|
if (!modalResult) {
|
|
1717
|
-
|
|
1718
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Missing modal result");
|
|
1718
1719
|
throw new Error("Missing modal result");
|
|
1719
1720
|
}
|
|
1720
1721
|
adapter = this.wallets.find((w) => w.id === modalResult.walletId) || null;
|
|
1721
1722
|
if (!adapter) {
|
|
1722
|
-
|
|
1723
|
+
_chunkJXTTDJRMjs.sentryLogger.error(`Selected wallet adapter not found: ${modalResult.walletId}`);
|
|
1723
1724
|
throw new Error("Selected wallet adapter not found");
|
|
1724
1725
|
}
|
|
1725
1726
|
result = modalResult;
|
|
1726
1727
|
}
|
|
1727
1728
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1728
1729
|
if (!provider) {
|
|
1729
|
-
|
|
1730
|
+
_chunkJXTTDJRMjs.sentryLogger.error(`Error fetching provider on login: ${adapter.id}`);
|
|
1730
1731
|
throw new Error("Error fetching provider. Please try again.");
|
|
1731
1732
|
}
|
|
1732
1733
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1743,7 +1744,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1743
1744
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1744
1745
|
this.emitConnect(chainId);
|
|
1745
1746
|
this.emitAccountsChanged([checksumAdr]);
|
|
1746
|
-
|
|
1747
|
+
_chunkJXTTDJRMjs.sentryLogger.info(`Wallet connected: ${adapter.id} (${walletId ? "headless" : "modal"})`);
|
|
1747
1748
|
return checksumAdr;
|
|
1748
1749
|
}
|
|
1749
1750
|
async disconnect() {
|
|
@@ -1763,7 +1764,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1763
1764
|
async isConnected() {
|
|
1764
1765
|
await this.whenReady();
|
|
1765
1766
|
return Boolean(
|
|
1766
|
-
_optionalChain([this, 'access',
|
|
1767
|
+
_optionalChain([this, 'access', _146 => _146.userInfo, 'optionalAccess', _147 => _147.publicAddress]) && _optionalChain([this, 'access', _148 => _148.userInfo, 'optionalAccess', _149 => _149.walletName]) && _optionalChain([this, 'access', _150 => _150.connectedWalletAdapter, 'optionalAccess', _151 => _151.getProvider, 'call', _152 => _152()])
|
|
1767
1768
|
);
|
|
1768
1769
|
}
|
|
1769
1770
|
async handleWidgetConnection(result) {
|
|
@@ -1772,7 +1773,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1772
1773
|
if (!adapter) throw new Error("Selected wallet adapter not found");
|
|
1773
1774
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1774
1775
|
if (!provider) {
|
|
1775
|
-
|
|
1776
|
+
_chunkJXTTDJRMjs.sentryLogger.error(`Error fetching provider on widget login: ${_optionalChain([result, 'optionalAccess', _153 => _153.walletId])}`);
|
|
1776
1777
|
throw new Error("Error fetching provider. Please try again.");
|
|
1777
1778
|
}
|
|
1778
1779
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1789,7 +1790,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1789
1790
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1790
1791
|
this.emitConnect(chainId);
|
|
1791
1792
|
this.emitAccountsChanged([checksumAdr]);
|
|
1792
|
-
|
|
1793
|
+
_chunkJXTTDJRMjs.sentryLogger.info(`Wallet connected: ${adapter.id} (widget)`);
|
|
1793
1794
|
return this.userInfo;
|
|
1794
1795
|
}
|
|
1795
1796
|
async getChainId() {
|
|
@@ -1808,7 +1809,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1808
1809
|
}
|
|
1809
1810
|
}
|
|
1810
1811
|
updateBrandConfig(newConfig) {
|
|
1811
|
-
const defaultTheme =
|
|
1812
|
+
const defaultTheme = _chunkJXTTDJRMjs.getDefaultThemeConfig.call(void 0, _nullishCoalesce(newConfig.theme, () => ( this.brandConfig.theme)));
|
|
1812
1813
|
this.brandConfig = {
|
|
1813
1814
|
logo: "logo" in newConfig ? _nullishCoalesce(newConfig.logo, () => ( defaultTheme.logo)) : this.brandConfig.logo,
|
|
1814
1815
|
theme: "theme" in newConfig ? _nullishCoalesce(newConfig.theme, () => ( defaultTheme.theme)) : this.brandConfig.theme,
|
|
@@ -1822,7 +1823,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1822
1823
|
};
|
|
1823
1824
|
if ("theme" in newConfig && this.brandConfig.theme) {
|
|
1824
1825
|
const wcAdapter = this.wallets.find((w) => w.id === _types.WalletId.WalletConnect);
|
|
1825
|
-
_optionalChain([wcAdapter, 'optionalAccess',
|
|
1826
|
+
_optionalChain([wcAdapter, 'optionalAccess', _154 => _154.updateTheme, 'call', _155 => _155(this.brandConfig.theme)]);
|
|
1826
1827
|
}
|
|
1827
1828
|
}
|
|
1828
1829
|
updateWalletsConfig(newConfig) {
|
|
@@ -1859,13 +1860,13 @@ var _AurumCore = class _AurumCore {
|
|
|
1859
1860
|
const verifyResult = await emailAdapter.emailAuthVerify(flowId, otp);
|
|
1860
1861
|
const provider = emailAdapter.getProvider();
|
|
1861
1862
|
if (!provider) {
|
|
1862
|
-
|
|
1863
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Failed to get provider after email verification");
|
|
1863
1864
|
throw new Error("Failed to get provider after email verification");
|
|
1864
1865
|
}
|
|
1865
|
-
const address = _optionalChain([verifyResult, 'access',
|
|
1866
|
-
const email = _optionalChain([verifyResult, 'access',
|
|
1866
|
+
const address = _optionalChain([verifyResult, 'access', _156 => _156.user, 'optionalAccess', _157 => _157.evmAccounts, 'optionalAccess', _158 => _158[0]]);
|
|
1867
|
+
const email = _optionalChain([verifyResult, 'access', _159 => _159.user, 'optionalAccess', _160 => _160.authenticationMethods, 'optionalAccess', _161 => _161.email, 'optionalAccess', _162 => _162.email]);
|
|
1867
1868
|
if (!address || !email) {
|
|
1868
|
-
|
|
1869
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Address or email not found after email verification");
|
|
1869
1870
|
throw new Error("Address or email not found after email verification");
|
|
1870
1871
|
}
|
|
1871
1872
|
const checksumAdr = _viem.checksumAddress.call(void 0, address);
|
|
@@ -1882,7 +1883,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1882
1883
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1883
1884
|
this.emitConnect(chainId);
|
|
1884
1885
|
this.emitAccountsChanged([checksumAdr]);
|
|
1885
|
-
|
|
1886
|
+
_chunkJXTTDJRMjs.sentryLogger.info(`Wallet connected: ${emailAdapter.id} (headless)`);
|
|
1886
1887
|
return { address: checksumAdr, email: _nullishCoalesce(email, () => ( "")), isNewUser: _nullishCoalesce(verifyResult.isNewUser, () => ( false)) };
|
|
1887
1888
|
}
|
|
1888
1889
|
/**
|
|
@@ -1902,7 +1903,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1902
1903
|
const result = await session.waitForConnection();
|
|
1903
1904
|
const provider = _nullishCoalesce(result.provider, () => ( wcAdapter.getProvider()));
|
|
1904
1905
|
if (!provider) {
|
|
1905
|
-
|
|
1906
|
+
_chunkJXTTDJRMjs.sentryLogger.error("Failed to get provider after WalletConnect connection");
|
|
1906
1907
|
throw new Error("Failed to get provider after WalletConnect connection");
|
|
1907
1908
|
}
|
|
1908
1909
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1918,7 +1919,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1918
1919
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1919
1920
|
this.emitConnect(chainId);
|
|
1920
1921
|
this.emitAccountsChanged([checksumAdr]);
|
|
1921
|
-
|
|
1922
|
+
_chunkJXTTDJRMjs.sentryLogger.info(`Wallet connected: ${wcAdapter.id} (headless)`);
|
|
1922
1923
|
return checksumAdr;
|
|
1923
1924
|
}
|
|
1924
1925
|
};
|
|
@@ -1934,15 +1935,15 @@ var _AurumCore = class _AurumCore {
|
|
|
1934
1935
|
}
|
|
1935
1936
|
this.eventListeners.get(event).add(callback);
|
|
1936
1937
|
if (!_AurumCore.MANAGED_EVENTS.includes(event)) {
|
|
1937
|
-
_optionalChain([this, 'access',
|
|
1938
|
+
_optionalChain([this, 'access', _163 => _163.currentProvider, 'access', _164 => _164.on, 'optionalCall', _165 => _165(event, callback)]);
|
|
1938
1939
|
}
|
|
1939
1940
|
};
|
|
1940
1941
|
}
|
|
1941
1942
|
if (prop === "removeListener") {
|
|
1942
1943
|
return (event, callback) => {
|
|
1943
|
-
_optionalChain([this, 'access',
|
|
1944
|
+
_optionalChain([this, 'access', _166 => _166.eventListeners, 'access', _167 => _167.get, 'call', _168 => _168(event), 'optionalAccess', _169 => _169.delete, 'call', _170 => _170(callback)]);
|
|
1944
1945
|
if (!_AurumCore.MANAGED_EVENTS.includes(event)) {
|
|
1945
|
-
_optionalChain([this, 'access',
|
|
1946
|
+
_optionalChain([this, 'access', _171 => _171.currentProvider, 'access', _172 => _172.removeListener, 'optionalCall', _173 => _173(event, callback)]);
|
|
1946
1947
|
}
|
|
1947
1948
|
};
|
|
1948
1949
|
}
|
|
@@ -1967,7 +1968,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1967
1968
|
this.eventListeners.forEach((callbacks, event) => {
|
|
1968
1969
|
if (!_AurumCore.MANAGED_EVENTS.includes(event)) {
|
|
1969
1970
|
callbacks.forEach((callback) => {
|
|
1970
|
-
_optionalChain([newProvider, 'access',
|
|
1971
|
+
_optionalChain([newProvider, 'access', _174 => _174.on, 'optionalCall', _175 => _175(event, callback)]);
|
|
1971
1972
|
});
|
|
1972
1973
|
}
|
|
1973
1974
|
});
|
|
@@ -1975,7 +1976,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1975
1976
|
/* BRAND & THEME METHODS */
|
|
1976
1977
|
resolveBrandConfig(config) {
|
|
1977
1978
|
const { brand = {} } = config || {};
|
|
1978
|
-
const themeConfig =
|
|
1979
|
+
const themeConfig = _chunkJXTTDJRMjs.getDefaultThemeConfig.call(void 0, brand.theme || _chunkJXTTDJRMjs.DEFAULT_THEME);
|
|
1979
1980
|
return {
|
|
1980
1981
|
logo: _nullishCoalesce(brand.logo, () => ( themeConfig.logo)),
|
|
1981
1982
|
theme: _nullishCoalesce(brand.theme, () => ( themeConfig.theme)),
|
|
@@ -1990,8 +1991,8 @@ var _AurumCore = class _AurumCore {
|
|
|
1990
1991
|
}
|
|
1991
1992
|
async tryRestoreConnection() {
|
|
1992
1993
|
try {
|
|
1993
|
-
await
|
|
1994
|
-
const store =
|
|
1994
|
+
await _chunkJXTTDJRMjs.waitForStoreHydration.call(void 0, );
|
|
1995
|
+
const store = _chunkJXTTDJRMjs.useAurumStore.getState();
|
|
1995
1996
|
if (!store.isConnected || !store.walletId || !store.address || !store.walletName) {
|
|
1996
1997
|
return;
|
|
1997
1998
|
}
|
|
@@ -2021,7 +2022,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2021
2022
|
}
|
|
2022
2023
|
}
|
|
2023
2024
|
persistConnectionState(adapter, address, email) {
|
|
2024
|
-
|
|
2025
|
+
_chunkJXTTDJRMjs.useAurumStore.getState().setConnection(adapter.id, _viem.checksumAddress.call(void 0, address), adapter.name, email);
|
|
2025
2026
|
}
|
|
2026
2027
|
/* INTERNAL LISTENER METHODS */
|
|
2027
2028
|
setInternalAccountChangeListener(adapter) {
|
|
@@ -2035,14 +2036,14 @@ var _AurumCore = class _AurumCore {
|
|
|
2035
2036
|
}
|
|
2036
2037
|
async syncStateFromAccountsChanged(accounts) {
|
|
2037
2038
|
if (!accounts.length || !accounts[0]) return;
|
|
2038
|
-
const prevAccount = _optionalChain([this, 'access',
|
|
2039
|
+
const prevAccount = _optionalChain([this, 'access', _176 => _176.userInfo, 'optionalAccess', _177 => _177.publicAddress]);
|
|
2039
2040
|
const newAccount = _viem.checksumAddress.call(void 0, accounts[0]);
|
|
2040
2041
|
if (newAccount !== prevAccount) {
|
|
2041
2042
|
this.userInfo = {
|
|
2042
2043
|
publicAddress: newAccount,
|
|
2043
|
-
walletName: _optionalChain([this, 'access',
|
|
2044
|
-
walletId: _optionalChain([this, 'access',
|
|
2045
|
-
email: _optionalChain([this, 'access',
|
|
2044
|
+
walletName: _optionalChain([this, 'access', _178 => _178.userInfo, 'optionalAccess', _179 => _179.walletName]),
|
|
2045
|
+
walletId: _optionalChain([this, 'access', _180 => _180.userInfo, 'optionalAccess', _181 => _181.walletId]),
|
|
2046
|
+
email: _optionalChain([this, 'access', _182 => _182.userInfo, 'optionalAccess', _183 => _183.email])
|
|
2046
2047
|
};
|
|
2047
2048
|
if (this.connectedWalletAdapter) {
|
|
2048
2049
|
this.persistConnectionState(this.connectedWalletAdapter, newAccount, this.userInfo.email);
|
|
@@ -2101,7 +2102,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2101
2102
|
}
|
|
2102
2103
|
}
|
|
2103
2104
|
async addChain(chain) {
|
|
2104
|
-
if (!_optionalChain([chain, 'optionalAccess',
|
|
2105
|
+
if (!_optionalChain([chain, 'optionalAccess', _184 => _184.id]) || !_optionalChain([chain, 'optionalAccess', _185 => _185.name]) || !_optionalChain([chain, 'optionalAccess', _186 => _186.nativeCurrency]) || !_optionalChain([chain, 'optionalAccess', _187 => _187.rpcUrls, 'optionalAccess', _188 => _188.default, 'optionalAccess', _189 => _189.http])) {
|
|
2105
2106
|
throw new Error("Invalid chain configuration: missing required properties");
|
|
2106
2107
|
}
|
|
2107
2108
|
await this.rpcProvider.request({
|
|
@@ -2119,7 +2120,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2119
2120
|
}
|
|
2120
2121
|
/* REST */
|
|
2121
2122
|
resetConnectionState() {
|
|
2122
|
-
|
|
2123
|
+
_chunkJXTTDJRMjs.useAurumStore.getState().clearConnection();
|
|
2123
2124
|
this.connectedWalletAdapter = null;
|
|
2124
2125
|
this.updateProvider(this.skeletonProvider);
|
|
2125
2126
|
this.userInfo = void 0;
|