@rango-dev/widget-embedded 0.1.16-next.18 → 0.1.16-next.19
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/Layout.d.ts.map +1 -1
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +24 -24
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +24 -24
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +25 -25
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Layout.tsx +7 -8
- package/src/components/RoutesOverview.tsx +2 -2
- package/src/components/TokenInfo.tsx +4 -4
- package/src/components/TokenPreview.tsx +3 -3
- package/src/components/warnings/BalanceErrors.tsx +2 -2
- package/src/components/warnings/MinRequiredSlippage.tsx +2 -2
- package/src/pages/ConfirmSwapPage.tsx +14 -12
- package/src/pages/SwapDetailsPage.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.1.16-next.
|
|
3
|
+
"version": "0.1.16-next.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@rango-dev/queue-manager-core": "^0.1.13-next.16",
|
|
29
29
|
"@rango-dev/queue-manager-rango-preset": "^0.1.13-next.16",
|
|
30
30
|
"@rango-dev/queue-manager-react": "^0.1.12-next.13",
|
|
31
|
-
"@rango-dev/ui": "^0.1.14-next.
|
|
31
|
+
"@rango-dev/ui": "^0.1.14-next.12",
|
|
32
32
|
"@rango-dev/wallets-core": "^0.1.14-next.15",
|
|
33
33
|
"@rango-dev/wallets-shared": "^0.1.13",
|
|
34
34
|
"bignumber.js": "^9.1.1",
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Typography,
|
|
5
5
|
styled,
|
|
6
6
|
Spinner,
|
|
7
|
+
Image,
|
|
7
8
|
} from '@rango-dev/ui';
|
|
8
9
|
import React, { useEffect } from 'react';
|
|
9
10
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -23,7 +24,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
23
24
|
import { useBestRouteStore } from '../store/bestRoute';
|
|
24
25
|
import { useMetaStore } from '../store/meta';
|
|
25
26
|
import { useSettingsStore } from '../store/settings';
|
|
26
|
-
import { Image } from '@rango-dev/ui';
|
|
27
27
|
|
|
28
28
|
const Header = styled('div', {
|
|
29
29
|
display: 'flex',
|
|
@@ -52,7 +52,7 @@ export function Layout({ config }: LayoutProps) {
|
|
|
52
52
|
const { getWalletInfo } = useWallets();
|
|
53
53
|
const connectedWalletsImages = removeDuplicateFrom(
|
|
54
54
|
getSelectableWallets(connectedWallets, selectedWallets, getWalletInfo).map(
|
|
55
|
-
|
|
55
|
+
w => w.image
|
|
56
56
|
)
|
|
57
57
|
);
|
|
58
58
|
const { blockchains, tokens } = useMetaStore.use.meta();
|
|
@@ -64,8 +64,7 @@ export function Layout({ config }: LayoutProps) {
|
|
|
64
64
|
const setAffiliateRef = useSettingsStore.use.setAffiliateRef();
|
|
65
65
|
|
|
66
66
|
const totalBalance = calculateWalletUsdValue(connectedWallets);
|
|
67
|
-
const connectWalletsButtonDisabled =
|
|
68
|
-
useUiStore.use.connectWalletsButtonDisabled();
|
|
67
|
+
const connectWalletsButtonDisabled = useUiStore.use.connectWalletsButtonDisabled();
|
|
69
68
|
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
70
69
|
const fetchingBalance = useWalletsStore(fetchingBalanceSelector);
|
|
71
70
|
|
|
@@ -73,9 +72,9 @@ export function Layout({ config }: LayoutProps) {
|
|
|
73
72
|
useEffect(() => {
|
|
74
73
|
if (loadingMetaStatus === 'success') {
|
|
75
74
|
const chain = blockchains.find(
|
|
76
|
-
|
|
75
|
+
chain => chain.name === config?.to?.blockchain
|
|
77
76
|
);
|
|
78
|
-
const token = tokens.find(
|
|
77
|
+
const token = tokens.find(t =>
|
|
79
78
|
tokensAreEqual(t, config?.to?.token || null)
|
|
80
79
|
);
|
|
81
80
|
setToChain(chain || null);
|
|
@@ -90,9 +89,9 @@ export function Layout({ config }: LayoutProps) {
|
|
|
90
89
|
useEffect(() => {
|
|
91
90
|
if (loadingMetaStatus === 'success') {
|
|
92
91
|
const chain = blockchains.find(
|
|
93
|
-
|
|
92
|
+
chain => chain.name === config?.from?.blockchain
|
|
94
93
|
);
|
|
95
|
-
const token = tokens.find(
|
|
94
|
+
const token = tokens.find(t =>
|
|
96
95
|
tokensAreEqual(t, config?.from?.token || null)
|
|
97
96
|
);
|
|
98
97
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { styled, ChevronRightIcon, GasIcon,
|
|
2
|
+
import { styled, ChevronRightIcon, GasIcon, Divider } from '@rango-dev/ui';
|
|
3
3
|
import { BestRouteResponse } from 'rango-sdk';
|
|
4
4
|
|
|
5
5
|
export const Container = styled('div', {
|
|
@@ -47,7 +47,7 @@ function RoutesOverview(props: PropTypes) {
|
|
|
47
47
|
{props.totalFee ? (
|
|
48
48
|
<div className="fee">
|
|
49
49
|
<GasIcon size={12} />
|
|
50
|
-
<
|
|
50
|
+
<Divider size={4} direction="horizontal" />${props.totalFee}
|
|
51
51
|
</div>
|
|
52
52
|
) : null}
|
|
53
53
|
</Container>
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TextField,
|
|
8
8
|
Typography,
|
|
9
9
|
Image,
|
|
10
|
-
|
|
10
|
+
Divider,
|
|
11
11
|
} from '@rango-dev/ui';
|
|
12
12
|
import { useMetaStore } from '../store/meta';
|
|
13
13
|
import { BlockchainMeta, Token } from 'rango-sdk';
|
|
@@ -201,7 +201,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
201
201
|
<Typography variant="body3" color="neutral600">{`${t(
|
|
202
202
|
'Balance'
|
|
203
203
|
)}: ${tokenBalance} ${fromToken?.symbol || ''}`}</Typography>
|
|
204
|
-
<
|
|
204
|
+
<Divider size={4} />
|
|
205
205
|
<Button type="primary" variant="ghost" size="compact">
|
|
206
206
|
{t('Max')}
|
|
207
207
|
</Button>
|
|
@@ -246,7 +246,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
246
246
|
? chain.displayName
|
|
247
247
|
: t('Chain')}
|
|
248
248
|
</Button>
|
|
249
|
-
<
|
|
249
|
+
<Divider size={12} direction="horizontal" />
|
|
250
250
|
<Button
|
|
251
251
|
className="selectors"
|
|
252
252
|
onClick={() => {
|
|
@@ -272,7 +272,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
272
272
|
>
|
|
273
273
|
{loadingStatus === 'success' && token ? token.symbol : t('Token')}
|
|
274
274
|
</Button>
|
|
275
|
-
<
|
|
275
|
+
<Divider size={12} direction="horizontal" />
|
|
276
276
|
<div className="amount">
|
|
277
277
|
{props.type === 'From' ? (
|
|
278
278
|
<TextField
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
InfoCircleIcon,
|
|
5
5
|
styled,
|
|
6
6
|
Typography,
|
|
7
|
-
|
|
7
|
+
Divider,
|
|
8
8
|
Image,
|
|
9
9
|
} from '@rango-dev/ui';
|
|
10
10
|
import { LoadingStatus } from '../store/meta';
|
|
@@ -157,7 +157,7 @@ export function TokenPreview(props: PropTypes) {
|
|
|
157
157
|
? chain.displayName
|
|
158
158
|
: t('Chain')}
|
|
159
159
|
</Button>
|
|
160
|
-
<
|
|
160
|
+
<Divider size={12} direction="horizontal" />
|
|
161
161
|
<Button
|
|
162
162
|
className="selectors"
|
|
163
163
|
variant="outlined"
|
|
@@ -175,7 +175,7 @@ export function TokenPreview(props: PropTypes) {
|
|
|
175
175
|
>
|
|
176
176
|
{loadingStatus === 'success' && token ? token.symbol : t('Token')}
|
|
177
177
|
</Button>
|
|
178
|
-
<
|
|
178
|
+
<Divider size={12} direction="horizontal" />
|
|
179
179
|
<div className="amount">
|
|
180
180
|
<OutputContainer>
|
|
181
181
|
<Typography variant="h4">{props.amount}</Typography>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Divider, styled, Typography } from '@rango-dev/ui';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
interface PropTypes {
|
|
@@ -34,7 +34,7 @@ export function BalanceErrors({ messages }: PropTypes) {
|
|
|
34
34
|
<Typography className="title" variant="title" color={'error'}>
|
|
35
35
|
Insufficent Balance:
|
|
36
36
|
</Typography>
|
|
37
|
-
<
|
|
37
|
+
<Divider size={8} />
|
|
38
38
|
<List showListStyle={showListStyle}>
|
|
39
39
|
{messages.map((warning, index) => (
|
|
40
40
|
<ListItem showListStyle={showListStyle} key={index}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Divider, Typography, styled } from '@rango-dev/ui';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeSlippageButton } from '../ChangeSlippageButton';
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ export function MinRequiredSlippage({ minRequiredSlippage }: PropTypes) {
|
|
|
16
16
|
We recommend you to increase slippage to at least
|
|
17
17
|
{minRequiredSlippage}
|
|
18
18
|
for this route.
|
|
19
|
-
<
|
|
19
|
+
<Divider size={8}/>
|
|
20
20
|
<ChangeSlippageButton />
|
|
21
21
|
</StyledMessage>
|
|
22
22
|
);
|
|
@@ -18,7 +18,7 @@ import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
|
18
18
|
import { TokenPreview } from '../components/TokenPreview';
|
|
19
19
|
// @ts-ignore // TODO: fix error in tsc build
|
|
20
20
|
import { t } from 'i18next';
|
|
21
|
-
import {
|
|
21
|
+
import { Divider, ConfirmSwap, LoadingFailedAlert } from '@rango-dev/ui';
|
|
22
22
|
import RoutesOverview from '../components/RoutesOverview';
|
|
23
23
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
24
24
|
import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
@@ -66,14 +66,14 @@ export function ConfirmSwapPage() {
|
|
|
66
66
|
const selectedSlippage = customSlippage || slippage;
|
|
67
67
|
|
|
68
68
|
const showHighSlippageWarning = !errors.find(
|
|
69
|
-
|
|
69
|
+
error => error.type === ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
const { getWalletInfo, connect } = useWallets();
|
|
73
73
|
const confirmDisabled =
|
|
74
74
|
fetchingBestRoute ||
|
|
75
|
-
!requiredWallets(bestRoute).every(
|
|
76
|
-
selectedWallets.map(
|
|
75
|
+
!requiredWallets(bestRoute).every(chain =>
|
|
76
|
+
selectedWallets.map(wallet => wallet.chain).includes(chain)
|
|
77
77
|
);
|
|
78
78
|
|
|
79
79
|
const firstStep = bestRoute?.result?.swaps[0];
|
|
@@ -94,8 +94,10 @@ export function ConfirmSwapPage() {
|
|
|
94
94
|
|
|
95
95
|
const handleConnectChain = (wallet: string) => {
|
|
96
96
|
const network = wallet as Network;
|
|
97
|
-
getKeplrCompatibleConnectedWallets(
|
|
98
|
-
|
|
97
|
+
getKeplrCompatibleConnectedWallets(
|
|
98
|
+
selectableWallets
|
|
99
|
+
).forEach((compatibleWallet: WalletType) =>
|
|
100
|
+
connect?.(compatibleWallet, network)
|
|
99
101
|
);
|
|
100
102
|
};
|
|
101
103
|
|
|
@@ -107,7 +109,7 @@ export function ConfirmSwapPage() {
|
|
|
107
109
|
selectableWallets={selectableWallets}
|
|
108
110
|
onBack={navigateBackFrom.bind(null, navigationRoutes.confirmSwap)}
|
|
109
111
|
onConfirm={async () => {
|
|
110
|
-
confirmSwap?.().then(async
|
|
112
|
+
confirmSwap?.().then(async swap => {
|
|
111
113
|
if (swap) {
|
|
112
114
|
try {
|
|
113
115
|
await manager?.create(
|
|
@@ -128,10 +130,10 @@ export function ConfirmSwapPage() {
|
|
|
128
130
|
}
|
|
129
131
|
});
|
|
130
132
|
}}
|
|
131
|
-
onChange={
|
|
133
|
+
onChange={wallet => setSelectedWallet(wallet)}
|
|
132
134
|
confirmDisabled={loadingMetaStatus !== 'success' || confirmDisabled}
|
|
133
|
-
handleConnectChain={
|
|
134
|
-
isExperimentalChain={
|
|
135
|
+
handleConnectChain={wallet => handleConnectChain(wallet)}
|
|
136
|
+
isExperimentalChain={wallet =>
|
|
135
137
|
getKeplrCompatibleConnectedWallets(selectableWallets).length > 0
|
|
136
138
|
? isExperimentalChain(blockchains, wallet)
|
|
137
139
|
: false
|
|
@@ -156,7 +158,7 @@ export function ConfirmSwapPage() {
|
|
|
156
158
|
: bestRouteloadingStatus
|
|
157
159
|
}
|
|
158
160
|
/>
|
|
159
|
-
<
|
|
161
|
+
<Divider size={12} />
|
|
160
162
|
<TokenPreview
|
|
161
163
|
chain={{
|
|
162
164
|
displayName: lastStep?.to.blockchain || '',
|
|
@@ -200,7 +202,7 @@ export function ConfirmSwapPage() {
|
|
|
200
202
|
<>
|
|
201
203
|
{loadingMetaStatus === 'failed' && <LoadingFailedAlert />}
|
|
202
204
|
{loadingMetaStatus === 'failed' && showHighSlippageWarning && (
|
|
203
|
-
<
|
|
205
|
+
<Divider />
|
|
204
206
|
)}
|
|
205
207
|
{showHighSlippageWarning && (
|
|
206
208
|
<ConfirmSwapExtraMessages selectedSlippage={selectedSlippage} />
|