@pooflabs/web 0.0.69-rc.1 → 0.0.69-rc.2
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/auth/providers/phantom-wallet-provider.d.ts +2 -0
- package/dist/{index-C4TkISTV.js → index-BZpQdkSL.js} +88 -24
- package/dist/{index-C4TkISTV.js.map → index-BZpQdkSL.js.map} +1 -1
- package/dist/{index-DnHUGqjI.esm.js → index-BxW0dVxR.esm.js} +2 -2
- package/dist/{index-DnHUGqjI.esm.js.map → index-BxW0dVxR.esm.js.map} +1 -1
- package/dist/{index-BRZ4-fcO.js → index-DDHlGslU.js} +2 -2
- package/dist/{index-BRZ4-fcO.js.map → index-DDHlGslU.js.map} +1 -1
- package/dist/{index-DUIdAaPc.esm.js → index-gZceh3R8.esm.js} +88 -24
- package/dist/{index-DUIdAaPc.esm.js.map → index-gZceh3R8.esm.js.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,8 @@ export declare class PhantomWalletProvider implements AuthProvider {
|
|
|
29
29
|
private initPromise;
|
|
30
30
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
31
31
|
onSwitchToPrivy: (() => Promise<AuthProvider>) | null;
|
|
32
|
+
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
33
|
+
onSwitchToMWA: (() => Promise<AuthProvider>) | null;
|
|
32
34
|
constructor(networkUrl?: string | null, config?: PhantomWalletConfig);
|
|
33
35
|
private initializeAsync;
|
|
34
36
|
/**
|
|
@@ -13566,7 +13566,7 @@ async function loadDependencies() {
|
|
|
13566
13566
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
13567
13567
|
import('react'),
|
|
13568
13568
|
import('react-dom/client'),
|
|
13569
|
-
Promise.resolve().then(function () { return require('./index-
|
|
13569
|
+
Promise.resolve().then(function () { return require('./index-DDHlGslU.js'); })
|
|
13570
13570
|
]);
|
|
13571
13571
|
// Extract default export from ESM module namespace
|
|
13572
13572
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -13589,6 +13589,8 @@ class PhantomWalletProvider {
|
|
|
13589
13589
|
this.initPromise = null;
|
|
13590
13590
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
13591
13591
|
this.onSwitchToPrivy = null;
|
|
13592
|
+
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
13593
|
+
this.onSwitchToMWA = null;
|
|
13592
13594
|
this.networkUrl = networkUrl;
|
|
13593
13595
|
this.config = config;
|
|
13594
13596
|
if (typeof window === 'undefined') {
|
|
@@ -13956,6 +13958,31 @@ class PhantomWalletProvider {
|
|
|
13956
13958
|
}
|
|
13957
13959
|
}
|
|
13958
13960
|
};
|
|
13961
|
+
const handleMobileWalletClick = async () => {
|
|
13962
|
+
that.loginInProgress = false;
|
|
13963
|
+
walletClickedRef.current = true;
|
|
13964
|
+
setShowWalletModal(false);
|
|
13965
|
+
if (that.onSwitchToMWA) {
|
|
13966
|
+
try {
|
|
13967
|
+
const mwaProvider = await that.onSwitchToMWA();
|
|
13968
|
+
const user = await mwaProvider.login();
|
|
13969
|
+
if (that.pendingLogin && user) {
|
|
13970
|
+
that.pendingLogin.resolve(user);
|
|
13971
|
+
that.pendingLogin = null;
|
|
13972
|
+
}
|
|
13973
|
+
else if (that.pendingLogin) {
|
|
13974
|
+
that.pendingLogin.reject(new Error('User cancelled login'));
|
|
13975
|
+
that.pendingLogin = null;
|
|
13976
|
+
}
|
|
13977
|
+
}
|
|
13978
|
+
catch (error) {
|
|
13979
|
+
if (that.pendingLogin) {
|
|
13980
|
+
that.pendingLogin.reject(error);
|
|
13981
|
+
that.pendingLogin = null;
|
|
13982
|
+
}
|
|
13983
|
+
}
|
|
13984
|
+
}
|
|
13985
|
+
};
|
|
13959
13986
|
const handleCloseModal = () => {
|
|
13960
13987
|
setShowWalletModal(false);
|
|
13961
13988
|
if (that.loginInProgress && that.pendingLogin && !(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected)) {
|
|
@@ -14031,6 +14058,37 @@ class PhantomWalletProvider {
|
|
|
14031
14058
|
style: { width: '28px', height: '28px', borderRadius: '6px' },
|
|
14032
14059
|
}), 'Open Phantom app'));
|
|
14033
14060
|
}
|
|
14061
|
+
// Mobile Wallet Adapter button — shown on Android when MWA callback is available
|
|
14062
|
+
const isAndroid = /Android/i.test(navigator.userAgent);
|
|
14063
|
+
if (isAndroid && that.onSwitchToMWA) {
|
|
14064
|
+
walletButtons.push(React$1.createElement('button', {
|
|
14065
|
+
key: 'mobile-wallet',
|
|
14066
|
+
style: buttonStyle('mobile-wallet'),
|
|
14067
|
+
onClick: handleMobileWalletClick,
|
|
14068
|
+
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
14069
|
+
onMouseLeave: () => setHoveredBtn(null),
|
|
14070
|
+
},
|
|
14071
|
+
// Mobile wallet icon (phone with wallet)
|
|
14072
|
+
React$1.createElement('svg', {
|
|
14073
|
+
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
14074
|
+
style: { flexShrink: '0' },
|
|
14075
|
+
},
|
|
14076
|
+
// Phone outline
|
|
14077
|
+
React$1.createElement('rect', {
|
|
14078
|
+
x: '5', y: '2', width: '14', height: '20', rx: '2',
|
|
14079
|
+
stroke: textColor, strokeWidth: '2', fill: 'none',
|
|
14080
|
+
}),
|
|
14081
|
+
// Screen line
|
|
14082
|
+
React$1.createElement('line', {
|
|
14083
|
+
x1: '5', y1: '6', x2: '19', y2: '6',
|
|
14084
|
+
stroke: textColor, strokeWidth: '1.5',
|
|
14085
|
+
}),
|
|
14086
|
+
// Wallet/shield checkmark
|
|
14087
|
+
React$1.createElement('path', {
|
|
14088
|
+
d: 'M9.5 12.5l2 2 3.5-3.5',
|
|
14089
|
+
stroke: textColor, strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
14090
|
+
})), 'Connect Mobile Wallet'));
|
|
14091
|
+
}
|
|
14034
14092
|
// Email button (always shown in custom modal since enablePrivyFallback is true)
|
|
14035
14093
|
walletButtons.push(React$1.createElement('button', {
|
|
14036
14094
|
key: 'email-login',
|
|
@@ -35477,11 +35535,33 @@ async function hotSwapToPrivyProvider(config) {
|
|
|
35477
35535
|
setAuthProviderInstance(provider);
|
|
35478
35536
|
return privyProvider;
|
|
35479
35537
|
}
|
|
35538
|
+
async function hotSwapToMWAProvider(config) {
|
|
35539
|
+
var _a, _b;
|
|
35540
|
+
const rpcUrl = (_a = config.rpcUrl) !== null && _a !== void 0 ? _a : null;
|
|
35541
|
+
const mwaConfig = (_b = config.mobileWalletConfig) !== null && _b !== void 0 ? _b : {
|
|
35542
|
+
appIdentity: {
|
|
35543
|
+
name: config.name || undefined,
|
|
35544
|
+
uri: typeof window !== 'undefined' ? window.location.origin : undefined,
|
|
35545
|
+
},
|
|
35546
|
+
};
|
|
35547
|
+
const mwaProvider = new SolanaMobileWalletProvider(rpcUrl, mwaConfig);
|
|
35548
|
+
let provider = mwaProvider;
|
|
35549
|
+
if (config.chain === "offchain") {
|
|
35550
|
+
provider = new OffchainAuthProvider(mwaProvider);
|
|
35551
|
+
}
|
|
35552
|
+
currentAuthProvider = provider;
|
|
35553
|
+
currentAuthMethod = 'mobile-wallet-adapter';
|
|
35554
|
+
const coreConfig = await getConfig();
|
|
35555
|
+
coreConfig.authProvider = provider;
|
|
35556
|
+
coreConfig.authMethod = 'mobile-wallet-adapter';
|
|
35557
|
+
setAuthProviderInstance(provider);
|
|
35558
|
+
return provider;
|
|
35559
|
+
}
|
|
35480
35560
|
const SOLANA_DEVNET_RPC_URL = "https://idelle-8nxsep-fast-devnet.helius-rpc.com";
|
|
35481
35561
|
const SOLANA_MAINNET_RPC_URL = "https://celestia-cegncv-fast-mainnet.helius-rpc.com";
|
|
35482
35562
|
const SURFNET_RPC_URL = "https://surfpool.fly.dev";
|
|
35483
35563
|
async function getAuthProvider(config) {
|
|
35484
|
-
var _a, _b, _c, _d
|
|
35564
|
+
var _a, _b, _c, _d;
|
|
35485
35565
|
if (currentAuthProvider) {
|
|
35486
35566
|
return currentAuthProvider;
|
|
35487
35567
|
}
|
|
@@ -35505,25 +35585,7 @@ async function getAuthProvider(config) {
|
|
|
35505
35585
|
// Invalid stored value — clear it
|
|
35506
35586
|
setStoredAuthMethod(null);
|
|
35507
35587
|
}
|
|
35508
|
-
|
|
35509
|
-
// On Android (TWA via Bubblewrap, Chrome, or mobile browser), register the
|
|
35510
|
-
// Mobile Wallet Adapter so it appears in wallet discovery (e.g. Phantom's
|
|
35511
|
-
// useDiscoveredWallets, or any wallet-standard consumer). This makes Seed
|
|
35512
|
-
// Vault, Solflare, and other MWA wallets show up alongside injected wallets
|
|
35513
|
-
// in the existing Phantom/Privy modals — without overriding the configured
|
|
35514
|
-
// authMethod. Email login, deeplinks, and all other flows stay intact.
|
|
35515
|
-
//
|
|
35516
|
-
// Only authMethod: 'mobile-wallet-adapter' (explicit opt-in) bypasses
|
|
35517
|
-
// Phantom/Privy entirely and uses MWA as the sole provider.
|
|
35518
|
-
if (isMobileWalletAvailable()) {
|
|
35519
|
-
registerMobileWalletAdapter({
|
|
35520
|
-
appIdentity: (_b = (_a = config.mobileWalletConfig) === null || _a === void 0 ? void 0 : _a.appIdentity) !== null && _b !== void 0 ? _b : {
|
|
35521
|
-
name: config.name || undefined,
|
|
35522
|
-
uri: typeof window !== 'undefined' ? window.location.origin : undefined,
|
|
35523
|
-
},
|
|
35524
|
-
}).catch(() => { });
|
|
35525
|
-
}
|
|
35526
|
-
const rpcUrl = (_c = config.rpcUrl) !== null && _c !== void 0 ? _c : null;
|
|
35588
|
+
const rpcUrl = (_a = config.rpcUrl) !== null && _a !== void 0 ? _a : null;
|
|
35527
35589
|
currentAuthMethod = authMethod;
|
|
35528
35590
|
switch (authMethod) {
|
|
35529
35591
|
case "wallet":
|
|
@@ -35533,13 +35595,15 @@ async function getAuthProvider(config) {
|
|
|
35533
35595
|
console.warn("Rainbow Kit auth is not yet supported.");
|
|
35534
35596
|
break;
|
|
35535
35597
|
case "privy":
|
|
35536
|
-
currentAuthProvider = new PrivyWalletProvider((
|
|
35598
|
+
currentAuthProvider = new PrivyWalletProvider((_b = config.name) !== null && _b !== void 0 ? _b : null, (_c = config.logoUrl) !== null && _c !== void 0 ? _c : null, config.privyConfig, rpcUrl);
|
|
35537
35599
|
break;
|
|
35538
35600
|
case "phantom":
|
|
35539
35601
|
currentAuthProvider = new PhantomWalletProvider(rpcUrl, config.phantomConfig);
|
|
35540
|
-
if ((
|
|
35602
|
+
if ((_d = config.phantomConfig) === null || _d === void 0 ? void 0 : _d.enablePrivyFallback) {
|
|
35541
35603
|
currentAuthProvider.onSwitchToPrivy =
|
|
35542
35604
|
() => hotSwapToPrivyProvider(config);
|
|
35605
|
+
currentAuthProvider.onSwitchToMWA =
|
|
35606
|
+
() => hotSwapToMWAProvider(config);
|
|
35543
35607
|
}
|
|
35544
35608
|
break;
|
|
35545
35609
|
case "mobile-wallet-adapter":
|
|
@@ -35811,4 +35875,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
|
|
|
35811
35875
|
exports.signTransaction = signTransaction;
|
|
35812
35876
|
exports.subscribe = subscribe;
|
|
35813
35877
|
exports.useAuth = useAuth;
|
|
35814
|
-
//# sourceMappingURL=index-
|
|
35878
|
+
//# sourceMappingURL=index-BZpQdkSL.js.map
|