@pooflabs/web 0.0.81-rc5 → 0.0.81
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/index.d.ts +10 -1
- package/dist/auth/providers/phantom-wallet-provider.d.ts +20 -21
- package/dist/global.d.ts +3 -1
- package/dist/{index-Fjyk5jYL.js → index-B2WGCssJ.js} +346 -490
- package/dist/index-B2WGCssJ.js.map +1 -0
- package/dist/{index-DB9nDInp.esm.js → index-CjHbp7Dq.esm.js} +3697 -562
- package/dist/index-CjHbp7Dq.esm.js.map +1 -0
- package/dist/{index-D_ta2S2c.js → index-DXPkkq81.js} +3698 -563
- package/dist/index-DXPkkq81.js.map +1 -0
- package/dist/{index-Bg_ApFIo.js → index-D_DiP8XQ.js} +3698 -563
- package/dist/index-D_DiP8XQ.js.map +1 -0
- package/dist/{index-CZhJBWap.esm.js → index-dcJIjFrs.esm.js} +3697 -562
- package/dist/index-dcJIjFrs.esm.js.map +1 -0
- package/dist/{index-Bkr4BRoP.esm.js → index-nt_HQVrk.esm.js} +344 -490
- package/dist/index-nt_HQVrk.esm.js.map +1 -0
- package/dist/{index.browser-iqs5DlRU.esm.js → index.browser-BNdFfyIg.esm.js} +1571 -1368
- package/dist/index.browser-BNdFfyIg.esm.js.map +1 -0
- package/dist/{index.browser-DHi7UhqF.js → index.browser-CT6PUv9G.js} +1571 -1368
- package/dist/index.browser-CT6PUv9G.js.map +1 -0
- package/dist/index.browser-Cy21yaX0.esm.js +1096 -0
- package/dist/index.browser-Cy21yaX0.esm.js.map +1 -0
- package/dist/index.browser-OvGNsMPu.esm.js +1002 -0
- package/dist/index.browser-OvGNsMPu.esm.js.map +1 -0
- package/dist/index.browser-ZD7Tz2bn.js +1099 -0
- package/dist/index.browser-ZD7Tz2bn.js.map +1 -0
- package/dist/index.browser-d0PlOXpF.js +105 -0
- package/dist/index.browser-d0PlOXpF.js.map +1 -0
- package/dist/index.browser-pE1s68e9.esm.js +102 -0
- package/dist/index.browser-pE1s68e9.esm.js.map +1 -0
- package/dist/index.browser-vuTr40so.js +1008 -0
- package/dist/index.browser-vuTr40so.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{index.native-DYgJWWY4.esm.js → index.native-BqYr--vb.esm.js} +202 -178
- package/dist/index.native-BqYr--vb.esm.js.map +1 -0
- package/dist/{index.native-DJWuqJTZ.js → index.native-CyA-RdvW.js} +204 -178
- package/dist/index.native-CyA-RdvW.js.map +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +1 -1
- package/dist/{phantom-wallet-provider-fofd8BMo.js → phantom-wallet-provider-DWCaMkyz.js} +147 -238
- package/dist/phantom-wallet-provider-DWCaMkyz.js.map +1 -0
- package/dist/{phantom-wallet-provider-DSFGWSOJ.esm.js → phantom-wallet-provider-K2V96G-G.esm.js} +147 -238
- package/dist/phantom-wallet-provider-K2V96G-G.esm.js.map +1 -0
- package/dist/{privy-wallet-provider-Csv34Kcc.js → privy-wallet-provider-BMg_S_d0.js} +4 -4
- package/dist/privy-wallet-provider-BMg_S_d0.js.map +1 -0
- package/dist/{privy-wallet-provider-TRToDe4Q.esm.js → privy-wallet-provider-DoX8q99w.esm.js} +4 -4
- package/dist/privy-wallet-provider-DoX8q99w.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-L7nRuxhv.esm.js → solana-mobile-wallet-provider-Cmphb3oB.esm.js} +3 -82
- package/dist/solana-mobile-wallet-provider-Cmphb3oB.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-Cp65LfNb.js → solana-mobile-wallet-provider-t22Ie8lY.js} +3 -82
- package/dist/solana-mobile-wallet-provider-t22Ie8lY.js.map +1 -0
- package/package.json +3 -3
- package/dist/index-Bg_ApFIo.js.map +0 -1
- package/dist/index-Bkr4BRoP.esm.js.map +0 -1
- package/dist/index-CZhJBWap.esm.js.map +0 -1
- package/dist/index-DB9nDInp.esm.js.map +0 -1
- package/dist/index-D_ta2S2c.js.map +0 -1
- package/dist/index-Fjyk5jYL.js.map +0 -1
- package/dist/index.browser-BTlliHCf.esm.js +0 -119
- package/dist/index.browser-BTlliHCf.esm.js.map +0 -1
- package/dist/index.browser-C-_FEr5M.esm.js +0 -1134
- package/dist/index.browser-C-_FEr5M.esm.js.map +0 -1
- package/dist/index.browser-DHi7UhqF.js.map +0 -1
- package/dist/index.browser-DRTQuf0J.js +0 -1253
- package/dist/index.browser-DRTQuf0J.js.map +0 -1
- package/dist/index.browser-Disp7Kcb.esm.js +0 -1250
- package/dist/index.browser-Disp7Kcb.esm.js.map +0 -1
- package/dist/index.browser-DjEZSiqI.js +0 -1137
- package/dist/index.browser-DjEZSiqI.js.map +0 -1
- package/dist/index.browser-DvTeEO2r.js +0 -122
- package/dist/index.browser-DvTeEO2r.js.map +0 -1
- package/dist/index.browser-iqs5DlRU.esm.js.map +0 -1
- package/dist/index.native-DJWuqJTZ.js.map +0 -1
- package/dist/index.native-DYgJWWY4.esm.js.map +0 -1
- package/dist/phantom-wallet-provider-DSFGWSOJ.esm.js.map +0 -1
- package/dist/phantom-wallet-provider-fofd8BMo.js.map +0 -1
- package/dist/privy-wallet-provider-Csv34Kcc.js.map +0 -1
- package/dist/privy-wallet-provider-TRToDe4Q.esm.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-Cp65LfNb.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-L7nRuxhv.esm.js.map +0 -1
|
@@ -22,6 +22,21 @@ function _interopNamespaceDefault(e) {
|
|
|
22
22
|
return Object.freeze(n);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function _mergeNamespaces(n, m) {
|
|
26
|
+
m.forEach(function (e) {
|
|
27
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
28
|
+
if (k !== 'default' && !(k in n)) {
|
|
29
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
30
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return e[k]; }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return Object.freeze(n);
|
|
38
|
+
}
|
|
39
|
+
|
|
25
40
|
var anchor__namespace = /*#__PURE__*/_interopNamespaceDefault(anchor);
|
|
26
41
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React$2);
|
|
27
42
|
|
|
@@ -9468,11 +9483,11 @@ function requireSrc () {
|
|
|
9468
9483
|
}
|
|
9469
9484
|
|
|
9470
9485
|
var bs58$1;
|
|
9471
|
-
var hasRequiredBs58;
|
|
9486
|
+
var hasRequiredBs58$1;
|
|
9472
9487
|
|
|
9473
|
-
function requireBs58 () {
|
|
9474
|
-
if (hasRequiredBs58) return bs58$1;
|
|
9475
|
-
hasRequiredBs58 = 1;
|
|
9488
|
+
function requireBs58$1 () {
|
|
9489
|
+
if (hasRequiredBs58$1) return bs58$1;
|
|
9490
|
+
hasRequiredBs58$1 = 1;
|
|
9476
9491
|
var basex = requireSrc();
|
|
9477
9492
|
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
9478
9493
|
|
|
@@ -9480,8 +9495,8 @@ function requireBs58 () {
|
|
|
9480
9495
|
return bs58$1;
|
|
9481
9496
|
}
|
|
9482
9497
|
|
|
9483
|
-
var bs58Exports = requireBs58();
|
|
9484
|
-
var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
|
|
9498
|
+
var bs58Exports$1 = requireBs58$1();
|
|
9499
|
+
var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports$1);
|
|
9485
9500
|
|
|
9486
9501
|
// ─────────────────────────────────────────────────────────────
|
|
9487
9502
|
// Local implementation of getSimulationComputeUnits
|
|
@@ -10127,40 +10142,17 @@ async function getConfig() {
|
|
|
10127
10142
|
return clientConfig;
|
|
10128
10143
|
}
|
|
10129
10144
|
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
10141
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
10142
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
10143
|
-
***************************************************************************** */
|
|
10144
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
function __rest(s, e) {
|
|
10148
|
-
var t = {};
|
|
10149
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
10150
|
-
t[p] = s[p];
|
|
10151
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10152
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
10153
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10154
|
-
t[p[i]] = s[p[i]];
|
|
10155
|
-
}
|
|
10156
|
-
return t;
|
|
10157
|
-
}
|
|
10158
|
-
|
|
10159
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
10160
|
-
var e = new Error(message);
|
|
10161
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
10145
|
+
var __rest = function (s, e) {
|
|
10146
|
+
var t = {};
|
|
10147
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
10148
|
+
t[p] = s[p];
|
|
10149
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10150
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
10151
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10152
|
+
t[p[i]] = s[p[i]];
|
|
10153
|
+
}
|
|
10154
|
+
return t;
|
|
10162
10155
|
};
|
|
10163
|
-
|
|
10164
10156
|
/**
|
|
10165
10157
|
* Thrown when a user's wallet doesn't have enough SOL to cover the transaction.
|
|
10166
10158
|
* Apps can catch this to trigger an onramp/funding flow.
|
|
@@ -12981,7 +12973,7 @@ async function getAuthProvider(config) {
|
|
|
12981
12973
|
}
|
|
12982
12974
|
return currentAuthProvider;
|
|
12983
12975
|
}
|
|
12984
|
-
async function login$1() {
|
|
12976
|
+
async function login$1(options) {
|
|
12985
12977
|
// Re-initialize provider if it was cleared by logout
|
|
12986
12978
|
if (!currentAuthProvider && initConfig) {
|
|
12987
12979
|
currentAuthProvider = await getAuthProvider(initConfig);
|
|
@@ -12994,6 +12986,14 @@ async function login$1() {
|
|
|
12994
12986
|
if (!currentAuthProvider) {
|
|
12995
12987
|
throw new Error("Auth provider not initialized. Please call init() first.");
|
|
12996
12988
|
}
|
|
12989
|
+
// Forward per-call overrides to providers that support them (duck-typed to stay
|
|
12990
|
+
// lazy-load safe — no direct import of PhantomWalletProvider here).
|
|
12991
|
+
// Always call (even with null) so previous overrides are cleared when this
|
|
12992
|
+
// login() is invoked without options — early-return paths inside the provider
|
|
12993
|
+
// bypass the .finally() cleanup, so we reset here too.
|
|
12994
|
+
if (typeof currentAuthProvider.setLoginOverrides === 'function') {
|
|
12995
|
+
currentAuthProvider.setLoginOverrides(options !== null && options !== void 0 ? options : null);
|
|
12996
|
+
}
|
|
12997
12997
|
const loginResult = await currentAuthProvider.login();
|
|
12998
12998
|
if (loginResult) {
|
|
12999
12999
|
// Store which auth method was used so we restore the right provider on reload
|
|
@@ -13076,11 +13076,11 @@ function setAuthLoading(loading) {
|
|
|
13076
13076
|
function getAuthLoading() {
|
|
13077
13077
|
return isAuthLoading;
|
|
13078
13078
|
}
|
|
13079
|
-
async function login() {
|
|
13079
|
+
async function login(options) {
|
|
13080
13080
|
if (!authProviderInstance) {
|
|
13081
13081
|
throw new Error('SDK not initialized. Please call init() first.');
|
|
13082
13082
|
}
|
|
13083
|
-
const loggedInUser = await login$1();
|
|
13083
|
+
const loggedInUser = await login$1(options);
|
|
13084
13084
|
setCurrentUser(loggedInUser);
|
|
13085
13085
|
return currentUser;
|
|
13086
13086
|
}
|
|
@@ -15669,7 +15669,7 @@ async function loadDependencies() {
|
|
|
15669
15669
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
15670
15670
|
import('react'),
|
|
15671
15671
|
import('react-dom/client'),
|
|
15672
|
-
Promise.resolve().then(function () { return require('./index-
|
|
15672
|
+
Promise.resolve().then(function () { return require('./index-DXPkkq81.js'); })
|
|
15673
15673
|
]);
|
|
15674
15674
|
// Extract default export from ESM module namespace
|
|
15675
15675
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -15681,6 +15681,10 @@ async function loadDependencies() {
|
|
|
15681
15681
|
return loadingPromise;
|
|
15682
15682
|
}
|
|
15683
15683
|
class PhantomWalletProvider {
|
|
15684
|
+
/** Temporarily override modal appearance for a single login() call. Cleared automatically after login settles. */
|
|
15685
|
+
setLoginOverrides(opts) {
|
|
15686
|
+
this.loginOverrides = opts;
|
|
15687
|
+
}
|
|
15684
15688
|
constructor(networkUrl = null, config = {}) {
|
|
15685
15689
|
this.containerElement = null;
|
|
15686
15690
|
this.root = null;
|
|
@@ -15690,6 +15694,7 @@ class PhantomWalletProvider {
|
|
|
15690
15694
|
this.loginInProgress = false;
|
|
15691
15695
|
this.autoLoginInProgress = false;
|
|
15692
15696
|
this.initPromise = null;
|
|
15697
|
+
this.loginOverrides = null;
|
|
15693
15698
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
15694
15699
|
this.onSwitchToPrivy = null;
|
|
15695
15700
|
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
@@ -15712,13 +15717,8 @@ class PhantomWalletProvider {
|
|
|
15712
15717
|
async initializeAsync() {
|
|
15713
15718
|
// Lazy load dependencies only when actually instantiating
|
|
15714
15719
|
await loadDependencies();
|
|
15715
|
-
// Initialize React component
|
|
15716
|
-
|
|
15717
|
-
// or non-Android). Otherwise defer until ensureReady() is reached from
|
|
15718
|
-
// a user-gesture flow. See shouldMountEagerly() for the rationale.
|
|
15719
|
-
if (this.shouldMountEagerly()) {
|
|
15720
|
-
this.initialize();
|
|
15721
|
-
}
|
|
15720
|
+
// Initialize React component
|
|
15721
|
+
this.initialize();
|
|
15722
15722
|
}
|
|
15723
15723
|
/**
|
|
15724
15724
|
* Check if social login providers are configured (non-injected providers).
|
|
@@ -15726,69 +15726,6 @@ class PhantomWalletProvider {
|
|
|
15726
15726
|
hasSocialProviders() {
|
|
15727
15727
|
return this.resolvedProviders.some(p => p !== 'injected');
|
|
15728
15728
|
}
|
|
15729
|
-
/**
|
|
15730
|
-
* Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
|
|
15731
|
-
* eagerly during init() or defer until the first user-triggered call
|
|
15732
|
-
* (login / sign / etc.) reaches ensureReady().
|
|
15733
|
-
*
|
|
15734
|
-
* Mounting the React tree synchronously constructs BrowserSDK, which runs
|
|
15735
|
-
* wallet-standard discovery in its constructor and fires sdk.autoConnect()
|
|
15736
|
-
* in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
|
|
15737
|
-
* pathways probe the Android intent surface to discover the Phantom mobile
|
|
15738
|
-
* app, which surfaces Chrome's system "wants to access other apps and
|
|
15739
|
-
* services" permission dialog *before* the PWA activity has window focus.
|
|
15740
|
-
* The dialog renders with grayed-out buttons until the user backgrounds
|
|
15741
|
-
* and resumes the app.
|
|
15742
|
-
*
|
|
15743
|
-
* Returns true when eager mount is needed (callback to handle, prior
|
|
15744
|
-
* session, in-page wallet present, or non-Android). Otherwise returns
|
|
15745
|
-
* false — the React tree is mounted lazily inside ensureReady() once a
|
|
15746
|
-
* user gesture brings us there.
|
|
15747
|
-
*/
|
|
15748
|
-
shouldMountEagerly() {
|
|
15749
|
-
if (typeof window === 'undefined')
|
|
15750
|
-
return false;
|
|
15751
|
-
// Preserve desktop behavior: always mount eagerly.
|
|
15752
|
-
if (!detectAndroid())
|
|
15753
|
-
return true;
|
|
15754
|
-
// In-page wallet present (Phantom in-app browser / desktop extension on
|
|
15755
|
-
// a desktop-mode Android UA): no Android intent probe needed, mount free.
|
|
15756
|
-
// Tighten beyond truthy `window.phantom` since arbitrary stubs can land
|
|
15757
|
-
// on that key — require a wallet-shaped surface.
|
|
15758
|
-
const ph = window.phantom;
|
|
15759
|
-
if (ph && (ph.solana || ph.ethereum || ph.app))
|
|
15760
|
-
return true;
|
|
15761
|
-
// Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
|
|
15762
|
-
// be live to read these URL params via urlParamsAccessor.
|
|
15763
|
-
const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
|
|
15764
|
-
try {
|
|
15765
|
-
const params = new URLSearchParams(window.location.search);
|
|
15766
|
-
if (callbackKeys.some(k => params.has(k)))
|
|
15767
|
-
return true;
|
|
15768
|
-
}
|
|
15769
|
-
catch (_a) {
|
|
15770
|
-
return true; // conservative on URL access failure
|
|
15771
|
-
}
|
|
15772
|
-
// Returning user with a stored Phantom session. They've already
|
|
15773
|
-
// approved the Android intent permission for this origin on first
|
|
15774
|
-
// login, so the dialog is typically pre-granted by Chrome — eager
|
|
15775
|
-
// mount lets autoConnect silently restore the wallet handshake.
|
|
15776
|
-
// Require BOTH the marker AND a session storage entry so a stale
|
|
15777
|
-
// orphaned marker doesn't keep eager-mounting forever. Note
|
|
15778
|
-
// isAuthenticated() is a raw key-existence check, not a validity
|
|
15779
|
-
// check — restoreSession() above clears the marker on the next load
|
|
15780
|
-
// if the session is unusable, so the bug self-corrects after at
|
|
15781
|
-
// most one further cold start.
|
|
15782
|
-
try {
|
|
15783
|
-
const stored = getPlatform().storage.getItem('tarobase_last_auth_method');
|
|
15784
|
-
if (stored === 'phantom' && WebSessionManager.isAuthenticated())
|
|
15785
|
-
return true;
|
|
15786
|
-
}
|
|
15787
|
-
catch (_b) {
|
|
15788
|
-
return true;
|
|
15789
|
-
}
|
|
15790
|
-
return false;
|
|
15791
|
-
}
|
|
15792
15729
|
static getInstance(networkUrl, config) {
|
|
15793
15730
|
if (!PhantomWalletProvider.instance) {
|
|
15794
15731
|
new PhantomWalletProvider(networkUrl, config);
|
|
@@ -15864,7 +15801,7 @@ class PhantomWalletProvider {
|
|
|
15864
15801
|
const sdkProviders = this.resolvedProviders.length > 0 ? [...this.resolvedProviders] : ['injected'];
|
|
15865
15802
|
// Inner component that uses hooks
|
|
15866
15803
|
const PhantomHooksComponent = () => {
|
|
15867
|
-
var _a, _b;
|
|
15804
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
15868
15805
|
const phantom = usePhantom();
|
|
15869
15806
|
const { connect, error: connectError } = useConnect();
|
|
15870
15807
|
const { disconnect, isDisconnecting } = useDisconnect();
|
|
@@ -16147,63 +16084,13 @@ class PhantomWalletProvider {
|
|
|
16147
16084
|
}
|
|
16148
16085
|
};
|
|
16149
16086
|
const handleMobileWalletClick = async () => {
|
|
16150
|
-
var _a;
|
|
16151
|
-
console.log('[MWA-DEBUG] handleMobileWalletClick: entered', {
|
|
16152
|
-
documentHasFocus: typeof document !== 'undefined' ? document.hasFocus() : 'n/a',
|
|
16153
|
-
visibilityState: typeof document !== 'undefined' ? document.visibilityState : 'n/a',
|
|
16154
|
-
displayMode: typeof window !== 'undefined' && window.matchMedia
|
|
16155
|
-
? (window.matchMedia('(display-mode: standalone)').matches ? 'standalone' : 'browser')
|
|
16156
|
-
: 'n/a',
|
|
16157
|
-
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : 'n/a',
|
|
16158
|
-
timestamp: Date.now(),
|
|
16159
|
-
});
|
|
16160
16087
|
that.loginInProgress = false;
|
|
16161
16088
|
walletClickedRef.current = true;
|
|
16162
16089
|
setShowWalletModal(false);
|
|
16163
|
-
// Hide the Phantom provider container while MWA's transact()
|
|
16164
|
-
// is opening the localhost WebSocket and Chrome surfaces the
|
|
16165
|
-
// "Apps on Device" / Local Network Access permission dialog.
|
|
16166
|
-
//
|
|
16167
|
-
// The container is a singleton fixed full-viewport <div> with
|
|
16168
|
-
// z-index 2147483647 + pointer-events: none parked on body.
|
|
16169
|
-
// Even though pointer-events: none should let touches pass
|
|
16170
|
-
// through, on Android Chrome (both PWA and regular browser)
|
|
16171
|
-
// the system permission dialog rendered during MWA's
|
|
16172
|
-
// handshake comes up with disabled-looking buttons until the
|
|
16173
|
-
// activity is forced to re-composite (the user's
|
|
16174
|
-
// background+reopen workaround).
|
|
16175
|
-
//
|
|
16176
|
-
// Display:none-ing the container during MWA login removes it
|
|
16177
|
-
// from the layout tree entirely so there's nothing for the
|
|
16178
|
-
// dialog hit-testing / compositor to get confused by. It's
|
|
16179
|
-
// restored after MWA login resolves or rejects.
|
|
16180
|
-
const containerEl = that.containerElement;
|
|
16181
|
-
const previousDisplay = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.display) !== null && _a !== void 0 ? _a : '';
|
|
16182
|
-
console.log('[MWA-DEBUG] container before hide', {
|
|
16183
|
-
hasContainer: !!containerEl,
|
|
16184
|
-
previousDisplay,
|
|
16185
|
-
inDom: containerEl ? document.body.contains(containerEl) : false,
|
|
16186
|
-
zIndex: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.zIndex,
|
|
16187
|
-
pointerEvents: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.pointerEvents,
|
|
16188
|
-
});
|
|
16189
|
-
if (containerEl) {
|
|
16190
|
-
containerEl.style.display = 'none';
|
|
16191
|
-
}
|
|
16192
|
-
console.log('[MWA-DEBUG] container hidden, computed display now:', containerEl ? getComputedStyle(containerEl).display : 'n/a');
|
|
16193
|
-
const restoreContainer = () => {
|
|
16194
|
-
if (containerEl) {
|
|
16195
|
-
containerEl.style.display = previousDisplay;
|
|
16196
|
-
console.log('[MWA-DEBUG] container restored, display:', containerEl.style.display);
|
|
16197
|
-
}
|
|
16198
|
-
};
|
|
16199
16090
|
if (that.onSwitchToMWA) {
|
|
16200
16091
|
try {
|
|
16201
|
-
console.log('[MWA-DEBUG] calling onSwitchToMWA');
|
|
16202
16092
|
const mwaProvider = await that.onSwitchToMWA();
|
|
16203
|
-
console.log('[MWA-DEBUG] onSwitchToMWA resolved, calling mwaProvider.login()');
|
|
16204
16093
|
const user = await mwaProvider.login();
|
|
16205
|
-
console.log('[MWA-DEBUG] mwaProvider.login() resolved', { hasUser: !!user });
|
|
16206
|
-
restoreContainer();
|
|
16207
16094
|
if (that.pendingLogin && user) {
|
|
16208
16095
|
that.pendingLogin.resolve(user);
|
|
16209
16096
|
that.pendingLogin = null;
|
|
@@ -16214,22 +16101,12 @@ class PhantomWalletProvider {
|
|
|
16214
16101
|
}
|
|
16215
16102
|
}
|
|
16216
16103
|
catch (error) {
|
|
16217
|
-
console.log('[MWA-DEBUG] mwaProvider.login() threw', {
|
|
16218
|
-
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
16219
|
-
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
16220
|
-
errorCode: error === null || error === void 0 ? void 0 : error.code,
|
|
16221
|
-
});
|
|
16222
|
-
restoreContainer();
|
|
16223
16104
|
if (that.pendingLogin) {
|
|
16224
16105
|
that.pendingLogin.reject(error);
|
|
16225
16106
|
that.pendingLogin = null;
|
|
16226
16107
|
}
|
|
16227
16108
|
}
|
|
16228
16109
|
}
|
|
16229
|
-
else {
|
|
16230
|
-
console.log('[MWA-DEBUG] no onSwitchToMWA configured');
|
|
16231
|
-
restoreContainer();
|
|
16232
|
-
}
|
|
16233
16110
|
};
|
|
16234
16111
|
const handleCloseModal = () => {
|
|
16235
16112
|
setShowWalletModal(false);
|
|
@@ -16243,31 +16120,59 @@ class PhantomWalletProvider {
|
|
|
16243
16120
|
if (!showWalletModal) {
|
|
16244
16121
|
return null;
|
|
16245
16122
|
}
|
|
16246
|
-
const
|
|
16247
|
-
const
|
|
16248
|
-
const
|
|
16249
|
-
const
|
|
16250
|
-
const
|
|
16123
|
+
const effectiveTheme = (_c = (_b = (_a = that.loginOverrides) === null || _a === void 0 ? void 0 : _a.theme) !== null && _b !== void 0 ? _b : that.config.theme) !== null && _c !== void 0 ? _c : 'dark';
|
|
16124
|
+
const isLight = effectiveTheme === 'light';
|
|
16125
|
+
const bgColor = isLight ? '#FFFFFF' : '#111113';
|
|
16126
|
+
const cardBorder = isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.07)';
|
|
16127
|
+
const textColor = isLight ? '#0f0f0f' : '#f5f5f5';
|
|
16128
|
+
const subTextColor = isLight ? 'rgba(0,0,0,0.45)' : 'rgba(255,255,255,0.4)';
|
|
16129
|
+
const btnBg = isLight ? 'rgba(0,0,0,0.04)' : 'rgba(255,255,255,0.05)';
|
|
16130
|
+
const btnHoverBg = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.09)';
|
|
16131
|
+
const btnBorder = isLight ? '1px solid rgba(0,0,0,0.10)' : '1px solid rgba(255,255,255,0.09)';
|
|
16132
|
+
const dividerColor = isLight ? 'rgba(0,0,0,0.10)' : 'rgba(255,255,255,0.08)';
|
|
16251
16133
|
const fontFamily = '"SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif';
|
|
16252
16134
|
const buttonStyle = (id) => ({
|
|
16253
16135
|
display: 'flex',
|
|
16254
16136
|
alignItems: 'center',
|
|
16255
16137
|
justifyContent: 'center',
|
|
16256
|
-
gap: '
|
|
16138
|
+
gap: '10px',
|
|
16257
16139
|
width: '100%',
|
|
16258
|
-
height: '
|
|
16259
|
-
padding: '
|
|
16260
|
-
border:
|
|
16261
|
-
borderRadius: '
|
|
16140
|
+
height: '52px',
|
|
16141
|
+
padding: '0 20px',
|
|
16142
|
+
border: btnBorder,
|
|
16143
|
+
borderRadius: '12px',
|
|
16262
16144
|
backgroundColor: hoveredBtn === id ? btnHoverBg : btnBg,
|
|
16263
16145
|
color: textColor,
|
|
16264
16146
|
fontFamily,
|
|
16265
16147
|
fontSize: '14px',
|
|
16266
|
-
fontWeight: '
|
|
16267
|
-
lineHeight: '
|
|
16268
|
-
letterSpacing: '
|
|
16148
|
+
fontWeight: '500',
|
|
16149
|
+
lineHeight: '1',
|
|
16150
|
+
letterSpacing: '0',
|
|
16269
16151
|
cursor: 'pointer',
|
|
16270
|
-
transition: 'background-color 0.
|
|
16152
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
16153
|
+
boxSizing: 'border-box',
|
|
16154
|
+
});
|
|
16155
|
+
const emailButtonStyle = (id) => ({
|
|
16156
|
+
display: 'flex',
|
|
16157
|
+
alignItems: 'center',
|
|
16158
|
+
justifyContent: 'center',
|
|
16159
|
+
gap: '10px',
|
|
16160
|
+
width: '100%',
|
|
16161
|
+
height: '52px',
|
|
16162
|
+
padding: '0 20px',
|
|
16163
|
+
border: isLight ? '1px solid rgba(0,0,0,0.15)' : '1px solid rgba(255,255,255,0.15)',
|
|
16164
|
+
borderRadius: '12px',
|
|
16165
|
+
backgroundColor: hoveredBtn === id
|
|
16166
|
+
? (isLight ? 'rgba(0,0,0,0.06)' : 'rgba(255,255,255,0.12)')
|
|
16167
|
+
: (isLight ? 'rgba(0,0,0,0.03)' : 'rgba(255,255,255,0.08)'),
|
|
16168
|
+
color: textColor,
|
|
16169
|
+
fontFamily,
|
|
16170
|
+
fontSize: '14px',
|
|
16171
|
+
fontWeight: '500',
|
|
16172
|
+
lineHeight: '1',
|
|
16173
|
+
cursor: 'pointer',
|
|
16174
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
16175
|
+
boxSizing: 'border-box',
|
|
16271
16176
|
});
|
|
16272
16177
|
const walletButtons = [];
|
|
16273
16178
|
// Google OAuth button — shown when 'google' is in resolved providers
|
|
@@ -16279,7 +16184,7 @@ class PhantomWalletProvider {
|
|
|
16279
16184
|
onMouseEnter: () => setHoveredBtn('google-oauth'),
|
|
16280
16185
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16281
16186
|
}, React$1.createElement('svg', {
|
|
16282
|
-
width: '
|
|
16187
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
16283
16188
|
style: { flexShrink: '0' },
|
|
16284
16189
|
}, React$1.createElement('path', {
|
|
16285
16190
|
d: 'M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z',
|
|
@@ -16304,7 +16209,7 @@ class PhantomWalletProvider {
|
|
|
16304
16209
|
onMouseEnter: () => setHoveredBtn('apple-oauth'),
|
|
16305
16210
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16306
16211
|
}, React$1.createElement('svg', {
|
|
16307
|
-
width: '
|
|
16212
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
16308
16213
|
fill: textColor,
|
|
16309
16214
|
style: { flexShrink: '0' },
|
|
16310
16215
|
}, React$1.createElement('path', {
|
|
@@ -16356,11 +16261,9 @@ class PhantomWalletProvider {
|
|
|
16356
16261
|
onClick: handleMobileWalletClick,
|
|
16357
16262
|
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
16358
16263
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16359
|
-
},
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
16363
|
-
style: { flexShrink: '0' },
|
|
16264
|
+
}, React$1.createElement('svg', {
|
|
16265
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
16266
|
+
style: { flexShrink: '0', opacity: '0.85' },
|
|
16364
16267
|
},
|
|
16365
16268
|
// Phone outline
|
|
16366
16269
|
React$1.createElement('rect', {
|
|
@@ -16382,23 +16285,51 @@ class PhantomWalletProvider {
|
|
|
16382
16285
|
if (that.config.enablePrivyFallback) {
|
|
16383
16286
|
walletButtons.push(React$1.createElement('button', {
|
|
16384
16287
|
key: 'email-login',
|
|
16385
|
-
style:
|
|
16288
|
+
style: emailButtonStyle('email-login'),
|
|
16386
16289
|
onClick: handleEmailClick,
|
|
16387
16290
|
onMouseEnter: () => setHoveredBtn('email-login'),
|
|
16388
16291
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16389
|
-
},
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
16393
|
-
style: { flexShrink: '0' },
|
|
16292
|
+
}, React$1.createElement('svg', {
|
|
16293
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
16294
|
+
style: { flexShrink: '0', opacity: '0.7' },
|
|
16394
16295
|
}, React$1.createElement('path', {
|
|
16395
16296
|
d: 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z',
|
|
16396
|
-
stroke: textColor, strokeWidth: '
|
|
16297
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
16397
16298
|
}), React$1.createElement('path', {
|
|
16398
16299
|
d: 'M22 6l-10 7L2 6',
|
|
16399
|
-
stroke: textColor, strokeWidth: '
|
|
16400
|
-
})), '
|
|
16300
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
16301
|
+
})), 'Continue with email'));
|
|
16401
16302
|
}
|
|
16303
|
+
// Split email button from the rest to insert OR divider
|
|
16304
|
+
const emailBtnIndex = walletButtons.findIndex((b) => b && b.key === 'email-login');
|
|
16305
|
+
const mainButtons = emailBtnIndex >= 0 ? walletButtons.slice(0, emailBtnIndex) : walletButtons;
|
|
16306
|
+
const emailButton = emailBtnIndex >= 0 ? walletButtons[emailBtnIndex] : null;
|
|
16307
|
+
// OR divider — shown when there are both wallet/social buttons and an email button
|
|
16308
|
+
const orDivider = (mainButtons.length > 0 && emailButton)
|
|
16309
|
+
? React$1.createElement('div', {
|
|
16310
|
+
key: 'or-divider',
|
|
16311
|
+
style: {
|
|
16312
|
+
display: 'flex',
|
|
16313
|
+
alignItems: 'center',
|
|
16314
|
+
gap: '12px',
|
|
16315
|
+
margin: '4px 0',
|
|
16316
|
+
},
|
|
16317
|
+
}, React$1.createElement('div', {
|
|
16318
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
16319
|
+
}), React$1.createElement('span', {
|
|
16320
|
+
style: {
|
|
16321
|
+
color: subTextColor,
|
|
16322
|
+
fontFamily,
|
|
16323
|
+
fontSize: '12px',
|
|
16324
|
+
fontWeight: '500',
|
|
16325
|
+
letterSpacing: '0.02em',
|
|
16326
|
+
textTransform: 'uppercase',
|
|
16327
|
+
userSelect: 'none',
|
|
16328
|
+
},
|
|
16329
|
+
}, 'or'), React$1.createElement('div', {
|
|
16330
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
16331
|
+
}))
|
|
16332
|
+
: null;
|
|
16402
16333
|
// Render custom modal
|
|
16403
16334
|
return React$1.createElement('div', {
|
|
16404
16335
|
// Overlay
|
|
@@ -16408,12 +16339,14 @@ class PhantomWalletProvider {
|
|
|
16408
16339
|
left: '0',
|
|
16409
16340
|
right: '0',
|
|
16410
16341
|
bottom: '0',
|
|
16411
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
16342
|
+
backgroundColor: isLight ? 'rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.65)',
|
|
16412
16343
|
display: 'flex',
|
|
16413
16344
|
alignItems: 'center',
|
|
16414
16345
|
justifyContent: 'center',
|
|
16415
16346
|
zIndex: 2147483647,
|
|
16416
16347
|
pointerEvents: 'auto',
|
|
16348
|
+
backdropFilter: 'blur(4px)',
|
|
16349
|
+
WebkitBackdropFilter: 'blur(4px)',
|
|
16417
16350
|
},
|
|
16418
16351
|
onClick: (e) => {
|
|
16419
16352
|
if (e.target === e.currentTarget)
|
|
@@ -16430,13 +16363,17 @@ class PhantomWalletProvider {
|
|
|
16430
16363
|
React$1.createElement('div', {
|
|
16431
16364
|
style: {
|
|
16432
16365
|
backgroundColor: bgColor,
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16366
|
+
border: cardBorder,
|
|
16367
|
+
borderRadius: '20px',
|
|
16368
|
+
width: '380px',
|
|
16369
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
16370
|
+
padding: '28px 24px 24px',
|
|
16437
16371
|
position: 'relative',
|
|
16438
|
-
boxShadow:
|
|
16372
|
+
boxShadow: isLight
|
|
16373
|
+
? '0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)'
|
|
16374
|
+
: '0 8px 40px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3)',
|
|
16439
16375
|
pointerEvents: 'auto',
|
|
16376
|
+
boxSizing: 'border-box',
|
|
16440
16377
|
},
|
|
16441
16378
|
onMouseDown: (e) => {
|
|
16442
16379
|
e.stopPropagation();
|
|
@@ -16445,26 +16382,30 @@ class PhantomWalletProvider {
|
|
|
16445
16382
|
e.stopPropagation();
|
|
16446
16383
|
},
|
|
16447
16384
|
},
|
|
16448
|
-
// Close button
|
|
16385
|
+
// Close button
|
|
16449
16386
|
React$1.createElement('button', {
|
|
16450
16387
|
onClick: handleCloseModal,
|
|
16451
16388
|
style: {
|
|
16452
16389
|
position: 'absolute',
|
|
16453
|
-
top: '
|
|
16454
|
-
right: '
|
|
16455
|
-
background: '
|
|
16456
|
-
border: '
|
|
16390
|
+
top: '14px',
|
|
16391
|
+
right: '14px',
|
|
16392
|
+
background: isLight ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.07)',
|
|
16393
|
+
border: isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.08)',
|
|
16394
|
+
borderRadius: '50%',
|
|
16395
|
+
width: '28px',
|
|
16396
|
+
height: '28px',
|
|
16457
16397
|
cursor: 'pointer',
|
|
16458
|
-
padding: '4px',
|
|
16459
16398
|
display: 'flex',
|
|
16460
16399
|
alignItems: 'center',
|
|
16461
16400
|
justifyContent: 'center',
|
|
16401
|
+
padding: '0',
|
|
16402
|
+
flexShrink: '0',
|
|
16462
16403
|
},
|
|
16463
16404
|
}, React$1.createElement('svg', {
|
|
16464
|
-
width: '
|
|
16405
|
+
width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none',
|
|
16465
16406
|
}, React$1.createElement('path', {
|
|
16466
|
-
d: '
|
|
16467
|
-
stroke:
|
|
16407
|
+
d: 'M11 1L1 11M1 1l10 10',
|
|
16408
|
+
stroke: subTextColor, strokeWidth: '1.75', strokeLinecap: 'round',
|
|
16468
16409
|
}))),
|
|
16469
16410
|
// App icon (if provided)
|
|
16470
16411
|
that.config.appIcon ? React$1.createElement('div', {
|
|
@@ -16472,27 +16413,40 @@ class PhantomWalletProvider {
|
|
|
16472
16413
|
}, React$1.createElement('img', {
|
|
16473
16414
|
src: that.config.appIcon,
|
|
16474
16415
|
alt: that.config.appName || 'App',
|
|
16475
|
-
style: { width: '
|
|
16416
|
+
style: { width: '44px', height: '44px', borderRadius: '10px' },
|
|
16476
16417
|
})) : null,
|
|
16477
16418
|
// Title
|
|
16478
16419
|
React$1.createElement('div', {
|
|
16479
16420
|
style: {
|
|
16480
16421
|
color: textColor,
|
|
16481
16422
|
fontFamily,
|
|
16482
|
-
fontSize: '
|
|
16423
|
+
fontSize: '17px',
|
|
16483
16424
|
fontWeight: '600',
|
|
16484
16425
|
textAlign: 'center',
|
|
16426
|
+
marginBottom: '6px',
|
|
16427
|
+
letterSpacing: '-0.2px',
|
|
16428
|
+
},
|
|
16429
|
+
}, (_f = (_e = (_d = that.loginOverrides) === null || _d === void 0 ? void 0 : _d.modalTitle) !== null && _e !== void 0 ? _e : that.config.modalTitle) !== null && _f !== void 0 ? _f : (that.config.appName ? `Log in to ${that.config.appName}` : 'Log in to your account')),
|
|
16430
|
+
// Subtitle
|
|
16431
|
+
React$1.createElement('div', {
|
|
16432
|
+
style: {
|
|
16433
|
+
color: subTextColor,
|
|
16434
|
+
fontFamily,
|
|
16435
|
+
fontSize: '13px',
|
|
16436
|
+
fontWeight: '400',
|
|
16437
|
+
textAlign: 'center',
|
|
16485
16438
|
marginBottom: '24px',
|
|
16439
|
+
lineHeight: '1.4',
|
|
16486
16440
|
},
|
|
16487
|
-
}, '
|
|
16488
|
-
//
|
|
16441
|
+
}, (_j = (_h = (_g = that.loginOverrides) === null || _g === void 0 ? void 0 : _g.modalSubtitle) !== null && _h !== void 0 ? _h : that.config.modalSubtitle) !== null && _j !== void 0 ? _j : 'Choose how you\'d like to continue'),
|
|
16442
|
+
// Main buttons + OR divider + email button
|
|
16489
16443
|
React$1.createElement('div', {
|
|
16490
16444
|
style: {
|
|
16491
16445
|
display: 'flex',
|
|
16492
16446
|
flexDirection: 'column',
|
|
16493
16447
|
gap: '8px',
|
|
16494
16448
|
},
|
|
16495
|
-
}, ...
|
|
16449
|
+
}, ...mainButtons, orDivider, emailButton)));
|
|
16496
16450
|
};
|
|
16497
16451
|
// Wrapper component with PhantomProvider
|
|
16498
16452
|
const PhantomProviderWrapper = () => {
|
|
@@ -16525,13 +16479,6 @@ class PhantomWalletProvider {
|
|
|
16525
16479
|
if (this.initPromise) {
|
|
16526
16480
|
await this.initPromise;
|
|
16527
16481
|
}
|
|
16528
|
-
// Lazy-mount path: if initializeAsync deferred the React mount (e.g.
|
|
16529
|
-
// first-time visitor on Android Chrome PWA), do it now. We're being
|
|
16530
|
-
// called from a user-gesture flow like login(), so any Android intent
|
|
16531
|
-
// dialog that surfaces will appear with the activity already focused.
|
|
16532
|
-
if (!this.containerElement) {
|
|
16533
|
-
this.initialize();
|
|
16534
|
-
}
|
|
16535
16482
|
// Wait for SDK to be ready
|
|
16536
16483
|
await new Promise((resolve) => {
|
|
16537
16484
|
const check = () => {
|
|
@@ -16625,7 +16572,7 @@ class PhantomWalletProvider {
|
|
|
16625
16572
|
this.pendingLogin.reject = reject;
|
|
16626
16573
|
});
|
|
16627
16574
|
}
|
|
16628
|
-
|
|
16575
|
+
const loginPromise = new Promise((resolve, reject) => {
|
|
16629
16576
|
this.pendingLogin = { resolve, reject };
|
|
16630
16577
|
this.loginInProgress = true;
|
|
16631
16578
|
// Always use our custom wallet modal
|
|
@@ -16639,55 +16586,17 @@ class PhantomWalletProvider {
|
|
|
16639
16586
|
}
|
|
16640
16587
|
}, 180000);
|
|
16641
16588
|
});
|
|
16589
|
+
return loginPromise.finally(() => {
|
|
16590
|
+
this.loginOverrides = null;
|
|
16591
|
+
});
|
|
16642
16592
|
}
|
|
16643
16593
|
async restoreSession() {
|
|
16644
|
-
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
|
|
16648
|
-
// before the PWA activity has window focus on Solana Seeker. The
|
|
16649
|
-
// resulting "access other apps and services" system dialog renders
|
|
16650
|
-
// with grayed-out buttons.
|
|
16651
|
-
//
|
|
16652
|
-
// Wrap getSession() in try/catch: WebSessionManager.getSession() runs
|
|
16653
|
-
// JSON.parse on the stored session *outside* its internal try/catch,
|
|
16654
|
-
// so genuinely malformed JSON in localStorage would propagate through
|
|
16655
|
-
// restoreSession() and break init() entirely. Treat any throw as
|
|
16656
|
-
// "no session" and fall through to the cleanup path so corrupted
|
|
16657
|
-
// storage is recoverable on next load.
|
|
16658
|
-
let session;
|
|
16659
|
-
try {
|
|
16660
|
-
session = await WebSessionManager.getSession();
|
|
16661
|
-
}
|
|
16662
|
-
catch (_a) {
|
|
16663
|
-
session = null;
|
|
16664
|
-
}
|
|
16665
|
-
if (!session) {
|
|
16666
|
-
// Tidy up storage so we don't leave junk behind:
|
|
16667
|
-
// (a) clearSession() removes any stale or unparseable session
|
|
16668
|
-
// storage entry. WebSessionManager.getSession() can't reach
|
|
16669
|
-
// its own clearSession() if JSON.parse threw. Idempotent —
|
|
16670
|
-
// safe to call unconditionally here.
|
|
16671
|
-
// (b) Drop the auth-method marker if it's stale.
|
|
16672
|
-
// WebSessionManager.clearSession() only removes the session
|
|
16673
|
-
// storage key, not the marker — so without this cleanup
|
|
16674
|
-
// shouldMountEagerly() would keep eager-mounting on every
|
|
16675
|
-
// future cold start.
|
|
16676
|
-
try {
|
|
16677
|
-
WebSessionManager.clearSession();
|
|
16678
|
-
}
|
|
16679
|
-
catch ( /* best-effort */_b) { /* best-effort */ }
|
|
16680
|
-
try {
|
|
16681
|
-
if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
|
|
16682
|
-
getPlatform().storage.removeItem('tarobase_last_auth_method');
|
|
16683
|
-
}
|
|
16684
|
-
}
|
|
16685
|
-
catch (_c) {
|
|
16686
|
-
// storage unavailable — best-effort cleanup
|
|
16687
|
-
}
|
|
16688
|
-
return null;
|
|
16594
|
+
await this.ensureReady();
|
|
16595
|
+
const session = await WebSessionManager.getSession();
|
|
16596
|
+
if (session) {
|
|
16597
|
+
return { provider: this, address: session.address };
|
|
16689
16598
|
}
|
|
16690
|
-
return
|
|
16599
|
+
return null;
|
|
16691
16600
|
}
|
|
16692
16601
|
async address() {
|
|
16693
16602
|
var _a, _b, _c, _d;
|
|
@@ -20178,137 +20087,161 @@ function createSolanaRpcSubscriptionsFromTransport(transport) {
|
|
|
20178
20087
|
});
|
|
20179
20088
|
}
|
|
20180
20089
|
|
|
20181
|
-
|
|
20182
|
-
|
|
20183
|
-
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
|
|
20187
|
-
|
|
20188
|
-
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
|
|
20193
|
-
|
|
20194
|
-
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20212
|
-
|
|
20213
|
-
|
|
20214
|
-
|
|
20215
|
-
|
|
20216
|
-
|
|
20217
|
-
|
|
20218
|
-
|
|
20219
|
-
|
|
20220
|
-
|
|
20221
|
-
|
|
20222
|
-
|
|
20223
|
-
|
|
20224
|
-
|
|
20225
|
-
|
|
20226
|
-
|
|
20227
|
-
|
|
20228
|
-
|
|
20229
|
-
|
|
20230
|
-
|
|
20231
|
-
|
|
20232
|
-
|
|
20233
|
-
|
|
20234
|
-
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
20256
|
-
|
|
20257
|
-
|
|
20258
|
-
|
|
20259
|
-
|
|
20260
|
-
|
|
20261
|
-
|
|
20262
|
-
|
|
20263
|
-
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
20268
|
-
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20301
|
-
|
|
20302
|
-
|
|
20090
|
+
var cjs = {};
|
|
20091
|
+
|
|
20092
|
+
var hasRequiredCjs;
|
|
20093
|
+
|
|
20094
|
+
function requireCjs () {
|
|
20095
|
+
if (hasRequiredCjs) return cjs;
|
|
20096
|
+
hasRequiredCjs = 1;
|
|
20097
|
+
// base-x encoding / decoding
|
|
20098
|
+
// Copyright (c) 2018 base-x contributors
|
|
20099
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
20100
|
+
// Distributed under the MIT software license, see the accompanying
|
|
20101
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
20102
|
+
Object.defineProperty(cjs, '__esModule', { value: true });
|
|
20103
|
+
function base (ALPHABET) {
|
|
20104
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
20105
|
+
const BASE_MAP = new Uint8Array(256);
|
|
20106
|
+
for (let j = 0; j < BASE_MAP.length; j++) {
|
|
20107
|
+
BASE_MAP[j] = 255;
|
|
20108
|
+
}
|
|
20109
|
+
for (let i = 0; i < ALPHABET.length; i++) {
|
|
20110
|
+
const x = ALPHABET.charAt(i);
|
|
20111
|
+
const xc = x.charCodeAt(0);
|
|
20112
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
20113
|
+
BASE_MAP[xc] = i;
|
|
20114
|
+
}
|
|
20115
|
+
const BASE = ALPHABET.length;
|
|
20116
|
+
const LEADER = ALPHABET.charAt(0);
|
|
20117
|
+
const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
20118
|
+
const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
20119
|
+
function encode (source) {
|
|
20120
|
+
// eslint-disable-next-line no-empty
|
|
20121
|
+
if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
|
|
20122
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
20123
|
+
} else if (Array.isArray(source)) {
|
|
20124
|
+
source = Uint8Array.from(source);
|
|
20125
|
+
}
|
|
20126
|
+
if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
|
|
20127
|
+
if (source.length === 0) { return '' }
|
|
20128
|
+
// Skip & count leading zeroes.
|
|
20129
|
+
let zeroes = 0;
|
|
20130
|
+
let length = 0;
|
|
20131
|
+
let pbegin = 0;
|
|
20132
|
+
const pend = source.length;
|
|
20133
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
20134
|
+
pbegin++;
|
|
20135
|
+
zeroes++;
|
|
20136
|
+
}
|
|
20137
|
+
// Allocate enough space in big-endian base58 representation.
|
|
20138
|
+
const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
20139
|
+
const b58 = new Uint8Array(size);
|
|
20140
|
+
// Process the bytes.
|
|
20141
|
+
while (pbegin !== pend) {
|
|
20142
|
+
let carry = source[pbegin];
|
|
20143
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
20144
|
+
let i = 0;
|
|
20145
|
+
for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
20146
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
20147
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
20148
|
+
carry = (carry / BASE) >>> 0;
|
|
20149
|
+
}
|
|
20150
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20151
|
+
length = i;
|
|
20152
|
+
pbegin++;
|
|
20153
|
+
}
|
|
20154
|
+
// Skip leading zeroes in base58 result.
|
|
20155
|
+
let it2 = size - length;
|
|
20156
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
20157
|
+
it2++;
|
|
20158
|
+
}
|
|
20159
|
+
// Translate the result into a string.
|
|
20160
|
+
let str = LEADER.repeat(zeroes);
|
|
20161
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
20162
|
+
return str
|
|
20163
|
+
}
|
|
20164
|
+
function decodeUnsafe (source) {
|
|
20165
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
20166
|
+
if (source.length === 0) { return new Uint8Array() }
|
|
20167
|
+
let psz = 0;
|
|
20168
|
+
// Skip and count leading '1's.
|
|
20169
|
+
let zeroes = 0;
|
|
20170
|
+
let length = 0;
|
|
20171
|
+
while (source[psz] === LEADER) {
|
|
20172
|
+
zeroes++;
|
|
20173
|
+
psz++;
|
|
20174
|
+
}
|
|
20175
|
+
// Allocate enough space in big-endian base256 representation.
|
|
20176
|
+
const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
20177
|
+
const b256 = new Uint8Array(size);
|
|
20178
|
+
// Process the characters.
|
|
20179
|
+
while (psz < source.length) {
|
|
20180
|
+
// Find code of next character
|
|
20181
|
+
const charCode = source.charCodeAt(psz);
|
|
20182
|
+
// Base map can not be indexed using char code
|
|
20183
|
+
if (charCode > 255) { return }
|
|
20184
|
+
// Decode character
|
|
20185
|
+
let carry = BASE_MAP[charCode];
|
|
20186
|
+
// Invalid character
|
|
20187
|
+
if (carry === 255) { return }
|
|
20188
|
+
let i = 0;
|
|
20189
|
+
for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
20190
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
20191
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
20192
|
+
carry = (carry / 256) >>> 0;
|
|
20193
|
+
}
|
|
20194
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20195
|
+
length = i;
|
|
20196
|
+
psz++;
|
|
20197
|
+
}
|
|
20198
|
+
// Skip leading zeroes in b256.
|
|
20199
|
+
let it4 = size - length;
|
|
20200
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
20201
|
+
it4++;
|
|
20202
|
+
}
|
|
20203
|
+
const vch = new Uint8Array(zeroes + (size - it4));
|
|
20204
|
+
let j = zeroes;
|
|
20205
|
+
while (it4 !== size) {
|
|
20206
|
+
vch[j++] = b256[it4++];
|
|
20207
|
+
}
|
|
20208
|
+
return vch
|
|
20209
|
+
}
|
|
20210
|
+
function decode (string) {
|
|
20211
|
+
const buffer = decodeUnsafe(string);
|
|
20212
|
+
if (buffer) { return buffer }
|
|
20213
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
20214
|
+
}
|
|
20215
|
+
return {
|
|
20216
|
+
encode,
|
|
20217
|
+
decodeUnsafe,
|
|
20218
|
+
decode
|
|
20219
|
+
}
|
|
20220
|
+
}
|
|
20221
|
+
cjs.default = base;
|
|
20222
|
+
return cjs;
|
|
20303
20223
|
}
|
|
20304
20224
|
|
|
20305
|
-
var
|
|
20306
|
-
var
|
|
20225
|
+
var bs58;
|
|
20226
|
+
var hasRequiredBs58;
|
|
20227
|
+
|
|
20228
|
+
function requireBs58 () {
|
|
20229
|
+
if (hasRequiredBs58) return bs58;
|
|
20230
|
+
hasRequiredBs58 = 1;
|
|
20231
|
+
var basex = requireCjs();
|
|
20232
|
+
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
20233
|
+
|
|
20234
|
+
bs58 = basex(ALPHABET);
|
|
20235
|
+
return bs58;
|
|
20236
|
+
}
|
|
20307
20237
|
|
|
20308
|
-
var
|
|
20238
|
+
var bs58Exports = requireBs58();
|
|
20239
|
+
var base58 = /*@__PURE__*/getDefaultExportFromCjs$1(bs58Exports);
|
|
20240
|
+
|
|
20241
|
+
var index = /*#__PURE__*/_mergeNamespaces({
|
|
20309
20242
|
__proto__: null,
|
|
20310
|
-
default:
|
|
20311
|
-
});
|
|
20243
|
+
default: base58
|
|
20244
|
+
}, [bs58Exports]);
|
|
20312
20245
|
|
|
20313
20246
|
const SURFNET_RPC_URL$1 = "https://surfpool.fly.dev";
|
|
20314
20247
|
let React;
|
|
@@ -21042,7 +20975,7 @@ class PrivyWalletProvider {
|
|
|
21042
20975
|
// Handle case where signature might be bytes instead of string
|
|
21043
20976
|
const rawSig = result.signature;
|
|
21044
20977
|
if (rawSig instanceof Uint8Array || Array.isArray(rawSig)) {
|
|
21045
|
-
signature =
|
|
20978
|
+
signature = base58.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
|
|
21046
20979
|
}
|
|
21047
20980
|
else {
|
|
21048
20981
|
signature = rawSig;
|
|
@@ -21210,63 +21143,6 @@ function isMobileWalletAvailable() {
|
|
|
21210
21143
|
return detectAndroid();
|
|
21211
21144
|
}
|
|
21212
21145
|
const ED25519_SIGNATURE_LENGTH = 64;
|
|
21213
|
-
/**
|
|
21214
|
-
* On Android Chrome PWA (e.g. Solana Seeker in standalone mode), MWA's
|
|
21215
|
-
* transact() opens a WebSocket to ws://localhost:<port>/solana-wallet to
|
|
21216
|
-
* handshake with the wallet app on the device. Chrome guards localhost
|
|
21217
|
-
* connections behind the Local Network Access ("Apps on Device") permission
|
|
21218
|
-
* dialog. The dialog inherits the activity's window-focus state at spawn
|
|
21219
|
-
* time — so if focus is in transit (e.g. just after a Phantom-modal close
|
|
21220
|
-
* triggers a React commit), the dialog renders with grayed-out Allow/Block
|
|
21221
|
-
* buttons and only becomes interactive after a manual background→resume
|
|
21222
|
-
* (which forces an onPause→onResume cycle on the activity).
|
|
21223
|
-
*
|
|
21224
|
-
* Wait for window focus to settle, then yield one frame, before opening
|
|
21225
|
-
* the WebSocket. This makes the system dialog spawn into a focused activity
|
|
21226
|
-
* so its buttons are immediately tappable.
|
|
21227
|
-
*/
|
|
21228
|
-
async function awaitActivityFocus() {
|
|
21229
|
-
var _a;
|
|
21230
|
-
if (typeof document === 'undefined' || typeof window === 'undefined')
|
|
21231
|
-
return;
|
|
21232
|
-
const t0 = Date.now();
|
|
21233
|
-
const initialHasFocus = document.hasFocus();
|
|
21234
|
-
console.log('[MWA-DEBUG] awaitActivityFocus: enter', {
|
|
21235
|
-
hasFocus: initialHasFocus,
|
|
21236
|
-
visibilityState: document.visibilityState,
|
|
21237
|
-
activeElement: (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName,
|
|
21238
|
-
});
|
|
21239
|
-
if (!initialHasFocus) {
|
|
21240
|
-
let resolvedBy = 'pending';
|
|
21241
|
-
await new Promise((resolve) => {
|
|
21242
|
-
const onFocus = () => {
|
|
21243
|
-
window.removeEventListener('focus', onFocus);
|
|
21244
|
-
resolvedBy = 'focus-event';
|
|
21245
|
-
resolve();
|
|
21246
|
-
};
|
|
21247
|
-
window.addEventListener('focus', onFocus);
|
|
21248
|
-
// Fallback in case the focus event never fires (e.g. activity
|
|
21249
|
-
// already focused but document.hasFocus() momentarily lies during
|
|
21250
|
-
// a React commit). 600ms is a perceptual ceiling — beyond this
|
|
21251
|
-
// the user notices a stall, so we'd rather take the focus race
|
|
21252
|
-
// than block forever.
|
|
21253
|
-
setTimeout(() => {
|
|
21254
|
-
window.removeEventListener('focus', onFocus);
|
|
21255
|
-
if (resolvedBy === 'pending')
|
|
21256
|
-
resolvedBy = 'timeout';
|
|
21257
|
-
resolve();
|
|
21258
|
-
}, 600);
|
|
21259
|
-
});
|
|
21260
|
-
console.log('[MWA-DEBUG] awaitActivityFocus: wait resolved', { resolvedBy, waitedMs: Date.now() - t0 });
|
|
21261
|
-
}
|
|
21262
|
-
// Yield to next paint so any pending React commits / focus changes have
|
|
21263
|
-
// flushed before the WebSocket open spawns the system dialog.
|
|
21264
|
-
await new Promise((r) => requestAnimationFrame(() => r()));
|
|
21265
|
-
console.log('[MWA-DEBUG] awaitActivityFocus: exit', {
|
|
21266
|
-
hasFocus: document.hasFocus(),
|
|
21267
|
-
totalMs: Date.now() - t0,
|
|
21268
|
-
});
|
|
21269
|
-
}
|
|
21270
21146
|
// Dynamically imported MWA protocol module
|
|
21271
21147
|
let mwaProtocolModule = null;
|
|
21272
21148
|
let mwaProtocolLoadPromise = null;
|
|
@@ -21279,7 +21155,7 @@ async function loadMwaProtocol() {
|
|
|
21279
21155
|
return mwaProtocolLoadPromise;
|
|
21280
21156
|
mwaProtocolLoadPromise = (async () => {
|
|
21281
21157
|
try {
|
|
21282
|
-
mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-
|
|
21158
|
+
mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-d0PlOXpF.js'); });
|
|
21283
21159
|
}
|
|
21284
21160
|
catch (e) {
|
|
21285
21161
|
console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
|
|
@@ -21301,7 +21177,7 @@ async function registerMobileWalletAdapter(config) {
|
|
|
21301
21177
|
if (typeof window === 'undefined')
|
|
21302
21178
|
return;
|
|
21303
21179
|
try {
|
|
21304
|
-
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-
|
|
21180
|
+
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-CT6PUv9G.js'); });
|
|
21305
21181
|
const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
|
|
21306
21182
|
if (!registerMwa) {
|
|
21307
21183
|
console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
|
|
@@ -21430,17 +21306,14 @@ class SolanaMobileWalletProvider {
|
|
|
21430
21306
|
}
|
|
21431
21307
|
async login() {
|
|
21432
21308
|
var _a, _b, _c, _d, _e;
|
|
21433
|
-
console.log('[MWA-DEBUG] SolanaMobileWalletProvider.login: enter');
|
|
21434
21309
|
setAuthLoading(true);
|
|
21435
21310
|
try {
|
|
21436
21311
|
await loadMwaProtocol();
|
|
21437
|
-
console.log('[MWA-DEBUG] loadMwaProtocol resolved');
|
|
21438
21312
|
const { transact } = mwaProtocolModule;
|
|
21439
21313
|
// Quick check: if we already have auth state and a valid session, skip
|
|
21440
21314
|
if (this.authorizedPublicKey) {
|
|
21441
21315
|
const existingSession = await WebSessionManager.getSession();
|
|
21442
21316
|
if (existingSession && existingSession.address === this.authorizedPublicKey) {
|
|
21443
|
-
console.log('[MWA-DEBUG] login: returning existing session, no transact');
|
|
21444
21317
|
const user = { provider: this, address: this.authorizedPublicKey };
|
|
21445
21318
|
setCurrentUser(user);
|
|
21446
21319
|
return user;
|
|
@@ -21448,12 +21321,8 @@ class SolanaMobileWalletProvider {
|
|
|
21448
21321
|
}
|
|
21449
21322
|
// Pre-fetch nonce from server while wallet is not yet connected
|
|
21450
21323
|
const nonce = await genAuthNonce();
|
|
21451
|
-
console.log('[MWA-DEBUG] login: nonce fetched, awaiting activity focus');
|
|
21452
|
-
await awaitActivityFocus();
|
|
21453
|
-
console.log('[MWA-DEBUG] login: about to call transact() — WebSocket to localhost will open now');
|
|
21454
21324
|
// Single transact() call: authorize + signMessages — one wallet popup
|
|
21455
21325
|
const result = await transact(async (wallet) => {
|
|
21456
|
-
console.log('[MWA-DEBUG] transact callback running — WebSocket connected, calling wallet.authorize');
|
|
21457
21326
|
// Step 1: Authorize — user approves the dApp
|
|
21458
21327
|
const authResult = await wallet.authorize({
|
|
21459
21328
|
identity: this.appIdentity,
|
|
@@ -21483,7 +21352,6 @@ class SolanaMobileWalletProvider {
|
|
|
21483
21352
|
walletUriBase: authResult.wallet_uri_base,
|
|
21484
21353
|
};
|
|
21485
21354
|
}, this.getAssociationConfig());
|
|
21486
|
-
console.log('[MWA-DEBUG] login: transact() resolved successfully');
|
|
21487
21355
|
// Store MWA auth state for reauthorization in subsequent transact() calls
|
|
21488
21356
|
this.authToken = result.authToken;
|
|
21489
21357
|
this.walletUriBase = result.walletUriBase;
|
|
@@ -21510,12 +21378,6 @@ class SolanaMobileWalletProvider {
|
|
|
21510
21378
|
return user;
|
|
21511
21379
|
}
|
|
21512
21380
|
catch (error) {
|
|
21513
|
-
console.log('[MWA-DEBUG] login caught error', {
|
|
21514
|
-
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
21515
|
-
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
21516
|
-
errorCode: error === null || error === void 0 ? void 0 : error.code,
|
|
21517
|
-
hasFocus: typeof document !== 'undefined' ? document.hasFocus() : 'n/a',
|
|
21518
|
-
});
|
|
21519
21381
|
const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
|
|
21520
21382
|
((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||
|
|
21521
21383
|
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||
|
|
@@ -21547,7 +21409,6 @@ class SolanaMobileWalletProvider {
|
|
|
21547
21409
|
await loadMwaProtocol();
|
|
21548
21410
|
const { transact } = mwaProtocolModule;
|
|
21549
21411
|
const authToken = this.authToken;
|
|
21550
|
-
await awaitActivityFocus();
|
|
21551
21412
|
await transact(async (wallet) => {
|
|
21552
21413
|
await wallet.deauthorize({ auth_token: authToken });
|
|
21553
21414
|
}, this.getAssociationConfig());
|
|
@@ -21573,7 +21434,6 @@ class SolanaMobileWalletProvider {
|
|
|
21573
21434
|
const { transact } = mwaProtocolModule;
|
|
21574
21435
|
const base64Addr = this.base64Address;
|
|
21575
21436
|
try {
|
|
21576
|
-
await awaitActivityFocus();
|
|
21577
21437
|
const signedMessages = await transact(async (wallet) => {
|
|
21578
21438
|
await this.reauthorizeWallet(wallet);
|
|
21579
21439
|
const messageBytes = getPlatform().textEncode(message);
|
|
@@ -21627,7 +21487,6 @@ class SolanaMobileWalletProvider {
|
|
|
21627
21487
|
}
|
|
21628
21488
|
}
|
|
21629
21489
|
try {
|
|
21630
|
-
await awaitActivityFocus();
|
|
21631
21490
|
const signedTransactions = await transact(async (wallet) => {
|
|
21632
21491
|
await this.reauthorizeWallet(wallet);
|
|
21633
21492
|
return wallet.signTransactions({ transactions: [transaction] });
|
|
@@ -21675,7 +21534,6 @@ class SolanaMobileWalletProvider {
|
|
|
21675
21534
|
}
|
|
21676
21535
|
if (isSurfnet) {
|
|
21677
21536
|
// Surfnet: sign-only, then submit to our specific RPC
|
|
21678
|
-
await awaitActivityFocus();
|
|
21679
21537
|
const signedTransactions = await transact(async (wallet) => {
|
|
21680
21538
|
await this.reauthorizeWallet(wallet);
|
|
21681
21539
|
return wallet.signTransactions({ transactions: [transaction] });
|
|
@@ -21695,7 +21553,6 @@ class SolanaMobileWalletProvider {
|
|
|
21695
21553
|
return signature;
|
|
21696
21554
|
}
|
|
21697
21555
|
// Non-surfnet: use signAndSendTransactions for wallet-optimized submission
|
|
21698
|
-
await awaitActivityFocus();
|
|
21699
21556
|
const signatures = await transact(async (wallet) => {
|
|
21700
21557
|
await this.reauthorizeWallet(wallet);
|
|
21701
21558
|
return wallet.signAndSendTransactions({
|
|
@@ -21779,7 +21636,6 @@ class SolanaMobileWalletProvider {
|
|
|
21779
21636
|
tx = result.tx;
|
|
21780
21637
|
}
|
|
21781
21638
|
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
21782
|
-
await awaitActivityFocus();
|
|
21783
21639
|
const [signedTx] = await transact(async (wallet) => {
|
|
21784
21640
|
await this.reauthorizeWallet(wallet);
|
|
21785
21641
|
return wallet.signTransactions({ transactions: [tx] });
|
|
@@ -21793,7 +21649,6 @@ class SolanaMobileWalletProvider {
|
|
|
21793
21649
|
}
|
|
21794
21650
|
if (isSurfnet) {
|
|
21795
21651
|
// Surfnet: sign then submit manually to our RPC
|
|
21796
|
-
await awaitActivityFocus();
|
|
21797
21652
|
const [signedTx] = await transact(async (wallet) => {
|
|
21798
21653
|
await this.reauthorizeWallet(wallet);
|
|
21799
21654
|
return wallet.signTransactions({ transactions: [tx] });
|
|
@@ -21822,7 +21677,6 @@ class SolanaMobileWalletProvider {
|
|
|
21822
21677
|
};
|
|
21823
21678
|
}
|
|
21824
21679
|
// Non-surfnet: use signAndSendTransactions
|
|
21825
|
-
await awaitActivityFocus();
|
|
21826
21680
|
const signatures = await transact(async (wallet) => {
|
|
21827
21681
|
await this.reauthorizeWallet(wallet);
|
|
21828
21682
|
return wallet.signAndSendTransactions({
|
|
@@ -22076,7 +21930,7 @@ class PrivyExpoProvider {
|
|
|
22076
21930
|
const wallet = await this.getWalletOrThrow();
|
|
22077
21931
|
const messageBytes = getPlatform().textEncode(message);
|
|
22078
21932
|
const result = await wallet.signMessage(messageBytes);
|
|
22079
|
-
return
|
|
21933
|
+
return base58.encode(result.signature);
|
|
22080
21934
|
}
|
|
22081
21935
|
async signTransaction(transaction) {
|
|
22082
21936
|
await this.ensureReady();
|
|
@@ -22243,11 +22097,12 @@ exports.ServerSessionManager = ServerSessionManager;
|
|
|
22243
22097
|
exports.SolanaMobileWalletProvider = SolanaMobileWalletProvider;
|
|
22244
22098
|
exports.WebSessionManager = WebSessionManager;
|
|
22245
22099
|
exports.aggregate = aggregate;
|
|
22246
|
-
exports.
|
|
22100
|
+
exports.base58 = base58;
|
|
22247
22101
|
exports.bufferExports = bufferExports;
|
|
22248
22102
|
exports.buildSetDocumentsTransaction = buildSetDocumentsTransaction;
|
|
22249
22103
|
exports.clearCache = clearCache;
|
|
22250
22104
|
exports.closeAllSubscriptions = closeAllSubscriptions;
|
|
22105
|
+
exports.commonjsRequire = commonjsRequire;
|
|
22251
22106
|
exports.convertRemainingAccounts = convertRemainingAccounts;
|
|
22252
22107
|
exports.count = count;
|
|
22253
22108
|
exports.createSessionWithPrivy = createSessionWithPrivy;
|
|
@@ -22275,6 +22130,7 @@ exports.onAuthStateChanged = onAuthStateChanged;
|
|
|
22275
22130
|
exports.reconnectWithNewAuth = reconnectWithNewAuth;
|
|
22276
22131
|
exports.refreshSession = refreshSession;
|
|
22277
22132
|
exports.registerMobileWalletAdapter = registerMobileWalletAdapter;
|
|
22133
|
+
exports.require$$0 = require$$0;
|
|
22278
22134
|
exports.runExpression = runExpression;
|
|
22279
22135
|
exports.runExpressionMany = runExpressionMany;
|
|
22280
22136
|
exports.runQuery = runQuery;
|
|
@@ -22289,4 +22145,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
|
|
|
22289
22145
|
exports.signTransaction = signTransaction;
|
|
22290
22146
|
exports.subscribe = subscribe;
|
|
22291
22147
|
exports.useAuth = useAuth;
|
|
22292
|
-
//# sourceMappingURL=index-
|
|
22148
|
+
//# sourceMappingURL=index-B2WGCssJ.js.map
|