@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/global.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +42 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +42 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/global.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ClientConfig } from './client/config';
|
|
2
2
|
import { User } from './types';
|
|
3
|
+
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
4
|
export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
|
|
4
5
|
export declare function onAuthStateChanged(callback: (user: User | null) => void): void;
|
|
5
6
|
export declare function login(): Promise<User | null>;
|
|
6
7
|
export declare function logout(): Promise<void>;
|
|
7
8
|
export declare function setCurrentUser(user: User | null): void;
|
|
8
9
|
export declare function getCurrentUser(): User | null;
|
|
10
|
+
export declare function signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, getCurrentUser, onAuthStateChanged, login, logout } from "./global";
|
|
1
|
+
export { init, getCurrentUser, onAuthStateChanged, login, logout, signTransaction } from "./global";
|
|
2
2
|
export { getConfig } from './client/config';
|
|
3
3
|
export { getAuthProvider, deserializeTransaction } from './auth';
|
|
4
4
|
export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, syncItems } from './client/operations';
|
package/dist/index.esm.js
CHANGED
|
@@ -4154,7 +4154,7 @@ class PhantomWalletProvider {
|
|
|
4154
4154
|
}
|
|
4155
4155
|
}
|
|
4156
4156
|
async runTransaction(evmTransactionData, solTransactionData, options) {
|
|
4157
|
-
var _a;
|
|
4157
|
+
var _a, _b, _c, _d, _e;
|
|
4158
4158
|
if (!solTransactionData) {
|
|
4159
4159
|
throw new Error("Solana transaction data is required for Phantom wallet");
|
|
4160
4160
|
}
|
|
@@ -4243,7 +4243,15 @@ class PhantomWalletProvider {
|
|
|
4243
4243
|
};
|
|
4244
4244
|
}
|
|
4245
4245
|
catch (error) {
|
|
4246
|
-
|
|
4246
|
+
// Check if this is a user rejection (don't log these as errors)
|
|
4247
|
+
const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
|
|
4248
|
+
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user rejected')) ||
|
|
4249
|
+
((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes('user denied')) ||
|
|
4250
|
+
((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes('user cancelled')) ||
|
|
4251
|
+
((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('user canceled'));
|
|
4252
|
+
if (!isUserRejection) {
|
|
4253
|
+
console.error('Failed to execute transaction', error);
|
|
4254
|
+
}
|
|
4247
4255
|
throw new Error(`Failed to execute transaction: ${error.message}`);
|
|
4248
4256
|
}
|
|
4249
4257
|
}
|
|
@@ -4265,6 +4273,7 @@ class PhantomWalletProvider {
|
|
|
4265
4273
|
}
|
|
4266
4274
|
}
|
|
4267
4275
|
async signMessage(message) {
|
|
4276
|
+
var _a, _b, _c, _d;
|
|
4268
4277
|
try {
|
|
4269
4278
|
// Use ensureConnected to auto-connect if needed
|
|
4270
4279
|
const provider = await this.ensureConnected();
|
|
@@ -4285,7 +4294,15 @@ class PhantomWalletProvider {
|
|
|
4285
4294
|
return Buffer.from(signatureResponse.signature).toString('base64');
|
|
4286
4295
|
}
|
|
4287
4296
|
catch (error) {
|
|
4288
|
-
|
|
4297
|
+
// Check if this is a user rejection (don't log these as errors)
|
|
4298
|
+
const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
|
|
4299
|
+
((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||
|
|
4300
|
+
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||
|
|
4301
|
+
((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes('user cancelled')) ||
|
|
4302
|
+
((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes('user canceled'));
|
|
4303
|
+
if (!isUserRejection) {
|
|
4304
|
+
console.error('Failed to sign message', error);
|
|
4305
|
+
}
|
|
4289
4306
|
throw new Error('Failed to sign message');
|
|
4290
4307
|
}
|
|
4291
4308
|
}
|
|
@@ -19470,7 +19487,10 @@ class PrivyWalletProvider {
|
|
|
19470
19487
|
}
|
|
19471
19488
|
},
|
|
19472
19489
|
onError: (error) => {
|
|
19473
|
-
|
|
19490
|
+
// Only log errors that aren't user-initiated cancellations
|
|
19491
|
+
if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {
|
|
19492
|
+
console.error('Wallet connection error:', error);
|
|
19493
|
+
}
|
|
19474
19494
|
if (that.pendingTransaction) {
|
|
19475
19495
|
that.pendingTransaction.reject(error);
|
|
19476
19496
|
that.pendingTransaction = null;
|
|
@@ -19516,7 +19536,10 @@ class PrivyWalletProvider {
|
|
|
19516
19536
|
}
|
|
19517
19537
|
},
|
|
19518
19538
|
onError: (error) => {
|
|
19519
|
-
|
|
19539
|
+
// Only log errors that aren't user-initiated cancellations
|
|
19540
|
+
if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {
|
|
19541
|
+
console.error('Login error:', error);
|
|
19542
|
+
}
|
|
19520
19543
|
if (that.pendingLogin) {
|
|
19521
19544
|
that.pendingLogin.reject(error);
|
|
19522
19545
|
that.pendingLogin = null;
|
|
@@ -20073,6 +20096,15 @@ function setCurrentUser(user) {
|
|
|
20073
20096
|
function getCurrentUser() {
|
|
20074
20097
|
return currentUser;
|
|
20075
20098
|
}
|
|
20099
|
+
async function signTransaction(transaction) {
|
|
20100
|
+
if (!authProviderInstance) {
|
|
20101
|
+
authProviderInstance = await getAuthProvider();
|
|
20102
|
+
}
|
|
20103
|
+
if (!currentUser) {
|
|
20104
|
+
throw new Error('No user logged in. Please call login() first.');
|
|
20105
|
+
}
|
|
20106
|
+
return await authProviderInstance.signTransaction(transaction);
|
|
20107
|
+
}
|
|
20076
20108
|
|
|
20077
20109
|
// Cache for get responses
|
|
20078
20110
|
const getCache = {};
|
|
@@ -21161,7 +21193,10 @@ function useAuth() {
|
|
|
21161
21193
|
setUser(user);
|
|
21162
21194
|
}
|
|
21163
21195
|
catch (error) {
|
|
21164
|
-
|
|
21196
|
+
// Only log errors that aren't user-initiated cancellations
|
|
21197
|
+
if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {
|
|
21198
|
+
console.error('Error logging in:', error);
|
|
21199
|
+
}
|
|
21165
21200
|
setUser(null);
|
|
21166
21201
|
}
|
|
21167
21202
|
finally {
|
|
@@ -21189,5 +21224,5 @@ function useAuth() {
|
|
|
21189
21224
|
};
|
|
21190
21225
|
}
|
|
21191
21226
|
|
|
21192
|
-
export { deserializeTransaction, get, getAuthProvider, getConfig, getCurrentUser, getFiles, getIdToken, init, login, logout, onAuthStateChanged, runQuery, runQueryMany, set, setFile, setMany, subscribe, syncItems, useAuth };
|
|
21227
|
+
export { deserializeTransaction, get, getAuthProvider, getConfig, getCurrentUser, getFiles, getIdToken, init, login, logout, onAuthStateChanged, runQuery, runQueryMany, set, setFile, setMany, signTransaction, subscribe, syncItems, useAuth };
|
|
21193
21228
|
//# sourceMappingURL=index.esm.js.map
|