@phantom/react-sdk 0.2.1 → 0.2.3

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
@@ -1,14 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import * as _phantom_browser_sdk from '@phantom/browser-sdk';
4
- import { BrowserSDKConfig, BrowserSDK, WalletAddress, SignMessageParams, SignAndSendTransactionParams, SignedTransaction, CreateUserOrganizationParams, CreateUserOrganizationResult } from '@phantom/browser-sdk';
5
- export { AddressType, CreateUserOrganizationParams, CreateUserOrganizationResult, NetworkId, SignAndSendTransactionParams, SignMessageParams, SignedTransaction, WalletAddress } from '@phantom/browser-sdk';
3
+ import { BrowserSDKConfig, AuthOptions, BrowserSDK, WalletAddress, SignMessageParams, SignAndSendTransactionParams, SignedTransaction, CreateUserOrganizationParams, CreateUserOrganizationResult } from '@phantom/browser-sdk';
4
+ export { AddressType, CreateUserOrganizationParams, CreateUserOrganizationResult, DebugLevel, DebugMessage, NetworkId, SignAndSendTransactionParams, SignMessageParams, SignedTransaction, WalletAddress, debug } from '@phantom/browser-sdk';
5
+ import * as _phantom_embedded_provider_core from '@phantom/embedded-provider-core';
6
6
 
7
7
  interface PhantomSDKConfig extends BrowserSDKConfig {
8
8
  }
9
9
  interface ConnectOptions {
10
10
  providerType?: "injected" | "embedded";
11
11
  embeddedWalletType?: "app-wallet" | "user-wallet";
12
+ authOptions?: AuthOptions;
12
13
  }
13
14
  interface PhantomContextValue {
14
15
  sdk: BrowserSDK | null;
@@ -29,10 +30,7 @@ declare function PhantomProvider({ children, config }: PhantomProviderProps): re
29
30
  declare function usePhantom(): PhantomContextValue;
30
31
 
31
32
  declare function useConnect(): {
32
- connect: (options?: ConnectOptions) => Promise<_phantom_browser_sdk.ConnectResult>;
33
- switchProvider: (type: "injected" | "embedded", options?: {
34
- embeddedWalletType?: "app-wallet" | "user-wallet";
35
- }) => Promise<void>;
33
+ connect: (options?: ConnectOptions) => Promise<_phantom_embedded_provider_core.ConnectResult>;
36
34
  isConnecting: boolean;
37
35
  error: Error | null;
38
36
  currentProviderType: "injected" | "embedded" | null;
@@ -57,7 +55,7 @@ declare function useSignAndSendTransaction(): {
57
55
  error: Error | null;
58
56
  };
59
57
 
60
- declare function useAccounts(): _phantom_browser_sdk.WalletAddress[] | null;
58
+ declare function useAccounts(): _phantom_embedded_provider_core.WalletAddress[] | null;
61
59
 
62
60
  declare function useCreateUserOrganization(): {
63
61
  createUserOrganization: (params: CreateUserOrganizationParams) => Promise<CreateUserOrganizationResult>;
package/dist/index.js CHANGED
@@ -31,8 +31,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
33
  AddressType: () => import_browser_sdk2.AddressType,
34
+ DebugLevel: () => import_browser_sdk2.DebugLevel,
34
35
  NetworkId: () => import_browser_sdk2.NetworkId,
35
36
  PhantomProvider: () => PhantomProvider,
37
+ debug: () => import_browser_sdk2.debug,
36
38
  useAccounts: () => useAccounts,
37
39
  useConnect: () => useConnect,
38
40
  useCreateUserOrganization: () => useCreateUserOrganization,
@@ -158,21 +160,8 @@ function useConnect() {
158
160
  },
159
161
  [context.sdk, context.isReady]
160
162
  );
161
- const switchProvider = (0, import_react2.useCallback)(
162
- async (type, options) => {
163
- if (!context.sdk || !context.isReady) {
164
- throw new Error("SDK not initialized");
165
- }
166
- await context.sdk.switchProvider(type, options);
167
- if (context.sdk._updateConnectionState) {
168
- await context.sdk._updateConnectionState();
169
- }
170
- },
171
- [context.sdk, context.isReady]
172
- );
173
163
  return {
174
164
  connect,
175
- switchProvider,
176
165
  isConnecting,
177
166
  error,
178
167
  currentProviderType: context.currentProviderType,
package/dist/index.mjs CHANGED
@@ -112,21 +112,8 @@ function useConnect() {
112
112
  },
113
113
  [context.sdk, context.isReady]
114
114
  );
115
- const switchProvider = useCallback2(
116
- async (type, options) => {
117
- if (!context.sdk || !context.isReady) {
118
- throw new Error("SDK not initialized");
119
- }
120
- await context.sdk.switchProvider(type, options);
121
- if (context.sdk._updateConnectionState) {
122
- await context.sdk._updateConnectionState();
123
- }
124
- },
125
- [context.sdk, context.isReady]
126
- );
127
115
  return {
128
116
  connect,
129
- switchProvider,
130
117
  isConnecting,
131
118
  error,
132
119
  currentProviderType: context.currentProviderType,
@@ -307,11 +294,13 @@ function useIsExtensionInstalled() {
307
294
  }
308
295
 
309
296
  // src/index.ts
310
- import { NetworkId, AddressType } from "@phantom/browser-sdk";
297
+ import { NetworkId, AddressType, DebugLevel, debug } from "@phantom/browser-sdk";
311
298
  export {
312
299
  AddressType,
300
+ DebugLevel,
313
301
  NetworkId,
314
302
  PhantomProvider,
303
+ debug,
315
304
  useAccounts,
316
305
  useConnect,
317
306
  useCreateUserOrganization,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantom/react-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "prettier": "prettier --write \"src/**/*.{ts,tsx}\""
26
26
  },
27
27
  "dependencies": {
28
- "@phantom/browser-sdk": "^0.2.1"
28
+ "@phantom/browser-sdk": "^0.2.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@testing-library/dom": "^10.4.0",