@pooflabs/web 0.0.10 → 0.0.12

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.
@@ -1,5 +1,6 @@
1
1
  export { PhantomWalletProvider, PhantomWalletConfig } from './providers/phantom-wallet-provider';
2
2
  export { PrivyWalletProvider } from './providers/privy-wallet-provider';
3
+ export { MockAuthProvider, DEFAULT_TEST_ADDRESS } from './providers/mock-auth-provider';
3
4
  import { AuthProvider, User, ClientConfig } from '@pooflabs/core';
4
5
  export declare function getAuthProvider(config?: Partial<ClientConfig>): Promise<AuthProvider>;
5
6
  export declare function login(): Promise<User | null>;
@@ -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 - only restores if user previously called login() explicitly.
31
+ * This prevents auto-login on first page load, but allows session persistence after login.
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
+ }
package/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export { useAuth } from './auth/hooks/useAuth';
8
8
  export { getIdToken } from '@pooflabs/core';
9
9
  export { PhantomWalletProvider, PhantomWalletConfig } from './auth/providers/phantom-wallet-provider';
10
10
  export { PrivyWalletProvider } from './auth/providers/privy-wallet-provider';
11
+ export { MockAuthProvider, DEFAULT_TEST_ADDRESS } from './auth/providers/mock-auth-provider';