@rango-dev/widget-embedded 0.5.0 → 0.5.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/dist/Widget.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +9 -10
- package/src/QueueManager.tsx +1 -1
- package/src/Widget.tsx +2 -4
- package/src/components/AppRouter.tsx +1 -1
- package/src/components/BottomLogo.tsx +1 -1
- package/src/pages/ConfirmSwapPage.tsx +3 -4
- package/src/utils/wallets.ts +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":";AAoCA,wBAAgB,eAAe,CAAC,EAC9B,wBAAwB,GACzB,EAAE;IACD,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,eA8MA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/utils/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACP,WAAW,EACX,UAAU,EAEV,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/utils/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACP,WAAW,EACX,UAAU,EAEV,UAAU,EACV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,UAAU,IAAI,eAAe,EAC7B,WAAW,IAAI,YAAY,EAC3B,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB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B,GAAG,IAAI,GAClC,gBAAgB,CAQlB;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,eAAe,EAAE,GACzB,eAAe,EAAE,CAcnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@rango-dev/provider-all": "^0.5.0",
|
|
21
|
-
"@rango-dev/queue-manager-core": "^0.
|
|
22
|
-
"@rango-dev/queue-manager-rango-preset": "^0.5.0",
|
|
23
|
-
"@rango-dev/queue-manager-react": "^0.5.0",
|
|
24
|
-
"@rango-dev/ui": "^0.5.
|
|
25
|
-
"@rango-dev/wallets-core": "^0.
|
|
26
|
-
"@rango-dev/wallets-shared": "^0.5.0",
|
|
20
|
+
"@rango-dev/provider-all": "^0.5.1-next.0",
|
|
21
|
+
"@rango-dev/queue-manager-core": "^0.5.1-next.0",
|
|
22
|
+
"@rango-dev/queue-manager-rango-preset": "^0.5.1-next.0",
|
|
23
|
+
"@rango-dev/queue-manager-react": "^0.5.1-next.0",
|
|
24
|
+
"@rango-dev/ui": "^0.5.1-next.1",
|
|
25
|
+
"@rango-dev/wallets-core": "^0.5.1-next.1",
|
|
26
|
+
"@rango-dev/wallets-shared": "^0.5.1-next.0",
|
|
27
27
|
"bignumber.js": "^9.1.1",
|
|
28
28
|
"copy-to-clipboard": "^3.3.3",
|
|
29
29
|
"dayjs": "^1.11.7",
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"i18next-http-backend": "^2.1.1",
|
|
33
33
|
"immer": "^9.0.19",
|
|
34
34
|
"mitt": "^3.0.0",
|
|
35
|
-
"parcel": "^2.8.0",
|
|
36
35
|
"rango-sdk": "^0.1.30",
|
|
37
|
-
"rango-types": "^0.1.
|
|
36
|
+
"rango-types": "^0.1.39",
|
|
38
37
|
"react-i18next": "^12.2.0",
|
|
39
38
|
"react-router-dom": "^6.8.0",
|
|
40
39
|
"values.js": "2.1.1",
|
package/src/QueueManager.tsx
CHANGED
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
import { useMetaStore } from './store/meta';
|
|
16
16
|
import { useWalletsStore } from './store/wallets';
|
|
17
17
|
import { walletAndSupportedChainsNames } from './utils/wallets';
|
|
18
|
-
import { isEvmBlockchain } from 'rango-sdk';
|
|
19
18
|
import { getConfig } from './utils/configs';
|
|
19
|
+
import { isEvmBlockchain } from 'rango-types';
|
|
20
20
|
|
|
21
21
|
function QueueManager(props: PropsWithChildren) {
|
|
22
22
|
const {
|
package/src/Widget.tsx
CHANGED
|
@@ -109,8 +109,7 @@ export const Widget: React.FC<WidgetProps> = ({ config }) => {
|
|
|
109
109
|
<Provider
|
|
110
110
|
allBlockChains={blockchains}
|
|
111
111
|
providers={providers}
|
|
112
|
-
onUpdateState={onUpdateState}
|
|
113
|
-
>
|
|
112
|
+
onUpdateState={onUpdateState}>
|
|
114
113
|
<div id="swap-container" className={activeTheme}>
|
|
115
114
|
<QueueManager>
|
|
116
115
|
<SwapContainer fixedHeight={currentPage !== navigationRoutes.home}>
|
|
@@ -119,8 +118,7 @@ export const Widget: React.FC<WidgetProps> = ({ config }) => {
|
|
|
119
118
|
disconnectedWallet={disconnectedWallet}
|
|
120
119
|
clearDisconnectedWallet={() => {
|
|
121
120
|
setDisconnectedWallet(undefined);
|
|
122
|
-
}}
|
|
123
|
-
>
|
|
121
|
+
}}>
|
|
124
122
|
<Layout config={config} />
|
|
125
123
|
</AppRouter>
|
|
126
124
|
</SwapContainer>
|
|
@@ -2,10 +2,10 @@ import React, { Fragment, PropsWithChildren } from 'react';
|
|
|
2
2
|
import { MemoryRouter, useInRouterContext } from 'react-router';
|
|
3
3
|
import { useQueueManager } from '@rango-dev/queue-manager-rango-preset';
|
|
4
4
|
import { WalletType } from '@rango-dev/wallets-shared';
|
|
5
|
-
import { isEvmBlockchain } from 'rango-types';
|
|
6
5
|
import { UpdateUrl } from './UpdateUrl';
|
|
7
6
|
import { useMetaStore } from '../store/meta';
|
|
8
7
|
import { useWallets } from '@rango-dev/wallets-core';
|
|
8
|
+
import { isEvmBlockchain } from 'rango-types';
|
|
9
9
|
|
|
10
10
|
export function AppRouter({
|
|
11
11
|
children,
|
|
@@ -17,10 +17,9 @@ import {
|
|
|
17
17
|
} from '../utils/swap';
|
|
18
18
|
import { numberToString } from '../utils/numbers';
|
|
19
19
|
import { useMetaStore } from '../store/meta';
|
|
20
|
-
import {
|
|
20
|
+
import { WalletType } from '@rango-dev/wallets-shared';
|
|
21
21
|
import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
22
22
|
import { TokenPreview } from '../components/TokenPreview';
|
|
23
|
-
// @ts-ignore // TODO: fix error in tsc build
|
|
24
23
|
import { t } from 'i18next';
|
|
25
24
|
import { Divider, ConfirmSwap, LoadingFailedAlert } from '@rango-dev/ui';
|
|
26
25
|
import RoutesOverview from '../components/RoutesOverview';
|
|
@@ -90,7 +89,7 @@ export function ConfirmSwapPage({
|
|
|
90
89
|
const toAmount = numberToString(lastStep?.toAmount, 4, 6);
|
|
91
90
|
useEffect(() => {
|
|
92
91
|
initSelectedWallets();
|
|
93
|
-
if (
|
|
92
|
+
if (customDestination) {
|
|
94
93
|
setCustomDestination('');
|
|
95
94
|
}
|
|
96
95
|
}, []);
|
|
@@ -108,7 +107,7 @@ export function ConfirmSwapPage({
|
|
|
108
107
|
);
|
|
109
108
|
|
|
110
109
|
const handleConnectChain = (wallet: string) => {
|
|
111
|
-
const network = wallet
|
|
110
|
+
const network = wallet;
|
|
112
111
|
getKeplrCompatibleConnectedWallets(selectableWallets).forEach(
|
|
113
112
|
(compatibleWallet: WalletType) => connect?.(compatibleWallet, network)
|
|
114
113
|
);
|
package/src/utils/wallets.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
detectInstallLink,
|
|
9
9
|
WalletInfo,
|
|
10
10
|
WalletTypes,
|
|
11
|
+
Networks,
|
|
11
12
|
} from '@rango-dev/wallets-shared';
|
|
12
13
|
|
|
13
14
|
import {
|
|
@@ -77,7 +78,7 @@ export function walletAndSupportedChainsNames(
|
|
|
77
78
|
if (!supportedChains) return null;
|
|
78
79
|
let walletAndSupportedChainsNames: Network[] = [];
|
|
79
80
|
walletAndSupportedChainsNames = supportedChains.map(
|
|
80
|
-
(blockchainMeta) => blockchainMeta.name
|
|
81
|
+
(blockchainMeta) => blockchainMeta.name
|
|
81
82
|
);
|
|
82
83
|
|
|
83
84
|
return walletAndSupportedChainsNames;
|
|
@@ -108,7 +109,7 @@ export function prepareAccountsForWalletStore(
|
|
|
108
109
|
|
|
109
110
|
const hasLimitation = supportedChains.length > 0;
|
|
110
111
|
const isSupported = supportedChains.includes(network);
|
|
111
|
-
const isUnknown = network ===
|
|
112
|
+
const isUnknown = network === Networks.Unknown;
|
|
112
113
|
const notSupportedNetworkByWallet =
|
|
113
114
|
hasLimitation && !isSupported && !isUnknown;
|
|
114
115
|
|
|
@@ -121,7 +122,7 @@ export function prepareAccountsForWalletStore(
|
|
|
121
122
|
// Example: showing our evm compatible netwrok when the uknown network is evem.
|
|
122
123
|
// Otherwise, we stop executing this function.
|
|
123
124
|
const isUknownAndEvmBased =
|
|
124
|
-
network ===
|
|
125
|
+
network === Networks.Unknown && isEvmAddress(address);
|
|
125
126
|
if (isUnknown && !isUknownAndEvmBased) return;
|
|
126
127
|
|
|
127
128
|
const isEvmBasedChain = evmBasedChains.includes(network);
|
|
@@ -172,7 +173,7 @@ export function getSelectableWallets(
|
|
|
172
173
|
destinationChain?: string
|
|
173
174
|
): SelectableWallet[] {
|
|
174
175
|
const selectableWallets = connectedWallets.map(
|
|
175
|
-
(connectedWallet: ConnectedWallet) => {
|
|
176
|
+
(connectedWallet: ConnectedWallet) => {
|
|
176
177
|
return {
|
|
177
178
|
address: connectedWallet.address,
|
|
178
179
|
walletType: connectedWallet.walletType,
|
|
@@ -325,13 +326,13 @@ export const calculateWalletUsdValue = (connectedWallet: ConnectedWallet[]) => {
|
|
|
325
326
|
};
|
|
326
327
|
|
|
327
328
|
function numberWithThousandSeperator(number: string | number): string {
|
|
328
|
-
|
|
329
|
+
const parts = number.toString().split('.');
|
|
329
330
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
330
331
|
return parts.join('.');
|
|
331
332
|
}
|
|
332
333
|
|
|
333
334
|
export const sortTokens = (tokens: TokenWithBalance[]): TokenWithBalance[] => {
|
|
334
|
-
|
|
335
|
+
const walletConnected = !!tokens.some((token) => token.balance);
|
|
335
336
|
if (!walletConnected) {
|
|
336
337
|
return tokens
|
|
337
338
|
.filter((token) => !token.address)
|