@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
|
@@ -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
|
|
|
@@ -9258,15 +9273,15 @@ function requireBuffer$1 () {
|
|
|
9258
9273
|
|
|
9259
9274
|
var bufferExports$1 = requireBuffer$1();
|
|
9260
9275
|
|
|
9261
|
-
var safeBuffer = {exports: {}};
|
|
9276
|
+
var safeBuffer$1 = {exports: {}};
|
|
9262
9277
|
|
|
9263
9278
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
9264
9279
|
|
|
9265
|
-
var hasRequiredSafeBuffer;
|
|
9280
|
+
var hasRequiredSafeBuffer$1;
|
|
9266
9281
|
|
|
9267
|
-
function requireSafeBuffer () {
|
|
9268
|
-
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
9269
|
-
hasRequiredSafeBuffer = 1;
|
|
9282
|
+
function requireSafeBuffer$1 () {
|
|
9283
|
+
if (hasRequiredSafeBuffer$1) return safeBuffer$1.exports;
|
|
9284
|
+
hasRequiredSafeBuffer$1 = 1;
|
|
9270
9285
|
(function (module, exports$1) {
|
|
9271
9286
|
/* eslint-disable node/no-deprecated-api */
|
|
9272
9287
|
var buffer = requireBuffer$1();
|
|
@@ -9332,23 +9347,23 @@ function requireSafeBuffer () {
|
|
|
9332
9347
|
}
|
|
9333
9348
|
return buffer.SlowBuffer(size)
|
|
9334
9349
|
};
|
|
9335
|
-
} (safeBuffer, safeBuffer.exports));
|
|
9336
|
-
return safeBuffer.exports;
|
|
9350
|
+
} (safeBuffer$1, safeBuffer$1.exports));
|
|
9351
|
+
return safeBuffer$1.exports;
|
|
9337
9352
|
}
|
|
9338
9353
|
|
|
9339
|
-
var src;
|
|
9340
|
-
var hasRequiredSrc;
|
|
9354
|
+
var src$1;
|
|
9355
|
+
var hasRequiredSrc$1;
|
|
9341
9356
|
|
|
9342
|
-
function requireSrc () {
|
|
9343
|
-
if (hasRequiredSrc) return src;
|
|
9344
|
-
hasRequiredSrc = 1;
|
|
9357
|
+
function requireSrc$1 () {
|
|
9358
|
+
if (hasRequiredSrc$1) return src$1;
|
|
9359
|
+
hasRequiredSrc$1 = 1;
|
|
9345
9360
|
// base-x encoding / decoding
|
|
9346
9361
|
// Copyright (c) 2018 base-x contributors
|
|
9347
9362
|
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
9348
9363
|
// Distributed under the MIT software license, see the accompanying
|
|
9349
9364
|
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
9350
9365
|
// @ts-ignore
|
|
9351
|
-
var _Buffer = requireSafeBuffer().Buffer;
|
|
9366
|
+
var _Buffer = requireSafeBuffer$1().Buffer;
|
|
9352
9367
|
function base (ALPHABET) {
|
|
9353
9368
|
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
9354
9369
|
var BASE_MAP = new Uint8Array(256);
|
|
@@ -9463,25 +9478,25 @@ function requireSrc () {
|
|
|
9463
9478
|
decode: decode
|
|
9464
9479
|
}
|
|
9465
9480
|
}
|
|
9466
|
-
src = base;
|
|
9467
|
-
return src;
|
|
9481
|
+
src$1 = base;
|
|
9482
|
+
return src$1;
|
|
9468
9483
|
}
|
|
9469
9484
|
|
|
9470
|
-
var bs58$1;
|
|
9471
|
-
var hasRequiredBs58;
|
|
9485
|
+
var bs58$1$1;
|
|
9486
|
+
var hasRequiredBs58$1;
|
|
9472
9487
|
|
|
9473
|
-
function requireBs58 () {
|
|
9474
|
-
if (hasRequiredBs58) return bs58$1;
|
|
9475
|
-
hasRequiredBs58 = 1;
|
|
9476
|
-
var basex = requireSrc();
|
|
9488
|
+
function requireBs58$1 () {
|
|
9489
|
+
if (hasRequiredBs58$1) return bs58$1$1;
|
|
9490
|
+
hasRequiredBs58$1 = 1;
|
|
9491
|
+
var basex = requireSrc$1();
|
|
9477
9492
|
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
9478
9493
|
|
|
9479
|
-
bs58$1 = basex(ALPHABET);
|
|
9480
|
-
return bs58$1;
|
|
9494
|
+
bs58$1$1 = basex(ALPHABET);
|
|
9495
|
+
return bs58$1$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
|
|
@@ -9560,6 +9575,12 @@ async function genSolanaMessage(address, nonce) {
|
|
|
9560
9575
|
// Serialization Helpers
|
|
9561
9576
|
// ─────────────────────────────────────────────────────────────
|
|
9562
9577
|
function isHexString(value) {
|
|
9578
|
+
// Only strings can be hex-encoded. Numbers, BNs, and other shapes coming back
|
|
9579
|
+
// from the API for u64Val/i64Val should fall through to `new BN(value)` which
|
|
9580
|
+
// accepts those shapes natively. Without this guard, calling .startsWith on a
|
|
9581
|
+
// non-string blows up with TypeError.
|
|
9582
|
+
if (typeof value !== "string")
|
|
9583
|
+
return false;
|
|
9563
9584
|
// Matches strings containing only 0-9, a-f, or A-F (optionally prefixed with 0x)
|
|
9564
9585
|
let testValue = value;
|
|
9565
9586
|
// Handle negative values
|
|
@@ -9655,8 +9676,11 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
9655
9676
|
}
|
|
9656
9677
|
else if (idl.address === "poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZp") {
|
|
9657
9678
|
const program = new anchor.Program(idl, anchorProvider);
|
|
9679
|
+
// Targets `set_documents_v2` (Vec<u8> ra_indices). The on-chain program
|
|
9680
|
+
// also exposes the legacy `set_documents` (Vec<u64>) so SDKs already on npm
|
|
9681
|
+
// continue to work — but new releases of this SDK speak v2 only.
|
|
9658
9682
|
tx = await program.methods
|
|
9659
|
-
.
|
|
9683
|
+
.setDocumentsV2(args.app_id, prepareAnchorArgs(args.documents), args.delete_paths, args.txData, simulate)
|
|
9660
9684
|
.preInstructions(instructions)
|
|
9661
9685
|
.accounts({
|
|
9662
9686
|
payer: payerPublicKey
|
|
@@ -10011,11 +10035,17 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
10011
10035
|
if (_overrides === null || _overrides === void 0 ? void 0 : _overrides.headers) {
|
|
10012
10036
|
Object.assign(headers, _overrides.headers);
|
|
10013
10037
|
}
|
|
10038
|
+
// Writes (PUT/POST/DELETE) can take significantly longer than reads —
|
|
10039
|
+
// server-side they may trigger ad-hoc LUT creation (create + extend +
|
|
10040
|
+
// wait-for-finalization, ~15-30s on mainnet). Use a larger default for
|
|
10041
|
+
// non-GET so the SDK doesn't time out before client-api responds.
|
|
10042
|
+
const isRead = method.toUpperCase() === "GET";
|
|
10043
|
+
const defaultTimeout = isRead ? 30000 : 90000;
|
|
10014
10044
|
const requestConfig = {
|
|
10015
10045
|
method,
|
|
10016
10046
|
url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
|
|
10017
10047
|
headers,
|
|
10018
|
-
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a :
|
|
10048
|
+
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a : defaultTimeout,
|
|
10019
10049
|
};
|
|
10020
10050
|
if (method !== "GET" && method !== "get") {
|
|
10021
10051
|
requestConfig.data = data ? JSON.stringify(data) : {};
|
|
@@ -10127,40 +10157,17 @@ async function getConfig() {
|
|
|
10127
10157
|
return clientConfig;
|
|
10128
10158
|
}
|
|
10129
10159
|
|
|
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;
|
|
10160
|
+
var __rest = function (s, e) {
|
|
10161
|
+
var t = {};
|
|
10162
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
10163
|
+
t[p] = s[p];
|
|
10164
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10165
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
10166
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10167
|
+
t[p[i]] = s[p[i]];
|
|
10168
|
+
}
|
|
10169
|
+
return t;
|
|
10162
10170
|
};
|
|
10163
|
-
|
|
10164
10171
|
/**
|
|
10165
10172
|
* Thrown when a user's wallet doesn't have enough SOL to cover the transaction.
|
|
10166
10173
|
* Apps can catch this to trigger an onramp/funding flow.
|
|
@@ -10683,21 +10690,38 @@ async function setMany(many, options) {
|
|
|
10683
10690
|
setDocumentData: tx.transactionArgs.setDocumentData,
|
|
10684
10691
|
deletePaths: tx.transactionArgs.deletePaths,
|
|
10685
10692
|
idl: tx.idl,
|
|
10686
|
-
txData: (_b = (_a = tx.txData) === null || _a === void 0 ? void 0 : _a.map((txData) => {
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10693
|
+
txData: (_b = (_a = tx.txData) === null || _a === void 0 ? void 0 : _a.map((txData) => ({
|
|
10694
|
+
pluginFunctionKey: txData.pluginFunctionKey,
|
|
10695
|
+
txData: bufferExports$1.Buffer.from(txData.txData),
|
|
10696
|
+
// raIndices is Vec<u8> on-chain (serialized as Buffer/bytes). The server may send
|
|
10697
|
+
// it as a Buffer, a number[], a Uint8Array, or — over JSON — as Node's serialized
|
|
10698
|
+
// Buffer shape {type: "Buffer", data: number[]} (the default `JSON.stringify(buf)`
|
|
10699
|
+
// output). Normalise all of those to Buffer here. Each value must fit in u8 (matches
|
|
10700
|
+
// Solana's instruction-level account indexing); throw clearly if anything is out of range.
|
|
10701
|
+
raIndices: (() => {
|
|
10702
|
+
const raw = txData.raIndices;
|
|
10703
|
+
if (raw == null)
|
|
10704
|
+
return bufferExports$1.Buffer.alloc(0);
|
|
10705
|
+
if (bufferExports$1.Buffer.isBuffer(raw))
|
|
10706
|
+
return raw;
|
|
10707
|
+
if (raw instanceof Uint8Array)
|
|
10708
|
+
return bufferExports$1.Buffer.from(raw);
|
|
10709
|
+
// Node's JSON-serialised Buffer: {type: "Buffer", data: number[]}
|
|
10710
|
+
const arrayLike = Array.isArray(raw)
|
|
10711
|
+
? raw
|
|
10712
|
+
: (raw && typeof raw === 'object' && Array.isArray(raw.data))
|
|
10713
|
+
? raw.data
|
|
10714
|
+
: (() => { throw new Error(`raIndices has unexpected shape: ${typeof raw}`); })();
|
|
10715
|
+
const bytes = arrayLike.map((raIndex) => {
|
|
10716
|
+
const n = isHexString(raIndex) ? parseInt(raIndex, 16) : Number(raIndex);
|
|
10717
|
+
if (!Number.isInteger(n) || n < 0 || n > 255) {
|
|
10718
|
+
throw new Error(`raIndex ${raIndex} is not a valid u8 (must be integer in 0..255)`);
|
|
10697
10719
|
}
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10720
|
+
return n;
|
|
10721
|
+
});
|
|
10722
|
+
return bufferExports$1.Buffer.from(bytes);
|
|
10723
|
+
})(),
|
|
10724
|
+
}))) !== null && _b !== void 0 ? _b : [],
|
|
10701
10725
|
};
|
|
10702
10726
|
const config = await getConfig();
|
|
10703
10727
|
const solTransaction = {
|
|
@@ -12981,7 +13005,7 @@ async function getAuthProvider(config) {
|
|
|
12981
13005
|
}
|
|
12982
13006
|
return currentAuthProvider;
|
|
12983
13007
|
}
|
|
12984
|
-
async function login$1() {
|
|
13008
|
+
async function login$1(options) {
|
|
12985
13009
|
// Re-initialize provider if it was cleared by logout
|
|
12986
13010
|
if (!currentAuthProvider && initConfig) {
|
|
12987
13011
|
currentAuthProvider = await getAuthProvider(initConfig);
|
|
@@ -12994,6 +13018,14 @@ async function login$1() {
|
|
|
12994
13018
|
if (!currentAuthProvider) {
|
|
12995
13019
|
throw new Error("Auth provider not initialized. Please call init() first.");
|
|
12996
13020
|
}
|
|
13021
|
+
// Forward per-call overrides to providers that support them (duck-typed to stay
|
|
13022
|
+
// lazy-load safe — no direct import of PhantomWalletProvider here).
|
|
13023
|
+
// Always call (even with null) so previous overrides are cleared when this
|
|
13024
|
+
// login() is invoked without options — early-return paths inside the provider
|
|
13025
|
+
// bypass the .finally() cleanup, so we reset here too.
|
|
13026
|
+
if (typeof currentAuthProvider.setLoginOverrides === 'function') {
|
|
13027
|
+
currentAuthProvider.setLoginOverrides(options !== null && options !== void 0 ? options : null);
|
|
13028
|
+
}
|
|
12997
13029
|
const loginResult = await currentAuthProvider.login();
|
|
12998
13030
|
if (loginResult) {
|
|
12999
13031
|
// Store which auth method was used so we restore the right provider on reload
|
|
@@ -13076,11 +13108,11 @@ function setAuthLoading(loading) {
|
|
|
13076
13108
|
function getAuthLoading() {
|
|
13077
13109
|
return isAuthLoading;
|
|
13078
13110
|
}
|
|
13079
|
-
async function login() {
|
|
13111
|
+
async function login(options) {
|
|
13080
13112
|
if (!authProviderInstance) {
|
|
13081
13113
|
throw new Error('SDK not initialized. Please call init() first.');
|
|
13082
13114
|
}
|
|
13083
|
-
const loggedInUser = await login$1();
|
|
13115
|
+
const loggedInUser = await login$1(options);
|
|
13084
13116
|
setCurrentUser(loggedInUser);
|
|
13085
13117
|
return currentUser;
|
|
13086
13118
|
}
|
|
@@ -15669,7 +15701,7 @@ async function loadDependencies() {
|
|
|
15669
15701
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
15670
15702
|
import('react'),
|
|
15671
15703
|
import('react-dom/client'),
|
|
15672
|
-
Promise.resolve().then(function () { return require('./index-
|
|
15704
|
+
Promise.resolve().then(function () { return require('./index-Ci3m3diI.js'); })
|
|
15673
15705
|
]);
|
|
15674
15706
|
// Extract default export from ESM module namespace
|
|
15675
15707
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -15681,6 +15713,10 @@ async function loadDependencies() {
|
|
|
15681
15713
|
return loadingPromise;
|
|
15682
15714
|
}
|
|
15683
15715
|
class PhantomWalletProvider {
|
|
15716
|
+
/** Temporarily override modal appearance for a single login() call. Cleared automatically after login settles. */
|
|
15717
|
+
setLoginOverrides(opts) {
|
|
15718
|
+
this.loginOverrides = opts;
|
|
15719
|
+
}
|
|
15684
15720
|
constructor(networkUrl = null, config = {}) {
|
|
15685
15721
|
this.containerElement = null;
|
|
15686
15722
|
this.root = null;
|
|
@@ -15690,6 +15726,7 @@ class PhantomWalletProvider {
|
|
|
15690
15726
|
this.loginInProgress = false;
|
|
15691
15727
|
this.autoLoginInProgress = false;
|
|
15692
15728
|
this.initPromise = null;
|
|
15729
|
+
this.loginOverrides = null;
|
|
15693
15730
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
15694
15731
|
this.onSwitchToPrivy = null;
|
|
15695
15732
|
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
@@ -15712,13 +15749,8 @@ class PhantomWalletProvider {
|
|
|
15712
15749
|
async initializeAsync() {
|
|
15713
15750
|
// Lazy load dependencies only when actually instantiating
|
|
15714
15751
|
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
|
-
}
|
|
15752
|
+
// Initialize React component
|
|
15753
|
+
this.initialize();
|
|
15722
15754
|
}
|
|
15723
15755
|
/**
|
|
15724
15756
|
* Check if social login providers are configured (non-injected providers).
|
|
@@ -15726,69 +15758,6 @@ class PhantomWalletProvider {
|
|
|
15726
15758
|
hasSocialProviders() {
|
|
15727
15759
|
return this.resolvedProviders.some(p => p !== 'injected');
|
|
15728
15760
|
}
|
|
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
15761
|
static getInstance(networkUrl, config) {
|
|
15793
15762
|
if (!PhantomWalletProvider.instance) {
|
|
15794
15763
|
new PhantomWalletProvider(networkUrl, config);
|
|
@@ -15864,7 +15833,7 @@ class PhantomWalletProvider {
|
|
|
15864
15833
|
const sdkProviders = this.resolvedProviders.length > 0 ? [...this.resolvedProviders] : ['injected'];
|
|
15865
15834
|
// Inner component that uses hooks
|
|
15866
15835
|
const PhantomHooksComponent = () => {
|
|
15867
|
-
var _a, _b;
|
|
15836
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
15868
15837
|
const phantom = usePhantom();
|
|
15869
15838
|
const { connect, error: connectError } = useConnect();
|
|
15870
15839
|
const { disconnect, isDisconnecting } = useDisconnect();
|
|
@@ -16147,63 +16116,13 @@ class PhantomWalletProvider {
|
|
|
16147
16116
|
}
|
|
16148
16117
|
};
|
|
16149
16118
|
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
16119
|
that.loginInProgress = false;
|
|
16161
16120
|
walletClickedRef.current = true;
|
|
16162
16121
|
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
16122
|
if (that.onSwitchToMWA) {
|
|
16200
16123
|
try {
|
|
16201
|
-
console.log('[MWA-DEBUG] calling onSwitchToMWA');
|
|
16202
16124
|
const mwaProvider = await that.onSwitchToMWA();
|
|
16203
|
-
console.log('[MWA-DEBUG] onSwitchToMWA resolved, calling mwaProvider.login()');
|
|
16204
16125
|
const user = await mwaProvider.login();
|
|
16205
|
-
console.log('[MWA-DEBUG] mwaProvider.login() resolved', { hasUser: !!user });
|
|
16206
|
-
restoreContainer();
|
|
16207
16126
|
if (that.pendingLogin && user) {
|
|
16208
16127
|
that.pendingLogin.resolve(user);
|
|
16209
16128
|
that.pendingLogin = null;
|
|
@@ -16214,22 +16133,12 @@ class PhantomWalletProvider {
|
|
|
16214
16133
|
}
|
|
16215
16134
|
}
|
|
16216
16135
|
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
16136
|
if (that.pendingLogin) {
|
|
16224
16137
|
that.pendingLogin.reject(error);
|
|
16225
16138
|
that.pendingLogin = null;
|
|
16226
16139
|
}
|
|
16227
16140
|
}
|
|
16228
16141
|
}
|
|
16229
|
-
else {
|
|
16230
|
-
console.log('[MWA-DEBUG] no onSwitchToMWA configured');
|
|
16231
|
-
restoreContainer();
|
|
16232
|
-
}
|
|
16233
16142
|
};
|
|
16234
16143
|
const handleCloseModal = () => {
|
|
16235
16144
|
setShowWalletModal(false);
|
|
@@ -16243,31 +16152,59 @@ class PhantomWalletProvider {
|
|
|
16243
16152
|
if (!showWalletModal) {
|
|
16244
16153
|
return null;
|
|
16245
16154
|
}
|
|
16246
|
-
const
|
|
16247
|
-
const
|
|
16248
|
-
const
|
|
16249
|
-
const
|
|
16250
|
-
const
|
|
16155
|
+
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';
|
|
16156
|
+
const isLight = effectiveTheme === 'light';
|
|
16157
|
+
const bgColor = isLight ? '#FFFFFF' : '#111113';
|
|
16158
|
+
const cardBorder = isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.07)';
|
|
16159
|
+
const textColor = isLight ? '#0f0f0f' : '#f5f5f5';
|
|
16160
|
+
const subTextColor = isLight ? 'rgba(0,0,0,0.45)' : 'rgba(255,255,255,0.4)';
|
|
16161
|
+
const btnBg = isLight ? 'rgba(0,0,0,0.04)' : 'rgba(255,255,255,0.05)';
|
|
16162
|
+
const btnHoverBg = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.09)';
|
|
16163
|
+
const btnBorder = isLight ? '1px solid rgba(0,0,0,0.10)' : '1px solid rgba(255,255,255,0.09)';
|
|
16164
|
+
const dividerColor = isLight ? 'rgba(0,0,0,0.10)' : 'rgba(255,255,255,0.08)';
|
|
16251
16165
|
const fontFamily = '"SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif';
|
|
16252
16166
|
const buttonStyle = (id) => ({
|
|
16253
16167
|
display: 'flex',
|
|
16254
16168
|
alignItems: 'center',
|
|
16255
16169
|
justifyContent: 'center',
|
|
16256
|
-
gap: '
|
|
16170
|
+
gap: '10px',
|
|
16257
16171
|
width: '100%',
|
|
16258
|
-
height: '
|
|
16259
|
-
padding: '
|
|
16260
|
-
border:
|
|
16261
|
-
borderRadius: '
|
|
16172
|
+
height: '52px',
|
|
16173
|
+
padding: '0 20px',
|
|
16174
|
+
border: btnBorder,
|
|
16175
|
+
borderRadius: '12px',
|
|
16262
16176
|
backgroundColor: hoveredBtn === id ? btnHoverBg : btnBg,
|
|
16263
16177
|
color: textColor,
|
|
16264
16178
|
fontFamily,
|
|
16265
16179
|
fontSize: '14px',
|
|
16266
|
-
fontWeight: '
|
|
16267
|
-
lineHeight: '
|
|
16268
|
-
letterSpacing: '
|
|
16180
|
+
fontWeight: '500',
|
|
16181
|
+
lineHeight: '1',
|
|
16182
|
+
letterSpacing: '0',
|
|
16269
16183
|
cursor: 'pointer',
|
|
16270
|
-
transition: 'background-color 0.
|
|
16184
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
16185
|
+
boxSizing: 'border-box',
|
|
16186
|
+
});
|
|
16187
|
+
const emailButtonStyle = (id) => ({
|
|
16188
|
+
display: 'flex',
|
|
16189
|
+
alignItems: 'center',
|
|
16190
|
+
justifyContent: 'center',
|
|
16191
|
+
gap: '10px',
|
|
16192
|
+
width: '100%',
|
|
16193
|
+
height: '52px',
|
|
16194
|
+
padding: '0 20px',
|
|
16195
|
+
border: isLight ? '1px solid rgba(0,0,0,0.15)' : '1px solid rgba(255,255,255,0.15)',
|
|
16196
|
+
borderRadius: '12px',
|
|
16197
|
+
backgroundColor: hoveredBtn === id
|
|
16198
|
+
? (isLight ? 'rgba(0,0,0,0.06)' : 'rgba(255,255,255,0.12)')
|
|
16199
|
+
: (isLight ? 'rgba(0,0,0,0.03)' : 'rgba(255,255,255,0.08)'),
|
|
16200
|
+
color: textColor,
|
|
16201
|
+
fontFamily,
|
|
16202
|
+
fontSize: '14px',
|
|
16203
|
+
fontWeight: '500',
|
|
16204
|
+
lineHeight: '1',
|
|
16205
|
+
cursor: 'pointer',
|
|
16206
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
16207
|
+
boxSizing: 'border-box',
|
|
16271
16208
|
});
|
|
16272
16209
|
const walletButtons = [];
|
|
16273
16210
|
// Google OAuth button — shown when 'google' is in resolved providers
|
|
@@ -16279,7 +16216,7 @@ class PhantomWalletProvider {
|
|
|
16279
16216
|
onMouseEnter: () => setHoveredBtn('google-oauth'),
|
|
16280
16217
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16281
16218
|
}, React$1.createElement('svg', {
|
|
16282
|
-
width: '
|
|
16219
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
16283
16220
|
style: { flexShrink: '0' },
|
|
16284
16221
|
}, React$1.createElement('path', {
|
|
16285
16222
|
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 +16241,7 @@ class PhantomWalletProvider {
|
|
|
16304
16241
|
onMouseEnter: () => setHoveredBtn('apple-oauth'),
|
|
16305
16242
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16306
16243
|
}, React$1.createElement('svg', {
|
|
16307
|
-
width: '
|
|
16244
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
16308
16245
|
fill: textColor,
|
|
16309
16246
|
style: { flexShrink: '0' },
|
|
16310
16247
|
}, React$1.createElement('path', {
|
|
@@ -16356,11 +16293,9 @@ class PhantomWalletProvider {
|
|
|
16356
16293
|
onClick: handleMobileWalletClick,
|
|
16357
16294
|
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
16358
16295
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16359
|
-
},
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
16363
|
-
style: { flexShrink: '0' },
|
|
16296
|
+
}, React$1.createElement('svg', {
|
|
16297
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
16298
|
+
style: { flexShrink: '0', opacity: '0.85' },
|
|
16364
16299
|
},
|
|
16365
16300
|
// Phone outline
|
|
16366
16301
|
React$1.createElement('rect', {
|
|
@@ -16382,23 +16317,51 @@ class PhantomWalletProvider {
|
|
|
16382
16317
|
if (that.config.enablePrivyFallback) {
|
|
16383
16318
|
walletButtons.push(React$1.createElement('button', {
|
|
16384
16319
|
key: 'email-login',
|
|
16385
|
-
style:
|
|
16320
|
+
style: emailButtonStyle('email-login'),
|
|
16386
16321
|
onClick: handleEmailClick,
|
|
16387
16322
|
onMouseEnter: () => setHoveredBtn('email-login'),
|
|
16388
16323
|
onMouseLeave: () => setHoveredBtn(null),
|
|
16389
|
-
},
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
16393
|
-
style: { flexShrink: '0' },
|
|
16324
|
+
}, React$1.createElement('svg', {
|
|
16325
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
16326
|
+
style: { flexShrink: '0', opacity: '0.7' },
|
|
16394
16327
|
}, React$1.createElement('path', {
|
|
16395
16328
|
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: '
|
|
16329
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
16397
16330
|
}), React$1.createElement('path', {
|
|
16398
16331
|
d: 'M22 6l-10 7L2 6',
|
|
16399
|
-
stroke: textColor, strokeWidth: '
|
|
16400
|
-
})), '
|
|
16332
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
16333
|
+
})), 'Continue with email'));
|
|
16401
16334
|
}
|
|
16335
|
+
// Split email button from the rest to insert OR divider
|
|
16336
|
+
const emailBtnIndex = walletButtons.findIndex((b) => b && b.key === 'email-login');
|
|
16337
|
+
const mainButtons = emailBtnIndex >= 0 ? walletButtons.slice(0, emailBtnIndex) : walletButtons;
|
|
16338
|
+
const emailButton = emailBtnIndex >= 0 ? walletButtons[emailBtnIndex] : null;
|
|
16339
|
+
// OR divider — shown when there are both wallet/social buttons and an email button
|
|
16340
|
+
const orDivider = (mainButtons.length > 0 && emailButton)
|
|
16341
|
+
? React$1.createElement('div', {
|
|
16342
|
+
key: 'or-divider',
|
|
16343
|
+
style: {
|
|
16344
|
+
display: 'flex',
|
|
16345
|
+
alignItems: 'center',
|
|
16346
|
+
gap: '12px',
|
|
16347
|
+
margin: '4px 0',
|
|
16348
|
+
},
|
|
16349
|
+
}, React$1.createElement('div', {
|
|
16350
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
16351
|
+
}), React$1.createElement('span', {
|
|
16352
|
+
style: {
|
|
16353
|
+
color: subTextColor,
|
|
16354
|
+
fontFamily,
|
|
16355
|
+
fontSize: '12px',
|
|
16356
|
+
fontWeight: '500',
|
|
16357
|
+
letterSpacing: '0.02em',
|
|
16358
|
+
textTransform: 'uppercase',
|
|
16359
|
+
userSelect: 'none',
|
|
16360
|
+
},
|
|
16361
|
+
}, 'or'), React$1.createElement('div', {
|
|
16362
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
16363
|
+
}))
|
|
16364
|
+
: null;
|
|
16402
16365
|
// Render custom modal
|
|
16403
16366
|
return React$1.createElement('div', {
|
|
16404
16367
|
// Overlay
|
|
@@ -16408,12 +16371,14 @@ class PhantomWalletProvider {
|
|
|
16408
16371
|
left: '0',
|
|
16409
16372
|
right: '0',
|
|
16410
16373
|
bottom: '0',
|
|
16411
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
16374
|
+
backgroundColor: isLight ? 'rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.65)',
|
|
16412
16375
|
display: 'flex',
|
|
16413
16376
|
alignItems: 'center',
|
|
16414
16377
|
justifyContent: 'center',
|
|
16415
16378
|
zIndex: 2147483647,
|
|
16416
16379
|
pointerEvents: 'auto',
|
|
16380
|
+
backdropFilter: 'blur(4px)',
|
|
16381
|
+
WebkitBackdropFilter: 'blur(4px)',
|
|
16417
16382
|
},
|
|
16418
16383
|
onClick: (e) => {
|
|
16419
16384
|
if (e.target === e.currentTarget)
|
|
@@ -16430,13 +16395,17 @@ class PhantomWalletProvider {
|
|
|
16430
16395
|
React$1.createElement('div', {
|
|
16431
16396
|
style: {
|
|
16432
16397
|
backgroundColor: bgColor,
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16398
|
+
border: cardBorder,
|
|
16399
|
+
borderRadius: '20px',
|
|
16400
|
+
width: '380px',
|
|
16401
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
16402
|
+
padding: '28px 24px 24px',
|
|
16437
16403
|
position: 'relative',
|
|
16438
|
-
boxShadow:
|
|
16404
|
+
boxShadow: isLight
|
|
16405
|
+
? '0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)'
|
|
16406
|
+
: '0 8px 40px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3)',
|
|
16439
16407
|
pointerEvents: 'auto',
|
|
16408
|
+
boxSizing: 'border-box',
|
|
16440
16409
|
},
|
|
16441
16410
|
onMouseDown: (e) => {
|
|
16442
16411
|
e.stopPropagation();
|
|
@@ -16445,26 +16414,30 @@ class PhantomWalletProvider {
|
|
|
16445
16414
|
e.stopPropagation();
|
|
16446
16415
|
},
|
|
16447
16416
|
},
|
|
16448
|
-
// Close button
|
|
16417
|
+
// Close button
|
|
16449
16418
|
React$1.createElement('button', {
|
|
16450
16419
|
onClick: handleCloseModal,
|
|
16451
16420
|
style: {
|
|
16452
16421
|
position: 'absolute',
|
|
16453
|
-
top: '
|
|
16454
|
-
right: '
|
|
16455
|
-
background: '
|
|
16456
|
-
border: '
|
|
16422
|
+
top: '14px',
|
|
16423
|
+
right: '14px',
|
|
16424
|
+
background: isLight ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.07)',
|
|
16425
|
+
border: isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.08)',
|
|
16426
|
+
borderRadius: '50%',
|
|
16427
|
+
width: '28px',
|
|
16428
|
+
height: '28px',
|
|
16457
16429
|
cursor: 'pointer',
|
|
16458
|
-
padding: '4px',
|
|
16459
16430
|
display: 'flex',
|
|
16460
16431
|
alignItems: 'center',
|
|
16461
16432
|
justifyContent: 'center',
|
|
16433
|
+
padding: '0',
|
|
16434
|
+
flexShrink: '0',
|
|
16462
16435
|
},
|
|
16463
16436
|
}, React$1.createElement('svg', {
|
|
16464
|
-
width: '
|
|
16437
|
+
width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none',
|
|
16465
16438
|
}, React$1.createElement('path', {
|
|
16466
|
-
d: '
|
|
16467
|
-
stroke:
|
|
16439
|
+
d: 'M11 1L1 11M1 1l10 10',
|
|
16440
|
+
stroke: subTextColor, strokeWidth: '1.75', strokeLinecap: 'round',
|
|
16468
16441
|
}))),
|
|
16469
16442
|
// App icon (if provided)
|
|
16470
16443
|
that.config.appIcon ? React$1.createElement('div', {
|
|
@@ -16472,27 +16445,40 @@ class PhantomWalletProvider {
|
|
|
16472
16445
|
}, React$1.createElement('img', {
|
|
16473
16446
|
src: that.config.appIcon,
|
|
16474
16447
|
alt: that.config.appName || 'App',
|
|
16475
|
-
style: { width: '
|
|
16448
|
+
style: { width: '44px', height: '44px', borderRadius: '10px' },
|
|
16476
16449
|
})) : null,
|
|
16477
16450
|
// Title
|
|
16478
16451
|
React$1.createElement('div', {
|
|
16479
16452
|
style: {
|
|
16480
16453
|
color: textColor,
|
|
16481
16454
|
fontFamily,
|
|
16482
|
-
fontSize: '
|
|
16455
|
+
fontSize: '17px',
|
|
16483
16456
|
fontWeight: '600',
|
|
16484
16457
|
textAlign: 'center',
|
|
16458
|
+
marginBottom: '6px',
|
|
16459
|
+
letterSpacing: '-0.2px',
|
|
16460
|
+
},
|
|
16461
|
+
}, (_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')),
|
|
16462
|
+
// Subtitle
|
|
16463
|
+
React$1.createElement('div', {
|
|
16464
|
+
style: {
|
|
16465
|
+
color: subTextColor,
|
|
16466
|
+
fontFamily,
|
|
16467
|
+
fontSize: '13px',
|
|
16468
|
+
fontWeight: '400',
|
|
16469
|
+
textAlign: 'center',
|
|
16485
16470
|
marginBottom: '24px',
|
|
16471
|
+
lineHeight: '1.4',
|
|
16486
16472
|
},
|
|
16487
|
-
}, '
|
|
16488
|
-
//
|
|
16473
|
+
}, (_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'),
|
|
16474
|
+
// Main buttons + OR divider + email button
|
|
16489
16475
|
React$1.createElement('div', {
|
|
16490
16476
|
style: {
|
|
16491
16477
|
display: 'flex',
|
|
16492
16478
|
flexDirection: 'column',
|
|
16493
16479
|
gap: '8px',
|
|
16494
16480
|
},
|
|
16495
|
-
}, ...
|
|
16481
|
+
}, ...mainButtons, orDivider, emailButton)));
|
|
16496
16482
|
};
|
|
16497
16483
|
// Wrapper component with PhantomProvider
|
|
16498
16484
|
const PhantomProviderWrapper = () => {
|
|
@@ -16525,13 +16511,6 @@ class PhantomWalletProvider {
|
|
|
16525
16511
|
if (this.initPromise) {
|
|
16526
16512
|
await this.initPromise;
|
|
16527
16513
|
}
|
|
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
16514
|
// Wait for SDK to be ready
|
|
16536
16515
|
await new Promise((resolve) => {
|
|
16537
16516
|
const check = () => {
|
|
@@ -16625,7 +16604,7 @@ class PhantomWalletProvider {
|
|
|
16625
16604
|
this.pendingLogin.reject = reject;
|
|
16626
16605
|
});
|
|
16627
16606
|
}
|
|
16628
|
-
|
|
16607
|
+
const loginPromise = new Promise((resolve, reject) => {
|
|
16629
16608
|
this.pendingLogin = { resolve, reject };
|
|
16630
16609
|
this.loginInProgress = true;
|
|
16631
16610
|
// Always use our custom wallet modal
|
|
@@ -16639,55 +16618,17 @@ class PhantomWalletProvider {
|
|
|
16639
16618
|
}
|
|
16640
16619
|
}, 180000);
|
|
16641
16620
|
});
|
|
16621
|
+
return loginPromise.finally(() => {
|
|
16622
|
+
this.loginOverrides = null;
|
|
16623
|
+
});
|
|
16642
16624
|
}
|
|
16643
16625
|
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;
|
|
16626
|
+
await this.ensureReady();
|
|
16627
|
+
const session = await WebSessionManager.getSession();
|
|
16628
|
+
if (session) {
|
|
16629
|
+
return { provider: this, address: session.address };
|
|
16689
16630
|
}
|
|
16690
|
-
return
|
|
16631
|
+
return null;
|
|
16691
16632
|
}
|
|
16692
16633
|
async address() {
|
|
16693
16634
|
var _a, _b, _c, _d;
|
|
@@ -20178,137 +20119,235 @@ function createSolanaRpcSubscriptionsFromTransport(transport) {
|
|
|
20178
20119
|
});
|
|
20179
20120
|
}
|
|
20180
20121
|
|
|
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
|
-
|
|
20122
|
+
var safeBuffer = {exports: {}};
|
|
20123
|
+
|
|
20124
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
20125
|
+
|
|
20126
|
+
var hasRequiredSafeBuffer;
|
|
20127
|
+
|
|
20128
|
+
function requireSafeBuffer () {
|
|
20129
|
+
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
20130
|
+
hasRequiredSafeBuffer = 1;
|
|
20131
|
+
(function (module, exports$1) {
|
|
20132
|
+
/* eslint-disable node/no-deprecated-api */
|
|
20133
|
+
var buffer = requireBuffer();
|
|
20134
|
+
var Buffer = buffer.Buffer;
|
|
20135
|
+
|
|
20136
|
+
// alternative to using Object.keys for old browsers
|
|
20137
|
+
function copyProps (src, dst) {
|
|
20138
|
+
for (var key in src) {
|
|
20139
|
+
dst[key] = src[key];
|
|
20140
|
+
}
|
|
20141
|
+
}
|
|
20142
|
+
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
20143
|
+
module.exports = buffer;
|
|
20144
|
+
} else {
|
|
20145
|
+
// Copy properties from require('buffer')
|
|
20146
|
+
copyProps(buffer, exports$1);
|
|
20147
|
+
exports$1.Buffer = SafeBuffer;
|
|
20148
|
+
}
|
|
20149
|
+
|
|
20150
|
+
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
20151
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
20152
|
+
}
|
|
20153
|
+
|
|
20154
|
+
SafeBuffer.prototype = Object.create(Buffer.prototype);
|
|
20155
|
+
|
|
20156
|
+
// Copy static methods from Buffer
|
|
20157
|
+
copyProps(Buffer, SafeBuffer);
|
|
20158
|
+
|
|
20159
|
+
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
20160
|
+
if (typeof arg === 'number') {
|
|
20161
|
+
throw new TypeError('Argument must not be a number')
|
|
20162
|
+
}
|
|
20163
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
20164
|
+
};
|
|
20165
|
+
|
|
20166
|
+
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
20167
|
+
if (typeof size !== 'number') {
|
|
20168
|
+
throw new TypeError('Argument must be a number')
|
|
20169
|
+
}
|
|
20170
|
+
var buf = Buffer(size);
|
|
20171
|
+
if (fill !== undefined) {
|
|
20172
|
+
if (typeof encoding === 'string') {
|
|
20173
|
+
buf.fill(fill, encoding);
|
|
20174
|
+
} else {
|
|
20175
|
+
buf.fill(fill);
|
|
20176
|
+
}
|
|
20177
|
+
} else {
|
|
20178
|
+
buf.fill(0);
|
|
20179
|
+
}
|
|
20180
|
+
return buf
|
|
20181
|
+
};
|
|
20182
|
+
|
|
20183
|
+
SafeBuffer.allocUnsafe = function (size) {
|
|
20184
|
+
if (typeof size !== 'number') {
|
|
20185
|
+
throw new TypeError('Argument must be a number')
|
|
20186
|
+
}
|
|
20187
|
+
return Buffer(size)
|
|
20188
|
+
};
|
|
20189
|
+
|
|
20190
|
+
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
20191
|
+
if (typeof size !== 'number') {
|
|
20192
|
+
throw new TypeError('Argument must be a number')
|
|
20193
|
+
}
|
|
20194
|
+
return buffer.SlowBuffer(size)
|
|
20195
|
+
};
|
|
20196
|
+
} (safeBuffer, safeBuffer.exports));
|
|
20197
|
+
return safeBuffer.exports;
|
|
20198
|
+
}
|
|
20199
|
+
|
|
20200
|
+
var src;
|
|
20201
|
+
var hasRequiredSrc;
|
|
20202
|
+
|
|
20203
|
+
function requireSrc () {
|
|
20204
|
+
if (hasRequiredSrc) return src;
|
|
20205
|
+
hasRequiredSrc = 1;
|
|
20206
|
+
// base-x encoding / decoding
|
|
20207
|
+
// Copyright (c) 2018 base-x contributors
|
|
20208
|
+
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
|
|
20209
|
+
// Distributed under the MIT software license, see the accompanying
|
|
20210
|
+
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
20211
|
+
// @ts-ignore
|
|
20212
|
+
var _Buffer = requireSafeBuffer().Buffer;
|
|
20213
|
+
function base (ALPHABET) {
|
|
20214
|
+
if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
|
|
20215
|
+
var BASE_MAP = new Uint8Array(256);
|
|
20216
|
+
for (var j = 0; j < BASE_MAP.length; j++) {
|
|
20217
|
+
BASE_MAP[j] = 255;
|
|
20218
|
+
}
|
|
20219
|
+
for (var i = 0; i < ALPHABET.length; i++) {
|
|
20220
|
+
var x = ALPHABET.charAt(i);
|
|
20221
|
+
var xc = x.charCodeAt(0);
|
|
20222
|
+
if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
|
|
20223
|
+
BASE_MAP[xc] = i;
|
|
20224
|
+
}
|
|
20225
|
+
var BASE = ALPHABET.length;
|
|
20226
|
+
var LEADER = ALPHABET.charAt(0);
|
|
20227
|
+
var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
|
|
20228
|
+
var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
|
|
20229
|
+
function encode (source) {
|
|
20230
|
+
if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source); }
|
|
20231
|
+
if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }
|
|
20232
|
+
if (source.length === 0) { return '' }
|
|
20233
|
+
// Skip & count leading zeroes.
|
|
20234
|
+
var zeroes = 0;
|
|
20235
|
+
var length = 0;
|
|
20236
|
+
var pbegin = 0;
|
|
20237
|
+
var pend = source.length;
|
|
20238
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
20239
|
+
pbegin++;
|
|
20240
|
+
zeroes++;
|
|
20241
|
+
}
|
|
20242
|
+
// Allocate enough space in big-endian base58 representation.
|
|
20243
|
+
var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
|
|
20244
|
+
var b58 = new Uint8Array(size);
|
|
20245
|
+
// Process the bytes.
|
|
20246
|
+
while (pbegin !== pend) {
|
|
20247
|
+
var carry = source[pbegin];
|
|
20248
|
+
// Apply "b58 = b58 * 256 + ch".
|
|
20249
|
+
var i = 0;
|
|
20250
|
+
for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
|
|
20251
|
+
carry += (256 * b58[it1]) >>> 0;
|
|
20252
|
+
b58[it1] = (carry % BASE) >>> 0;
|
|
20253
|
+
carry = (carry / BASE) >>> 0;
|
|
20254
|
+
}
|
|
20255
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20256
|
+
length = i;
|
|
20257
|
+
pbegin++;
|
|
20258
|
+
}
|
|
20259
|
+
// Skip leading zeroes in base58 result.
|
|
20260
|
+
var it2 = size - length;
|
|
20261
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
20262
|
+
it2++;
|
|
20263
|
+
}
|
|
20264
|
+
// Translate the result into a string.
|
|
20265
|
+
var str = LEADER.repeat(zeroes);
|
|
20266
|
+
for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
|
|
20267
|
+
return str
|
|
20268
|
+
}
|
|
20269
|
+
function decodeUnsafe (source) {
|
|
20270
|
+
if (typeof source !== 'string') { throw new TypeError('Expected String') }
|
|
20271
|
+
if (source.length === 0) { return _Buffer.alloc(0) }
|
|
20272
|
+
var psz = 0;
|
|
20273
|
+
// Skip and count leading '1's.
|
|
20274
|
+
var zeroes = 0;
|
|
20275
|
+
var length = 0;
|
|
20276
|
+
while (source[psz] === LEADER) {
|
|
20277
|
+
zeroes++;
|
|
20278
|
+
psz++;
|
|
20279
|
+
}
|
|
20280
|
+
// Allocate enough space in big-endian base256 representation.
|
|
20281
|
+
var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
|
|
20282
|
+
var b256 = new Uint8Array(size);
|
|
20283
|
+
// Process the characters.
|
|
20284
|
+
while (psz < source.length) {
|
|
20285
|
+
// Find code of next character
|
|
20286
|
+
var charCode = source.charCodeAt(psz);
|
|
20287
|
+
// Base map can not be indexed using char code
|
|
20288
|
+
if (charCode > 255) { return }
|
|
20289
|
+
// Decode character
|
|
20290
|
+
var carry = BASE_MAP[charCode];
|
|
20291
|
+
// Invalid character
|
|
20292
|
+
if (carry === 255) { return }
|
|
20293
|
+
var i = 0;
|
|
20294
|
+
for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
|
|
20295
|
+
carry += (BASE * b256[it3]) >>> 0;
|
|
20296
|
+
b256[it3] = (carry % 256) >>> 0;
|
|
20297
|
+
carry = (carry / 256) >>> 0;
|
|
20298
|
+
}
|
|
20299
|
+
if (carry !== 0) { throw new Error('Non-zero carry') }
|
|
20300
|
+
length = i;
|
|
20301
|
+
psz++;
|
|
20302
|
+
}
|
|
20303
|
+
// Skip leading zeroes in b256.
|
|
20304
|
+
var it4 = size - length;
|
|
20305
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
20306
|
+
it4++;
|
|
20307
|
+
}
|
|
20308
|
+
var vch = _Buffer.allocUnsafe(zeroes + (size - it4));
|
|
20309
|
+
vch.fill(0x00, 0, zeroes);
|
|
20310
|
+
var j = zeroes;
|
|
20311
|
+
while (it4 !== size) {
|
|
20312
|
+
vch[j++] = b256[it4++];
|
|
20313
|
+
}
|
|
20314
|
+
return vch
|
|
20315
|
+
}
|
|
20316
|
+
function decode (string) {
|
|
20317
|
+
var buffer = decodeUnsafe(string);
|
|
20318
|
+
if (buffer) { return buffer }
|
|
20319
|
+
throw new Error('Non-base' + BASE + ' character')
|
|
20320
|
+
}
|
|
20321
|
+
return {
|
|
20322
|
+
encode: encode,
|
|
20323
|
+
decodeUnsafe: decodeUnsafe,
|
|
20324
|
+
decode: decode
|
|
20325
|
+
}
|
|
20326
|
+
}
|
|
20327
|
+
src = base;
|
|
20328
|
+
return src;
|
|
20303
20329
|
}
|
|
20304
20330
|
|
|
20305
|
-
var
|
|
20306
|
-
var
|
|
20331
|
+
var bs58$1;
|
|
20332
|
+
var hasRequiredBs58;
|
|
20307
20333
|
|
|
20308
|
-
|
|
20334
|
+
function requireBs58 () {
|
|
20335
|
+
if (hasRequiredBs58) return bs58$1;
|
|
20336
|
+
hasRequiredBs58 = 1;
|
|
20337
|
+
var basex = requireSrc();
|
|
20338
|
+
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
20339
|
+
|
|
20340
|
+
bs58$1 = basex(ALPHABET);
|
|
20341
|
+
return bs58$1;
|
|
20342
|
+
}
|
|
20343
|
+
|
|
20344
|
+
var bs58Exports = requireBs58();
|
|
20345
|
+
var bs58 = /*@__PURE__*/getDefaultExportFromCjs$1(bs58Exports);
|
|
20346
|
+
|
|
20347
|
+
var index = /*#__PURE__*/_mergeNamespaces({
|
|
20309
20348
|
__proto__: null,
|
|
20310
20349
|
default: bs58
|
|
20311
|
-
});
|
|
20350
|
+
}, [bs58Exports]);
|
|
20312
20351
|
|
|
20313
20352
|
const SURFNET_RPC_URL$1 = "https://surfpool.fly.dev";
|
|
20314
20353
|
let React;
|
|
@@ -21210,63 +21249,6 @@ function isMobileWalletAvailable() {
|
|
|
21210
21249
|
return detectAndroid();
|
|
21211
21250
|
}
|
|
21212
21251
|
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
21252
|
// Dynamically imported MWA protocol module
|
|
21271
21253
|
let mwaProtocolModule = null;
|
|
21272
21254
|
let mwaProtocolLoadPromise = null;
|
|
@@ -21279,7 +21261,7 @@ async function loadMwaProtocol() {
|
|
|
21279
21261
|
return mwaProtocolLoadPromise;
|
|
21280
21262
|
mwaProtocolLoadPromise = (async () => {
|
|
21281
21263
|
try {
|
|
21282
|
-
mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-
|
|
21264
|
+
mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-Df7yN8D5.js'); });
|
|
21283
21265
|
}
|
|
21284
21266
|
catch (e) {
|
|
21285
21267
|
console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
|
|
@@ -21301,7 +21283,7 @@ async function registerMobileWalletAdapter(config) {
|
|
|
21301
21283
|
if (typeof window === 'undefined')
|
|
21302
21284
|
return;
|
|
21303
21285
|
try {
|
|
21304
|
-
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-
|
|
21286
|
+
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-BkMiHSON.js'); });
|
|
21305
21287
|
const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
|
|
21306
21288
|
if (!registerMwa) {
|
|
21307
21289
|
console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
|
|
@@ -21430,17 +21412,14 @@ class SolanaMobileWalletProvider {
|
|
|
21430
21412
|
}
|
|
21431
21413
|
async login() {
|
|
21432
21414
|
var _a, _b, _c, _d, _e;
|
|
21433
|
-
console.log('[MWA-DEBUG] SolanaMobileWalletProvider.login: enter');
|
|
21434
21415
|
setAuthLoading(true);
|
|
21435
21416
|
try {
|
|
21436
21417
|
await loadMwaProtocol();
|
|
21437
|
-
console.log('[MWA-DEBUG] loadMwaProtocol resolved');
|
|
21438
21418
|
const { transact } = mwaProtocolModule;
|
|
21439
21419
|
// Quick check: if we already have auth state and a valid session, skip
|
|
21440
21420
|
if (this.authorizedPublicKey) {
|
|
21441
21421
|
const existingSession = await WebSessionManager.getSession();
|
|
21442
21422
|
if (existingSession && existingSession.address === this.authorizedPublicKey) {
|
|
21443
|
-
console.log('[MWA-DEBUG] login: returning existing session, no transact');
|
|
21444
21423
|
const user = { provider: this, address: this.authorizedPublicKey };
|
|
21445
21424
|
setCurrentUser(user);
|
|
21446
21425
|
return user;
|
|
@@ -21448,12 +21427,8 @@ class SolanaMobileWalletProvider {
|
|
|
21448
21427
|
}
|
|
21449
21428
|
// Pre-fetch nonce from server while wallet is not yet connected
|
|
21450
21429
|
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
21430
|
// Single transact() call: authorize + signMessages — one wallet popup
|
|
21455
21431
|
const result = await transact(async (wallet) => {
|
|
21456
|
-
console.log('[MWA-DEBUG] transact callback running — WebSocket connected, calling wallet.authorize');
|
|
21457
21432
|
// Step 1: Authorize — user approves the dApp
|
|
21458
21433
|
const authResult = await wallet.authorize({
|
|
21459
21434
|
identity: this.appIdentity,
|
|
@@ -21483,7 +21458,6 @@ class SolanaMobileWalletProvider {
|
|
|
21483
21458
|
walletUriBase: authResult.wallet_uri_base,
|
|
21484
21459
|
};
|
|
21485
21460
|
}, this.getAssociationConfig());
|
|
21486
|
-
console.log('[MWA-DEBUG] login: transact() resolved successfully');
|
|
21487
21461
|
// Store MWA auth state for reauthorization in subsequent transact() calls
|
|
21488
21462
|
this.authToken = result.authToken;
|
|
21489
21463
|
this.walletUriBase = result.walletUriBase;
|
|
@@ -21510,12 +21484,6 @@ class SolanaMobileWalletProvider {
|
|
|
21510
21484
|
return user;
|
|
21511
21485
|
}
|
|
21512
21486
|
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
21487
|
const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
|
|
21520
21488
|
((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||
|
|
21521
21489
|
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||
|
|
@@ -21547,7 +21515,6 @@ class SolanaMobileWalletProvider {
|
|
|
21547
21515
|
await loadMwaProtocol();
|
|
21548
21516
|
const { transact } = mwaProtocolModule;
|
|
21549
21517
|
const authToken = this.authToken;
|
|
21550
|
-
await awaitActivityFocus();
|
|
21551
21518
|
await transact(async (wallet) => {
|
|
21552
21519
|
await wallet.deauthorize({ auth_token: authToken });
|
|
21553
21520
|
}, this.getAssociationConfig());
|
|
@@ -21573,7 +21540,6 @@ class SolanaMobileWalletProvider {
|
|
|
21573
21540
|
const { transact } = mwaProtocolModule;
|
|
21574
21541
|
const base64Addr = this.base64Address;
|
|
21575
21542
|
try {
|
|
21576
|
-
await awaitActivityFocus();
|
|
21577
21543
|
const signedMessages = await transact(async (wallet) => {
|
|
21578
21544
|
await this.reauthorizeWallet(wallet);
|
|
21579
21545
|
const messageBytes = getPlatform().textEncode(message);
|
|
@@ -21627,7 +21593,6 @@ class SolanaMobileWalletProvider {
|
|
|
21627
21593
|
}
|
|
21628
21594
|
}
|
|
21629
21595
|
try {
|
|
21630
|
-
await awaitActivityFocus();
|
|
21631
21596
|
const signedTransactions = await transact(async (wallet) => {
|
|
21632
21597
|
await this.reauthorizeWallet(wallet);
|
|
21633
21598
|
return wallet.signTransactions({ transactions: [transaction] });
|
|
@@ -21675,7 +21640,6 @@ class SolanaMobileWalletProvider {
|
|
|
21675
21640
|
}
|
|
21676
21641
|
if (isSurfnet) {
|
|
21677
21642
|
// Surfnet: sign-only, then submit to our specific RPC
|
|
21678
|
-
await awaitActivityFocus();
|
|
21679
21643
|
const signedTransactions = await transact(async (wallet) => {
|
|
21680
21644
|
await this.reauthorizeWallet(wallet);
|
|
21681
21645
|
return wallet.signTransactions({ transactions: [transaction] });
|
|
@@ -21695,7 +21659,6 @@ class SolanaMobileWalletProvider {
|
|
|
21695
21659
|
return signature;
|
|
21696
21660
|
}
|
|
21697
21661
|
// Non-surfnet: use signAndSendTransactions for wallet-optimized submission
|
|
21698
|
-
await awaitActivityFocus();
|
|
21699
21662
|
const signatures = await transact(async (wallet) => {
|
|
21700
21663
|
await this.reauthorizeWallet(wallet);
|
|
21701
21664
|
return wallet.signAndSendTransactions({
|
|
@@ -21779,7 +21742,6 @@ class SolanaMobileWalletProvider {
|
|
|
21779
21742
|
tx = result.tx;
|
|
21780
21743
|
}
|
|
21781
21744
|
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
21782
|
-
await awaitActivityFocus();
|
|
21783
21745
|
const [signedTx] = await transact(async (wallet) => {
|
|
21784
21746
|
await this.reauthorizeWallet(wallet);
|
|
21785
21747
|
return wallet.signTransactions({ transactions: [tx] });
|
|
@@ -21793,7 +21755,6 @@ class SolanaMobileWalletProvider {
|
|
|
21793
21755
|
}
|
|
21794
21756
|
if (isSurfnet) {
|
|
21795
21757
|
// Surfnet: sign then submit manually to our RPC
|
|
21796
|
-
await awaitActivityFocus();
|
|
21797
21758
|
const [signedTx] = await transact(async (wallet) => {
|
|
21798
21759
|
await this.reauthorizeWallet(wallet);
|
|
21799
21760
|
return wallet.signTransactions({ transactions: [tx] });
|
|
@@ -21822,7 +21783,6 @@ class SolanaMobileWalletProvider {
|
|
|
21822
21783
|
};
|
|
21823
21784
|
}
|
|
21824
21785
|
// Non-surfnet: use signAndSendTransactions
|
|
21825
|
-
await awaitActivityFocus();
|
|
21826
21786
|
const signatures = await transact(async (wallet) => {
|
|
21827
21787
|
await this.reauthorizeWallet(wallet);
|
|
21828
21788
|
return wallet.signAndSendTransactions({
|
|
@@ -22243,11 +22203,11 @@ exports.ServerSessionManager = ServerSessionManager;
|
|
|
22243
22203
|
exports.SolanaMobileWalletProvider = SolanaMobileWalletProvider;
|
|
22244
22204
|
exports.WebSessionManager = WebSessionManager;
|
|
22245
22205
|
exports.aggregate = aggregate;
|
|
22246
|
-
exports.bs58 = bs58;
|
|
22247
22206
|
exports.bufferExports = bufferExports;
|
|
22248
22207
|
exports.buildSetDocumentsTransaction = buildSetDocumentsTransaction;
|
|
22249
22208
|
exports.clearCache = clearCache;
|
|
22250
22209
|
exports.closeAllSubscriptions = closeAllSubscriptions;
|
|
22210
|
+
exports.commonjsRequire = commonjsRequire;
|
|
22251
22211
|
exports.convertRemainingAccounts = convertRemainingAccounts;
|
|
22252
22212
|
exports.count = count;
|
|
22253
22213
|
exports.createSessionWithPrivy = createSessionWithPrivy;
|
|
@@ -22275,6 +22235,7 @@ exports.onAuthStateChanged = onAuthStateChanged;
|
|
|
22275
22235
|
exports.reconnectWithNewAuth = reconnectWithNewAuth;
|
|
22276
22236
|
exports.refreshSession = refreshSession;
|
|
22277
22237
|
exports.registerMobileWalletAdapter = registerMobileWalletAdapter;
|
|
22238
|
+
exports.require$$0 = require$$0;
|
|
22278
22239
|
exports.runExpression = runExpression;
|
|
22279
22240
|
exports.runExpressionMany = runExpressionMany;
|
|
22280
22241
|
exports.runQuery = runQuery;
|
|
@@ -22289,4 +22250,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
|
|
|
22289
22250
|
exports.signTransaction = signTransaction;
|
|
22290
22251
|
exports.subscribe = subscribe;
|
|
22291
22252
|
exports.useAuth = useAuth;
|
|
22292
|
-
//# sourceMappingURL=index-
|
|
22253
|
+
//# sourceMappingURL=index-BicMkamC.js.map
|