@pooflabs/web 0.0.89 → 0.0.90
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/{index-BLbguAbm.js → index-BZ_W-sR0.js} +2 -2
- package/dist/index-BZ_W-sR0.js.map +1 -0
- package/dist/{index-CEr58d1y.esm.js → index-C65AsRIA.esm.js} +364 -14
- package/dist/index-C65AsRIA.esm.js.map +1 -0
- package/dist/{index-DsyaaxjP.js → index-CqpErQap.js} +363 -13
- package/dist/index-CqpErQap.js.map +1 -0
- package/dist/{index-D_H81ZZs.esm.js → index-CzVM_hix.esm.js} +142 -7
- package/dist/index-CzVM_hix.esm.js.map +1 -0
- package/dist/index-D72o3sHT.esm.js +6 -0
- package/dist/index-D72o3sHT.esm.js.map +1 -0
- package/dist/{index-BhMsVVRC.esm.js → index-DOYZMq5N.esm.js} +363 -13
- package/dist/index-DOYZMq5N.esm.js.map +1 -0
- package/dist/{index-BsAk0dF_.js → index-Eb2uyla3.js} +147 -6
- package/dist/index-Eb2uyla3.js.map +1 -0
- package/dist/{index-DV-v3Udi.js → index-lt7AQ69U.js} +364 -14
- package/dist/index-lt7AQ69U.js.map +1 -0
- package/dist/{index.browser-AsD3ML3C.js → index.browser-BltIkY00.js} +2 -2
- package/dist/{index.browser-AsD3ML3C.js.map → index.browser-BltIkY00.js.map} +1 -1
- package/dist/{index.browser-CmvrvtVk.js → index.browser-C81ODkjH.js} +2 -2
- package/dist/{index.browser-CmvrvtVk.js.map → index.browser-C81ODkjH.js.map} +1 -1
- package/dist/{index.browser-Cdrgfw30.esm.js → index.browser-D1uNEi4e.esm.js} +2 -2
- package/dist/{index.browser-Cdrgfw30.esm.js.map → index.browser-D1uNEi4e.esm.js.map} +1 -1
- package/dist/{index.browser-Ctdjdn7K.esm.js → index.browser-zlnKOqcR.esm.js} +2 -2
- package/dist/{index.browser-Ctdjdn7K.esm.js.map → index.browser-zlnKOqcR.esm.js.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/{index.native-CujLdGqC.esm.js → index.native-Czk4F68O.esm.js} +142 -7
- package/dist/index.native-Czk4F68O.esm.js.map +1 -0
- package/dist/{index.native-TmE1_ksX.js → index.native-DYddSSgT.js} +147 -6
- package/dist/index.native-DYddSSgT.js.map +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +7 -1
- package/dist/index.native.js.map +1 -1
- package/dist/{phantom-wallet-provider-DsB9i0xD.esm.js → phantom-wallet-provider-0tX0Zs72.esm.js} +4 -4
- package/dist/{phantom-wallet-provider-DsB9i0xD.esm.js.map → phantom-wallet-provider-0tX0Zs72.esm.js.map} +1 -1
- package/dist/{phantom-wallet-provider-Drxxai7b.js → phantom-wallet-provider-DR5qAGcS.js} +4 -4
- package/dist/{phantom-wallet-provider-Drxxai7b.js.map → phantom-wallet-provider-DR5qAGcS.js.map} +1 -1
- package/dist/{privy-wallet-provider-_PkLjOQV.js → privy-wallet-provider-BqTsdJPZ.js} +3 -3
- package/dist/privy-wallet-provider-BqTsdJPZ.js.map +1 -0
- package/dist/{privy-wallet-provider-Bh5qilM2.esm.js → privy-wallet-provider-ChMUFAEp.esm.js} +3 -3
- package/dist/privy-wallet-provider-ChMUFAEp.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-xzJFY_GQ.esm.js → solana-mobile-wallet-provider-Cq2H4eoW.esm.js} +4 -4
- package/dist/{solana-mobile-wallet-provider-xzJFY_GQ.esm.js.map → solana-mobile-wallet-provider-Cq2H4eoW.esm.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-wzJ_5N_z.js → solana-mobile-wallet-provider-DiXPSf8n.js} +4 -4
- package/dist/{solana-mobile-wallet-provider-wzJ_5N_z.js.map → solana-mobile-wallet-provider-DiXPSf8n.js.map} +1 -1
- package/package.json +2 -2
- package/dist/index-BLbguAbm.js.map +0 -1
- package/dist/index-BhMsVVRC.esm.js.map +0 -1
- package/dist/index-BsAk0dF_.js.map +0 -1
- package/dist/index-CEr58d1y.esm.js.map +0 -1
- package/dist/index-DV-v3Udi.js.map +0 -1
- package/dist/index-D_H81ZZs.esm.js.map +0 -1
- package/dist/index-DsyaaxjP.js.map +0 -1
- package/dist/index-udwtZBLu.esm.js +0 -6
- package/dist/index-udwtZBLu.esm.js.map +0 -1
- package/dist/index.native-CujLdGqC.esm.js.map +0 -1
- package/dist/index.native-TmE1_ksX.js.map +0 -1
- package/dist/privy-wallet-provider-Bh5qilM2.esm.js.map +0 -1
- package/dist/privy-wallet-provider-_PkLjOQV.js.map +0 -1
|
@@ -11138,6 +11138,7 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
11138
11138
|
subscriptions: new Map(),
|
|
11139
11139
|
pendingSubscriptions: new Map(),
|
|
11140
11140
|
pendingUnsubscriptions: new Map(),
|
|
11141
|
+
pendingRequests: new Map(),
|
|
11141
11142
|
isConnecting: false,
|
|
11142
11143
|
isConnected: false,
|
|
11143
11144
|
appId,
|
|
@@ -11236,11 +11237,17 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
11236
11237
|
clearInterval(connection.tokenRefreshTimer);
|
|
11237
11238
|
connection.tokenRefreshTimer = null;
|
|
11238
11239
|
}
|
|
11240
|
+
// Reject all pending WS CRUD requests on disconnect (fail fast)
|
|
11241
|
+
for (const [id, pending] of connection.pendingRequests) {
|
|
11242
|
+
clearTimeout(pending.timer);
|
|
11243
|
+
pending.reject(new Error('WebSocket disconnected'));
|
|
11244
|
+
}
|
|
11245
|
+
connection.pendingRequests.clear();
|
|
11239
11246
|
});
|
|
11240
11247
|
return connection;
|
|
11241
11248
|
}
|
|
11242
11249
|
function handleServerMessage(connection, message) {
|
|
11243
|
-
var _a;
|
|
11250
|
+
var _a, _b;
|
|
11244
11251
|
switch (message.type) {
|
|
11245
11252
|
case 'subscribed': {
|
|
11246
11253
|
const subscription = connection.subscriptions.get(message.subscriptionId);
|
|
@@ -11285,8 +11292,45 @@ function handleServerMessage(connection, message) {
|
|
|
11285
11292
|
}
|
|
11286
11293
|
break;
|
|
11287
11294
|
}
|
|
11295
|
+
case 'response': {
|
|
11296
|
+
const pendingReq = connection.pendingRequests.get(message.requestId);
|
|
11297
|
+
if (pendingReq) {
|
|
11298
|
+
connection.pendingRequests.delete(message.requestId);
|
|
11299
|
+
clearTimeout(pendingReq.timer);
|
|
11300
|
+
if (message.status >= 400) {
|
|
11301
|
+
pendingReq.reject(new Error(`Request failed with status ${message.status}`));
|
|
11302
|
+
}
|
|
11303
|
+
else {
|
|
11304
|
+
pendingReq.resolve(message.data);
|
|
11305
|
+
}
|
|
11306
|
+
}
|
|
11307
|
+
break;
|
|
11308
|
+
}
|
|
11309
|
+
case 'setResponse': {
|
|
11310
|
+
const pendingSet = connection.pendingRequests.get(message.requestId);
|
|
11311
|
+
if (pendingSet) {
|
|
11312
|
+
connection.pendingRequests.delete(message.requestId);
|
|
11313
|
+
clearTimeout(pendingSet.timer);
|
|
11314
|
+
if (message.statusCode >= 400) {
|
|
11315
|
+
pendingSet.reject(new Error(((_a = message.body) === null || _a === void 0 ? void 0 : _a.message) || `Set failed with status ${message.statusCode}`));
|
|
11316
|
+
}
|
|
11317
|
+
else {
|
|
11318
|
+
pendingSet.resolve(message.body);
|
|
11319
|
+
}
|
|
11320
|
+
}
|
|
11321
|
+
break;
|
|
11322
|
+
}
|
|
11288
11323
|
case 'error': {
|
|
11289
11324
|
console.error('[WS v2] Server error:', message.code, message.message);
|
|
11325
|
+
// Handle CRUD request errors (requestId present)
|
|
11326
|
+
if (message.requestId) {
|
|
11327
|
+
const pendingReq = connection.pendingRequests.get(message.requestId);
|
|
11328
|
+
if (pendingReq) {
|
|
11329
|
+
connection.pendingRequests.delete(message.requestId);
|
|
11330
|
+
clearTimeout(pendingReq.timer);
|
|
11331
|
+
pendingReq.reject(new Error(`${message.code}: ${message.message}`));
|
|
11332
|
+
}
|
|
11333
|
+
}
|
|
11290
11334
|
if (message.subscriptionId) {
|
|
11291
11335
|
// Reject pending subscription if this is a subscription error
|
|
11292
11336
|
const pending = connection.pendingSubscriptions.get(message.subscriptionId);
|
|
@@ -11298,7 +11342,7 @@ function handleServerMessage(connection, message) {
|
|
|
11298
11342
|
const subscription = connection.subscriptions.get(message.subscriptionId);
|
|
11299
11343
|
if (subscription) {
|
|
11300
11344
|
for (const callback of subscription.callbacks) {
|
|
11301
|
-
(
|
|
11345
|
+
(_b = callback.onError) === null || _b === void 0 ? void 0 : _b.call(callback, new Error(`${message.code}: ${message.message}`));
|
|
11302
11346
|
}
|
|
11303
11347
|
}
|
|
11304
11348
|
}
|
|
@@ -11587,6 +11631,97 @@ async function doReconnectWithNewAuth() {
|
|
|
11587
11631
|
}
|
|
11588
11632
|
}
|
|
11589
11633
|
}
|
|
11634
|
+
// ============ CRUD over WebSocket ============
|
|
11635
|
+
const WS_REQUEST_TIMEOUT_MS = 30000;
|
|
11636
|
+
function generateRequestId() {
|
|
11637
|
+
return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
11638
|
+
}
|
|
11639
|
+
/**
|
|
11640
|
+
* Returns true if there is an active v2 WebSocket connection open.
|
|
11641
|
+
*/
|
|
11642
|
+
function hasActiveConnection() {
|
|
11643
|
+
for (const connection of connections.values()) {
|
|
11644
|
+
if (connection.ws && connection.isConnected) {
|
|
11645
|
+
return true;
|
|
11646
|
+
}
|
|
11647
|
+
}
|
|
11648
|
+
return false;
|
|
11649
|
+
}
|
|
11650
|
+
async function sendRequest(msgBuilder) {
|
|
11651
|
+
const config = await getConfig();
|
|
11652
|
+
const appId = config.appId;
|
|
11653
|
+
const connection = await getOrCreateConnection(appId, config.isServer);
|
|
11654
|
+
// Wait for the connection to be open (getOrCreateConnection may return
|
|
11655
|
+
// while still connecting).
|
|
11656
|
+
if (!connection.isConnected && connection.ws) {
|
|
11657
|
+
await new Promise((resolve, reject) => {
|
|
11658
|
+
const timeout = setTimeout(() => {
|
|
11659
|
+
var _a;
|
|
11660
|
+
(_a = connection.ws) === null || _a === void 0 ? void 0 : _a.removeEventListener('open', onOpen);
|
|
11661
|
+
reject(new Error('WebSocket connection timeout'));
|
|
11662
|
+
}, 10000);
|
|
11663
|
+
const onOpen = () => { clearTimeout(timeout); resolve(); };
|
|
11664
|
+
if (connection.isConnected) {
|
|
11665
|
+
clearTimeout(timeout);
|
|
11666
|
+
resolve();
|
|
11667
|
+
return;
|
|
11668
|
+
}
|
|
11669
|
+
connection.ws.addEventListener('open', onOpen);
|
|
11670
|
+
});
|
|
11671
|
+
}
|
|
11672
|
+
if (!connection.ws || !connection.isConnected) {
|
|
11673
|
+
throw new Error('WebSocket connection not available');
|
|
11674
|
+
}
|
|
11675
|
+
const requestId = generateRequestId();
|
|
11676
|
+
const message = msgBuilder(requestId);
|
|
11677
|
+
return new Promise((resolve, reject) => {
|
|
11678
|
+
const timer = setTimeout(() => {
|
|
11679
|
+
connection.pendingRequests.delete(requestId);
|
|
11680
|
+
reject(new Error(`WebSocket request timed out after ${WS_REQUEST_TIMEOUT_MS}ms`));
|
|
11681
|
+
}, WS_REQUEST_TIMEOUT_MS);
|
|
11682
|
+
connection.pendingRequests.set(requestId, { resolve, reject, timer });
|
|
11683
|
+
try {
|
|
11684
|
+
connection.ws.send(JSON.stringify(message));
|
|
11685
|
+
}
|
|
11686
|
+
catch (error) {
|
|
11687
|
+
connection.pendingRequests.delete(requestId);
|
|
11688
|
+
clearTimeout(timer);
|
|
11689
|
+
reject(error);
|
|
11690
|
+
}
|
|
11691
|
+
});
|
|
11692
|
+
}
|
|
11693
|
+
async function wsGet(path) {
|
|
11694
|
+
return sendRequest((requestId) => ({
|
|
11695
|
+
type: 'get',
|
|
11696
|
+
requestId,
|
|
11697
|
+
path,
|
|
11698
|
+
}));
|
|
11699
|
+
}
|
|
11700
|
+
async function wsSet(documents) {
|
|
11701
|
+
return sendRequest((requestId) => ({
|
|
11702
|
+
type: 'set',
|
|
11703
|
+
requestId,
|
|
11704
|
+
documents,
|
|
11705
|
+
}));
|
|
11706
|
+
}
|
|
11707
|
+
async function wsQuery(path, opts) {
|
|
11708
|
+
return sendRequest((requestId) => (Object.assign(Object.assign(Object.assign(Object.assign({ type: 'query', requestId,
|
|
11709
|
+
path }, ((opts === null || opts === void 0 ? void 0 : opts.filter) ? { filter: opts.filter } : {})), ((opts === null || opts === void 0 ? void 0 : opts.sort) ? { sort: opts.sort } : {})), ((opts === null || opts === void 0 ? void 0 : opts.limit) !== undefined ? { limit: opts.limit } : {})), ((opts === null || opts === void 0 ? void 0 : opts.includeSubPaths) ? { includeSubPaths: opts.includeSubPaths } : {}))));
|
|
11710
|
+
}
|
|
11711
|
+
async function wsDelete(path) {
|
|
11712
|
+
return sendRequest((requestId) => ({
|
|
11713
|
+
type: 'delete',
|
|
11714
|
+
requestId,
|
|
11715
|
+
path,
|
|
11716
|
+
}));
|
|
11717
|
+
}
|
|
11718
|
+
async function wsGetMany(paths) {
|
|
11719
|
+
return sendRequest((requestId) => ({
|
|
11720
|
+
type: 'getMany',
|
|
11721
|
+
requestId,
|
|
11722
|
+
paths,
|
|
11723
|
+
}));
|
|
11724
|
+
}
|
|
11590
11725
|
|
|
11591
11726
|
/**
|
|
11592
11727
|
* WebSocket Subscription Module
|
|
@@ -15766,7 +15901,7 @@ async function loadDependencies() {
|
|
|
15766
15901
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
15767
15902
|
import('react'),
|
|
15768
15903
|
import('react-dom/client'),
|
|
15769
|
-
Promise.resolve().then(function () { return require('./index-
|
|
15904
|
+
Promise.resolve().then(function () { return require('./index-CqpErQap.js'); })
|
|
15770
15905
|
]);
|
|
15771
15906
|
// Extract default export from ESM module namespace
|
|
15772
15907
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -21906,7 +22041,7 @@ async function registerMobileWalletAdapter(config) {
|
|
|
21906
22041
|
if (typeof window === 'undefined')
|
|
21907
22042
|
return;
|
|
21908
22043
|
try {
|
|
21909
|
-
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-
|
|
22044
|
+
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-BltIkY00.js'); });
|
|
21910
22045
|
const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
|
|
21911
22046
|
if (!registerMwa) {
|
|
21912
22047
|
console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
|
|
@@ -22045,7 +22180,7 @@ class SolanaMobileWalletProvider {
|
|
|
22045
22180
|
async ensureWallet() {
|
|
22046
22181
|
if (this.wallet)
|
|
22047
22182
|
return this.wallet;
|
|
22048
|
-
const mod = await Promise.resolve().then(function () { return require('./index.browser-
|
|
22183
|
+
const mod = await Promise.resolve().then(function () { return require('./index.browser-BltIkY00.js'); });
|
|
22049
22184
|
const chain = mapChainToWalletStandard(this.cluster);
|
|
22050
22185
|
this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
|
|
22051
22186
|
appIdentity: this.appIdentity,
|
|
@@ -23272,6 +23407,7 @@ exports.getFiles = getFiles;
|
|
|
23272
23407
|
exports.getIdToken = getIdToken;
|
|
23273
23408
|
exports.getMany = getMany;
|
|
23274
23409
|
exports.getPlatform = getPlatform;
|
|
23410
|
+
exports.hasActiveConnection = hasActiveConnection;
|
|
23275
23411
|
exports.init = init;
|
|
23276
23412
|
exports.isMobileWalletAvailable = isMobileWalletAvailable;
|
|
23277
23413
|
exports.login = login;
|
|
@@ -23295,4 +23431,9 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
|
|
|
23295
23431
|
exports.signTransaction = signTransaction;
|
|
23296
23432
|
exports.subscribe = subscribe;
|
|
23297
23433
|
exports.useAuth = useAuth;
|
|
23298
|
-
|
|
23434
|
+
exports.wsDelete = wsDelete;
|
|
23435
|
+
exports.wsGet = wsGet;
|
|
23436
|
+
exports.wsGetMany = wsGetMany;
|
|
23437
|
+
exports.wsQuery = wsQuery;
|
|
23438
|
+
exports.wsSet = wsSet;
|
|
23439
|
+
//# sourceMappingURL=index-Eb2uyla3.js.map
|