@pooflabs/web 0.0.59 → 0.0.60

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.
@@ -9973,7 +9973,7 @@ async function setMany(many, options) {
9973
9973
  // Sync items after all transactions are confirmed
9974
9974
  // Wait for 1.5 seconds to ensure all transactions are confirmed
9975
9975
  await new Promise(resolve => setTimeout(resolve, 1500));
9976
- await syncItems(many.map(m => m.path));
9976
+ await syncItems(many.map(m => m.path), options);
9977
9977
  // TODO: Should we wait here or do the optimistic subscription updates like below?
9978
9978
  return Object.assign(Object.assign({}, documents.map(d => d.document)), { transactionId: lastTxSignature, signedTransaction: signedTransaction });
9979
9979
  }
@@ -10198,9 +10198,9 @@ async function signAndSubmitTransaction(transaction, feePayer) {
10198
10198
  }
10199
10199
  return config.authProvider.signAndSubmitTransaction(transaction, feePayer);
10200
10200
  }
10201
- async function syncItems(paths) {
10201
+ async function syncItems(paths, options) {
10202
10202
  try {
10203
- const response = await makeApiRequest('PUT', 'items/sync', { paths }, undefined);
10203
+ const response = await makeApiRequest('PUT', 'items/sync', { paths }, options === null || options === void 0 ? void 0 : options._overrides);
10204
10204
  return response.data;
10205
10205
  }
10206
10206
  catch (error) {
@@ -13246,7 +13246,7 @@ async function loadDependencies() {
13246
13246
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
13247
13247
  import('react'),
13248
13248
  import('react-dom/client'),
13249
- import('./index-B1INQP2H.esm.js')
13249
+ import('./index-BU0jcnYK.esm.js')
13250
13250
  ]);
13251
13251
  // Extract default export from ESM module namespace
13252
13252
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -13984,7 +13984,7 @@ class PhantomWalletProvider {
13984
13984
  return (solAddress === null || solAddress === void 0 ? void 0 : solAddress.address) || null;
13985
13985
  }
13986
13986
  async runTransaction(_evmTransactionData, solTransactionData, options) {
13987
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
13987
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
13988
13988
  if (!solTransactionData) {
13989
13989
  throw new Error("Solana transaction data is required for Phantom wallet");
13990
13990
  }
@@ -14015,6 +14015,7 @@ class PhantomWalletProvider {
14015
14015
  }
14016
14016
  const rpcUrl = this.getRpcUrl(solTransactionData.network);
14017
14017
  const connection = new Connection(rpcUrl, 'confirmed');
14018
+ const isSurfnet = rpcUrl === SURFNET_RPC_URL;
14018
14019
  try {
14019
14020
  const remainingAccounts = convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);
14020
14021
  let app_id = solTransactionData.appId;
@@ -14059,8 +14060,8 @@ class PhantomWalletProvider {
14059
14060
  delete_paths: solTransactionData.txArgs[0].deletePaths,
14060
14061
  txData: solTransactionData.txArgs[0].txData
14061
14062
  }, finalDeduped, solTransactionData.lutKey, solTransactionData.preInstructions, false);
14062
- const signedTx = await walletAdapter.signTransaction(tx);
14063
14063
  if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
14064
+ const signedTx = await walletAdapter.signTransaction(tx);
14064
14065
  return {
14065
14066
  signedTransaction: signedTx,
14066
14067
  blockNumber: 0,
@@ -14068,27 +14069,41 @@ class PhantomWalletProvider {
14068
14069
  data: ""
14069
14070
  };
14070
14071
  }
14071
- // Submit using shared helper
14072
- const { signature, txInfo } = await this.submitSignedTransaction(signedTx, connection);
14072
+ // Keep manual submission on surfnet, use Phantom's recommended signAndSend for other networks.
14073
+ if (isSurfnet) {
14074
+ const signedTx = await walletAdapter.signTransaction(tx);
14075
+ const { signature, txInfo } = await this.submitSignedTransaction(signedTx, connection);
14076
+ return {
14077
+ transactionSignature: signature,
14078
+ blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
14079
+ gasUsed: ((_c = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _c === void 0 ? void 0 : _c.fee.toString()) || '0',
14080
+ data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,
14081
+ };
14082
+ }
14083
+ const signature = await this.signAndSendViaPhantom(tx);
14084
+ const txInfo = await connection.getParsedTransaction(signature, {
14085
+ maxSupportedTransactionVersion: 0,
14086
+ commitment: 'confirmed'
14087
+ });
14073
14088
  return {
14074
14089
  transactionSignature: signature,
14075
14090
  blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
14076
- gasUsed: ((_c = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _c === void 0 ? void 0 : _c.fee.toString()) || '0',
14091
+ gasUsed: ((_d = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _d === void 0 ? void 0 : _d.fee.toString()) || '0',
14077
14092
  data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,
14078
14093
  };
14079
14094
  }
14080
14095
  catch (error) {
14081
14096
  // Check if this is a connection error - if so, log out
14082
- if (((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.includes('not connected')) || ((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.includes('connect first'))) {
14097
+ if (((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.includes('not connected')) || ((_f = error === null || error === void 0 ? void 0 : error.message) === null || _f === void 0 ? void 0 : _f.includes('connect first'))) {
14083
14098
  console.error('Solana provider connection lost during transaction, logging out');
14084
14099
  await this.logout();
14085
14100
  throw new Error('Wallet connection lost. Please reconnect.');
14086
14101
  }
14087
14102
  const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
14088
- ((_f = error === null || error === void 0 ? void 0 : error.message) === null || _f === void 0 ? void 0 : _f.toLowerCase().includes('user rejected')) ||
14089
- ((_g = error === null || error === void 0 ? void 0 : error.message) === null || _g === void 0 ? void 0 : _g.toLowerCase().includes('user denied')) ||
14090
- ((_h = error === null || error === void 0 ? void 0 : error.message) === null || _h === void 0 ? void 0 : _h.toLowerCase().includes('user cancelled')) ||
14091
- ((_j = error === null || error === void 0 ? void 0 : error.message) === null || _j === void 0 ? void 0 : _j.toLowerCase().includes('user canceled'));
14103
+ ((_g = error === null || error === void 0 ? void 0 : error.message) === null || _g === void 0 ? void 0 : _g.toLowerCase().includes('user rejected')) ||
14104
+ ((_h = error === null || error === void 0 ? void 0 : error.message) === null || _h === void 0 ? void 0 : _h.toLowerCase().includes('user denied')) ||
14105
+ ((_j = error === null || error === void 0 ? void 0 : error.message) === null || _j === void 0 ? void 0 : _j.toLowerCase().includes('user cancelled')) ||
14106
+ ((_k = error === null || error === void 0 ? void 0 : error.message) === null || _k === void 0 ? void 0 : _k.toLowerCase().includes('user canceled'));
14092
14107
  if (!isUserRejection) {
14093
14108
  console.error('Failed to execute transaction', error);
14094
14109
  }
@@ -14218,6 +14233,7 @@ class PhantomWalletProvider {
14218
14233
  }
14219
14234
  const rpcUrl = this.getRpcUrl();
14220
14235
  const connection = new Connection(rpcUrl, 'confirmed');
14236
+ const isSurfnet = rpcUrl === SURFNET_RPC_URL;
14221
14237
  try {
14222
14238
  // Get fresh blockhash and set it on the transaction before signing
14223
14239
  const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');
@@ -14248,11 +14264,13 @@ class PhantomWalletProvider {
14248
14264
  // Note: VersionedTransaction feePayer is set in the message at creation time
14249
14265
  // and cannot be modified after creation
14250
14266
  }
14251
- // Sign the transaction
14252
- const signedTx = await this.phantomMethods.solana.signTransaction(transaction);
14253
- // Submit using shared helper with the blockhash we set
14254
- const { signature } = await this.submitSignedTransactionWithBlockhash(signedTx, connection, blockhash, lastValidBlockHeight);
14255
- return signature;
14267
+ // Keep manual submission on surfnet, use Phantom's recommended signAndSend for other networks.
14268
+ if (isSurfnet) {
14269
+ const signedTx = await this.phantomMethods.solana.signTransaction(transaction);
14270
+ const { signature } = await this.submitSignedTransactionWithBlockhash(signedTx, connection, blockhash, lastValidBlockHeight);
14271
+ return signature;
14272
+ }
14273
+ return await this.signAndSendViaPhantom(transaction);
14256
14274
  }
14257
14275
  catch (error) {
14258
14276
  // Check if this is a connection error - if so, log out
@@ -14360,6 +14378,15 @@ class PhantomWalletProvider {
14360
14378
  }
14361
14379
  return SOLANA_MAINNET_RPC_URL; // default to mainnet
14362
14380
  }
14381
+ async signAndSendViaPhantom(transaction) {
14382
+ var _a, _b, _c;
14383
+ const result = await ((_b = (_a = this.phantomMethods) === null || _a === void 0 ? void 0 : _a.solana) === null || _b === void 0 ? void 0 : _b.signAndSendTransaction(transaction));
14384
+ const signature = (_c = result === null || result === void 0 ? void 0 : result.signature) !== null && _c !== void 0 ? _c : result === null || result === void 0 ? void 0 : result.hash;
14385
+ if (!signature) {
14386
+ throw new Error('Phantom did not return a transaction signature');
14387
+ }
14388
+ return signature;
14389
+ }
14363
14390
  async submitSignedTransaction(signedTx, connection) {
14364
14391
  // Get fresh blockhash for confirmation
14365
14392
  const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');
@@ -34814,4 +34841,4 @@ async function getIdToken() {
34814
34841
  }
34815
34842
 
34816
34843
  export { PrivyWalletProvider as A, buildSetDocumentsTransaction as B, clearCache as C, DEFAULT_TEST_ADDRESS as D, EventEmitter3 as E, closeAllSubscriptions as F, convertRemainingAccounts as G, createSessionWithPrivy as H, createSessionWithSignature as I, genAuthNonce as J, genSolanaMessage as K, getCachedData as L, MockAuthProvider as M, reconnectWithNewAuth as N, OffchainAuthProvider as O, PhantomWalletProvider as P, refreshSession as Q, signSessionCreateMessage as R, ServerSessionManager as S, WebSessionManager as W, bs58 as a, bufferExports as b, onAuthLoadingChanged as c, getAuthLoading as d, logout as e, getConfig as f, getCurrentUser as g, getAuthProvider as h, init as i, get$2 as j, setMany as k, login as l, setFile as m, getFiles as n, onAuthStateChanged as o, runQueryMany as p, runExpression as q, runQuery as r, set$1 as s, runExpressionMany as t, signMessage as u, signTransaction as v, signAndSubmitTransaction as w, subscribe as x, useAuth as y, getIdToken as z };
34817
- //# sourceMappingURL=index-C9sapvtl.esm.js.map
34844
+ //# sourceMappingURL=index-Bt89WhpV.esm.js.map