@pooflabs/web 0.0.9 → 0.0.11
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/hooks/useAuth.d.ts +1 -1
- package/dist/auth/index.d.ts +5 -4
- package/dist/auth/providers/mock-auth-provider.d.ts +42 -0
- package/dist/auth/providers/phantom-wallet-provider.d.ts +8 -66
- package/dist/auth/providers/privy-wallet-provider.d.ts +1 -3
- package/dist/global.d.ts +1 -4
- package/dist/index.d.ts +10 -7
- package/dist/index.esm.js +39707 -34827
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +39831 -34938
- package/dist/index.js.map +1 -1
- package/package.json +5 -19
- package/dist/auth/providers/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpDevnet-program.d.ts +0 -1814
- package/dist/auth/providers/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpMainnet-program.d.ts +0 -1814
- package/dist/auth/providers/sol/sol-utils.d.ts +0 -42
- package/dist/auth/providers/sol/taro6CvKqwrYrDc16ufYgzQ2NZcyyVKStffbtudrhRuDevnet-program.d.ts +0 -1161
- package/dist/auth/utils/auth-api.d.ts +0 -6
- package/dist/auth/utils/session-manager.d.ts +0 -14
- package/dist/auth/utils/utils.d.ts +0 -8
- package/dist/client/config.d.ts +0 -20
- package/dist/client/operations.d.ts +0 -30
- package/dist/client/subscription.d.ts +0 -10
- package/dist/types.d.ts +0 -45
- package/dist/utils/api.d.ts +0 -8
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
export { PhantomWalletProvider, PhantomWalletConfig } from './providers/phantom-wallet-provider';
|
|
2
|
+
export { PrivyWalletProvider } from './providers/privy-wallet-provider';
|
|
3
|
+
export { MockAuthProvider, DEFAULT_TEST_ADDRESS } from './providers/mock-auth-provider';
|
|
4
|
+
import { AuthProvider, User, ClientConfig } from '@pooflabs/core';
|
|
5
|
+
export declare function getAuthProvider(config?: Partial<ClientConfig>): Promise<AuthProvider>;
|
|
5
6
|
export declare function login(): Promise<User | null>;
|
|
6
7
|
export declare function logout(): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AuthProvider, User, TransactionResult, SolTransaction, EVMTransaction } from '@pooflabs/core';
|
|
2
|
+
import { SetOptions } from '@pooflabs/core';
|
|
3
|
+
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
4
|
+
export declare const DEFAULT_TEST_ADDRESS = "HKbZbRR7jWWR5VRN8KFjvTCHEzJQgameYxKQxh2gPoof";
|
|
5
|
+
/**
|
|
6
|
+
* MockAuthProvider bypasses real wallet authentication for testing purposes.
|
|
7
|
+
* Uses sessionStorage to simulate logged-in user, with fallback to default test address.
|
|
8
|
+
*
|
|
9
|
+
* This is enabled by passing mockAuth: true to init()
|
|
10
|
+
*/
|
|
11
|
+
export declare class MockAuthProvider implements AuthProvider {
|
|
12
|
+
/**
|
|
13
|
+
* Mock login - reads user from sessionStorage or uses default test address
|
|
14
|
+
*/
|
|
15
|
+
login(): Promise<User | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Mock transaction - returns fake signature without actual blockchain interaction
|
|
18
|
+
* The real transaction will be handled by the backend using test headers
|
|
19
|
+
*/
|
|
20
|
+
runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Mock message signing
|
|
23
|
+
*/
|
|
24
|
+
signMessage(message: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Mock transaction signing - returns the transaction as-is (no actual signing)
|
|
27
|
+
*/
|
|
28
|
+
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
29
|
+
/**
|
|
30
|
+
* Restore session from sessionStorage
|
|
31
|
+
* Only restores if user was previously logged in
|
|
32
|
+
*/
|
|
33
|
+
restoreSession(): Promise<User | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Mock logout - clears test user from sessionStorage
|
|
36
|
+
*/
|
|
37
|
+
logout(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Get native wallet methods (not needed for mock auth)
|
|
40
|
+
*/
|
|
41
|
+
getNativeMethods(): Promise<any>;
|
|
42
|
+
}
|
|
@@ -1,75 +1,17 @@
|
|
|
1
|
-
import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider } from '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider, SetOptions } from '@pooflabs/core';
|
|
2
|
+
export interface PhantomWalletConfig {
|
|
3
|
+
appId?: string;
|
|
4
|
+
autoConnect?: boolean;
|
|
5
|
+
providerType?: 'injected' | 'embedded';
|
|
6
|
+
}
|
|
5
7
|
export declare class PhantomWalletProvider implements AuthProvider {
|
|
6
|
-
|
|
7
|
-
private initialized;
|
|
8
|
-
private networkUrl;
|
|
9
|
-
private embeddedWallet;
|
|
10
|
-
private embeddedConfig;
|
|
11
|
-
constructor(networkUrl?: string, embeddedConfig?: CreatePhantomConfig);
|
|
12
|
-
private init;
|
|
13
|
-
/**
|
|
14
|
-
* Shows the embedded wallet UI
|
|
15
|
-
*/
|
|
16
|
-
showWallet(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Hides the embedded wallet UI
|
|
19
|
-
*/
|
|
20
|
-
hideWallet(): void;
|
|
21
|
-
/**
|
|
22
|
-
* Opens the swap screen in the embedded wallet
|
|
23
|
-
* @param options Swap options (buy token, sell token, amount)
|
|
24
|
-
*/
|
|
25
|
-
openSwap(options: {
|
|
26
|
-
buy: string;
|
|
27
|
-
sell?: string;
|
|
28
|
-
amount?: string;
|
|
29
|
-
}): void;
|
|
30
|
-
/**
|
|
31
|
-
* Opens the buy screen in the embedded wallet
|
|
32
|
-
* @param options Buy options (token to buy, amount in USD)
|
|
33
|
-
*/
|
|
34
|
-
openBuy(options: {
|
|
35
|
-
amount?: number;
|
|
36
|
-
buy: string;
|
|
37
|
-
}): void;
|
|
38
|
-
private getProvider;
|
|
39
|
-
/**
|
|
40
|
-
* Ensures the wallet is connected and returns the provider
|
|
41
|
-
* This method will attempt to connect if not already connected
|
|
42
|
-
*/
|
|
43
|
-
private ensureConnected;
|
|
8
|
+
constructor(networkUrl?: string, config?: PhantomWalletConfig);
|
|
44
9
|
login(): Promise<User | null>;
|
|
45
10
|
restoreSession(): Promise<User | null>;
|
|
46
11
|
address(): Promise<string | null>;
|
|
47
12
|
runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
48
|
-
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
49
13
|
signMessage(message: string): Promise<string>;
|
|
14
|
+
signTransaction(transaction: any): Promise<any>;
|
|
50
15
|
logout(): Promise<void>;
|
|
51
16
|
getNativeMethods(): Promise<any>;
|
|
52
17
|
}
|
|
53
|
-
declare global {
|
|
54
|
-
interface Window {
|
|
55
|
-
phantom?: {
|
|
56
|
-
solana?: {
|
|
57
|
-
isPhantom: boolean;
|
|
58
|
-
isConnected: boolean;
|
|
59
|
-
publicKey: PublicKey;
|
|
60
|
-
connect: () => Promise<{
|
|
61
|
-
publicKey: PublicKey;
|
|
62
|
-
}>;
|
|
63
|
-
disconnect: () => Promise<void>;
|
|
64
|
-
signMessage: (message: Uint8Array, encoding: string) => Promise<{
|
|
65
|
-
signature: Uint8Array;
|
|
66
|
-
}>;
|
|
67
|
-
signTransaction: (transaction: Transaction | VersionedTransaction) => Promise<Transaction>;
|
|
68
|
-
signAndSendTransaction: (transaction: Transaction | VersionedTransaction) => Promise<{
|
|
69
|
-
signature: string;
|
|
70
|
-
}>;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
CUSTOM_TAROBASE_APP_ID_HEADER?: string;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { EVMTransaction, SolTransaction, TransactionResult } from '
|
|
2
|
-
import { AuthProvider, User } from '../../types';
|
|
1
|
+
import type { EVMTransaction, SolTransaction, TransactionResult, AuthProvider, User, SetOptions } from '@pooflabs/core';
|
|
3
2
|
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
4
|
-
import { SetOptions } from '../../client/operations';
|
|
5
3
|
export declare class PrivyWalletProvider implements AuthProvider {
|
|
6
4
|
private static instance;
|
|
7
5
|
private containerElement;
|
package/dist/global.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { ClientConfig } from '
|
|
2
|
-
import { User } from './types';
|
|
3
|
-
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
1
|
+
import { User, ClientConfig } from '@pooflabs/core';
|
|
4
2
|
export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
|
|
5
3
|
export declare function onAuthStateChanged(callback: (user: User | null) => void): void;
|
|
6
4
|
export declare function login(): Promise<User | null>;
|
|
7
5
|
export declare function logout(): Promise<void>;
|
|
8
6
|
export declare function setCurrentUser(user: User | null): void;
|
|
9
7
|
export declare function getCurrentUser(): User | null;
|
|
10
|
-
export declare function signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export { init, getCurrentUser, onAuthStateChanged, login, logout
|
|
2
|
-
export { getConfig } from '
|
|
3
|
-
export { getAuthProvider
|
|
4
|
-
export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany,
|
|
5
|
-
export { subscribe } from '
|
|
6
|
-
export * from '
|
|
1
|
+
export { init, getCurrentUser, onAuthStateChanged, login, logout } from "./global";
|
|
2
|
+
export { getConfig } from '@pooflabs/core';
|
|
3
|
+
export { getAuthProvider } from './auth';
|
|
4
|
+
export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, runExpression, runExpressionMany } from '@pooflabs/core';
|
|
5
|
+
export { subscribe } from '@pooflabs/core';
|
|
6
|
+
export * from '@pooflabs/core';
|
|
7
7
|
export { useAuth } from './auth/hooks/useAuth';
|
|
8
|
-
export { getIdToken } from '
|
|
8
|
+
export { getIdToken } from '@pooflabs/core';
|
|
9
|
+
export { PhantomWalletProvider, PhantomWalletConfig } from './auth/providers/phantom-wallet-provider';
|
|
10
|
+
export { PrivyWalletProvider } from './auth/providers/privy-wallet-provider';
|
|
11
|
+
export { MockAuthProvider, DEFAULT_TEST_ADDRESS } from './auth/providers/mock-auth-provider';
|