@rango-dev/widget-embedded 0.36.1-next.3 → 0.36.1-next.4

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.36.1-next.3",
3
+ "version": "0.36.1-next.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -30,7 +30,7 @@
30
30
  "@rango-dev/queue-manager-rango-preset": "^0.40.1-next.1",
31
31
  "@rango-dev/queue-manager-react": "^0.27.0",
32
32
  "@rango-dev/signer-solana": "^0.35.0",
33
- "@rango-dev/ui": "^0.42.1-next.2",
33
+ "@rango-dev/ui": "^0.42.1-next.3",
34
34
  "@rango-dev/wallets-core": "^0.40.1-next.1",
35
35
  "@rango-dev/wallets-react": "^0.26.1-next.1",
36
36
  "@rango-dev/wallets-shared": "^0.40.1-next.1",
@@ -17,7 +17,11 @@ import {
17
17
  import BigNumber from 'bignumber.js';
18
18
  import React, { useRef, useState } from 'react';
19
19
 
20
- import { GAS_FEE_MAX } from '../../constants/quote';
20
+ import {
21
+ GAS_FEE_MAX,
22
+ ROUTE_TIME_MAX,
23
+ SECONDS_IN_MINUTE,
24
+ } from '../../constants/quote';
21
25
  import {
22
26
  GAS_FEE_MAX_DECIMALS,
23
27
  GAS_FEE_MIN_DECIMALS,
@@ -311,7 +315,8 @@ export function Quote(props: QuoteProps) {
311
315
  const container = propContainer || getContainer();
312
316
  const sortedQuoteTags = sortTags(props.quote.tags || []);
313
317
  const showAllRoutesButton = !!onClickAllRoutes;
314
- const totalTime = roundedSecondsToString(totalArrivalTime(quote?.swaps));
318
+ const totalDurationSeconds = totalArrivalTime(quote?.swaps);
319
+ const totalTime = roundedSecondsToString(totalDurationSeconds);
315
320
  const totalFee = getTotalFeeInUsd(quote?.swaps ?? [], findToken);
316
321
  const fee = numberToString(
317
322
  totalFee,
@@ -320,6 +325,8 @@ export function Quote(props: QuoteProps) {
320
325
  );
321
326
 
322
327
  const feeWarning = totalFee.gte(new BigNumber(GAS_FEE_MAX));
328
+ const timeWarning =
329
+ totalDurationSeconds / SECONDS_IN_MINUTE >= ROUTE_TIME_MAX;
323
330
 
324
331
  return fullExpandedMode ? (
325
332
  <FullExpandedQuote
@@ -336,6 +343,7 @@ export function Quote(props: QuoteProps) {
336
343
  time={totalTime}
337
344
  fee={fee}
338
345
  feeWarning={feeWarning}
346
+ timeWarning={timeWarning}
339
347
  showModalFee={showModalFee}
340
348
  steps={numberOfSteps}
341
349
  />
@@ -378,6 +386,7 @@ export function Quote(props: QuoteProps) {
378
386
  time={totalTime}
379
387
  fee={fee}
380
388
  feeWarning={feeWarning}
389
+ timeWarning={timeWarning}
381
390
  showModalFee={showModalFee}
382
391
  steps={numberOfSteps}
383
392
  />
@@ -48,6 +48,7 @@ export type QuoteCostDetailsProps = {
48
48
  fee: string;
49
49
  time: string;
50
50
  feeWarning?: boolean;
51
+ timeWarning?: boolean;
51
52
  showModalFee: boolean;
52
53
  fullExpandedMode?: boolean;
53
54
  };
@@ -63,6 +63,7 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
63
63
  fee,
64
64
  time,
65
65
  feeWarning,
66
+ timeWarning,
66
67
  showModalFee,
67
68
  fullExpandedMode = false,
68
69
  } = props;
@@ -84,6 +85,7 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
84
85
  }
85
86
  fee={fee}
86
87
  feeWarning={feeWarning}
88
+ timeWarning={timeWarning}
87
89
  time={time}
88
90
  steps={steps}
89
91
  tooltipGas={showModalFee ? i18n.t('View more info') : undefined}
@@ -33,3 +33,5 @@ export const HIGH_PRIORITY_TAGS: TagValue[] = [
33
33
  ];
34
34
 
35
35
  export const GAS_FEE_MAX = 30;
36
+ export const ROUTE_TIME_MAX = 15;
37
+ export const SECONDS_IN_MINUTE = 60;