@pooflabs/web 0.0.4 → 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/global.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +63 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +63 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -19469,6 +19486,7 @@ class PrivyWalletProvider {
|
|
|
19469
19486
|
const useOAuthTokens = privyImports.useOAuthTokens();
|
|
19470
19487
|
const useFundWalletSolana = privySolana.useFundWallet();
|
|
19471
19488
|
const useSendTransactionSolana = privySolana.useSendTransaction();
|
|
19489
|
+
const { signTransaction } = privySolana.useSignTransaction();
|
|
19472
19490
|
const useSolanaWallets = privySolana.useSolanaWallets();
|
|
19473
19491
|
const useIdentityToken = privyImports.useIdentityToken();
|
|
19474
19492
|
const { createWallet, wallets, ready: walletReady } = privySolana.useSolanaWallets();
|
|
@@ -19489,7 +19507,10 @@ class PrivyWalletProvider {
|
|
|
19489
19507
|
}
|
|
19490
19508
|
},
|
|
19491
19509
|
onError: (error) => {
|
|
19492
|
-
|
|
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
|
+
}
|
|
19493
19514
|
if (that.pendingTransaction) {
|
|
19494
19515
|
that.pendingTransaction.reject(error);
|
|
19495
19516
|
that.pendingTransaction = null;
|
|
@@ -19535,7 +19556,10 @@ class PrivyWalletProvider {
|
|
|
19535
19556
|
}
|
|
19536
19557
|
},
|
|
19537
19558
|
onError: (error) => {
|
|
19538
|
-
|
|
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
|
+
}
|
|
19539
19563
|
if (that.pendingLogin) {
|
|
19540
19564
|
that.pendingLogin.reject(error);
|
|
19541
19565
|
that.pendingLogin = null;
|
|
@@ -19564,6 +19588,7 @@ class PrivyWalletProvider {
|
|
|
19564
19588
|
useFundWalletSolana: useFundWalletSolana,
|
|
19565
19589
|
useSendTransactionSolana: useSendTransactionSolana,
|
|
19566
19590
|
useSolanaWallets: useSolanaWallets,
|
|
19591
|
+
signTransaction: signTransaction,
|
|
19567
19592
|
};
|
|
19568
19593
|
}
|
|
19569
19594
|
}, [privy.ready, privy.authenticated, wallets, login, logout, walletReady]);
|
|
@@ -19628,7 +19653,7 @@ class PrivyWalletProvider {
|
|
|
19628
19653
|
await this.privyMethods.logout();
|
|
19629
19654
|
}
|
|
19630
19655
|
async runTransaction(_evmTransactionData, solTransactionData, options) {
|
|
19631
|
-
var _a;
|
|
19656
|
+
var _a, _b, _c;
|
|
19632
19657
|
await this.ensureReady();
|
|
19633
19658
|
let session = await SessionManager.getSession();
|
|
19634
19659
|
let sessionAddress = session === null || session === void 0 ? void 0 : session.address;
|
|
@@ -19697,7 +19722,11 @@ class PrivyWalletProvider {
|
|
|
19697
19722
|
}
|
|
19698
19723
|
try {
|
|
19699
19724
|
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
19700
|
-
const signedTx = await
|
|
19725
|
+
const signedTx = await ((_b = this.privyMethods) === null || _b === void 0 ? void 0 : _b.signTransaction({
|
|
19726
|
+
transaction: tx,
|
|
19727
|
+
connection,
|
|
19728
|
+
address: wallet.address.toString(),
|
|
19729
|
+
}));
|
|
19701
19730
|
return {
|
|
19702
19731
|
signedTransaction: signedTx,
|
|
19703
19732
|
blockNumber: 0,
|
|
@@ -19705,7 +19734,19 @@ class PrivyWalletProvider {
|
|
|
19705
19734
|
data: ""
|
|
19706
19735
|
};
|
|
19707
19736
|
}
|
|
19708
|
-
const
|
|
19737
|
+
const isSurfnet = connection.rpcEndpoint === SURFNET_RPC_URL;
|
|
19738
|
+
let txSignature;
|
|
19739
|
+
if (isSurfnet) {
|
|
19740
|
+
const signedTx = await ((_c = this.privyMethods) === null || _c === void 0 ? void 0 : _c.signTransaction({
|
|
19741
|
+
transaction: tx,
|
|
19742
|
+
connection,
|
|
19743
|
+
address: wallet.address.toString(),
|
|
19744
|
+
}));
|
|
19745
|
+
txSignature = await connection.sendRawTransaction(signedTx.serialize());
|
|
19746
|
+
}
|
|
19747
|
+
else {
|
|
19748
|
+
txSignature = await privyWallet.sendTransaction(tx, connection);
|
|
19749
|
+
}
|
|
19709
19750
|
return {
|
|
19710
19751
|
transactionSignature: txSignature,
|
|
19711
19752
|
blockNumber: 0,
|
|
@@ -20075,6 +20116,15 @@ function setCurrentUser(user) {
|
|
|
20075
20116
|
function getCurrentUser() {
|
|
20076
20117
|
return currentUser;
|
|
20077
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
|
+
}
|
|
20078
20128
|
|
|
20079
20129
|
// Cache for get responses
|
|
20080
20130
|
const getCache = {};
|
|
@@ -21163,7 +21213,10 @@ function useAuth() {
|
|
|
21163
21213
|
setUser(user);
|
|
21164
21214
|
}
|
|
21165
21215
|
catch (error) {
|
|
21166
|
-
|
|
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
|
+
}
|
|
21167
21220
|
setUser(null);
|
|
21168
21221
|
}
|
|
21169
21222
|
finally {
|
|
@@ -21207,6 +21260,7 @@ exports.runQueryMany = runQueryMany;
|
|
|
21207
21260
|
exports.set = set;
|
|
21208
21261
|
exports.setFile = setFile;
|
|
21209
21262
|
exports.setMany = setMany;
|
|
21263
|
+
exports.signTransaction = signTransaction;
|
|
21210
21264
|
exports.subscribe = subscribe;
|
|
21211
21265
|
exports.syncItems = syncItems;
|
|
21212
21266
|
exports.useAuth = useAuth;
|