@rango-dev/widget-embedded 0.1.16-next.17 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.1.16-next.17",
3
+ "version": "0.1.16-next.19",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -24,12 +24,12 @@
24
24
  "trailingComma": "es5"
25
25
  },
26
26
  "dependencies": {
27
- "@rango-dev/provider-all": "^0.1.14-next.15",
28
- "@rango-dev/queue-manager-core": "^0.1.13",
29
- "@rango-dev/queue-manager-rango-preset": "^0.1.13",
30
- "@rango-dev/queue-manager-react": "^0.1.12",
31
- "@rango-dev/ui": "^0.1.14",
32
- "@rango-dev/wallets-core": "^0.1.13",
27
+ "@rango-dev/provider-all": "^0.1.21",
28
+ "@rango-dev/queue-manager-core": "^0.1.13-next.16",
29
+ "@rango-dev/queue-manager-rango-preset": "^0.1.13-next.16",
30
+ "@rango-dev/queue-manager-react": "^0.1.12-next.13",
31
+ "@rango-dev/ui": "^0.1.14-next.12",
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",
35
35
  "copy-to-clipboard": "^3.3.3",
@@ -42,13 +42,15 @@
42
42
  "parcel": "^2.8.0",
43
43
  "rango-sdk": "^0.1.27",
44
44
  "rango-types": "^0.1.32",
45
- "react": "^18.2.0",
46
- "react-dom": "^18.2.0",
47
45
  "react-i18next": "^12.2.0",
48
46
  "react-router-dom": "^6.8.0",
49
47
  "values.js": "2.1.1",
50
48
  "zustand": "^4.3.2"
51
49
  },
50
+ "peerDependencies": {
51
+ "react": ">=16",
52
+ "react-dom": ">=16"
53
+ },
52
54
  "publishConfig": {
53
55
  "access": "public"
54
56
  }
@@ -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
- (w) => w.image
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
- (chain) => chain.name === config?.to?.blockchain
75
+ chain => chain.name === config?.to?.blockchain
77
76
  );
78
- const token = tokens.find((t) =>
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
- (chain) => chain.name === config?.from?.blockchain
92
+ chain => chain.name === config?.from?.blockchain
94
93
  );
95
- const token = tokens.find((t) =>
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, Spacer } from '@rango-dev/ui';
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
- <Spacer size={4} />${props.totalFee}
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
- Spacer,
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
- <Spacer size={4} />
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
- <Spacer size={12} />
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
- <Spacer size={12} />
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
- Spacer,
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
- <Spacer size={12} />
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
- <Spacer size={12} />
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 { Spacer, styled, Typography } from '@rango-dev/ui';
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
- <Spacer size={8} direction="vertical" />
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 { Spacer, Typography, styled } from '@rango-dev/ui';
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 &nbsp;
17
17
  {minRequiredSlippage}
18
18
  &nbsp; for this route.
19
- <Spacer size={8} direction="vertical" />
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 { Spacer, ConfirmSwap, LoadingFailedAlert } from '@rango-dev/ui';
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
- (error) => error.type === ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE
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((chain) =>
76
- selectedWallets.map((wallet) => wallet.chain).includes(chain)
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(selectableWallets).forEach(
98
- (compatibleWallet: WalletType) => connect?.(compatibleWallet, network)
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 (swap) => {
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={(wallet) => setSelectedWallet(wallet)}
133
+ onChange={wallet => setSelectedWallet(wallet)}
132
134
  confirmDisabled={loadingMetaStatus !== 'success' || confirmDisabled}
133
- handleConnectChain={(wallet) => handleConnectChain(wallet)}
134
- isExperimentalChain={(wallet) =>
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
- <Spacer size={12} direction="vertical" />
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
- <Spacer direction="vertical" />
205
+ <Divider />
204
206
  )}
205
207
  {showHighSlippageWarning && (
206
208
  <ConfirmSwapExtraMessages selectedSlippage={selectedSlippage} />
@@ -109,7 +109,7 @@ export function SwapDetailsPage() {
109
109
  label={t('From')}
110
110
  loadingStatus={'success'}
111
111
  />
112
- <Spacer size={12} direction="vertical" />
112
+ <Divider size={12} />
113
113
  <TokenPreview
114
114
  chain={{
115
115
  displayName: lastStep?.toBlockchain || '',