@phantom/react-sdk 1.0.0-beta.19 → 1.0.0-beta.20
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 +11 -10
- package/dist/index.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ function WalletComponent() {
|
|
|
56
56
|
const { ethereum } = useEthereum();
|
|
57
57
|
|
|
58
58
|
const handleConnect = async () => {
|
|
59
|
-
const { addresses } = await connect();
|
|
59
|
+
const { addresses } = await connect({ provider: "injected" });
|
|
60
60
|
console.log("Connected addresses:", addresses);
|
|
61
61
|
};
|
|
62
62
|
|
|
@@ -118,9 +118,9 @@ function WalletExample() {
|
|
|
118
118
|
const { solana } = useSolana();
|
|
119
119
|
const { ethereum } = useEthereum();
|
|
120
120
|
|
|
121
|
-
// 1. Connect first
|
|
121
|
+
// 1. Connect first (provider parameter is required)
|
|
122
122
|
const handleConnect = async () => {
|
|
123
|
-
await connect();
|
|
123
|
+
await connect({ provider: "injected" });
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
// 2. Then use chain-specific operations
|
|
@@ -136,14 +136,11 @@ function WalletExample() {
|
|
|
136
136
|
|
|
137
137
|
### Connection Options
|
|
138
138
|
|
|
139
|
-
The `connect()` method automatically switches between providers based on the authentication method you specify:
|
|
139
|
+
The `connect()` method requires a `provider` parameter and automatically switches between providers based on the authentication method you specify:
|
|
140
140
|
|
|
141
141
|
```tsx
|
|
142
142
|
const { connect } = useConnect();
|
|
143
143
|
|
|
144
|
-
// Connect with current provider (no switching)
|
|
145
|
-
await connect();
|
|
146
|
-
|
|
147
144
|
// Connect with injected provider (Phantom extension)
|
|
148
145
|
// Automatically switches to injected provider if not already using it
|
|
149
146
|
await connect({
|
|
@@ -162,14 +159,18 @@ await connect({
|
|
|
162
159
|
provider: "apple",
|
|
163
160
|
});
|
|
164
161
|
|
|
165
|
-
|
|
166
|
-
|
|
167
162
|
// Connect with Phantom authentication (embedded provider)
|
|
168
163
|
// Uses Phantom extension or mobile app for authentication
|
|
169
164
|
// Automatically switches to embedded provider if not already using it
|
|
170
165
|
await connect({
|
|
171
166
|
provider: "phantom",
|
|
172
167
|
});
|
|
168
|
+
|
|
169
|
+
// Connect with JWT authentication (embedded provider)
|
|
170
|
+
await connect({
|
|
171
|
+
provider: "jwt",
|
|
172
|
+
jwtToken: "your-jwt-token",
|
|
173
|
+
});
|
|
173
174
|
```
|
|
174
175
|
|
|
175
176
|
## Provider Types
|
|
@@ -228,7 +229,7 @@ function ConnectButton() {
|
|
|
228
229
|
|
|
229
230
|
const handleConnect = async () => {
|
|
230
231
|
try {
|
|
231
|
-
const { addresses } = await connect();
|
|
232
|
+
const { addresses } = await connect({ provider: "injected" });
|
|
232
233
|
console.log("Connected addresses:", addresses);
|
|
233
234
|
} catch (err) {
|
|
234
235
|
console.error("Failed to connect:", err);
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ declare function PhantomProvider({ children, config, debugConfig }: PhantomProvi
|
|
|
34
34
|
declare function usePhantom(): PhantomContextValue;
|
|
35
35
|
|
|
36
36
|
declare function useConnect(): {
|
|
37
|
-
connect: (options
|
|
37
|
+
connect: (options: AuthOptions) => Promise<_phantom_embedded_provider_core.ConnectResult>;
|
|
38
38
|
isConnecting: boolean;
|
|
39
39
|
error: Error | null;
|
|
40
40
|
currentProviderType: "injected" | "embedded" | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/react-sdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.20",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@phantom/browser-sdk": "^1.0.0-beta.
|
|
29
|
+
"@phantom/browser-sdk": "^1.0.0-beta.20",
|
|
30
30
|
"@phantom/chain-interfaces": "^1.0.0-beta.8",
|
|
31
31
|
"@phantom/constants": "^1.0.0-beta.8"
|
|
32
32
|
},
|