@pooflabs/web 0.0.26 → 0.0.28

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,4 +1,4 @@
1
- export { PhantomWalletProvider, PhantomWalletConfig, } from "./providers/phantom-wallet-provider";
1
+ export { PhantomWalletProvider, PhantomWalletConfig, PhantomProviderType, } from "./providers/phantom-wallet-provider";
2
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";
@@ -1,33 +1,44 @@
1
1
  import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider, SetOptions } from '@pooflabs/core';
2
2
  import { Transaction, VersionedTransaction } from '@solana/web3.js';
3
+ export type PhantomProviderType = 'injected' | 'google' | 'apple' | 'phantom';
3
4
  export interface PhantomWalletConfig {
4
5
  appId?: string;
5
- providers?: Array<'injected' | 'google' | 'apple' | 'deeplink'>;
6
+ /** Providers to use for authentication. Accepts string[] for convenience (e.g., ["injected"]) */
7
+ providers?: PhantomProviderType[] | string[];
6
8
  redirectUrl?: string;
7
9
  autoConnect?: boolean;
10
+ /** Theme for the connect modal: 'light' or 'dark' */
11
+ theme?: 'light' | 'dark';
12
+ /** App name displayed in the connect modal */
13
+ appName?: string;
14
+ /** App icon URL displayed in the connect modal */
15
+ appIcon?: string;
8
16
  }
9
17
  export declare class PhantomWalletProvider implements AuthProvider {
10
- private initialized;
18
+ private static instance;
19
+ private containerElement;
11
20
  private networkUrl;
12
- private sdk;
21
+ private root;
22
+ private phantomMethods;
13
23
  private config;
24
+ private resolvedProviders;
25
+ private pendingLogin;
26
+ private loginInProgress;
14
27
  constructor(networkUrl?: string | null, config?: PhantomWalletConfig);
15
- private init;
16
- private getSDK;
28
+ static getInstance(networkUrl: string | null, config: PhantomWalletConfig): PhantomWalletProvider;
29
+ private resolveProviders;
30
+ private initialize;
31
+ private ensureReady;
32
+ private ensureSolanaReady;
17
33
  /**
18
- * Check if the injected Phantom provider is available
34
+ * Get the list of available (configured) providers for this wallet.
19
35
  */
20
- private hasInjectedProvider;
36
+ getAvailableProviders(): PhantomProviderType[];
21
37
  /**
22
- * Get the injected Phantom provider for direct wallet operations
38
+ * Login using the Phantom connect modal.
39
+ * Opens the native Phantom connect UI where users can choose their preferred login method
40
+ * (Google, Apple, Phantom, or browser extension).
23
41
  */
24
- private getInjectedProvider;
25
- /**
26
- * Ensures the wallet is connected and returns the SDK
27
- * This method will attempt to connect if not already connected.
28
- * If session doesn't match the connected wallet, it will re-login.
29
- */
30
- private ensureConnected;
31
42
  login(): Promise<User | null>;
32
43
  restoreSession(): Promise<User | null>;
33
44
  address(): Promise<string | null>;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { subscribe } from "@pooflabs/core";
6
6
  export * from "@pooflabs/core";
7
7
  export { useAuth } from "./auth/hooks/useAuth";
8
8
  export { getIdToken } from "./utils";
9
- export { PhantomWalletProvider, PhantomWalletConfig, } from "./auth/providers/phantom-wallet-provider";
9
+ export { PhantomWalletProvider, PhantomWalletConfig, PhantomProviderType, } from "./auth/providers/phantom-wallet-provider";
10
10
  export { PrivyWalletProvider } from "./auth/providers/privy-wallet-provider";
11
11
  export { MockAuthProvider, DEFAULT_TEST_ADDRESS, } from "./auth/providers/mock-auth-provider";
12
12
  export { OffchainAuthProvider, OffchainAuthProviderConfig, } from "./auth/providers/offchain-auth-provider";