@rango-dev/widget-embedded 0.38.1-next.7 → 0.38.1-next.9
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/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -4
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +2 -3
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +0 -1
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +3 -3
- package/src/containers/Wallets/Wallets.tsx +0 -6
- package/src/hooks/useWalletList.ts +2 -9
- package/src/store/slices/config.ts +0 -4
- package/src/store/slices/data.test.ts +0 -3
- package/src/types/config.ts +1 -5
- package/src/utils/providers.ts +6 -17
- package/src/utils/settings.ts +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.38.1-next.
|
|
3
|
+
"version": "0.38.1-next.9",
|
|
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.6.0",
|
|
28
|
-
"@rango-dev/provider-all": "^0.42.1-next.
|
|
28
|
+
"@rango-dev/provider-all": "^0.42.1-next.5",
|
|
29
29
|
"@rango-dev/queue-manager-core": "^0.27.0",
|
|
30
30
|
"@rango-dev/queue-manager-rango-preset": "^0.41.1-next.1",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.27.0",
|
|
32
32
|
"@rango-dev/signer-solana": "^0.36.0",
|
|
33
33
|
"@rango-dev/ui": "^0.43.1-next.2",
|
|
34
34
|
"@rango-dev/wallets-core": "^0.40.1-next.9",
|
|
35
|
-
"@rango-dev/wallets-react": "^0.27.1-next.
|
|
35
|
+
"@rango-dev/wallets-react": "^0.27.1-next.6",
|
|
36
36
|
"@rango-dev/wallets-shared": "^0.41.1-next.1",
|
|
37
37
|
"bignumber.js": "^9.1.1",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
@@ -19,7 +19,6 @@ import React, { createContext, useEffect, useMemo, useRef } from 'react';
|
|
|
19
19
|
import { useWalletProviders } from '../../hooks/useWalletProviders';
|
|
20
20
|
import { AppStoreProvider, useAppStore } from '../../store/AppStore';
|
|
21
21
|
import { useUiStore } from '../../store/ui';
|
|
22
|
-
import { isFeatureEnabled } from '../../utils/settings';
|
|
23
22
|
import {
|
|
24
23
|
prepareAccountsForWalletStore,
|
|
25
24
|
walletAndSupportedChainsNames,
|
|
@@ -54,7 +53,6 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
54
53
|
walletConnectListedDesktopWalletLink:
|
|
55
54
|
props.config.__UNSTABLE_OR_INTERNAL__
|
|
56
55
|
?.walletConnectListedDesktopWalletLink,
|
|
57
|
-
experimentalWallet: props.config.features?.experimentalWallet,
|
|
58
56
|
};
|
|
59
57
|
const { providers } = useWalletProviders(config.wallets, walletOptions);
|
|
60
58
|
const onConnectWalletHandler = useRef<OnWalletConnectionChange>();
|
|
@@ -209,10 +207,6 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
209
207
|
autoConnect={!!isActiveTab}
|
|
210
208
|
configs={{
|
|
211
209
|
wallets: config.wallets,
|
|
212
|
-
isExperimentalEnabled: isFeatureEnabled(
|
|
213
|
-
'experimentalWallet',
|
|
214
|
-
config.features
|
|
215
|
-
),
|
|
216
210
|
}}>
|
|
217
211
|
{props.children}
|
|
218
212
|
</Provider>
|
|
@@ -40,21 +40,14 @@ interface API {
|
|
|
40
40
|
*/
|
|
41
41
|
export function useWalletList(params?: Params): API {
|
|
42
42
|
const { chain } = params || {};
|
|
43
|
-
const {
|
|
43
|
+
const { connectedWallets, getAvailableProviders } = useAppStore();
|
|
44
44
|
const { state, getWalletInfo } = useWallets();
|
|
45
45
|
const blockchains = useAppStore().blockchains();
|
|
46
46
|
const { handleDisconnect } = useStatefulConnect();
|
|
47
47
|
|
|
48
48
|
/** It can be what has been set by widget config or as a fallback we use all the supported wallets by our library */
|
|
49
49
|
const listAvailableWalletTypes = configWalletsToWalletName(
|
|
50
|
-
getAvailableProviders()
|
|
51
|
-
{
|
|
52
|
-
trezorManifest: config?.trezorManifest,
|
|
53
|
-
walletConnectProjectId: config?.walletConnectProjectId,
|
|
54
|
-
walletConnectListedDesktopWalletLink:
|
|
55
|
-
config.__UNSTABLE_OR_INTERNAL__?.walletConnectListedDesktopWalletLink,
|
|
56
|
-
tonConnect: config.tonConnect,
|
|
57
|
-
}
|
|
50
|
+
getAvailableProviders()
|
|
58
51
|
);
|
|
59
52
|
|
|
60
53
|
let wallets = mapWalletTypesToWalletInfo(
|
|
@@ -22,7 +22,6 @@ function makeProvidersOptionsFromConfig(
|
|
|
22
22
|
tonConnect: config?.tonConnect,
|
|
23
23
|
walletConnectListedDesktopWalletLink:
|
|
24
24
|
config.__UNSTABLE_OR_INTERNAL__?.walletConnectListedDesktopWalletLink,
|
|
25
|
-
experimentalWallet: config.features?.experimentalWallet,
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
return options;
|
|
@@ -43,9 +42,6 @@ export const DEFAULT_CONFIG: WidgetConfig = {
|
|
|
43
42
|
manifestUrl:
|
|
44
43
|
'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/manifests/tonconnect-manifest.json',
|
|
45
44
|
},
|
|
46
|
-
features: {
|
|
47
|
-
experimentalWallet: 'enabled',
|
|
48
|
-
},
|
|
49
45
|
};
|
|
50
46
|
|
|
51
47
|
interface IframeConfigs {
|
|
@@ -34,9 +34,6 @@ const DEFAULT_CONFIG: WidgetConfig = {
|
|
|
34
34
|
manifestUrl:
|
|
35
35
|
'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/manifests/tonconnect-manifest.json',
|
|
36
36
|
},
|
|
37
|
-
features: {
|
|
38
|
-
experimentalWallet: 'enabled',
|
|
39
|
-
},
|
|
40
37
|
};
|
|
41
38
|
|
|
42
39
|
beforeEach(() => {
|
package/src/types/config.ts
CHANGED
|
@@ -134,9 +134,6 @@ export type SignersConfig = {
|
|
|
134
134
|
*
|
|
135
135
|
* @property {'visible' | 'hidden'} [liquiditySource]
|
|
136
136
|
* - The visibility state for the liquiditySource feature. Optional property.
|
|
137
|
-
*
|
|
138
|
-
* @property {'disabled' | 'enabled'} [experimentalWallet]
|
|
139
|
-
* - Enable our experimental version of wallets. Default: disable on production, enabled on dev.
|
|
140
137
|
*/
|
|
141
138
|
export type Features = Partial<
|
|
142
139
|
Record<
|
|
@@ -148,8 +145,7 @@ export type Features = Partial<
|
|
|
148
145
|
| 'customTokens',
|
|
149
146
|
'visible' | 'hidden'
|
|
150
147
|
>
|
|
151
|
-
|
|
152
|
-
Partial<Record<'experimentalWallet', 'disabled' | 'enabled'>>;
|
|
148
|
+
>;
|
|
153
149
|
|
|
154
150
|
/**
|
|
155
151
|
* `Routing`
|
package/src/utils/providers.ts
CHANGED
|
@@ -15,7 +15,6 @@ export interface ProvidersOptions {
|
|
|
15
15
|
>['walletConnectListedDesktopWalletLink'];
|
|
16
16
|
trezorManifest: WidgetConfig['trezorManifest'];
|
|
17
17
|
tonConnect: WidgetConfig['tonConnect'];
|
|
18
|
-
experimentalWallet?: 'enabled' | 'disabled';
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -28,7 +27,6 @@ type BothProvidersInterface = LegacyProviderInterface | Provider;
|
|
|
28
27
|
export function matchAndGenerateProviders({
|
|
29
28
|
allProviders,
|
|
30
29
|
configWallets,
|
|
31
|
-
options,
|
|
32
30
|
}: {
|
|
33
31
|
allProviders: VersionedProviders[];
|
|
34
32
|
configWallets: WidgetConfig['wallets'];
|
|
@@ -56,10 +54,8 @@ export function matchAndGenerateProviders({
|
|
|
56
54
|
* If the corresponding provider to a wallet was found in allProvider,
|
|
57
55
|
* it will be add to selected providers.
|
|
58
56
|
*/
|
|
59
|
-
const versionedProvider =
|
|
60
|
-
provider
|
|
61
|
-
options
|
|
62
|
-
);
|
|
57
|
+
const versionedProvider =
|
|
58
|
+
pickProviderVersionWithFallbackToLegacy(provider);
|
|
63
59
|
if (versionedProvider instanceof Provider) {
|
|
64
60
|
return versionedProvider.id === requestedWallet;
|
|
65
61
|
}
|
|
@@ -100,14 +96,10 @@ export function matchAndGenerateProviders({
|
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
function pickProviderVersionWithFallbackToLegacy(
|
|
103
|
-
provider: VersionedProviders
|
|
104
|
-
options?: ProvidersOptions
|
|
99
|
+
provider: VersionedProviders
|
|
105
100
|
): BothProvidersInterface {
|
|
106
|
-
const { experimentalWallet = 'enabled' } = options || {};
|
|
107
|
-
const version = experimentalWallet == 'disabled' ? '0.0.0' : '1.0.0';
|
|
108
|
-
|
|
109
101
|
try {
|
|
110
|
-
return pickVersion(provider,
|
|
102
|
+
return pickVersion(provider, '1.0.0')[1];
|
|
111
103
|
} catch {
|
|
112
104
|
// Fallback to legacy version, if target version doesn't exists.
|
|
113
105
|
return pickVersion(provider, '0.0.0')[1];
|
|
@@ -115,13 +107,10 @@ function pickProviderVersionWithFallbackToLegacy(
|
|
|
115
107
|
}
|
|
116
108
|
|
|
117
109
|
export function configWalletsToWalletName(
|
|
118
|
-
providers: VersionedProviders[]
|
|
119
|
-
options?: ProvidersOptions
|
|
110
|
+
providers: VersionedProviders[]
|
|
120
111
|
): string[] {
|
|
121
112
|
const names = providers
|
|
122
|
-
.map((provider) =>
|
|
123
|
-
pickProviderVersionWithFallbackToLegacy(provider, options)
|
|
124
|
-
)
|
|
113
|
+
.map((provider) => pickProviderVersionWithFallbackToLegacy(provider))
|
|
125
114
|
.map((provider) => {
|
|
126
115
|
if (provider instanceof Provider) {
|
|
127
116
|
return provider.id;
|
package/src/utils/settings.ts
CHANGED
|
@@ -72,10 +72,6 @@ export function isFeatureHidden(feature: keyof Features, features?: Features) {
|
|
|
72
72
|
return features?.[feature] === 'hidden';
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export function isFeatureEnabled(feature: keyof Features, features?: Features) {
|
|
76
|
-
return features?.[feature] === 'enabled';
|
|
77
|
-
}
|
|
78
|
-
|
|
79
75
|
export function isRoutingEnabled(item: keyof Routing, routing?: Routing) {
|
|
80
76
|
return routing?.[item] === 'enabled';
|
|
81
77
|
}
|