@rango-dev/widget-embedded 0.51.0 → 0.51.1-next.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.51.0",
3
+ "version": "0.51.1-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,14 +25,14 @@
25
25
  "@lingui/core": "4.2.1",
26
26
  "@lingui/react": "4.2.1",
27
27
  "@rango-dev/logging-core": "^0.11.0",
28
- "@rango-dev/provider-all": "^0.53.0",
28
+ "@rango-dev/provider-all": "^0.53.1-next.0",
29
29
  "@rango-dev/queue-manager-core": "^0.32.0",
30
30
  "@rango-dev/queue-manager-rango-preset": "^0.53.0",
31
31
  "@rango-dev/queue-manager-react": "^0.32.0",
32
32
  "@rango-dev/signer-solana": "^0.44.0",
33
33
  "@rango-dev/ui": "^0.54.0",
34
34
  "@rango-dev/wallets-core": "^0.50.0",
35
- "@rango-dev/wallets-react": "^0.37.0",
35
+ "@rango-dev/wallets-react": "^0.37.1-next.0",
36
36
  "@rango-dev/wallets-shared": "^0.51.0",
37
37
  "bignumber.js": "^9.1.1",
38
38
  "copy-to-clipboard": "^3.3.3",
@@ -5,7 +5,7 @@ import type {
5
5
  WidgetContextInterface,
6
6
  } from './Wallets.types';
7
7
  import type { ProvidersOptions } from '../../utils/providers';
8
- import type { LegacyEventHandler } from '@rango-dev/wallets-core/dist/legacy/mod';
8
+ import type { LegacyEventHandler } from '@rango-dev/wallets-core/legacy';
9
9
  import type { PropsWithChildren } from 'react';
10
10
 
11
11
  import { Provider } from '@rango-dev/wallets-react';
@@ -1,4 +1,5 @@
1
1
  export { useStatefulConnect } from './useStatefulConnect';
2
+ export type { UseStatefulConnect } from './useStatefulConnect';
2
3
  export { ResultStatus } from './useStatefulConnect.types';
3
4
  export type {
4
5
  NeedsNamespacesState,
@@ -17,7 +17,7 @@ import {
17
17
  import { initState, reducer, type State } from './useStatefulConnect.state';
18
18
  import { ResultStatus } from './useStatefulConnect.types';
19
19
 
20
- interface UseStatefulConnect {
20
+ export interface UseStatefulConnect {
21
21
  handleConnect: (
22
22
  wallet: WalletInfoWithExtra,
23
23
  options?: HandleConnectOptions
@@ -1,13 +1,18 @@
1
1
  import type { ProviderInterface } from '@rango-dev/wallets-react';
2
2
 
3
+ import { Provider } from '@rango-dev/wallets-core';
4
+
3
5
  export function hashProviders(
4
- providers: (string | ProviderInterface)[]
6
+ providers: (string | ProviderInterface | Provider)[]
5
7
  ): string {
6
8
  return providers
7
9
  .map((provider) => {
8
10
  if (typeof provider === 'string') {
9
11
  return provider;
10
12
  }
13
+ if (provider instanceof Provider) {
14
+ return provider.id;
15
+ }
11
16
  return provider.config.type;
12
17
  })
13
18
  .join('-');
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { WidgetProps } from './containers/Widget';
2
+ import type { UseStatefulConnect } from './hooks/useStatefulConnect';
2
3
  import type { ConnectedWallet } from './store/slices/wallets';
3
4
  import type {
4
5
  BlockchainAndTokenConfig,
@@ -86,6 +87,7 @@ import {
86
87
  WalletEventTypes,
87
88
  WidgetEvents,
88
89
  } from './types';
90
+ import { pickProviderVersionWithFallbackToLegacy } from './utils/providers';
89
91
  import { customizedThemeTokens } from './utils/ui';
90
92
 
91
93
  export const StatefulConnect = {
@@ -131,6 +133,7 @@ export type {
131
133
  QuoteEventData,
132
134
  UiEventData,
133
135
  WalletInfoWithExtra,
136
+ UseStatefulConnect,
134
137
  };
135
138
  export {
136
139
  Widget,
@@ -180,6 +183,7 @@ export type {
180
183
  // Internal function and enum exports for Rango
181
184
  export {
182
185
  readAccountAddress,
186
+ pickProviderVersionWithFallbackToLegacy,
183
187
  Networks,
184
188
  WalletEvents,
185
189
  WalletTypes,
@@ -1,5 +1,6 @@
1
1
  import type { Language, theme } from '@rango-dev/ui';
2
- import type { LegacyProviderInterface } from '@rango-dev/wallets-core/dist/legacy/mod';
2
+ import type { Provider } from '@rango-dev/wallets-core';
3
+ import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
3
4
  import type { WalletType } from '@rango-dev/wallets-shared';
4
5
  import type { Asset } from 'rango-sdk';
5
6
  import type { ReactElement } from 'react';
@@ -272,7 +273,7 @@ export type WidgetConfig = {
272
273
  from?: BlockchainAndTokenConfig;
273
274
  to?: BlockchainAndTokenConfig;
274
275
  liquiditySources?: string[];
275
- wallets?: (WalletType | LegacyProviderInterface)[];
276
+ wallets?: (WalletType | LegacyProviderInterface | Provider)[];
276
277
  multiWallets?: boolean;
277
278
  customDestination?: boolean;
278
279
  defaultCustomDestinations?: { [blockchain: string]: string };
@@ -95,7 +95,7 @@ export function matchAndGenerateProviders({
95
95
  return allProviders;
96
96
  }
97
97
 
98
- function pickProviderVersionWithFallbackToLegacy(
98
+ export function pickProviderVersionWithFallbackToLegacy(
99
99
  provider: VersionedProviders
100
100
  ): BothProvidersInterface {
101
101
  try {