@rango-dev/widget-embedded 0.36.1-next.0 → 0.36.1-next.10
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/CHANGELOG.md +4 -0
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +2 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts +2 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts.map +1 -1
- package/dist/constants/quote.d.ts +2 -0
- package/dist/constants/quote.d.ts.map +1 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
- package/dist/hooks/useFetchCustomToken.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts +2 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +2 -1
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/hub.d.ts +1 -1
- package/dist/utils/hub.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +8 -8
- package/src/components/Quote/Quote.tsx +22 -3
- package/src/components/Quote/Quote.types.ts +2 -0
- package/src/components/Quote/QuoteCostDetails.styles.ts +0 -1
- package/src/components/Quote/QuoteCostDetails.tsx +23 -4
- package/src/components/StatefulConnectModal/StatefulConnectModal.tsx +1 -1
- package/src/components/WalletStatefulConnect/DerivationPath.helpers.ts +2 -1
- package/src/components/WalletStatefulConnect/Namespaces.tsx +1 -1
- package/src/components/WalletStatefulConnect/Namespaces.types.tsx +1 -1
- package/src/constants/quote.ts +2 -0
- package/src/containers/ExpandedQuotes/ExpandedQuotes.styles.ts +1 -0
- package/src/containers/ExpandedQuotes/ExpandedQuotes.tsx +1 -1
- package/src/hooks/useFetchCustomToken.ts +5 -0
- package/src/hooks/useStatefulConnect/useStatefulConnect.ts +2 -5
- package/src/hooks/useStatefulConnect/useStatefulConnect.types.ts +1 -1
- package/src/store/slices/data.ts +3 -2
- package/src/types/wallets.ts +2 -1
- package/src/utils/hub.ts +8 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.36.1-next.
|
|
3
|
+
"version": "0.36.1-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@lingui/core": "4.2.1",
|
|
26
26
|
"@lingui/react": "4.2.1",
|
|
27
27
|
"@rango-dev/logging-core": "^0.6.0",
|
|
28
|
-
"@rango-dev/provider-all": "^0.40.1-next.
|
|
28
|
+
"@rango-dev/provider-all": "^0.40.1-next.5",
|
|
29
29
|
"@rango-dev/queue-manager-core": "^0.27.0",
|
|
30
|
-
"@rango-dev/queue-manager-rango-preset": "^0.40.1-next.
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.40.1-next.4",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.27.0",
|
|
32
|
-
"@rango-dev/signer-solana": "^0.35.0",
|
|
33
|
-
"@rango-dev/ui": "^0.42.1-next.
|
|
34
|
-
"@rango-dev/wallets-core": "^0.40.1-next.
|
|
35
|
-
"@rango-dev/wallets-react": "^0.26.1-next.
|
|
36
|
-
"@rango-dev/wallets-shared": "^0.40.1-next.
|
|
32
|
+
"@rango-dev/signer-solana": "^0.35.1-next.0",
|
|
33
|
+
"@rango-dev/ui": "^0.42.1-next.7",
|
|
34
|
+
"@rango-dev/wallets-core": "^0.40.1-next.4",
|
|
35
|
+
"@rango-dev/wallets-react": "^0.26.1-next.5",
|
|
36
|
+
"@rango-dev/wallets-shared": "^0.40.1-next.4",
|
|
37
37
|
"bignumber.js": "^9.1.1",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
39
39
|
"dayjs": "^1.11.7",
|
|
@@ -17,7 +17,11 @@ import {
|
|
|
17
17
|
import BigNumber from 'bignumber.js';
|
|
18
18
|
import React, { useRef, useState } from 'react';
|
|
19
19
|
|
|
20
|
-
import {
|
|
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
|
|
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
|
|
@@ -329,7 +336,18 @@ export function Quote(props: QuoteProps) {
|
|
|
329
336
|
tooltipContainer={getExpanded()}
|
|
330
337
|
steps={steps}
|
|
331
338
|
tags={sortedQuoteTags}
|
|
332
|
-
|
|
339
|
+
quoteCost={
|
|
340
|
+
<QuoteCostDetails
|
|
341
|
+
quote={quote}
|
|
342
|
+
fullExpandedMode
|
|
343
|
+
time={totalTime}
|
|
344
|
+
fee={fee}
|
|
345
|
+
feeWarning={feeWarning}
|
|
346
|
+
timeWarning={timeWarning}
|
|
347
|
+
showModalFee={showModalFee}
|
|
348
|
+
steps={numberOfSteps}
|
|
349
|
+
/>
|
|
350
|
+
}
|
|
333
351
|
percentageChange={percentageChange}
|
|
334
352
|
warningLevel={priceImpactWarningLevel}
|
|
335
353
|
outputPrice={{
|
|
@@ -368,6 +386,7 @@ export function Quote(props: QuoteProps) {
|
|
|
368
386
|
time={totalTime}
|
|
369
387
|
fee={fee}
|
|
370
388
|
feeWarning={feeWarning}
|
|
389
|
+
timeWarning={timeWarning}
|
|
371
390
|
showModalFee={showModalFee}
|
|
372
391
|
steps={numberOfSteps}
|
|
373
392
|
/>
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
USD_VALUE_MAX_DECIMALS,
|
|
22
22
|
USD_VALUE_MIN_DECIMALS,
|
|
23
23
|
} from '../../constants/routing';
|
|
24
|
-
import { getContainer } from '../../utils/common';
|
|
24
|
+
import { getContainer, getExpanded } from '../../utils/common';
|
|
25
25
|
import { numberToString } from '../../utils/numbers';
|
|
26
26
|
import { getFeesGroup, getTotalFeesInUsd, getUsdFee } from '../../utils/swap';
|
|
27
27
|
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
@@ -57,9 +57,18 @@ const NonPayableFee = (props: { fee: BigNumber; label: string }) => {
|
|
|
57
57
|
export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
58
58
|
const [open, setOpen] = useState<boolean>(false);
|
|
59
59
|
const [openCollapse, setOpenCollapse] = useState<boolean>(false);
|
|
60
|
-
const {
|
|
60
|
+
const {
|
|
61
|
+
steps,
|
|
62
|
+
quote,
|
|
63
|
+
fee,
|
|
64
|
+
time,
|
|
65
|
+
feeWarning,
|
|
66
|
+
timeWarning,
|
|
67
|
+
showModalFee,
|
|
68
|
+
fullExpandedMode = false,
|
|
69
|
+
} = props;
|
|
61
70
|
const swaps = quote?.swaps ?? [];
|
|
62
|
-
const container = getContainer();
|
|
71
|
+
const container = fullExpandedMode ? getExpanded() : getContainer();
|
|
63
72
|
|
|
64
73
|
const feesGroup = getFeesGroup(swaps);
|
|
65
74
|
|
|
@@ -76,6 +85,7 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
76
85
|
}
|
|
77
86
|
fee={fee}
|
|
78
87
|
feeWarning={feeWarning}
|
|
88
|
+
timeWarning={timeWarning}
|
|
79
89
|
time={time}
|
|
80
90
|
steps={steps}
|
|
81
91
|
tooltipGas={showModalFee ? i18n.t('View more info') : undefined}
|
|
@@ -85,8 +95,17 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
85
95
|
<WatermarkedModal
|
|
86
96
|
container={container}
|
|
87
97
|
open={open}
|
|
98
|
+
anchor={fullExpandedMode ? 'center' : 'bottom'}
|
|
99
|
+
styles={{
|
|
100
|
+
container: {
|
|
101
|
+
maxWidth: fullExpandedMode ? '484px' : 'unset',
|
|
102
|
+
},
|
|
103
|
+
}}
|
|
88
104
|
header={
|
|
89
|
-
<ModalHeader
|
|
105
|
+
<ModalHeader
|
|
106
|
+
style={{
|
|
107
|
+
textAlign: fullExpandedMode ? 'left' : 'center',
|
|
108
|
+
}}>
|
|
90
109
|
<Typography variant="title" size="medium">
|
|
91
110
|
{i18n.t('Gas & Fee Explanation')}
|
|
92
111
|
</Typography>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Result } from '../../hooks/useStatefulConnect';
|
|
2
2
|
import type { WalletInfoWithExtra } from '../../types';
|
|
3
|
-
import type { Namespace } from '@rango-dev/wallets-
|
|
3
|
+
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
4
4
|
|
|
5
5
|
import { Divider } from '@rango-dev/ui';
|
|
6
6
|
import React, { useEffect, useRef, useState } from 'react';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
2
|
+
import type { DerivationPath } from '@rango-dev/wallets-shared';
|
|
2
3
|
|
|
3
4
|
import { namespaces } from '@rango-dev/wallets-shared';
|
|
4
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NeedsNamespacesState } from '../../hooks/useStatefulConnect';
|
|
2
|
-
import type { Namespace } from '@rango-dev/wallets-
|
|
2
|
+
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
3
3
|
|
|
4
4
|
export interface PropTypes {
|
|
5
5
|
onConfirm: (namespaces: Namespace[]) => void;
|
package/src/constants/quote.ts
CHANGED
|
@@ -103,6 +103,11 @@ export function useFetchCustomToken(): UseFetchCustomToken {
|
|
|
103
103
|
|
|
104
104
|
return token;
|
|
105
105
|
} catch (error: any) {
|
|
106
|
+
if (error?.code === 'ERR_BAD_REQUEST') {
|
|
107
|
+
const errorMessage = produceErrorMessage('not-found', blockchain);
|
|
108
|
+
setError(errorMessage);
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
106
111
|
setError(undefined);
|
|
107
112
|
throw new Error(error.message);
|
|
108
113
|
} finally {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { HandleConnectOptions, Result } from './useStatefulConnect.types';
|
|
2
2
|
import type { WalletInfoWithExtra } from '../../types';
|
|
3
3
|
import type { ExtendedModalWalletInfo } from '../../utils/wallets';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
NamespaceData,
|
|
7
|
-
WalletType,
|
|
8
|
-
} from '@rango-dev/wallets-shared';
|
|
4
|
+
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
5
|
+
import type { NamespaceData, WalletType } from '@rango-dev/wallets-shared';
|
|
9
6
|
|
|
10
7
|
import { WalletState } from '@rango-dev/ui';
|
|
11
8
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Namespace } from '@rango-dev/wallets-
|
|
1
|
+
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
2
2
|
|
|
3
3
|
export interface HandleConnectOptions {
|
|
4
4
|
// To have a switch between connect and disconnect when user is clicking on a button, this option can be helpful.
|
package/src/store/slices/data.ts
CHANGED
|
@@ -348,8 +348,9 @@ export const createDataSlice: StateCreator<
|
|
|
348
348
|
{};
|
|
349
349
|
const tokens: Token[] = [];
|
|
350
350
|
const popularTokens: Token[] = response.popularTokens;
|
|
351
|
-
const swappers: SwapperMeta[] = response.swappers
|
|
352
|
-
|
|
351
|
+
const swappers: SwapperMeta[] = response.swappers.filter(
|
|
352
|
+
(swapper) => swapper.enabled
|
|
353
|
+
);
|
|
353
354
|
const blockchainsWithAtLeastOneToken = new Set();
|
|
354
355
|
|
|
355
356
|
response.tokens.forEach((token) => {
|
package/src/types/wallets.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { WalletInfo } from '@rango-dev/ui';
|
|
2
|
-
import type { Namespace
|
|
2
|
+
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
3
|
+
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
3
4
|
|
|
4
5
|
export interface Wallet {
|
|
5
6
|
chain: string;
|
package/src/utils/hub.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CommonNamespaceKeys } from '@rango-dev/wallets-core';
|
|
2
|
-
|
|
3
|
-
import { Namespace } from '@rango-dev/wallets-shared';
|
|
2
|
+
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
4
3
|
|
|
5
4
|
export function convertCommonNamespacesKeysToLegacyNamespace(
|
|
6
5
|
namespaces: CommonNamespaceKeys[]
|
|
@@ -8,15 +7,15 @@ export function convertCommonNamespacesKeysToLegacyNamespace(
|
|
|
8
7
|
return namespaces.map((namespace) => {
|
|
9
8
|
switch (namespace) {
|
|
10
9
|
case 'evm':
|
|
11
|
-
return
|
|
10
|
+
return 'EVM';
|
|
12
11
|
case 'solana':
|
|
13
|
-
return
|
|
12
|
+
return 'Solana';
|
|
14
13
|
case 'cosmos':
|
|
15
|
-
return
|
|
14
|
+
return 'Cosmos';
|
|
15
|
+
default:
|
|
16
|
+
throw new Error(
|
|
17
|
+
'Can not convert this common namespace key to a proper legacy key.'
|
|
18
|
+
);
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
throw new Error(
|
|
19
|
-
'Can not convert this common namespace key to a proper legacy key.'
|
|
20
|
-
);
|
|
21
20
|
});
|
|
22
21
|
}
|