@rango-dev/widget-embedded 0.24.1 → 0.24.2-next.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA4BnD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,wBAAgB,IAAI,sBAyMnB"}
1
+ {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA4BnD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,wBAAgB,IAAI,sBAyMnB"}
@@ -1,6 +1,6 @@
1
1
  import type { BestRouteResponse } from 'rango-sdk';
2
2
  import { BigNumber } from 'bignumber.js';
3
- export declare const secondsToString: (s: number) => string;
3
+ export declare const roundedSecondsToString: (s: number) => string;
4
4
  export declare const numberToString: (number: BigNumber | string | number | null | undefined, minDecimals?: number | null, maxDecimals?: number | null) => string;
5
5
  export declare const uint8ArrayToHex: (buffer: Uint8Array) => string;
6
6
  export declare const totalArrivalTime: (data: {
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/utils/numbers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,eAAO,MAAM,eAAe,MAAO,MAAM,KAAG,MAM3C,CAAC;AAEF,eAAO,MAAM,cAAc,WACjB,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,gBACzC,MAAM,GAAG,IAAI,gBACb,MAAM,GAAG,IAAI,KACzB,MA2EF,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,UAAU,KAA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D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.24.1",
3
+ "version": "0.24.2-next.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -26,7 +26,7 @@
26
26
  "@rango-dev/queue-manager-core": "^0.26.0",
27
27
  "@rango-dev/queue-manager-rango-preset": "^0.29.1",
28
28
  "@rango-dev/queue-manager-react": "^0.26.0",
29
- "@rango-dev/ui": "^0.30.0",
29
+ "@rango-dev/ui": "^0.30.1-next.0",
30
30
  "@rango-dev/wallets-react": "^0.15.0",
31
31
  "@rango-dev/wallets-shared": "^0.29.0",
32
32
  "bignumber.js": "^9.1.1",
@@ -42,7 +42,7 @@ import {
42
42
  import {
43
43
  formatTooltipNumbers,
44
44
  numberToString,
45
- secondsToString,
45
+ roundedSecondsToString,
46
46
  totalArrivalTime,
47
47
  } from '../../utils/numbers';
48
48
  import {
@@ -292,7 +292,7 @@ export function Quote(props: QuoteProps) {
292
292
  const container = getContainer();
293
293
  const sortedQuoteTags = sortTags(props.quote.tags || []);
294
294
  const showAllRoutesButton = !!onClickAllRoutes;
295
- const totalTime = secondsToString(totalArrivalTime(quote?.swaps));
295
+ const totalTime = roundedSecondsToString(totalArrivalTime(quote?.swaps));
296
296
  const totalFee = getTotalFeeInUsd(quote?.swaps ?? [], tokens);
297
297
  const fee = numberToString(
298
298
  totalFee,
@@ -43,7 +43,7 @@ import { getContainer } from '../../utils/common';
43
43
  import {
44
44
  formatTooltipNumbers,
45
45
  numberToString,
46
- secondsToString,
46
+ roundedSecondsToString,
47
47
  totalArrivalTime,
48
48
  } from '../../utils/numbers';
49
49
  import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
@@ -320,7 +320,7 @@ export function SwapDetails(props: SwapDetailsProps) {
320
320
  GAS_FEE_MIN_DECIMALS,
321
321
  GAS_FEE_MAX_DECIMALS
322
322
  )}
323
- time={secondsToString(totalArrivalTime(swap.steps))}
323
+ time={roundedSecondsToString(totalArrivalTime(swap.steps))}
324
324
  steps={numberOfSteps}
325
325
  />
326
326
  <QuoteSummary
@@ -107,9 +107,7 @@ export function Inputs(props: PropTypes) {
107
107
  loadingBalance={fetchingBalance}
108
108
  tooltipContainer={getContainer()}
109
109
  onSelectMaxBalance={() => {
110
- if (fromTokenFormattedBalance !== '0') {
111
- setInputAmount(tokenBalanceReal.split(',').join(''));
112
- }
110
+ setInputAmount(tokenBalanceReal.split(',').join(''));
113
111
  }}
114
112
  />
115
113
  <SwitchFromAndToButton />
@@ -150,7 +150,7 @@ export function SettingsLists() {
150
150
  id: 'bridge-item',
151
151
  title: (
152
152
  <Typography variant="title" size="xmedium">
153
- {i18n.t('Enabled bridges')}
153
+ {i18n.t('Bridges')}
154
154
  </Typography>
155
155
  ),
156
156
  end: (
@@ -168,7 +168,7 @@ export function SettingsLists() {
168
168
  id: 'exchange-item',
169
169
  title: (
170
170
  <Typography variant="title" size="xmedium">
171
- {i18n.t('Enabled exchanges')}
171
+ {i18n.t('Exchanges')}
172
172
  </Typography>
173
173
  ),
174
174
  end: (
@@ -2,6 +2,7 @@ import type { SelectedQuote } from '../types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
  import { Button, Divider, styled, WarningIcon } from '@rango-dev/ui';
5
+ import BigNumber from 'bignumber.js';
5
6
  import React, { useEffect, useState } from 'react';
6
7
  import { useNavigate } from 'react-router-dom';
7
8
 
@@ -27,7 +28,7 @@ const MainContainer = styled('div', {
27
28
  alignItems: 'flex-start',
28
29
  maxHeight: 700,
29
30
  '& .footer__alert': {
30
- paddingTop: '0',
31
+ paddingTop: '0 !important',
31
32
  },
32
33
  });
33
34
  export const TIME_TO_NAVIGATE_ANOTHER_PAGE = 300;
@@ -81,7 +82,7 @@ export function Home() {
81
82
  !!inputAmount &&
82
83
  !!fromToken &&
83
84
  !!toToken &&
84
- inputAmount !== '0' &&
85
+ new BigNumber(inputAmount).gt(0) &&
85
86
  !isTokensIdentical(fromToken, toToken);
86
87
 
87
88
  const fetchingQuote = hasInputs && fetchMetaStatus === 'success' && loading;
@@ -155,12 +155,22 @@ export const createDataSlice: StateCreator<
155
155
  }
156
156
  }
157
157
 
158
- //3. sort by token popularity
158
+ const blockChainA = blockchainsMapByName.get(tokenA.blockchain);
159
+ const blockChainB = blockchainsMapByName.get(tokenB.blockchain);
160
+
161
+ //3. sort by native token
162
+ const isNativeTokenA = isTokenNative(tokenA, blockChainA);
163
+ const isNativeTokenB = isTokenNative(tokenB, blockChainB);
164
+ if (isNativeTokenA !== isNativeTokenB) {
165
+ return isNativeTokenA ? -1 : 1;
166
+ }
167
+
168
+ //4. sort by token popularity
159
169
  if (tokenA.isPopular !== tokenB.isPopular) {
160
170
  return tokenA.isPopular ? -1 : 1;
161
171
  }
162
172
 
163
- //4. sort by search phrase
173
+ //5. sort by search phrase
164
174
  if (options.searchFor) {
165
175
  const symbolSearchForCompare = compareWithSearchFor(
166
176
  tokenA,
@@ -172,16 +182,6 @@ export const createDataSlice: StateCreator<
172
182
  }
173
183
  }
174
184
 
175
- const blockChainA = blockchainsMapByName.get(tokenA.blockchain);
176
- const blockChainB = blockchainsMapByName.get(tokenB.blockchain);
177
-
178
- //5. sort by native token
179
- const isNativeTokenA = isTokenNative(tokenA, blockChainA);
180
- const isNativeTokenB = isTokenNative(tokenB, blockChainB);
181
- if (isNativeTokenA !== isNativeTokenB) {
182
- return isNativeTokenA ? -1 : 1;
183
- }
184
-
185
185
  //6. sort by token isSecondary
186
186
  if (tokenA.isSecondaryCoin !== tokenB.isSecondaryCoin) {
187
187
  return tokenA.isSecondaryCoin ? 1 : -1;
@@ -6,12 +6,19 @@ import { BigNumber } from 'bignumber.js';
6
6
 
7
7
  import { TOOLTIP_DECIMALS } from '../constants/routing';
8
8
 
9
- export const secondsToString = (s: number): string => {
10
- const seconds = (s % 60).toString().padStart(2, '0');
11
- const minutes = parseInt((s / 60).toString())
9
+ /*
10
+ * if time > 1h -> rounded with 5 minutes precision
11
+ * if time < 1h -> rounded with 15 seconds precision
12
+ */
13
+ export const roundedSecondsToString = (s: number): string => {
14
+ const seconds = Math.floor((s % 60) / 15) * 15;
15
+ const minutes = parseInt((s / 60).toString());
16
+ if (minutes >= 60) {
17
+ return `${Math.floor(minutes / 5) * 5}:00`;
18
+ }
19
+ return `${minutes.toString().padStart(2, '0')}:${seconds
12
20
  .toString()
13
- .padStart(2, '0');
14
- return `${minutes}:${seconds}`;
21
+ .padStart(2, '0')}`;
15
22
  };
16
23
 
17
24
  export const numberToString = (