@pooflabs/web 0.0.46 → 0.0.47-rc.10
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 +7 -1
- package/dist/auth/providers/phantom-wallet-provider.d.ts +7 -4
- package/dist/auth/providers/privy-wallet-provider.d.ts +2 -89
- package/dist/global.d.ts +2 -1
- package/dist/{index-Cwg0PKbk.esm.js → index-BWcswHii.esm.js} +1227 -1085
- package/dist/index-BWcswHii.esm.js.map +1 -0
- package/dist/{index-BwzodgFt.esm.js → index-D0mAnOLC.esm.js} +2418 -1222
- package/dist/index-D0mAnOLC.esm.js.map +1 -0
- package/dist/{index-DEjt5UPi.js → index-DqS02PIx.js} +1230 -1085
- package/dist/index-DqS02PIx.js.map +1 -0
- package/dist/{index-DCKHawfW.js → index-r9ESqIHx.js} +2423 -1227
- package/dist/index-r9ESqIHx.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/index-BwzodgFt.esm.js.map +0 -1
- package/dist/index-Cwg0PKbk.esm.js.map +0 -1
- package/dist/index-DCKHawfW.js.map +0 -1
- package/dist/index-DEjt5UPi.js.map +0 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
export { PhantomWalletProvider, PhantomWalletConfig, PhantomProviderType, } from "./providers/phantom-wallet-provider";
|
|
2
|
-
export { PrivyWalletProvider
|
|
2
|
+
export { PrivyWalletProvider } from "./providers/privy-wallet-provider";
|
|
3
3
|
export { MockAuthProvider, DEFAULT_TEST_ADDRESS, } from "./providers/mock-auth-provider";
|
|
4
4
|
export { OffchainAuthProvider, OffchainAuthProviderConfig, } from "./providers/offchain-auth-provider";
|
|
5
5
|
import { AuthProvider, User, ClientConfig } from "@pooflabs/core";
|
|
6
|
+
/**
|
|
7
|
+
* Clears the session if it was created before auth method tracking (legacy session).
|
|
8
|
+
* Returns true if the session was cleared, false if the session is compatible.
|
|
9
|
+
*/
|
|
10
|
+
export declare function clearIncompatibleSession(): boolean;
|
|
6
11
|
export declare const SOLANA_DEVNET_RPC_URL = "https://idelle-8nxsep-fast-devnet.helius-rpc.com";
|
|
7
12
|
export declare const SOLANA_MAINNET_RPC_URL = "https://celestia-cegncv-fast-mainnet.helius-rpc.com";
|
|
8
13
|
export declare const SURFNET_RPC_URL = "https://surfpool.fly.dev";
|
|
9
14
|
export declare function getAuthProvider(config?: Partial<ClientConfig>): Promise<AuthProvider>;
|
|
10
15
|
export declare function login(): Promise<User | null>;
|
|
16
|
+
export declare function getCurrentAuthMethod(): string | null;
|
|
11
17
|
export declare function logout(): Promise<void>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider, SetOptions } from '@pooflabs/core';
|
|
2
2
|
import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
-
export type PhantomProviderType = 'injected' | 'google' | 'apple' | '
|
|
3
|
+
export type PhantomProviderType = 'injected' | 'google' | 'apple' | 'deeplink';
|
|
4
4
|
export interface PhantomWalletConfig {
|
|
5
5
|
appId?: string;
|
|
6
6
|
/** Providers to use for authentication. Accepts string[] for convenience (e.g., ["injected"]) */
|
|
7
7
|
providers?: PhantomProviderType[] | string[];
|
|
8
|
-
redirectUrl?: string;
|
|
9
8
|
autoConnect?: boolean;
|
|
10
9
|
/** Theme for the connect modal: 'light' or 'dark' */
|
|
11
10
|
theme?: 'light' | 'dark';
|
|
@@ -13,6 +12,8 @@ export interface PhantomWalletConfig {
|
|
|
13
12
|
appName?: string;
|
|
14
13
|
/** App icon URL displayed in the connect modal */
|
|
15
14
|
appIcon?: string;
|
|
15
|
+
/** Enable a "Log in with email" fallback button (via Privy) in the Phantom modal */
|
|
16
|
+
enablePrivyFallback?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export declare class PhantomWalletProvider implements AuthProvider {
|
|
18
19
|
private static instance;
|
|
@@ -26,6 +27,8 @@ export declare class PhantomWalletProvider implements AuthProvider {
|
|
|
26
27
|
private loginInProgress;
|
|
27
28
|
private autoLoginInProgress;
|
|
28
29
|
private initPromise;
|
|
30
|
+
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
31
|
+
onSwitchToPrivy: (() => Promise<AuthProvider>) | null;
|
|
29
32
|
constructor(networkUrl?: string | null, config?: PhantomWalletConfig);
|
|
30
33
|
private initializeAsync;
|
|
31
34
|
/**
|
|
@@ -43,8 +46,8 @@ export declare class PhantomWalletProvider implements AuthProvider {
|
|
|
43
46
|
getAvailableProviders(): PhantomProviderType[];
|
|
44
47
|
/**
|
|
45
48
|
* Login using the Phantom connect modal.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
49
|
+
* When enablePrivyFallback is true, the modal is enhanced via React effect to
|
|
50
|
+
* auto-skip to the wallet list and show a "Log in with email" button.
|
|
48
51
|
*/
|
|
49
52
|
login(): Promise<User | null>;
|
|
50
53
|
restoreSession(): Promise<User | null>;
|
|
@@ -1,36 +1,5 @@
|
|
|
1
1
|
import type { EVMTransaction, SolTransaction, TransactionResult, AuthProvider, User, SetOptions } from '@pooflabs/core';
|
|
2
2
|
import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
-
/**
|
|
4
|
-
* Context passed to the redirect URL resolver function.
|
|
5
|
-
* Allows dynamic redirect URL selection based on the current environment.
|
|
6
|
-
*/
|
|
7
|
-
export interface RedirectUrlContext {
|
|
8
|
-
/** The current platform (best effort detection) */
|
|
9
|
-
platform: 'android' | 'ios' | 'web' | 'unknown';
|
|
10
|
-
/** The user agent string */
|
|
11
|
-
userAgent: string;
|
|
12
|
-
/** Whether this appears to be a WebView */
|
|
13
|
-
isWebView: boolean;
|
|
14
|
-
/** The current URL origin */
|
|
15
|
-
origin: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Redirect URL can be a static string or a function that returns a string.
|
|
19
|
-
* Using a function allows dynamic selection based on platform/environment.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // Static string
|
|
23
|
-
* redirectUrl: 'seekerwheel://callback'
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* // Dynamic function
|
|
27
|
-
* redirectUrl: (context) => {
|
|
28
|
-
* if (context.platform === 'android') return 'seekerwheel://callback';
|
|
29
|
-
* if (context.platform === 'ios') return 'seekerwheel://callback';
|
|
30
|
-
* return context.origin; // web fallback
|
|
31
|
-
* }
|
|
32
|
-
*/
|
|
33
|
-
export type RedirectUrlResolver = string | ((context: RedirectUrlContext) => string);
|
|
34
3
|
export declare class PrivyWalletProvider implements AuthProvider {
|
|
35
4
|
private static instance;
|
|
36
5
|
private containerElement;
|
|
@@ -40,71 +9,15 @@ export declare class PrivyWalletProvider implements AuthProvider {
|
|
|
40
9
|
private privyMethods;
|
|
41
10
|
private privyConfig;
|
|
42
11
|
private pendingLogin;
|
|
43
|
-
/**
|
|
44
|
-
* Custom redirect URL for OAuth flows.
|
|
45
|
-
* Can be a static string or a function that dynamically determines the URL.
|
|
46
|
-
* Required for Android/iOS apps with custom URI schemes (e.g., 'seekerwheel://callback').
|
|
47
|
-
*/
|
|
48
|
-
private redirectUrl;
|
|
49
12
|
private pendingTransaction;
|
|
50
13
|
private pendingSignTransaction;
|
|
51
14
|
private pendingSignMessage;
|
|
52
15
|
private pendingSignAndSubmitTransaction;
|
|
53
|
-
/**
|
|
54
|
-
* Create a new PrivyWalletProvider instance.
|
|
55
|
-
*
|
|
56
|
-
* @param appName - App name displayed in the Privy modal
|
|
57
|
-
* @param appLogoUrl - App logo URL displayed in the Privy modal
|
|
58
|
-
* @param privyConfig - Custom Privy configuration (optional, uses default if not provided)
|
|
59
|
-
* @param networkUrl - Custom RPC URL (optional)
|
|
60
|
-
* @param redirectUrl - Custom redirect URL for OAuth flows. Can be a string or a function
|
|
61
|
-
* that returns a string based on the current context (platform, WebView, etc.)
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* // Static string
|
|
65
|
-
* new PrivyWalletProvider('MyApp', null, null, null, 'seekerwheel://callback')
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* // Dynamic function
|
|
69
|
-
* new PrivyWalletProvider('MyApp', null, null, null, (context) => {
|
|
70
|
-
* if (context.platform === 'android' || context.platform === 'ios') {
|
|
71
|
-
* return 'seekerwheel://callback';
|
|
72
|
-
* }
|
|
73
|
-
* return context.origin; // web fallback
|
|
74
|
-
* })
|
|
75
|
-
*/
|
|
76
16
|
constructor(appName: string | null, appLogoUrl: string | null, privyConfig?: {
|
|
77
17
|
appId: string;
|
|
78
18
|
config: any;
|
|
79
|
-
}, networkUrl?: string | null
|
|
80
|
-
static getInstance(appName: string | null, appLogoUrl: string | null, privyConfig: any
|
|
81
|
-
/**
|
|
82
|
-
* Get the resolved redirect URL for OAuth flows.
|
|
83
|
-
* If a function was provided, it will be called with the current context.
|
|
84
|
-
*
|
|
85
|
-
* IMPORTANT: This URL must be added to your Privy Dashboard under
|
|
86
|
-
* "Allowed OAuth Redirect URLs" for social OAuth (Google, Apple, etc.) to work.
|
|
87
|
-
*
|
|
88
|
-
* For Android apps:
|
|
89
|
-
* 1. Add an intent filter in AndroidManifest.xml for your custom scheme
|
|
90
|
-
* 2. Add the scheme (e.g., 'seekerwheel://callback') to Privy Dashboard
|
|
91
|
-
* 3. Pass the same URL as `redirectUrl` when initializing the SDK
|
|
92
|
-
*
|
|
93
|
-
* For iOS apps:
|
|
94
|
-
* 1. Add the URL scheme to Info.plist under CFBundleURLTypes
|
|
95
|
-
* 2. Add the scheme to Privy Dashboard
|
|
96
|
-
* 3. Pass the same URL as `redirectUrl` when initializing the SDK
|
|
97
|
-
*
|
|
98
|
-
* @returns The resolved redirect URL or null if not set
|
|
99
|
-
*/
|
|
100
|
-
getRedirectUrl(): string | null;
|
|
101
|
-
/**
|
|
102
|
-
* Get the current redirect URL context.
|
|
103
|
-
* Useful for debugging or determining what platform was detected.
|
|
104
|
-
*
|
|
105
|
-
* @returns The context object with platform, userAgent, isWebView, and origin
|
|
106
|
-
*/
|
|
107
|
-
getRedirectUrlContext(): RedirectUrlContext;
|
|
19
|
+
}, networkUrl?: string | null);
|
|
20
|
+
static getInstance(appName: string | null, appLogoUrl: string | null, privyConfig: any): PrivyWalletProvider;
|
|
108
21
|
private initialize;
|
|
109
22
|
login(): Promise<User | null>;
|
|
110
23
|
getNativeMethods(): Promise<any>;
|
package/dist/global.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { User, ClientConfig } from '@pooflabs/core';
|
|
1
|
+
import { AuthProvider, User, ClientConfig } from '@pooflabs/core';
|
|
2
2
|
export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
|
|
3
3
|
export declare function onAuthStateChanged(callback: (user: User | null) => void): void;
|
|
4
4
|
export declare function onAuthLoadingChanged(callback: (loading: boolean) => void): void;
|
|
@@ -8,3 +8,4 @@ export declare function login(): Promise<User | null>;
|
|
|
8
8
|
export declare function logout(): Promise<void>;
|
|
9
9
|
export declare function setCurrentUser(user: User | null): void;
|
|
10
10
|
export declare function getCurrentUser(): User | null;
|
|
11
|
+
export declare function setAuthProviderInstance(provider: AuthProvider): void;
|