@aurum-sdk/core 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-27AOACEW.js +13332 -0
- package/dist/chunk-4EBNC4R3.js +33 -0
- package/dist/chunk-DRID67T7.mjs +33 -0
- package/dist/chunk-J6XFKNJN.mjs +1878 -0
- package/dist/chunk-QIPVNM7T.js +1878 -0
- package/dist/chunk-X6ADRWYF.mjs +13332 -0
- package/dist/chunk-XTOUIIXZ.js +891 -0
- package/dist/chunk-YP64HBUK.mjs +891 -0
- package/dist/dist-7I773YNF.js +4825 -0
- package/dist/dist-YBFFGXT3.mjs +4825 -0
- package/dist/index.js +116 -96
- package/dist/index.mjs +67 -47
- package/dist/index.web-T26HBS3X.mjs +28161 -0
- package/dist/index.web-WXUV52ZW.js +28161 -0
- package/dist/widgets.js +24 -12
- package/dist/widgets.mjs +13 -1
- package/package.json +4 -4
- package/dist/chunk-JXTTDJRM.js +0 -2455
- package/dist/chunk-KAP5LMPM.mjs +0 -2455
package/dist/index.js
CHANGED
|
@@ -13,12 +13,27 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunk27AOACEWjs = require('./chunk-27AOACEW.js');
|
|
20
|
+
require('./chunk-4EBNC4R3.js');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _chunkQIPVNM7Tjs = require('./chunk-QIPVNM7T.js');
|
|
24
|
+
|
|
25
|
+
// src/index.ts
|
|
26
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
27
|
+
|
|
28
|
+
// src/Aurum.ts
|
|
29
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
17
30
|
|
|
18
31
|
// src/AurumCore.ts
|
|
32
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
19
33
|
var _viem = require('viem');
|
|
20
34
|
|
|
21
35
|
// src/utils/chainHelpers.ts
|
|
36
|
+
_chunkQIPVNM7Tjs.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
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
60
|
+
|
|
43
61
|
// src/components/ConnectModal/ModalShell.tsx
|
|
62
|
+
_chunkQIPVNM7Tjs.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 } = _chunk27AOACEWjs.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
|
+
_chunk27AOACEWjs.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, _chunk27AOACEWjs.ConnectPages, {})
|
|
62
81
|
}
|
|
63
82
|
);
|
|
64
83
|
};
|
|
65
84
|
|
|
66
85
|
// src/utils/createModalContainer.ts
|
|
86
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
67
87
|
var _client = require('react-dom/client');
|
|
68
88
|
|
|
69
89
|
// src/utils/createShadowRoot.ts
|
|
90
|
+
_chunkQIPVNM7Tjs.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>${_chunk27AOACEWjs.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 = _chunk27AOACEWjs.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, _chunk27AOACEWjs.ThemeContainer, { theme: brandConfig.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk27AOACEWjs.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
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
149
|
+
|
|
150
|
+
// src/wallet-adapters/index.ts
|
|
151
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
152
|
+
|
|
126
153
|
// src/wallet-adapters/RabbyAdapter.ts
|
|
127
|
-
|
|
128
|
-
var _types = require('@aurum-sdk/types');
|
|
154
|
+
_chunkQIPVNM7Tjs.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 = _chunk27AOACEWjs.WalletId.Rabby;
|
|
159
|
+
this.name = _chunk27AOACEWjs.WalletName.Rabby;
|
|
160
|
+
this.icon = _nullishCoalesce(_chunk27AOACEWjs.getLogoDataUri.call(void 0, _chunk27AOACEWjs.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
|
+
_chunk27AOACEWjs.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
|
+
_chunk27AOACEWjs.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
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
263
288
|
|
|
264
289
|
// src/utils/platform/isBraveBrowser.ts
|
|
290
|
+
_chunkQIPVNM7Tjs.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 = _chunk27AOACEWjs.WalletId.Brave;
|
|
301
|
+
this.name = _chunk27AOACEWjs.WalletName.Brave;
|
|
302
|
+
this.icon = _nullishCoalesce(_chunk27AOACEWjs.getLogoDataUri.call(void 0, _chunk27AOACEWjs.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
|
+
_chunk27AOACEWjs.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
|
+
_chunk27AOACEWjs.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
|
+
_chunkQIPVNM7Tjs.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 = _chunk27AOACEWjs.WalletId.Phantom;
|
|
438
|
+
this.name = _chunk27AOACEWjs.WalletName.Phantom;
|
|
439
|
+
this.icon = _nullishCoalesce(_chunk27AOACEWjs.getLogoDataUri.call(void 0, _chunk27AOACEWjs.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
|
+
_chunk27AOACEWjs.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
|
+
_chunk27AOACEWjs.sentryLogger.error("No accounts returned from Phantom");
|
|
491
516
|
throw new Error("No accounts returned from Phantom");
|
|
492
517
|
}
|
|
493
518
|
return {
|
|
@@ -543,13 +568,12 @@ var PhantomAdapter = class {
|
|
|
543
568
|
};
|
|
544
569
|
|
|
545
570
|
// src/wallet-adapters/CoinbaseWalletAdapter.ts
|
|
546
|
-
|
|
547
|
-
|
|
571
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
548
572
|
var CoinbaseWalletAdapter = class {
|
|
549
573
|
constructor({ appName, appLogoUrl, telemetry }) {
|
|
550
|
-
this.id =
|
|
551
|
-
this.name =
|
|
552
|
-
this.icon = _nullishCoalesce(
|
|
574
|
+
this.id = _chunk27AOACEWjs.WalletId.CoinbaseWallet;
|
|
575
|
+
this.name = _chunk27AOACEWjs.WalletName.CoinbaseWallet;
|
|
576
|
+
this.icon = _nullishCoalesce(_chunk27AOACEWjs.getLogoDataUri.call(void 0, _chunk27AOACEWjs.WalletId.CoinbaseWallet, "brand"), () => ( ""));
|
|
553
577
|
this.hide = false;
|
|
554
578
|
this.downloadUrl = "https://www.coinbase.com/wallet/downloads";
|
|
555
579
|
this.wcDeepLinkUrl = "cbwallet://wc?uri=";
|
|
@@ -568,7 +592,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
568
592
|
async initializeProvider() {
|
|
569
593
|
if (typeof window === "undefined") return;
|
|
570
594
|
try {
|
|
571
|
-
const { createCoinbaseWalletSDK } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
595
|
+
const { createCoinbaseWalletSDK } = await Promise.resolve().then(() => _interopRequireWildcard(require("./dist-7I773YNF.js")));
|
|
572
596
|
const coinbaseSdk = createCoinbaseWalletSDK({
|
|
573
597
|
appName: this.config.appName,
|
|
574
598
|
appLogoUrl: this.config.appLogoUrl,
|
|
@@ -579,7 +603,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
579
603
|
});
|
|
580
604
|
this.provider = coinbaseSdk.getProvider();
|
|
581
605
|
} catch (error) {
|
|
582
|
-
|
|
606
|
+
_chunk27AOACEWjs.sentryLogger.warn("Failed to initialize Coinbase Wallet provider", { error });
|
|
583
607
|
}
|
|
584
608
|
}
|
|
585
609
|
isInstalled() {
|
|
@@ -588,7 +612,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
588
612
|
async connect() {
|
|
589
613
|
await this.ensureInitialized();
|
|
590
614
|
if (!this.provider) {
|
|
591
|
-
|
|
615
|
+
_chunk27AOACEWjs.sentryLogger.error("Coinbase Wallet is not available");
|
|
592
616
|
throw new Error("Coinbase Wallet is not available");
|
|
593
617
|
}
|
|
594
618
|
const accounts = await this.provider.request({
|
|
@@ -596,7 +620,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
596
620
|
params: []
|
|
597
621
|
});
|
|
598
622
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
599
|
-
|
|
623
|
+
_chunk27AOACEWjs.sentryLogger.error("No accounts returned from Coinbase Wallet");
|
|
600
624
|
throw new Error("No accounts returned from Coinbase Wallet");
|
|
601
625
|
}
|
|
602
626
|
return {
|
|
@@ -636,7 +660,7 @@ var CoinbaseWalletAdapter = class {
|
|
|
636
660
|
await this.provider.disconnect();
|
|
637
661
|
}
|
|
638
662
|
} catch (error) {
|
|
639
|
-
|
|
663
|
+
_chunk27AOACEWjs.sentryLogger.warn("Error disconnecting from Coinbase Wallet", { error });
|
|
640
664
|
} finally {
|
|
641
665
|
this.clearLocalStorage();
|
|
642
666
|
}
|
|
@@ -675,14 +699,13 @@ var CoinbaseWalletAdapter = class {
|
|
|
675
699
|
};
|
|
676
700
|
|
|
677
701
|
// src/wallet-adapters/MetaMaskAdapter.ts
|
|
678
|
-
|
|
679
|
-
|
|
702
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
680
703
|
var METAMASK_RDNS = "io.metamask";
|
|
681
704
|
var MetaMaskAdapter = class {
|
|
682
705
|
constructor() {
|
|
683
|
-
this.id =
|
|
684
|
-
this.name =
|
|
685
|
-
this.icon = _nullishCoalesce(
|
|
706
|
+
this.id = _chunk27AOACEWjs.WalletId.MetaMask;
|
|
707
|
+
this.name = _chunk27AOACEWjs.WalletName.MetaMask;
|
|
708
|
+
this.icon = _nullishCoalesce(_chunk27AOACEWjs.getLogoDataUri.call(void 0, _chunk27AOACEWjs.WalletId.MetaMask, "brand"), () => ( ""));
|
|
686
709
|
this.hide = false;
|
|
687
710
|
this.downloadUrl = "https://metamask.io/download";
|
|
688
711
|
this.wcDeepLinkUrl = "metamask://wc?uri=";
|
|
@@ -747,7 +770,7 @@ var MetaMaskAdapter = class {
|
|
|
747
770
|
await this.providerPromise;
|
|
748
771
|
}
|
|
749
772
|
if (!this.provider) {
|
|
750
|
-
|
|
773
|
+
_chunk27AOACEWjs.sentryLogger.error("MetaMask is not available");
|
|
751
774
|
throw new Error("MetaMask is not available");
|
|
752
775
|
}
|
|
753
776
|
await this.provider.request({
|
|
@@ -759,7 +782,7 @@ var MetaMaskAdapter = class {
|
|
|
759
782
|
params: []
|
|
760
783
|
});
|
|
761
784
|
if (!accounts || accounts.length === 0 || !accounts[0]) {
|
|
762
|
-
|
|
785
|
+
_chunk27AOACEWjs.sentryLogger.error("No accounts returned from MetaMask");
|
|
763
786
|
throw new Error("No accounts returned from MetaMask");
|
|
764
787
|
}
|
|
765
788
|
return {
|
|
@@ -815,10 +838,10 @@ var MetaMaskAdapter = class {
|
|
|
815
838
|
};
|
|
816
839
|
|
|
817
840
|
// src/wallet-adapters/WalletConnectAdapter.ts
|
|
818
|
-
|
|
819
|
-
|
|
841
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
820
842
|
|
|
821
843
|
// src/constants/adapters.ts
|
|
844
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
822
845
|
var WALLETCONNECT_NAMESPACE = {
|
|
823
846
|
eip155: {
|
|
824
847
|
methods: [
|
|
@@ -911,9 +934,9 @@ function extractAddressFromSession(namespaces) {
|
|
|
911
934
|
}
|
|
912
935
|
var WalletConnectAdapter = class {
|
|
913
936
|
constructor(config) {
|
|
914
|
-
this.id =
|
|
915
|
-
this.name =
|
|
916
|
-
this.icon = _nullishCoalesce(
|
|
937
|
+
this.id = _chunk27AOACEWjs.WalletId.WalletConnect;
|
|
938
|
+
this.name = _chunk27AOACEWjs.WalletName.WalletConnect;
|
|
939
|
+
this.icon = _nullishCoalesce(_chunk27AOACEWjs.getLogoDataUri.call(void 0, _chunk27AOACEWjs.WalletId.WalletConnect, "brand"), () => ( ""));
|
|
917
940
|
this.hide = false;
|
|
918
941
|
this.downloadUrl = null;
|
|
919
942
|
this.wcDeepLinkUrl = null;
|
|
@@ -1051,13 +1074,13 @@ var WalletConnectAdapter = class {
|
|
|
1051
1074
|
this.provider = provider;
|
|
1052
1075
|
}
|
|
1053
1076
|
} catch (error) {
|
|
1054
|
-
|
|
1077
|
+
_chunk27AOACEWjs.sentryLogger.warn("Failed to get provider from wagmi connector", { error });
|
|
1055
1078
|
}
|
|
1056
1079
|
}
|
|
1057
1080
|
}
|
|
1058
1081
|
}
|
|
1059
1082
|
} catch (error) {
|
|
1060
|
-
|
|
1083
|
+
_chunk27AOACEWjs.sentryLogger.warn("Failed to get provider from WalletConnect", { error });
|
|
1061
1084
|
}
|
|
1062
1085
|
}
|
|
1063
1086
|
isInstalled() {
|
|
@@ -1100,7 +1123,7 @@ var WalletConnectAdapter = class {
|
|
|
1100
1123
|
* Emits walletconnect:uri event for QR code display.
|
|
1101
1124
|
*/
|
|
1102
1125
|
async connect() {
|
|
1103
|
-
if (!this.config.projectId) throw
|
|
1126
|
+
if (!this.config.projectId) throw _chunk27AOACEWjs.createConfigError.call(void 0, "WalletConnect");
|
|
1104
1127
|
await this.ensureInitialized();
|
|
1105
1128
|
if (!this.universalProvider) throw new Error("WalletConnect is not available");
|
|
1106
1129
|
await this.resetConnectionState();
|
|
@@ -1163,7 +1186,7 @@ var WalletConnectAdapter = class {
|
|
|
1163
1186
|
* Used on mobile and when user clicks "Open Modal" button.
|
|
1164
1187
|
*/
|
|
1165
1188
|
async openModal() {
|
|
1166
|
-
if (!this.config.projectId) throw
|
|
1189
|
+
if (!this.config.projectId) throw _chunk27AOACEWjs.createConfigError.call(void 0, "WalletConnect");
|
|
1167
1190
|
await this.ensureInitialized();
|
|
1168
1191
|
if (!this.modal) throw new Error("AppKit is not available");
|
|
1169
1192
|
await this.resetConnectionState();
|
|
@@ -1339,13 +1362,12 @@ var WalletConnectAdapter = class {
|
|
|
1339
1362
|
};
|
|
1340
1363
|
|
|
1341
1364
|
// src/wallet-adapters/EmailAdapter.ts
|
|
1342
|
-
|
|
1343
|
-
|
|
1365
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
1344
1366
|
var _EmailAdapter = class _EmailAdapter {
|
|
1345
1367
|
constructor(config) {
|
|
1346
|
-
this.id =
|
|
1347
|
-
this.name =
|
|
1348
|
-
this.icon = _nullishCoalesce(
|
|
1368
|
+
this.id = _chunk27AOACEWjs.WalletId.Email;
|
|
1369
|
+
this.name = _chunk27AOACEWjs.WalletName.Email;
|
|
1370
|
+
this.icon = _nullishCoalesce(_chunk27AOACEWjs.getLogoDataUri.call(void 0, _chunk27AOACEWjs.WalletId.Email, "brand"), () => ( ""));
|
|
1349
1371
|
this.hide = true;
|
|
1350
1372
|
this.downloadUrl = null;
|
|
1351
1373
|
this.wcDeepLinkUrl = null;
|
|
@@ -1367,14 +1389,14 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1367
1389
|
}
|
|
1368
1390
|
async emailAuthStart(email) {
|
|
1369
1391
|
if (!this.projectId) {
|
|
1370
|
-
throw
|
|
1392
|
+
throw _chunk27AOACEWjs.createConfigError.call(void 0, "Email");
|
|
1371
1393
|
}
|
|
1372
1394
|
await this.ensureInitialized();
|
|
1373
1395
|
if (!this.provider) {
|
|
1374
|
-
|
|
1396
|
+
_chunk27AOACEWjs.sentryLogger.error("Email is not available");
|
|
1375
1397
|
throw new Error("Email is not available");
|
|
1376
1398
|
}
|
|
1377
|
-
const { signInWithEmail } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1399
|
+
const { signInWithEmail } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-WXUV52ZW.js")));
|
|
1378
1400
|
const authResult = await signInWithEmail({ email });
|
|
1379
1401
|
return authResult;
|
|
1380
1402
|
}
|
|
@@ -1384,14 +1406,14 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1384
1406
|
}
|
|
1385
1407
|
await this.ensureInitialized();
|
|
1386
1408
|
if (!this.provider) {
|
|
1387
|
-
|
|
1409
|
+
_chunk27AOACEWjs.sentryLogger.error("Email provider not initialized");
|
|
1388
1410
|
throw new Error("Email provider not initialized");
|
|
1389
1411
|
}
|
|
1390
|
-
const { verifyEmailOTP } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1412
|
+
const { verifyEmailOTP } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-WXUV52ZW.js")));
|
|
1391
1413
|
return verifyEmailOTP({ flowId, otp });
|
|
1392
1414
|
}
|
|
1393
1415
|
async connect() {
|
|
1394
|
-
|
|
1416
|
+
_chunk27AOACEWjs.sentryLogger.error("EmailAdapter.connect() is not implemented");
|
|
1395
1417
|
throw new Error("EmailAdapter.connect() is not implemented");
|
|
1396
1418
|
}
|
|
1397
1419
|
async tryRestoreConnection() {
|
|
@@ -1419,7 +1441,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1419
1441
|
async disconnect() {
|
|
1420
1442
|
try {
|
|
1421
1443
|
await this.ensureInitialized();
|
|
1422
|
-
const { signOut } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1444
|
+
const { signOut } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-WXUV52ZW.js")));
|
|
1423
1445
|
await signOut();
|
|
1424
1446
|
} catch (e12) {
|
|
1425
1447
|
}
|
|
@@ -1465,7 +1487,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1465
1487
|
* Called by ensureInitialized() - deduplication handled via initPromise.
|
|
1466
1488
|
*/
|
|
1467
1489
|
async initializeProvider() {
|
|
1468
|
-
const { initialize } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1490
|
+
const { initialize } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-WXUV52ZW.js")));
|
|
1469
1491
|
await initialize({
|
|
1470
1492
|
projectId: this.projectId,
|
|
1471
1493
|
ethereum: {
|
|
@@ -1483,7 +1505,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1483
1505
|
async createProvider() {
|
|
1484
1506
|
try {
|
|
1485
1507
|
await _EmailAdapter.initializeChainData();
|
|
1486
|
-
const { createCDPEmbeddedWallet } = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
1508
|
+
const { createCDPEmbeddedWallet } = await Promise.resolve().then(() => _interopRequireWildcard(require("./index.web-WXUV52ZW.js")));
|
|
1487
1509
|
const wallet = createCDPEmbeddedWallet({
|
|
1488
1510
|
chains: _EmailAdapter.viemChains,
|
|
1489
1511
|
transports: _EmailAdapter.viemTransports
|
|
@@ -1504,7 +1526,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1504
1526
|
const chainIdHex = await base.request({ method: "eth_chainId", params: [] });
|
|
1505
1527
|
chainId = parseInt(chainIdHex, 16);
|
|
1506
1528
|
} catch (e13) {
|
|
1507
|
-
|
|
1529
|
+
_chunk27AOACEWjs.sentryLogger.error("Failed to get chainId for fallback request");
|
|
1508
1530
|
throw new Error("Failed to get chainId for fallback request");
|
|
1509
1531
|
}
|
|
1510
1532
|
const publicClient = await getPublicClient(chainId);
|
|
@@ -1519,7 +1541,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1519
1541
|
};
|
|
1520
1542
|
return wrapped;
|
|
1521
1543
|
} catch (error) {
|
|
1522
|
-
|
|
1544
|
+
_chunk27AOACEWjs.sentryLogger.error("Failed to initialize Email provider", { error });
|
|
1523
1545
|
return null;
|
|
1524
1546
|
}
|
|
1525
1547
|
}
|
|
@@ -1561,10 +1583,8 @@ function createWalletAdapters({
|
|
|
1561
1583
|
];
|
|
1562
1584
|
}
|
|
1563
1585
|
|
|
1564
|
-
// src/AurumCore.ts
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
1586
|
// src/providers/RpcProvider.ts
|
|
1587
|
+
_chunkQIPVNM7Tjs.init_polyfills.call(void 0, );
|
|
1568
1588
|
var ProviderRpcError = class extends Error {
|
|
1569
1589
|
constructor(code, message, data) {
|
|
1570
1590
|
super(message);
|
|
@@ -1648,7 +1668,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1648
1668
|
return _AurumCore.instance;
|
|
1649
1669
|
}
|
|
1650
1670
|
const telemetryEnabled = config.telemetry !== false;
|
|
1651
|
-
|
|
1671
|
+
_chunk27AOACEWjs.initSentry.call(void 0, telemetryEnabled);
|
|
1652
1672
|
this.brandConfig = this.resolveBrandConfig(config);
|
|
1653
1673
|
this.excludedWallets = new Set(_nullishCoalesce(_optionalChain([config, 'access', _139 => _139.wallets, 'optionalAccess', _140 => _140.exclude]), () => ( [])));
|
|
1654
1674
|
this.wallets = createWalletAdapters({
|
|
@@ -1703,7 +1723,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1703
1723
|
if (!adapter) {
|
|
1704
1724
|
throw new Error(`${walletId} is not configured`);
|
|
1705
1725
|
}
|
|
1706
|
-
if (walletId ===
|
|
1726
|
+
if (walletId === _chunk27AOACEWjs.WalletId.WalletConnect && adapter.openModal) {
|
|
1707
1727
|
result = await adapter.openModal();
|
|
1708
1728
|
} else {
|
|
1709
1729
|
if (!adapter.isInstalled()) {
|
|
@@ -1715,19 +1735,19 @@ var _AurumCore = class _AurumCore {
|
|
|
1715
1735
|
const displayedWallets = this.wallets.filter((w) => !this.excludedWallets.has(w.id));
|
|
1716
1736
|
const modalResult = await renderConnectModal({ displayedWallets, brandConfig: this.brandConfig });
|
|
1717
1737
|
if (!modalResult) {
|
|
1718
|
-
|
|
1738
|
+
_chunk27AOACEWjs.sentryLogger.error("Missing modal result");
|
|
1719
1739
|
throw new Error("Missing modal result");
|
|
1720
1740
|
}
|
|
1721
1741
|
adapter = this.wallets.find((w) => w.id === modalResult.walletId) || null;
|
|
1722
1742
|
if (!adapter) {
|
|
1723
|
-
|
|
1743
|
+
_chunk27AOACEWjs.sentryLogger.error(`Selected wallet adapter not found: ${modalResult.walletId}`);
|
|
1724
1744
|
throw new Error("Selected wallet adapter not found");
|
|
1725
1745
|
}
|
|
1726
1746
|
result = modalResult;
|
|
1727
1747
|
}
|
|
1728
1748
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1729
1749
|
if (!provider) {
|
|
1730
|
-
|
|
1750
|
+
_chunk27AOACEWjs.sentryLogger.error(`Error fetching provider on login: ${adapter.id}`);
|
|
1731
1751
|
throw new Error("Error fetching provider. Please try again.");
|
|
1732
1752
|
}
|
|
1733
1753
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1744,7 +1764,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1744
1764
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1745
1765
|
this.emitConnect(chainId);
|
|
1746
1766
|
this.emitAccountsChanged([checksumAdr]);
|
|
1747
|
-
|
|
1767
|
+
_chunk27AOACEWjs.sentryLogger.info(`Wallet connected: ${adapter.id} (${walletId ? "headless" : "modal"})`);
|
|
1748
1768
|
return checksumAdr;
|
|
1749
1769
|
}
|
|
1750
1770
|
async disconnect() {
|
|
@@ -1773,7 +1793,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1773
1793
|
if (!adapter) throw new Error("Selected wallet adapter not found");
|
|
1774
1794
|
const provider = _nullishCoalesce(result.provider, () => ( adapter.getProvider()));
|
|
1775
1795
|
if (!provider) {
|
|
1776
|
-
|
|
1796
|
+
_chunk27AOACEWjs.sentryLogger.error(`Error fetching provider on widget login: ${_optionalChain([result, 'optionalAccess', _153 => _153.walletId])}`);
|
|
1777
1797
|
throw new Error("Error fetching provider. Please try again.");
|
|
1778
1798
|
}
|
|
1779
1799
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1790,7 +1810,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1790
1810
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1791
1811
|
this.emitConnect(chainId);
|
|
1792
1812
|
this.emitAccountsChanged([checksumAdr]);
|
|
1793
|
-
|
|
1813
|
+
_chunk27AOACEWjs.sentryLogger.info(`Wallet connected: ${adapter.id} (widget)`);
|
|
1794
1814
|
return this.userInfo;
|
|
1795
1815
|
}
|
|
1796
1816
|
async getChainId() {
|
|
@@ -1809,7 +1829,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1809
1829
|
}
|
|
1810
1830
|
}
|
|
1811
1831
|
updateBrandConfig(newConfig) {
|
|
1812
|
-
const defaultTheme =
|
|
1832
|
+
const defaultTheme = _chunk27AOACEWjs.getDefaultThemeConfig.call(void 0, _nullishCoalesce(newConfig.theme, () => ( this.brandConfig.theme)));
|
|
1813
1833
|
this.brandConfig = {
|
|
1814
1834
|
logo: "logo" in newConfig ? _nullishCoalesce(newConfig.logo, () => ( defaultTheme.logo)) : this.brandConfig.logo,
|
|
1815
1835
|
theme: "theme" in newConfig ? _nullishCoalesce(newConfig.theme, () => ( defaultTheme.theme)) : this.brandConfig.theme,
|
|
@@ -1822,7 +1842,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1822
1842
|
walletLayout: "walletLayout" in newConfig ? _nullishCoalesce(newConfig.walletLayout, () => ( defaultTheme.walletLayout)) : this.brandConfig.walletLayout
|
|
1823
1843
|
};
|
|
1824
1844
|
if ("theme" in newConfig && this.brandConfig.theme) {
|
|
1825
|
-
const wcAdapter = this.wallets.find((w) => w.id ===
|
|
1845
|
+
const wcAdapter = this.wallets.find((w) => w.id === _chunk27AOACEWjs.WalletId.WalletConnect);
|
|
1826
1846
|
_optionalChain([wcAdapter, 'optionalAccess', _154 => _154.updateTheme, 'call', _155 => _155(this.brandConfig.theme)]);
|
|
1827
1847
|
}
|
|
1828
1848
|
}
|
|
@@ -1838,7 +1858,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1838
1858
|
*/
|
|
1839
1859
|
async emailAuthStart(email) {
|
|
1840
1860
|
await this.whenReady();
|
|
1841
|
-
const emailAdapter = this.wallets.find((w) => w.id ===
|
|
1861
|
+
const emailAdapter = this.wallets.find((w) => w.id === _chunk27AOACEWjs.WalletId.Email);
|
|
1842
1862
|
if (!emailAdapter || !emailAdapter.emailAuthStart) {
|
|
1843
1863
|
throw new Error("Email wallet is not configured");
|
|
1844
1864
|
}
|
|
@@ -1853,20 +1873,20 @@ var _AurumCore = class _AurumCore {
|
|
|
1853
1873
|
*/
|
|
1854
1874
|
async emailAuthVerify(flowId, otp) {
|
|
1855
1875
|
await this.whenReady();
|
|
1856
|
-
const emailAdapter = this.wallets.find((w) => w.id ===
|
|
1876
|
+
const emailAdapter = this.wallets.find((w) => w.id === _chunk27AOACEWjs.WalletId.Email);
|
|
1857
1877
|
if (!emailAdapter || !emailAdapter.emailAuthVerify) {
|
|
1858
1878
|
throw new Error("Email wallet is not configured");
|
|
1859
1879
|
}
|
|
1860
1880
|
const verifyResult = await emailAdapter.emailAuthVerify(flowId, otp);
|
|
1861
1881
|
const provider = emailAdapter.getProvider();
|
|
1862
1882
|
if (!provider) {
|
|
1863
|
-
|
|
1883
|
+
_chunk27AOACEWjs.sentryLogger.error("Failed to get provider after email verification");
|
|
1864
1884
|
throw new Error("Failed to get provider after email verification");
|
|
1865
1885
|
}
|
|
1866
1886
|
const address = _optionalChain([verifyResult, 'access', _156 => _156.user, 'optionalAccess', _157 => _157.evmAccounts, 'optionalAccess', _158 => _158[0]]);
|
|
1867
1887
|
const email = _optionalChain([verifyResult, 'access', _159 => _159.user, 'optionalAccess', _160 => _160.authenticationMethods, 'optionalAccess', _161 => _161.email, 'optionalAccess', _162 => _162.email]);
|
|
1868
1888
|
if (!address || !email) {
|
|
1869
|
-
|
|
1889
|
+
_chunk27AOACEWjs.sentryLogger.error("Address or email not found after email verification");
|
|
1870
1890
|
throw new Error("Address or email not found after email verification");
|
|
1871
1891
|
}
|
|
1872
1892
|
const checksumAdr = _viem.checksumAddress.call(void 0, address);
|
|
@@ -1883,7 +1903,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1883
1903
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1884
1904
|
this.emitConnect(chainId);
|
|
1885
1905
|
this.emitAccountsChanged([checksumAdr]);
|
|
1886
|
-
|
|
1906
|
+
_chunk27AOACEWjs.sentryLogger.info(`Wallet connected: ${emailAdapter.id} (headless)`);
|
|
1887
1907
|
return { address: checksumAdr, email: _nullishCoalesce(email, () => ( "")), isNewUser: _nullishCoalesce(verifyResult.isNewUser, () => ( false)) };
|
|
1888
1908
|
}
|
|
1889
1909
|
/**
|
|
@@ -1892,7 +1912,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1892
1912
|
*/
|
|
1893
1913
|
async getWalletConnectSession() {
|
|
1894
1914
|
await this.whenReady();
|
|
1895
|
-
const wcAdapter = this.wallets.find((w) => w.id ===
|
|
1915
|
+
const wcAdapter = this.wallets.find((w) => w.id === _chunk27AOACEWjs.WalletId.WalletConnect);
|
|
1896
1916
|
if (!wcAdapter) {
|
|
1897
1917
|
throw new Error("WalletConnect is not enabled");
|
|
1898
1918
|
}
|
|
@@ -1903,7 +1923,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1903
1923
|
const result = await session.waitForConnection();
|
|
1904
1924
|
const provider = _nullishCoalesce(result.provider, () => ( wcAdapter.getProvider()));
|
|
1905
1925
|
if (!provider) {
|
|
1906
|
-
|
|
1926
|
+
_chunk27AOACEWjs.sentryLogger.error("Failed to get provider after WalletConnect connection");
|
|
1907
1927
|
throw new Error("Failed to get provider after WalletConnect connection");
|
|
1908
1928
|
}
|
|
1909
1929
|
const checksumAdr = _viem.checksumAddress.call(void 0, result.address);
|
|
@@ -1919,7 +1939,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1919
1939
|
const chainId = await provider.request({ method: "eth_chainId" });
|
|
1920
1940
|
this.emitConnect(chainId);
|
|
1921
1941
|
this.emitAccountsChanged([checksumAdr]);
|
|
1922
|
-
|
|
1942
|
+
_chunk27AOACEWjs.sentryLogger.info(`Wallet connected: ${wcAdapter.id} (headless)`);
|
|
1923
1943
|
return checksumAdr;
|
|
1924
1944
|
}
|
|
1925
1945
|
};
|
|
@@ -1976,7 +1996,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1976
1996
|
/* BRAND & THEME METHODS */
|
|
1977
1997
|
resolveBrandConfig(config) {
|
|
1978
1998
|
const { brand = {} } = config || {};
|
|
1979
|
-
const themeConfig =
|
|
1999
|
+
const themeConfig = _chunk27AOACEWjs.getDefaultThemeConfig.call(void 0, brand.theme || _chunk27AOACEWjs.DEFAULT_THEME);
|
|
1980
2000
|
return {
|
|
1981
2001
|
logo: _nullishCoalesce(brand.logo, () => ( themeConfig.logo)),
|
|
1982
2002
|
theme: _nullishCoalesce(brand.theme, () => ( themeConfig.theme)),
|
|
@@ -1991,8 +2011,8 @@ var _AurumCore = class _AurumCore {
|
|
|
1991
2011
|
}
|
|
1992
2012
|
async tryRestoreConnection() {
|
|
1993
2013
|
try {
|
|
1994
|
-
await
|
|
1995
|
-
const store =
|
|
2014
|
+
await _chunk27AOACEWjs.waitForStoreHydration.call(void 0, );
|
|
2015
|
+
const store = _chunk27AOACEWjs.useAurumStore.getState();
|
|
1996
2016
|
if (!store.isConnected || !store.walletId || !store.address || !store.walletName) {
|
|
1997
2017
|
return;
|
|
1998
2018
|
}
|
|
@@ -2022,7 +2042,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2022
2042
|
}
|
|
2023
2043
|
}
|
|
2024
2044
|
persistConnectionState(adapter, address, email) {
|
|
2025
|
-
|
|
2045
|
+
_chunk27AOACEWjs.useAurumStore.getState().setConnection(adapter.id, _viem.checksumAddress.call(void 0, address), adapter.name, email);
|
|
2026
2046
|
}
|
|
2027
2047
|
/* INTERNAL LISTENER METHODS */
|
|
2028
2048
|
setInternalAccountChangeListener(adapter) {
|
|
@@ -2120,7 +2140,7 @@ var _AurumCore = class _AurumCore {
|
|
|
2120
2140
|
}
|
|
2121
2141
|
/* REST */
|
|
2122
2142
|
resetConnectionState() {
|
|
2123
|
-
|
|
2143
|
+
_chunk27AOACEWjs.useAurumStore.getState().clearConnection();
|
|
2124
2144
|
this.connectedWalletAdapter = null;
|
|
2125
2145
|
this.updateProvider(this.skeletonProvider);
|
|
2126
2146
|
this.userInfo = void 0;
|