@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/CHANGELOG.md +16 -0
- package/dist/hooks/useStatefulConnect/index.d.ts +1 -0
- package/dist/hooks/useStatefulConnect/index.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts +1 -2
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts +2 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/types/config.d.ts +3 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +11 -1
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +3 -3
- package/src/containers/Wallets/Wallets.tsx +1 -1
- package/src/hooks/useStatefulConnect/index.ts +1 -0
- package/src/hooks/useStatefulConnect/useStatefulConnect.ts +1 -1
- package/src/hooks/useWalletProviders/useWalletProviders.helpers.ts +6 -1
- package/src/index.ts +4 -0
- package/src/types/config.ts +3 -2
- package/src/utils/providers.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.51.
|
|
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/
|
|
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';
|
|
@@ -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,
|
package/src/types/config.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Language, theme } from '@rango-dev/ui';
|
|
2
|
-
import type {
|
|
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 };
|
package/src/utils/providers.ts
CHANGED
|
@@ -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 {
|