@pooflabs/web 0.0.81-rc5 → 0.0.82
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-BicMkamC.js} +483 -522
- package/dist/index-BicMkamC.js.map +1 -0
- package/dist/{index-Bkr4BRoP.esm.js → index-BsY_Lgiu.esm.js} +482 -522
- package/dist/index-BsY_Lgiu.esm.js.map +1 -0
- package/dist/index-CHWmdXHE.esm.js +6 -0
- package/dist/index-CHWmdXHE.esm.js.map +1 -0
- package/dist/{index-DB9nDInp.esm.js → index-CK_2Zn89.esm.js} +3825 -563
- package/dist/index-CK_2Zn89.esm.js.map +1 -0
- package/dist/{index-D_ta2S2c.js → index-Ci3m3diI.js} +3825 -563
- package/dist/index-Ci3m3diI.js.map +1 -0
- package/dist/{index-CZhJBWap.esm.js → index-DWf2AOhe.esm.js} +3824 -562
- package/dist/index-DWf2AOhe.esm.js.map +1 -0
- package/dist/{index-Bg_ApFIo.js → index-DlKo76M3.js} +3826 -564
- package/dist/index-DlKo76M3.js.map +1 -0
- package/dist/index-Dz0bPXrU.js +8 -0
- package/dist/index-Dz0bPXrU.js.map +1 -0
- package/dist/{index.browser-DHi7UhqF.js → index.browser-BkMiHSON.js} +2 -2
- package/dist/{index.browser-DHi7UhqF.js.map → index.browser-BkMiHSON.js.map} +1 -1
- package/dist/{index.browser-Disp7Kcb.esm.js → index.browser-C9bFQZyQ.esm.js} +128 -5
- package/dist/index.browser-C9bFQZyQ.esm.js.map +1 -0
- package/dist/{index.browser-iqs5DlRU.esm.js → index.browser-DCOvqSUT.esm.js} +2 -2
- package/dist/{index.browser-iqs5DlRU.esm.js.map → index.browser-DCOvqSUT.esm.js.map} +1 -1
- package/dist/{index.browser-BTlliHCf.esm.js → index.browser-Dbq5Qf1G.esm.js} +128 -5
- package/dist/index.browser-Dbq5Qf1G.esm.js.map +1 -0
- package/dist/{index.browser-DvTeEO2r.js → index.browser-Df7yN8D5.js} +129 -6
- package/dist/index.browser-Df7yN8D5.js.map +1 -0
- package/dist/{index.browser-DRTQuf0J.js → index.browser-dszs5oe5.js} +129 -6
- package/dist/index.browser-dszs5oe5.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-DJWuqJTZ.js → index.native-11supFRU.js} +2742 -240
- package/dist/index.native-11supFRU.js.map +1 -0
- package/dist/{index.native-DYgJWWY4.esm.js → index.native-CLaHKvDv.esm.js} +2740 -241
- package/dist/index.native-CLaHKvDv.esm.js.map +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +1 -1
- package/dist/{phantom-wallet-provider-DSFGWSOJ.esm.js → phantom-wallet-provider-BN47klTp.esm.js} +148 -239
- package/dist/phantom-wallet-provider-BN47klTp.esm.js.map +1 -0
- package/dist/{phantom-wallet-provider-fofd8BMo.js → phantom-wallet-provider-Xb070-O6.js} +148 -239
- package/dist/phantom-wallet-provider-Xb070-O6.js.map +1 -0
- package/dist/{privy-wallet-provider-Csv34Kcc.js → privy-wallet-provider-Ch22rj_G.js} +3 -3
- package/dist/privy-wallet-provider-Ch22rj_G.js.map +1 -0
- package/dist/{privy-wallet-provider-TRToDe4Q.esm.js → privy-wallet-provider-DUJS5viU.esm.js} +3 -3
- package/dist/privy-wallet-provider-DUJS5viU.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-L7nRuxhv.esm.js → solana-mobile-wallet-provider-BF04Xp8P.esm.js} +4 -83
- package/dist/solana-mobile-wallet-provider-BF04Xp8P.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-Cp65LfNb.js → solana-mobile-wallet-provider-BXm94fqW.js} +4 -83
- package/dist/solana-mobile-wallet-provider-BXm94fqW.js.map +1 -0
- package/package.json +3 -3
- package/dist/index-Bdcc5821.js +0 -2375
- package/dist/index-Bdcc5821.js.map +0 -1
- 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-CrOVJFX9.esm.js +0 -2373
- package/dist/index-CrOVJFX9.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.map +0 -1
- package/dist/index.browser-DRTQuf0J.js.map +0 -1
- package/dist/index.browser-Disp7Kcb.esm.js.map +0 -1
- package/dist/index.browser-DvTeEO2r.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
|
@@ -4,6 +4,21 @@ import * as anchor from '@coral-xyz/anchor';
|
|
|
4
4
|
import { Program } from '@coral-xyz/anchor';
|
|
5
5
|
import * as React$2 from 'react';
|
|
6
6
|
|
|
7
|
+
function _mergeNamespaces(n, m) {
|
|
8
|
+
m.forEach(function (e) {
|
|
9
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !(k in n)) {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
function getDefaultExportFromCjs$1 (x) {
|
|
8
23
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
24
|
}
|
|
@@ -9237,15 +9252,15 @@ function requireBuffer$1 () {
|
|
|
9237
9252
|
|
|
9238
9253
|
var bufferExports$1 = requireBuffer$1();
|
|
9239
9254
|
|
|
9240
|
-
var safeBuffer = {exports: {}};
|
|
9255
|
+
var safeBuffer$1 = {exports: {}};
|
|
9241
9256
|
|
|
9242
9257
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
9243
9258
|
|
|
9244
|
-
var hasRequiredSafeBuffer;
|
|
9259
|
+
var hasRequiredSafeBuffer$1;
|
|
9245
9260
|
|
|
9246
|
-
function requireSafeBuffer () {
|
|
9247
|
-
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
9248
|
-
hasRequiredSafeBuffer = 1;
|
|
9261
|
+
function requireSafeBuffer$1 () {
|
|
9262
|
+
if (hasRequiredSafeBuffer$1) return safeBuffer$1.exports;
|
|
9263
|
+
hasRequiredSafeBuffer$1 = 1;
|
|
9249
9264
|
(function (module, exports$1) {
|
|
9250
9265
|
/* eslint-disable node/no-deprecated-api */
|
|
9251
9266
|
var buffer = requireBuffer$1();
|
|
@@ -9311,23 +9326,23 @@ function requireSafeBuffer () {
|
|
|
9311
9326
|
}
|
|
9312
9327
|
return buffer.SlowBuffer(size)
|
|
9313
9328
|
};
|
|
9314
|
-
} (safeBuffer, safeBuffer.exports));
|
|
9315
|
-
return safeBuffer.exports;
|
|
9329
|
+
} (safeBuffer$1, safeBuffer$1.exports));
|
|
9330
|
+
return safeBuffer$1.exports;
|
|
9316
9331
|
}
|
|
9317
9332
|
|
|
9318
|
-
var src;
|
|
9319
|
-
var hasRequiredSrc;
|
|
9333
|
+
var src$1;
|
|
9334
|
+
var hasRequiredSrc$1;
|
|
9320
9335
|
|
|
9321
|
-
function requireSrc () {
|
|
9322
|
-
if (hasRequiredSrc) return src;
|
|
9323
|
-
hasRequiredSrc = 1;
|
|
9336
|
+
function requireSrc$1 () {
|
|
9337
|
+
if (hasRequiredSrc$1) return src$1;
|
|
9338
|
+
hasRequiredSrc$1 = 1;
|
|
9324
9339
|
// base-x encoding / decoding
|
|
9325
9340
|
// Copyright (c) 2018 base-x contributors
|
|
9326
9341
|
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
9327
9342
|
// Distributed under the MIT software license, see the accompanying
|
|
9328
9343
|
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
9329
9344
|
// @ts-ignore
|
|
9330
|
-
var _Buffer = requireSafeBuffer().Buffer;
|
|
9345
|
+
var _Buffer = requireSafeBuffer$1().Buffer;
|
|
9331
9346
|
function base (ALPHABET) {
|
|
9332
9347
|
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
9333
9348
|
var BASE_MAP = new Uint8Array(256);
|
|
@@ -9442,25 +9457,25 @@ function requireSrc () {
|
|
|
9442
9457
|
decode: decode
|
|
9443
9458
|
}
|
|
9444
9459
|
}
|
|
9445
|
-
src = base;
|
|
9446
|
-
return src;
|
|
9460
|
+
src$1 = base;
|
|
9461
|
+
return src$1;
|
|
9447
9462
|
}
|
|
9448
9463
|
|
|
9449
|
-
var bs58$1;
|
|
9450
|
-
var hasRequiredBs58;
|
|
9464
|
+
var bs58$1$1;
|
|
9465
|
+
var hasRequiredBs58$1;
|
|
9451
9466
|
|
|
9452
|
-
function requireBs58 () {
|
|
9453
|
-
if (hasRequiredBs58) return bs58$1;
|
|
9454
|
-
hasRequiredBs58 = 1;
|
|
9455
|
-
var basex = requireSrc();
|
|
9467
|
+
function requireBs58$1 () {
|
|
9468
|
+
if (hasRequiredBs58$1) return bs58$1$1;
|
|
9469
|
+
hasRequiredBs58$1 = 1;
|
|
9470
|
+
var basex = requireSrc$1();
|
|
9456
9471
|
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
9457
9472
|
|
|
9458
|
-
bs58$1 = basex(ALPHABET);
|
|
9459
|
-
return bs58$1;
|
|
9473
|
+
bs58$1$1 = basex(ALPHABET);
|
|
9474
|
+
return bs58$1$1;
|
|
9460
9475
|
}
|
|
9461
9476
|
|
|
9462
|
-
var bs58Exports = requireBs58();
|
|
9463
|
-
var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
|
|
9477
|
+
var bs58Exports$1 = requireBs58$1();
|
|
9478
|
+
var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports$1);
|
|
9464
9479
|
|
|
9465
9480
|
// ─────────────────────────────────────────────────────────────
|
|
9466
9481
|
// Local implementation of getSimulationComputeUnits
|
|
@@ -9539,6 +9554,12 @@ async function genSolanaMessage(address, nonce) {
|
|
|
9539
9554
|
// Serialization Helpers
|
|
9540
9555
|
// ─────────────────────────────────────────────────────────────
|
|
9541
9556
|
function isHexString(value) {
|
|
9557
|
+
// Only strings can be hex-encoded. Numbers, BNs, and other shapes coming back
|
|
9558
|
+
// from the API for u64Val/i64Val should fall through to `new BN(value)` which
|
|
9559
|
+
// accepts those shapes natively. Without this guard, calling .startsWith on a
|
|
9560
|
+
// non-string blows up with TypeError.
|
|
9561
|
+
if (typeof value !== "string")
|
|
9562
|
+
return false;
|
|
9542
9563
|
// Matches strings containing only 0-9, a-f, or A-F (optionally prefixed with 0x)
|
|
9543
9564
|
let testValue = value;
|
|
9544
9565
|
// Handle negative values
|
|
@@ -9634,8 +9655,11 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
9634
9655
|
}
|
|
9635
9656
|
else if (idl.address === "poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZp") {
|
|
9636
9657
|
const program = new Program(idl, anchorProvider);
|
|
9658
|
+
// Targets `set_documents_v2` (Vec<u8> ra_indices). The on-chain program
|
|
9659
|
+
// also exposes the legacy `set_documents` (Vec<u64>) so SDKs already on npm
|
|
9660
|
+
// continue to work — but new releases of this SDK speak v2 only.
|
|
9637
9661
|
tx = await program.methods
|
|
9638
|
-
.
|
|
9662
|
+
.setDocumentsV2(args.app_id, prepareAnchorArgs(args.documents), args.delete_paths, args.txData, simulate)
|
|
9639
9663
|
.preInstructions(instructions)
|
|
9640
9664
|
.accounts({
|
|
9641
9665
|
payer: payerPublicKey
|
|
@@ -9990,11 +10014,17 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
9990
10014
|
if (_overrides === null || _overrides === void 0 ? void 0 : _overrides.headers) {
|
|
9991
10015
|
Object.assign(headers, _overrides.headers);
|
|
9992
10016
|
}
|
|
10017
|
+
// Writes (PUT/POST/DELETE) can take significantly longer than reads —
|
|
10018
|
+
// server-side they may trigger ad-hoc LUT creation (create + extend +
|
|
10019
|
+
// wait-for-finalization, ~15-30s on mainnet). Use a larger default for
|
|
10020
|
+
// non-GET so the SDK doesn't time out before client-api responds.
|
|
10021
|
+
const isRead = method.toUpperCase() === "GET";
|
|
10022
|
+
const defaultTimeout = isRead ? 30000 : 90000;
|
|
9993
10023
|
const requestConfig = {
|
|
9994
10024
|
method,
|
|
9995
10025
|
url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
|
|
9996
10026
|
headers,
|
|
9997
|
-
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a :
|
|
10027
|
+
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a : defaultTimeout,
|
|
9998
10028
|
};
|
|
9999
10029
|
if (method !== "GET" && method !== "get") {
|
|
10000
10030
|
requestConfig.data = data ? JSON.stringify(data) : {};
|
|
@@ -10106,40 +10136,17 @@ async function getConfig() {
|
|
|
10106
10136
|
return clientConfig;
|
|
10107
10137
|
}
|
|
10108
10138
|
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
10120
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
10121
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
10122
|
-
***************************************************************************** */
|
|
10123
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
function __rest(s, e) {
|
|
10127
|
-
var t = {};
|
|
10128
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
10129
|
-
t[p] = s[p];
|
|
10130
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10131
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
10132
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10133
|
-
t[p[i]] = s[p[i]];
|
|
10134
|
-
}
|
|
10135
|
-
return t;
|
|
10136
|
-
}
|
|
10137
|
-
|
|
10138
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
10139
|
-
var e = new Error(message);
|
|
10140
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
10139
|
+
var __rest = function (s, e) {
|
|
10140
|
+
var t = {};
|
|
10141
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
10142
|
+
t[p] = s[p];
|
|
10143
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10144
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
10145
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10146
|
+
t[p[i]] = s[p[i]];
|
|
10147
|
+
}
|
|
10148
|
+
return t;
|
|
10141
10149
|
};
|
|
10142
|
-
|
|
10143
10150
|
/**
|
|
10144
10151
|
* Thrown when a user's wallet doesn't have enough SOL to cover the transaction.
|
|
10145
10152
|
* Apps can catch this to trigger an onramp/funding flow.
|
|
@@ -10662,21 +10669,38 @@ async function setMany(many, options) {
|
|
|
10662
10669
|
setDocumentData: tx.transactionArgs.setDocumentData,
|
|
10663
10670
|
deletePaths: tx.transactionArgs.deletePaths,
|
|
10664
10671
|
idl: tx.idl,
|
|
10665
|
-
txData: (_b = (_a = tx.txData) === null || _a === void 0 ? void 0 : _a.map((txData) => {
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10672
|
+
txData: (_b = (_a = tx.txData) === null || _a === void 0 ? void 0 : _a.map((txData) => ({
|
|
10673
|
+
pluginFunctionKey: txData.pluginFunctionKey,
|
|
10674
|
+
txData: bufferExports$1.Buffer.from(txData.txData),
|
|
10675
|
+
// raIndices is Vec<u8> on-chain (serialized as Buffer/bytes). The server may send
|
|
10676
|
+
// it as a Buffer, a number[], a Uint8Array, or — over JSON — as Node's serialized
|
|
10677
|
+
// Buffer shape {type: "Buffer", data: number[]} (the default `JSON.stringify(buf)`
|
|
10678
|
+
// output). Normalise all of those to Buffer here. Each value must fit in u8 (matches
|
|
10679
|
+
// Solana's instruction-level account indexing); throw clearly if anything is out of range.
|
|
10680
|
+
raIndices: (() => {
|
|
10681
|
+
const raw = txData.raIndices;
|
|
10682
|
+
if (raw == null)
|
|
10683
|
+
return bufferExports$1.Buffer.alloc(0);
|
|
10684
|
+
if (bufferExports$1.Buffer.isBuffer(raw))
|
|
10685
|
+
return raw;
|
|
10686
|
+
if (raw instanceof Uint8Array)
|
|
10687
|
+
return bufferExports$1.Buffer.from(raw);
|
|
10688
|
+
// Node's JSON-serialised Buffer: {type: "Buffer", data: number[]}
|
|
10689
|
+
const arrayLike = Array.isArray(raw)
|
|
10690
|
+
? raw
|
|
10691
|
+
: (raw && typeof raw === 'object' && Array.isArray(raw.data))
|
|
10692
|
+
? raw.data
|
|
10693
|
+
: (() => { throw new Error(`raIndices has unexpected shape: ${typeof raw}`); })();
|
|
10694
|
+
const bytes = arrayLike.map((raIndex) => {
|
|
10695
|
+
const n = isHexString(raIndex) ? parseInt(raIndex, 16) : Number(raIndex);
|
|
10696
|
+
if (!Number.isInteger(n) || n < 0 || n > 255) {
|
|
10697
|
+
throw new Error(`raIndex ${raIndex} is not a valid u8 (must be integer in 0..255)`);
|
|
10673
10698
|
}
|
|
10674
|
-
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
})) !== null && _b !== void 0 ? _b : [],
|
|
10699
|
+
return n;
|
|
10700
|
+
});
|
|
10701
|
+
return bufferExports$1.Buffer.from(bytes);
|
|
10702
|
+
})(),
|
|
10703
|
+
}))) !== null && _b !== void 0 ? _b : [],
|
|
10680
10704
|
};
|
|
10681
10705
|
const config = await getConfig();
|
|
10682
10706
|
const solTransaction = {
|
|
@@ -12960,7 +12984,7 @@ async function getAuthProvider(config) {
|
|
|
12960
12984
|
}
|
|
12961
12985
|
return currentAuthProvider;
|
|
12962
12986
|
}
|
|
12963
|
-
async function login$1() {
|
|
12987
|
+
async function login$1(options) {
|
|
12964
12988
|
// Re-initialize provider if it was cleared by logout
|
|
12965
12989
|
if (!currentAuthProvider && initConfig) {
|
|
12966
12990
|
currentAuthProvider = await getAuthProvider(initConfig);
|
|
@@ -12973,6 +12997,14 @@ async function login$1() {
|
|
|
12973
12997
|
if (!currentAuthProvider) {
|
|
12974
12998
|
throw new Error("Auth provider not initialized. Please call init() first.");
|
|
12975
12999
|
}
|
|
13000
|
+
// Forward per-call overrides to providers that support them (duck-typed to stay
|
|
13001
|
+
// lazy-load safe — no direct import of PhantomWalletProvider here).
|
|
13002
|
+
// Always call (even with null) so previous overrides are cleared when this
|
|
13003
|
+
// login() is invoked without options — early-return paths inside the provider
|
|
13004
|
+
// bypass the .finally() cleanup, so we reset here too.
|
|
13005
|
+
if (typeof currentAuthProvider.setLoginOverrides === 'function') {
|
|
13006
|
+
currentAuthProvider.setLoginOverrides(options !== null && options !== void 0 ? options : null);
|
|
13007
|
+
}
|
|
12976
13008
|
const loginResult = await currentAuthProvider.login();
|
|
12977
13009
|
if (loginResult) {
|
|
12978
13010
|
// Store which auth method was used so we restore the right provider on reload
|
|
@@ -13055,11 +13087,11 @@ function setAuthLoading(loading) {
|
|
|
13055
13087
|
function getAuthLoading() {
|
|
13056
13088
|
return isAuthLoading;
|
|
13057
13089
|
}
|
|
13058
|
-
async function login() {
|
|
13090
|
+
async function login(options) {
|
|
13059
13091
|
if (!authProviderInstance) {
|
|
13060
13092
|
throw new Error('SDK not initialized. Please call init() first.');
|
|
13061
13093
|
}
|
|
13062
|
-
const loggedInUser = await login$1();
|
|
13094
|
+
const loggedInUser = await login$1(options);
|
|
13063
13095
|
setCurrentUser(loggedInUser);
|
|
13064
13096
|
return currentUser;
|
|
13065
13097
|
}
|
|
@@ -15648,7 +15680,7 @@ async function loadDependencies() {
|
|
|
15648
15680
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
15649
15681
|
import('react'),
|
|
15650
15682
|
import('react-dom/client'),
|
|
15651
|
-
import('./index-
|
|
15683
|
+
import('./index-DWf2AOhe.esm.js')
|
|
15652
15684
|
]);
|
|
15653
15685
|
// Extract default export from ESM module namespace
|
|
15654
15686
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -15660,6 +15692,10 @@ async function loadDependencies() {
|
|
|
15660
15692
|
return loadingPromise;
|
|
15661
15693
|
}
|
|
15662
15694
|
class PhantomWalletProvider {
|
|
15695
|
+
/** Temporarily override modal appearance for a single login() call. Cleared automatically after login settles. */
|
|
15696
|
+
setLoginOverrides(opts) {
|
|
15697
|
+
this.loginOverrides = opts;
|
|
15698
|
+
}
|
|
15663
15699
|
constructor(networkUrl = null, config = {}) {
|
|
15664
15700
|
this.containerElement = null;
|
|
15665
15701
|
this.root = null;
|
|
@@ -15669,6 +15705,7 @@ class PhantomWalletProvider {
|
|
|
15669
15705
|
this.loginInProgress = false;
|
|
15670
15706
|
this.autoLoginInProgress = false;
|
|
15671
15707
|
this.initPromise = null;
|
|
15708
|
+
this.loginOverrides = null;
|
|
15672
15709
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
15673
15710
|
this.onSwitchToPrivy = null;
|
|
15674
15711
|
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
@@ -15691,13 +15728,8 @@ class PhantomWalletProvider {
|
|
|
15691
15728
|
async initializeAsync() {
|
|
15692
15729
|
// Lazy load dependencies only when actually instantiating
|
|
15693
15730
|
await loadDependencies();
|
|
15694
|
-
// Initialize React component
|
|
15695
|
-
|
|
15696
|
-
// or non-Android). Otherwise defer until ensureReady() is reached from
|
|
15697
|
-
// a user-gesture flow. See shouldMountEagerly() for the rationale.
|
|
15698
|
-
if (this.shouldMountEagerly()) {
|
|
15699
|
-
this.initialize();
|
|
15700
|
-
}
|
|
15731
|
+
// Initialize React component
|
|
15732
|
+
this.initialize();
|
|
15701
15733
|
}
|
|
15702
15734
|
/**
|
|
15703
15735
|
* Check if social login providers are configured (non-injected providers).
|
|
@@ -15705,69 +15737,6 @@ class PhantomWalletProvider {
|
|
|
15705
15737
|
hasSocialProviders() {
|
|
15706
15738
|
return this.resolvedProviders.some(p => p !== 'injected');
|
|
15707
15739
|
}
|
|
15708
|
-
/**
|
|
15709
|
-
* Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
|
|
15710
|
-
* eagerly during init() or defer until the first user-triggered call
|
|
15711
|
-
* (login / sign / etc.) reaches ensureReady().
|
|
15712
|
-
*
|
|
15713
|
-
* Mounting the React tree synchronously constructs BrowserSDK, which runs
|
|
15714
|
-
* wallet-standard discovery in its constructor and fires sdk.autoConnect()
|
|
15715
|
-
* in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
|
|
15716
|
-
* pathways probe the Android intent surface to discover the Phantom mobile
|
|
15717
|
-
* app, which surfaces Chrome's system "wants to access other apps and
|
|
15718
|
-
* services" permission dialog *before* the PWA activity has window focus.
|
|
15719
|
-
* The dialog renders with grayed-out buttons until the user backgrounds
|
|
15720
|
-
* and resumes the app.
|
|
15721
|
-
*
|
|
15722
|
-
* Returns true when eager mount is needed (callback to handle, prior
|
|
15723
|
-
* session, in-page wallet present, or non-Android). Otherwise returns
|
|
15724
|
-
* false — the React tree is mounted lazily inside ensureReady() once a
|
|
15725
|
-
* user gesture brings us there.
|
|
15726
|
-
*/
|
|
15727
|
-
shouldMountEagerly() {
|
|
15728
|
-
if (typeof window === 'undefined')
|
|
15729
|
-
return false;
|
|
15730
|
-
// Preserve desktop behavior: always mount eagerly.
|
|
15731
|
-
if (!detectAndroid())
|
|
15732
|
-
return true;
|
|
15733
|
-
// In-page wallet present (Phantom in-app browser / desktop extension on
|
|
15734
|
-
// a desktop-mode Android UA): no Android intent probe needed, mount free.
|
|
15735
|
-
// Tighten beyond truthy `window.phantom` since arbitrary stubs can land
|
|
15736
|
-
// on that key — require a wallet-shaped surface.
|
|
15737
|
-
const ph = window.phantom;
|
|
15738
|
-
if (ph && (ph.solana || ph.ethereum || ph.app))
|
|
15739
|
-
return true;
|
|
15740
|
-
// Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
|
|
15741
|
-
// be live to read these URL params via urlParamsAccessor.
|
|
15742
|
-
const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
|
|
15743
|
-
try {
|
|
15744
|
-
const params = new URLSearchParams(window.location.search);
|
|
15745
|
-
if (callbackKeys.some(k => params.has(k)))
|
|
15746
|
-
return true;
|
|
15747
|
-
}
|
|
15748
|
-
catch (_a) {
|
|
15749
|
-
return true; // conservative on URL access failure
|
|
15750
|
-
}
|
|
15751
|
-
// Returning user with a stored Phantom session. They've already
|
|
15752
|
-
// approved the Android intent permission for this origin on first
|
|
15753
|
-
// login, so the dialog is typically pre-granted by Chrome — eager
|
|
15754
|
-
// mount lets autoConnect silently restore the wallet handshake.
|
|
15755
|
-
// Require BOTH the marker AND a session storage entry so a stale
|
|
15756
|
-
// orphaned marker doesn't keep eager-mounting forever. Note
|
|
15757
|
-
// isAuthenticated() is a raw key-existence check, not a validity
|
|
15758
|
-
// check — restoreSession() above clears the marker on the next load
|
|
15759
|
-
// if the session is unusable, so the bug self-corrects after at
|
|
15760
|
-
// most one further cold start.
|
|
15761
|
-
try {
|
|
15762
|
-
const stored = getPlatform().storage.getItem('tarobase_last_auth_method');
|
|
15763
|
-
if (stored === 'phantom' && WebSessionManager.isAuthenticated())
|
|
15764
|
-
return true;
|
|
15765
|
-
}
|
|
15766
|
-
catch (_b) {
|
|
15767
|
-
return true;
|
|
15768
|
-
}
|
|
15769
|
-
return false;
|
|
15770
|
-
}
|
|
15771
15740
|
static getInstance(networkUrl, config) {
|
|
15772
15741
|
if (!PhantomWalletProvider.instance) {
|
|
15773
15742
|
new PhantomWalletProvider(networkUrl, config);
|
|
@@ -15843,7 +15812,7 @@ class PhantomWalletProvider {
|
|
|
15843
15812
|
const sdkProviders = this.resolvedProviders.length > 0 ? [...this.resolvedProviders] : ['injected'];
|
|
15844
15813
|
// Inner component that uses hooks
|
|
15845
15814
|
const PhantomHooksComponent = () => {
|
|
15846
|
-
var _a, _b;
|
|
15815
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
15847
15816
|
const phantom = usePhantom();
|
|
15848
15817
|
const { connect, error: connectError } = useConnect();
|
|
15849
15818
|
const { disconnect, isDisconnecting } = useDisconnect();
|
|
@@ -16126,63 +16095,13 @@ class PhantomWalletProvider {
|
|
|
16126
16095
|
}
|
|
16127
16096
|
};
|
|
16128
16097
|
const handleMobileWalletClick = async () => {
|
|
16129
|
-
var _a;
|
|
16130
|
-
console.log('[MWA-DEBUG] handleMobileWalletClick: entered', {
|
|
16131
|
-
documentHasFocus: typeof document !== 'undefined' ? document.hasFocus() : 'n/a',
|
|
16132
|
-
visibilityState: typeof document !== 'undefined' ? document.visibilityState : 'n/a',
|
|
16133
|
-
displayMode: typeof window !== 'undefined' && window.matchMedia
|
|
16134
|
-
? (window.matchMedia('(display-mode: standalone)').matches ? 'standalone' : 'browser')
|
|
16135
|
-
: 'n/a',
|
|
16136
|
-
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : 'n/a',
|
|
16137
|
-
timestamp: Date.now(),
|
|
16138
|
-
});
|
|
16139
16098
|
that.loginInProgress = false;
|
|
16140
16099
|
walletClickedRef.current = true;
|
|
16141
16100
|
setShowWalletModal(false);
|
|
16142
|
-
// Hide the Phantom provider container while MWA's transact()
|
|
16143
|
-
// is opening the localhost WebSocket and Chrome surfaces the
|
|
16144
|
-
// "Apps on Device" / Local Network Access permission dialog.
|
|
16145
|
-
//
|
|
16146
|
-
// The container is a singleton fixed full-viewport <div> with
|
|
16147
|
-
// z-index 2147483647 + pointer-events: none parked on body.
|
|
16148
|
-
// Even though pointer-events: none should let touches pass
|
|
16149
|
-
// through, on Android Chrome (both PWA and regular browser)
|
|
16150
|
-
// the system permission dialog rendered during MWA's
|
|
16151
|
-
// handshake comes up with disabled-looking buttons until the
|
|
16152
|
-
// activity is forced to re-composite (the user's
|
|
16153
|
-
// background+reopen workaround).
|
|
16154
|
-
//
|
|
16155
|
-
// Display:none-ing the container during MWA login removes it
|
|
16156
|
-
// from the layout tree entirely so there's nothing for the
|
|
16157
|
-
// dialog hit-testing / compositor to get confused by. It's
|
|
16158
|
-
// restored after MWA login resolves or rejects.
|
|
16159
|
-
const containerEl = that.containerElement;
|
|
16160
|
-
const previousDisplay = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.display) !== null && _a !== void 0 ? _a : '';
|
|
16161
|
-
console.log('[MWA-DEBUG] container before hide', {
|
|
16162
|
-
hasContainer: !!containerEl,
|
|
16163
|
-
previousDisplay,
|
|
16164
|
-
inDom: containerEl ? document.body.contains(containerEl) : false,
|
|
16165
|
-
zIndex: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.zIndex,
|
|
16166
|
-
pointerEvents: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.pointerEvents,
|
|
16167
|
-
});
|
|
16168
|
-
if (containerEl) {
|
|
16169
|
-
containerEl.style.display = 'none';
|
|
16170
|
-
}
|
|
16171
|
-
console.log('[MWA-DEBUG] container hidden, computed display now:', containerEl ? getComputedStyle(containerEl).display : 'n/a');
|
|
16172
|
-
const restoreContainer = () => {
|
|
16173
|
-
if (containerEl) {
|
|
16174
|
-
containerEl.style.display = previousDisplay;
|
|
16175
|
-
console.log('[MWA-DEBUG] container restored, display:', containerEl.style.display);
|
|
16176
|
-
}
|
|
16177
|
-
};
|
|
16178
16101
|
if (that.onSwitchToMWA) {
|
|
16179
16102
|
try {
|
|
16180
|
-
console.log('[MWA-DEBUG] calling onSwitchToMWA');
|
|
16181
16103
|
const mwaProvider = await that.onSwitchToMWA();
|
|
16182
|
-
console.log('[MWA-DEBUG] onSwitchToMWA resolved, calling mwaProvider.login()');
|
|
16183
16104
|
const user = await mwaProvider.login();
|
|
16184
|
-
console.log('[MWA-DEBUG] mwaProvider.login() resolved', { hasUser: !!user });
|
|
16185
|
-
restoreContainer();
|
|
16186
16105
|
if (that.pendingLogin && user) {
|
|
16187
16106
|
that.pendingLogin.resolve(user);
|
|
16188
16107
|
that.pendingLogin = null;
|
|
@@ -16193,22 +16112,12 @@ class PhantomWalletProvider {
|
|
|
16193
16112
|
}
|
|
16194
16113
|
}
|
|
16195
16114
|
catch (error) {
|
|
16196
|
-
console.log('[MWA-DEBUG] mwaProvider.login() threw', {
|
|
16197
|
-
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
16198
|
-
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
16199
|
-
errorCode: error === null || error === void 0 ? void 0 : error.code,
|
|
16200
|
-
});
|
|
16201
|
-
restoreContainer();
|
|
16202
16115
|
if (that.pendingLogin) {
|
|
16203
16116
|
that.pendingLogin.reject(error);
|
|
16204
16117
|
that.pendingLogin = null;
|
|
16205
16118
|
}
|
|
16206
16119
|
}
|
|
16207
16120
|
}
|
|
16208
|
-
else {
|
|
16209
|
-
console.log('[MWA-DEBUG] no onSwitchToMWA configured');
|
|
16210
|
-
restoreContainer();
|
|
16211
|
-
}
|
|
16212
16121
|
};
|
|
16213
16122
|
const handleCloseModal = () => {
|
|
16214
16123
|
setShowWalletModal(false);
|
|
@@ -16222,31 +16131,59 @@ class PhantomWalletProvider {
|
|
|
16222
16131
|
if (!showWalletModal) {
|
|
16223
16132
|
return null;
|
|
16224
16133
|
}
|
|
16225
|
-
const
|
|
16226
|
-
const
|
|
16227
|
-
const
|
|
16228
|
-
const
|
|
16229
|
-
const
|
|
16134
|
+
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';
|
|
16135
|
+
const isLight = effectiveTheme === 'light';
|
|
16136
|
+
const bgColor = isLight ? '#FFFFFF' : '#111113';
|
|
16137
|
+
const cardBorder = isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.07)';
|
|
16138
|
+
const textColor = isLight ? '#0f0f0f' : '#f5f5f5';
|
|
16139
|
+
const subTextColor = isLight ? 'rgba(0,0,0,0.45)' : 'rgba(255,255,255,0.4)';
|
|
16140
|
+
const btnBg = isLight ? 'rgba(0,0,0,0.04)' : 'rgba(255,255,255,0.05)';
|
|
16141
|
+
const btnHoverBg = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.09)';
|
|
16142
|
+
const btnBorder = isLight ? '1px solid rgba(0,0,0,0.10)' : '1px solid rgba(255,255,255,0.09)';
|
|
16143
|
+
const dividerColor = isLight ? 'rgba(0,0,0,0.10)' : 'rgba(255,255,255,0.08)';
|
|
16230
16144
|
const fontFamily = '"SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif';
|
|
16231
16145
|
const buttonStyle = (id) => ({
|
|
16232
16146
|
display: 'flex',
|
|
16233
16147
|
alignItems: 'center',
|
|
16234
16148
|
justifyContent: 'center',
|
|
16235
|
-
gap: '
|
|
16149
|
+
gap: '10px',
|
|
16236
16150
|
width: '100%',
|
|
16237
|
-
height: '
|
|
16238
|
-
padding: '
|
|
16239
|
-
border:
|
|
16240
|
-
borderRadius: '
|
|
16151
|
+
height: '52px',
|
|
16152
|
+
padding: '0 20px',
|
|
16153
|
+
border: btnBorder,
|
|
16154
|
+
borderRadius: '12px',
|
|
16241
16155
|
backgroundColor: hoveredBtn === id ? btnHoverBg : btnBg,
|
|
16242
16156
|
color: textColor,
|
|
16243
16157
|
fontFamily,
|
|
16244
16158
|
fontSize: '14px',
|
|
16245
|
-
fontWeight: '
|
|
16246
|
-
lineHeight: '
|
|
16247
|
-
letterSpacing: '
|
|
16159
|
+
fontWeight: '500',
|
|
16160
|
+
lineHeight: '1',
|
|
16161
|
+
letterSpacing: '0',
|
|
16248
16162
|
cursor: 'pointer',
|
|
16249
|
-
transition: 'background-color 0.
|
|
16163
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
16164
|
+
boxSizing: 'border-box',
|
|
16165
|
+
});
|
|
16166
|
+
const emailButtonStyle = (id) => ({
|
|
16167
|
+
display: 'flex',
|
|
16168
|
+
alignItems: 'center',
|
|
16169
|
+
justifyContent: 'center',
|
|
16170
|
+
gap: '10px',
|
|
16171
|
+
width: '100%',
|
|
16172
|
+
height: '52px',
|
|
16173
|
+
padding: '0 20px',
|
|
16174
|
+
border: isLight ? '1px solid rgba(0,0,0,0.15)' : '1px solid rgba(255,255,255,0.15)',
|
|
16175
|
+
borderRadius: '12px',
|
|
16176
|
+
backgroundColor: hoveredBtn === id
|
|
16177
|
+
? (isLight ? 'rgba(0,0,0,0.06)' : 'rgba(255,255,255,0.12)')
|
|
16178
|
+
: (isLight ? 'rgba(0,0,0,0.03)' : 'rgba(255,255,255,0.08)'),
|
|
16179
|
+
color: textColor,
|
|
16180
|
+
fontFamily,
|
|
16181
|
+
fontSize: '14px',
|
|
16182
|
+
fontWeight: '500',
|
|
16183
|
+
lineHeight: '1',
|
|
16184
|
+
cursor: 'pointer',
|
|
16185
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
16186
|
+
boxSizing: 'border-box',
|
|
16250
16187
|
});
|
|
16251
16188
|
const walletButtons = [];
|
|
16252
16189
|
// Google OAuth button — shown when 'google' is in resolved providers
|
|
@@ -16258,7 +16195,7 @@ class PhantomWalletProvider {
|
|
|
16258
16195
|
onMouseEnter: () => setHoveredBtn('google-oauth'),
|
|
16259
16196
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16260
16197
|
}, React$1.createElement('svg', {
|
|
16261
|
-
width: '
|
|
16198
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
16262
16199
|
style: { flexShrink: '0' },
|
|
16263
16200
|
}, React$1.createElement('path', {
|
|
16264
16201
|
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',
|
|
@@ -16283,7 +16220,7 @@ class PhantomWalletProvider {
|
|
|
16283
16220
|
onMouseEnter: () => setHoveredBtn('apple-oauth'),
|
|
16284
16221
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16285
16222
|
}, React$1.createElement('svg', {
|
|
16286
|
-
width: '
|
|
16223
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
16287
16224
|
fill: textColor,
|
|
16288
16225
|
style: { flexShrink: '0' },
|
|
16289
16226
|
}, React$1.createElement('path', {
|
|
@@ -16335,11 +16272,9 @@ class PhantomWalletProvider {
|
|
|
16335
16272
|
onClick: handleMobileWalletClick,
|
|
16336
16273
|
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
16337
16274
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16338
|
-
},
|
|
16339
|
-
|
|
16340
|
-
|
|
16341
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
16342
|
-
style: { flexShrink: '0' },
|
|
16275
|
+
}, React$1.createElement('svg', {
|
|
16276
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
16277
|
+
style: { flexShrink: '0', opacity: '0.85' },
|
|
16343
16278
|
},
|
|
16344
16279
|
// Phone outline
|
|
16345
16280
|
React$1.createElement('rect', {
|
|
@@ -16361,23 +16296,51 @@ class PhantomWalletProvider {
|
|
|
16361
16296
|
if (that.config.enablePrivyFallback) {
|
|
16362
16297
|
walletButtons.push(React$1.createElement('button', {
|
|
16363
16298
|
key: 'email-login',
|
|
16364
|
-
style:
|
|
16299
|
+
style: emailButtonStyle('email-login'),
|
|
16365
16300
|
onClick: handleEmailClick,
|
|
16366
16301
|
onMouseEnter: () => setHoveredBtn('email-login'),
|
|
16367
16302
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16368
|
-
},
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
16372
|
-
style: { flexShrink: '0' },
|
|
16303
|
+
}, React$1.createElement('svg', {
|
|
16304
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
16305
|
+
style: { flexShrink: '0', opacity: '0.7' },
|
|
16373
16306
|
}, React$1.createElement('path', {
|
|
16374
16307
|
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',
|
|
16375
|
-
stroke: textColor, strokeWidth: '
|
|
16308
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
16376
16309
|
}), React$1.createElement('path', {
|
|
16377
16310
|
d: 'M22 6l-10 7L2 6',
|
|
16378
|
-
stroke: textColor, strokeWidth: '
|
|
16379
|
-
})), '
|
|
16311
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
16312
|
+
})), 'Continue with email'));
|
|
16380
16313
|
}
|
|
16314
|
+
// Split email button from the rest to insert OR divider
|
|
16315
|
+
const emailBtnIndex = walletButtons.findIndex((b) => b && b.key === 'email-login');
|
|
16316
|
+
const mainButtons = emailBtnIndex >= 0 ? walletButtons.slice(0, emailBtnIndex) : walletButtons;
|
|
16317
|
+
const emailButton = emailBtnIndex >= 0 ? walletButtons[emailBtnIndex] : null;
|
|
16318
|
+
// OR divider — shown when there are both wallet/social buttons and an email button
|
|
16319
|
+
const orDivider = (mainButtons.length > 0 && emailButton)
|
|
16320
|
+
? React$1.createElement('div', {
|
|
16321
|
+
key: 'or-divider',
|
|
16322
|
+
style: {
|
|
16323
|
+
display: 'flex',
|
|
16324
|
+
alignItems: 'center',
|
|
16325
|
+
gap: '12px',
|
|
16326
|
+
margin: '4px 0',
|
|
16327
|
+
},
|
|
16328
|
+
}, React$1.createElement('div', {
|
|
16329
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
16330
|
+
}), React$1.createElement('span', {
|
|
16331
|
+
style: {
|
|
16332
|
+
color: subTextColor,
|
|
16333
|
+
fontFamily,
|
|
16334
|
+
fontSize: '12px',
|
|
16335
|
+
fontWeight: '500',
|
|
16336
|
+
letterSpacing: '0.02em',
|
|
16337
|
+
textTransform: 'uppercase',
|
|
16338
|
+
userSelect: 'none',
|
|
16339
|
+
},
|
|
16340
|
+
}, 'or'), React$1.createElement('div', {
|
|
16341
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
16342
|
+
}))
|
|
16343
|
+
: null;
|
|
16381
16344
|
// Render custom modal
|
|
16382
16345
|
return React$1.createElement('div', {
|
|
16383
16346
|
// Overlay
|
|
@@ -16387,12 +16350,14 @@ class PhantomWalletProvider {
|
|
|
16387
16350
|
left: '0',
|
|
16388
16351
|
right: '0',
|
|
16389
16352
|
bottom: '0',
|
|
16390
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
16353
|
+
backgroundColor: isLight ? 'rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.65)',
|
|
16391
16354
|
display: 'flex',
|
|
16392
16355
|
alignItems: 'center',
|
|
16393
16356
|
justifyContent: 'center',
|
|
16394
16357
|
zIndex: 2147483647,
|
|
16395
16358
|
pointerEvents: 'auto',
|
|
16359
|
+
backdropFilter: 'blur(4px)',
|
|
16360
|
+
WebkitBackdropFilter: 'blur(4px)',
|
|
16396
16361
|
},
|
|
16397
16362
|
onClick: (e) => {
|
|
16398
16363
|
if (e.target === e.currentTarget)
|
|
@@ -16409,13 +16374,17 @@ class PhantomWalletProvider {
|
|
|
16409
16374
|
React$1.createElement('div', {
|
|
16410
16375
|
style: {
|
|
16411
16376
|
backgroundColor: bgColor,
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16377
|
+
border: cardBorder,
|
|
16378
|
+
borderRadius: '20px',
|
|
16379
|
+
width: '380px',
|
|
16380
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
16381
|
+
padding: '28px 24px 24px',
|
|
16416
16382
|
position: 'relative',
|
|
16417
|
-
boxShadow:
|
|
16383
|
+
boxShadow: isLight
|
|
16384
|
+
? '0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)'
|
|
16385
|
+
: '0 8px 40px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3)',
|
|
16418
16386
|
pointerEvents: 'auto',
|
|
16387
|
+
boxSizing: 'border-box',
|
|
16419
16388
|
},
|
|
16420
16389
|
onMouseDown: (e) => {
|
|
16421
16390
|
e.stopPropagation();
|
|
@@ -16424,26 +16393,30 @@ class PhantomWalletProvider {
|
|
|
16424
16393
|
e.stopPropagation();
|
|
16425
16394
|
},
|
|
16426
16395
|
},
|
|
16427
|
-
// Close button
|
|
16396
|
+
// Close button
|
|
16428
16397
|
React$1.createElement('button', {
|
|
16429
16398
|
onClick: handleCloseModal,
|
|
16430
16399
|
style: {
|
|
16431
16400
|
position: 'absolute',
|
|
16432
|
-
top: '
|
|
16433
|
-
right: '
|
|
16434
|
-
background: '
|
|
16435
|
-
border: '
|
|
16401
|
+
top: '14px',
|
|
16402
|
+
right: '14px',
|
|
16403
|
+
background: isLight ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.07)',
|
|
16404
|
+
border: isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.08)',
|
|
16405
|
+
borderRadius: '50%',
|
|
16406
|
+
width: '28px',
|
|
16407
|
+
height: '28px',
|
|
16436
16408
|
cursor: 'pointer',
|
|
16437
|
-
padding: '4px',
|
|
16438
16409
|
display: 'flex',
|
|
16439
16410
|
alignItems: 'center',
|
|
16440
16411
|
justifyContent: 'center',
|
|
16412
|
+
padding: '0',
|
|
16413
|
+
flexShrink: '0',
|
|
16441
16414
|
},
|
|
16442
16415
|
}, React$1.createElement('svg', {
|
|
16443
|
-
width: '
|
|
16416
|
+
width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none',
|
|
16444
16417
|
}, React$1.createElement('path', {
|
|
16445
|
-
d: '
|
|
16446
|
-
stroke:
|
|
16418
|
+
d: 'M11 1L1 11M1 1l10 10',
|
|
16419
|
+
stroke: subTextColor, strokeWidth: '1.75', strokeLinecap: 'round',
|
|
16447
16420
|
}))),
|
|
16448
16421
|
// App icon (if provided)
|
|
16449
16422
|
that.config.appIcon ? React$1.createElement('div', {
|
|
@@ -16451,27 +16424,40 @@ class PhantomWalletProvider {
|
|
|
16451
16424
|
}, React$1.createElement('img', {
|
|
16452
16425
|
src: that.config.appIcon,
|
|
16453
16426
|
alt: that.config.appName || 'App',
|
|
16454
|
-
style: { width: '
|
|
16427
|
+
style: { width: '44px', height: '44px', borderRadius: '10px' },
|
|
16455
16428
|
})) : null,
|
|
16456
16429
|
// Title
|
|
16457
16430
|
React$1.createElement('div', {
|
|
16458
16431
|
style: {
|
|
16459
16432
|
color: textColor,
|
|
16460
16433
|
fontFamily,
|
|
16461
|
-
fontSize: '
|
|
16434
|
+
fontSize: '17px',
|
|
16462
16435
|
fontWeight: '600',
|
|
16463
16436
|
textAlign: 'center',
|
|
16437
|
+
marginBottom: '6px',
|
|
16438
|
+
letterSpacing: '-0.2px',
|
|
16439
|
+
},
|
|
16440
|
+
}, (_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')),
|
|
16441
|
+
// Subtitle
|
|
16442
|
+
React$1.createElement('div', {
|
|
16443
|
+
style: {
|
|
16444
|
+
color: subTextColor,
|
|
16445
|
+
fontFamily,
|
|
16446
|
+
fontSize: '13px',
|
|
16447
|
+
fontWeight: '400',
|
|
16448
|
+
textAlign: 'center',
|
|
16464
16449
|
marginBottom: '24px',
|
|
16450
|
+
lineHeight: '1.4',
|
|
16465
16451
|
},
|
|
16466
|
-
}, '
|
|
16467
|
-
//
|
|
16452
|
+
}, (_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'),
|
|
16453
|
+
// Main buttons + OR divider + email button
|
|
16468
16454
|
React$1.createElement('div', {
|
|
16469
16455
|
style: {
|
|
16470
16456
|
display: 'flex',
|
|
16471
16457
|
flexDirection: 'column',
|
|
16472
16458
|
gap: '8px',
|
|
16473
16459
|
},
|
|
16474
|
-
}, ...
|
|
16460
|
+
}, ...mainButtons, orDivider, emailButton)));
|
|
16475
16461
|
};
|
|
16476
16462
|
// Wrapper component with PhantomProvider
|
|
16477
16463
|
const PhantomProviderWrapper = () => {
|
|
@@ -16504,13 +16490,6 @@ class PhantomWalletProvider {
|
|
|
16504
16490
|
if (this.initPromise) {
|
|
16505
16491
|
await this.initPromise;
|
|
16506
16492
|
}
|
|
16507
|
-
// Lazy-mount path: if initializeAsync deferred the React mount (e.g.
|
|
16508
|
-
// first-time visitor on Android Chrome PWA), do it now. We're being
|
|
16509
|
-
// called from a user-gesture flow like login(), so any Android intent
|
|
16510
|
-
// dialog that surfaces will appear with the activity already focused.
|
|
16511
|
-
if (!this.containerElement) {
|
|
16512
|
-
this.initialize();
|
|
16513
|
-
}
|
|
16514
16493
|
// Wait for SDK to be ready
|
|
16515
16494
|
await new Promise((resolve) => {
|
|
16516
16495
|
const check = () => {
|
|
@@ -16604,7 +16583,7 @@ class PhantomWalletProvider {
|
|
|
16604
16583
|
this.pendingLogin.reject = reject;
|
|
16605
16584
|
});
|
|
16606
16585
|
}
|
|
16607
|
-
|
|
16586
|
+
const loginPromise = new Promise((resolve, reject) => {
|
|
16608
16587
|
this.pendingLogin = { resolve, reject };
|
|
16609
16588
|
this.loginInProgress = true;
|
|
16610
16589
|
// Always use our custom wallet modal
|
|
@@ -16618,55 +16597,17 @@ class PhantomWalletProvider {
|
|
|
16618
16597
|
}
|
|
16619
16598
|
}, 180000);
|
|
16620
16599
|
});
|
|
16600
|
+
return loginPromise.finally(() => {
|
|
16601
|
+
this.loginOverrides = null;
|
|
16602
|
+
});
|
|
16621
16603
|
}
|
|
16622
16604
|
async restoreSession() {
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16627
|
-
// before the PWA activity has window focus on Solana Seeker. The
|
|
16628
|
-
// resulting "access other apps and services" system dialog renders
|
|
16629
|
-
// with grayed-out buttons.
|
|
16630
|
-
//
|
|
16631
|
-
// Wrap getSession() in try/catch: WebSessionManager.getSession() runs
|
|
16632
|
-
// JSON.parse on the stored session *outside* its internal try/catch,
|
|
16633
|
-
// so genuinely malformed JSON in localStorage would propagate through
|
|
16634
|
-
// restoreSession() and break init() entirely. Treat any throw as
|
|
16635
|
-
// "no session" and fall through to the cleanup path so corrupted
|
|
16636
|
-
// storage is recoverable on next load.
|
|
16637
|
-
let session;
|
|
16638
|
-
try {
|
|
16639
|
-
session = await WebSessionManager.getSession();
|
|
16640
|
-
}
|
|
16641
|
-
catch (_a) {
|
|
16642
|
-
session = null;
|
|
16643
|
-
}
|
|
16644
|
-
if (!session) {
|
|
16645
|
-
// Tidy up storage so we don't leave junk behind:
|
|
16646
|
-
// (a) clearSession() removes any stale or unparseable session
|
|
16647
|
-
// storage entry. WebSessionManager.getSession() can't reach
|
|
16648
|
-
// its own clearSession() if JSON.parse threw. Idempotent —
|
|
16649
|
-
// safe to call unconditionally here.
|
|
16650
|
-
// (b) Drop the auth-method marker if it's stale.
|
|
16651
|
-
// WebSessionManager.clearSession() only removes the session
|
|
16652
|
-
// storage key, not the marker — so without this cleanup
|
|
16653
|
-
// shouldMountEagerly() would keep eager-mounting on every
|
|
16654
|
-
// future cold start.
|
|
16655
|
-
try {
|
|
16656
|
-
WebSessionManager.clearSession();
|
|
16657
|
-
}
|
|
16658
|
-
catch ( /* best-effort */_b) { /* best-effort */ }
|
|
16659
|
-
try {
|
|
16660
|
-
if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
|
|
16661
|
-
getPlatform().storage.removeItem('tarobase_last_auth_method');
|
|
16662
|
-
}
|
|
16663
|
-
}
|
|
16664
|
-
catch (_c) {
|
|
16665
|
-
// storage unavailable — best-effort cleanup
|
|
16666
|
-
}
|
|
16667
|
-
return null;
|
|
16605
|
+
await this.ensureReady();
|
|
16606
|
+
const session = await WebSessionManager.getSession();
|
|
16607
|
+
if (session) {
|
|
16608
|
+
return { provider: this, address: session.address };
|
|
16668
16609
|
}
|
|
16669
|
-
return
|
|
16610
|
+
return null;
|
|
16670
16611
|
}
|
|
16671
16612
|
async address() {
|
|
16672
16613
|
var _a, _b, _c, _d;
|
|
@@ -20157,137 +20098,235 @@ function createSolanaRpcSubscriptionsFromTransport(transport) {
|
|
|
20157
20098
|
});
|
|
20158
20099
|
}
|
|
20159
20100
|
|
|
20160
|
-
|
|
20161
|
-
|
|
20162
|
-
|
|
20163
|
-
|
|
20164
|
-
|
|
20165
|
-
|
|
20166
|
-
|
|
20167
|
-
|
|
20168
|
-
|
|
20169
|
-
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
20180
|
-
|
|
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
|
-
|
|
20101
|
+
var safeBuffer = {exports: {}};
|
|
20102
|
+
|
|
20103
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
20104
|
+
|
|
20105
|
+
var hasRequiredSafeBuffer;
|
|
20106
|
+
|
|
20107
|
+
function requireSafeBuffer () {
|
|
20108
|
+
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
20109
|
+
hasRequiredSafeBuffer = 1;
|
|
20110
|
+
(function (module, exports$1) {
|
|
20111
|
+
/* eslint-disable node/no-deprecated-api */
|
|
20112
|
+
var buffer = requireBuffer();
|
|
20113
|
+
var Buffer = buffer.Buffer;
|
|
20114
|
+
|
|
20115
|
+
// alternative to using Object.keys for old browsers
|
|
20116
|
+
function copyProps (src, dst) {
|
|
20117
|
+
for (var key in src) {
|
|
20118
|
+
dst[key] = src[key];
|
|
20119
|
+
}
|
|
20120
|
+
}
|
|
20121
|
+
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
20122
|
+
module.exports = buffer;
|
|
20123
|
+
} else {
|
|
20124
|
+
// Copy properties from require('buffer')
|
|
20125
|
+
copyProps(buffer, exports$1);
|
|
20126
|
+
exports$1.Buffer = SafeBuffer;
|
|
20127
|
+
}
|
|
20128
|
+
|
|
20129
|
+
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
20130
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
20131
|
+
}
|
|
20132
|
+
|
|
20133
|
+
SafeBuffer.prototype = Object.create(Buffer.prototype);
|
|
20134
|
+
|
|
20135
|
+
// Copy static methods from Buffer
|
|
20136
|
+
copyProps(Buffer, SafeBuffer);
|
|
20137
|
+
|
|
20138
|
+
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
20139
|
+
if (typeof arg === 'number') {
|
|
20140
|
+
throw new TypeError('Argument must not be a number')
|
|
20141
|
+
}
|
|
20142
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
20143
|
+
};
|
|
20144
|
+
|
|
20145
|
+
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
20146
|
+
if (typeof size !== 'number') {
|
|
20147
|
+
throw new TypeError('Argument must be a number')
|
|
20148
|
+
}
|
|
20149
|
+
var buf = Buffer(size);
|
|
20150
|
+
if (fill !== undefined) {
|
|
20151
|
+
if (typeof encoding === 'string') {
|
|
20152
|
+
buf.fill(fill, encoding);
|
|
20153
|
+
} else {
|
|
20154
|
+
buf.fill(fill);
|
|
20155
|
+
}
|
|
20156
|
+
} else {
|
|
20157
|
+
buf.fill(0);
|
|
20158
|
+
}
|
|
20159
|
+
return buf
|
|
20160
|
+
};
|
|
20161
|
+
|
|
20162
|
+
SafeBuffer.allocUnsafe = function (size) {
|
|
20163
|
+
if (typeof size !== 'number') {
|
|
20164
|
+
throw new TypeError('Argument must be a number')
|
|
20165
|
+
}
|
|
20166
|
+
return Buffer(size)
|
|
20167
|
+
};
|
|
20168
|
+
|
|
20169
|
+
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
20170
|
+
if (typeof size !== 'number') {
|
|
20171
|
+
throw new TypeError('Argument must be a number')
|
|
20172
|
+
}
|
|
20173
|
+
return buffer.SlowBuffer(size)
|
|
20174
|
+
};
|
|
20175
|
+
} (safeBuffer, safeBuffer.exports));
|
|
20176
|
+
return safeBuffer.exports;
|
|
20177
|
+
}
|
|
20178
|
+
|
|
20179
|
+
var src;
|
|
20180
|
+
var hasRequiredSrc;
|
|
20181
|
+
|
|
20182
|
+
function requireSrc () {
|
|
20183
|
+
if (hasRequiredSrc) return src;
|
|
20184
|
+
hasRequiredSrc = 1;
|
|
20185
|
+
// base-x encoding / decoding
|
|
20186
|
+
// Copyright (c) 2018 base-x contributors
|
|
20187
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
20188
|
+
// Distributed under the MIT software license, see the accompanying
|
|
20189
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
20190
|
+
// @ts-ignore
|
|
20191
|
+
var _Buffer = requireSafeBuffer().Buffer;
|
|
20192
|
+
function base (ALPHABET) {
|
|
20193
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
20194
|
+
var BASE_MAP = new Uint8Array(256);
|
|
20195
|
+
for (var j = 0; j < BASE_MAP.length; j++) {
|
|
20196
|
+
BASE_MAP[j] = 255;
|
|
20197
|
+
}
|
|
20198
|
+
for (var i = 0; i < ALPHABET.length; i++) {
|
|
20199
|
+
var x = ALPHABET.charAt(i);
|
|
20200
|
+
var xc = x.charCodeAt(0);
|
|
20201
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
20202
|
+
BASE_MAP[xc] = i;
|
|
20203
|
+
}
|
|
20204
|
+
var BASE = ALPHABET.length;
|
|
20205
|
+
var LEADER = ALPHABET.charAt(0);
|
|
20206
|
+
var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
20207
|
+
var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
20208
|
+
function encode (source) {
|
|
20209
|
+
if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source); }
|
|
20210
|
+
if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }
|
|
20211
|
+
if (source.length === 0) { return '' }
|
|
20212
|
+
// Skip & count leading zeroes.
|
|
20213
|
+
var zeroes = 0;
|
|
20214
|
+
var length = 0;
|
|
20215
|
+
var pbegin = 0;
|
|
20216
|
+
var pend = source.length;
|
|
20217
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
20218
|
+
pbegin++;
|
|
20219
|
+
zeroes++;
|
|
20220
|
+
}
|
|
20221
|
+
// Allocate enough space in big-endian base58 representation.
|
|
20222
|
+
var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
20223
|
+
var b58 = new Uint8Array(size);
|
|
20224
|
+
// Process the bytes.
|
|
20225
|
+
while (pbegin !== pend) {
|
|
20226
|
+
var carry = source[pbegin];
|
|
20227
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
20228
|
+
var i = 0;
|
|
20229
|
+
for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
20230
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
20231
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
20232
|
+
carry = (carry / BASE) >>> 0;
|
|
20233
|
+
}
|
|
20234
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20235
|
+
length = i;
|
|
20236
|
+
pbegin++;
|
|
20237
|
+
}
|
|
20238
|
+
// Skip leading zeroes in base58 result.
|
|
20239
|
+
var it2 = size - length;
|
|
20240
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
20241
|
+
it2++;
|
|
20242
|
+
}
|
|
20243
|
+
// Translate the result into a string.
|
|
20244
|
+
var str = LEADER.repeat(zeroes);
|
|
20245
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
20246
|
+
return str
|
|
20247
|
+
}
|
|
20248
|
+
function decodeUnsafe (source) {
|
|
20249
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
20250
|
+
if (source.length === 0) { return _Buffer.alloc(0) }
|
|
20251
|
+
var psz = 0;
|
|
20252
|
+
// Skip and count leading '1's.
|
|
20253
|
+
var zeroes = 0;
|
|
20254
|
+
var length = 0;
|
|
20255
|
+
while (source[psz] === LEADER) {
|
|
20256
|
+
zeroes++;
|
|
20257
|
+
psz++;
|
|
20258
|
+
}
|
|
20259
|
+
// Allocate enough space in big-endian base256 representation.
|
|
20260
|
+
var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
20261
|
+
var b256 = new Uint8Array(size);
|
|
20262
|
+
// Process the characters.
|
|
20263
|
+
while (psz < source.length) {
|
|
20264
|
+
// Find code of next character
|
|
20265
|
+
var charCode = source.charCodeAt(psz);
|
|
20266
|
+
// Base map can not be indexed using char code
|
|
20267
|
+
if (charCode > 255) { return }
|
|
20268
|
+
// Decode character
|
|
20269
|
+
var carry = BASE_MAP[charCode];
|
|
20270
|
+
// Invalid character
|
|
20271
|
+
if (carry === 255) { return }
|
|
20272
|
+
var i = 0;
|
|
20273
|
+
for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
20274
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
20275
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
20276
|
+
carry = (carry / 256) >>> 0;
|
|
20277
|
+
}
|
|
20278
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20279
|
+
length = i;
|
|
20280
|
+
psz++;
|
|
20281
|
+
}
|
|
20282
|
+
// Skip leading zeroes in b256.
|
|
20283
|
+
var it4 = size - length;
|
|
20284
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
20285
|
+
it4++;
|
|
20286
|
+
}
|
|
20287
|
+
var vch = _Buffer.allocUnsafe(zeroes + (size - it4));
|
|
20288
|
+
vch.fill(0x00, 0, zeroes);
|
|
20289
|
+
var j = zeroes;
|
|
20290
|
+
while (it4 !== size) {
|
|
20291
|
+
vch[j++] = b256[it4++];
|
|
20292
|
+
}
|
|
20293
|
+
return vch
|
|
20294
|
+
}
|
|
20295
|
+
function decode (string) {
|
|
20296
|
+
var buffer = decodeUnsafe(string);
|
|
20297
|
+
if (buffer) { return buffer }
|
|
20298
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
20299
|
+
}
|
|
20300
|
+
return {
|
|
20301
|
+
encode: encode,
|
|
20302
|
+
decodeUnsafe: decodeUnsafe,
|
|
20303
|
+
decode: decode
|
|
20304
|
+
}
|
|
20305
|
+
}
|
|
20306
|
+
src = base;
|
|
20307
|
+
return src;
|
|
20308
|
+
}
|
|
20309
|
+
|
|
20310
|
+
var bs58$1;
|
|
20311
|
+
var hasRequiredBs58;
|
|
20312
|
+
|
|
20313
|
+
function requireBs58 () {
|
|
20314
|
+
if (hasRequiredBs58) return bs58$1;
|
|
20315
|
+
hasRequiredBs58 = 1;
|
|
20316
|
+
var basex = requireSrc();
|
|
20317
|
+
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
20318
|
+
|
|
20319
|
+
bs58$1 = basex(ALPHABET);
|
|
20320
|
+
return bs58$1;
|
|
20282
20321
|
}
|
|
20283
20322
|
|
|
20284
|
-
var
|
|
20285
|
-
var bs58 =
|
|
20323
|
+
var bs58Exports = requireBs58();
|
|
20324
|
+
var bs58 = /*@__PURE__*/getDefaultExportFromCjs$1(bs58Exports);
|
|
20286
20325
|
|
|
20287
|
-
var index = /*#__PURE__*/
|
|
20326
|
+
var index = /*#__PURE__*/_mergeNamespaces({
|
|
20288
20327
|
__proto__: null,
|
|
20289
20328
|
default: bs58
|
|
20290
|
-
});
|
|
20329
|
+
}, [bs58Exports]);
|
|
20291
20330
|
|
|
20292
20331
|
const SURFNET_RPC_URL$1 = "https://surfpool.fly.dev";
|
|
20293
20332
|
let React;
|
|
@@ -21189,63 +21228,6 @@ function isMobileWalletAvailable() {
|
|
|
21189
21228
|
return detectAndroid();
|
|
21190
21229
|
}
|
|
21191
21230
|
const ED25519_SIGNATURE_LENGTH = 64;
|
|
21192
|
-
/**
|
|
21193
|
-
* On Android Chrome PWA (e.g. Solana Seeker in standalone mode), MWA's
|
|
21194
|
-
* transact() opens a WebSocket to ws://localhost:<port>/solana-wallet to
|
|
21195
|
-
* handshake with the wallet app on the device. Chrome guards localhost
|
|
21196
|
-
* connections behind the Local Network Access ("Apps on Device") permission
|
|
21197
|
-
* dialog. The dialog inherits the activity's window-focus state at spawn
|
|
21198
|
-
* time — so if focus is in transit (e.g. just after a Phantom-modal close
|
|
21199
|
-
* triggers a React commit), the dialog renders with grayed-out Allow/Block
|
|
21200
|
-
* buttons and only becomes interactive after a manual background→resume
|
|
21201
|
-
* (which forces an onPause→onResume cycle on the activity).
|
|
21202
|
-
*
|
|
21203
|
-
* Wait for window focus to settle, then yield one frame, before opening
|
|
21204
|
-
* the WebSocket. This makes the system dialog spawn into a focused activity
|
|
21205
|
-
* so its buttons are immediately tappable.
|
|
21206
|
-
*/
|
|
21207
|
-
async function awaitActivityFocus() {
|
|
21208
|
-
var _a;
|
|
21209
|
-
if (typeof document === 'undefined' || typeof window === 'undefined')
|
|
21210
|
-
return;
|
|
21211
|
-
const t0 = Date.now();
|
|
21212
|
-
const initialHasFocus = document.hasFocus();
|
|
21213
|
-
console.log('[MWA-DEBUG] awaitActivityFocus: enter', {
|
|
21214
|
-
hasFocus: initialHasFocus,
|
|
21215
|
-
visibilityState: document.visibilityState,
|
|
21216
|
-
activeElement: (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName,
|
|
21217
|
-
});
|
|
21218
|
-
if (!initialHasFocus) {
|
|
21219
|
-
let resolvedBy = 'pending';
|
|
21220
|
-
await new Promise((resolve) => {
|
|
21221
|
-
const onFocus = () => {
|
|
21222
|
-
window.removeEventListener('focus', onFocus);
|
|
21223
|
-
resolvedBy = 'focus-event';
|
|
21224
|
-
resolve();
|
|
21225
|
-
};
|
|
21226
|
-
window.addEventListener('focus', onFocus);
|
|
21227
|
-
// Fallback in case the focus event never fires (e.g. activity
|
|
21228
|
-
// already focused but document.hasFocus() momentarily lies during
|
|
21229
|
-
// a React commit). 600ms is a perceptual ceiling — beyond this
|
|
21230
|
-
// the user notices a stall, so we'd rather take the focus race
|
|
21231
|
-
// than block forever.
|
|
21232
|
-
setTimeout(() => {
|
|
21233
|
-
window.removeEventListener('focus', onFocus);
|
|
21234
|
-
if (resolvedBy === 'pending')
|
|
21235
|
-
resolvedBy = 'timeout';
|
|
21236
|
-
resolve();
|
|
21237
|
-
}, 600);
|
|
21238
|
-
});
|
|
21239
|
-
console.log('[MWA-DEBUG] awaitActivityFocus: wait resolved', { resolvedBy, waitedMs: Date.now() - t0 });
|
|
21240
|
-
}
|
|
21241
|
-
// Yield to next paint so any pending React commits / focus changes have
|
|
21242
|
-
// flushed before the WebSocket open spawns the system dialog.
|
|
21243
|
-
await new Promise((r) => requestAnimationFrame(() => r()));
|
|
21244
|
-
console.log('[MWA-DEBUG] awaitActivityFocus: exit', {
|
|
21245
|
-
hasFocus: document.hasFocus(),
|
|
21246
|
-
totalMs: Date.now() - t0,
|
|
21247
|
-
});
|
|
21248
|
-
}
|
|
21249
21231
|
// Dynamically imported MWA protocol module
|
|
21250
21232
|
let mwaProtocolModule = null;
|
|
21251
21233
|
let mwaProtocolLoadPromise = null;
|
|
@@ -21258,7 +21240,7 @@ async function loadMwaProtocol() {
|
|
|
21258
21240
|
return mwaProtocolLoadPromise;
|
|
21259
21241
|
mwaProtocolLoadPromise = (async () => {
|
|
21260
21242
|
try {
|
|
21261
|
-
mwaProtocolModule = await import('./index.browser-
|
|
21243
|
+
mwaProtocolModule = await import('./index.browser-Dbq5Qf1G.esm.js');
|
|
21262
21244
|
}
|
|
21263
21245
|
catch (e) {
|
|
21264
21246
|
console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
|
|
@@ -21280,7 +21262,7 @@ async function registerMobileWalletAdapter(config) {
|
|
|
21280
21262
|
if (typeof window === 'undefined')
|
|
21281
21263
|
return;
|
|
21282
21264
|
try {
|
|
21283
|
-
const walletStandardMobile = await import('./index.browser-
|
|
21265
|
+
const walletStandardMobile = await import('./index.browser-DCOvqSUT.esm.js');
|
|
21284
21266
|
const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
|
|
21285
21267
|
if (!registerMwa) {
|
|
21286
21268
|
console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
|
|
@@ -21409,17 +21391,14 @@ class SolanaMobileWalletProvider {
|
|
|
21409
21391
|
}
|
|
21410
21392
|
async login() {
|
|
21411
21393
|
var _a, _b, _c, _d, _e;
|
|
21412
|
-
console.log('[MWA-DEBUG] SolanaMobileWalletProvider.login: enter');
|
|
21413
21394
|
setAuthLoading(true);
|
|
21414
21395
|
try {
|
|
21415
21396
|
await loadMwaProtocol();
|
|
21416
|
-
console.log('[MWA-DEBUG] loadMwaProtocol resolved');
|
|
21417
21397
|
const { transact } = mwaProtocolModule;
|
|
21418
21398
|
// Quick check: if we already have auth state and a valid session, skip
|
|
21419
21399
|
if (this.authorizedPublicKey) {
|
|
21420
21400
|
const existingSession = await WebSessionManager.getSession();
|
|
21421
21401
|
if (existingSession && existingSession.address === this.authorizedPublicKey) {
|
|
21422
|
-
console.log('[MWA-DEBUG] login: returning existing session, no transact');
|
|
21423
21402
|
const user = { provider: this, address: this.authorizedPublicKey };
|
|
21424
21403
|
setCurrentUser(user);
|
|
21425
21404
|
return user;
|
|
@@ -21427,12 +21406,8 @@ class SolanaMobileWalletProvider {
|
|
|
21427
21406
|
}
|
|
21428
21407
|
// Pre-fetch nonce from server while wallet is not yet connected
|
|
21429
21408
|
const nonce = await genAuthNonce();
|
|
21430
|
-
console.log('[MWA-DEBUG] login: nonce fetched, awaiting activity focus');
|
|
21431
|
-
await awaitActivityFocus();
|
|
21432
|
-
console.log('[MWA-DEBUG] login: about to call transact() — WebSocket to localhost will open now');
|
|
21433
21409
|
// Single transact() call: authorize + signMessages — one wallet popup
|
|
21434
21410
|
const result = await transact(async (wallet) => {
|
|
21435
|
-
console.log('[MWA-DEBUG] transact callback running — WebSocket connected, calling wallet.authorize');
|
|
21436
21411
|
// Step 1: Authorize — user approves the dApp
|
|
21437
21412
|
const authResult = await wallet.authorize({
|
|
21438
21413
|
identity: this.appIdentity,
|
|
@@ -21462,7 +21437,6 @@ class SolanaMobileWalletProvider {
|
|
|
21462
21437
|
walletUriBase: authResult.wallet_uri_base,
|
|
21463
21438
|
};
|
|
21464
21439
|
}, this.getAssociationConfig());
|
|
21465
|
-
console.log('[MWA-DEBUG] login: transact() resolved successfully');
|
|
21466
21440
|
// Store MWA auth state for reauthorization in subsequent transact() calls
|
|
21467
21441
|
this.authToken = result.authToken;
|
|
21468
21442
|
this.walletUriBase = result.walletUriBase;
|
|
@@ -21489,12 +21463,6 @@ class SolanaMobileWalletProvider {
|
|
|
21489
21463
|
return user;
|
|
21490
21464
|
}
|
|
21491
21465
|
catch (error) {
|
|
21492
|
-
console.log('[MWA-DEBUG] login caught error', {
|
|
21493
|
-
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
21494
|
-
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
21495
|
-
errorCode: error === null || error === void 0 ? void 0 : error.code,
|
|
21496
|
-
hasFocus: typeof document !== 'undefined' ? document.hasFocus() : 'n/a',
|
|
21497
|
-
});
|
|
21498
21466
|
const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
|
|
21499
21467
|
((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||
|
|
21500
21468
|
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||
|
|
@@ -21526,7 +21494,6 @@ class SolanaMobileWalletProvider {
|
|
|
21526
21494
|
await loadMwaProtocol();
|
|
21527
21495
|
const { transact } = mwaProtocolModule;
|
|
21528
21496
|
const authToken = this.authToken;
|
|
21529
|
-
await awaitActivityFocus();
|
|
21530
21497
|
await transact(async (wallet) => {
|
|
21531
21498
|
await wallet.deauthorize({ auth_token: authToken });
|
|
21532
21499
|
}, this.getAssociationConfig());
|
|
@@ -21552,7 +21519,6 @@ class SolanaMobileWalletProvider {
|
|
|
21552
21519
|
const { transact } = mwaProtocolModule;
|
|
21553
21520
|
const base64Addr = this.base64Address;
|
|
21554
21521
|
try {
|
|
21555
|
-
await awaitActivityFocus();
|
|
21556
21522
|
const signedMessages = await transact(async (wallet) => {
|
|
21557
21523
|
await this.reauthorizeWallet(wallet);
|
|
21558
21524
|
const messageBytes = getPlatform().textEncode(message);
|
|
@@ -21606,7 +21572,6 @@ class SolanaMobileWalletProvider {
|
|
|
21606
21572
|
}
|
|
21607
21573
|
}
|
|
21608
21574
|
try {
|
|
21609
|
-
await awaitActivityFocus();
|
|
21610
21575
|
const signedTransactions = await transact(async (wallet) => {
|
|
21611
21576
|
await this.reauthorizeWallet(wallet);
|
|
21612
21577
|
return wallet.signTransactions({ transactions: [transaction] });
|
|
@@ -21654,7 +21619,6 @@ class SolanaMobileWalletProvider {
|
|
|
21654
21619
|
}
|
|
21655
21620
|
if (isSurfnet) {
|
|
21656
21621
|
// Surfnet: sign-only, then submit to our specific RPC
|
|
21657
|
-
await awaitActivityFocus();
|
|
21658
21622
|
const signedTransactions = await transact(async (wallet) => {
|
|
21659
21623
|
await this.reauthorizeWallet(wallet);
|
|
21660
21624
|
return wallet.signTransactions({ transactions: [transaction] });
|
|
@@ -21674,7 +21638,6 @@ class SolanaMobileWalletProvider {
|
|
|
21674
21638
|
return signature;
|
|
21675
21639
|
}
|
|
21676
21640
|
// Non-surfnet: use signAndSendTransactions for wallet-optimized submission
|
|
21677
|
-
await awaitActivityFocus();
|
|
21678
21641
|
const signatures = await transact(async (wallet) => {
|
|
21679
21642
|
await this.reauthorizeWallet(wallet);
|
|
21680
21643
|
return wallet.signAndSendTransactions({
|
|
@@ -21758,7 +21721,6 @@ class SolanaMobileWalletProvider {
|
|
|
21758
21721
|
tx = result.tx;
|
|
21759
21722
|
}
|
|
21760
21723
|
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
21761
|
-
await awaitActivityFocus();
|
|
21762
21724
|
const [signedTx] = await transact(async (wallet) => {
|
|
21763
21725
|
await this.reauthorizeWallet(wallet);
|
|
21764
21726
|
return wallet.signTransactions({ transactions: [tx] });
|
|
@@ -21772,7 +21734,6 @@ class SolanaMobileWalletProvider {
|
|
|
21772
21734
|
}
|
|
21773
21735
|
if (isSurfnet) {
|
|
21774
21736
|
// Surfnet: sign then submit manually to our RPC
|
|
21775
|
-
await awaitActivityFocus();
|
|
21776
21737
|
const [signedTx] = await transact(async (wallet) => {
|
|
21777
21738
|
await this.reauthorizeWallet(wallet);
|
|
21778
21739
|
return wallet.signTransactions({ transactions: [tx] });
|
|
@@ -21801,7 +21762,6 @@ class SolanaMobileWalletProvider {
|
|
|
21801
21762
|
};
|
|
21802
21763
|
}
|
|
21803
21764
|
// Non-surfnet: use signAndSendTransactions
|
|
21804
|
-
await awaitActivityFocus();
|
|
21805
21765
|
const signatures = await transact(async (wallet) => {
|
|
21806
21766
|
await this.reauthorizeWallet(wallet);
|
|
21807
21767
|
return wallet.signAndSendTransactions({
|
|
@@ -22210,5 +22170,5 @@ class PrivyExpoProvider {
|
|
|
22210
22170
|
}
|
|
22211
22171
|
}
|
|
22212
22172
|
|
|
22213
|
-
export {
|
|
22214
|
-
//# sourceMappingURL=index-
|
|
22173
|
+
export { genSolanaMessage as $, aggregate as A, subscribe as B, useAuth 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 _, getCurrentUser as a, getCachedData as a0, getMany as a1, reconnectWithNewAuth as a2, refreshSession as a3, signSessionCreateMessage as a4, bufferExports as b, commonjsRequire 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, runQuery as q, require$$0 as r, set as s, runQueryMany as t, runExpression as u, runExpressionMany as v, signMessage as w, signTransaction as x, signAndSubmitTransaction as y, count as z };
|
|
22174
|
+
//# sourceMappingURL=index-BsY_Lgiu.esm.js.map
|