@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.mjs
CHANGED
|
@@ -4,21 +4,36 @@ import {
|
|
|
4
4
|
DEFAULT_THEME,
|
|
5
5
|
Modal,
|
|
6
6
|
ThemeContainer,
|
|
7
|
+
WalletId,
|
|
8
|
+
WalletName,
|
|
7
9
|
createConfigError,
|
|
8
10
|
generateCompleteStyles,
|
|
9
11
|
getDefaultThemeConfig,
|
|
12
|
+
getLogoDataUri,
|
|
10
13
|
initSentry,
|
|
11
14
|
sentryLogger,
|
|
12
15
|
sortWallets,
|
|
13
16
|
useAurumStore,
|
|
14
17
|
useNavigation,
|
|
15
18
|
waitForStoreHydration
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GP7AGIK5.mjs";
|
|
20
|
+
import "./chunk-ZT57KKYB.mjs";
|
|
21
|
+
import {
|
|
22
|
+
init_polyfills
|
|
23
|
+
} from "./chunk-YFDA5EMH.mjs";
|
|
24
|
+
|
|
25
|
+
// src/index.ts
|
|
26
|
+
init_polyfills();
|
|
27
|
+
|
|
28
|
+
// src/Aurum.ts
|
|
29
|
+
init_polyfills();
|
|
17
30
|
|
|
18
31
|
// src/AurumCore.ts
|
|
32
|
+
init_polyfills();
|
|
19
33
|
import { checksumAddress } from "viem";
|
|
20
34
|
|
|
21
35
|
// src/utils/chainHelpers.ts
|
|
36
|
+
init_polyfills();
|
|
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,7 +55,11 @@ function isChainExistsError(error) {
|
|
|
40
55
|
);
|
|
41
56
|
}
|
|
42
57
|
|
|
58
|
+
// src/components/ConnectModal/renderConnectModal.tsx
|
|
59
|
+
init_polyfills();
|
|
60
|
+
|
|
43
61
|
// src/components/ConnectModal/ModalShell.tsx
|
|
62
|
+
init_polyfills();
|
|
44
63
|
import { useState } from "react";
|
|
45
64
|
import { jsx } from "react/jsx-runtime";
|
|
46
65
|
var ModalShell = ({ onClose, brandConfig }) => {
|
|
@@ -64,9 +83,11 @@ var ModalShell = ({ onClose, brandConfig }) => {
|
|
|
64
83
|
};
|
|
65
84
|
|
|
66
85
|
// src/utils/createModalContainer.ts
|
|
86
|
+
init_polyfills();
|
|
67
87
|
import { createRoot } from "react-dom/client";
|
|
68
88
|
|
|
69
89
|
// src/utils/createShadowRoot.ts
|
|
90
|
+
init_polyfills();
|
|
70
91
|
function createShadowRoot(container, brandConfig) {
|
|
71
92
|
const shadowRoot = container.attachShadow({ mode: "open" });
|
|
72
93
|
shadowRoot.innerHTML = `
|
|
@@ -123,9 +144,14 @@ function renderConnectModal({
|
|
|
123
144
|
});
|
|
124
145
|
}
|
|
125
146
|
|
|
147
|
+
// src/utils/createWalletAdapters.ts
|
|
148
|
+
init_polyfills();
|
|
149
|
+
|
|
150
|
+
// src/wallet-adapters/index.ts
|
|
151
|
+
init_polyfills();
|
|
152
|
+
|
|
126
153
|
// src/wallet-adapters/RabbyAdapter.ts
|
|
127
|
-
|
|
128
|
-
import { WalletId, WalletName } from "@aurum-sdk/types";
|
|
154
|
+
init_polyfills();
|
|
129
155
|
var RABBY_RDNS = "io.rabby";
|
|
130
156
|
var RabbyAdapter = class {
|
|
131
157
|
constructor() {
|
|
@@ -258,10 +284,10 @@ var RabbyAdapter = class {
|
|
|
258
284
|
};
|
|
259
285
|
|
|
260
286
|
// src/wallet-adapters/BraveAdapter.ts
|
|
261
|
-
|
|
262
|
-
import { WalletId as WalletId2, WalletName as WalletName2 } from "@aurum-sdk/types";
|
|
287
|
+
init_polyfills();
|
|
263
288
|
|
|
264
289
|
// src/utils/platform/isBraveBrowser.ts
|
|
290
|
+
init_polyfills();
|
|
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 =
|
|
300
|
+
this.id = WalletId.Brave;
|
|
301
|
+
this.name = WalletName.Brave;
|
|
302
|
+
this.icon = getLogoDataUri(WalletId.Brave, "brand") ?? "";
|
|
277
303
|
this.downloadUrl = "https://brave.com/download";
|
|
278
304
|
this.wcDeepLinkUrl = null;
|
|
279
305
|
this.provider = null;
|
|
@@ -404,14 +430,13 @@ var BraveAdapter = class {
|
|
|
404
430
|
};
|
|
405
431
|
|
|
406
432
|
// src/wallet-adapters/PhantomAdapter.ts
|
|
407
|
-
|
|
408
|
-
import { WalletId as WalletId3, WalletName as WalletName3 } from "@aurum-sdk/types";
|
|
433
|
+
init_polyfills();
|
|
409
434
|
var PHANTOM_RDNS = "app.phantom";
|
|
410
435
|
var PhantomAdapter = class {
|
|
411
436
|
constructor() {
|
|
412
|
-
this.id =
|
|
413
|
-
this.name =
|
|
414
|
-
this.icon =
|
|
437
|
+
this.id = WalletId.Phantom;
|
|
438
|
+
this.name = WalletName.Phantom;
|
|
439
|
+
this.icon = getLogoDataUri(WalletId.Phantom, "brand") ?? "";
|
|
415
440
|
this.hide = false;
|
|
416
441
|
this.downloadUrl = "https://phantom.com/download";
|
|
417
442
|
this.wcDeepLinkUrl = "phantom://wc?uri=";
|
|
@@ -543,47 +568,50 @@ var PhantomAdapter = class {
|
|
|
543
568
|
};
|
|
544
569
|
|
|
545
570
|
// src/wallet-adapters/CoinbaseWalletAdapter.ts
|
|
546
|
-
|
|
547
|
-
import { getLogoDataUri as getLogoDataUri4 } from "@aurum-sdk/logos";
|
|
548
|
-
import { WalletId as WalletId4, WalletName as WalletName4 } from "@aurum-sdk/types";
|
|
571
|
+
init_polyfills();
|
|
549
572
|
var CoinbaseWalletAdapter = class {
|
|
550
573
|
constructor({ appName, appLogoUrl, telemetry }) {
|
|
551
|
-
this.id =
|
|
552
|
-
this.name =
|
|
553
|
-
this.icon =
|
|
574
|
+
this.id = WalletId.CoinbaseWallet;
|
|
575
|
+
this.name = WalletName.CoinbaseWallet;
|
|
576
|
+
this.icon = getLogoDataUri(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: 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 {
|
|
595
|
+
const { createCoinbaseWalletSDK } = await import("./dist-SYSRLCAE.mjs");
|
|
568
596
|
const coinbaseSdk = createCoinbaseWalletSDK({
|
|
569
|
-
appName,
|
|
570
|
-
appLogoUrl,
|
|
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
606
|
sentryLogger.warn("Failed to initialize Coinbase Wallet provider", { error });
|
|
579
|
-
return null;
|
|
580
607
|
}
|
|
581
608
|
}
|
|
582
609
|
isInstalled() {
|
|
583
|
-
return
|
|
610
|
+
return true;
|
|
584
611
|
}
|
|
585
612
|
async connect() {
|
|
586
|
-
|
|
613
|
+
await this.ensureInitialized();
|
|
614
|
+
if (!this.provider) {
|
|
587
615
|
sentryLogger.error("Coinbase Wallet is not available");
|
|
588
616
|
throw new Error("Coinbase Wallet is not available");
|
|
589
617
|
}
|
|
@@ -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,10 +652,11 @@ var CoinbaseWalletAdapter = class {
|
|
|
623
652
|
}
|
|
624
653
|
}
|
|
625
654
|
async disconnect() {
|
|
655
|
+
if (!this.provider) return;
|
|
626
656
|
try {
|
|
627
|
-
if (this.provider
|
|
657
|
+
if (this.provider.close) {
|
|
628
658
|
await this.provider.close();
|
|
629
|
-
} else if (this.provider
|
|
659
|
+
} else if (this.provider.disconnect) {
|
|
630
660
|
await this.provider.disconnect();
|
|
631
661
|
}
|
|
632
662
|
} catch (error) {
|
|
@@ -669,14 +699,13 @@ var CoinbaseWalletAdapter = class {
|
|
|
669
699
|
};
|
|
670
700
|
|
|
671
701
|
// src/wallet-adapters/MetaMaskAdapter.ts
|
|
672
|
-
|
|
673
|
-
import { WalletId as WalletId5, WalletName as WalletName5 } from "@aurum-sdk/types";
|
|
702
|
+
init_polyfills();
|
|
674
703
|
var METAMASK_RDNS = "io.metamask";
|
|
675
704
|
var MetaMaskAdapter = class {
|
|
676
705
|
constructor() {
|
|
677
|
-
this.id =
|
|
678
|
-
this.name =
|
|
679
|
-
this.icon =
|
|
706
|
+
this.id = WalletId.MetaMask;
|
|
707
|
+
this.name = WalletName.MetaMask;
|
|
708
|
+
this.icon = getLogoDataUri(WalletId.MetaMask, "brand") ?? "";
|
|
680
709
|
this.hide = false;
|
|
681
710
|
this.downloadUrl = "https://metamask.io/download";
|
|
682
711
|
this.wcDeepLinkUrl = "metamask://wc?uri=";
|
|
@@ -809,10 +838,10 @@ var MetaMaskAdapter = class {
|
|
|
809
838
|
};
|
|
810
839
|
|
|
811
840
|
// src/wallet-adapters/WalletConnectAdapter.ts
|
|
812
|
-
|
|
813
|
-
import { WalletId as WalletId6, WalletName as WalletName6 } from "@aurum-sdk/types";
|
|
841
|
+
init_polyfills();
|
|
814
842
|
|
|
815
843
|
// src/constants/adapters.ts
|
|
844
|
+
init_polyfills();
|
|
816
845
|
var WALLETCONNECT_NAMESPACE = {
|
|
817
846
|
eip155: {
|
|
818
847
|
methods: [
|
|
@@ -905,9 +934,9 @@ function extractAddressFromSession(namespaces) {
|
|
|
905
934
|
}
|
|
906
935
|
var WalletConnectAdapter = class {
|
|
907
936
|
constructor(config) {
|
|
908
|
-
this.id =
|
|
909
|
-
this.name =
|
|
910
|
-
this.icon =
|
|
937
|
+
this.id = WalletId.WalletConnect;
|
|
938
|
+
this.name = WalletName.WalletConnect;
|
|
939
|
+
this.icon = getLogoDataUri(WalletId.WalletConnect, "brand") ?? "";
|
|
911
940
|
this.hide = false;
|
|
912
941
|
this.downloadUrl = null;
|
|
913
942
|
this.wcDeepLinkUrl = null;
|
|
@@ -1333,13 +1362,12 @@ var WalletConnectAdapter = class {
|
|
|
1333
1362
|
};
|
|
1334
1363
|
|
|
1335
1364
|
// src/wallet-adapters/EmailAdapter.ts
|
|
1336
|
-
|
|
1337
|
-
import { getLogoDataUri as getLogoDataUri7 } from "@aurum-sdk/logos";
|
|
1365
|
+
init_polyfills();
|
|
1338
1366
|
var _EmailAdapter = class _EmailAdapter {
|
|
1339
1367
|
constructor(config) {
|
|
1340
|
-
this.id =
|
|
1341
|
-
this.name =
|
|
1342
|
-
this.icon =
|
|
1368
|
+
this.id = WalletId.Email;
|
|
1369
|
+
this.name = WalletName.Email;
|
|
1370
|
+
this.icon = getLogoDataUri(WalletId.Email, "brand") ?? "";
|
|
1343
1371
|
this.hide = true;
|
|
1344
1372
|
this.downloadUrl = null;
|
|
1345
1373
|
this.wcDeepLinkUrl = null;
|
|
@@ -1368,14 +1396,9 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1368
1396
|
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
|
-
sentryLogger.error("Failed to start email authentication", { error });
|
|
1377
|
-
throw error;
|
|
1378
|
-
}
|
|
1399
|
+
const { signInWithEmail } = await import("./index.web-HX5ZVRA3.mjs");
|
|
1400
|
+
const authResult = await signInWithEmail({ email });
|
|
1401
|
+
return authResult;
|
|
1379
1402
|
}
|
|
1380
1403
|
async emailAuthVerify(flowId, otp) {
|
|
1381
1404
|
if (!flowId || !otp) {
|
|
@@ -1386,7 +1409,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1386
1409
|
sentryLogger.error("Email provider not initialized");
|
|
1387
1410
|
throw new Error("Email provider not initialized");
|
|
1388
1411
|
}
|
|
1389
|
-
const { verifyEmailOTP } = await import("
|
|
1412
|
+
const { verifyEmailOTP } = await import("./index.web-HX5ZVRA3.mjs");
|
|
1390
1413
|
return verifyEmailOTP({ flowId, otp });
|
|
1391
1414
|
}
|
|
1392
1415
|
async connect() {
|
|
@@ -1418,7 +1441,7 @@ var _EmailAdapter = class _EmailAdapter {
|
|
|
1418
1441
|
async disconnect() {
|
|
1419
1442
|
try {
|
|
1420
1443
|
await this.ensureInitialized();
|
|
1421
|
-
const { signOut } = await import("
|
|
1444
|
+
const { signOut } = await import("./index.web-HX5ZVRA3.mjs");
|
|
1422
1445
|
await signOut();
|
|
1423
1446
|
} catch {
|
|
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 import("
|
|
1490
|
+
const { initialize } = await import("./index.web-HX5ZVRA3.mjs");
|
|
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 import("
|
|
1508
|
+
const { createCDPEmbeddedWallet } = await import("./index.web-HX5ZVRA3.mjs");
|
|
1486
1509
|
const wallet = createCDPEmbeddedWallet({
|
|
1487
1510
|
chains: _EmailAdapter.viemChains,
|
|
1488
1511
|
transports: _EmailAdapter.viemTransports
|
|
@@ -1560,10 +1583,8 @@ function createWalletAdapters({
|
|
|
1560
1583
|
];
|
|
1561
1584
|
}
|
|
1562
1585
|
|
|
1563
|
-
// src/AurumCore.ts
|
|
1564
|
-
import { WalletId as WalletId8 } from "@aurum-sdk/types";
|
|
1565
|
-
|
|
1566
1586
|
// src/providers/RpcProvider.ts
|
|
1587
|
+
init_polyfills();
|
|
1567
1588
|
var ProviderRpcError = class extends Error {
|
|
1568
1589
|
constructor(code, message, data) {
|
|
1569
1590
|
super(message);
|
|
@@ -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 === WalletId.WalletConnect && adapter.openModal) {
|
|
1706
1727
|
result = await adapter.openModal();
|
|
1707
1728
|
} else {
|
|
1708
1729
|
if (!adapter.isInstalled()) {
|
|
@@ -1821,7 +1842,7 @@ var _AurumCore = class _AurumCore {
|
|
|
1821
1842
|
walletLayout: "walletLayout" in newConfig ? 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 ===
|
|
1845
|
+
const wcAdapter = this.wallets.find((w) => w.id === WalletId.WalletConnect);
|
|
1825
1846
|
wcAdapter?.updateTheme(this.brandConfig.theme);
|
|
1826
1847
|
}
|
|
1827
1848
|
}
|
|
@@ -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 === WalletId.Email);
|
|
1841
1862
|
if (!emailAdapter || !emailAdapter.emailAuthStart) {
|
|
1842
1863
|
throw new Error("Email wallet is not configured");
|
|
1843
1864
|
}
|
|
@@ -1852,7 +1873,7 @@ 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 === WalletId.Email);
|
|
1856
1877
|
if (!emailAdapter || !emailAdapter.emailAuthVerify) {
|
|
1857
1878
|
throw new Error("Email wallet is not configured");
|
|
1858
1879
|
}
|
|
@@ -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 === WalletId.WalletConnect);
|
|
1895
1916
|
if (!wcAdapter) {
|
|
1896
1917
|
throw new Error("WalletConnect is not enabled");
|
|
1897
1918
|
}
|