@phantom/react-native-sdk 1.0.0-beta.15 → 1.0.0-beta.16

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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  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
- export { ConnectResult, SignAndSendTransactionParams, SignMessageParams, SignMessageResult, SignedTransaction, WalletAddress } from '@phantom/embedded-provider-core';
5
+ export { ConnectErrorEventData, ConnectEventData, ConnectResult, ConnectStartEventData, DisconnectEventData, EmbeddedProviderEvent, EmbeddedProviderEventMap, EventCallback, SignAndSendTransactionParams, SignMessageParams, SignMessageResult, SignedTransaction, WalletAddress } from '@phantom/embedded-provider-core';
6
6
  import { ISolanaChain, IEthereumChain } from '@phantom/chain-interfaces';
7
7
  export { AddressType } from '@phantom/client';
8
8
  export { NetworkId } from '@phantom/constants';
@@ -40,6 +40,7 @@ interface PhantomContextValue {
40
40
  addresses: WalletAddress[];
41
41
  walletId: string | null;
42
42
  setWalletId: (walletId: string | null) => void;
43
+ user: ConnectResult | null;
43
44
  }
44
45
  interface PhantomProviderProps {
45
46
  children: ReactNode;
package/dist/index.js CHANGED
@@ -153,7 +153,7 @@ var ExpoAuthProvider = class {
153
153
  // OAuth session management - defaults to allow refresh unless explicitly clearing after logout
154
154
  clear_previous_session: (phantomOptions.clearPreviousSession ?? false).toString(),
155
155
  allow_refresh: (phantomOptions.allowRefresh ?? true).toString(),
156
- sdk_version: "1.0.0-beta.15",
156
+ sdk_version: "1.0.0-beta.16",
157
157
  sdk_type: "react-native",
158
158
  platform: import_react_native.Platform.OS
159
159
  });
@@ -522,6 +522,7 @@ function PhantomProvider({ children, config, debugConfig }) {
522
522
  const [connectError, setConnectError] = (0, import_react.useState)(null);
523
523
  const [addresses, setAddresses] = (0, import_react.useState)([]);
524
524
  const [walletId, setWalletId] = (0, import_react.useState)(null);
525
+ const [user, setUser] = (0, import_react.useState)(null);
525
526
  const memoizedConfig = (0, import_react.useMemo)(() => {
526
527
  const redirectUrl = config.authOptions?.redirectUrl || `${config.scheme}://phantom-auth-callback`;
527
528
  return {
@@ -558,7 +559,7 @@ function PhantomProvider({ children, config, debugConfig }) {
558
559
  [import_constants2.ANALYTICS_HEADERS.PLATFORM_VERSION]: `${import_react_native3.Platform.Version}`,
559
560
  [import_constants2.ANALYTICS_HEADERS.APP_ID]: config.appId,
560
561
  [import_constants2.ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
561
- [import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.15"
562
+ [import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.16"
562
563
  // Replaced at build time
563
564
  }
564
565
  };
@@ -569,10 +570,11 @@ function PhantomProvider({ children, config, debugConfig }) {
569
570
  setIsConnecting(true);
570
571
  setConnectError(null);
571
572
  };
572
- const handleConnect = async () => {
573
+ const handleConnect = async (data) => {
573
574
  try {
574
575
  setIsConnected(true);
575
576
  setIsConnecting(false);
577
+ setUser(data);
576
578
  const addrs = await sdk.getAddresses();
577
579
  setAddresses(addrs);
578
580
  } catch (err) {
@@ -587,6 +589,7 @@ function PhantomProvider({ children, config, debugConfig }) {
587
589
  const handleConnectError = (errorData) => {
588
590
  setIsConnecting(false);
589
591
  setConnectError(new Error(errorData.error || "Connection failed"));
592
+ setAddresses([]);
590
593
  };
591
594
  const handleDisconnect = () => {
592
595
  setIsConnected(false);
@@ -594,6 +597,7 @@ function PhantomProvider({ children, config, debugConfig }) {
594
597
  setConnectError(null);
595
598
  setAddresses([]);
596
599
  setWalletId(null);
600
+ setUser(null);
597
601
  };
598
602
  sdk.on("connect_start", handleConnectStart);
599
603
  sdk.on("connect", handleConnect);
@@ -620,9 +624,10 @@ function PhantomProvider({ children, config, debugConfig }) {
620
624
  connectError,
621
625
  addresses,
622
626
  walletId,
623
- setWalletId
627
+ setWalletId,
628
+ user
624
629
  }),
625
- [sdk, isConnected, isConnecting, connectError, addresses, walletId, setWalletId]
630
+ [sdk, isConnected, isConnecting, connectError, addresses, walletId, setWalletId, user]
626
631
  );
627
632
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PhantomContext.Provider, { value, children });
628
633
  }
package/dist/index.mjs CHANGED
@@ -109,7 +109,7 @@ var ExpoAuthProvider = class {
109
109
  // OAuth session management - defaults to allow refresh unless explicitly clearing after logout
110
110
  clear_previous_session: (phantomOptions.clearPreviousSession ?? false).toString(),
111
111
  allow_refresh: (phantomOptions.allowRefresh ?? true).toString(),
112
- sdk_version: "1.0.0-beta.15",
112
+ sdk_version: "1.0.0-beta.16",
113
113
  sdk_type: "react-native",
114
114
  platform: Platform.OS
115
115
  });
@@ -478,6 +478,7 @@ function PhantomProvider({ children, config, debugConfig }) {
478
478
  const [connectError, setConnectError] = useState(null);
479
479
  const [addresses, setAddresses] = useState([]);
480
480
  const [walletId, setWalletId] = useState(null);
481
+ const [user, setUser] = useState(null);
481
482
  const memoizedConfig = useMemo(() => {
482
483
  const redirectUrl = config.authOptions?.redirectUrl || `${config.scheme}://phantom-auth-callback`;
483
484
  return {
@@ -514,7 +515,7 @@ function PhantomProvider({ children, config, debugConfig }) {
514
515
  [ANALYTICS_HEADERS.PLATFORM_VERSION]: `${Platform2.Version}`,
515
516
  [ANALYTICS_HEADERS.APP_ID]: config.appId,
516
517
  [ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
517
- [ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.15"
518
+ [ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.16"
518
519
  // Replaced at build time
519
520
  }
520
521
  };
@@ -525,10 +526,11 @@ function PhantomProvider({ children, config, debugConfig }) {
525
526
  setIsConnecting(true);
526
527
  setConnectError(null);
527
528
  };
528
- const handleConnect = async () => {
529
+ const handleConnect = async (data) => {
529
530
  try {
530
531
  setIsConnected(true);
531
532
  setIsConnecting(false);
533
+ setUser(data);
532
534
  const addrs = await sdk.getAddresses();
533
535
  setAddresses(addrs);
534
536
  } catch (err) {
@@ -543,6 +545,7 @@ function PhantomProvider({ children, config, debugConfig }) {
543
545
  const handleConnectError = (errorData) => {
544
546
  setIsConnecting(false);
545
547
  setConnectError(new Error(errorData.error || "Connection failed"));
548
+ setAddresses([]);
546
549
  };
547
550
  const handleDisconnect = () => {
548
551
  setIsConnected(false);
@@ -550,6 +553,7 @@ function PhantomProvider({ children, config, debugConfig }) {
550
553
  setConnectError(null);
551
554
  setAddresses([]);
552
555
  setWalletId(null);
556
+ setUser(null);
553
557
  };
554
558
  sdk.on("connect_start", handleConnectStart);
555
559
  sdk.on("connect", handleConnect);
@@ -576,9 +580,10 @@ function PhantomProvider({ children, config, debugConfig }) {
576
580
  connectError,
577
581
  addresses,
578
582
  walletId,
579
- setWalletId
583
+ setWalletId,
584
+ user
580
585
  }),
581
- [sdk, isConnected, isConnecting, connectError, addresses, walletId, setWalletId]
586
+ [sdk, isConnected, isConnecting, connectError, addresses, walletId, setWalletId, user]
582
587
  );
583
588
  return /* @__PURE__ */ jsx(PhantomContext.Provider, { value, children });
584
589
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantom/react-native-sdk",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.16",
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.7",
49
49
  "@phantom/base64url": "^1.0.0-beta.7",
50
50
  "@phantom/chain-interfaces": "^1.0.0-beta.7",
51
- "@phantom/client": "^1.0.0-beta.15",
51
+ "@phantom/client": "^1.0.0-beta.16",
52
52
  "@phantom/constants": "^1.0.0-beta.7",
53
53
  "@phantom/crypto": "^1.0.0-beta.7",
54
- "@phantom/embedded-provider-core": "^1.0.0-beta.15",
54
+ "@phantom/embedded-provider-core": "^1.0.0-beta.16",
55
55
  "@phantom/sdk-types": "^1.0.0-beta.7",
56
56
  "@types/bs58": "^5.0.0",
57
57
  "bs58": "^6.0.0",