@aurum-sdk/core 0.2.3-canary.3 → 0.2.4
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-ATH4UWSL.js +891 -0
- package/dist/chunk-GP7AGIK5.mjs +15206 -0
- package/dist/chunk-GTEGWUGU.js +15206 -0
- package/dist/chunk-IQ7F5R7D.js +1885 -0
- package/dist/chunk-LMQLRSFP.js +33 -0
- package/dist/chunk-YEVOYJGQ.mjs +891 -0
- package/dist/chunk-YFDA5EMH.mjs +1885 -0
- package/dist/chunk-ZT57KKYB.mjs +33 -0
- package/dist/dist-3K7ESMKX.js +4825 -0
- package/dist/dist-SYSRLCAE.mjs +4825 -0
- package/dist/index.js +200 -179
- package/dist/index.mjs +93 -72
- package/dist/index.web-HX5ZVRA3.mjs +28161 -0
- package/dist/index.web-ZRK5OLZ5.js +28161 -0
- package/dist/widgets.js +24 -12
- package/dist/widgets.mjs +13 -1
- package/package.json +4 -3
- package/dist/chunk-E5UAJURN.mjs +0 -2455
- package/dist/chunk-E5UAJURN.mjs.map +0 -1
- package/dist/chunk-MHRKTE55.js +0 -2455
- 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,12 +13,27 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkGTEGWUGUjs = require('./chunk-GTEGWUGU.js');
|
|
20
|
+
require('./chunk-LMQLRSFP.js');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _chunkIQ7F5R7Djs = require('./chunk-IQ7F5R7D.js');
|
|
24
|
+
|
|
25
|
+
// src/index.ts
|
|
26
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
27
|
+
|
|
28
|
+
// src/Aurum.ts
|
|
29
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
17
30
|
|
|
18
31
|
// src/AurumCore.ts
|
|
32
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
19
33
|
var _viem = require('viem');
|
|
20
34
|
|
|
21
35
|
// src/utils/chainHelpers.ts
|
|
36
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
22
37
|
function normalizeChainId(chainId) {
|
|
23
38
|
if (typeof chainId === "string" && chainId.startsWith("0x")) return chainId;
|
|
24
39
|
const numericId = typeof chainId === "number" ? chainId : Number(chainId);
|
|
@@ -40,37 +55,43 @@ function isChainExistsError(error) {
|
|
|
40
55
|
);
|
|
41
56
|
}
|
|
42
57
|
|
|
58
|
+
// src/components/ConnectModal/renderConnectModal.tsx
|
|
59
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
60
|
+
|
|
43
61
|
// src/components/ConnectModal/ModalShell.tsx
|
|
62
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
44
63
|
var _react = require('react');
|
|
45
64
|
var _jsxruntime = require('react/jsx-runtime');
|
|
46
65
|
var ModalShell = ({ onClose, brandConfig }) => {
|
|
47
66
|
const [isOpen, setIsOpen] = _react.useState.call(void 0, true);
|
|
48
|
-
const { currentPage } =
|
|
67
|
+
const { currentPage } = _chunkGTEGWUGUjs.useNavigation.call(void 0, );
|
|
49
68
|
const handleClose = () => {
|
|
50
69
|
setIsOpen(false);
|
|
51
70
|
onClose();
|
|
52
71
|
};
|
|
53
72
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
54
|
-
|
|
73
|
+
_chunkGTEGWUGUjs.Modal,
|
|
55
74
|
{
|
|
56
75
|
isOpen,
|
|
57
76
|
closeOnOverlayClick: true,
|
|
58
77
|
onCloseComplete: handleClose,
|
|
59
78
|
brandConfig,
|
|
60
79
|
transitionKey: currentPage,
|
|
61
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
80
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGTEGWUGUjs.ConnectPages, {})
|
|
62
81
|
}
|
|
63
82
|
);
|
|
64
83
|
};
|
|
65
84
|
|
|
66
85
|
// src/utils/createModalContainer.ts
|
|
86
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
67
87
|
var _client = require('react-dom/client');
|
|
68
88
|
|
|
69
89
|
// src/utils/createShadowRoot.ts
|
|
90
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
70
91
|
function createShadowRoot(container, brandConfig) {
|
|
71
92
|
const shadowRoot = container.attachShadow({ mode: "open" });
|
|
72
93
|
shadowRoot.innerHTML = `
|
|
73
|
-
<style>${
|
|
94
|
+
<style>${_chunkGTEGWUGUjs.generateCompleteStyles.call(void 0, brandConfig)}</style>
|
|
74
95
|
<div class="aurum-modal-root"></div>
|
|
75
96
|
`;
|
|
76
97
|
return shadowRoot.querySelector(".aurum-modal-root");
|
|
@@ -107,7 +128,7 @@ function renderConnectModal({
|
|
|
107
128
|
brandConfig
|
|
108
129
|
}) {
|
|
109
130
|
return new Promise((resolve, reject) => {
|
|
110
|
-
const sortedWallets =
|
|
131
|
+
const sortedWallets = _chunkGTEGWUGUjs.sortWallets.call(void 0, displayedWallets, { filterHidden: false });
|
|
111
132
|
const { root, cleanup } = createModalContainer(CONTAINER_ID, brandConfig);
|
|
112
133
|
const onConnect = (result) => {
|
|
113
134
|
cleanup();
|
|
@@ -118,20 +139,25 @@ function renderConnectModal({
|
|
|
118
139
|
reject(new Error("User rejected request"));
|
|
119
140
|
};
|
|
120
141
|
root.render(
|
|
121
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGTEGWUGUjs.ThemeContainer, { theme: brandConfig.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGTEGWUGUjs.ConnectUIProviders, { onConnect, displayedWallets: sortedWallets, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalShell, { onClose, brandConfig }) }) })
|
|
122
143
|
);
|
|
123
144
|
});
|
|
124
145
|
}
|
|
125
146
|
|
|
147
|
+
// src/utils/createWalletAdapters.ts
|
|
148
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
149
|
+
|
|
150
|
+
// src/wallet-adapters/index.ts
|
|
151
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
152
|
+
|
|
126
153
|
// src/wallet-adapters/RabbyAdapter.ts
|
|
127
|
-
|
|
128
|
-
var _types = require('@aurum-sdk/types');
|
|
154
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
129
155
|
var RABBY_RDNS = "io.rabby";
|
|
130
156
|
var RabbyAdapter = class {
|
|
131
157
|
constructor() {
|
|
132
|
-
this.id =
|
|
133
|
-
this.name =
|
|
134
|
-
this.icon = _nullishCoalesce(
|
|
158
|
+
this.id = _chunkGTEGWUGUjs.WalletId.Rabby;
|
|
159
|
+
this.name = _chunkGTEGWUGUjs.WalletName.Rabby;
|
|
160
|
+
this.icon = _nullishCoalesce(_chunkGTEGWUGUjs.getLogoDataUri.call(void 0, _chunkGTEGWUGUjs.WalletId.Rabby, "brand"), () => ( ""));
|
|
135
161
|
this.hide = false;
|
|
136
162
|
this.downloadUrl = "https://rabby.io";
|
|
137
163
|
this.wcDeepLinkUrl = null;
|
|
@@ -190,7 +216,7 @@ var RabbyAdapter = class {
|
|
|
190
216
|
await this.providerPromise;
|
|
191
217
|
}
|
|
192
218
|
if (!this.provider) {
|
|
193
|
-
|
|
219
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Rabby is not available");
|
|
194
220
|
throw new Error("Rabby is not available");
|
|
195
221
|
}
|
|
196
222
|
await this.provider.request({
|
|
@@ -202,7 +228,7 @@ var RabbyAdapter = class {
|
|
|
202
228
|
params: []
|
|
203
229
|
});
|
|
204
230
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
205
|
-
|
|
231
|
+
_chunkGTEGWUGUjs.sentryLogger.error("No accounts returned from Rabby");
|
|
206
232
|
throw new Error("No accounts returned from Rabby");
|
|
207
233
|
}
|
|
208
234
|
return {
|
|
@@ -258,10 +284,10 @@ var RabbyAdapter = class {
|
|
|
258
284
|
};
|
|
259
285
|
|
|
260
286
|
// src/wallet-adapters/BraveAdapter.ts
|
|
261
|
-
|
|
262
|
-
|
|
287
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
263
288
|
|
|
264
289
|
// src/utils/platform/isBraveBrowser.ts
|
|
290
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
265
291
|
function isBraveBrowser() {
|
|
266
292
|
if (typeof navigator === "undefined") return false;
|
|
267
293
|
return navigator.brave !== void 0;
|
|
@@ -271,9 +297,9 @@ function isBraveBrowser() {
|
|
|
271
297
|
var BRAVE_RDNS = "com.brave.wallet";
|
|
272
298
|
var BraveAdapter = class {
|
|
273
299
|
constructor() {
|
|
274
|
-
this.id =
|
|
275
|
-
this.name =
|
|
276
|
-
this.icon = _nullishCoalesce(
|
|
300
|
+
this.id = _chunkGTEGWUGUjs.WalletId.Brave;
|
|
301
|
+
this.name = _chunkGTEGWUGUjs.WalletName.Brave;
|
|
302
|
+
this.icon = _nullishCoalesce(_chunkGTEGWUGUjs.getLogoDataUri.call(void 0, _chunkGTEGWUGUjs.WalletId.Brave, "brand"), () => ( ""));
|
|
277
303
|
this.downloadUrl = "https://brave.com/download";
|
|
278
304
|
this.wcDeepLinkUrl = null;
|
|
279
305
|
this.provider = null;
|
|
@@ -336,7 +362,7 @@ var BraveAdapter = class {
|
|
|
336
362
|
await this.providerPromise;
|
|
337
363
|
}
|
|
338
364
|
if (!this.provider) {
|
|
339
|
-
|
|
365
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Brave Wallet is not available");
|
|
340
366
|
throw new Error("Brave Wallet is not available");
|
|
341
367
|
}
|
|
342
368
|
await this.provider.request({
|
|
@@ -348,7 +374,7 @@ var BraveAdapter = class {
|
|
|
348
374
|
params: []
|
|
349
375
|
});
|
|
350
376
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
351
|
-
|
|
377
|
+
_chunkGTEGWUGUjs.sentryLogger.error("No accounts returned from Brave Wallet");
|
|
352
378
|
throw new Error("No accounts returned from Brave Wallet");
|
|
353
379
|
}
|
|
354
380
|
return {
|
|
@@ -404,14 +430,13 @@ var BraveAdapter = class {
|
|
|
404
430
|
};
|
|
405
431
|
|
|
406
432
|
// src/wallet-adapters/PhantomAdapter.ts
|
|
407
|
-
|
|
408
|
-
|
|
433
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
409
434
|
var PHANTOM_RDNS = "app.phantom";
|
|
410
435
|
var PhantomAdapter = class {
|
|
411
436
|
constructor() {
|
|
412
|
-
this.id =
|
|
413
|
-
this.name =
|
|
414
|
-
this.icon = _nullishCoalesce(
|
|
437
|
+
this.id = _chunkGTEGWUGUjs.WalletId.Phantom;
|
|
438
|
+
this.name = _chunkGTEGWUGUjs.WalletName.Phantom;
|
|
439
|
+
this.icon = _nullishCoalesce(_chunkGTEGWUGUjs.getLogoDataUri.call(void 0, _chunkGTEGWUGUjs.WalletId.Phantom, "brand"), () => ( ""));
|
|
415
440
|
this.hide = false;
|
|
416
441
|
this.downloadUrl = "https://phantom.com/download";
|
|
417
442
|
this.wcDeepLinkUrl = "phantom://wc?uri=";
|
|
@@ -475,7 +500,7 @@ var PhantomAdapter = class {
|
|
|
475
500
|
await this.providerPromise;
|
|
476
501
|
}
|
|
477
502
|
if (!this.provider) {
|
|
478
|
-
|
|
503
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Phantom is not available");
|
|
479
504
|
throw new Error("Phantom is not available");
|
|
480
505
|
}
|
|
481
506
|
await this.provider.request({
|
|
@@ -487,7 +512,7 @@ var PhantomAdapter = class {
|
|
|
487
512
|
params: []
|
|
488
513
|
});
|
|
489
514
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
490
|
-
|
|
515
|
+
_chunkGTEGWUGUjs.sentryLogger.error("No accounts returned from Phantom");
|
|
491
516
|
throw new Error("No accounts returned from Phantom");
|
|
492
517
|
}
|
|
493
518
|
return {
|
|
@@ -543,48 +568,51 @@ var PhantomAdapter = class {
|
|
|
543
568
|
};
|
|
544
569
|
|
|
545
570
|
// src/wallet-adapters/CoinbaseWalletAdapter.ts
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
571
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
549
572
|
var CoinbaseWalletAdapter = class {
|
|
550
573
|
constructor({ appName, appLogoUrl, telemetry }) {
|
|
551
|
-
this.id =
|
|
552
|
-
this.name =
|
|
553
|
-
this.icon = _nullishCoalesce(
|
|
574
|
+
this.id = _chunkGTEGWUGUjs.WalletId.CoinbaseWallet;
|
|
575
|
+
this.name = _chunkGTEGWUGUjs.WalletName.CoinbaseWallet;
|
|
576
|
+
this.icon = _nullishCoalesce(_chunkGTEGWUGUjs.getLogoDataUri.call(void 0, _chunkGTEGWUGUjs.WalletId.CoinbaseWallet, "brand"), () => ( ""));
|
|
554
577
|
this.hide = false;
|
|
555
578
|
this.downloadUrl = "https://www.coinbase.com/wallet/downloads";
|
|
556
579
|
this.wcDeepLinkUrl = "cbwallet://wc?uri=";
|
|
557
580
|
this.provider = null;
|
|
558
581
|
this.accountsChangedCallback = null;
|
|
559
|
-
this.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
582
|
+
this.initPromise = null;
|
|
583
|
+
this.config = { appName, appLogoUrl, telemetry: _nullishCoalesce(telemetry, () => ( false)) };
|
|
584
|
+
}
|
|
585
|
+
async ensureInitialized() {
|
|
586
|
+
if (this.provider) return;
|
|
587
|
+
if (!this.initPromise) {
|
|
588
|
+
this.initPromise = this.initializeProvider();
|
|
589
|
+
}
|
|
590
|
+
await this.initPromise;
|
|
591
|
+
}
|
|
592
|
+
async initializeProvider() {
|
|
593
|
+
if (typeof window === "undefined") return;
|
|
567
594
|
try {
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
595
|
+
const { createCoinbaseWalletSDK } = await Promise.resolve().then(() => _interopRequireWildcard(require("./dist-3K7ESMKX.js")));
|
|
596
|
+
const coinbaseSdk = createCoinbaseWalletSDK({
|
|
597
|
+
appName: this.config.appName,
|
|
598
|
+
appLogoUrl: this.config.appLogoUrl,
|
|
571
599
|
preference: {
|
|
572
600
|
options: "all",
|
|
573
|
-
telemetry
|
|
601
|
+
telemetry: this.config.telemetry
|
|
574
602
|
}
|
|
575
603
|
});
|
|
576
|
-
|
|
604
|
+
this.provider = coinbaseSdk.getProvider();
|
|
577
605
|
} catch (error) {
|
|
578
|
-
|
|
579
|
-
return null;
|
|
606
|
+
_chunkGTEGWUGUjs.sentryLogger.warn("Failed to initialize Coinbase Wallet provider", { error });
|
|
580
607
|
}
|
|
581
608
|
}
|
|
582
609
|
isInstalled() {
|
|
583
|
-
return
|
|
610
|
+
return true;
|
|
584
611
|
}
|
|
585
612
|
async connect() {
|
|
586
|
-
|
|
587
|
-
|
|
613
|
+
await this.ensureInitialized();
|
|
614
|
+
if (!this.provider) {
|
|
615
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Coinbase Wallet is not available");
|
|
588
616
|
throw new Error("Coinbase Wallet is not available");
|
|
589
617
|
}
|
|
590
618
|
const accounts = await this.provider.request({
|
|
@@ -592,7 +620,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
592
620
|
params: []
|
|
593
621
|
});
|
|
594
622
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
595
|
-
|
|
623
|
+
_chunkGTEGWUGUjs.sentryLogger.error("No accounts returned from Coinbase Wallet");
|
|
596
624
|
throw new Error("No accounts returned from Coinbase Wallet");
|
|
597
625
|
}
|
|
598
626
|
return {
|
|
@@ -602,7 +630,8 @@ var CoinbaseWalletAdapter = class {
|
|
|
602
630
|
};
|
|
603
631
|
}
|
|
604
632
|
async tryRestoreConnection() {
|
|
605
|
-
|
|
633
|
+
await this.ensureInitialized();
|
|
634
|
+
if (!this.provider) {
|
|
606
635
|
return null;
|
|
607
636
|
}
|
|
608
637
|
try {
|
|
@@ -623,14 +652,15 @@ var CoinbaseWalletAdapter = class {
|
|
|
623
652
|
}
|
|
624
653
|
}
|
|
625
654
|
async disconnect() {
|
|
655
|
+
if (!this.provider) return;
|
|
626
656
|
try {
|
|
627
|
-
if (
|
|
657
|
+
if (this.provider.close) {
|
|
628
658
|
await this.provider.close();
|
|
629
|
-
} else if (
|
|
659
|
+
} else if (this.provider.disconnect) {
|
|
630
660
|
await this.provider.disconnect();
|
|
631
661
|
}
|
|
632
662
|
} catch (error) {
|
|
633
|
-
|
|
663
|
+
_chunkGTEGWUGUjs.sentryLogger.warn("Error disconnecting from Coinbase Wallet", { error });
|
|
634
664
|
} finally {
|
|
635
665
|
this.clearLocalStorage();
|
|
636
666
|
}
|
|
@@ -654,29 +684,28 @@ var CoinbaseWalletAdapter = class {
|
|
|
654
684
|
// Called by Aurum when user connects wallet
|
|
655
685
|
// Passes Aurum.ts --> syncStateFromAccountsChanged() to handle the provider accounts changed event
|
|
656
686
|
onAccountsChanged(callback) {
|
|
657
|
-
if (!_optionalChain([this, 'access',
|
|
687
|
+
if (!_optionalChain([this, 'access', _47 => _47.provider, 'optionalAccess', _48 => _48.on])) return;
|
|
658
688
|
if (this.accountsChangedCallback) {
|
|
659
|
-
_optionalChain([this, 'access',
|
|
689
|
+
_optionalChain([this, 'access', _49 => _49.provider, 'access', _50 => _50.removeListener, 'optionalCall', _51 => _51("accountsChanged", this.accountsChangedCallback)]);
|
|
660
690
|
}
|
|
661
691
|
this.accountsChangedCallback = callback;
|
|
662
692
|
this.provider.on("accountsChanged", this.accountsChangedCallback);
|
|
663
693
|
}
|
|
664
694
|
removeListeners() {
|
|
665
|
-
if (!_optionalChain([this, 'access',
|
|
695
|
+
if (!_optionalChain([this, 'access', _52 => _52.provider, 'optionalAccess', _53 => _53.removeListener]) || !this.accountsChangedCallback) return;
|
|
666
696
|
this.provider.removeListener("accountsChanged", this.accountsChangedCallback);
|
|
667
697
|
this.accountsChangedCallback = null;
|
|
668
698
|
}
|
|
669
699
|
};
|
|
670
700
|
|
|
671
701
|
// src/wallet-adapters/MetaMaskAdapter.ts
|
|
672
|
-
|
|
673
|
-
|
|
702
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
674
703
|
var METAMASK_RDNS = "io.metamask";
|
|
675
704
|
var MetaMaskAdapter = class {
|
|
676
705
|
constructor() {
|
|
677
|
-
this.id =
|
|
678
|
-
this.name =
|
|
679
|
-
this.icon = _nullishCoalesce(
|
|
706
|
+
this.id = _chunkGTEGWUGUjs.WalletId.MetaMask;
|
|
707
|
+
this.name = _chunkGTEGWUGUjs.WalletName.MetaMask;
|
|
708
|
+
this.icon = _nullishCoalesce(_chunkGTEGWUGUjs.getLogoDataUri.call(void 0, _chunkGTEGWUGUjs.WalletId.MetaMask, "brand"), () => ( ""));
|
|
680
709
|
this.hide = false;
|
|
681
710
|
this.downloadUrl = "https://metamask.io/download";
|
|
682
711
|
this.wcDeepLinkUrl = "metamask://wc?uri=";
|
|
@@ -724,7 +753,7 @@ var MetaMaskAdapter = class {
|
|
|
724
753
|
detectLegacyProvider() {
|
|
725
754
|
const ethereum = window.ethereum;
|
|
726
755
|
if (!ethereum) return null;
|
|
727
|
-
if (_optionalChain([ethereum, 'access',
|
|
756
|
+
if (_optionalChain([ethereum, 'access', _54 => _54.providers, 'optionalAccess', _55 => _55.length])) {
|
|
728
757
|
const metaMaskProvider = ethereum.providers.find((p) => p.isMetaMask && !p.isBraveWallet);
|
|
729
758
|
if (metaMaskProvider) return metaMaskProvider;
|
|
730
759
|
}
|
|
@@ -741,7 +770,7 @@ var MetaMaskAdapter = class {
|
|
|
741
770
|
await this.providerPromise;
|
|
742
771
|
}
|
|
743
772
|
if (!this.provider) {
|
|
744
|
-
|
|
773
|
+
_chunkGTEGWUGUjs.sentryLogger.error("MetaMask is not available");
|
|
745
774
|
throw new Error("MetaMask is not available");
|
|
746
775
|
}
|
|
747
776
|
await this.provider.request({
|
|
@@ -753,7 +782,7 @@ var MetaMaskAdapter = class {
|
|
|
753
782
|
params: []
|
|
754
783
|
});
|
|
755
784
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
756
|
-
|
|
785
|
+
_chunkGTEGWUGUjs.sentryLogger.error("No accounts returned from MetaMask");
|
|
757
786
|
throw new Error("No accounts returned from MetaMask");
|
|
758
787
|
}
|
|
759
788
|
return {
|
|
@@ -794,25 +823,25 @@ var MetaMaskAdapter = class {
|
|
|
794
823
|
// Called by Aurum when user connects wallet
|
|
795
824
|
// Passes Aurum.ts --> syncStateFromAccountsChanged() to handle the provider accounts changed event
|
|
796
825
|
onAccountsChanged(callback) {
|
|
797
|
-
if (!_optionalChain([this, 'access',
|
|
826
|
+
if (!_optionalChain([this, 'access', _56 => _56.provider, 'optionalAccess', _57 => _57.on])) return;
|
|
798
827
|
if (this.accountsChangedCallback) {
|
|
799
|
-
_optionalChain([this, 'access',
|
|
828
|
+
_optionalChain([this, 'access', _58 => _58.provider, 'access', _59 => _59.removeListener, 'optionalCall', _60 => _60("accountsChanged", this.accountsChangedCallback)]);
|
|
800
829
|
}
|
|
801
830
|
this.accountsChangedCallback = callback;
|
|
802
831
|
this.provider.on("accountsChanged", this.accountsChangedCallback);
|
|
803
832
|
}
|
|
804
833
|
removeListeners() {
|
|
805
|
-
if (!_optionalChain([this, 'access',
|
|
834
|
+
if (!_optionalChain([this, 'access', _61 => _61.provider, 'optionalAccess', _62 => _62.removeListener]) || !this.accountsChangedCallback) return;
|
|
806
835
|
this.provider.removeListener("accountsChanged", this.accountsChangedCallback);
|
|
807
836
|
this.accountsChangedCallback = null;
|
|
808
837
|
}
|
|
809
838
|
};
|
|
810
839
|
|
|
811
840
|
// src/wallet-adapters/WalletConnectAdapter.ts
|
|
812
|
-
|
|
813
|
-
|
|
841
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
814
842
|
|
|
815
843
|
// src/constants/adapters.ts
|
|
844
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
816
845
|
var WALLETCONNECT_NAMESPACE = {
|
|
817
846
|
eip155: {
|
|
818
847
|
methods: [
|
|
@@ -899,15 +928,15 @@ var WALLETCONNECT_NAMESPACE = {
|
|
|
899
928
|
|
|
900
929
|
// src/wallet-adapters/WalletConnectAdapter.ts
|
|
901
930
|
function extractAddressFromSession(namespaces) {
|
|
902
|
-
const accounts = _optionalChain([namespaces, 'optionalAccess',
|
|
931
|
+
const accounts = _optionalChain([namespaces, 'optionalAccess', _63 => _63.eip155, 'optionalAccess', _64 => _64.accounts]) || [];
|
|
903
932
|
const firstAccount = accounts[0];
|
|
904
|
-
return _nullishCoalesce(_optionalChain([firstAccount, 'optionalAccess',
|
|
933
|
+
return _nullishCoalesce(_optionalChain([firstAccount, 'optionalAccess', _65 => _65.split, 'call', _66 => _66(":"), 'access', _67 => _67[2]]), () => ( null));
|
|
905
934
|
}
|
|
906
935
|
var WalletConnectAdapter = class {
|
|
907
936
|
constructor(config) {
|
|
908
|
-
this.id =
|
|
909
|
-
this.name =
|
|
910
|
-
this.icon = _nullishCoalesce(
|
|
937
|
+
this.id = _chunkGTEGWUGUjs.WalletId.WalletConnect;
|
|
938
|
+
this.name = _chunkGTEGWUGUjs.WalletName.WalletConnect;
|
|
939
|
+
this.icon = _nullishCoalesce(_chunkGTEGWUGUjs.getLogoDataUri.call(void 0, _chunkGTEGWUGUjs.WalletId.WalletConnect, "brand"), () => ( ""));
|
|
911
940
|
this.hide = false;
|
|
912
941
|
this.downloadUrl = null;
|
|
913
942
|
this.wcDeepLinkUrl = null;
|
|
@@ -1012,11 +1041,11 @@ var WalletConnectAdapter = class {
|
|
|
1012
1041
|
}
|
|
1013
1042
|
}
|
|
1014
1043
|
syncAddressFromWagmi() {
|
|
1015
|
-
if (!_optionalChain([this, 'access',
|
|
1044
|
+
if (!_optionalChain([this, 'access', _68 => _68.wagmiAdapter, 'optionalAccess', _69 => _69.wagmiConfig])) return;
|
|
1016
1045
|
const { state } = this.wagmiAdapter.wagmiConfig;
|
|
1017
1046
|
if (state.current && state.connections) {
|
|
1018
1047
|
const connection = state.connections.get(state.current);
|
|
1019
|
-
if (_optionalChain([connection, 'optionalAccess',
|
|
1048
|
+
if (_optionalChain([connection, 'optionalAccess', _70 => _70.accounts, 'optionalAccess', _71 => _71[0]])) {
|
|
1020
1049
|
this.address = connection.accounts[0];
|
|
1021
1050
|
}
|
|
1022
1051
|
}
|
|
@@ -1027,17 +1056,17 @@ var WalletConnectAdapter = class {
|
|
|
1027
1056
|
const getProvidersFn = this.modal.getProviders;
|
|
1028
1057
|
if (typeof getProvidersFn === "function") {
|
|
1029
1058
|
const providers = getProvidersFn.call(this.modal);
|
|
1030
|
-
const eip155Provider = _optionalChain([providers, 'optionalAccess',
|
|
1059
|
+
const eip155Provider = _optionalChain([providers, 'optionalAccess', _72 => _72["eip155"]]);
|
|
1031
1060
|
if (eip155Provider) {
|
|
1032
1061
|
this.provider = eip155Provider;
|
|
1033
1062
|
return;
|
|
1034
1063
|
}
|
|
1035
1064
|
}
|
|
1036
|
-
if (_optionalChain([this, 'access',
|
|
1065
|
+
if (_optionalChain([this, 'access', _73 => _73.wagmiAdapter, 'optionalAccess', _74 => _74.wagmiConfig])) {
|
|
1037
1066
|
const { state } = this.wagmiAdapter.wagmiConfig;
|
|
1038
1067
|
if (state.current && state.connections) {
|
|
1039
1068
|
const connection = state.connections.get(state.current);
|
|
1040
|
-
const connector = _optionalChain([connection, 'optionalAccess',
|
|
1069
|
+
const connector = _optionalChain([connection, 'optionalAccess', _75 => _75.connector]);
|
|
1041
1070
|
if (connector && typeof connector.getProvider === "function") {
|
|
1042
1071
|
try {
|
|
1043
1072
|
const provider = await connector.getProvider();
|
|
@@ -1045,13 +1074,13 @@ var WalletConnectAdapter = class {
|
|
|
1045
1074
|
this.provider = provider;
|
|
1046
1075
|
}
|
|
1047
1076
|
} catch (error) {
|
|
1048
|
-
|
|
1077
|
+
_chunkGTEGWUGUjs.sentryLogger.warn("Failed to get provider from wagmi connector", { error });
|
|
1049
1078
|
}
|
|
1050
1079
|
}
|
|
1051
1080
|
}
|
|
1052
1081
|
}
|
|
1053
1082
|
} catch (error) {
|
|
1054
|
-
|
|
1083
|
+
_chunkGTEGWUGUjs.sentryLogger.warn("Failed to get provider from WalletConnect", { error });
|
|
1055
1084
|
}
|
|
1056
1085
|
}
|
|
1057
1086
|
isInstalled() {
|
|
@@ -1067,20 +1096,20 @@ var WalletConnectAdapter = class {
|
|
|
1067
1096
|
this.lastKnownAccounts = [];
|
|
1068
1097
|
this.lastKnownChainId = null;
|
|
1069
1098
|
try {
|
|
1070
|
-
const { state } = _optionalChain([this, 'access',
|
|
1071
|
-
const connection = _optionalChain([state, 'optionalAccess',
|
|
1072
|
-
if (connection && typeof connection !== "string" && _optionalChain([connection, 'access',
|
|
1099
|
+
const { state } = _optionalChain([this, 'access', _76 => _76.wagmiAdapter, 'optionalAccess', _77 => _77.wagmiConfig]) || {};
|
|
1100
|
+
const connection = _optionalChain([state, 'optionalAccess', _78 => _78.current]) && _optionalChain([state, 'access', _79 => _79.connections, 'optionalAccess', _80 => _80.get, 'call', _81 => _81(state.current)]);
|
|
1101
|
+
if (connection && typeof connection !== "string" && _optionalChain([connection, 'access', _82 => _82.connector, 'optionalAccess', _83 => _83.disconnect])) {
|
|
1073
1102
|
await connection.connector.disconnect();
|
|
1074
1103
|
}
|
|
1075
1104
|
} catch (e6) {
|
|
1076
1105
|
}
|
|
1077
|
-
if (_optionalChain([this, 'access',
|
|
1106
|
+
if (_optionalChain([this, 'access', _84 => _84.modal, 'optionalAccess', _85 => _85.getIsConnectedState, 'call', _86 => _86()])) {
|
|
1078
1107
|
try {
|
|
1079
1108
|
await this.modal.disconnect("eip155");
|
|
1080
1109
|
} catch (e7) {
|
|
1081
1110
|
}
|
|
1082
1111
|
}
|
|
1083
|
-
if (_optionalChain([this, 'access',
|
|
1112
|
+
if (_optionalChain([this, 'access', _87 => _87.universalProvider, 'optionalAccess', _88 => _88.session])) {
|
|
1084
1113
|
try {
|
|
1085
1114
|
await this.universalProvider.disconnect();
|
|
1086
1115
|
} catch (e8) {
|
|
@@ -1094,7 +1123,7 @@ var WalletConnectAdapter = class {
|
|
|
1094
1123
|
* Emits walletconnect:uri event for QR code display.
|
|
1095
1124
|
*/
|
|
1096
1125
|
async connect() {
|
|
1097
|
-
if (!this.config.projectId) throw
|
|
1126
|
+
if (!this.config.projectId) throw _chunkGTEGWUGUjs.createConfigError.call(void 0, "WalletConnect");
|
|
1098
1127
|
await this.ensureInitialized();
|
|
1099
1128
|
if (!this.universalProvider) throw new Error("WalletConnect is not available");
|
|
1100
1129
|
await this.resetConnectionState();
|
|
@@ -1157,7 +1186,7 @@ var WalletConnectAdapter = class {
|
|
|
1157
1186
|
* Used on mobile and when user clicks "Open Modal" button.
|
|
1158
1187
|
*/
|
|
1159
1188
|
async openModal() {
|
|
1160
|
-
if (!this.config.projectId) throw
|
|
1189
|
+
if (!this.config.projectId) throw _chunkGTEGWUGUjs.createConfigError.call(void 0, "WalletConnect");
|
|
1161
1190
|
await this.ensureInitialized();
|
|
1162
1191
|
if (!this.modal) throw new Error("AppKit is not available");
|
|
1163
1192
|
await this.resetConnectionState();
|
|
@@ -1169,7 +1198,7 @@ var WalletConnectAdapter = class {
|
|
|
1169
1198
|
const startTime = Date.now();
|
|
1170
1199
|
let unsubscribe = null;
|
|
1171
1200
|
let resolved = false;
|
|
1172
|
-
const cleanup = () => _optionalChain([unsubscribe, 'optionalCall',
|
|
1201
|
+
const cleanup = () => _optionalChain([unsubscribe, 'optionalCall', _89 => _89()]);
|
|
1173
1202
|
const checkConnection = async () => {
|
|
1174
1203
|
if (resolved) return true;
|
|
1175
1204
|
this.syncAddressFromWagmi();
|
|
@@ -1177,10 +1206,10 @@ var WalletConnectAdapter = class {
|
|
|
1177
1206
|
if (this.provider && this.address) {
|
|
1178
1207
|
try {
|
|
1179
1208
|
const accounts = await this.provider.request({ method: "eth_accounts" });
|
|
1180
|
-
if (_optionalChain([accounts, 'optionalAccess',
|
|
1209
|
+
if (_optionalChain([accounts, 'optionalAccess', _90 => _90.length])) {
|
|
1181
1210
|
resolved = true;
|
|
1182
1211
|
cleanup();
|
|
1183
|
-
_optionalChain([this, 'access',
|
|
1212
|
+
_optionalChain([this, 'access', _91 => _91.modal, 'optionalAccess', _92 => _92.close, 'call', _93 => _93()]);
|
|
1184
1213
|
this.lastKnownAccounts = accounts;
|
|
1185
1214
|
resolve({ address: this.address, provider: this.provider, walletId: this.id });
|
|
1186
1215
|
return true;
|
|
@@ -1215,9 +1244,9 @@ var WalletConnectAdapter = class {
|
|
|
1215
1244
|
try {
|
|
1216
1245
|
await new Promise((r) => setTimeout(r, 1e3));
|
|
1217
1246
|
const { state } = this.wagmiAdapter.wagmiConfig || {};
|
|
1218
|
-
const connection = _optionalChain([state, 'optionalAccess',
|
|
1247
|
+
const connection = _optionalChain([state, 'optionalAccess', _94 => _94.current]) && _optionalChain([state, 'access', _95 => _95.connections, 'optionalAccess', _96 => _96.get, 'call', _97 => _97(state.current)]);
|
|
1219
1248
|
if (!connection || typeof connection === "string") return null;
|
|
1220
|
-
const address = _optionalChain([connection, 'access',
|
|
1249
|
+
const address = _optionalChain([connection, 'access', _98 => _98.accounts, 'optionalAccess', _99 => _99[0]]);
|
|
1221
1250
|
if (address && this.provider) {
|
|
1222
1251
|
this.address = address;
|
|
1223
1252
|
this.lastKnownAccounts = [...connection.accounts || []];
|
|
@@ -1246,10 +1275,10 @@ var WalletConnectAdapter = class {
|
|
|
1246
1275
|
return this.provider;
|
|
1247
1276
|
}
|
|
1248
1277
|
onAccountsChanged(callback) {
|
|
1249
|
-
if (this.accountsChangedCallback && _optionalChain([this, 'access',
|
|
1278
|
+
if (this.accountsChangedCallback && _optionalChain([this, 'access', _100 => _100.provider, 'optionalAccess', _101 => _101.removeListener])) {
|
|
1250
1279
|
this.provider.removeListener("accountsChanged", this.accountsChangedCallback);
|
|
1251
1280
|
}
|
|
1252
|
-
if (this.sessionUpdateHandler && _optionalChain([this, 'access',
|
|
1281
|
+
if (this.sessionUpdateHandler && _optionalChain([this, 'access', _102 => _102.universalProvider, 'optionalAccess', _103 => _103.removeListener])) {
|
|
1253
1282
|
this.universalProvider.removeListener("session_update", this.sessionUpdateHandler);
|
|
1254
1283
|
}
|
|
1255
1284
|
if (!this.lastKnownAccounts.length && this.address) this.lastKnownAccounts = [this.address];
|
|
@@ -1258,12 +1287,12 @@ var WalletConnectAdapter = class {
|
|
|
1258
1287
|
this.lastKnownAccounts = accounts;
|
|
1259
1288
|
callback(accounts);
|
|
1260
1289
|
};
|
|
1261
|
-
if (_optionalChain([this, 'access',
|
|
1290
|
+
if (_optionalChain([this, 'access', _104 => _104.provider, 'optionalAccess', _105 => _105.on])) {
|
|
1262
1291
|
this.provider.on("accountsChanged", this.accountsChangedCallback);
|
|
1263
1292
|
}
|
|
1264
|
-
if (_optionalChain([this, 'access',
|
|
1293
|
+
if (_optionalChain([this, 'access', _106 => _106.universalProvider, 'optionalAccess', _107 => _107.on])) {
|
|
1265
1294
|
this.sessionUpdateHandler = (args) => {
|
|
1266
|
-
const accounts = this.extractAccountsFromNamespaces(_optionalChain([args, 'optionalAccess',
|
|
1295
|
+
const accounts = this.extractAccountsFromNamespaces(_optionalChain([args, 'optionalAccess', _108 => _108.params, 'optionalAccess', _109 => _109.namespaces]));
|
|
1267
1296
|
if (accounts.length && this.hasAccountsChanged(accounts)) {
|
|
1268
1297
|
this.lastKnownAccounts = accounts;
|
|
1269
1298
|
this.address = accounts[0];
|
|
@@ -1274,8 +1303,8 @@ var WalletConnectAdapter = class {
|
|
|
1274
1303
|
}
|
|
1275
1304
|
}
|
|
1276
1305
|
onChainChanged(callback) {
|
|
1277
|
-
if (!_optionalChain([this, 'access',
|
|
1278
|
-
if (this.chainChangedCallback) _optionalChain([this, 'access',
|
|
1306
|
+
if (!_optionalChain([this, 'access', _110 => _110.provider, 'optionalAccess', _111 => _111.on])) return;
|
|
1307
|
+
if (this.chainChangedCallback) _optionalChain([this, 'access', _112 => _112.provider, 'access', _113 => _113.removeListener, 'optionalCall', _114 => _114("chainChanged", this.chainChangedCallback)]);
|
|
1279
1308
|
this.chainChangedCallback = (chainId) => {
|
|
1280
1309
|
const normalized = typeof chainId === "string" ? chainId : `0x${Number(chainId).toString(16)}`;
|
|
1281
1310
|
if (normalized !== this.lastKnownChainId) {
|
|
@@ -1300,7 +1329,7 @@ var WalletConnectAdapter = class {
|
|
|
1300
1329
|
if (!namespaces) return [];
|
|
1301
1330
|
const accounts = [];
|
|
1302
1331
|
Object.values(namespaces).forEach((ns) => {
|
|
1303
|
-
_optionalChain([ns, 'optionalAccess',
|
|
1332
|
+
_optionalChain([ns, 'optionalAccess', _115 => _115.accounts, 'optionalAccess', _116 => _116.forEach, 'call', _117 => _117((account) => {
|
|
1304
1333
|
const address = account.split(":")[2];
|
|
1305
1334
|
if (address) accounts.push(address);
|
|
1306
1335
|
})]);
|
|
@@ -1309,19 +1338,19 @@ var WalletConnectAdapter = class {
|
|
|
1309
1338
|
}
|
|
1310
1339
|
hasAccountsChanged(newAccounts) {
|
|
1311
1340
|
if (newAccounts.length !== this.lastKnownAccounts.length) return true;
|
|
1312
|
-
return newAccounts.some((acc, i) => acc.toLowerCase() !== _optionalChain([this, 'access',
|
|
1341
|
+
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
1342
|
}
|
|
1314
1343
|
removeListeners() {
|
|
1315
1344
|
if (this.accountsChangedCallback) {
|
|
1316
|
-
_optionalChain([this, 'access',
|
|
1345
|
+
_optionalChain([this, 'access', _122 => _122.provider, 'optionalAccess', _123 => _123.removeListener, 'optionalCall', _124 => _124("accountsChanged", this.accountsChangedCallback)]);
|
|
1317
1346
|
this.accountsChangedCallback = null;
|
|
1318
1347
|
}
|
|
1319
1348
|
if (this.chainChangedCallback) {
|
|
1320
|
-
_optionalChain([this, 'access',
|
|
1349
|
+
_optionalChain([this, 'access', _125 => _125.provider, 'optionalAccess', _126 => _126.removeListener, 'optionalCall', _127 => _127("chainChanged", this.chainChangedCallback)]);
|
|
1321
1350
|
this.chainChangedCallback = null;
|
|
1322
1351
|
}
|
|
1323
1352
|
if (this.sessionUpdateHandler) {
|
|
1324
|
-
_optionalChain([this, 'access',
|
|
1353
|
+
_optionalChain([this, 'access', _128 => _128.universalProvider, 'optionalAccess', _129 => _129.removeListener, 'optionalCall', _130 => _130("session_update", this.sessionUpdateHandler)]);
|
|
1325
1354
|
this.sessionUpdateHandler = null;
|
|
1326
1355
|
}
|
|
1327
1356
|
this.disconnectCallback = null;
|
|
@@ -1333,21 +1362,20 @@ var WalletConnectAdapter = class {
|
|
|
1333
1362
|
};
|
|
1334
1363
|
|
|
1335
1364
|
// src/wallet-adapters/EmailAdapter.ts
|
|
1336
|
-
|
|
1337
|
-
|
|
1365
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
1338
1366
|
var _EmailAdapter = class _EmailAdapter {
|
|
1339
1367
|
constructor(config) {
|
|
1340
|
-
this.id =
|
|
1341
|
-
this.name =
|
|
1342
|
-
this.icon = _nullishCoalesce(
|
|
1368
|
+
this.id = _chunkGTEGWUGUjs.WalletId.Email;
|
|
1369
|
+
this.name = _chunkGTEGWUGUjs.WalletName.Email;
|
|
1370
|
+
this.icon = _nullishCoalesce(_chunkGTEGWUGUjs.getLogoDataUri.call(void 0, _chunkGTEGWUGUjs.WalletId.Email, "brand"), () => ( ""));
|
|
1343
1371
|
this.hide = true;
|
|
1344
1372
|
this.downloadUrl = null;
|
|
1345
1373
|
this.wcDeepLinkUrl = null;
|
|
1346
1374
|
this.provider = null;
|
|
1347
1375
|
this.initPromise = null;
|
|
1348
1376
|
this.publicClientCache = /* @__PURE__ */ new Map();
|
|
1349
|
-
this.projectId = _optionalChain([config, 'optionalAccess',
|
|
1350
|
-
this.telemetry = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1377
|
+
this.projectId = _optionalChain([config, 'optionalAccess', _131 => _131.projectId]) || "";
|
|
1378
|
+
this.telemetry = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _132 => _132.telemetry]), () => ( false));
|
|
1351
1379
|
}
|
|
1352
1380
|
async ensureInitialized() {
|
|
1353
1381
|
if (this.provider) return;
|
|
@@ -1361,21 +1389,16 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1361
1389
|
}
|
|
1362
1390
|
async emailAuthStart(email) {
|
|
1363
1391
|
if (!this.projectId) {
|
|
1364
|
-
throw
|
|
1392
|
+
throw _chunkGTEGWUGUjs.createConfigError.call(void 0, "Email");
|
|
1365
1393
|
}
|
|
1366
1394
|
await this.ensureInitialized();
|
|
1367
1395
|
if (!this.provider) {
|
|
1368
|
-
|
|
1396
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Email is not available");
|
|
1369
1397
|
throw new Error("Email is not available");
|
|
1370
1398
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
return authResult;
|
|
1375
|
-
} catch (error) {
|
|
1376
|
-
_chunkMHRKTE55js.sentryLogger.error("Failed to start email authentication", { error });
|
|
1377
|
-
throw error;
|
|
1378
|
-
}
|
|
1399
|
+
const { signInWithEmail } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-ZRK5OLZ5.js")));
|
|
1400
|
+
const authResult = await signInWithEmail({ email });
|
|
1401
|
+
return authResult;
|
|
1379
1402
|
}
|
|
1380
1403
|
async emailAuthVerify(flowId, otp) {
|
|
1381
1404
|
if (!flowId || !otp) {
|
|
@@ -1383,14 +1406,14 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1383
1406
|
}
|
|
1384
1407
|
await this.ensureInitialized();
|
|
1385
1408
|
if (!this.provider) {
|
|
1386
|
-
|
|
1409
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Email provider not initialized");
|
|
1387
1410
|
throw new Error("Email provider not initialized");
|
|
1388
1411
|
}
|
|
1389
|
-
const { verifyEmailOTP } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1412
|
+
const { verifyEmailOTP } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-ZRK5OLZ5.js")));
|
|
1390
1413
|
return verifyEmailOTP({ flowId, otp });
|
|
1391
1414
|
}
|
|
1392
1415
|
async connect() {
|
|
1393
|
-
|
|
1416
|
+
_chunkGTEGWUGUjs.sentryLogger.error("EmailAdapter.connect() is not implemented");
|
|
1394
1417
|
throw new Error("EmailAdapter.connect() is not implemented");
|
|
1395
1418
|
}
|
|
1396
1419
|
async tryRestoreConnection() {
|
|
@@ -1418,7 +1441,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1418
1441
|
async disconnect() {
|
|
1419
1442
|
try {
|
|
1420
1443
|
await this.ensureInitialized();
|
|
1421
|
-
const { signOut } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1444
|
+
const { signOut } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-ZRK5OLZ5.js")));
|
|
1422
1445
|
await signOut();
|
|
1423
1446
|
} catch (e12) {
|
|
1424
1447
|
}
|
|
@@ -1464,7 +1487,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1464
1487
|
* Called by ensureInitialized() - deduplication handled via initPromise.
|
|
1465
1488
|
*/
|
|
1466
1489
|
async initializeProvider() {
|
|
1467
|
-
const { initialize } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1490
|
+
const { initialize } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-ZRK5OLZ5.js")));
|
|
1468
1491
|
await initialize({
|
|
1469
1492
|
projectId: this.projectId,
|
|
1470
1493
|
ethereum: {
|
|
@@ -1482,7 +1505,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1482
1505
|
async createProvider() {
|
|
1483
1506
|
try {
|
|
1484
1507
|
await _EmailAdapter.initializeChainData();
|
|
1485
|
-
const { createCDPEmbeddedWallet } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1508
|
+
const { createCDPEmbeddedWallet } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-ZRK5OLZ5.js")));
|
|
1486
1509
|
const wallet = createCDPEmbeddedWallet({
|
|
1487
1510
|
chains: _EmailAdapter.viemChains,
|
|
1488
1511
|
transports: _EmailAdapter.viemTransports
|
|
@@ -1495,15 +1518,15 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1495
1518
|
try {
|
|
1496
1519
|
return await base.request(args);
|
|
1497
1520
|
} catch (err) {
|
|
1498
|
-
const msg = String(_optionalChain([err, 'optionalAccess',
|
|
1499
|
-
const isUnsupported = msg.includes("not supported") || msg.includes("Unsupported") || _optionalChain([err, 'optionalAccess',
|
|
1521
|
+
const msg = String(_optionalChain([err, 'optionalAccess', _133 => _133.message]) || "");
|
|
1522
|
+
const isUnsupported = msg.includes("not supported") || msg.includes("Unsupported") || _optionalChain([err, 'optionalAccess', _134 => _134.code]) === -32601;
|
|
1500
1523
|
if (isUnsupported) {
|
|
1501
1524
|
let chainId;
|
|
1502
1525
|
try {
|
|
1503
1526
|
const chainIdHex = await base.request({ method: "eth_chainId", params: [] });
|
|
1504
1527
|
chainId = parseInt(chainIdHex, 16);
|
|
1505
1528
|
} catch (e13) {
|
|
1506
|
-
|
|
1529
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Failed to get chainId for fallback request");
|
|
1507
1530
|
throw new Error("Failed to get chainId for fallback request");
|
|
1508
1531
|
}
|
|
1509
1532
|
const publicClient = await getPublicClient(chainId);
|
|
@@ -1518,7 +1541,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1518
1541
|
};
|
|
1519
1542
|
return wrapped;
|
|
1520
1543
|
} catch (error) {
|
|
1521
|
-
|
|
1544
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Failed to initialize Email provider", { error });
|
|
1522
1545
|
return null;
|
|
1523
1546
|
}
|
|
1524
1547
|
}
|
|
@@ -1544,10 +1567,10 @@ function createWalletAdapters({
|
|
|
1544
1567
|
telemetry
|
|
1545
1568
|
}) {
|
|
1546
1569
|
return [
|
|
1547
|
-
new EmailAdapter({ projectId: _optionalChain([walletsConfig, 'optionalAccess',
|
|
1570
|
+
new EmailAdapter({ projectId: _optionalChain([walletsConfig, 'optionalAccess', _135 => _135.embedded, 'optionalAccess', _136 => _136.projectId]), telemetry }),
|
|
1548
1571
|
new MetaMaskAdapter(),
|
|
1549
1572
|
new WalletConnectAdapter({
|
|
1550
|
-
projectId: _optionalChain([walletsConfig, 'optionalAccess',
|
|
1573
|
+
projectId: _optionalChain([walletsConfig, 'optionalAccess', _137 => _137.walletConnect, 'optionalAccess', _138 => _138.projectId]),
|
|
1551
1574
|
appName,
|
|
1552
1575
|
modalZIndex,
|
|
1553
1576
|
theme,
|
|
@@ -1560,10 +1583,8 @@ function createWalletAdapters({
|
|
|
1560
1583
|
];
|
|
1561
1584
|
}
|
|
1562
1585
|
|
|
1563
|
-
// src/AurumCore.ts
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
1586
|
// src/providers/RpcProvider.ts
|
|
1587
|
+
_chunkIQ7F5R7Djs.init_polyfills.call(void 0, );
|
|
1567
1588
|
var ProviderRpcError = class extends Error {
|
|
1568
1589
|
constructor(code, message, data) {
|
|
1569
1590
|
super(message);
|
|
@@ -1647,9 +1668,9 @@ var _AurumCore = class _AurumCore {
|
|
|
1647
1668
|
return _AurumCore.instance;
|
|
1648
1669
|
}
|
|
1649
1670
|
const telemetryEnabled = config.telemetry !== false;
|
|
1650
|
-
|
|
1671
|
+
_chunkGTEGWUGUjs.initSentry.call(void 0, telemetryEnabled);
|
|
1651
1672
|
this.brandConfig = this.resolveBrandConfig(config);
|
|
1652
|
-
this.excludedWallets = new Set(_nullishCoalesce(_optionalChain([config, 'access',
|
|
1673
|
+
this.excludedWallets = new Set(_nullishCoalesce(_optionalChain([config, 'access', _139 => _139.wallets, 'optionalAccess', _140 => _140.exclude]), () => ( [])));
|
|
1653
1674
|
this.wallets = createWalletAdapters({
|
|
1654
1675
|
walletsConfig: config.wallets,
|
|
1655
1676
|
appName: this.brandConfig.appName,
|
|
@@ -1686,7 +1707,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1686
1707
|
if (walletId === "email") {
|
|
1687
1708
|
throw new Error("Use emailAuthStart() and emailAuthVerify() for email wallet connections");
|
|
1688
1709
|
}
|
|
1689
|
-
if (_optionalChain([this, 'access',
|
|
1710
|
+
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
1711
|
if (!walletId || this.userInfo.walletId === walletId) {
|
|
1691
1712
|
return this.userInfo.publicAddress;
|
|
1692
1713
|
}
|
|
@@ -1702,7 +1723,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1702
1723
|
if (!adapter) {
|
|
1703
1724
|
throw new Error(`${walletId} is not configured`);
|
|
1704
1725
|
}
|
|
1705
|
-
if (walletId ===
|
|
1726
|
+
if (walletId === _chunkGTEGWUGUjs.WalletId.WalletConnect && adapter.openModal) {
|
|
1706
1727
|
result = await adapter.openModal();
|
|
1707
1728
|
} else {
|
|
1708
1729
|
if (!adapter.isInstalled()) {
|
|
@@ -1714,19 +1735,19 @@ var _AurumCore = class _AurumCore {
|
|
|
1714
1735
|
const displayedWallets = this.wallets.filter((w) => !this.excludedWallets.has(w.id));
|
|
1715
1736
|
const modalResult = await renderConnectModal({ displayedWallets, brandConfig: this.brandConfig });
|
|
1716
1737
|
if (!modalResult) {
|
|
1717
|
-
|
|
1738
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Missing modal result");
|
|
1718
1739
|
throw new Error("Missing modal result");
|
|
1719
1740
|
}
|
|
1720
1741
|
adapter = this.wallets.find((w) => w.id === modalResult.walletId) || null;
|
|
1721
1742
|
if (!adapter) {
|
|
1722
|
-
|
|
1743
|
+
_chunkGTEGWUGUjs.sentryLogger.error(`Selected wallet adapter not found: ${modalResult.walletId}`);
|
|
1723
1744
|
throw new Error("Selected wallet adapter not found");
|
|
1724
1745
|
}
|
|
1725
1746
|
result = modalResult;
|
|
1726
1747
|
}
|
|
1727
1748
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1728
1749
|
if (!provider) {
|
|
1729
|
-
|
|
1750
|
+
_chunkGTEGWUGUjs.sentryLogger.error(`Error fetching provider on login: ${adapter.id}`);
|
|
1730
1751
|
throw new Error("Error fetching provider. Please try again.");
|
|
1731
1752
|
}
|
|
1732
1753
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1743,7 +1764,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1743
1764
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1744
1765
|
this.emitConnect(chainId);
|
|
1745
1766
|
this.emitAccountsChanged([checksumAdr]);
|
|
1746
|
-
|
|
1767
|
+
_chunkGTEGWUGUjs.sentryLogger.info(`Wallet connected: ${adapter.id} (${walletId ? "headless" : "modal"})`);
|
|
1747
1768
|
return checksumAdr;
|
|
1748
1769
|
}
|
|
1749
1770
|
async disconnect() {
|
|
@@ -1763,7 +1784,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1763
1784
|
async isConnected() {
|
|
1764
1785
|
await this.whenReady();
|
|
1765
1786
|
return Boolean(
|
|
1766
|
-
_optionalChain([this, 'access',
|
|
1787
|
+
_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
1788
|
);
|
|
1768
1789
|
}
|
|
1769
1790
|
async handleWidgetConnection(result) {
|
|
@@ -1772,7 +1793,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1772
1793
|
if (!adapter) throw new Error("Selected wallet adapter not found");
|
|
1773
1794
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1774
1795
|
if (!provider) {
|
|
1775
|
-
|
|
1796
|
+
_chunkGTEGWUGUjs.sentryLogger.error(`Error fetching provider on widget login: ${_optionalChain([result, 'optionalAccess', _153 => _153.walletId])}`);
|
|
1776
1797
|
throw new Error("Error fetching provider. Please try again.");
|
|
1777
1798
|
}
|
|
1778
1799
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1789,7 +1810,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1789
1810
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1790
1811
|
this.emitConnect(chainId);
|
|
1791
1812
|
this.emitAccountsChanged([checksumAdr]);
|
|
1792
|
-
|
|
1813
|
+
_chunkGTEGWUGUjs.sentryLogger.info(`Wallet connected: ${adapter.id} (widget)`);
|
|
1793
1814
|
return this.userInfo;
|
|
1794
1815
|
}
|
|
1795
1816
|
async getChainId() {
|
|
@@ -1808,7 +1829,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1808
1829
|
}
|
|
1809
1830
|
}
|
|
1810
1831
|
updateBrandConfig(newConfig) {
|
|
1811
|
-
const defaultTheme =
|
|
1832
|
+
const defaultTheme = _chunkGTEGWUGUjs.getDefaultThemeConfig.call(void 0, _nullishCoalesce(newConfig.theme, () => ( this.brandConfig.theme)));
|
|
1812
1833
|
this.brandConfig = {
|
|
1813
1834
|
logo: "logo" in newConfig ? _nullishCoalesce(newConfig.logo, () => ( defaultTheme.logo)) : this.brandConfig.logo,
|
|
1814
1835
|
theme: "theme" in newConfig ? _nullishCoalesce(newConfig.theme, () => ( defaultTheme.theme)) : this.brandConfig.theme,
|
|
@@ -1821,8 +1842,8 @@ var _AurumCore = class _AurumCore {
|
|
|
1821
1842
|
walletLayout: "walletLayout" in newConfig ? _nullishCoalesce(newConfig.walletLayout, () => ( defaultTheme.walletLayout)) : this.brandConfig.walletLayout
|
|
1822
1843
|
};
|
|
1823
1844
|
if ("theme" in newConfig && this.brandConfig.theme) {
|
|
1824
|
-
const wcAdapter = this.wallets.find((w) => w.id ===
|
|
1825
|
-
_optionalChain([wcAdapter, 'optionalAccess',
|
|
1845
|
+
const wcAdapter = this.wallets.find((w) => w.id === _chunkGTEGWUGUjs.WalletId.WalletConnect);
|
|
1846
|
+
_optionalChain([wcAdapter, 'optionalAccess', _154 => _154.updateTheme, 'call', _155 => _155(this.brandConfig.theme)]);
|
|
1826
1847
|
}
|
|
1827
1848
|
}
|
|
1828
1849
|
updateWalletsConfig(newConfig) {
|
|
@@ -1837,7 +1858,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1837
1858
|
*/
|
|
1838
1859
|
async emailAuthStart(email) {
|
|
1839
1860
|
await this.whenReady();
|
|
1840
|
-
const emailAdapter = this.wallets.find((w) => w.id ===
|
|
1861
|
+
const emailAdapter = this.wallets.find((w) => w.id === _chunkGTEGWUGUjs.WalletId.Email);
|
|
1841
1862
|
if (!emailAdapter || !emailAdapter.emailAuthStart) {
|
|
1842
1863
|
throw new Error("Email wallet is not configured");
|
|
1843
1864
|
}
|
|
@@ -1852,20 +1873,20 @@ var _AurumCore = class _AurumCore {
|
|
|
1852
1873
|
*/
|
|
1853
1874
|
async emailAuthVerify(flowId, otp) {
|
|
1854
1875
|
await this.whenReady();
|
|
1855
|
-
const emailAdapter = this.wallets.find((w) => w.id ===
|
|
1876
|
+
const emailAdapter = this.wallets.find((w) => w.id === _chunkGTEGWUGUjs.WalletId.Email);
|
|
1856
1877
|
if (!emailAdapter || !emailAdapter.emailAuthVerify) {
|
|
1857
1878
|
throw new Error("Email wallet is not configured");
|
|
1858
1879
|
}
|
|
1859
1880
|
const verifyResult = await emailAdapter.emailAuthVerify(flowId, otp);
|
|
1860
1881
|
const provider = emailAdapter.getProvider();
|
|
1861
1882
|
if (!provider) {
|
|
1862
|
-
|
|
1883
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Failed to get provider after email verification");
|
|
1863
1884
|
throw new Error("Failed to get provider after email verification");
|
|
1864
1885
|
}
|
|
1865
|
-
const address = _optionalChain([verifyResult, 'access',
|
|
1866
|
-
const email = _optionalChain([verifyResult, 'access',
|
|
1886
|
+
const address = _optionalChain([verifyResult, 'access', _156 => _156.user, 'optionalAccess', _157 => _157.evmAccounts, 'optionalAccess', _158 => _158[0]]);
|
|
1887
|
+
const email = _optionalChain([verifyResult, 'access', _159 => _159.user, 'optionalAccess', _160 => _160.authenticationMethods, 'optionalAccess', _161 => _161.email, 'optionalAccess', _162 => _162.email]);
|
|
1867
1888
|
if (!address || !email) {
|
|
1868
|
-
|
|
1889
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Address or email not found after email verification");
|
|
1869
1890
|
throw new Error("Address or email not found after email verification");
|
|
1870
1891
|
}
|
|
1871
1892
|
const checksumAdr = _viem.checksumAddress.call(void 0, address);
|
|
@@ -1882,7 +1903,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1882
1903
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1883
1904
|
this.emitConnect(chainId);
|
|
1884
1905
|
this.emitAccountsChanged([checksumAdr]);
|
|
1885
|
-
|
|
1906
|
+
_chunkGTEGWUGUjs.sentryLogger.info(`Wallet connected: ${emailAdapter.id} (headless)`);
|
|
1886
1907
|
return { address: checksumAdr, email: _nullishCoalesce(email, () => ( "")), isNewUser: _nullishCoalesce(verifyResult.isNewUser, () => ( false)) };
|
|
1887
1908
|
}
|
|
1888
1909
|
/**
|
|
@@ -1891,7 +1912,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1891
1912
|
*/
|
|
1892
1913
|
async getWalletConnectSession() {
|
|
1893
1914
|
await this.whenReady();
|
|
1894
|
-
const wcAdapter = this.wallets.find((w) => w.id ===
|
|
1915
|
+
const wcAdapter = this.wallets.find((w) => w.id === _chunkGTEGWUGUjs.WalletId.WalletConnect);
|
|
1895
1916
|
if (!wcAdapter) {
|
|
1896
1917
|
throw new Error("WalletConnect is not enabled");
|
|
1897
1918
|
}
|
|
@@ -1902,7 +1923,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1902
1923
|
const result = await session.waitForConnection();
|
|
1903
1924
|
const provider = _nullishCoalesce(result.provider, () => ( wcAdapter.getProvider()));
|
|
1904
1925
|
if (!provider) {
|
|
1905
|
-
|
|
1926
|
+
_chunkGTEGWUGUjs.sentryLogger.error("Failed to get provider after WalletConnect connection");
|
|
1906
1927
|
throw new Error("Failed to get provider after WalletConnect connection");
|
|
1907
1928
|
}
|
|
1908
1929
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1918,7 +1939,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1918
1939
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1919
1940
|
this.emitConnect(chainId);
|
|
1920
1941
|
this.emitAccountsChanged([checksumAdr]);
|
|
1921
|
-
|
|
1942
|
+
_chunkGTEGWUGUjs.sentryLogger.info(`Wallet connected: ${wcAdapter.id} (headless)`);
|
|
1922
1943
|
return checksumAdr;
|
|
1923
1944
|
}
|
|
1924
1945
|
};
|
|
@@ -1934,15 +1955,15 @@ var _AurumCore = class _AurumCore {
|
|
|
1934
1955
|
}
|
|
1935
1956
|
this.eventListeners.get(event).add(callback);
|
|
1936
1957
|
if (!_AurumCore.MANAGED_EVENTS.includes(event)) {
|
|
1937
|
-
_optionalChain([this, 'access',
|
|
1958
|
+
_optionalChain([this, 'access', _163 => _163.currentProvider, 'access', _164 => _164.on, 'optionalCall', _165 => _165(event, callback)]);
|
|
1938
1959
|
}
|
|
1939
1960
|
};
|
|
1940
1961
|
}
|
|
1941
1962
|
if (prop === "removeListener") {
|
|
1942
1963
|
return (event, callback) => {
|
|
1943
|
-
_optionalChain([this, 'access',
|
|
1964
|
+
_optionalChain([this, 'access', _166 => _166.eventListeners, 'access', _167 => _167.get, 'call', _168 => _168(event), 'optionalAccess', _169 => _169.delete, 'call', _170 => _170(callback)]);
|
|
1944
1965
|
if (!_AurumCore.MANAGED_EVENTS.includes(event)) {
|
|
1945
|
-
_optionalChain([this, 'access',
|
|
1966
|
+
_optionalChain([this, 'access', _171 => _171.currentProvider, 'access', _172 => _172.removeListener, 'optionalCall', _173 => _173(event, callback)]);
|
|
1946
1967
|
}
|
|
1947
1968
|
};
|
|
1948
1969
|
}
|
|
@@ -1967,7 +1988,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1967
1988
|
this.eventListeners.forEach((callbacks, event) => {
|
|
1968
1989
|
if (!_AurumCore.MANAGED_EVENTS.includes(event)) {
|
|
1969
1990
|
callbacks.forEach((callback) => {
|
|
1970
|
-
_optionalChain([newProvider, 'access',
|
|
1991
|
+
_optionalChain([newProvider, 'access', _174 => _174.on, 'optionalCall', _175 => _175(event, callback)]);
|
|
1971
1992
|
});
|
|
1972
1993
|
}
|
|
1973
1994
|
});
|
|
@@ -1975,7 +1996,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1975
1996
|
/* BRAND & THEME METHODS */
|
|
1976
1997
|
resolveBrandConfig(config) {
|
|
1977
1998
|
const { brand = {} } = config || {};
|
|
1978
|
-
const themeConfig =
|
|
1999
|
+
const themeConfig = _chunkGTEGWUGUjs.getDefaultThemeConfig.call(void 0, brand.theme || _chunkGTEGWUGUjs.DEFAULT_THEME);
|
|
1979
2000
|
return {
|
|
1980
2001
|
logo: _nullishCoalesce(brand.logo, () => ( themeConfig.logo)),
|
|
1981
2002
|
theme: _nullishCoalesce(brand.theme, () => ( themeConfig.theme)),
|
|
@@ -1990,8 +2011,8 @@ var _AurumCore = class _AurumCore {
|
|
|
1990
2011
|
}
|
|
1991
2012
|
async tryRestoreConnection() {
|
|
1992
2013
|
try {
|
|
1993
|
-
await
|
|
1994
|
-
const store =
|
|
2014
|
+
await _chunkGTEGWUGUjs.waitForStoreHydration.call(void 0, );
|
|
2015
|
+
const store = _chunkGTEGWUGUjs.useAurumStore.getState();
|
|
1995
2016
|
if (!store.isConnected || !store.walletId || !store.address || !store.walletName) {
|
|
1996
2017
|
return;
|
|
1997
2018
|
}
|
|
@@ -2021,7 +2042,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2021
2042
|
}
|
|
2022
2043
|
}
|
|
2023
2044
|
persistConnectionState(adapter, address, email) {
|
|
2024
|
-
|
|
2045
|
+
_chunkGTEGWUGUjs.useAurumStore.getState().setConnection(adapter.id, _viem.checksumAddress.call(void 0, address), adapter.name, email);
|
|
2025
2046
|
}
|
|
2026
2047
|
/* INTERNAL LISTENER METHODS */
|
|
2027
2048
|
setInternalAccountChangeListener(adapter) {
|
|
@@ -2035,14 +2056,14 @@ var _AurumCore = class _AurumCore {
|
|
|
2035
2056
|
}
|
|
2036
2057
|
async syncStateFromAccountsChanged(accounts) {
|
|
2037
2058
|
if (!accounts.length || !accounts[0]) return;
|
|
2038
|
-
const prevAccount = _optionalChain([this, 'access',
|
|
2059
|
+
const prevAccount = _optionalChain([this, 'access', _176 => _176.userInfo, 'optionalAccess', _177 => _177.publicAddress]);
|
|
2039
2060
|
const newAccount = _viem.checksumAddress.call(void 0, accounts[0]);
|
|
2040
2061
|
if (newAccount !== prevAccount) {
|
|
2041
2062
|
this.userInfo = {
|
|
2042
2063
|
publicAddress: newAccount,
|
|
2043
|
-
walletName: _optionalChain([this, 'access',
|
|
2044
|
-
walletId: _optionalChain([this, 'access',
|
|
2045
|
-
email: _optionalChain([this, 'access',
|
|
2064
|
+
walletName: _optionalChain([this, 'access', _178 => _178.userInfo, 'optionalAccess', _179 => _179.walletName]),
|
|
2065
|
+
walletId: _optionalChain([this, 'access', _180 => _180.userInfo, 'optionalAccess', _181 => _181.walletId]),
|
|
2066
|
+
email: _optionalChain([this, 'access', _182 => _182.userInfo, 'optionalAccess', _183 => _183.email])
|
|
2046
2067
|
};
|
|
2047
2068
|
if (this.connectedWalletAdapter) {
|
|
2048
2069
|
this.persistConnectionState(this.connectedWalletAdapter, newAccount, this.userInfo.email);
|
|
@@ -2101,7 +2122,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2101
2122
|
}
|
|
2102
2123
|
}
|
|
2103
2124
|
async addChain(chain) {
|
|
2104
|
-
if (!_optionalChain([chain, 'optionalAccess',
|
|
2125
|
+
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
2126
|
throw new Error("Invalid chain configuration: missing required properties");
|
|
2106
2127
|
}
|
|
2107
2128
|
await this.rpcProvider.request({
|
|
@@ -2119,7 +2140,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2119
2140
|
}
|
|
2120
2141
|
/* REST */
|
|
2121
2142
|
resetConnectionState() {
|
|
2122
|
-
|
|
2143
|
+
_chunkGTEGWUGUjs.useAurumStore.getState().clearConnection();
|
|
2123
2144
|
this.connectedWalletAdapter = null;
|
|
2124
2145
|
this.updateProvider(this.skeletonProvider);
|
|
2125
2146
|
this.userInfo = void 0;
|