@rango-dev/wallets-react 0.48.1-next.5 → 0.49.0

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.
Files changed (83) hide show
  1. package/dist/context.d.ts.map +1 -0
  2. package/dist/helpers.d.ts +1 -1
  3. package/dist/hooks.d.ts +3 -0
  4. package/dist/hooks.d.ts.map +1 -0
  5. package/dist/hub/autoConnect.d.ts +2 -4
  6. package/dist/hub/autoConnect.d.ts.map +1 -1
  7. package/dist/hub/constants.d.ts +0 -1
  8. package/dist/hub/constants.d.ts.map +1 -1
  9. package/dist/hub/helpers.d.ts +2 -0
  10. package/dist/hub/helpers.d.ts.map +1 -1
  11. package/dist/hub/lastConnectedWallets.d.ts +1 -2
  12. package/dist/hub/lastConnectedWallets.d.ts.map +1 -1
  13. package/dist/hub/mod.d.ts +1 -1
  14. package/dist/hub/mod.d.ts.map +1 -1
  15. package/dist/hub/persistor.d.ts +11 -0
  16. package/dist/hub/persistor.d.ts.map +1 -0
  17. package/dist/{legacy → hub}/useAutoConnect.d.ts +1 -1
  18. package/dist/hub/useAutoConnect.d.ts.map +1 -0
  19. package/dist/hub/useHubAdapter.d.ts +1 -5
  20. package/dist/hub/useHubAdapter.d.ts.map +1 -1
  21. package/dist/hub/utils.d.ts +7 -8
  22. package/dist/hub/utils.d.ts.map +1 -1
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +4 -4
  27. package/dist/legacy/mod.d.ts +2 -4
  28. package/dist/legacy/mod.d.ts.map +1 -1
  29. package/dist/legacy/types.d.ts +89 -69
  30. package/dist/legacy/types.d.ts.map +1 -1
  31. package/dist/provider.d.ts +1 -1
  32. package/dist/provider.d.ts.map +1 -1
  33. package/dist/types.d.ts +39 -0
  34. package/dist/types.d.ts.map +1 -0
  35. package/package.json +6 -11
  36. package/src/{legacy/context.ts → context.ts} +0 -3
  37. package/src/helpers.ts +1 -1
  38. package/src/hooks.ts +13 -0
  39. package/src/hub/autoConnect.ts +26 -35
  40. package/src/hub/constants.ts +0 -1
  41. package/src/hub/helpers.ts +8 -1
  42. package/src/hub/lastConnectedWallets.ts +3 -51
  43. package/src/hub/mod.ts +1 -5
  44. package/src/hub/persistor.ts +19 -0
  45. package/src/{legacy → hub}/useAutoConnect.ts +2 -2
  46. package/src/hub/useHubAdapter.ts +37 -35
  47. package/src/hub/utils.ts +20 -55
  48. package/src/index.ts +2 -2
  49. package/src/legacy/mod.ts +6 -9
  50. package/src/legacy/types.ts +112 -97
  51. package/src/provider.tsx +8 -4
  52. package/src/types.ts +58 -0
  53. package/CHANGELOG.md +0 -343
  54. package/dist/helpers/index.d.ts +0 -2
  55. package/dist/helpers/index.d.ts.map +0 -1
  56. package/dist/helpers/index.js +0 -2
  57. package/dist/helpers/index.js.map +0 -7
  58. package/dist/legacy/autoConnect.d.ts +0 -7
  59. package/dist/legacy/autoConnect.d.ts.map +0 -1
  60. package/dist/legacy/context.d.ts.map +0 -1
  61. package/dist/legacy/helpers.d.ts +0 -31
  62. package/dist/legacy/helpers.d.ts.map +0 -1
  63. package/dist/legacy/hooks.d.ts +0 -10
  64. package/dist/legacy/hooks.d.ts.map +0 -1
  65. package/dist/legacy/useAutoConnect.d.ts.map +0 -1
  66. package/dist/legacy/useLegacyProviders.d.ts +0 -7
  67. package/dist/legacy/useLegacyProviders.d.ts.map +0 -1
  68. package/dist/legacy/utils.d.ts +0 -3
  69. package/dist/legacy/utils.d.ts.map +0 -1
  70. package/dist/test-utils/fixtures.d.ts +0 -14
  71. package/dist/test-utils/fixtures.d.ts.map +0 -1
  72. package/dist/useProviders.d.ts +0 -4
  73. package/dist/useProviders.d.ts.map +0 -1
  74. package/helpers/package.json +0 -8
  75. package/src/helpers/index.ts +0 -1
  76. package/src/legacy/autoConnect.ts +0 -69
  77. package/src/legacy/helpers.ts +0 -193
  78. package/src/legacy/hooks.ts +0 -54
  79. package/src/legacy/useLegacyProviders.ts +0 -246
  80. package/src/legacy/utils.ts +0 -7
  81. package/src/test-utils/fixtures.ts +0 -164
  82. package/src/useProviders.ts +0 -121
  83. /package/dist/{legacy/context.d.ts → context.d.ts} +0 -0
@@ -1,11 +1,7 @@
1
1
  import type { Namespace } from '@hub3js/namespaces';
2
2
 
3
- import { Persistor } from '@rango-dev/wallets-core/legacy';
4
-
5
- import {
6
- HUB_LAST_CONNECTED_WALLETS,
7
- LEGACY_LAST_CONNECTED_WALLETS,
8
- } from './constants.js';
3
+ import { HUB_LAST_CONNECTED_WALLETS } from './constants.js';
4
+ import { Persistor } from './persistor.js';
9
5
 
10
6
  export interface NamespaceInput {
11
7
  namespace: Namespace;
@@ -16,11 +12,9 @@ export interface LastConnectedWalletsStorage {
16
12
  [providerId: string]: NamespaceInput[];
17
13
  }
18
14
 
19
- export type LegacyLastConnectedWalletsStorage = string[];
20
-
21
15
  /**
22
16
  * We are doing some certain actions on storage for `last-connected-wallets` key.
23
- * This class helps us to define them in one place and also it has support for both legacy and hub.
17
+ * This class helps us to define them in one place.
24
18
  */
25
19
  export class LastConnectedWalletsFromStorage {
26
20
  #storageKey: string;
@@ -32,24 +26,18 @@ export class LastConnectedWalletsFromStorage {
32
26
  addWallet(providerId: string, namespaces: NamespaceInput[]): void {
33
27
  if (this.#storageKey === HUB_LAST_CONNECTED_WALLETS) {
34
28
  return this.#addWalletToHub(providerId, namespaces);
35
- } else if (this.#storageKey === LEGACY_LAST_CONNECTED_WALLETS) {
36
- return this.#addWalletToLegacy(providerId);
37
29
  }
38
30
  throw new Error('Not implemented');
39
31
  }
40
32
  removeWallets(providerIds?: string[]): void {
41
33
  if (this.#storageKey === HUB_LAST_CONNECTED_WALLETS) {
42
34
  return this.#removeWalletsFromHub(providerIds);
43
- } else if (this.#storageKey === LEGACY_LAST_CONNECTED_WALLETS) {
44
- return this.#removeWalletsFromLegacy(providerIds);
45
35
  }
46
36
  throw new Error('Not implemented');
47
37
  }
48
38
  list(): LastConnectedWalletsStorage {
49
39
  if (this.#storageKey === HUB_LAST_CONNECTED_WALLETS) {
50
40
  return this.#listFromHub();
51
- } else if (this.#storageKey === LEGACY_LAST_CONNECTED_WALLETS) {
52
- return this.#listFromLegacy();
53
41
  }
54
42
  throw new Error('Not implemented');
55
43
  }
@@ -60,17 +48,6 @@ export class LastConnectedWalletsFromStorage {
60
48
  throw new Error('Not implemented');
61
49
  }
62
50
 
63
- #listFromLegacy(): LastConnectedWalletsStorage {
64
- const persistor = new Persistor<LegacyLastConnectedWalletsStorage>();
65
- const lastConnectedWallets =
66
- persistor.getItem(LEGACY_LAST_CONNECTED_WALLETS) || [];
67
- const output: LastConnectedWalletsStorage = {};
68
- lastConnectedWallets.forEach((provider) => {
69
- // Setting empty namespaces
70
- output[provider] = [];
71
- });
72
- return output;
73
- }
74
51
  #listFromHub(): LastConnectedWalletsStorage {
75
52
  const persistor = new Persistor<LastConnectedWalletsStorage>();
76
53
  const lastConnectedWallets =
@@ -102,15 +79,6 @@ export class LastConnectedWalletsFromStorage {
102
79
  [providerId]: toBeAddedNamespaces,
103
80
  });
104
81
  }
105
- #addWalletToLegacy(providerId: string): void {
106
- const storage = new Persistor<LegacyLastConnectedWalletsStorage>();
107
- const storageState = storage.getItem(this.#storageKey) || [];
108
-
109
- storage.setItem(
110
- LEGACY_LAST_CONNECTED_WALLETS,
111
- storageState.concat(providerId)
112
- );
113
- }
114
82
  #removeWalletsFromHub(providerIds?: string[]): void {
115
83
  const persistor = new Persistor<LastConnectedWalletsStorage>();
116
84
  const storageState = persistor.getItem(this.#storageKey) || {};
@@ -147,20 +115,4 @@ export class LastConnectedWalletsFromStorage {
147
115
  this.#addWalletToHub(providerId, newProviderNamespaces);
148
116
  }
149
117
  }
150
- #removeWalletsFromLegacy(providerIds?: string[]): void {
151
- const persistor = new Persistor<LegacyLastConnectedWalletsStorage>();
152
- const storageState = persistor.getItem(this.#storageKey) || [];
153
-
154
- // Remove all wallets
155
- if (!providerIds) {
156
- persistor.setItem(this.#storageKey, []);
157
- return;
158
- }
159
-
160
- // Remove some of the wallets
161
- persistor.setItem(
162
- LEGACY_LAST_CONNECTED_WALLETS,
163
- storageState.filter((wallet) => !providerIds.includes(wallet))
164
- );
165
- }
166
118
  }
package/src/hub/mod.ts CHANGED
@@ -1,6 +1,2 @@
1
- export {
2
- separateLegacyAndHubProviders,
3
- getAllLegacyProviders,
4
- findProviderByType,
5
- } from './utils.js';
1
+ export { getHubProviders, findProviderByType } from './utils.js';
6
2
  export { useHubAdapter } from './useHubAdapter.js';
@@ -0,0 +1,19 @@
1
+ export interface PersistStorage<T> {
2
+ getItem: (name: string) => T | null;
3
+ setItem: (name: string, value: T) => void;
4
+ removeItem: (name: string) => void;
5
+ }
6
+
7
+ export class Persistor<T> implements PersistStorage<T> {
8
+ getItem(name: string) {
9
+ const item = localStorage.getItem(name);
10
+ const parsedItem = item ? (JSON.parse(item) as T) : null;
11
+ return parsedItem;
12
+ }
13
+ setItem(name: string, value: T) {
14
+ localStorage.setItem(name, JSON.stringify(value));
15
+ }
16
+ removeItem(name: string) {
17
+ localStorage.removeItem(name);
18
+ }
19
+ }
@@ -1,8 +1,8 @@
1
- import type { ProviderProps } from './types.js';
1
+ import type { ProviderProps } from '../types.js';
2
2
 
3
3
  import { useEffect, useRef } from 'react';
4
4
 
5
- import { shouldTryAutoConnect } from './utils.js';
5
+ import { shouldTryAutoConnect } from './helpers.js';
6
6
 
7
7
  export function useAutoConnect(
8
8
  props: Pick<ProviderProps, 'allBlockChains' | 'autoConnect'> & {
@@ -1,13 +1,12 @@
1
1
  import type { AllProxiedNamespaces, ExtensionLink } from './types.js';
2
- import type { ProviderContext } from '../index.js';
3
- import type { Provider } from '@hub3js/core';
4
- import type { VersionedProviders } from '@hub3js/core/utils';
5
- import type { Accounts, AccountsWithActiveChain } from '@hub3js/std/types';
6
2
  import type {
7
- LegacyNamespaceInputForConnect,
8
- LegacyWalletInfo as WalletInfo,
9
- LegacyWalletType as WalletType,
10
- } from '@rango-dev/wallets-core/legacy';
3
+ ConnectResult,
4
+ NamespaceInputForConnect,
5
+ WalletInfo,
6
+ } from '../legacy/mod.js';
7
+ import type { ProviderContext, ProviderProps } from '../types.js';
8
+ import type { Provider, WalletType } from '@hub3js/core';
9
+ import type { Accounts, AccountsWithActiveChain } from '@hub3js/std/types';
11
10
 
12
11
  import { utils } from '@hub3js/evm';
13
12
  import {
@@ -17,18 +16,16 @@ import {
17
16
  import { useEffect, useRef, useState } from 'react';
18
17
  import { Ok, Result } from 'ts-results';
19
18
 
20
- import {
21
- type ConnectResult,
22
- HUB_LAST_CONNECTED_WALLETS,
23
- type ProviderProps,
24
- } from '../legacy/mod.js';
25
- import { useAutoConnect } from '../legacy/useAutoConnect.js';
19
+ import { withErrorLoggingApi } from '../helpers.js';
26
20
 
27
21
  import { autoConnect } from './autoConnect.js';
22
+ import { HUB_LAST_CONNECTED_WALLETS } from './constants.js';
28
23
  import { createQueue, fromAccountIdToLegacyAddressFormat } from './helpers.js';
29
24
  import { LastConnectedWalletsFromStorage } from './lastConnectedWallets.js';
25
+ import { useAutoConnect } from './useAutoConnect.js';
30
26
  import { useHubRefs } from './useHubRefs.js';
31
27
  import {
28
+ findProviderByType,
32
29
  isEvmNamespace,
33
30
  isSolanaNamespace,
34
31
  isUtxoNamespace,
@@ -39,8 +36,6 @@ import {
39
36
 
40
37
  export type UseAdapterParams = Omit<ProviderProps, 'providers'> & {
41
38
  providers: Provider[];
42
- /** This is only will be used to access some parts of the legacy provider that doesn't exists in Hub. */
43
- allVersionedProviders: VersionedProviders[];
44
39
  };
45
40
 
46
41
  export function useHubAdapter(params: UseAdapterParams): ProviderContext {
@@ -49,7 +44,6 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
49
44
  // useEffect will run `subscribe` once, so we need a reference and mutate the value if it's changes.
50
45
  const dataRef = useRef({
51
46
  onUpdateState: params.onUpdateState,
52
- allVersionedProviders: params.allVersionedProviders,
53
47
  allBlockChains: params.allBlockChains,
54
48
  });
55
49
  const hubInitiated = useRef(false);
@@ -59,12 +53,12 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
59
53
  * Derivation path from params is used in `mapHubEventsToLegacy` to be added to the payload of connect events.
60
54
  */
61
55
  const lastConnectAttemptParamsRef = useRef<{
62
- [type: WalletType]: LegacyNamespaceInputForConnect[];
56
+ [type: WalletType]: NamespaceInputForConnect[];
63
57
  }>({});
64
58
 
65
59
  const updateLastConnectAttemptParams = (
66
60
  type: WalletType,
67
- namespaces: LegacyNamespaceInputForConnect[] | undefined
61
+ namespaces: NamespaceInputForConnect[] | undefined
68
62
  ) => {
69
63
  lastConnectAttemptParamsRef.current[type] = namespaces || [];
70
64
  };
@@ -80,7 +74,6 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
80
74
  useEffect(() => {
81
75
  dataRef.current = {
82
76
  onUpdateState: params.onUpdateState,
83
- allVersionedProviders: params.allVersionedProviders,
84
77
  allBlockChains: params.allBlockChains,
85
78
  };
86
79
  }, [params]);
@@ -140,9 +133,8 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
140
133
  const provider = getHub().get(type);
141
134
 
142
135
  if (!provider) {
143
- throw new Error(
144
- `You should add ${type} to provider first then call 'canSwitchNetworkTo'.`
145
- );
136
+ // TODO: should throw an error
137
+ return false;
146
138
  }
147
139
 
148
140
  if (!namespace) {
@@ -206,7 +198,7 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
206
198
 
207
199
  // Check `namespace` and look into hub to see how it can match given namespace to hub namespace.
208
200
  const targetNamespaces: [
209
- LegacyNamespaceInputForConnect,
201
+ NamespaceInputForConnect,
210
202
  AllProxiedNamespaces
211
203
  ][] = [];
212
204
  namespaces.forEach((namespace) => {
@@ -436,18 +428,22 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
436
428
  properties: metadata.properties,
437
429
  };
438
430
  },
439
- providers() {
440
- throw new Error('This method is not available on hub providers.');
441
- },
442
431
  state(type) {
443
432
  const hubState = getHub().state();
444
433
  const wallet = getHub().get(type);
445
434
  const walletState = hubState[type];
446
435
 
447
436
  if (!walletState || !wallet) {
448
- throw new Error(
449
- `It seems your requested provider doesn't exist in hub. Provider Id: ${type}`
450
- );
437
+ // TODO: should throw an error
438
+ return {
439
+ connected: false,
440
+ connecting: false,
441
+ installed: false,
442
+ reachable: false,
443
+ accounts: null,
444
+ network: null,
445
+ namespaces: new Map(),
446
+ };
451
447
  }
452
448
 
453
449
  const accounts = walletState.namespaces
@@ -501,12 +497,18 @@ export function useHubAdapter(params: UseAdapterParams): ProviderContext {
501
497
  `Suggest has not been implemented for given chain: ${namespace.network}`
502
498
  );
503
499
  },
504
- hubProvider() {
505
- throw new Error(
506
- 'Unreachable code. the method has been implemented in main adapter instance.'
507
- );
500
+ hubProvider(type) {
501
+ const provider = findProviderByType(params.providers, type);
502
+
503
+ if (!provider) {
504
+ throw new Error(
505
+ `You're trying to access ${type} provider which is not found in hub providers. it may not be registered yet.`
506
+ );
507
+ }
508
+
509
+ return provider;
508
510
  },
509
511
  };
510
512
 
511
- return api;
513
+ return withErrorLoggingApi(api);
512
514
  }
package/src/hub/utils.ts CHANGED
@@ -1,38 +1,32 @@
1
1
  import type { AllProxiedNamespaces } from './types.js';
2
+ import type {
3
+ ConnectResult,
4
+ NamespaceInputForConnect,
5
+ EventHandler as WalletEventHandler,
6
+ } from '../legacy/mod.js';
7
+ import type { ProviderProps } from '../types.js';
2
8
  import type { UtxoActions } from '@hub3js/bip122';
3
- import type { Hub, Provider, ProxiedNamespace } from '@hub3js/core';
9
+ import type { Hub, Provider, ProxiedNamespace, WalletType } from '@hub3js/core';
4
10
  import type { Event } from '@hub3js/core/store';
5
11
  import type {
6
12
  Chain as AddEthereumChainParameter,
7
13
  EvmActions,
8
14
  } from '@hub3js/evm';
9
15
  import type { SolanaActions } from '@hub3js/solana';
10
- import type {
11
- LegacyNamespaceInputForConnect,
12
- LegacyProviderInterface,
13
- LegacyEventHandler as WalletEventHandler,
14
- LegacyWalletType as WalletType,
15
- } from '@rango-dev/wallets-core/legacy';
16
16
 
17
17
  import { pickVersion, type VersionedProviders } from '@hub3js/core/utils';
18
18
  import {
19
19
  convertEvmBlockchainMetaToEvmChainInfo,
20
+ formatAddressWithNetwork,
21
+ getBlockChainNameFromId,
20
22
  getSupportedChainsFromProvider,
21
23
  } from '@rango-dev/internal-blockchains';
22
- import {
23
- LegacyEvents as Events,
24
- legacyFormatAddressWithNetwork as formatAddressWithNetwork,
25
- legacyGetBlockChainNameFromId as getBlockChainNameFromId,
26
- } from '@rango-dev/wallets-core/legacy';
27
24
  import { AccountId } from 'caip';
28
25
  import { type BlockchainMeta, isEvmBlockchain } from 'rango-types';
29
26
 
30
- import {
31
- type ConnectResult,
32
- HUB_LAST_CONNECTED_WALLETS,
33
- type ProviderProps,
34
- } from '../legacy/mod.js';
27
+ import { Events } from '../legacy/mod.js';
35
28
 
29
+ import { HUB_LAST_CONNECTED_WALLETS } from './constants.js';
36
30
  import {
37
31
  fromAccountIdToLegacyAddressFormat,
38
32
  isConnectResultEvm,
@@ -40,27 +34,16 @@ import {
40
34
  } from './helpers.js';
41
35
  import { LastConnectedWalletsFromStorage } from './lastConnectedWallets.js';
42
36
 
43
- /* Gets a list of hub and legacy providers and returns a tuple which separates them. */
44
- export function separateLegacyAndHubProviders(
45
- providers: VersionedProviders[]
46
- ): [LegacyProviderInterface[], Provider[]] {
47
- const LEGACY_VERSION = '0.0.0';
48
- const HUB_VERSION = '1.0.0';
49
-
50
- const legacyProviders: LegacyProviderInterface[] = [];
51
- const hubProviders: Provider[] = [];
52
-
53
- providers.forEach((provider) => {
37
+ export function getHubProviders(providers: VersionedProviders[]): Provider[] {
38
+ return providers.map((provider) => {
54
39
  try {
55
- const target = pickVersion(provider, HUB_VERSION);
56
- hubProviders.push(target[1]);
40
+ return pickVersion(provider, '1.0.0')[1] as Provider;
57
41
  } catch {
58
- const target = pickVersion(provider, LEGACY_VERSION);
59
- legacyProviders.push(target[1]);
42
+ throw new Error(
43
+ "Legacy providers aren't supported anymore. Expected a provider with version '1.0.0'."
44
+ );
60
45
  }
61
46
  });
62
-
63
- return [legacyProviders, hubProviders];
64
47
  }
65
48
 
66
49
  export function findProviderByType(
@@ -86,7 +69,7 @@ export function mapHubEventsToLegacy(
86
69
  metadata: {
87
70
  allBlockChains: ProviderProps['allBlockChains'];
88
71
  lastConnectAttemptParams: {
89
- [type: WalletType]: LegacyNamespaceInputForConnect[];
72
+ [type: WalletType]: NamespaceInputForConnect[];
90
73
  };
91
74
  }
92
75
  ): void {
@@ -272,27 +255,12 @@ export function mapHubEventsToLegacy(
272
255
  }
273
256
  }
274
257
 
275
- export function getAllLegacyProviders(
276
- allProviders: VersionedProviders[]
277
- ): LegacyProviderInterface[] {
278
- const LEGACY_VERSION = '0.0.0';
279
-
280
- const legacyProviders: LegacyProviderInterface[] = [];
281
-
282
- allProviders.forEach((provider) => {
283
- const target = pickVersion(provider, LEGACY_VERSION);
284
- legacyProviders.push(target[1]);
285
- });
286
-
287
- return legacyProviders;
288
- }
289
-
290
258
  /**
291
259
  * In legacy mode, for those who have switch network functionality (like evm), we are using an enum for network names
292
260
  * this enum only has meaning for us, and when we are going to connect an instance (e.g. window.ethereum) we should pass chain id.
293
261
  */
294
262
  export function convertNamespaceNetworkToEvmChainId(
295
- namespace: LegacyNamespaceInputForConnect,
263
+ namespace: NamespaceInputForConnect,
296
264
  meta: BlockchainMeta[]
297
265
  ): AddEthereumChainParameter | undefined {
298
266
  if (!namespace.network) {
@@ -310,7 +278,7 @@ export function convertNamespaceNetworkToEvmChainId(
310
278
  * This function will help us to map these strings to proper hex ids.
311
279
  */
312
280
  export function tryConvertNamespaceNetworkToChainInfo(
313
- namespace: LegacyNamespaceInputForConnect,
281
+ namespace: NamespaceInputForConnect,
314
282
  meta: BlockchainMeta[]
315
283
  ): string | AddEthereumChainParameter | undefined {
316
284
  // `undefined` means it's not evm or we couldn't find it in meta.
@@ -327,20 +295,17 @@ export function transformHubResultToLegacyResult(
327
295
  return {
328
296
  accounts: res.accounts,
329
297
  network: res.network,
330
- provider: undefined,
331
298
  };
332
299
  } else if (isConnectResultSolana(res)) {
333
300
  return {
334
301
  accounts: res,
335
302
  network: null,
336
- provider: undefined,
337
303
  };
338
304
  }
339
305
 
340
306
  return {
341
307
  accounts: [res],
342
308
  network: null,
343
- provider: undefined,
344
309
  };
345
310
  }
346
311
 
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './legacy/helpers.js';
2
1
  export { default as Provider } from './provider.js';
3
- export { useWallets } from './legacy/hooks.js';
2
+ export { useWallets } from './hooks.js';
3
+ export type * from './types.js';
4
4
  export * from './legacy/types.js';
package/src/legacy/mod.ts CHANGED
@@ -1,13 +1,10 @@
1
1
  export type {
2
- ProviderProps,
3
- ProviderContext,
4
2
  ConnectResult,
3
+ EventHandler,
4
+ EventInfo,
5
5
  ExtendedWalletInfo,
6
+ NamespaceInputForConnect,
7
+ WalletInfo,
8
+ WalletState,
6
9
  } from './types.js';
7
- export {
8
- LEGACY_LAST_CONNECTED_WALLETS,
9
- HUB_LAST_CONNECTED_WALLETS,
10
- } from '../hub/constants.js';
11
-
12
- export { WalletContext } from './context.js';
13
- export { useLegacyProviders } from './useLegacyProviders.js';
10
+ export { Events } from './types.js';