@pooflabs/web 0.0.5 → 0.0.6

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.js CHANGED
@@ -4174,7 +4174,7 @@ class PhantomWalletProvider {
4174
4174
  }
4175
4175
  }
4176
4176
  async runTransaction(evmTransactionData, solTransactionData, options) {
4177
- var _a;
4177
+ var _a, _b, _c, _d, _e;
4178
4178
  if (!solTransactionData) {
4179
4179
  throw new Error("Solana transaction data is required for Phantom wallet");
4180
4180
  }
@@ -4263,7 +4263,15 @@ class PhantomWalletProvider {
4263
4263
  };
4264
4264
  }
4265
4265
  catch (error) {
4266
- console.error('Failed to execute transaction', error);
4266
+ // Check if this is a user rejection (don't log these as errors)
4267
+ const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
4268
+ ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user rejected')) ||
4269
+ ((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes('user denied')) ||
4270
+ ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes('user cancelled')) ||
4271
+ ((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('user canceled'));
4272
+ if (!isUserRejection) {
4273
+ console.error('Failed to execute transaction', error);
4274
+ }
4267
4275
  throw new Error(`Failed to execute transaction: ${error.message}`);
4268
4276
  }
4269
4277
  }
@@ -4285,6 +4293,7 @@ class PhantomWalletProvider {
4285
4293
  }
4286
4294
  }
4287
4295
  async signMessage(message) {
4296
+ var _a, _b, _c, _d;
4288
4297
  try {
4289
4298
  // Use ensureConnected to auto-connect if needed
4290
4299
  const provider = await this.ensureConnected();
@@ -4305,7 +4314,15 @@ class PhantomWalletProvider {
4305
4314
  return Buffer.from(signatureResponse.signature).toString('base64');
4306
4315
  }
4307
4316
  catch (error) {
4308
- console.error('Failed to sign message', error);
4317
+ // Check if this is a user rejection (don't log these as errors)
4318
+ const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
4319
+ ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||
4320
+ ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||
4321
+ ((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes('user cancelled')) ||
4322
+ ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes('user canceled'));
4323
+ if (!isUserRejection) {
4324
+ console.error('Failed to sign message', error);
4325
+ }
4309
4326
  throw new Error('Failed to sign message');
4310
4327
  }
4311
4328
  }
@@ -19490,7 +19507,10 @@ class PrivyWalletProvider {
19490
19507
  }
19491
19508
  },
19492
19509
  onError: (error) => {
19493
- console.error('Wallet connection error:', error);
19510
+ // Only log errors that aren't user-initiated cancellations
19511
+ if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {
19512
+ console.error('Wallet connection error:', error);
19513
+ }
19494
19514
  if (that.pendingTransaction) {
19495
19515
  that.pendingTransaction.reject(error);
19496
19516
  that.pendingTransaction = null;
@@ -19536,7 +19556,10 @@ class PrivyWalletProvider {
19536
19556
  }
19537
19557
  },
19538
19558
  onError: (error) => {
19539
- console.error('Login error:', error);
19559
+ // Only log errors that aren't user-initiated cancellations
19560
+ if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {
19561
+ console.error('Login error:', error);
19562
+ }
19540
19563
  if (that.pendingLogin) {
19541
19564
  that.pendingLogin.reject(error);
19542
19565
  that.pendingLogin = null;
@@ -20093,6 +20116,15 @@ function setCurrentUser(user) {
20093
20116
  function getCurrentUser() {
20094
20117
  return currentUser;
20095
20118
  }
20119
+ async function signTransaction(transaction) {
20120
+ if (!authProviderInstance) {
20121
+ authProviderInstance = await getAuthProvider();
20122
+ }
20123
+ if (!currentUser) {
20124
+ throw new Error('No user logged in. Please call login() first.');
20125
+ }
20126
+ return await authProviderInstance.signTransaction(transaction);
20127
+ }
20096
20128
 
20097
20129
  // Cache for get responses
20098
20130
  const getCache = {};
@@ -21181,7 +21213,10 @@ function useAuth() {
21181
21213
  setUser(user);
21182
21214
  }
21183
21215
  catch (error) {
21184
- console.error('Error logging in:', error);
21216
+ // Only log errors that aren't user-initiated cancellations
21217
+ if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {
21218
+ console.error('Error logging in:', error);
21219
+ }
21185
21220
  setUser(null);
21186
21221
  }
21187
21222
  finally {
@@ -21225,6 +21260,7 @@ exports.runQueryMany = runQueryMany;
21225
21260
  exports.set = set;
21226
21261
  exports.setFile = setFile;
21227
21262
  exports.setMany = setMany;
21263
+ exports.signTransaction = signTransaction;
21228
21264
  exports.subscribe = subscribe;
21229
21265
  exports.syncItems = syncItems;
21230
21266
  exports.useAuth = useAuth;