@pooflabs/web 0.0.73 → 0.0.74
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/index.d.ts +4 -5
- package/dist/auth/providers/mock-auth-provider.d.ts +3 -3
- package/dist/auth/providers/privy-expo-provider.d.ts +105 -0
- package/dist/{index-BFJJZKXQ.js → index-BVfqY0fJ.js} +2761 -7
- package/dist/index-BVfqY0fJ.js.map +1 -0
- package/dist/index-Bdcc5821.js +2375 -0
- package/dist/index-Bdcc5821.js.map +1 -0
- package/dist/{index-TfCOBCez.esm.js → index-ByH7PSr3.esm.js} +2756 -2
- package/dist/index-ByH7PSr3.esm.js.map +1 -0
- package/dist/index-CVK4iKo4.js +21508 -0
- package/dist/index-CVK4iKo4.js.map +1 -0
- package/dist/index-CrOVJFX9.esm.js +2373 -0
- package/dist/index-CrOVJFX9.esm.js.map +1 -0
- package/dist/index-ORXorrQK.esm.js +18291 -0
- package/dist/index-ORXorrQK.esm.js.map +1 -0
- package/dist/index-QqlKSXH4.js +18332 -0
- package/dist/index-QqlKSXH4.js.map +1 -0
- package/dist/index-tYJgJQDc.esm.js +21430 -0
- package/dist/index-tYJgJQDc.esm.js.map +1 -0
- package/dist/index.browser-B8vmX-tI.js +1471 -0
- package/dist/index.browser-B8vmX-tI.js.map +1 -0
- package/dist/{index.browser-ChrwVq76.esm.js → index.browser-C2K1wE09.esm.js} +2 -3
- package/dist/{index.browser-ChrwVq76.esm.js.map → index.browser-C2K1wE09.esm.js.map} +1 -1
- package/dist/index.browser-D63nJFKg.esm.js +1468 -0
- package/dist/index.browser-D63nJFKg.esm.js.map +1 -0
- package/dist/{index.browser-BuIgwfvv.esm.js → index.browser-DTId19-8.esm.js} +2 -3
- package/dist/{index.browser-BuIgwfvv.esm.js.map → index.browser-DTId19-8.esm.js.map} +1 -1
- package/dist/{index.browser-wsb8xknL.js → index.browser-De6JT7NR.js} +2 -3
- package/dist/{index.browser-wsb8xknL.js.map → index.browser-De6JT7NR.js.map} +1 -1
- package/dist/{index.browser-BO1XxDi0.js → index.browser-GM5fUBfQ.js} +2 -3
- package/dist/{index.browser-BO1XxDi0.js.map → index.browser-GM5fUBfQ.js.map} +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +1 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.native-CzfZTw_J.esm.js +13211 -0
- package/dist/index.native-CzfZTw_J.esm.js.map +1 -0
- package/dist/index.native-muw49g7i.js +13290 -0
- package/dist/index.native-muw49g7i.js.map +1 -0
- package/dist/index.native.d.ts +24 -0
- package/dist/index.native.esm.js +6 -0
- package/dist/index.native.esm.js.map +1 -0
- package/dist/index.native.js +59 -0
- package/dist/index.native.js.map +1 -0
- package/dist/phantom-wallet-provider-CeNZvRZY.js +1328 -0
- package/dist/phantom-wallet-provider-CeNZvRZY.js.map +1 -0
- package/dist/phantom-wallet-provider-Di3Z8vOA.esm.js +1307 -0
- package/dist/phantom-wallet-provider-Di3Z8vOA.esm.js.map +1 -0
- package/dist/platform.d.ts +68 -0
- package/dist/privy-wallet-provider-Cfws3b3x.esm.js +3921 -0
- package/dist/privy-wallet-provider-Cfws3b3x.esm.js.map +1 -0
- package/dist/privy-wallet-provider-lbg2fDVg.js +3942 -0
- package/dist/privy-wallet-provider-lbg2fDVg.js.map +1 -0
- package/dist/solana-mobile-wallet-provider-BZMvp9Qy.esm.js +558 -0
- package/dist/solana-mobile-wallet-provider-BZMvp9Qy.esm.js.map +1 -0
- package/dist/solana-mobile-wallet-provider-DDqwl25J.js +579 -0
- package/dist/solana-mobile-wallet-provider-DDqwl25J.js.map +1 -0
- package/package.json +19 -3
- package/dist/index-BFJJZKXQ.js.map +0 -1
- package/dist/index-BV8MOXXy.js +0 -36033
- package/dist/index-BV8MOXXy.js.map +0 -1
- package/dist/index-D0yz-P8G.esm.js +0 -35962
- package/dist/index-D0yz-P8G.esm.js.map +0 -1
- package/dist/index-TfCOBCez.esm.js.map +0 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export { PhantomWalletProvider, PhantomWalletConfig, PhantomProviderType, } 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
|
-
export { OffchainAuthProvider, OffchainAuthProviderConfig, } from "./providers/offchain-auth-provider";
|
|
5
|
-
export { SolanaMobileWalletProvider, SolanaMobileWalletConfig, isMobileWalletAvailable, registerMobileWalletAdapter, } from "./providers/solana-mobile-wallet-provider";
|
|
6
1
|
import { AuthProvider, User, ClientConfig } from "@pooflabs/core";
|
|
7
2
|
/**
|
|
8
3
|
* Clears the session if it was created before auth method tracking (legacy session).
|
|
9
4
|
* Returns true if the session was cleared, false if the session is compatible.
|
|
5
|
+
*
|
|
6
|
+
* Dispatches to the correct session manager based on the current auth method
|
|
7
|
+
* so both web (WebSessionManager) and RN (ReactNativeSessionManager) sessions
|
|
8
|
+
* are properly cleared.
|
|
10
9
|
*/
|
|
11
10
|
export declare function clearIncompatibleSession(): boolean;
|
|
12
11
|
export declare const SOLANA_DEVNET_RPC_URL = "https://idelle-8nxsep-fast-devnet.helius-rpc.com";
|
|
@@ -4,13 +4,13 @@ import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
|
4
4
|
export declare const DEFAULT_TEST_ADDRESS = "HKbZbRR7jWWR5VRN8KFjvTCHEzJQgameYxKQxh2gPoof";
|
|
5
5
|
/**
|
|
6
6
|
* MockAuthProvider bypasses real wallet authentication for testing purposes.
|
|
7
|
-
* Uses
|
|
7
|
+
* Uses session storage to simulate logged-in user, with fallback to default test address.
|
|
8
8
|
*
|
|
9
9
|
* This is enabled by passing mockAuth: true to init()
|
|
10
10
|
*/
|
|
11
11
|
export declare class MockAuthProvider implements AuthProvider {
|
|
12
12
|
/**
|
|
13
|
-
* Mock login - reads user from
|
|
13
|
+
* Mock login - reads user from session storage or uses default test address
|
|
14
14
|
*/
|
|
15
15
|
login(): Promise<User | null>;
|
|
16
16
|
/**
|
|
@@ -39,7 +39,7 @@ export declare class MockAuthProvider implements AuthProvider {
|
|
|
39
39
|
*/
|
|
40
40
|
restoreSession(): Promise<User | null>;
|
|
41
41
|
/**
|
|
42
|
-
* Mock logout - clears test user from
|
|
42
|
+
* Mock logout - clears test user from session storage
|
|
43
43
|
*/
|
|
44
44
|
logout(): Promise<void>;
|
|
45
45
|
/**
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privy Expo Auth Provider — React Native implementation of AuthProvider.
|
|
3
|
+
*
|
|
4
|
+
* Uses @privy-io/expo instead of @privy-io/react-auth.
|
|
5
|
+
* Uses ReactNativeSessionManager instead of WebSessionManager.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT — Expo/RN consumers must:
|
|
8
|
+
* 1. Install polyfills: fast-text-encoding, react-native-get-random-values
|
|
9
|
+
* 2. Install @privy-io/expo, @privy-io/expo-native-extensions
|
|
10
|
+
* 3. Call ReactNativeSessionManager.configure({ storage, atob }) at startup
|
|
11
|
+
* 4. Call setPlatform({ ... }) from @pooflabs/web at startup
|
|
12
|
+
* 5. Wrap their app tree with PrivyProvider from @privy-io/expo
|
|
13
|
+
* 6. Create this provider and pass the Privy hooks/methods via setPrivyMethods()
|
|
14
|
+
*
|
|
15
|
+
* Unlike the web PrivyWalletProvider which renders a hidden React DOM tree
|
|
16
|
+
* to host Privy's React context, this provider expects the RN app itself
|
|
17
|
+
* to render <PrivyProvider> and then bridge the hooks via setPrivyMethods().
|
|
18
|
+
*/
|
|
19
|
+
import type { EVMTransaction, SolTransaction, TransactionResult, AuthProvider, User, SetOptions } from '@pooflabs/core';
|
|
20
|
+
import { PublicKey, Connection, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
21
|
+
export interface PrivyExpoMethods {
|
|
22
|
+
/** Whether Privy SDK is fully initialized. */
|
|
23
|
+
isReady: boolean;
|
|
24
|
+
/** Whether the user is authenticated. */
|
|
25
|
+
isAuthenticated: boolean;
|
|
26
|
+
/** The user object from usePrivy(). */
|
|
27
|
+
user: any;
|
|
28
|
+
/** Trigger Privy login UI. Returns the user on success. */
|
|
29
|
+
login: () => Promise<any>;
|
|
30
|
+
/** Log out from Privy. */
|
|
31
|
+
logout: () => Promise<void>;
|
|
32
|
+
/** Get an access token from Privy. */
|
|
33
|
+
getAccessToken: () => Promise<string | null>;
|
|
34
|
+
/** Get the Privy identity token. */
|
|
35
|
+
getIdentityToken: () => Promise<string | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the embedded Solana wallet provider.
|
|
38
|
+
* Comes from useEmbeddedSolanaWallet().
|
|
39
|
+
*/
|
|
40
|
+
getWalletProvider: () => Promise<{
|
|
41
|
+
address: string;
|
|
42
|
+
signMessage: (message: Uint8Array) => Promise<{
|
|
43
|
+
signature: Uint8Array;
|
|
44
|
+
}>;
|
|
45
|
+
signTransaction: (transaction: Transaction | VersionedTransaction) => Promise<{
|
|
46
|
+
signedTransaction: Uint8Array;
|
|
47
|
+
}>;
|
|
48
|
+
signAndSendTransaction: (transaction: Transaction | VersionedTransaction, connection: Connection) => Promise<{
|
|
49
|
+
signature: string;
|
|
50
|
+
}>;
|
|
51
|
+
} | null>;
|
|
52
|
+
}
|
|
53
|
+
export declare class PrivyExpoProvider implements AuthProvider {
|
|
54
|
+
private networkUrl;
|
|
55
|
+
private privyMethods;
|
|
56
|
+
private appId;
|
|
57
|
+
constructor(appId: string, networkUrl?: string | null);
|
|
58
|
+
/**
|
|
59
|
+
* Bridge Privy hooks from the app's React tree into this provider.
|
|
60
|
+
*
|
|
61
|
+
* Call this from a component rendered inside <PrivyProvider>:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* const privy = usePrivy();
|
|
64
|
+
* const wallet = useEmbeddedSolanaWallet();
|
|
65
|
+
* const { getAccessToken } = usePrivy();
|
|
66
|
+
* const { getIdentityToken } = useIdentityToken();
|
|
67
|
+
*
|
|
68
|
+
* useEffect(() => {
|
|
69
|
+
* provider.setPrivyMethods({
|
|
70
|
+
* isReady: privy.isReady,
|
|
71
|
+
* isAuthenticated: !!privy.user,
|
|
72
|
+
* user: privy.user,
|
|
73
|
+
* login: privy.login,
|
|
74
|
+
* logout: privy.logout,
|
|
75
|
+
* getAccessToken,
|
|
76
|
+
* getIdentityToken,
|
|
77
|
+
* getWalletProvider: async () => {
|
|
78
|
+
* if (!wallet.wallets[0]) return null;
|
|
79
|
+
* const provider = await wallet.wallets[0].getProvider();
|
|
80
|
+
* return {
|
|
81
|
+
* address: wallet.wallets[0].address,
|
|
82
|
+
* signMessage: provider.signMessage,
|
|
83
|
+
* signTransaction: provider.signTransaction,
|
|
84
|
+
* signAndSendTransaction: provider.signAndSendTransaction,
|
|
85
|
+
* };
|
|
86
|
+
* },
|
|
87
|
+
* });
|
|
88
|
+
* }, [privy.isReady, privy.user, wallet.wallets]);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
setPrivyMethods(methods: PrivyExpoMethods): void;
|
|
92
|
+
login(): Promise<User | null>;
|
|
93
|
+
runTransaction(_evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
94
|
+
signMessage(message: string): Promise<string>;
|
|
95
|
+
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
96
|
+
signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise<string>;
|
|
97
|
+
restoreSession(): Promise<User | null>;
|
|
98
|
+
logout(): Promise<void>;
|
|
99
|
+
getNativeMethods(): Promise<any>;
|
|
100
|
+
private createSession;
|
|
101
|
+
private getWalletOrThrow;
|
|
102
|
+
private signAndSubmitInternal;
|
|
103
|
+
private getRpcUrl;
|
|
104
|
+
private ensureReady;
|
|
105
|
+
}
|