@pooflabs/web 0.0.89-rc2 → 0.0.89-rc4
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/hooks/usePoofnetWallet.d.ts +28 -0
- package/dist/auth/providers/mock-poofnet-provider.d.ts +10 -25
- package/dist/{index-DQhWZskl.esm.js → index-Bop7HFA-.esm.js} +2 -2
- package/dist/{index-4JUcdcnk.esm.js.map → index-Bop7HFA-.esm.js.map} +1 -1
- package/dist/{index-CXmcQaFm.js → index-CEADZ0na.js} +2 -2
- package/dist/{index-CXmcQaFm.js.map → index-CEADZ0na.js.map} +1 -1
- package/dist/{index-Cgaz8U9W.esm.js → index-DGOP9-5L.esm.js} +132 -87
- package/dist/index-DGOP9-5L.esm.js.map +1 -0
- package/dist/{index-BLiaV7Dz.js → index-DHI02_l_.js} +132 -86
- package/dist/index-DHI02_l_.js.map +1 -0
- package/dist/{index-QJAj_nTx.js → index-DS3Ftep_.js} +2 -2
- package/dist/{index-QJAj_nTx.js.map → index-DS3Ftep_.js.map} +1 -1
- package/dist/{index-4JUcdcnk.esm.js → index-DZhOa-_D.esm.js} +2 -2
- package/dist/{index-DQhWZskl.esm.js.map → index-DZhOa-_D.esm.js.map} +1 -1
- package/dist/{index.browser-kQdoMu7Y.esm.js → index.browser-0dewreQm.esm.js} +2 -2
- package/dist/{index.browser-kQdoMu7Y.esm.js.map → index.browser-0dewreQm.esm.js.map} +1 -1
- package/dist/{index.browser-CG2sQjrd.esm.js → index.browser-B-pUCZgP.esm.js} +2 -2
- package/dist/{index.browser-CG2sQjrd.esm.js.map → index.browser-B-pUCZgP.esm.js.map} +1 -1
- package/dist/{index.browser-B9NfvmrP.js → index.browser-C9AVHEa4.js} +2 -2
- package/dist/{index.browser-B9NfvmrP.js.map → index.browser-C9AVHEa4.js.map} +1 -1
- package/dist/{index.browser-UxB-zDuA.js → index.browser-rhFUHjM1.js} +2 -2
- package/dist/{index.browser-UxB-zDuA.js.map → index.browser-rhFUHjM1.js.map} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{index.native-CwpIbypp.esm.js → index.native-CXtxnE1X.esm.js} +114 -85
- package/dist/index.native-CXtxnE1X.esm.js.map +1 -0
- package/dist/{index.native-Cycwo-3I.js → index.native-DzDWIHgW.js} +114 -84
- package/dist/index.native-DzDWIHgW.js.map +1 -0
- package/dist/index.native.d.ts +2 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +2 -1
- package/dist/index.native.js.map +1 -1
- package/dist/{phantom-wallet-provider-DM-96ILz.esm.js → phantom-wallet-provider-SmsVVBCI.esm.js} +16 -3
- package/dist/phantom-wallet-provider-SmsVVBCI.esm.js.map +1 -0
- package/dist/{phantom-wallet-provider-BgDhrraw.js → phantom-wallet-provider-mA4Yaf-t.js} +16 -3
- package/dist/phantom-wallet-provider-mA4Yaf-t.js.map +1 -0
- package/dist/{privy-wallet-provider-C70AIqHI.esm.js → privy-wallet-provider-BNPm2WEZ.esm.js} +3 -3
- package/dist/{privy-wallet-provider-C70AIqHI.esm.js.map → privy-wallet-provider-BNPm2WEZ.esm.js.map} +1 -1
- package/dist/{privy-wallet-provider-D4IYOUji.js → privy-wallet-provider-CHMc_YjB.js} +3 -3
- package/dist/{privy-wallet-provider-D4IYOUji.js.map → privy-wallet-provider-CHMc_YjB.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-CXXw-pKg.esm.js → solana-mobile-wallet-provider-BMGBQI3W.esm.js} +8 -5
- package/dist/solana-mobile-wallet-provider-BMGBQI3W.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-BrjPc7Wd.js → solana-mobile-wallet-provider-DmBKAypM.js} +8 -5
- package/dist/solana-mobile-wallet-provider-DmBKAypM.js.map +1 -0
- package/package.json +1 -1
- package/dist/index-BLiaV7Dz.js.map +0 -1
- package/dist/index-Cgaz8U9W.esm.js.map +0 -1
- package/dist/index.native-CwpIbypp.esm.js.map +0 -1
- package/dist/index.native-Cycwo-3I.js.map +0 -1
- package/dist/phantom-wallet-provider-BgDhrraw.js.map +0 -1
- package/dist/phantom-wallet-provider-DM-96ILz.esm.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-BrjPc7Wd.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-CXXw-pKg.esm.js.map +0 -1
|
@@ -16874,13 +16874,19 @@ const AUTH_METHOD = 'poofnet-mock';
|
|
|
16874
16874
|
* wrapped by OffchainAuthProvider so transaction mocking is unchanged. Mainnet
|
|
16875
16875
|
* never touches this class.
|
|
16876
16876
|
*/
|
|
16877
|
+
/**
|
|
16878
|
+
* The active MockPoofnetProvider instance while mock-connected. Exposed so the
|
|
16879
|
+
* usePoofnetWallet() hook (and thus the app's own wallet UI, e.g. WalletButton)
|
|
16880
|
+
* can list/switch/generate mock wallets. Null when not mock-connected.
|
|
16881
|
+
*/
|
|
16882
|
+
let activeMockPoofnetInstance = null;
|
|
16883
|
+
function getActiveMockPoofnetProvider() {
|
|
16884
|
+
return activeMockPoofnetInstance;
|
|
16885
|
+
}
|
|
16877
16886
|
class MockPoofnetProvider {
|
|
16878
16887
|
constructor() {
|
|
16879
16888
|
/** The keypair for the currently-connected mock wallet (re-derived on login/switch/restore). */
|
|
16880
16889
|
this.activeKeypair = null;
|
|
16881
|
-
/** Floating wallet widget root (web only). */
|
|
16882
|
-
this.widgetEl = null;
|
|
16883
|
-
this.widgetExpanded = false;
|
|
16884
16890
|
}
|
|
16885
16891
|
// ============ Identity / derivation ============
|
|
16886
16892
|
getDeviceId() {
|
|
@@ -16979,21 +16985,24 @@ class MockPoofnetProvider {
|
|
|
16979
16985
|
}
|
|
16980
16986
|
const index = Math.min(meta.activeIndex, meta.count - 1);
|
|
16981
16987
|
this.activeKeypair = await this.deriveKeypair(appId, index);
|
|
16988
|
+
// Set the singleton BEFORE mintSession — mintSession calls setCurrentUser,
|
|
16989
|
+
// which fires onAuthStateChanged → usePoofnetWallet.refresh(); that refresh
|
|
16990
|
+
// must see this instance (else isMock is false until a reload).
|
|
16991
|
+
activeMockPoofnetInstance = this;
|
|
16982
16992
|
const user = await this.mintSession(this.activeKeypair);
|
|
16983
|
-
this.showWalletWidget(appId).catch(() => { });
|
|
16984
16993
|
return user;
|
|
16985
16994
|
}
|
|
16986
16995
|
async restoreSession() {
|
|
16987
16996
|
const session = await WebSessionManager.getSession();
|
|
16988
16997
|
if (!session)
|
|
16989
16998
|
return null;
|
|
16990
|
-
// Re-derive the active keypair so signMessage works after a reload
|
|
16991
|
-
//
|
|
16999
|
+
// Re-derive the active keypair so signMessage works after a reload.
|
|
17000
|
+
// Best-effort — the session itself is authoritative.
|
|
16992
17001
|
try {
|
|
16993
17002
|
const appId = await this.getAppId();
|
|
16994
17003
|
const meta = this.getWalletMeta(appId);
|
|
16995
17004
|
this.activeKeypair = await this.deriveKeypair(appId, Math.min(meta.activeIndex, Math.max(0, meta.count - 1)));
|
|
16996
|
-
|
|
17005
|
+
activeMockPoofnetInstance = this;
|
|
16997
17006
|
}
|
|
16998
17007
|
catch ( /* noop */_a) { /* noop */ }
|
|
16999
17008
|
return { provider: this, address: session.address };
|
|
@@ -17002,7 +17011,7 @@ class MockPoofnetProvider {
|
|
|
17002
17011
|
WebSessionManager.clearSession();
|
|
17003
17012
|
setCurrentUser(null);
|
|
17004
17013
|
this.activeKeypair = null;
|
|
17005
|
-
|
|
17014
|
+
activeMockPoofnetInstance = null;
|
|
17006
17015
|
}
|
|
17007
17016
|
// ============ Multi-wallet management ============
|
|
17008
17017
|
/** Switch to (and connect as) an existing mock wallet by index. */
|
|
@@ -17016,8 +17025,10 @@ class MockPoofnetProvider {
|
|
|
17016
17025
|
// Drop the old session, mint a fresh one for the selected wallet.
|
|
17017
17026
|
WebSessionManager.clearSession();
|
|
17018
17027
|
this.activeKeypair = await this.deriveKeypair(appId, index);
|
|
17028
|
+
// Set the singleton before mintSession (see login) so the refresh that
|
|
17029
|
+
// mintSession's setCurrentUser triggers observes the active instance.
|
|
17030
|
+
activeMockPoofnetInstance = this;
|
|
17019
17031
|
const user = await this.mintSession(this.activeKeypair);
|
|
17020
|
-
this.showWalletWidget(appId).catch(() => { });
|
|
17021
17032
|
return user;
|
|
17022
17033
|
}
|
|
17023
17034
|
/** Generate a brand-new mock wallet (next index) and connect as it. */
|
|
@@ -17026,6 +17037,18 @@ class MockPoofnetProvider {
|
|
|
17026
17037
|
const meta = this.getWalletMeta(appId);
|
|
17027
17038
|
return this.switchWallet(meta.count);
|
|
17028
17039
|
}
|
|
17040
|
+
/** Wallet list + active index for the wallet UI (usePoofnetWallet hook). */
|
|
17041
|
+
async getWalletState() {
|
|
17042
|
+
const appId = await this.getAppId();
|
|
17043
|
+
const meta = this.getWalletMeta(appId);
|
|
17044
|
+
const count = Math.max(1, meta.count);
|
|
17045
|
+
const wallets = [];
|
|
17046
|
+
for (let i = 0; i < count; i++) {
|
|
17047
|
+
const kp = await this.deriveKeypair(appId, i);
|
|
17048
|
+
wallets.push({ index: i, label: this.labelFor(meta, i), address: kp.publicKey.toBase58() });
|
|
17049
|
+
}
|
|
17050
|
+
return { wallets, activeIndex: Math.min(meta.activeIndex, count - 1) };
|
|
17051
|
+
}
|
|
17029
17052
|
// ============ AuthProvider interface (offchain-wrapped, mostly inert) ============
|
|
17030
17053
|
async signMessage(message) {
|
|
17031
17054
|
if (!this.activeKeypair)
|
|
@@ -17058,73 +17081,6 @@ class MockPoofnetProvider {
|
|
|
17058
17081
|
async getNativeMethods() {
|
|
17059
17082
|
return {};
|
|
17060
17083
|
}
|
|
17061
|
-
// ============ Floating wallet widget (web only) ============
|
|
17062
|
-
async showWalletWidget(appId) {
|
|
17063
|
-
if (!getPlatform().hasDOM || typeof document === 'undefined')
|
|
17064
|
-
return;
|
|
17065
|
-
const meta = this.getWalletMeta(appId);
|
|
17066
|
-
// Derive addresses for every wallet so the dropdown can show them.
|
|
17067
|
-
const wallets = [];
|
|
17068
|
-
for (let i = 0; i < meta.count; i++) {
|
|
17069
|
-
const kp = await this.deriveKeypair(appId, i);
|
|
17070
|
-
wallets.push({ index: i, label: this.labelFor(meta, i), address: kp.publicKey.toBase58() });
|
|
17071
|
-
}
|
|
17072
|
-
const active = wallets[Math.min(meta.activeIndex, wallets.length - 1)] || wallets[0];
|
|
17073
|
-
if (!active)
|
|
17074
|
-
return;
|
|
17075
|
-
if (!this.widgetEl) {
|
|
17076
|
-
this.widgetEl = document.createElement('div');
|
|
17077
|
-
this.widgetEl.id = 'poofnet-wallet-widget';
|
|
17078
|
-
document.body.appendChild(this.widgetEl);
|
|
17079
|
-
}
|
|
17080
|
-
const short = (a) => `${a.slice(0, 4)}…${a.slice(-4)}`;
|
|
17081
|
-
const rows = wallets.map((w) => `
|
|
17082
|
-
<button data-poofnet-switch="${w.index}" style="display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:8px 10px;background:${w.index === active.index ? 'rgba(153,69,255,0.18)' : 'transparent'};border:none;border-radius:8px;color:#fff;font-size:13px;cursor:pointer;text-align:left;">
|
|
17083
|
-
<span style="display:flex;flex-direction:column;"><span style="font-weight:600;">${w.label}</span><span style="opacity:0.55;font-size:11px;font-family:monospace;">${short(w.address)}</span></span>
|
|
17084
|
-
${w.index === active.index ? '<span style="color:#9945FF;">●</span>' : ''}
|
|
17085
|
-
</button>`).join('');
|
|
17086
|
-
this.widgetEl.innerHTML = `
|
|
17087
|
-
<div style="position:fixed;bottom:16px;right:16px;z-index:2147483600;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;">
|
|
17088
|
-
${this.widgetExpanded ? `
|
|
17089
|
-
<div style="margin-bottom:8px;width:240px;background:#161618;border:1px solid #2a2a2e;border-radius:12px;padding:8px;box-shadow:0 8px 32px rgba(0,0,0,0.5);">
|
|
17090
|
-
<div style="padding:6px 10px 8px;font-size:11px;letter-spacing:0.04em;text-transform:uppercase;color:#9945FF;font-weight:700;">Poofnet · Simulated</div>
|
|
17091
|
-
<div style="max-height:220px;overflow:auto;display:flex;flex-direction:column;gap:2px;">${rows}</div>
|
|
17092
|
-
<button data-poofnet-generate="1" style="margin-top:6px;width:100%;padding:8px 10px;background:rgba(153,69,255,0.12);border:1px dashed #9945FF;border-radius:8px;color:#c8a4ff;font-size:13px;font-weight:600;cursor:pointer;">+ Generate new wallet</button>
|
|
17093
|
-
</div>` : ''}
|
|
17094
|
-
<button data-poofnet-toggle="1" style="display:flex;align-items:center;gap:8px;padding:8px 12px;background:#161618;border:1px solid #2a2a2e;border-radius:999px;color:#fff;font-size:13px;cursor:pointer;box-shadow:0 4px 16px rgba(0,0,0,0.4);">
|
|
17095
|
-
<span style="width:8px;height:8px;border-radius:50%;background:#9945FF;box-shadow:0 0 8px #9945FF;"></span>
|
|
17096
|
-
<span style="font-weight:600;">${active.label}</span>
|
|
17097
|
-
<span style="opacity:0.55;font-family:monospace;font-size:12px;">${short(active.address)}</span>
|
|
17098
|
-
<span style="opacity:0.5;transform:rotate(${this.widgetExpanded ? '180deg' : '0deg'});">▾</span>
|
|
17099
|
-
</button>
|
|
17100
|
-
</div>`;
|
|
17101
|
-
// Wire handlers (re-bound each render).
|
|
17102
|
-
const toggle = this.widgetEl.querySelector('[data-poofnet-toggle]');
|
|
17103
|
-
if (toggle)
|
|
17104
|
-
toggle.onclick = () => { this.widgetExpanded = !this.widgetExpanded; this.showWalletWidget(appId).catch(() => { }); };
|
|
17105
|
-
this.widgetEl.querySelectorAll('[data-poofnet-switch]').forEach((btn) => {
|
|
17106
|
-
btn.onclick = async () => {
|
|
17107
|
-
const idx = parseInt(btn.getAttribute('data-poofnet-switch'), 10);
|
|
17108
|
-
this.widgetExpanded = false;
|
|
17109
|
-
if (idx !== active.index)
|
|
17110
|
-
await this.switchWallet(idx);
|
|
17111
|
-
else
|
|
17112
|
-
this.showWalletWidget(appId).catch(() => { });
|
|
17113
|
-
};
|
|
17114
|
-
});
|
|
17115
|
-
const gen = this.widgetEl.querySelector('[data-poofnet-generate]');
|
|
17116
|
-
if (gen)
|
|
17117
|
-
gen.onclick = async () => { this.widgetExpanded = false; await this.generateWallet(); };
|
|
17118
|
-
}
|
|
17119
|
-
removeWalletWidget() {
|
|
17120
|
-
try {
|
|
17121
|
-
if (this.widgetEl && this.widgetEl.parentNode)
|
|
17122
|
-
this.widgetEl.parentNode.removeChild(this.widgetEl);
|
|
17123
|
-
}
|
|
17124
|
-
catch ( /* noop */_a) { /* noop */ }
|
|
17125
|
-
this.widgetEl = null;
|
|
17126
|
-
this.widgetExpanded = false;
|
|
17127
|
-
}
|
|
17128
17084
|
}
|
|
17129
17085
|
|
|
17130
17086
|
/**
|
|
@@ -18226,17 +18182,17 @@ function setAuthProviderInstance(provider) {
|
|
|
18226
18182
|
authProviderInstance = provider;
|
|
18227
18183
|
}
|
|
18228
18184
|
|
|
18229
|
-
var _a;
|
|
18185
|
+
var _a$1;
|
|
18230
18186
|
// Whether we're in a server-side rendering context (no hooks allowed).
|
|
18231
18187
|
// React Native has no `window` but DOES support hooks.
|
|
18232
18188
|
// We detect Node SSR specifically via process.versions.node to avoid
|
|
18233
18189
|
// false positives from Node 21+ which defines `navigator` globally.
|
|
18234
|
-
const isSSR = typeof window === 'undefined'
|
|
18190
|
+
const isSSR$1 = typeof window === 'undefined'
|
|
18235
18191
|
&& typeof process !== 'undefined'
|
|
18236
|
-
&& !!((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
|
18192
|
+
&& !!((_a$1 = process.versions) === null || _a$1 === void 0 ? void 0 : _a$1.node);
|
|
18237
18193
|
function useAuth() {
|
|
18238
18194
|
// Provide a fallback so server render doesn't break
|
|
18239
|
-
if (isSSR) {
|
|
18195
|
+
if (isSSR$1) {
|
|
18240
18196
|
return {
|
|
18241
18197
|
login: async () => undefined,
|
|
18242
18198
|
logout: async () => undefined,
|
|
@@ -18296,6 +18252,79 @@ function useAuth() {
|
|
|
18296
18252
|
};
|
|
18297
18253
|
}
|
|
18298
18254
|
|
|
18255
|
+
var _a;
|
|
18256
|
+
const isSSR = typeof window === 'undefined'
|
|
18257
|
+
&& typeof process !== 'undefined'
|
|
18258
|
+
&& !!((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
|
18259
|
+
const EMPTY = {
|
|
18260
|
+
isMock: false,
|
|
18261
|
+
wallets: [],
|
|
18262
|
+
activeIndex: 0,
|
|
18263
|
+
switchWallet: async () => undefined,
|
|
18264
|
+
generateWallet: async () => undefined,
|
|
18265
|
+
refresh: async () => undefined,
|
|
18266
|
+
};
|
|
18267
|
+
/**
|
|
18268
|
+
* Exposes the simulated Poofnet wallet to the app's own wallet UI (e.g. the
|
|
18269
|
+
* template WalletButton). `isMock` is false on mainnet / real-wallet sessions,
|
|
18270
|
+
* so callers can conditionally render the switch/generate controls.
|
|
18271
|
+
*
|
|
18272
|
+
* Reactive: re-reads whenever auth state changes (login / logout / wallet
|
|
18273
|
+
* switch all flow through setCurrentUser → onAuthStateChanged).
|
|
18274
|
+
*/
|
|
18275
|
+
function usePoofnetWallet() {
|
|
18276
|
+
if (isSSR)
|
|
18277
|
+
return EMPTY;
|
|
18278
|
+
const [state, setState] = React$2.useState({
|
|
18279
|
+
isMock: false,
|
|
18280
|
+
wallets: [],
|
|
18281
|
+
activeIndex: 0,
|
|
18282
|
+
});
|
|
18283
|
+
const refresh = React$2.useCallback(async () => {
|
|
18284
|
+
const provider = getActiveMockPoofnetProvider();
|
|
18285
|
+
if (!provider) {
|
|
18286
|
+
setState({ isMock: false, wallets: [], activeIndex: 0 });
|
|
18287
|
+
return;
|
|
18288
|
+
}
|
|
18289
|
+
try {
|
|
18290
|
+
const { wallets, activeIndex } = await provider.getWalletState();
|
|
18291
|
+
setState({ isMock: true, wallets, activeIndex });
|
|
18292
|
+
}
|
|
18293
|
+
catch (_a) {
|
|
18294
|
+
setState({ isMock: false, wallets: [], activeIndex: 0 });
|
|
18295
|
+
}
|
|
18296
|
+
}, []);
|
|
18297
|
+
React$2.useEffect(() => {
|
|
18298
|
+
refresh();
|
|
18299
|
+
// setCurrentUser (login/logout/switch/generate) notifies these listeners.
|
|
18300
|
+
onAuthStateChanged(() => { refresh(); });
|
|
18301
|
+
// Note: onAuthStateChanged has no unsubscribe yet (same as useAuth) — fine
|
|
18302
|
+
// for a wallet button that mounts once.
|
|
18303
|
+
}, [refresh]);
|
|
18304
|
+
const switchWallet = React$2.useCallback(async (index) => {
|
|
18305
|
+
const provider = getActiveMockPoofnetProvider();
|
|
18306
|
+
if (provider) {
|
|
18307
|
+
await provider.switchWallet(index);
|
|
18308
|
+
await refresh();
|
|
18309
|
+
}
|
|
18310
|
+
}, [refresh]);
|
|
18311
|
+
const generateWallet = React$2.useCallback(async () => {
|
|
18312
|
+
const provider = getActiveMockPoofnetProvider();
|
|
18313
|
+
if (provider) {
|
|
18314
|
+
await provider.generateWallet();
|
|
18315
|
+
await refresh();
|
|
18316
|
+
}
|
|
18317
|
+
}, [refresh]);
|
|
18318
|
+
return {
|
|
18319
|
+
isMock: state.isMock,
|
|
18320
|
+
wallets: state.wallets,
|
|
18321
|
+
activeIndex: state.activeIndex,
|
|
18322
|
+
switchWallet,
|
|
18323
|
+
generateWallet,
|
|
18324
|
+
refresh,
|
|
18325
|
+
};
|
|
18326
|
+
}
|
|
18327
|
+
|
|
18299
18328
|
async function deserializeTransaction(tx) {
|
|
18300
18329
|
const buf = Buffer.isBuffer(tx) ? tx : Buffer.from(tx, 'base64');
|
|
18301
18330
|
if ((buf[0] & 0x80) !== 0) {
|
|
@@ -18427,7 +18456,7 @@ async function loadDependencies() {
|
|
|
18427
18456
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
18428
18457
|
import('react'),
|
|
18429
18458
|
import('react-dom/client'),
|
|
18430
|
-
import('./index-
|
|
18459
|
+
import('./index-Bop7HFA-.esm.js')
|
|
18431
18460
|
]);
|
|
18432
18461
|
// Extract default export from ESM module namespace
|
|
18433
18462
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -18878,6 +18907,19 @@ class PhantomWalletProvider {
|
|
|
18878
18907
|
that.awaitTopLevelConnect();
|
|
18879
18908
|
return;
|
|
18880
18909
|
}
|
|
18910
|
+
// C2: pre-warm Chrome's Local Network Access permission inside the
|
|
18911
|
+
// tap gesture, so its prompt appears up-front instead of on return
|
|
18912
|
+
// from the wallet (MWA opens a ws://localhost reflector only after
|
|
18913
|
+
// the app-switch, which is why the prompt currently lands on return).
|
|
18914
|
+
// Best-effort, Android top-level only. DEVICE-TEST: confirm Chrome
|
|
18915
|
+
// grants this per-origin (so MWA's later random-port socket reuses
|
|
18916
|
+
// it). If LNA turns out to be per-port, this won't pre-grant — cut it.
|
|
18917
|
+
if (detectAndroid() && typeof WebSocket !== 'undefined') {
|
|
18918
|
+
try {
|
|
18919
|
+
new WebSocket('ws://localhost:1');
|
|
18920
|
+
}
|
|
18921
|
+
catch ( /* noop */_a) { /* noop */ }
|
|
18922
|
+
}
|
|
18881
18923
|
if (that.onSwitchToMWA) {
|
|
18882
18924
|
try {
|
|
18883
18925
|
const mwaProvider = await that.onSwitchToMWA();
|
|
@@ -24615,7 +24657,7 @@ async function registerMobileWalletAdapter(config) {
|
|
|
24615
24657
|
if (typeof window === 'undefined')
|
|
24616
24658
|
return;
|
|
24617
24659
|
try {
|
|
24618
|
-
const walletStandardMobile = await import('./index.browser-
|
|
24660
|
+
const walletStandardMobile = await import('./index.browser-B-pUCZgP.esm.js');
|
|
24619
24661
|
const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
|
|
24620
24662
|
if (!registerMwa) {
|
|
24621
24663
|
console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
|
|
@@ -24754,7 +24796,7 @@ class SolanaMobileWalletProvider {
|
|
|
24754
24796
|
async ensureWallet() {
|
|
24755
24797
|
if (this.wallet)
|
|
24756
24798
|
return this.wallet;
|
|
24757
|
-
const mod = await import('./index.browser-
|
|
24799
|
+
const mod = await import('./index.browser-B-pUCZgP.esm.js');
|
|
24758
24800
|
const chain = mapChainToWalletStandard(this.cluster);
|
|
24759
24801
|
this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
|
|
24760
24802
|
appIdentity: this.appIdentity,
|
|
@@ -24963,8 +25005,6 @@ class SolanaMobileWalletProvider {
|
|
|
24963
25005
|
return user;
|
|
24964
25006
|
}
|
|
24965
25007
|
}
|
|
24966
|
-
// Pre-fetch nonce while the wallet popup is not yet open.
|
|
24967
|
-
const nonce = await genAuthNonce();
|
|
24968
25008
|
// Wallet popup #1: standard:connect performs MWA authorize. This
|
|
24969
25009
|
// is where wallet-standard's checkLocalNetworkAccessPermission()
|
|
24970
25010
|
// fires the three-stage LNA UX (info modal → permission prompt →
|
|
@@ -25007,6 +25047,11 @@ class SolanaMobileWalletProvider {
|
|
|
25007
25047
|
// Insert a Tarobase modal: the user's tap on "Sign in" provides a
|
|
25008
25048
|
// fresh activation, and signMessage is invoked synchronously
|
|
25009
25049
|
// inside the click handler so the activation propagates.
|
|
25050
|
+
// C1: fetch the nonce HERE (after connect), not before — a pre-connect
|
|
25051
|
+
// network round-trip was decaying the Chrome user activation needed for
|
|
25052
|
+
// the connect's solana-wallet: navigation, intermittently causing
|
|
25053
|
+
// ERROR_WALLET_NOT_FOUND. The nonce is only needed for the message below.
|
|
25054
|
+
const nonce = await genAuthNonce();
|
|
25010
25055
|
const messageText = await genSolanaMessage(base58Addr, nonce);
|
|
25011
25056
|
const messageBytes = getPlatform().textEncode(messageText);
|
|
25012
25057
|
const signMessageFeat = getSignMessageFeature(wallet);
|
|
@@ -25943,5 +25988,5 @@ class PrivyExpoProvider {
|
|
|
25943
25988
|
}
|
|
25944
25989
|
}
|
|
25945
25990
|
|
|
25946
|
-
export {
|
|
25947
|
-
//# sourceMappingURL=index-
|
|
25991
|
+
export { genSolanaMessage as $, subscribe as A, useAuth as B, usePoofnetWallet as C, deserializeTransaction as D, getIdToken as E, setPlatform as F, getPlatform as G, PrivyWalletProvider as H, DEFAULT_TEST_ADDRESS as I, isMobileWalletAvailable as J, registerMobileWalletAdapter as K, PrivyExpoProvider as L, MockAuthProvider as M, InsufficientBalanceError as N, OffchainAuthProvider as O, PhantomWalletProvider as P, ServerSessionManager as Q, ReactNativeSessionManager as R, SolanaMobileWalletProvider as S, buildSetDocumentsTransaction as T, clearCache as U, closeAllSubscriptions as V, WebSessionManager as W, convertRemainingAccounts as X, createSessionWithPrivy as Y, createSessionWithSignature as Z, genAuthNonce as _, base58 as a, getCachedData as a0, getMany as a1, reconnectWithNewAuth as a2, refreshSession as a3, signSessionCreateMessage as a4, bufferExports as b, getCurrentUser as c, onAuthLoadingChanged as d, getAuthLoading as e, logout as f, getDefaultExportFromCjs$1 as g, getConfig as h, init as i, getAuthProvider as j, get as k, login as l, setMany as m, setFile as n, onAuthStateChanged as o, getFiles as p, runQueryMany as q, runQuery as r, set as s, runExpression as t, runExpressionMany as u, signMessage as v, signTransaction as w, signAndSubmitTransaction as x, count as y, aggregate as z };
|
|
25992
|
+
//# sourceMappingURL=index-DGOP9-5L.esm.js.map
|