@phantom/browser-sdk 1.0.0-beta.13 → 1.0.0-beta.15

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/README.md CHANGED
@@ -93,24 +93,36 @@ const ethResult = await sdk.ethereum.sendTransaction({
93
93
 
94
94
  ### Connection Options
95
95
 
96
- For embedded user-wallets, you can specify authentication providers:
96
+ The `connect()` method automatically switches between providers based on the authentication method you specify:
97
97
 
98
98
  ```typescript
99
- // Default: Show provider selection screen
99
+ // Connect with current provider (no switching)
100
100
  const result = await sdk.connect();
101
101
 
102
- // Google authentication (skips provider selection)
102
+ // Connect with injected provider (Phantom extension)
103
+ // Automatically switches to injected provider if not already using it
103
104
  const result = await sdk.connect({
104
- authOptions: {
105
- provider: "google",
106
- },
105
+ provider: "injected",
107
106
  });
108
107
 
109
- // Apple authentication (skips provider selection)
108
+ // Connect with Google authentication (embedded provider)
109
+ // Automatically switches to embedded provider if not already using it
110
110
  const result = await sdk.connect({
111
- authOptions: {
112
- provider: "apple",
113
- },
111
+ provider: "google",
112
+ });
113
+
114
+ // Connect with Apple authentication (embedded provider)
115
+ // Automatically switches to embedded provider if not already using it
116
+ const result = await sdk.connect({
117
+ provider: "apple",
118
+ });
119
+
120
+
121
+ // Connect with Phantom authentication (embedded provider)
122
+ // Uses Phantom extension or mobile app for authentication
123
+ // Automatically switches to embedded provider if not already using it
124
+ const result = await sdk.connect({
125
+ provider: "phantom",
114
126
  });
115
127
  ```
116
128
 
@@ -315,7 +327,7 @@ Connect to wallet and get addresses for configured AddressTypes.
315
327
 
316
328
  ```typescript
317
329
  const result = await sdk.connect();
318
- // Returns: { walletId?: string, addresses: WalletAddress[] }
330
+ // Returns: { addresses: WalletAddress[] }
319
331
  // addresses only includes types from addressTypes config
320
332
  ```
321
333
 
@@ -344,15 +356,6 @@ Check if SDK is connected to a wallet.
344
356
  const connected = sdk.isConnected();
345
357
  ```
346
358
 
347
- #### getWalletId()
348
-
349
- Get the wallet ID (embedded wallets only).
350
-
351
- ```typescript
352
- const walletId = sdk.getWalletId();
353
- // Returns string for embedded wallets, null for injected
354
- ```
355
-
356
359
  ### Solana Chain Methods
357
360
 
358
361
  #### signMessage(message)
package/dist/index.d.ts CHANGED
@@ -52,14 +52,33 @@ declare const DebugCategory: {
52
52
  readonly SESSION: "Session";
53
53
  };
54
54
 
55
+ /**
56
+ * Phantom extension app.login API types
57
+ */
58
+ interface PhantomAppLoginOptions {
59
+ publicKey: string;
60
+ appId: string;
61
+ sessionId: string;
62
+ }
63
+ interface PhantomAppLoginResult {
64
+ walletId: string;
65
+ organizationId: string;
66
+ accountDerivationIndex?: number;
67
+ expiresInMs?: number;
68
+ }
69
+ interface PhantomApp {
70
+ login(options: PhantomAppLoginOptions): Promise<PhantomAppLoginResult>;
71
+ }
55
72
  declare global {
56
73
  interface Window {
57
74
  phantom?: {
58
75
  solana?: unknown;
59
76
  ethereum?: unknown;
60
- };
77
+ app?: PhantomApp;
78
+ } | undefined;
61
79
  }
62
80
  }
81
+
63
82
  interface InjectedProviderConfig {
64
83
  addressTypes: AddressType[];
65
84
  }
@@ -105,9 +124,6 @@ interface ProviderPreference {
105
124
  type: "injected" | "embedded";
106
125
  embeddedWalletType?: "app-wallet" | "user-wallet";
107
126
  }
108
- interface SwitchProviderOptions {
109
- embeddedWalletType?: "app-wallet" | "user-wallet" | (string & Record<never, never>);
110
- }
111
127
 
112
128
  /**
113
129
  * Browser SDK with chain-specific API
@@ -141,10 +157,6 @@ declare class BrowserSDK {
141
157
  * Disconnect from the wallet
142
158
  */
143
159
  disconnect(): Promise<void>;
144
- /**
145
- * Switch between provider types (injected vs embedded)
146
- */
147
- switchProvider(type: "injected" | "embedded", options?: SwitchProviderOptions): Promise<void>;
148
160
  /**
149
161
  * Check if the SDK is connected to a wallet
150
162
  */
@@ -157,10 +169,6 @@ declare class BrowserSDK {
157
169
  * Get information about the current provider
158
170
  */
159
171
  getCurrentProviderInfo(): ProviderPreference | null;
160
- /**
161
- * Get the wallet ID (for embedded wallets)
162
- */
163
- getWalletId(): string | null;
164
172
  /**
165
173
  * Check if Phantom extension is installed
166
174
  */
@@ -178,7 +186,7 @@ declare class BrowserSDK {
178
186
  /**
179
187
  * Attempt auto-connection using existing session
180
188
  * Should be called after setting up event listeners
181
- * Only works with embedded providers
189
+ * Tries embedded provider first, then injected provider as fallback
182
190
  */
183
191
  autoConnect(): Promise<void>;
184
192
  /**