@phantom/browser-sdk 1.0.0-beta.24 → 1.0.0-beta.26
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/index.js +11 -41
- package/dist/index.mjs +11 -41
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -397,42 +397,13 @@ async function discoverSolanaWallets() {
|
|
|
397
397
|
debug.log(DebugCategory.BROWSER_SDK, "Wallet Standard Solana discovery completed", finalLogData);
|
|
398
398
|
return wallets;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
401
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
402
|
-
return null;
|
|
403
|
-
}
|
|
404
|
-
const walletsAPI = navigator.wallets;
|
|
405
|
-
if (!walletsAPI || typeof walletsAPI.getWallets !== "function") {
|
|
406
|
-
return null;
|
|
407
|
-
}
|
|
408
|
-
try {
|
|
409
|
-
const walletsGetter = walletsAPI.getWallets();
|
|
410
|
-
if (walletsGetter && typeof walletsGetter.get === "function") {
|
|
411
|
-
const registeredWallets = walletsGetter.get();
|
|
412
|
-
const phantomWallet = registeredWallets.find((w) => w.name.toLowerCase().includes("phantom"));
|
|
413
|
-
if (phantomWallet?.icon) {
|
|
414
|
-
return phantomWallet.icon;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
} catch (error) {
|
|
418
|
-
}
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
async function discoverPhantomWallet(addressTypes) {
|
|
400
|
+
function discoverPhantomWallet(addressTypes) {
|
|
422
401
|
if (typeof window === "undefined") {
|
|
423
402
|
return null;
|
|
424
403
|
}
|
|
425
404
|
if (!(0, import_browser_injected_sdk.isPhantomExtensionInstalled)()) {
|
|
426
405
|
return null;
|
|
427
406
|
}
|
|
428
|
-
let icon = await getPhantomIconFromWalletStandard();
|
|
429
|
-
if (!icon) {
|
|
430
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
431
|
-
icon = await getPhantomIconFromWalletStandard();
|
|
432
|
-
}
|
|
433
|
-
if (!icon) {
|
|
434
|
-
icon = "https://phantom.app/img/phantom-icon-purple.png";
|
|
435
|
-
}
|
|
436
407
|
const plugins = [(0, import_browser_injected_sdk2.createExtensionPlugin)()];
|
|
437
408
|
if (addressTypes.includes(import_client2.AddressType.solana)) {
|
|
438
409
|
plugins.push((0, import_solana.createSolanaPlugin)());
|
|
@@ -445,7 +416,8 @@ async function discoverPhantomWallet(addressTypes) {
|
|
|
445
416
|
return {
|
|
446
417
|
id: "phantom",
|
|
447
418
|
name: "Phantom",
|
|
448
|
-
icon,
|
|
419
|
+
icon: void 0,
|
|
420
|
+
// Icon will be rendered from icons package in UI components
|
|
449
421
|
addressTypes,
|
|
450
422
|
providers: {
|
|
451
423
|
solana: addressTypes.includes(import_client2.AddressType.solana) ? phantomInstance.solana : void 0,
|
|
@@ -460,11 +432,8 @@ async function discoverWallets(addressTypes) {
|
|
|
460
432
|
debug.log(DebugCategory.BROWSER_SDK, "Starting all wallet discovery methods", {
|
|
461
433
|
addressTypes: requestedAddressTypes
|
|
462
434
|
});
|
|
463
|
-
const [
|
|
464
|
-
|
|
465
|
-
discoverSolanaWallets(),
|
|
466
|
-
discoverEthereumWallets()
|
|
467
|
-
]);
|
|
435
|
+
const [solanaWallets, ethereumWallets] = await Promise.all([discoverSolanaWallets(), discoverEthereumWallets()]);
|
|
436
|
+
const phantomWallet = discoverPhantomWallet(requestedAddressTypes);
|
|
468
437
|
debug.log(DebugCategory.BROWSER_SDK, "All wallet discovery methods completed", {
|
|
469
438
|
phantomFound: !!phantomWallet,
|
|
470
439
|
solanaWalletsCount: solanaWallets.length,
|
|
@@ -1709,7 +1678,7 @@ var InjectedWalletRegistry = class {
|
|
|
1709
1678
|
* Register Phantom wallet with its instance
|
|
1710
1679
|
* This creates wrapped providers and stores the Phantom instance for auto-confirm access
|
|
1711
1680
|
*/
|
|
1712
|
-
registerPhantom(phantomInstance, addressTypes
|
|
1681
|
+
registerPhantom(phantomInstance, addressTypes) {
|
|
1713
1682
|
const wrappedProviders = {};
|
|
1714
1683
|
if (addressTypes.includes(import_client.AddressType.solana) && phantomInstance.solana) {
|
|
1715
1684
|
wrappedProviders.solana = new PhantomSolanaChain(phantomInstance);
|
|
@@ -1726,7 +1695,8 @@ var InjectedWalletRegistry = class {
|
|
|
1726
1695
|
const phantomWallet = {
|
|
1727
1696
|
id: "phantom",
|
|
1728
1697
|
name: "Phantom",
|
|
1729
|
-
icon:
|
|
1698
|
+
icon: "",
|
|
1699
|
+
// Icon will be rendered from icons package in UI components
|
|
1730
1700
|
addressTypes,
|
|
1731
1701
|
providers: wrappedProviders,
|
|
1732
1702
|
isPhantom: true,
|
|
@@ -1767,7 +1737,7 @@ var InjectedWalletRegistry = class {
|
|
|
1767
1737
|
const relevantWallets = addressTypes ? discoveredWallets.filter((wallet) => wallet.addressTypes.some((type) => addressTypes.includes(type))) : discoveredWallets;
|
|
1768
1738
|
for (const wallet of relevantWallets) {
|
|
1769
1739
|
if (wallet.id === "phantom" && isPhantomWallet(wallet)) {
|
|
1770
|
-
this.registerPhantom(wallet.phantomInstance, wallet.addressTypes
|
|
1740
|
+
this.registerPhantom(wallet.phantomInstance, wallet.addressTypes);
|
|
1771
1741
|
} else {
|
|
1772
1742
|
this.register(wallet);
|
|
1773
1743
|
}
|
|
@@ -2906,7 +2876,7 @@ var BrowserAuthProvider = class {
|
|
|
2906
2876
|
// OAuth session management - defaults to allow refresh unless explicitly clearing after logout
|
|
2907
2877
|
clear_previous_session: (phantomOptions.clearPreviousSession ?? false).toString(),
|
|
2908
2878
|
allow_refresh: (phantomOptions.allowRefresh ?? true).toString(),
|
|
2909
|
-
sdk_version: "1.0.0-beta.
|
|
2879
|
+
sdk_version: "1.0.0-beta.26",
|
|
2910
2880
|
sdk_type: "browser",
|
|
2911
2881
|
platform: detectBrowser().name
|
|
2912
2882
|
});
|
|
@@ -3170,7 +3140,7 @@ var EmbeddedProvider = class extends import_embedded_provider_core.EmbeddedProvi
|
|
|
3170
3140
|
// Full user agent for more detailed info
|
|
3171
3141
|
[import_constants2.ANALYTICS_HEADERS.APP_ID]: config.appId,
|
|
3172
3142
|
[import_constants2.ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
|
|
3173
|
-
[import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.
|
|
3143
|
+
[import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.26"
|
|
3174
3144
|
// Replaced at build time
|
|
3175
3145
|
}
|
|
3176
3146
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -348,42 +348,13 @@ async function discoverSolanaWallets() {
|
|
|
348
348
|
debug.log(DebugCategory.BROWSER_SDK, "Wallet Standard Solana discovery completed", finalLogData);
|
|
349
349
|
return wallets;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") {
|
|
353
|
-
return null;
|
|
354
|
-
}
|
|
355
|
-
const walletsAPI = navigator.wallets;
|
|
356
|
-
if (!walletsAPI || typeof walletsAPI.getWallets !== "function") {
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
try {
|
|
360
|
-
const walletsGetter = walletsAPI.getWallets();
|
|
361
|
-
if (walletsGetter && typeof walletsGetter.get === "function") {
|
|
362
|
-
const registeredWallets = walletsGetter.get();
|
|
363
|
-
const phantomWallet = registeredWallets.find((w) => w.name.toLowerCase().includes("phantom"));
|
|
364
|
-
if (phantomWallet?.icon) {
|
|
365
|
-
return phantomWallet.icon;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
} catch (error) {
|
|
369
|
-
}
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
async function discoverPhantomWallet(addressTypes) {
|
|
351
|
+
function discoverPhantomWallet(addressTypes) {
|
|
373
352
|
if (typeof window === "undefined") {
|
|
374
353
|
return null;
|
|
375
354
|
}
|
|
376
355
|
if (!isPhantomExtensionInstalled()) {
|
|
377
356
|
return null;
|
|
378
357
|
}
|
|
379
|
-
let icon = await getPhantomIconFromWalletStandard();
|
|
380
|
-
if (!icon) {
|
|
381
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
382
|
-
icon = await getPhantomIconFromWalletStandard();
|
|
383
|
-
}
|
|
384
|
-
if (!icon) {
|
|
385
|
-
icon = "https://phantom.app/img/phantom-icon-purple.png";
|
|
386
|
-
}
|
|
387
358
|
const plugins = [createExtensionPlugin()];
|
|
388
359
|
if (addressTypes.includes(ClientAddressType.solana)) {
|
|
389
360
|
plugins.push(createSolanaPlugin());
|
|
@@ -396,7 +367,8 @@ async function discoverPhantomWallet(addressTypes) {
|
|
|
396
367
|
return {
|
|
397
368
|
id: "phantom",
|
|
398
369
|
name: "Phantom",
|
|
399
|
-
icon,
|
|
370
|
+
icon: void 0,
|
|
371
|
+
// Icon will be rendered from icons package in UI components
|
|
400
372
|
addressTypes,
|
|
401
373
|
providers: {
|
|
402
374
|
solana: addressTypes.includes(ClientAddressType.solana) ? phantomInstance.solana : void 0,
|
|
@@ -411,11 +383,8 @@ async function discoverWallets(addressTypes) {
|
|
|
411
383
|
debug.log(DebugCategory.BROWSER_SDK, "Starting all wallet discovery methods", {
|
|
412
384
|
addressTypes: requestedAddressTypes
|
|
413
385
|
});
|
|
414
|
-
const [
|
|
415
|
-
|
|
416
|
-
discoverSolanaWallets(),
|
|
417
|
-
discoverEthereumWallets()
|
|
418
|
-
]);
|
|
386
|
+
const [solanaWallets, ethereumWallets] = await Promise.all([discoverSolanaWallets(), discoverEthereumWallets()]);
|
|
387
|
+
const phantomWallet = discoverPhantomWallet(requestedAddressTypes);
|
|
419
388
|
debug.log(DebugCategory.BROWSER_SDK, "All wallet discovery methods completed", {
|
|
420
389
|
phantomFound: !!phantomWallet,
|
|
421
390
|
solanaWalletsCount: solanaWallets.length,
|
|
@@ -1660,7 +1629,7 @@ var InjectedWalletRegistry = class {
|
|
|
1660
1629
|
* Register Phantom wallet with its instance
|
|
1661
1630
|
* This creates wrapped providers and stores the Phantom instance for auto-confirm access
|
|
1662
1631
|
*/
|
|
1663
|
-
registerPhantom(phantomInstance, addressTypes
|
|
1632
|
+
registerPhantom(phantomInstance, addressTypes) {
|
|
1664
1633
|
const wrappedProviders = {};
|
|
1665
1634
|
if (addressTypes.includes(AddressType.solana) && phantomInstance.solana) {
|
|
1666
1635
|
wrappedProviders.solana = new PhantomSolanaChain(phantomInstance);
|
|
@@ -1677,7 +1646,8 @@ var InjectedWalletRegistry = class {
|
|
|
1677
1646
|
const phantomWallet = {
|
|
1678
1647
|
id: "phantom",
|
|
1679
1648
|
name: "Phantom",
|
|
1680
|
-
icon:
|
|
1649
|
+
icon: "",
|
|
1650
|
+
// Icon will be rendered from icons package in UI components
|
|
1681
1651
|
addressTypes,
|
|
1682
1652
|
providers: wrappedProviders,
|
|
1683
1653
|
isPhantom: true,
|
|
@@ -1718,7 +1688,7 @@ var InjectedWalletRegistry = class {
|
|
|
1718
1688
|
const relevantWallets = addressTypes ? discoveredWallets.filter((wallet) => wallet.addressTypes.some((type) => addressTypes.includes(type))) : discoveredWallets;
|
|
1719
1689
|
for (const wallet of relevantWallets) {
|
|
1720
1690
|
if (wallet.id === "phantom" && isPhantomWallet(wallet)) {
|
|
1721
|
-
this.registerPhantom(wallet.phantomInstance, wallet.addressTypes
|
|
1691
|
+
this.registerPhantom(wallet.phantomInstance, wallet.addressTypes);
|
|
1722
1692
|
} else {
|
|
1723
1693
|
this.register(wallet);
|
|
1724
1694
|
}
|
|
@@ -2857,7 +2827,7 @@ var BrowserAuthProvider = class {
|
|
|
2857
2827
|
// OAuth session management - defaults to allow refresh unless explicitly clearing after logout
|
|
2858
2828
|
clear_previous_session: (phantomOptions.clearPreviousSession ?? false).toString(),
|
|
2859
2829
|
allow_refresh: (phantomOptions.allowRefresh ?? true).toString(),
|
|
2860
|
-
sdk_version: "1.0.0-beta.
|
|
2830
|
+
sdk_version: "1.0.0-beta.26",
|
|
2861
2831
|
sdk_type: "browser",
|
|
2862
2832
|
platform: detectBrowser().name
|
|
2863
2833
|
});
|
|
@@ -3121,7 +3091,7 @@ var EmbeddedProvider = class extends CoreEmbeddedProvider {
|
|
|
3121
3091
|
// Full user agent for more detailed info
|
|
3122
3092
|
[ANALYTICS_HEADERS.APP_ID]: config.appId,
|
|
3123
3093
|
[ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
|
|
3124
|
-
[ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.
|
|
3094
|
+
[ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.26"
|
|
3125
3095
|
// Replaced at build time
|
|
3126
3096
|
}
|
|
3127
3097
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/browser-sdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.26",
|
|
4
4
|
"description": "Browser SDK for Phantom Wallet",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@phantom/base64url": "^1.0.0-beta.
|
|
37
|
-
"@phantom/browser-injected-sdk": "^1.0.0-beta.
|
|
38
|
-
"@phantom/chain-interfaces": "^1.0.0-beta.
|
|
39
|
-
"@phantom/client": "^1.0.0-beta.
|
|
40
|
-
"@phantom/constants": "^1.0.0-beta.
|
|
41
|
-
"@phantom/embedded-provider-core": "^1.0.0-beta.
|
|
42
|
-
"@phantom/indexed-db-stamper": "^1.0.0-beta.
|
|
43
|
-
"@phantom/parsers": "^1.0.0-beta.
|
|
44
|
-
"@phantom/sdk-types": "^1.0.0-beta.
|
|
36
|
+
"@phantom/base64url": "^1.0.0-beta.14",
|
|
37
|
+
"@phantom/browser-injected-sdk": "^1.0.0-beta.11",
|
|
38
|
+
"@phantom/chain-interfaces": "^1.0.0-beta.14",
|
|
39
|
+
"@phantom/client": "^1.0.0-beta.26",
|
|
40
|
+
"@phantom/constants": "^1.0.0-beta.14",
|
|
41
|
+
"@phantom/embedded-provider-core": "^1.0.0-beta.26",
|
|
42
|
+
"@phantom/indexed-db-stamper": "^1.0.0-beta.7",
|
|
43
|
+
"@phantom/parsers": "^1.0.0-beta.14",
|
|
44
|
+
"@phantom/sdk-types": "^1.0.0-beta.14",
|
|
45
45
|
"axios": "^1.10.0",
|
|
46
46
|
"bs58": "^6.0.0",
|
|
47
47
|
"buffer": "^6.0.3",
|