@rango-dev/ui 0.1.10-next.89 → 0.1.10-next.90

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.1.10-next.89",
3
+ "version": "0.1.10-next.90",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -7,7 +7,7 @@ import { TokenWithAmount } from '../TokenList/TokenList';
7
7
  export interface PropTypes {
8
8
  list: TokenWithAmount[];
9
9
  type?: 'Source' | 'Destination';
10
- selected?: TokenWithAmount;
10
+ selected: TokenWithAmount | null;
11
11
  onChange: (token: TokenWithAmount) => void;
12
12
  hasHeader?: boolean;
13
13
  multiSelect?: boolean;
@@ -1,5 +1,5 @@
1
- import { BestRouteResponse } from 'rango-sdk';
2
1
  import React, { Fragment, PropsWithChildren, ReactNode } from 'react';
2
+ import { Spacer } from '../../components';
3
3
  import { Alert } from '../../components/Alert';
4
4
  import { Button } from '../../components/Button';
5
5
  import { RetryIcon, GasIcon } from '../../components/Icon';
@@ -7,6 +7,7 @@ import { SecondaryPage } from '../../components/SecondaryPage/';
7
7
  import { StepDetail } from '../../components/StepDetail';
8
8
  import { Typography } from '../../components/Typography';
9
9
  import { styled } from '../../theme';
10
+ import { BestRouteWithFee } from '../../types/swaps';
10
11
 
11
12
  const MainContainer = styled('div', {
12
13
  overflow: 'hidden',
@@ -77,9 +78,8 @@ const BestRouteContainer = styled('div', {
77
78
  });
78
79
 
79
80
  const Alerts = styled('div', { paddingBottom: '$16' });
80
-
81
81
  export interface PropTypes {
82
- bestRoute: BestRouteResponse | null;
82
+ bestRoute: BestRouteWithFee | null;
83
83
  onRefresh?: React.MouseEventHandler<SVGElement>;
84
84
  confirmButtonTitle: string;
85
85
  confirmButtonDisabled: boolean;
@@ -130,15 +130,20 @@ export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
130
130
  {extraMessages || null}
131
131
  <Alerts>
132
132
  {errors?.map((error, index) => (
133
- <Alert type="error" key={index}>
134
- {error}
135
- </Alert>
133
+ <>
134
+ <Spacer direction="vertical" />
135
+ <Alert type="error" key={index}>
136
+ {error}
137
+ </Alert>
138
+ </>
136
139
  ))}
137
- {/* {error && warnings && <Spacer direction="vertical" size={16} />} */}
138
140
  {warnings?.map((warning, index) => (
139
- <Alert type="warning" key={index}>
140
- {warning}
141
- </Alert>
141
+ <>
142
+ <Spacer direction="vertical" />
143
+ <Alert type="warning" key={index}>
144
+ {warning}
145
+ </Alert>
146
+ </>
142
147
  ))}
143
148
  </Alerts>
144
149
  </div>
@@ -168,8 +173,7 @@ export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
168
173
  <Fee>
169
174
  <GasIcon />
170
175
  <Typography ml={4} variant="caption">
171
- {parseFloat(swap.fee[0].amount).toFixed(6)} estimated gas
172
- fee
176
+ ${swap.feeInUsd} estimated gas fee
173
177
  </Typography>
174
178
  </Fee>
175
179
  </div>
@@ -22,7 +22,7 @@ const ConfirmButton = styled(Button, {
22
22
  });
23
23
 
24
24
  export interface PropTypes {
25
- swap: BestRouteResponse;
25
+ swap: BestRouteResponse | null;
26
26
  fromAmount: string;
27
27
  toAmount: string;
28
28
  onBack: () => void;
@@ -51,8 +51,8 @@ export function ConfirmWallets(props: PropsWithChildren<PropTypes>) {
51
51
  toAmount,
52
52
  } = props;
53
53
 
54
- const firstStep = swap.result?.swaps[0];
55
- const lastStep = swap.result?.swaps[swap.result?.swaps.length - 1];
54
+ const firstStep = swap?.result?.swaps[0];
55
+ const lastStep = swap?.result?.swaps[swap.result?.swaps.length - 1];
56
56
 
57
57
  return (
58
58
  <SecondaryPage
@@ -161,7 +161,7 @@ export function SwapHistory(props: PropTypes) {
161
161
  <Fee>
162
162
  <GasIcon />
163
163
  <Typography ml={4} variant="caption">
164
- {step.feeInUsd} estimated gas fee
164
+ ${step.feeInUsd} estimated gas fee
165
165
  </Typography>
166
166
  </Fee>
167
167
  </div>
@@ -1 +1,3 @@
1
1
  export * from './wallet';
2
+
3
+ export { BestRouteWithFee } from './swaps';
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  BestRouteResponse,
3
3
  BlockchainValidationStatus,
4
+ SimulationResult,
5
+ SwapResult,
4
6
  WalletRequiredAssets,
5
7
  } from 'rango-sdk';
6
8
  export type SwapStatus = 'running' | 'failed' | 'success';
@@ -34,3 +36,9 @@ export type SwapSavedSettings = {
34
36
  export type SimulationAssetAndAmount = WalletRequiredAssets;
35
37
  export type SimulationValidationStatus = BlockchainValidationStatus;
36
38
  export type BestRouteType = BestRouteResponse;
39
+
40
+ export type BestRouteWithFee = Omit<BestRouteResponse, 'result'> & {
41
+ result: Omit<SimulationResult, 'swaps'> & {
42
+ swaps: (SwapResult & { feeInUsd?: string })[];
43
+ };
44
+ };
@@ -17,6 +17,7 @@ export type WalletInfo = {
17
17
  name: string;
18
18
  image: string;
19
19
  type: WalletType;
20
+ showOnMobile: boolean;
20
21
  };
21
22
 
22
23
  export interface SelectableWallet {