@phantom/react-native-sdk 1.0.0-beta.10 → 1.0.0-beta.11

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
@@ -114,8 +114,8 @@ import { useConnect, useAccounts, useSolana, useEthereum, useDisconnect } from "
114
114
  export function WalletScreen() {
115
115
  const { connect, isConnecting, error: connectError } = useConnect();
116
116
  const { addresses, isConnected } = useAccounts();
117
- const solana = useSolana();
118
- const ethereum = useEthereum();
117
+ const { solana } = useSolana();
118
+ const { ethereum } = useEthereum();
119
119
  const { disconnect } = useDisconnect();
120
120
 
121
121
  const handleConnect = async () => {
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
3
3
  import * as _phantom_embedded_provider_core from '@phantom/embedded-provider-core';
4
4
  import { EmbeddedProviderConfig, EmbeddedProvider, WalletAddress, ConnectResult } from '@phantom/embedded-provider-core';
5
5
  export { ConnectResult, SignAndSendTransactionParams, SignMessageParams, SignMessageResult, SignedTransaction, WalletAddress } from '@phantom/embedded-provider-core';
6
- import * as _phantom_chain_interfaces from '@phantom/chain-interfaces';
6
+ import { ISolanaChain, IEthereumChain } from '@phantom/chain-interfaces';
7
7
  export { AddressType } from '@phantom/client';
8
8
  export { NetworkId } from '@phantom/constants';
9
9
 
@@ -75,7 +75,7 @@ declare function useAccounts(): {
75
75
  * @returns Solana chain interface with connection enforcement
76
76
  */
77
77
  declare function useSolana(): {
78
- solana: _phantom_chain_interfaces.ISolanaChain;
78
+ solana: ISolanaChain;
79
79
  isAvailable: boolean;
80
80
  };
81
81
 
@@ -85,7 +85,7 @@ declare function useSolana(): {
85
85
  * @returns Ethereum chain interface with connection enforcement
86
86
  */
87
87
  declare function useEthereum(): {
88
- ethereum: _phantom_chain_interfaces.IEthereumChain;
88
+ ethereum: IEthereumChain;
89
89
  isAvailable: boolean;
90
90
  };
91
91
 
package/dist/index.js CHANGED
@@ -104,22 +104,22 @@ var ExpoAuthProvider = class {
104
104
  return;
105
105
  }
106
106
  const phantomOptions = options;
107
- const { authUrl, redirectUrl, organizationId, sessionId, provider, customAuthData, appId } = phantomOptions;
107
+ const { authUrl, redirectUrl, publicKey, sessionId, provider, customAuthData, appId } = phantomOptions;
108
108
  if (!redirectUrl) {
109
109
  throw new Error("redirectUrl is required for web browser authentication");
110
110
  }
111
- if (!organizationId || !sessionId || !appId) {
112
- throw new Error("organizationId, sessionId and appId are required for authentication");
111
+ if (!publicKey || !sessionId || !appId) {
112
+ throw new Error("publicKey, sessionId and appId are required for authentication");
113
113
  }
114
114
  try {
115
115
  const baseUrl = authUrl || import_constants.DEFAULT_AUTH_URL;
116
116
  const params = new URLSearchParams({
117
- organization_id: organizationId,
117
+ public_key: publicKey,
118
118
  app_id: appId,
119
119
  redirect_uri: redirectUrl,
120
120
  session_id: sessionId,
121
121
  clear_previous_session: "true",
122
- sdk_version: "1.0.0-beta.10"
122
+ sdk_version: "1.0.0-beta.11"
123
123
  });
124
124
  if (provider) {
125
125
  console.log("[ExpoAuthProvider] Provider specified, will skip selection", { provider });
@@ -136,7 +136,7 @@ var ExpoAuthProvider = class {
136
136
  console.log("[ExpoAuthProvider] Starting authentication", {
137
137
  baseUrl,
138
138
  redirectUrl,
139
- organizationId,
139
+ publicKey,
140
140
  sessionId,
141
141
  provider,
142
142
  hasCustomData: !!customAuthData
@@ -153,15 +153,30 @@ var ExpoAuthProvider = class {
153
153
  if (result.type === "success" && result.url) {
154
154
  const url = new URL(result.url);
155
155
  const walletId = url.searchParams.get("wallet_id");
156
+ const organizationId = url.searchParams.get("organization_id");
156
157
  const provider2 = url.searchParams.get("provider");
157
158
  const accountDerivationIndex = url.searchParams.get("selected_account_index");
159
+ const expiresInMs = url.searchParams.get("expires_in_ms");
158
160
  if (!walletId) {
159
161
  throw new Error("Authentication failed: no walletId in redirect URL");
160
162
  }
163
+ if (!organizationId) {
164
+ console.error("[ExpoAuthProvider] Missing organizationId in redirect URL", { url: result.url });
165
+ throw new Error("Authentication failed: no organizationId in redirect URL");
166
+ }
167
+ console.log("[ExpoAuthProvider] Auth redirect parameters", {
168
+ walletId,
169
+ organizationId,
170
+ provider: provider2,
171
+ accountDerivationIndex,
172
+ expiresInMs
173
+ });
161
174
  return {
162
175
  walletId,
176
+ organizationId,
163
177
  provider: provider2 || void 0,
164
- accountDerivationIndex: accountDerivationIndex ? parseInt(accountDerivationIndex) : void 0
178
+ accountDerivationIndex: accountDerivationIndex ? parseInt(accountDerivationIndex) : 0,
179
+ expiresInMs: expiresInMs ? parseInt(expiresInMs) : 0
165
180
  };
166
181
  } else if (result.type === "cancel") {
167
182
  throw new Error("User cancelled authentication");
@@ -494,7 +509,7 @@ function PhantomProvider({ children, config, debugConfig }) {
494
509
  [import_constants2.ANALYTICS_HEADERS.PLATFORM_VERSION]: `${import_react_native2.Platform.Version}`,
495
510
  [import_constants2.ANALYTICS_HEADERS.APP_ID]: config.appId,
496
511
  [import_constants2.ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
497
- [import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.10"
512
+ [import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.11"
498
513
  // Replaced at build time
499
514
  }
500
515
  };
package/dist/index.mjs CHANGED
@@ -60,22 +60,22 @@ var ExpoAuthProvider = class {
60
60
  return;
61
61
  }
62
62
  const phantomOptions = options;
63
- const { authUrl, redirectUrl, organizationId, sessionId, provider, customAuthData, appId } = phantomOptions;
63
+ const { authUrl, redirectUrl, publicKey, sessionId, provider, customAuthData, appId } = phantomOptions;
64
64
  if (!redirectUrl) {
65
65
  throw new Error("redirectUrl is required for web browser authentication");
66
66
  }
67
- if (!organizationId || !sessionId || !appId) {
68
- throw new Error("organizationId, sessionId and appId are required for authentication");
67
+ if (!publicKey || !sessionId || !appId) {
68
+ throw new Error("publicKey, sessionId and appId are required for authentication");
69
69
  }
70
70
  try {
71
71
  const baseUrl = authUrl || DEFAULT_AUTH_URL;
72
72
  const params = new URLSearchParams({
73
- organization_id: organizationId,
73
+ public_key: publicKey,
74
74
  app_id: appId,
75
75
  redirect_uri: redirectUrl,
76
76
  session_id: sessionId,
77
77
  clear_previous_session: "true",
78
- sdk_version: "1.0.0-beta.10"
78
+ sdk_version: "1.0.0-beta.11"
79
79
  });
80
80
  if (provider) {
81
81
  console.log("[ExpoAuthProvider] Provider specified, will skip selection", { provider });
@@ -92,7 +92,7 @@ var ExpoAuthProvider = class {
92
92
  console.log("[ExpoAuthProvider] Starting authentication", {
93
93
  baseUrl,
94
94
  redirectUrl,
95
- organizationId,
95
+ publicKey,
96
96
  sessionId,
97
97
  provider,
98
98
  hasCustomData: !!customAuthData
@@ -109,15 +109,30 @@ var ExpoAuthProvider = class {
109
109
  if (result.type === "success" && result.url) {
110
110
  const url = new URL(result.url);
111
111
  const walletId = url.searchParams.get("wallet_id");
112
+ const organizationId = url.searchParams.get("organization_id");
112
113
  const provider2 = url.searchParams.get("provider");
113
114
  const accountDerivationIndex = url.searchParams.get("selected_account_index");
115
+ const expiresInMs = url.searchParams.get("expires_in_ms");
114
116
  if (!walletId) {
115
117
  throw new Error("Authentication failed: no walletId in redirect URL");
116
118
  }
119
+ if (!organizationId) {
120
+ console.error("[ExpoAuthProvider] Missing organizationId in redirect URL", { url: result.url });
121
+ throw new Error("Authentication failed: no organizationId in redirect URL");
122
+ }
123
+ console.log("[ExpoAuthProvider] Auth redirect parameters", {
124
+ walletId,
125
+ organizationId,
126
+ provider: provider2,
127
+ accountDerivationIndex,
128
+ expiresInMs
129
+ });
117
130
  return {
118
131
  walletId,
132
+ organizationId,
119
133
  provider: provider2 || void 0,
120
- accountDerivationIndex: accountDerivationIndex ? parseInt(accountDerivationIndex) : void 0
134
+ accountDerivationIndex: accountDerivationIndex ? parseInt(accountDerivationIndex) : 0,
135
+ expiresInMs: expiresInMs ? parseInt(expiresInMs) : 0
121
136
  };
122
137
  } else if (result.type === "cancel") {
123
138
  throw new Error("User cancelled authentication");
@@ -450,7 +465,7 @@ function PhantomProvider({ children, config, debugConfig }) {
450
465
  [ANALYTICS_HEADERS.PLATFORM_VERSION]: `${Platform.Version}`,
451
466
  [ANALYTICS_HEADERS.APP_ID]: config.appId,
452
467
  [ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
453
- [ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.10"
468
+ [ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.11"
454
469
  // Replaced at build time
455
470
  }
456
471
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantom/react-native-sdk",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "Phantom Wallet SDK for React Native and Expo applications",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -48,10 +48,10 @@
48
48
  "@phantom/api-key-stamper": "^1.0.0-beta.6",
49
49
  "@phantom/base64url": "^1.0.0-beta.6",
50
50
  "@phantom/chain-interfaces": "^1.0.0-beta.6",
51
- "@phantom/client": "^1.0.0-beta.10",
51
+ "@phantom/client": "^1.0.0-beta.11",
52
52
  "@phantom/constants": "^1.0.0-beta.6",
53
53
  "@phantom/crypto": "^1.0.0-beta.6",
54
- "@phantom/embedded-provider-core": "^1.0.0-beta.10",
54
+ "@phantom/embedded-provider-core": "^1.0.0-beta.11",
55
55
  "@phantom/sdk-types": "^1.0.0-beta.6",
56
56
  "@types/bs58": "^5.0.0",
57
57
  "bs58": "^6.0.0",