@rango-dev/widget-embedded 0.51.1-next.6 → 0.51.1-next.7
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/components/ConfirmWalletsModal/WalletList.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 +4 -4
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/types/config.d.ts +0 -15
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +7 -7
- package/src/components/ConfirmWalletsModal/WalletList.tsx +2 -7
- package/src/hooks/useWalletList.ts +1 -4
- package/src/pages/WalletsPage.tsx +0 -4
- package/src/types/config.ts +1 -15
- package/src/utils/wallets.ts +1 -0
- package/dist/hooks/useDeepLink.d.ts +0 -7
- package/dist/hooks/useDeepLink.d.ts.map +0 -1
- package/src/hooks/useDeepLink.ts +0 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.51.1-next.
|
|
3
|
+
"version": "0.51.1-next.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,15 +25,15 @@
|
|
|
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.1-next.
|
|
28
|
+
"@rango-dev/provider-all": "^0.53.1-next.2",
|
|
29
29
|
"@rango-dev/queue-manager-core": "^0.32.1-next.0",
|
|
30
|
-
"@rango-dev/queue-manager-rango-preset": "^0.53.1-next.
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.53.1-next.2",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.32.1-next.0",
|
|
32
32
|
"@rango-dev/signer-solana": "^0.44.0",
|
|
33
|
-
"@rango-dev/ui": "^0.54.1-next.
|
|
34
|
-
"@rango-dev/wallets-core": "^0.50.1-next.
|
|
35
|
-
"@rango-dev/wallets-react": "^0.37.1-next.
|
|
36
|
-
"@rango-dev/wallets-shared": "^0.51.1-next.
|
|
33
|
+
"@rango-dev/ui": "^0.54.1-next.3",
|
|
34
|
+
"@rango-dev/wallets-core": "^0.50.1-next.1",
|
|
35
|
+
"@rango-dev/wallets-react": "^0.37.1-next.2",
|
|
36
|
+
"@rango-dev/wallets-shared": "^0.51.1-next.1",
|
|
37
37
|
"bignumber.js": "^9.1.1",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
39
39
|
"dayjs": "^1.11.7",
|
|
@@ -15,7 +15,6 @@ import React, { useEffect, useState } from 'react';
|
|
|
15
15
|
|
|
16
16
|
import { useWallets } from '../..';
|
|
17
17
|
import { WIDGET_UI_ID } from '../../constants';
|
|
18
|
-
import { useDeepLink } from '../../hooks/useDeepLink';
|
|
19
18
|
import { useWalletList } from '../../hooks/useWalletList';
|
|
20
19
|
import { useAppStore } from '../../store/AppStore';
|
|
21
20
|
import { useUiStore } from '../../store/ui';
|
|
@@ -39,7 +38,7 @@ export function WalletList(props: PropTypes) {
|
|
|
39
38
|
const { chain, quoteChains, isSelected, selectWallet, limit, onShowMore } =
|
|
40
39
|
props;
|
|
41
40
|
const isActiveTab = useUiStore.use.isActiveTab();
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
const { blockchains, connectedWallets } = useAppStore();
|
|
44
43
|
const [selectedWalletToConnect, setSelectedWalletToConnect] =
|
|
45
44
|
useState<ExtendedModalWalletInfo>();
|
|
@@ -162,9 +161,7 @@ export function WalletList(props: PropTypes) {
|
|
|
162
161
|
}
|
|
163
162
|
};
|
|
164
163
|
|
|
165
|
-
const info = makeInfo(wallet.state
|
|
166
|
-
hasDeepLink: checkHasDeepLink(wallet.type),
|
|
167
|
-
});
|
|
164
|
+
const info = makeInfo(wallet.state);
|
|
168
165
|
|
|
169
166
|
const getWalletDescription = () => {
|
|
170
167
|
if (couldAddExperimentalChain) {
|
|
@@ -235,7 +232,6 @@ export function WalletList(props: PropTypes) {
|
|
|
235
232
|
</WatermarkedModal>
|
|
236
233
|
)}
|
|
237
234
|
<SelectableWallet
|
|
238
|
-
hasDeepLink={checkHasDeepLink(wallet.type)}
|
|
239
235
|
key={wallet.type}
|
|
240
236
|
id="widget-wallets-list-selectable-wallet-btn"
|
|
241
237
|
description={getWalletDescription()}
|
|
@@ -244,7 +240,6 @@ export function WalletList(props: PropTypes) {
|
|
|
244
240
|
selected={isSelected(wallet.type, chain)}
|
|
245
241
|
disabled={!isActiveTab}
|
|
246
242
|
{...wallet}
|
|
247
|
-
link={getWalletLink(wallet.type)}
|
|
248
243
|
/>
|
|
249
244
|
</React.Fragment>
|
|
250
245
|
);
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
sortWalletsBasedOnConnectionState,
|
|
21
21
|
} from '../utils/wallets';
|
|
22
22
|
|
|
23
|
-
import { useDeepLink } from './useDeepLink';
|
|
24
23
|
import { useStatefulConnect } from './useStatefulConnect/useStatefulConnect';
|
|
25
24
|
|
|
26
25
|
interface Params {
|
|
@@ -45,7 +44,6 @@ export function useWalletList(params?: Params): API {
|
|
|
45
44
|
const { state, getWalletInfo } = useWallets();
|
|
46
45
|
const blockchains = useAppStore().blockchains();
|
|
47
46
|
const { handleDisconnect } = useStatefulConnect();
|
|
48
|
-
const { checkHasDeepLink } = useDeepLink();
|
|
49
47
|
|
|
50
48
|
/** It can be what has been set by widget config or as a fallback we use all the supported wallets by our library */
|
|
51
49
|
const listAvailableWalletTypes = configWalletsToWalletName(
|
|
@@ -62,8 +60,7 @@ export function useWalletList(params?: Params): API {
|
|
|
62
60
|
wallets = detectMobileScreens()
|
|
63
61
|
? wallets.filter(
|
|
64
62
|
(wallet) =>
|
|
65
|
-
wallet.showOnMobile !== false &&
|
|
66
|
-
(state(wallet.type).installed || checkHasDeepLink(wallet.type))
|
|
63
|
+
wallet.showOnMobile !== false && state(wallet.type).installed
|
|
67
64
|
)
|
|
68
65
|
: wallets;
|
|
69
66
|
|
|
@@ -13,7 +13,6 @@ import React, { useState } from 'react';
|
|
|
13
13
|
|
|
14
14
|
import { Layout, PageContainer } from '../components/Layout';
|
|
15
15
|
import { StatefulConnectModal } from '../components/StatefulConnectModal';
|
|
16
|
-
import { useDeepLink } from '../hooks/useDeepLink';
|
|
17
16
|
import { useWalletList } from '../hooks/useWalletList';
|
|
18
17
|
import { useAppStore } from '../store/AppStore';
|
|
19
18
|
import { useUiStore } from '../store/ui';
|
|
@@ -42,7 +41,6 @@ export function WalletsPage() {
|
|
|
42
41
|
const [blockchainCategory, setBlockchainCategory] = useState<string>('ALL');
|
|
43
42
|
const blockchains = useAppStore().blockchains();
|
|
44
43
|
const { config } = useAppStore();
|
|
45
|
-
const { checkHasDeepLink, getWalletLink } = useDeepLink();
|
|
46
44
|
const [selectedWalletToConnect, setSelectedWalletToConnect] =
|
|
47
45
|
useState<WalletInfoWithExtra>();
|
|
48
46
|
const isActiveTab = useUiStore.use.isActiveTab();
|
|
@@ -90,8 +88,6 @@ export function WalletsPage() {
|
|
|
90
88
|
<Wallet
|
|
91
89
|
key={key}
|
|
92
90
|
{...wallet}
|
|
93
|
-
hasDeepLink={checkHasDeepLink(wallet.type)}
|
|
94
|
-
link={getWalletLink(wallet.type)}
|
|
95
91
|
state={wallet.state}
|
|
96
92
|
container={getContainer()}
|
|
97
93
|
onClick={() => handleWalletItemClick(wallet)}
|
package/src/types/config.ts
CHANGED
|
@@ -176,19 +176,7 @@ export type TrezorManifest = {
|
|
|
176
176
|
appUrl: string;
|
|
177
177
|
email: string;
|
|
178
178
|
};
|
|
179
|
-
|
|
180
|
-
* `DeepLinking`
|
|
181
|
-
*
|
|
182
|
-
* @property {string} [targetUrl]
|
|
183
|
-
* - The URL to be opened in the provider's in-app browser.
|
|
184
|
-
*
|
|
185
|
-
* @property {string} [appHost]
|
|
186
|
-
* - The full domain of the app, excluding the protocol (https://), path, and query parameters.
|
|
187
|
-
*/
|
|
188
|
-
export type DeepLinking = {
|
|
189
|
-
targetUrl: string;
|
|
190
|
-
appHost: string;
|
|
191
|
-
};
|
|
179
|
+
|
|
192
180
|
/**
|
|
193
181
|
*
|
|
194
182
|
* @property {string} manifestUrl - The URL of the TON Connect [manifest]{@link https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest}, containing the Dapp metadata to be displayed in the user’s wallet.
|
|
@@ -236,7 +224,6 @@ export type TonConnectConfig = {
|
|
|
236
224
|
* @property {WidgetTheme} theme - The `theme` property is a part of the `WidgetConfig` type and is
|
|
237
225
|
* used to specify the visual theme of the widget. It is of type `WidgetTheme`, which is an interface
|
|
238
226
|
* that defines the various properties of the theme, such as colors, fonts, and others.
|
|
239
|
-
* @property {DeepLinking} deepLinking - Configures deep linking parameters for providers that support it.
|
|
240
227
|
* @property {boolean} externalWallets
|
|
241
228
|
* If `externalWallets` is `true`, you should add `WidgetWallets` to your app.
|
|
242
229
|
* @property {boolean} excludeLiquiditySources - The `excludeLiquiditySources` property is a boolean value that when you
|
|
@@ -279,7 +266,6 @@ export type WidgetConfig = {
|
|
|
279
266
|
defaultCustomDestinations?: { [blockchain: string]: string };
|
|
280
267
|
language?: Language;
|
|
281
268
|
theme?: WidgetTheme;
|
|
282
|
-
deepLinking?: DeepLinking;
|
|
283
269
|
externalWallets?: boolean;
|
|
284
270
|
excludeLiquiditySources?: boolean;
|
|
285
271
|
features?: Features;
|
package/src/utils/wallets.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { InstallObjects } from '@rango-dev/wallets-shared';
|
|
2
|
-
export declare function useDeepLink(): {
|
|
3
|
-
getWalletDeepLink: (walletType: string) => string | undefined;
|
|
4
|
-
getWalletLink: (walletType: string) => string | InstallObjects;
|
|
5
|
-
checkHasDeepLink: (walletType: string) => boolean;
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=useDeepLink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDeepLink.d.ts","sourceRoot":"","sources":["../../src/hooks/useDeepLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOhE,wBAAgB,WAAW;oCAKc,MAAM,KAAG,MAAM,GAAG,SAAS;gCAsB/B,MAAM,KAAG,MAAM,GAAG,cAAc;mCAS7B,MAAM,KAAG,OAAO;EAIvD"}
|
package/src/hooks/useDeepLink.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { InstallObjects } from '@rango-dev/wallets-shared';
|
|
2
|
-
|
|
3
|
-
import { useWallets } from '@rango-dev/wallets-react';
|
|
4
|
-
import { detectMobileScreens } from '@rango-dev/wallets-shared';
|
|
5
|
-
|
|
6
|
-
import { useAppStore } from '../store/AppStore';
|
|
7
|
-
|
|
8
|
-
export function useDeepLink() {
|
|
9
|
-
const { getWalletInfo } = useWallets();
|
|
10
|
-
const { config } = useAppStore();
|
|
11
|
-
const isMobileScreen = detectMobileScreens();
|
|
12
|
-
|
|
13
|
-
function getWalletDeepLink(walletType: string): string | undefined {
|
|
14
|
-
const wallet = getWalletInfo(walletType);
|
|
15
|
-
const appHost = config.deepLinking?.appHost;
|
|
16
|
-
const targetUrl = config.deepLinking?.targetUrl;
|
|
17
|
-
if (!appHost || !targetUrl) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
return wallet.generateDeepLink?.({
|
|
21
|
-
appHost,
|
|
22
|
-
targetUrl,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns the appropriate wallet link based on the given wallet type.
|
|
28
|
-
*
|
|
29
|
-
* If a deep link is available and the user is on a mobile screen, the deep link is returned.
|
|
30
|
-
* Otherwise, it falls back to returning the wallet's install link.
|
|
31
|
-
*
|
|
32
|
-
* @param {string} walletType - The type of the wallet (e.g., 'metamask', 'trust-wallet').
|
|
33
|
-
* @returns {string | InstallObjects} - A deep link string if available on mobile, or an install link object otherwise.
|
|
34
|
-
*/
|
|
35
|
-
function getWalletLink(walletType: string): string | InstallObjects {
|
|
36
|
-
const deepLink = getWalletDeepLink(walletType);
|
|
37
|
-
if (deepLink && isMobileScreen) {
|
|
38
|
-
return deepLink;
|
|
39
|
-
}
|
|
40
|
-
const wallet = getWalletInfo(walletType);
|
|
41
|
-
return wallet.installLink;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function checkHasDeepLink(walletType: string): boolean {
|
|
45
|
-
return !!getWalletDeepLink(walletType) && isMobileScreen;
|
|
46
|
-
}
|
|
47
|
-
return { getWalletDeepLink, getWalletLink, checkHasDeepLink };
|
|
48
|
-
}
|