@rango-dev/widget-embedded 0.17.1-next.2 → 0.17.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/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -3
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
- package/dist/components/NoResult/NoResult.d.ts +4 -0
- package/dist/components/NoResult/NoResult.d.ts.map +1 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
- package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
- package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
- package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
- package/dist/components/NoResult/index.d.ts +2 -0
- package/dist/components/NoResult/index.d.ts.map +1 -0
- package/dist/components/Quote/Quote.d.ts +4 -0
- package/dist/components/Quote/Quote.d.ts.map +1 -0
- package/dist/components/Quote/Quote.styles.d.ts +1429 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
- package/dist/components/Quote/Quote.types.d.ts +22 -0
- package/dist/components/Quote/Quote.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
- package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
- package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
- package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.d.ts +11 -0
- package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts +158 -0
- package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
- package/dist/components/Quote/index.d.ts +4 -0
- package/dist/components/Quote/index.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
- package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +22 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
- package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/WidgetEvents.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +4 -4
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/messages.d.ts +1 -1
- package/dist/constants/warnings.d.ts +2 -2
- package/dist/constants/warnings.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts +4 -0
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +472 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +17 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
- package/dist/containers/QuoteInfo/index.d.ts +2 -0
- package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/index.d.ts +2 -0
- package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +16 -0
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
- package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
- package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
- package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
- package/dist/hooks/useFetchQuote.d.ts.map +1 -0
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
- package/dist/hooks/useSwapInput.d.ts +4 -2
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/store/app.d.ts +2 -2
- package/dist/store/{bestRoute.d.ts → quote.d.ts} +25 -20
- package/dist/store/quote.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/quote.d.ts +82 -0
- package/dist/types/quote.d.ts.map +1 -0
- package/dist/utils/numbers.d.ts +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/{routing.d.ts → quote.d.ts} +16 -12
- package/dist/utils/quote.d.ts.map +1 -0
- package/dist/utils/settings.d.ts +1 -1
- package/dist/utils/swap.d.ts +22 -20
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +3 -3
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +23 -26
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -1
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
- package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
- package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +16 -9
- package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
- package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +7 -12
- package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
- package/src/components/NoResult/index.ts +1 -0
- package/src/components/Quote/Quote.styles.ts +212 -0
- package/src/components/Quote/Quote.tsx +347 -0
- package/src/components/Quote/Quote.types.ts +16 -0
- package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
- package/src/components/Quote/QuoteSkeleton.tsx +108 -0
- package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
- package/src/components/Quote/QuoteSummary.styles.ts +15 -0
- package/src/components/Quote/QuoteSummary.tsx +46 -0
- package/src/components/Quote/index.ts +3 -0
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
- package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +3 -3
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +67 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +24 -0
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
- package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.tsx +13 -16
- package/src/components/SwitchFromAndTo.tsx +2 -2
- package/src/components/UpdateUrl.tsx +12 -12
- package/src/components/WidgetEvents.tsx +2 -3
- package/src/constants/errors.ts +8 -10
- package/src/constants/messages.ts +1 -1
- package/src/constants/warnings.ts +7 -7
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +15 -0
- package/src/containers/QuoteInfo/QuoteInfo.tsx +97 -0
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +17 -0
- package/src/containers/QuoteInfo/index.ts +1 -0
- package/src/hooks/useConfirmSwap/index.ts +1 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +168 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +136 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
- package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
- package/src/hooks/useNavigateBack.ts +3 -3
- package/src/hooks/useSwapInput.ts +57 -23
- package/src/hooks/useSyncStoresWithConfig.ts +2 -2
- package/src/pages/ConfirmSwapPage.tsx +58 -227
- package/src/pages/HistoryPage.tsx +1 -1
- package/src/pages/Home.tsx +52 -241
- package/src/pages/LanguagePage.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +1 -1
- package/src/pages/SelectBlockchainPage.tsx +3 -3
- package/src/pages/SelectSwapItemsPage.tsx +2 -2
- package/src/pages/SettingsPage.tsx +1 -1
- package/src/pages/ThemePage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +1 -1
- package/src/store/{bestRoute.ts → quote.ts} +42 -38
- package/src/types/index.ts +1 -1
- package/src/types/quote.ts +107 -0
- package/src/utils/numbers.ts +1 -1
- package/src/utils/quote.ts +338 -0
- package/src/utils/swap.ts +99 -69
- package/src/utils/wallets.ts +2 -2
- package/dist/components/NoRoutes/NoRoutes.d.ts +0 -4
- package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
- package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
- package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
- package/dist/components/NoRoutes/index.d.ts +0 -2
- package/dist/components/NoRoutes/index.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
- package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
- package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
- package/dist/components/RouteErrors/index.d.ts +0 -2
- package/dist/components/RouteErrors/index.d.ts.map +0 -1
- package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
- package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
- package/dist/store/bestRoute.d.ts.map +0 -1
- package/dist/types/routing.d.ts +0 -65
- package/dist/types/routing.d.ts.map +0 -1
- package/dist/utils/routing.d.ts.map +0 -1
- package/src/components/NoRoutes/index.ts +0 -1
- package/src/components/RouteErrors/RouteErrors.tsx +0 -79
- package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
- package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
- package/src/components/RouteErrors/index.ts +0 -1
- package/src/hooks/useConfirmSwap.ts +0 -303
- package/src/types/routing.ts +0 -77
- package/src/utils/routing.ts +0 -321
- /package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAgB7C,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkDnD,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,qBA0R/C"}
|
package/dist/pages/Home.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAqD3D,wBAAgB,IAAI,sBAmPnB"}
|
package/dist/store/app.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export declare const useAppStore: {
|
|
|
10
10
|
_popularTokens: () => import("rango-sdk").Token[];
|
|
11
11
|
_swappers: () => import("rango-sdk").SwapperMeta[];
|
|
12
12
|
blockchains: () => (options?: {
|
|
13
|
-
type?: "
|
|
13
|
+
type?: "source" | "destination" | undefined;
|
|
14
14
|
} | undefined) => import("rango-sdk").BlockchainMeta[];
|
|
15
15
|
tokens: () => (options?: {
|
|
16
|
-
type?: "
|
|
16
|
+
type?: "source" | "destination" | undefined;
|
|
17
17
|
blockchain?: string | undefined;
|
|
18
18
|
searchFor?: string | undefined;
|
|
19
19
|
} | undefined) => import("rango-sdk").Token[];
|
|
@@ -3,7 +3,8 @@ import type { Wallet } from '../types';
|
|
|
3
3
|
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset/dist/shared';
|
|
4
4
|
import type { BestRouteResponse, BlockchainMeta, Token } from 'rango-sdk';
|
|
5
5
|
import BigNumber from 'bignumber.js';
|
|
6
|
-
export
|
|
6
|
+
export declare const getUsdValue: (token: Token | null, amount: string) => BigNumber | null;
|
|
7
|
+
export interface QuoteState {
|
|
7
8
|
fromBlockchain: BlockchainMeta | null;
|
|
8
9
|
toBlockchain: BlockchainMeta | null;
|
|
9
10
|
inputAmount: string;
|
|
@@ -12,9 +13,10 @@ export interface RouteState {
|
|
|
12
13
|
outputUsdValue: BigNumber | null;
|
|
13
14
|
fromToken: TokenWithBalance | null;
|
|
14
15
|
toToken: TokenWithBalance | null;
|
|
15
|
-
|
|
16
|
+
quoteWalletsConfirmed: boolean;
|
|
16
17
|
selectedWallets: Wallet[];
|
|
17
|
-
|
|
18
|
+
quoteWarningsConfirmed: boolean;
|
|
19
|
+
resetQuote: () => void;
|
|
18
20
|
resetToBlockchain: () => void;
|
|
19
21
|
resetFromBlockchain: () => void;
|
|
20
22
|
setFromBlockchain: (chain: BlockchainMeta | null) => void;
|
|
@@ -22,23 +24,24 @@ export interface RouteState {
|
|
|
22
24
|
setFromToken: (token: Token | null) => void;
|
|
23
25
|
setToToken: (token: Token | null) => void;
|
|
24
26
|
setInputAmount: (amount: string) => void;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
quote: BestRouteResponse | null;
|
|
28
|
+
setQuote: (quote: BestRouteResponse | null) => void;
|
|
27
29
|
retry: (pendingSwap: PendingSwap) => void;
|
|
28
30
|
switchFromAndTo: () => void;
|
|
29
|
-
|
|
31
|
+
setQuoteWalletConfirmed: (flag: boolean) => void;
|
|
30
32
|
setSelectedWallets: (wallets: Wallet[]) => void;
|
|
31
33
|
customDestination: string;
|
|
32
34
|
setCustomDestination: (address: string) => void;
|
|
33
|
-
|
|
35
|
+
resetQuoteWallets: () => void;
|
|
36
|
+
setQuoteWarningsConfirmed: (flag: boolean) => void;
|
|
34
37
|
}
|
|
35
|
-
export declare const
|
|
36
|
-
():
|
|
37
|
-
<U>(selector: (state:
|
|
38
|
-
} & Omit<import("zustand").StoreApi<
|
|
38
|
+
export declare const useQuoteStore: {
|
|
39
|
+
(): QuoteState;
|
|
40
|
+
<U>(selector: (state: QuoteState) => U, equals?: ((a: U, b: U) => boolean) | undefined): U;
|
|
41
|
+
} & Omit<import("zustand").StoreApi<QuoteState>, "subscribe"> & {
|
|
39
42
|
subscribe: {
|
|
40
|
-
(listener: (selectedState:
|
|
41
|
-
<U_1>(selector: (state:
|
|
43
|
+
(listener: (selectedState: QuoteState, previousSelectedState: QuoteState) => void): () => void;
|
|
44
|
+
<U_1>(selector: (state: QuoteState) => U_1, listener: (selectedState: U_1, previousSelectedState: U_1) => void, options?: {
|
|
42
45
|
equalityFn?: ((a: U_1, b: U_1) => boolean) | undefined;
|
|
43
46
|
fireImmediately?: boolean | undefined;
|
|
44
47
|
} | undefined): () => void;
|
|
@@ -53,9 +56,10 @@ export declare const useBestRouteStore: {
|
|
|
53
56
|
outputUsdValue: () => BigNumber | null;
|
|
54
57
|
fromToken: () => TokenWithBalance | null;
|
|
55
58
|
toToken: () => TokenWithBalance | null;
|
|
56
|
-
|
|
59
|
+
quoteWalletsConfirmed: () => boolean;
|
|
57
60
|
selectedWallets: () => Wallet[];
|
|
58
|
-
|
|
61
|
+
quoteWarningsConfirmed: () => boolean;
|
|
62
|
+
resetQuote: () => () => void;
|
|
59
63
|
resetToBlockchain: () => () => void;
|
|
60
64
|
resetFromBlockchain: () => () => void;
|
|
61
65
|
setFromBlockchain: () => (chain: BlockchainMeta | null) => void;
|
|
@@ -63,15 +67,16 @@ export declare const useBestRouteStore: {
|
|
|
63
67
|
setFromToken: () => (token: Token | null) => void;
|
|
64
68
|
setToToken: () => (token: Token | null) => void;
|
|
65
69
|
setInputAmount: () => (amount: string) => void;
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
quote: () => BestRouteResponse | null;
|
|
71
|
+
setQuote: () => (quote: BestRouteResponse | null) => void;
|
|
68
72
|
retry: () => (pendingSwap: PendingSwap) => void;
|
|
69
73
|
switchFromAndTo: () => () => void;
|
|
70
|
-
|
|
74
|
+
setQuoteWalletConfirmed: () => (flag: boolean) => void;
|
|
71
75
|
setSelectedWallets: () => (wallets: Wallet[]) => void;
|
|
72
76
|
customDestination: () => string;
|
|
73
77
|
setCustomDestination: () => (address: string) => void;
|
|
74
|
-
|
|
78
|
+
resetQuoteWallets: () => () => void;
|
|
79
|
+
setQuoteWarningsConfirmed: () => (flag: boolean) => void;
|
|
75
80
|
};
|
|
76
81
|
};
|
|
77
|
-
//# sourceMappingURL=
|
|
82
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../src/store/quote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE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
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { PriceImpactWarningLevel } from '@rango-dev/ui';
|
|
2
|
+
import type BigNumber from 'bignumber.js';
|
|
3
|
+
import type { SwapResult } from 'rango-sdk';
|
|
4
|
+
export declare enum QuoteErrorType {
|
|
5
|
+
NO_RESULT = 0,
|
|
6
|
+
REQUEST_FAILED = 1,
|
|
7
|
+
REQUEST_CANCELED = 2,
|
|
8
|
+
BRIDGE_LIMIT = 3,
|
|
9
|
+
INSUFFICIENT_SLIPPAGE = 4
|
|
10
|
+
}
|
|
11
|
+
export type NoResultError = {
|
|
12
|
+
type: QuoteErrorType.NO_RESULT;
|
|
13
|
+
diagnosisMessage?: string;
|
|
14
|
+
};
|
|
15
|
+
export type BridgeLimitError = {
|
|
16
|
+
type: QuoteErrorType.BRIDGE_LIMIT;
|
|
17
|
+
swap: SwapResult;
|
|
18
|
+
recommendation: string;
|
|
19
|
+
fromAmountRangeError: string;
|
|
20
|
+
};
|
|
21
|
+
export type InsufficientSlippageError = {
|
|
22
|
+
type: QuoteErrorType.INSUFFICIENT_SLIPPAGE;
|
|
23
|
+
recommendedSlippages: RecommendedSlippages | null;
|
|
24
|
+
minRequiredSlippage: string | null;
|
|
25
|
+
};
|
|
26
|
+
export type QuoteRequestFailed = {
|
|
27
|
+
type: QuoteErrorType.REQUEST_FAILED;
|
|
28
|
+
};
|
|
29
|
+
export type QuoteRequestCanceled = {
|
|
30
|
+
type: QuoteErrorType.REQUEST_CANCELED;
|
|
31
|
+
};
|
|
32
|
+
export type QuoteError = NoResultError | BridgeLimitError | InsufficientSlippageError | QuoteRequestFailed | QuoteRequestCanceled;
|
|
33
|
+
export declare enum QuoteWarningType {
|
|
34
|
+
HIGH_VALUE_LOSS = 0,
|
|
35
|
+
UNKNOWN_PRICE = 1,
|
|
36
|
+
INSUFFICIENT_SLIPPAGE = 2,
|
|
37
|
+
HIGH_SLIPPAGE = 3
|
|
38
|
+
}
|
|
39
|
+
export declare enum QuoteUpdateType {
|
|
40
|
+
QUOTE_UPDATED = 0,
|
|
41
|
+
QUOTE_SWAPPERS_UPDATED = 1,
|
|
42
|
+
QUOTE_COINS_UPDATED = 2,
|
|
43
|
+
QUOTE_AND_OUTPUT_AMOUNT_UPDATED = 3,
|
|
44
|
+
QUOTE_UPDATED_WITH_HIGH_VALUE_LOSS = 4
|
|
45
|
+
}
|
|
46
|
+
export type QuoteUpdateWarning = {
|
|
47
|
+
type: QuoteUpdateType.QUOTE_AND_OUTPUT_AMOUNT_UPDATED;
|
|
48
|
+
newOutputAmount: string;
|
|
49
|
+
percentageChange: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: Exclude<QuoteUpdateType, QuoteUpdateType.QUOTE_AND_OUTPUT_AMOUNT_UPDATED>;
|
|
52
|
+
};
|
|
53
|
+
export type RecommendedSlippages = Map<number, string>;
|
|
54
|
+
export type InsufficientSlippageWarning = {
|
|
55
|
+
type: QuoteWarningType.INSUFFICIENT_SLIPPAGE;
|
|
56
|
+
recommendedSlippages: RecommendedSlippages | null;
|
|
57
|
+
minRequiredSlippage: string | null;
|
|
58
|
+
};
|
|
59
|
+
export type HighSlippageWarning = {
|
|
60
|
+
type: QuoteWarningType.HIGH_SLIPPAGE;
|
|
61
|
+
slippage: string | null;
|
|
62
|
+
};
|
|
63
|
+
export type HighValueLossWarning = {
|
|
64
|
+
type: QuoteWarningType.HIGH_VALUE_LOSS;
|
|
65
|
+
warningLevel: PriceImpactWarningLevel;
|
|
66
|
+
inputUsdValue: BigNumber;
|
|
67
|
+
outputUsdValue: BigNumber;
|
|
68
|
+
totalFee: BigNumber;
|
|
69
|
+
priceImpact: number;
|
|
70
|
+
};
|
|
71
|
+
export type UnknownPriceWarning = {
|
|
72
|
+
type: QuoteWarningType.UNKNOWN_PRICE;
|
|
73
|
+
};
|
|
74
|
+
export type QuoteWarning = HighValueLossWarning | InsufficientSlippageWarning | HighSlippageWarning | UnknownPriceWarning;
|
|
75
|
+
export type ConfirmSwapWarnings = {
|
|
76
|
+
quote: QuoteWarning | null;
|
|
77
|
+
quoteUpdate: QuoteUpdateWarning | null;
|
|
78
|
+
balance: {
|
|
79
|
+
messages: string[];
|
|
80
|
+
} | null;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../src/types/quote.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,oBAAY,cAAc;IACxB,SAAS,IAAA;IACT,cAAc,IAAA;IACd,gBAAgB,IAAA;IAChB,YAAY,IAAA;IACZ,qBAAqB,IAAA;CACtB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,cAAc,CAAC,YAAY,CAAC;IAClC,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC,qBAAqB,CAAC;IAC3C,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClD,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,kB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SAAS,CAAC;IACzB,cAAc,EAAE,SAAS,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,gBAAgB,CAAC,aAAa,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,2BAA2B,GAC3B,mBAAmB,GACnB,mBAAmB,CAAC;AAExB,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACvC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CACxC,CAAC"}
|
package/dist/utils/numbers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { BestRouteResponse } from 'rango-sdk';
|
|
|
2
2
|
import { BigNumber } from 'bignumber.js';
|
|
3
3
|
export declare const percentToString: (p: number, fractions?: number) => string;
|
|
4
4
|
export declare const secondsToString: (s: number) => string;
|
|
5
|
-
export declare const numberToString: (number: BigNumber | string | null | undefined, minDecimals?: number | null, maxDecimals?: number | null) => string;
|
|
5
|
+
export declare const numberToString: (number: BigNumber | string | number | null | undefined, minDecimals?: number | null, maxDecimals?: number | null) => string;
|
|
6
6
|
export declare const convertBigNumberToHex: (value: BigNumber, decimals: number) => string;
|
|
7
7
|
export declare const uint8ArrayToHex: (buffer: Uint8Array) => string;
|
|
8
8
|
export declare function dollarToConciseString(num: number | undefined): string;
|
|
@@ -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;AAEzC,eAAO,MAAM,eAA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E,MAAM,EACpB,gBAAgB,SAAI,GACnB,MAAM,CASR"}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { QuoteError, QuoteWarning, Wallet } from '../types';
|
|
2
2
|
import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
3
3
|
import type { PriceImpactWarningLevel } from '@rango-dev/ui';
|
|
4
4
|
import type { SimulationAssetAndAmount, SimulationValidationStatus } from '@rango-dev/ui/dist/widget/ui/src/types/swaps';
|
|
5
5
|
import type { Asset, BestRouteResponse, BlockchainMeta, Token } from 'rango-sdk';
|
|
6
6
|
import BigNumber from 'bignumber.js';
|
|
7
7
|
export declare function searchParamsToToken(tokens: Token[], searchParams: string | null, chain: BlockchainMeta | null): Token | null;
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function isNumberOfSwapsChanged(
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
8
|
+
export declare function getQuoteToTokenUsdPrice(quote: BestRouteResponse | null): number | null | undefined;
|
|
9
|
+
export declare function isNumberOfSwapsChanged(quoteA: BestRouteResponse, quoteB: BestRouteResponse): boolean;
|
|
10
|
+
export declare function isQuoteSwappersUpdated(quoteA: BestRouteResponse, quoteB: BestRouteResponse): boolean;
|
|
11
|
+
export declare function isQuoteInternalCoinsUpdated(quoteA: BestRouteResponse, quoteB: BestRouteResponse): boolean;
|
|
12
|
+
export declare function isQuoteChanged(quoteA: BestRouteResponse, quoteB: BestRouteResponse): boolean;
|
|
13
13
|
export declare function outToRatioHasWarning(fromUsdValue: BigNumber | null, outToInRatio: BigNumber | 0): boolean;
|
|
14
14
|
export declare function getRequiredBalanceOfWallet(selectedWallet: Wallet, fee: SimulationValidationStatus[] | null): SimulationAssetAndAmount[] | null;
|
|
15
|
-
export declare function isRouteParametersChanged(params: BestRouteEqualityParams): boolean | undefined;
|
|
16
|
-
export declare function getFormattedBestRoute(bestRoute: BestRouteResponse | null): BestRouteResponse | null;
|
|
17
|
-
export declare function getFormattedPendingSwap(pendingSwap: PendingSwap): PendingSwap;
|
|
18
|
-
export declare const getBestRouteStatus: (loading: boolean, error: boolean) => "loading" | "success" | "failed";
|
|
19
15
|
export declare function getPriceImpactLevel(priceImpact: number): PriceImpactWarningLevel;
|
|
20
16
|
export declare function findCommonTokens<T extends Asset[], R extends Asset[]>(listA: T, listB: R): R;
|
|
21
|
-
export declare function
|
|
17
|
+
export declare function createRetryQuote(pendingSwap: PendingSwap, blockchains: BlockchainMeta[], tokens: Token[]): {
|
|
22
18
|
fromBlockchain: BlockchainMeta | null;
|
|
23
19
|
fromToken: Token | null;
|
|
24
20
|
toBlockchain: BlockchainMeta | null;
|
|
25
21
|
toToken: Token | null;
|
|
26
22
|
inputAmount: string;
|
|
27
23
|
};
|
|
28
|
-
|
|
24
|
+
export declare function generateQuoteWarnings(quote: BestRouteResponse, params: {
|
|
25
|
+
fromToken: Token;
|
|
26
|
+
toToken: Token;
|
|
27
|
+
tokens: Token[];
|
|
28
|
+
userSlippage: number;
|
|
29
|
+
}): QuoteWarning | null;
|
|
30
|
+
export declare function generateQuoteErrors(quote: BestRouteResponse): QuoteError | null;
|
|
31
|
+
export declare function getPriceImpact(inputUsdValue: BigNumber | string | null, outputUsdValue: BigNumber | string | null): number | null;
|
|
32
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../src/utils/quote.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EACV,KAA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AAK,EAAE,GACd;IACD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,OAAO,EAAE,KAAK,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CA4CA;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE;IACN,SAAS,EAAE,KAAK,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,GACA,YAAY,GAAG,IAAI,CAgDrB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,GACvB,UAAU,GAAG,IAAI,CA+BnB;AAED,wBAAgB,cAAc,CAC5B,aAAa,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,EACxC,cAAc,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,iBAgB1C"}
|
package/dist/utils/settings.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type UniqueSwappersGroupType = {
|
|
|
7
7
|
selected: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare function getUniqueSwappersGroups(supportedSwappers?: string[]): UniqueSwappersGroupType[];
|
|
10
|
-
export declare function sortLiquiditySourcesByGroupTitle(a: UniqueSwappersGroupType, b: UniqueSwappersGroupType):
|
|
10
|
+
export declare function sortLiquiditySourcesByGroupTitle(a: UniqueSwappersGroupType, b: UniqueSwappersGroupType): 1 | -1 | 0;
|
|
11
11
|
//# sourceMappingURL=settings.d.ts.map
|
package/dist/utils/swap.d.ts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import type { LoadingStatus } from '../store/meta';
|
|
2
2
|
import type { ConnectedWallet } from '../store/wallets';
|
|
3
|
-
import type { ConvertedToken, SwapButtonState, Wallet } from '../types';
|
|
3
|
+
import type { ConvertedToken, RecommendedSlippages, SwapButtonState, Wallet } from '../types';
|
|
4
4
|
import type { PendingSwap, PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
|
|
5
5
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
6
6
|
import type { BestRouteRequest, BestRouteResponse, BlockchainMeta, RecommendedSlippage, SwapResult, Token } from 'rango-sdk';
|
|
7
7
|
import BigNumber from 'bignumber.js';
|
|
8
|
-
export declare function getOutputRatio(inputUsdValue: BigNumber | null, outputUsdValue: BigNumber | null):
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function hasLimitError(
|
|
11
|
-
export declare function
|
|
12
|
-
swap: SwapResult
|
|
8
|
+
export declare function getOutputRatio(inputUsdValue: BigNumber | null, outputUsdValue: BigNumber | null): number;
|
|
9
|
+
export declare function hasHighValueLoss(inputUsdValue: BigNumber | null, priceImpact: number): boolean;
|
|
10
|
+
export declare function hasLimitError(quote: BestRouteResponse | null): boolean;
|
|
11
|
+
export declare function getLimitErrorMessage(quote: BestRouteResponse): {
|
|
12
|
+
swap: SwapResult;
|
|
13
13
|
fromAmountRangeError: string;
|
|
14
14
|
recommendation: string;
|
|
15
15
|
};
|
|
16
|
-
export declare function getSwapButtonState(loadingMetaStatus: LoadingStatus, connectedWallets: ConnectedWallet[], loading: boolean,
|
|
17
|
-
export declare function canComputePriceImpact(
|
|
18
|
-
export declare function requiredWallets(
|
|
16
|
+
export declare function getSwapButtonState(loadingMetaStatus: LoadingStatus, connectedWallets: ConnectedWallet[], loading: boolean, quote: BestRouteResponse | null, hasLimitError: boolean, highValueLoss: boolean, priceImpactCanNotBeComputed: boolean, needsToWarnEthOnPath: boolean, inputAmount: string): SwapButtonState;
|
|
17
|
+
export declare function canComputePriceImpact(quote: BestRouteResponse | null, inputAmount: string, usdValue: BigNumber | null): boolean;
|
|
18
|
+
export declare function requiredWallets(quote: BestRouteResponse | null): string[];
|
|
19
19
|
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
20
20
|
export declare function getUsdFeeOfStep(step: SwapResult, allTokens: Token[]): BigNumber;
|
|
21
|
-
export declare function getTotalFeeInUsd(
|
|
21
|
+
export declare function getTotalFeeInUsd(swaps: SwapResult[], allTokens: Token[]): BigNumber;
|
|
22
22
|
export declare function hasHighFee(totalFeeInUsd: BigNumber | null): boolean;
|
|
23
23
|
export declare function hasSlippageError(slippages: (RecommendedSlippage | null)[] | undefined): boolean;
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function checkSlippageErrors(quote: BestRouteResponse): RecommendedSlippages | null;
|
|
25
|
+
export declare function checkSlippageWarnings(quote: BestRouteResponse, userSlippage: number): RecommendedSlippages | null;
|
|
26
|
+
export declare function getMinRequiredSlippage(quote: BestRouteResponse): string | null;
|
|
25
27
|
export declare function hasProperSlippage(userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
26
|
-
export declare function hasEnoughBalance(
|
|
27
|
-
export declare function hasEnoughBalanceAndProperSlippage(
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function hasEnoughBalance(quote: BestRouteResponse, selectedWallets: Wallet[]): boolean;
|
|
29
|
+
export declare function hasEnoughBalanceAndProperSlippage(quote: BestRouteResponse, selectedWallets: Wallet[], userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
30
|
+
export declare function createQuoteRequestBody(params: {
|
|
29
31
|
fromToken: Token;
|
|
30
32
|
toToken: Token;
|
|
31
33
|
inputAmount: string;
|
|
@@ -38,7 +40,7 @@ export declare function createBestRouteRequestBody(params: {
|
|
|
38
40
|
affiliateWallets: {
|
|
39
41
|
[key: string]: string;
|
|
40
42
|
} | null;
|
|
41
|
-
|
|
43
|
+
initialQuote?: BestRouteResponse;
|
|
42
44
|
destination?: string;
|
|
43
45
|
}): BestRouteRequest;
|
|
44
46
|
export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
@@ -47,10 +49,10 @@ export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
|
47
49
|
walletType: WalletType;
|
|
48
50
|
};
|
|
49
51
|
};
|
|
50
|
-
export declare function
|
|
51
|
-
export declare function getPercentageChange(
|
|
52
|
-
export declare function isOutputAmountChangedALot(
|
|
53
|
-
export declare function getBalanceWarnings(
|
|
52
|
+
export declare function getQuoteOutputAmount(quote: BestRouteResponse): string | null;
|
|
53
|
+
export declare function getPercentageChange(input: string, output: string): number;
|
|
54
|
+
export declare function isOutputAmountChangedALot(oldQuote: BestRouteResponse, newQuote: BestRouteResponse): boolean;
|
|
55
|
+
export declare function getBalanceWarnings(quote: BestRouteResponse, selectedWallets: Wallet[]): string[];
|
|
54
56
|
export declare function calcOutputUsdValue(outputAmount?: string, tokenPrice?: number | null): BigNumber;
|
|
55
57
|
export declare function isNetworkStatusInWarningState(pendingSwapStep: PendingSwapStep | null): boolean;
|
|
56
58
|
export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: PendingSwapStep | null): {
|
|
@@ -63,7 +65,7 @@ export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: P
|
|
|
63
65
|
export declare function getLastConvertedTokenInFailedSwap(pendingSwap: PendingSwap): ConvertedToken;
|
|
64
66
|
export declare function shouldRetrySwap(pendingSwap: PendingSwap): boolean;
|
|
65
67
|
export declare function isValidCustomDestination(blockchain: string, address: string): boolean;
|
|
66
|
-
export declare function confirmSwapDisabled(fetching: boolean, showCustomDestination: boolean, customDestination: string,
|
|
68
|
+
export declare function confirmSwapDisabled(fetching: boolean, showCustomDestination: boolean, customDestination: string, quote: BestRouteResponse | null, selectedWallets: {
|
|
67
69
|
walletType: string;
|
|
68
70
|
chain: string;
|
|
69
71
|
}[], lastStepToBlockchain?: BlockchainMeta): boolean | undefined;
|
package/dist/utils/swap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,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AAM,GAAG,IAAI,aAK3B;AAED,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,eAAe,GAAG,IAAI,GACtC,OAAO,CAMT;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,eAAe,GAAG,IAAI,GAClC;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;CACrD,CAyCA;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,WAAW,GACvB,cAAc,CAkBhB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,WAMvD;AACD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAMT;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,qBAAqB,EAAE,OAAO,EAC9B,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAC/B,eAAe,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACxD,oBAAoB,CAAC,EAAE,cAAc,uBActC"}
|
package/dist/utils/wallets.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function mapStatusToWalletState(state: WalletState): WalletStatus
|
|
|
9
9
|
export declare function mapWalletTypesToWalletInfo(getState: (type: WalletType) => WalletState, getWalletInfo: (type: WalletType) => WalletInfo, list: WalletType[], chain?: string): ModalWalletInfo[];
|
|
10
10
|
export declare function walletAndSupportedChainsNames(supportedBlockchains: BlockchainMeta[]): Network[] | null;
|
|
11
11
|
export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null): Wallet[];
|
|
12
|
-
export declare function getRequiredChains(
|
|
12
|
+
export declare function getRequiredChains(quote: BestRouteResponse | null): string[];
|
|
13
13
|
export declare function getBalanceFromWallet(connectedWallets: ConnectedWallet[], chain: string, symbol: string, address: string | null): TokenBalance | null;
|
|
14
14
|
export declare function isAccountAndWalletMatched(account: Wallet, connectedWallet: ConnectedWallet): boolean;
|
|
15
15
|
export declare function makeBalanceFor(retrievedBalance: WalletDetail, tokens: Token[]): TokenBalance[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.17.1-next.
|
|
3
|
+
"version": "0.17.1-next.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@lingui/react": "4.2.1",
|
|
22
22
|
"@rango-dev/provider-all": "^0.22.1-next.2",
|
|
23
23
|
"@rango-dev/queue-manager-core": "^0.22.1-next.0",
|
|
24
|
-
"@rango-dev/queue-manager-rango-preset": "^0.22.1-next.
|
|
24
|
+
"@rango-dev/queue-manager-rango-preset": "^0.22.1-next.2",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.22.1-next.0",
|
|
26
|
-
"@rango-dev/ui": "^0.22.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.22.1-next.3",
|
|
27
27
|
"@rango-dev/wallets-react": "^0.8.1-next.1",
|
|
28
28
|
"@rango-dev/wallets-shared": "^0.21.1-next.1",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
|
@@ -13,8 +13,8 @@ import React from 'react';
|
|
|
13
13
|
|
|
14
14
|
import { BLOCKCHAIN_LIST_SIZE } from '../../constants/configs';
|
|
15
15
|
import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
|
|
16
|
-
import { useBestRouteStore } from '../../store/bestRoute';
|
|
17
16
|
import { useMetaStore } from '../../store/meta';
|
|
17
|
+
import { useQuoteStore } from '../../store/quote';
|
|
18
18
|
|
|
19
19
|
import { Container } from './BlockchainsSection.styles';
|
|
20
20
|
|
|
@@ -28,8 +28,8 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
const loadingStatus = useMetaStore.use.loadingStatus();
|
|
31
|
-
const resetToBlockchain =
|
|
32
|
-
const resetFromBlockchain =
|
|
31
|
+
const resetToBlockchain = useQuoteStore.use.resetToBlockchain();
|
|
32
|
+
const resetFromBlockchain = useQuoteStore.use.resetFromBlockchain();
|
|
33
33
|
const hasMoreItemsInList = blockchainsList.more.length > 0;
|
|
34
34
|
/**
|
|
35
35
|
* When only one item is left on list, we will not show the `More` button and will show the item itself instead.
|
|
@@ -1,71 +1,9 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
-
import type { Step } from '@rango-dev/ui/dist/widget/ui/src/components/BestRoute/BestRoute.types';
|
|
3
1
|
import type { BestRouteResponse, BlockchainMeta } from 'rango-sdk';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
7
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
8
|
-
USD_VALUE_MAX_DECIMALS,
|
|
9
|
-
USD_VALUE_MIN_DECIMALS,
|
|
10
|
-
} from '../../constants/routing';
|
|
11
|
-
import { getBlockchainShortNameFor } from '../../utils/meta';
|
|
12
|
-
import { numberToString } from '../../utils/numbers';
|
|
13
|
-
|
|
14
|
-
export function formatBestRoute(
|
|
15
|
-
bestRoute: BestRouteResponse,
|
|
16
|
-
blockchains: BlockchainMeta[]
|
|
17
|
-
): Step[] | undefined {
|
|
18
|
-
return bestRoute.result?.swaps.map((swap) => {
|
|
19
|
-
return {
|
|
20
|
-
swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
|
|
21
|
-
from: {
|
|
22
|
-
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
23
|
-
chain: {
|
|
24
|
-
displayName:
|
|
25
|
-
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
26
|
-
image: swap.from.blockchainLogo,
|
|
27
|
-
},
|
|
28
|
-
price: {
|
|
29
|
-
value: numberToString(
|
|
30
|
-
swap.fromAmount,
|
|
31
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
32
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
33
|
-
),
|
|
34
|
-
usdValue: numberToString(
|
|
35
|
-
swap.from.usdPrice?.toString(),
|
|
36
|
-
USD_VALUE_MIN_DECIMALS,
|
|
37
|
-
USD_VALUE_MAX_DECIMALS
|
|
38
|
-
),
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
to: {
|
|
42
|
-
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
43
|
-
chain: {
|
|
44
|
-
displayName:
|
|
45
|
-
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
46
|
-
image: swap.to.blockchainLogo,
|
|
47
|
-
},
|
|
48
|
-
price: {
|
|
49
|
-
value: numberToString(
|
|
50
|
-
swap.toAmount,
|
|
51
|
-
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
52
|
-
TOKEN_AMOUNT_MAX_DECIMALS
|
|
53
|
-
),
|
|
54
|
-
usdValue: numberToString(
|
|
55
|
-
swap.to.usdPrice?.toString(),
|
|
56
|
-
USD_VALUE_MIN_DECIMALS,
|
|
57
|
-
USD_VALUE_MAX_DECIMALS
|
|
58
|
-
),
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function getRequiredWallets(route: BestRouteResponse | null): string[] {
|
|
3
|
+
export function getRequiredWallets(quote: BestRouteResponse | null): string[] {
|
|
66
4
|
const wallets: string[] = [];
|
|
67
5
|
|
|
68
|
-
|
|
6
|
+
quote?.result?.swaps.forEach((swap) => {
|
|
69
7
|
const currentStepFromBlockchain = swap.from.blockchain;
|
|
70
8
|
const currentStepToBlockchain = swap.to.blockchain;
|
|
71
9
|
let lastAddedWallet = wallets[wallets.length - 1];
|