@pooflabs/web 0.0.61 → 0.0.63
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/providers/transaction-utils.d.ts +10 -0
- package/dist/{index-BcHdE9FZ.esm.js → index-AjAeq_x4.esm.js} +270 -38
- package/dist/index-AjAeq_x4.esm.js.map +1 -0
- package/dist/{index-BDbuVeBU.js → index-Ce_FPfWw.js} +271 -37
- package/dist/{index-BcHdE9FZ.esm.js.map → index-Ce_FPfWw.js.map} +1 -1
- package/dist/{index-D0CV6SvU.js → index-Cx0ON8Td.js} +2 -2
- package/dist/{index-D0CV6SvU.js.map → index-Cx0ON8Td.js.map} +1 -1
- package/dist/{index-Dphggtap.esm.js → index-Dcrdb8rn.esm.js} +2 -2
- package/dist/{index-Dphggtap.esm.js.map → index-Dcrdb8rn.esm.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/index-BDbuVeBU.js.map +0 -1
|
@@ -6556,10 +6556,14 @@ class WebSessionManager {
|
|
|
6556
6556
|
const newObj = JSON.parse(newSession);
|
|
6557
6557
|
return { address: newObj.address, session: newObj };
|
|
6558
6558
|
}
|
|
6559
|
+
// Refresh failed — clear stale session to prevent retry loops
|
|
6560
|
+
this.clearSession();
|
|
6559
6561
|
return null;
|
|
6560
6562
|
}
|
|
6561
6563
|
}
|
|
6562
6564
|
catch (err) {
|
|
6565
|
+
// Token decode or refresh failed — clear stale session to prevent retry loops
|
|
6566
|
+
this.clearSession();
|
|
6563
6567
|
return null;
|
|
6564
6568
|
}
|
|
6565
6569
|
return { address: sessionObj.address, session: sessionObj };
|
|
@@ -9483,15 +9487,30 @@ class ServerSessionManager {
|
|
|
9483
9487
|
constructor() {
|
|
9484
9488
|
/* Private cache (lives for the life of the process) */
|
|
9485
9489
|
this.session = null;
|
|
9490
|
+
/* Coalesce concurrent getSession() calls into a single in-flight request */
|
|
9491
|
+
this.pendingSession = null;
|
|
9486
9492
|
}
|
|
9487
9493
|
/* ---------------------------------------------- *
|
|
9488
9494
|
* GET (lazy-fetch)
|
|
9489
9495
|
* ---------------------------------------------- */
|
|
9490
9496
|
async getSession() {
|
|
9491
|
-
if (this.session
|
|
9492
|
-
this.session
|
|
9493
|
-
}
|
|
9494
|
-
|
|
9497
|
+
if (this.session !== null) {
|
|
9498
|
+
return this.session;
|
|
9499
|
+
}
|
|
9500
|
+
// If a session creation is already in-flight, reuse that promise
|
|
9501
|
+
// instead of firing a second concurrent request.
|
|
9502
|
+
if (this.pendingSession !== null) {
|
|
9503
|
+
return this.pendingSession;
|
|
9504
|
+
}
|
|
9505
|
+
this.pendingSession = createSession()
|
|
9506
|
+
.then((session) => {
|
|
9507
|
+
this.session = session;
|
|
9508
|
+
return session;
|
|
9509
|
+
})
|
|
9510
|
+
.finally(() => {
|
|
9511
|
+
this.pendingSession = null;
|
|
9512
|
+
});
|
|
9513
|
+
return this.pendingSession;
|
|
9495
9514
|
}
|
|
9496
9515
|
/* ---------------------------------------------- *
|
|
9497
9516
|
* STORE (overwrites the cached value)
|
|
@@ -9504,6 +9523,7 @@ class ServerSessionManager {
|
|
|
9504
9523
|
* ---------------------------------------------- */
|
|
9505
9524
|
clearSession() {
|
|
9506
9525
|
this.session = null;
|
|
9526
|
+
this.pendingSession = null;
|
|
9507
9527
|
}
|
|
9508
9528
|
/* ---------------------------------------------- *
|
|
9509
9529
|
* QUICK helpers
|
|
@@ -9806,6 +9826,150 @@ function hashForKey$1(value) {
|
|
|
9806
9826
|
}
|
|
9807
9827
|
return h.toString(36);
|
|
9808
9828
|
}
|
|
9829
|
+
/**
|
|
9830
|
+
* Validates that a field name is a safe identifier (alphanumeric, underscores, dots for nested paths).
|
|
9831
|
+
* Prevents prompt injection via crafted field names.
|
|
9832
|
+
*/
|
|
9833
|
+
function validateFieldName(field) {
|
|
9834
|
+
if (!/^[a-zA-Z0-9_.]+$/.test(field)) {
|
|
9835
|
+
throw new Error(`Invalid field name "${field}". Field names must only contain letters, numbers, underscores, and dots.`);
|
|
9836
|
+
}
|
|
9837
|
+
}
|
|
9838
|
+
/**
|
|
9839
|
+
* Parses a raw aggregation result (e.g. [{ count: 42 }] or [{ _id: null, total: 100 }])
|
|
9840
|
+
* into a single numeric value.
|
|
9841
|
+
*/
|
|
9842
|
+
function parseAggregateValue(result) {
|
|
9843
|
+
if (typeof result === 'number')
|
|
9844
|
+
return result;
|
|
9845
|
+
if (Array.isArray(result)) {
|
|
9846
|
+
if (result.length === 0)
|
|
9847
|
+
return 0;
|
|
9848
|
+
// Multiple elements — not a collapsed aggregate result
|
|
9849
|
+
if (result.length > 1) {
|
|
9850
|
+
throw new Error(`Unexpected aggregate result: got array with ${result.length} elements. The AI may have returned full documents instead of an aggregation.`);
|
|
9851
|
+
}
|
|
9852
|
+
const first = result[0];
|
|
9853
|
+
if (typeof first === 'number')
|
|
9854
|
+
return first;
|
|
9855
|
+
if (first && typeof first === 'object') {
|
|
9856
|
+
// $count stage returns { count: N }
|
|
9857
|
+
if (typeof first.count === 'number')
|
|
9858
|
+
return first.count;
|
|
9859
|
+
// $group stage returns { _id: null, result: N } — expect _id + one numeric field
|
|
9860
|
+
const numericEntries = Object.entries(first).filter(([key, val]) => key !== '_id' && typeof val === 'number');
|
|
9861
|
+
if (numericEntries.length === 1)
|
|
9862
|
+
return numericEntries[0][1];
|
|
9863
|
+
}
|
|
9864
|
+
// Avoid leaking document contents into error messages
|
|
9865
|
+
const shape = first && typeof first === 'object' ? `{${Object.keys(first).join(', ')}}` : String(first);
|
|
9866
|
+
throw new Error(`Unexpected aggregate result shape: ${shape}. Expected {count: N} or {_id: null, <field>: N}.`);
|
|
9867
|
+
}
|
|
9868
|
+
if (result && typeof result === 'object' && typeof result.count === 'number') {
|
|
9869
|
+
return result.count;
|
|
9870
|
+
}
|
|
9871
|
+
throw new Error(`Unexpected aggregate result type: ${typeof result}. Expected a number, array, or object with a count field.`);
|
|
9872
|
+
}
|
|
9873
|
+
/**
|
|
9874
|
+
* Count items in a collection path. Returns a numeric result.
|
|
9875
|
+
*
|
|
9876
|
+
* This uses the AI query engine with a count-specific prompt prefix,
|
|
9877
|
+
* so TaroBase will generate a $count aggregation pipeline and return
|
|
9878
|
+
* just the count rather than full documents.
|
|
9879
|
+
*
|
|
9880
|
+
* IMPORTANT: This only works for collections where the read policy is "true".
|
|
9881
|
+
* If the read policy requires per-document checks, the server will return
|
|
9882
|
+
* an error because aggregate counts cannot be performed without pulling all
|
|
9883
|
+
* documents for access control evaluation.
|
|
9884
|
+
*
|
|
9885
|
+
* @param path - Collection path (e.g., "posts", "users/abc/comments")
|
|
9886
|
+
* @param opts - Optional filter prompt and overrides
|
|
9887
|
+
* @returns AggregateResult with the count value
|
|
9888
|
+
*/
|
|
9889
|
+
async function count(path, opts = {}) {
|
|
9890
|
+
const prefix = 'Return ONLY the total count of matching documents. Use the $count stage to produce a field named "count". Do NOT return the documents themselves.';
|
|
9891
|
+
const fullPrompt = opts.prompt
|
|
9892
|
+
? `${prefix} Filter: ${opts.prompt}`
|
|
9893
|
+
: prefix;
|
|
9894
|
+
const result = await get$2(path, { prompt: fullPrompt, bypassCache: true, _overrides: opts._overrides });
|
|
9895
|
+
return { value: parseAggregateValue(result) };
|
|
9896
|
+
}
|
|
9897
|
+
/**
|
|
9898
|
+
* Run an aggregate operation on a collection path. Returns a numeric result.
|
|
9899
|
+
*
|
|
9900
|
+
* Supported operations:
|
|
9901
|
+
* - count: Total number of documents
|
|
9902
|
+
* - uniqueCount: Number of distinct values for a field
|
|
9903
|
+
* - sum: Sum of a numeric field
|
|
9904
|
+
* - avg: Average of a numeric field
|
|
9905
|
+
* - min: Minimum value of a numeric field
|
|
9906
|
+
* - max: Maximum value of a numeric field
|
|
9907
|
+
*
|
|
9908
|
+
* IMPORTANT: This only works for collections where the read policy is "true".
|
|
9909
|
+
* If the read policy requires per-document checks, the server will return
|
|
9910
|
+
* an error because aggregate operations cannot be performed without pulling
|
|
9911
|
+
* all documents for access control evaluation.
|
|
9912
|
+
*
|
|
9913
|
+
* @param path - Collection path (e.g., "posts", "users/abc/comments")
|
|
9914
|
+
* @param operation - The aggregate operation to perform
|
|
9915
|
+
* @param opts - Options including optional filter prompt and field name
|
|
9916
|
+
* @returns AggregateResult with the computed numeric value
|
|
9917
|
+
*/
|
|
9918
|
+
async function aggregate(path, operation, opts = {}) {
|
|
9919
|
+
let prefix;
|
|
9920
|
+
switch (operation) {
|
|
9921
|
+
case 'count':
|
|
9922
|
+
prefix = 'Return ONLY the total count of matching documents. Use the $count stage to produce a field named "count". Do NOT return the documents themselves.';
|
|
9923
|
+
break;
|
|
9924
|
+
case 'uniqueCount':
|
|
9925
|
+
if (!opts.field)
|
|
9926
|
+
throw new Error('aggregate "uniqueCount" requires a field option');
|
|
9927
|
+
validateFieldName(opts.field);
|
|
9928
|
+
prefix = `Return ONLY the count of unique/distinct values of the "${opts.field}" field. Use $group with _id set to "$${opts.field}" then $count to produce a field named "count". Do NOT return the documents themselves.`;
|
|
9929
|
+
break;
|
|
9930
|
+
case 'sum':
|
|
9931
|
+
if (!opts.field)
|
|
9932
|
+
throw new Error('aggregate "sum" requires a field option');
|
|
9933
|
+
validateFieldName(opts.field);
|
|
9934
|
+
prefix = `Return ONLY the sum of the "${opts.field}" field across all matching documents. Use $group with _id: null and result: { $sum: "$${opts.field}" }. Do NOT return the documents themselves.`;
|
|
9935
|
+
break;
|
|
9936
|
+
case 'avg':
|
|
9937
|
+
if (!opts.field)
|
|
9938
|
+
throw new Error('aggregate "avg" requires a field option');
|
|
9939
|
+
validateFieldName(opts.field);
|
|
9940
|
+
prefix = `Return ONLY the average of the "${opts.field}" field across all matching documents. Use $group with _id: null and result: { $avg: "$${opts.field}" }. Do NOT return the documents themselves.`;
|
|
9941
|
+
break;
|
|
9942
|
+
case 'min':
|
|
9943
|
+
if (!opts.field)
|
|
9944
|
+
throw new Error('aggregate "min" requires a field option');
|
|
9945
|
+
validateFieldName(opts.field);
|
|
9946
|
+
prefix = `Return ONLY the minimum value of the "${opts.field}" field across all matching documents. Use $group with _id: null and result: { $min: "$${opts.field}" }. Do NOT return the documents themselves.`;
|
|
9947
|
+
break;
|
|
9948
|
+
case 'max':
|
|
9949
|
+
if (!opts.field)
|
|
9950
|
+
throw new Error('aggregate "max" requires a field option');
|
|
9951
|
+
validateFieldName(opts.field);
|
|
9952
|
+
prefix = `Return ONLY the maximum value of the "${opts.field}" field across all matching documents. Use $group with _id: null and result: { $max: "$${opts.field}" }. Do NOT return the documents themselves.`;
|
|
9953
|
+
break;
|
|
9954
|
+
default:
|
|
9955
|
+
throw new Error(`Unsupported aggregate operation: ${operation}`);
|
|
9956
|
+
}
|
|
9957
|
+
const fullPrompt = opts.prompt
|
|
9958
|
+
? `${prefix} Filter: ${opts.prompt}`
|
|
9959
|
+
: prefix;
|
|
9960
|
+
const result = await get$2(path, { prompt: fullPrompt, bypassCache: true, _overrides: opts._overrides });
|
|
9961
|
+
// For uniqueCount, the AI may return $group results without the final $count
|
|
9962
|
+
// stage, producing [{_id: "val1"}, {_id: "val2"}, ...]. Verify elements look
|
|
9963
|
+
// like $group output (only _id key) before using array length as the count.
|
|
9964
|
+
if (operation === 'uniqueCount' && Array.isArray(result) && result.length > 1) {
|
|
9965
|
+
const looksLikeGroupOutput = result.every((el) => el && typeof el === 'object' && Object.keys(el).length === 1 && '_id' in el);
|
|
9966
|
+
if (looksLikeGroupOutput) {
|
|
9967
|
+
return { value: result.length };
|
|
9968
|
+
}
|
|
9969
|
+
throw new Error(`Unexpected uniqueCount result: got ${result.length} elements that don't match $group output shape.`);
|
|
9970
|
+
}
|
|
9971
|
+
return { value: parseAggregateValue(result) };
|
|
9972
|
+
}
|
|
9809
9973
|
async function get$2(path, opts = {}) {
|
|
9810
9974
|
try {
|
|
9811
9975
|
let normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
@@ -10272,7 +10436,7 @@ const BASE_MIN_RECONNECT_DELAY_MS = 1000;
|
|
|
10272
10436
|
const MIN_RECONNECT_DELAY_JITTER_MS = 1000;
|
|
10273
10437
|
const MAX_RECONNECT_DELAY_MS = 300000;
|
|
10274
10438
|
const RECONNECT_DELAY_GROW_FACTOR = 1.8;
|
|
10275
|
-
const MIN_BROWSER_RECONNECT_INTERVAL_MS =
|
|
10439
|
+
const MIN_BROWSER_RECONNECT_INTERVAL_MS = 5000;
|
|
10276
10440
|
const WS_CONFIG = {
|
|
10277
10441
|
// Keep retrying indefinitely so long outages recover without page refresh.
|
|
10278
10442
|
maxRetries: Infinity,
|
|
@@ -10437,6 +10601,8 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
10437
10601
|
isConnected: false,
|
|
10438
10602
|
appId,
|
|
10439
10603
|
tokenRefreshTimer: null,
|
|
10604
|
+
lastMessageAt: Date.now(),
|
|
10605
|
+
keepaliveTimer: null,
|
|
10440
10606
|
};
|
|
10441
10607
|
connections.set(appId, connection);
|
|
10442
10608
|
// URL provider for reconnection with fresh tokens
|
|
@@ -10473,6 +10639,7 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
10473
10639
|
ws.addEventListener('open', () => {
|
|
10474
10640
|
connection.isConnecting = false;
|
|
10475
10641
|
connection.isConnected = true;
|
|
10642
|
+
connection.lastMessageAt = Date.now();
|
|
10476
10643
|
// Schedule token refresh before expiry
|
|
10477
10644
|
(async () => {
|
|
10478
10645
|
const token = await getIdToken$1(isServer);
|
|
@@ -10480,11 +10647,28 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
10480
10647
|
})();
|
|
10481
10648
|
// Re-subscribe to all existing subscriptions after reconnect
|
|
10482
10649
|
for (const sub of connection.subscriptions.values()) {
|
|
10650
|
+
sub.lastData = undefined;
|
|
10483
10651
|
sendSubscribe(connection, sub);
|
|
10484
10652
|
}
|
|
10653
|
+
// Start keepalive detection — if no messages for 90s, force reconnect
|
|
10654
|
+
if (connection.keepaliveTimer) {
|
|
10655
|
+
clearInterval(connection.keepaliveTimer);
|
|
10656
|
+
}
|
|
10657
|
+
connection.keepaliveTimer = setInterval(() => {
|
|
10658
|
+
var _a;
|
|
10659
|
+
if (Date.now() - connection.lastMessageAt > 90000) {
|
|
10660
|
+
console.warn('[WS v2] No messages received for 90s, forcing reconnect');
|
|
10661
|
+
if (connection.keepaliveTimer) {
|
|
10662
|
+
clearInterval(connection.keepaliveTimer);
|
|
10663
|
+
connection.keepaliveTimer = null;
|
|
10664
|
+
}
|
|
10665
|
+
(_a = connection.ws) === null || _a === void 0 ? void 0 : _a.reconnect();
|
|
10666
|
+
}
|
|
10667
|
+
}, 30000);
|
|
10485
10668
|
});
|
|
10486
10669
|
// Handle incoming messages
|
|
10487
10670
|
ws.addEventListener('message', (event) => {
|
|
10671
|
+
connection.lastMessageAt = Date.now();
|
|
10488
10672
|
try {
|
|
10489
10673
|
const message = JSON.parse(event.data);
|
|
10490
10674
|
handleServerMessage(connection, message);
|
|
@@ -10496,20 +10680,22 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
10496
10680
|
// Handle errors
|
|
10497
10681
|
ws.addEventListener('error', (event) => {
|
|
10498
10682
|
console.error('[WS v2] WebSocket error:', event);
|
|
10499
|
-
|
|
10500
|
-
for (const [id, pending] of connection.pendingSubscriptions) {
|
|
10683
|
+
for (const [, pending] of connection.pendingSubscriptions) {
|
|
10501
10684
|
pending.reject(new Error('WebSocket error'));
|
|
10502
|
-
connection.pendingSubscriptions.delete(id);
|
|
10503
10685
|
}
|
|
10686
|
+
connection.pendingSubscriptions.clear();
|
|
10504
10687
|
});
|
|
10505
10688
|
// Handle close
|
|
10506
10689
|
ws.addEventListener('close', () => {
|
|
10507
10690
|
connection.isConnected = false;
|
|
10508
|
-
// Clear token refresh timer
|
|
10509
10691
|
if (connection.tokenRefreshTimer) {
|
|
10510
10692
|
clearTimeout(connection.tokenRefreshTimer);
|
|
10511
10693
|
connection.tokenRefreshTimer = null;
|
|
10512
10694
|
}
|
|
10695
|
+
if (connection.keepaliveTimer) {
|
|
10696
|
+
clearInterval(connection.keepaliveTimer);
|
|
10697
|
+
connection.keepaliveTimer = null;
|
|
10698
|
+
}
|
|
10513
10699
|
});
|
|
10514
10700
|
return connection;
|
|
10515
10701
|
}
|
|
@@ -10709,9 +10895,7 @@ async function subscribeV2(path, subscriptionOptions) {
|
|
|
10709
10895
|
await subscriptionPromise;
|
|
10710
10896
|
}
|
|
10711
10897
|
catch (error) {
|
|
10712
|
-
|
|
10713
|
-
connection.subscriptions.delete(subscriptionId);
|
|
10714
|
-
throw error;
|
|
10898
|
+
console.warn('[WS v2] Subscription confirmation failed, keeping for reconnect recovery:', error);
|
|
10715
10899
|
}
|
|
10716
10900
|
}
|
|
10717
10901
|
// Return unsubscribe function
|
|
@@ -10827,8 +11011,6 @@ async function reconnectWithNewAuthV2() {
|
|
|
10827
11011
|
if (!connection.ws) {
|
|
10828
11012
|
continue;
|
|
10829
11013
|
}
|
|
10830
|
-
// Reject any pending subscriptions - they'll need to be retried after reconnect
|
|
10831
|
-
// This prevents hanging promises during auth transitions
|
|
10832
11014
|
for (const [, pending] of connection.pendingSubscriptions) {
|
|
10833
11015
|
pending.reject(new Error('Connection reconnecting due to auth change'));
|
|
10834
11016
|
}
|
|
@@ -13291,6 +13473,54 @@ function requireBuffer () {
|
|
|
13291
13473
|
|
|
13292
13474
|
var bufferExports = requireBuffer();
|
|
13293
13475
|
|
|
13476
|
+
/**
|
|
13477
|
+
* Extracts a human-readable error message from Solana transaction logs.
|
|
13478
|
+
*/
|
|
13479
|
+
function extractTransactionError(err, logMessages) {
|
|
13480
|
+
if (logMessages) {
|
|
13481
|
+
return JSON.stringify(logMessages);
|
|
13482
|
+
}
|
|
13483
|
+
if (err) {
|
|
13484
|
+
try {
|
|
13485
|
+
return JSON.stringify(err);
|
|
13486
|
+
}
|
|
13487
|
+
catch (_a) {
|
|
13488
|
+
return String(err);
|
|
13489
|
+
}
|
|
13490
|
+
}
|
|
13491
|
+
return 'Unknown transaction error';
|
|
13492
|
+
}
|
|
13493
|
+
/**
|
|
13494
|
+
* Polls getSignatureStatuses until the transaction is confirmed, then checks for errors.
|
|
13495
|
+
* Throws if the transaction failed on-chain. Returns parsed transaction info on success.
|
|
13496
|
+
*/
|
|
13497
|
+
async function confirmAndCheckTransaction(connection, signature) {
|
|
13498
|
+
var _a;
|
|
13499
|
+
const maxAttempts = 15;
|
|
13500
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
13501
|
+
const { value } = await connection.getSignatureStatuses([signature]);
|
|
13502
|
+
const status = value[0];
|
|
13503
|
+
if (status) {
|
|
13504
|
+
if (status.err) {
|
|
13505
|
+
const txInfo = await connection.getParsedTransaction(signature, {
|
|
13506
|
+
maxSupportedTransactionVersion: 0,
|
|
13507
|
+
commitment: 'confirmed'
|
|
13508
|
+
});
|
|
13509
|
+
const errorMessage = extractTransactionError(status.err, (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.logMessages);
|
|
13510
|
+
throw new Error(`Transaction failed: ${errorMessage}`);
|
|
13511
|
+
}
|
|
13512
|
+
if (status.confirmationStatus === 'confirmed' || status.confirmationStatus === 'finalized') {
|
|
13513
|
+
return await connection.getParsedTransaction(signature, {
|
|
13514
|
+
maxSupportedTransactionVersion: 0,
|
|
13515
|
+
commitment: 'confirmed'
|
|
13516
|
+
});
|
|
13517
|
+
}
|
|
13518
|
+
}
|
|
13519
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
13520
|
+
}
|
|
13521
|
+
throw new Error('Transaction confirmation timeout');
|
|
13522
|
+
}
|
|
13523
|
+
|
|
13294
13524
|
const VALID_PROVIDERS = ['injected', 'google', 'apple', 'deeplink', 'phantom'];
|
|
13295
13525
|
// Dynamically import React and Phantom SDK - only when needed
|
|
13296
13526
|
let React$1;
|
|
@@ -13312,7 +13542,7 @@ async function loadDependencies() {
|
|
|
13312
13542
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
13313
13543
|
import('react'),
|
|
13314
13544
|
import('react-dom/client'),
|
|
13315
|
-
Promise.resolve().then(function () { return require('./index-
|
|
13545
|
+
Promise.resolve().then(function () { return require('./index-Cx0ON8Td.js'); })
|
|
13316
13546
|
]);
|
|
13317
13547
|
// Extract default export from ESM module namespace
|
|
13318
13548
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -14147,10 +14377,7 @@ class PhantomWalletProvider {
|
|
|
14147
14377
|
};
|
|
14148
14378
|
}
|
|
14149
14379
|
const signature = await this.signAndSendViaPhantom(tx);
|
|
14150
|
-
const txInfo = await connection
|
|
14151
|
-
maxSupportedTransactionVersion: 0,
|
|
14152
|
-
commitment: 'confirmed'
|
|
14153
|
-
});
|
|
14380
|
+
const txInfo = await confirmAndCheckTransaction(connection, signature);
|
|
14154
14381
|
return {
|
|
14155
14382
|
transactionSignature: signature,
|
|
14156
14383
|
blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
|
|
@@ -14336,7 +14563,9 @@ class PhantomWalletProvider {
|
|
|
14336
14563
|
const { signature } = await this.submitSignedTransactionWithBlockhash(signedTx, connection, blockhash, lastValidBlockHeight);
|
|
14337
14564
|
return signature;
|
|
14338
14565
|
}
|
|
14339
|
-
|
|
14566
|
+
const signature = await this.signAndSendViaPhantom(transaction);
|
|
14567
|
+
await confirmAndCheckTransaction(connection, signature);
|
|
14568
|
+
return signature;
|
|
14340
14569
|
}
|
|
14341
14570
|
catch (error) {
|
|
14342
14571
|
// Check if this is a connection error - if so, log out
|
|
@@ -33002,7 +33231,7 @@ class PrivyWalletProvider {
|
|
|
33002
33231
|
await this.privyMethods.logout();
|
|
33003
33232
|
}
|
|
33004
33233
|
async runTransaction(_evmTransactionData, solTransactionData, options) {
|
|
33005
|
-
var _a;
|
|
33234
|
+
var _a, _b;
|
|
33006
33235
|
await this.ensureReady({ waitForWallets: true });
|
|
33007
33236
|
let session = await WebSessionManager.getSession();
|
|
33008
33237
|
let sessionAddress = session === null || session === void 0 ? void 0 : session.address;
|
|
@@ -33084,12 +33313,12 @@ class PrivyWalletProvider {
|
|
|
33084
33313
|
};
|
|
33085
33314
|
}
|
|
33086
33315
|
// Sign and submit using shared helper
|
|
33087
|
-
const
|
|
33316
|
+
const { signature, txInfo } = await this.signAndSubmitInternal(tx, privyWallet, rpcUrl, connection);
|
|
33088
33317
|
return {
|
|
33089
|
-
transactionSignature:
|
|
33090
|
-
blockNumber: 0,
|
|
33091
|
-
gasUsed:
|
|
33092
|
-
data:
|
|
33318
|
+
transactionSignature: signature,
|
|
33319
|
+
blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
|
|
33320
|
+
gasUsed: ((_b = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _b === void 0 ? void 0 : _b.fee.toString()) || '0',
|
|
33321
|
+
data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,
|
|
33093
33322
|
};
|
|
33094
33323
|
}
|
|
33095
33324
|
catch (err) {
|
|
@@ -33235,7 +33464,8 @@ class PrivyWalletProvider {
|
|
|
33235
33464
|
// and cannot be modified after creation
|
|
33236
33465
|
}
|
|
33237
33466
|
// Use shared sign and submit logic
|
|
33238
|
-
|
|
33467
|
+
const { signature } = await this.signAndSubmitInternal(transaction, privyWallet, rpcUrl, connection);
|
|
33468
|
+
return signature;
|
|
33239
33469
|
}
|
|
33240
33470
|
// ============ Private Helpers ============
|
|
33241
33471
|
getRpcUrl(network) {
|
|
@@ -33319,15 +33549,14 @@ class PrivyWalletProvider {
|
|
|
33319
33549
|
* For Surfnet: sign with signTransactionRaw, then sendRawTransaction
|
|
33320
33550
|
* For non-Surfnet: use Privy's signAndSendTransaction (combined operation)
|
|
33321
33551
|
*/
|
|
33322
|
-
async signAndSubmitInternal(transaction, privyWallet, rpcUrl) {
|
|
33552
|
+
async signAndSubmitInternal(transaction, privyWallet, rpcUrl, connection) {
|
|
33323
33553
|
var _a;
|
|
33324
33554
|
const isSurfnet = rpcUrl === SURFNET_RPC_URL$1;
|
|
33555
|
+
let signature;
|
|
33325
33556
|
if (isSurfnet) {
|
|
33326
33557
|
// For Surfnet: sign with signTransactionRaw, then sendRawTransaction
|
|
33327
33558
|
const signedTx = await this.signTransactionRaw(transaction, privyWallet);
|
|
33328
|
-
|
|
33329
|
-
const signature = await connection.sendRawTransaction(signedTx);
|
|
33330
|
-
return signature;
|
|
33559
|
+
signature = await connection.sendRawTransaction(signedTx);
|
|
33331
33560
|
}
|
|
33332
33561
|
else {
|
|
33333
33562
|
// For non-Surfnet: use Privy's combined signAndSendTransaction
|
|
@@ -33347,13 +33576,16 @@ class PrivyWalletProvider {
|
|
|
33347
33576
|
chain: this.chainId
|
|
33348
33577
|
}));
|
|
33349
33578
|
// Handle case where signature might be bytes instead of string
|
|
33350
|
-
|
|
33351
|
-
if (
|
|
33352
|
-
|
|
33353
|
-
|
|
33579
|
+
const rawSig = result.signature;
|
|
33580
|
+
if (rawSig instanceof Uint8Array || Array.isArray(rawSig)) {
|
|
33581
|
+
signature = bs58.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
|
|
33582
|
+
}
|
|
33583
|
+
else {
|
|
33584
|
+
signature = rawSig;
|
|
33354
33585
|
}
|
|
33355
|
-
return signature;
|
|
33356
33586
|
}
|
|
33587
|
+
const txInfo = await confirmAndCheckTransaction(connection, signature);
|
|
33588
|
+
return { signature, txInfo };
|
|
33357
33589
|
}
|
|
33358
33590
|
async signMessage(message) {
|
|
33359
33591
|
var _a, _b;
|
|
@@ -34620,11 +34852,13 @@ exports.PhantomWalletProvider = PhantomWalletProvider;
|
|
|
34620
34852
|
exports.PrivyWalletProvider = PrivyWalletProvider;
|
|
34621
34853
|
exports.ServerSessionManager = ServerSessionManager;
|
|
34622
34854
|
exports.WebSessionManager = WebSessionManager;
|
|
34855
|
+
exports.aggregate = aggregate;
|
|
34623
34856
|
exports.bufferExports = bufferExports;
|
|
34624
34857
|
exports.buildSetDocumentsTransaction = buildSetDocumentsTransaction;
|
|
34625
34858
|
exports.clearCache = clearCache;
|
|
34626
34859
|
exports.closeAllSubscriptions = closeAllSubscriptions;
|
|
34627
34860
|
exports.convertRemainingAccounts = convertRemainingAccounts;
|
|
34861
|
+
exports.count = count;
|
|
34628
34862
|
exports.createSessionWithPrivy = createSessionWithPrivy;
|
|
34629
34863
|
exports.createSessionWithSignature = createSessionWithSignature;
|
|
34630
34864
|
exports.genAuthNonce = genAuthNonce;
|
|
@@ -34658,4 +34892,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
|
|
|
34658
34892
|
exports.signTransaction = signTransaction;
|
|
34659
34893
|
exports.subscribe = subscribe;
|
|
34660
34894
|
exports.useAuth = useAuth;
|
|
34661
|
-
//# sourceMappingURL=index-
|
|
34895
|
+
//# sourceMappingURL=index-Ce_FPfWw.js.map
|