@rango-dev/widget-embedded 0.1.19 → 0.1.20-next.1
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/QueueManager.d.ts +3 -3
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/Widget.d.ts +8 -0
- package/dist/Widget.d.ts.map +1 -0
- package/dist/components/AppRouter.d.ts +7 -7
- package/dist/components/AppRouter.d.ts.map +1 -1
- package/dist/components/AppRoutes.d.ts +7 -7
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/BottomLogo.d.ts +2 -2
- package/dist/components/BottomLogo.d.ts.map +1 -1
- package/dist/components/ChangeSlippageButton.d.ts +2 -2
- package/dist/components/ChangeSlippageButton.d.ts.map +1 -1
- package/dist/components/ConfirmSwapErrors.d.ts +3 -3
- package/dist/components/ConfirmSwapErrors.d.ts.map +1 -1
- package/dist/components/ConfirmSwapWarnings.d.ts +2 -2
- package/dist/components/ConfirmSwapWarnings.d.ts.map +1 -1
- package/dist/components/Footer.d.ts +111 -1
- package/dist/components/Footer.d.ts.map +1 -1
- package/dist/components/HeaderButtons.d.ts +6 -6
- package/dist/components/HeaderButtons.d.ts.map +1 -1
- package/dist/components/Layout.d.ts +6 -6
- package/dist/components/Layout.d.ts.map +1 -1
- package/dist/components/PercentageChange.d.ts +8 -8
- package/dist/components/PercentageChange.d.ts.map +1 -1
- package/dist/components/RoutesOverview.d.ts +119 -9
- package/dist/components/RoutesOverview.d.ts.map +1 -1
- package/dist/components/SwapDetailsPlaceholder.d.ts +119 -9
- package/dist/components/SwapDetailsPlaceholder.d.ts.map +1 -1
- package/dist/components/SwitchFromAndTo.d.ts +3 -3
- package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
- package/dist/components/TokenInfo.d.ts +17 -17
- package/dist/components/TokenInfo.d.ts.map +1 -1
- package/dist/components/TokenPreview.d.ts +20 -20
- package/dist/components/TokenPreview.d.ts.map +1 -1
- package/dist/components/UpdateUrl.d.ts +1 -1
- package/dist/components/UpdateUrl.d.ts.map +1 -1
- package/dist/components/warnings/BalanceErrors.d.ts +6 -6
- package/dist/components/warnings/BalanceErrors.d.ts.map +1 -1
- package/dist/components/warnings/ConfirmSwapExtraMessages.d.ts +6 -6
- package/dist/components/warnings/ConfirmSwapExtraMessages.d.ts.map +1 -1
- package/dist/components/warnings/HighSlippageWarning.d.ts +6 -6
- package/dist/components/warnings/HighSlippageWarning.d.ts.map +1 -1
- package/dist/components/warnings/MinRequiredSlippage.d.ts +6 -6
- package/dist/components/warnings/MinRequiredSlippage.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +3 -3
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/navigationRoutes.d.ts +13 -13
- package/dist/constants/navigationRoutes.d.ts.map +1 -1
- package/dist/constants/numbers.d.ts +2 -2
- package/dist/constants/numbers.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +7 -7
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/constants/swapSettings.d.ts +5 -5
- package/dist/constants/swapSettings.d.ts.map +1 -1
- package/dist/globalStyles.d.ts +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap.d.ts +10 -10
- package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useNavigateBack.d.ts +3 -3
- package/dist/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/hooks/usePrevious.d.ts +1 -1
- package/dist/hooks/usePrevious.d.ts.map +1 -1
- package/dist/hooks/useSelectLanguage.d.ts +4 -4
- package/dist/hooks/useSelectLanguage.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts +30 -4
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/i18n.d.ts +2 -2
- package/dist/i18n.d.ts.map +1 -1
- package/dist/index.d.ts +5 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/index.js.map +7 -0
- package/dist/mockData/pendingSwap.d.ts +1 -1
- package/dist/mockData/pendingSwap.d.ts.map +1 -1
- package/dist/pages/ConfirmSwapPage.d.ts +2 -2
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts +2 -2
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts +2 -2
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcesPage.d.ts +6 -6
- package/dist/pages/LiquiditySourcesPage.d.ts.map +1 -1
- package/dist/pages/SelectChainPage.d.ts +7 -7
- package/dist/pages/SelectChainPage.d.ts.map +1 -1
- package/dist/pages/SelectTokenPage.d.ts +14 -14
- package/dist/pages/SelectTokenPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts +7 -7
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts +2 -2
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +8 -8
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/services/httpService.d.ts +3 -3
- package/dist/services/httpService.d.ts.map +1 -1
- package/dist/store/bestRoute.d.ts +67 -31
- package/dist/store/bestRoute.d.ts.map +1 -1
- package/dist/store/meta.d.ts +17 -8
- package/dist/store/meta.d.ts.map +1 -1
- package/dist/store/selectors.d.ts +10 -10
- package/dist/store/selectors.d.ts.map +1 -1
- package/dist/store/settings.d.ts +55 -18
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/store/ui.d.ts +22 -1
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/store/wallets.d.ts +55 -33
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +114 -114
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/routing.d.ts +57 -57
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/swap.d.ts +16 -16
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +6 -6
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/common.d.ts +3 -3
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +6 -6
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/date.d.ts +2 -2
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +13 -13
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/queue.d.ts +3 -3
- package/dist/utils/queue.d.ts.map +1 -1
- package/dist/utils/routing.d.ts +17 -17
- package/dist/utils/routing.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +50 -50
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/utils/time.d.ts +3 -3
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +27 -27
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +15 -11
- package/src/QueueManager.tsx +5 -1
- package/src/{index.tsx → Widget.tsx} +1 -14
- package/src/components/Layout.tsx +23 -17
- package/src/components/RoutesOverview.tsx +2 -2
- package/src/components/TokenInfo.tsx +4 -4
- package/src/components/TokenPreview.tsx +3 -3
- package/src/components/warnings/BalanceErrors.tsx +2 -2
- package/src/components/warnings/MinRequiredSlippage.tsx +2 -2
- package/src/index.ts +18 -0
- package/src/pages/ConfirmSwapPage.tsx +14 -12
- package/src/pages/SwapDetailsPage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +6 -2
- package/src/utils/wallets.ts +6 -3
- package/dist/widget-embedded.cjs.development.js +0 -3398
- package/dist/widget-embedded.cjs.development.js.map +0 -1
- package/dist/widget-embedded.cjs.production.min.js +0 -3398
- package/dist/widget-embedded.cjs.production.min.js.map +0 -1
- package/dist/widget-embedded.esm.js +0 -3384
- package/dist/widget-embedded.esm.js.map +0 -1
package/dist/utils/swap.d.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { BestRouteRequest, BestRouteResponse, RecommendedSlippage, SwapResult, Token } from 'rango-sdk';
|
|
3
|
-
import { ConnectedWallet } from '../store/wallets';
|
|
4
|
-
import { WalletType } from '@rango-dev/wallets-shared';
|
|
5
|
-
import { LoadingStatus } from '../store/meta';
|
|
6
|
-
import { ConvertedToken, SwapButtonState, Wallet } from '../types';
|
|
7
|
-
import { PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
|
|
8
|
-
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
9
|
-
export declare function getOutputRatio(inputUsdValue: BigNumber, outputUsdValue: BigNumber):
|
|
10
|
-
export declare function outputRatioHasWarning(inputUsdValue: BigNumber, outputRatio: BigNumber | 0): boolean;
|
|
11
|
-
export declare function hasLimitError(bestRoute: BestRouteResponse | null): boolean;
|
|
12
|
-
export declare function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
13
|
-
swap: SwapResult | null;
|
|
14
|
-
fromAmountRangeError: string;
|
|
15
|
-
recommendation: string;
|
|
16
|
-
};
|
|
17
|
-
export declare function getSwapButtonState(loadingMetaStatus: LoadingStatus, connectedWallets: ConnectedWallet[], loading: boolean, bestRoute: BestRouteResponse | null, hasLimitError: boolean, highValueLoss: boolean, priceImpactCanNotBeComputed: boolean, needsToWarnEthOnPath: boolean, inputAmount: string): SwapButtonState;
|
|
18
|
-
export declare function canComputePriceImpact(bestRoute: BestRouteResponse | null, inputAmount: string, inputUsdValue: BigNumber, outputUsdValue: BigNumber): boolean;
|
|
19
|
-
export declare function requiredWallets(route: BestRouteResponse | null): string[];
|
|
20
|
-
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
21
|
-
export declare function getUsdFeeOfStep(step: SwapResult, allTokens: Token[]): BigNumber;
|
|
22
|
-
export declare function getTotalFeeInUsd(bestRoute: BestRouteResponse | null, allTokens: Token[]): BigNumber | null;
|
|
23
|
-
export declare function hasHighFee(totalFeeInUsd: BigNumber | null): boolean;
|
|
24
|
-
export declare function hasSlippageError(slippages: (RecommendedSlippage | null)[] | undefined): boolean;
|
|
25
|
-
export declare function getMinRequiredSlippage(route: BestRouteResponse): string | null;
|
|
26
|
-
export declare function hasProperSlippage(userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
27
|
-
export declare function hasEnoughBalance(route: BestRouteResponse, selectedWallets: Wallet[]): boolean;
|
|
28
|
-
export declare function hasEnoughBalanceAndProperSlippage(route: BestRouteResponse, selectedWallets: Wallet[], userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
29
|
-
export declare function createBestRouteRequestBody(fromToken: Token, toToken: Token, inputAmount: string, wallets: ConnectedWallet[], selectedWallets: Wallet[], disabledLiquiditySources: string[], slippage: number, affiliateRef: string | null, initialRoute?: BestRouteResponse): BestRouteRequest;
|
|
30
|
-
export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
31
|
-
[p: string]: {
|
|
32
|
-
address: string;
|
|
33
|
-
walletType: WalletType;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export declare function getRouteOutputAmount(route: BestRouteResponse | null): string | null;
|
|
37
|
-
export declare function getPercentageChange(oldValue: string | number | null, newValue: string | number | null): BigNumber | null;
|
|
38
|
-
export declare function isOutputAmountChangedALot(oldRoute: BestRouteResponse, newRoute: BestRouteResponse): boolean;
|
|
39
|
-
export declare function getBalanceWarnings(route: BestRouteResponse, selectedWallets: Wallet[]): string[];
|
|
40
|
-
export declare function calcOutputUsdValue(outputAmount?: string, tokenPrice?: number | null): BigNumber;
|
|
41
|
-
export declare function isNetworkStatusInWarningState(pendingSwapStep: PendingSwapStep | null): boolean;
|
|
42
|
-
export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: PendingSwapStep | null): {
|
|
43
|
-
shortMessage: string;
|
|
44
|
-
detailedMessage: {
|
|
45
|
-
content: string;
|
|
46
|
-
long: boolean;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export declare function getLastConvertedTokenInFailedSwap(pendingSwap: PendingSwap): ConvertedToken;
|
|
50
|
-
export declare function shouldRetrySwap(pendingSwap: PendingSwap): boolean;
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { BestRouteRequest, BestRouteResponse, RecommendedSlippage, SwapResult, Token } from 'rango-sdk';
|
|
3
|
+
import { ConnectedWallet } from '../store/wallets';
|
|
4
|
+
import { WalletType } from '@rango-dev/wallets-shared';
|
|
5
|
+
import { LoadingStatus } from '../store/meta';
|
|
6
|
+
import { ConvertedToken, SwapButtonState, Wallet } from '../types';
|
|
7
|
+
import { PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
|
|
8
|
+
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
9
|
+
export declare function getOutputRatio(inputUsdValue: BigNumber, outputUsdValue: BigNumber): 0 | BigNumber;
|
|
10
|
+
export declare function outputRatioHasWarning(inputUsdValue: BigNumber, outputRatio: BigNumber | 0): boolean;
|
|
11
|
+
export declare function hasLimitError(bestRoute: BestRouteResponse | null): boolean;
|
|
12
|
+
export declare function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
13
|
+
swap: SwapResult | null;
|
|
14
|
+
fromAmountRangeError: string;
|
|
15
|
+
recommendation: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function getSwapButtonState(loadingMetaStatus: LoadingStatus, connectedWallets: ConnectedWallet[], loading: boolean, bestRoute: BestRouteResponse | null, hasLimitError: boolean, highValueLoss: boolean, priceImpactCanNotBeComputed: boolean, needsToWarnEthOnPath: boolean, inputAmount: string): SwapButtonState;
|
|
18
|
+
export declare function canComputePriceImpact(bestRoute: BestRouteResponse | null, inputAmount: string, inputUsdValue: BigNumber, outputUsdValue: BigNumber): boolean;
|
|
19
|
+
export declare function requiredWallets(route: BestRouteResponse | null): string[];
|
|
20
|
+
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
21
|
+
export declare function getUsdFeeOfStep(step: SwapResult, allTokens: Token[]): BigNumber;
|
|
22
|
+
export declare function getTotalFeeInUsd(bestRoute: BestRouteResponse | null, allTokens: Token[]): BigNumber | null;
|
|
23
|
+
export declare function hasHighFee(totalFeeInUsd: BigNumber | null): boolean;
|
|
24
|
+
export declare function hasSlippageError(slippages: (RecommendedSlippage | null)[] | undefined): boolean;
|
|
25
|
+
export declare function getMinRequiredSlippage(route: BestRouteResponse): string | null;
|
|
26
|
+
export declare function hasProperSlippage(userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
27
|
+
export declare function hasEnoughBalance(route: BestRouteResponse, selectedWallets: Wallet[]): boolean;
|
|
28
|
+
export declare function hasEnoughBalanceAndProperSlippage(route: BestRouteResponse, selectedWallets: Wallet[], userSlippage: string, minRequiredSlippage: string | null): boolean;
|
|
29
|
+
export declare function createBestRouteRequestBody(fromToken: Token, toToken: Token, inputAmount: string, wallets: ConnectedWallet[], selectedWallets: Wallet[], disabledLiquiditySources: string[], slippage: number, affiliateRef: string | null, initialRoute?: BestRouteResponse): BestRouteRequest;
|
|
30
|
+
export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
31
|
+
[p: string]: {
|
|
32
|
+
address: string;
|
|
33
|
+
walletType: WalletType;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare function getRouteOutputAmount(route: BestRouteResponse | null): string | null;
|
|
37
|
+
export declare function getPercentageChange(oldValue: string | number | null, newValue: string | number | null): BigNumber | null;
|
|
38
|
+
export declare function isOutputAmountChangedALot(oldRoute: BestRouteResponse, newRoute: BestRouteResponse): boolean;
|
|
39
|
+
export declare function getBalanceWarnings(route: BestRouteResponse, selectedWallets: Wallet[]): string[];
|
|
40
|
+
export declare function calcOutputUsdValue(outputAmount?: string, tokenPrice?: number | null): BigNumber;
|
|
41
|
+
export declare function isNetworkStatusInWarningState(pendingSwapStep: PendingSwapStep | null): boolean;
|
|
42
|
+
export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: PendingSwapStep | null): {
|
|
43
|
+
shortMessage: string;
|
|
44
|
+
detailedMessage: {
|
|
45
|
+
content: string;
|
|
46
|
+
long: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function getLastConvertedTokenInFailedSwap(pendingSwap: PendingSwap): ConvertedToken;
|
|
50
|
+
export declare function shouldRetrySwap(pendingSwap: PendingSwap): boolean;
|
|
51
51
|
//# sourceMappingURL=swap.d.ts.map
|
package/dist/utils/swap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,KAAK,EACN,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAEL,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,wBAAgB,cAAc,CAC5B,aAAa,EAAE,SAAS,EACxB,cAAc,EAAE,SAAS,iBAI1B;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,SAAS,EACxB,WAAW,EAAE,SAAS,GAAG,CAAC,WAQ3B;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAiB1E;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,iBAAiB,G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,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,CAoCA;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,WAAW,GACvB,cAAc,CAkBhB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,WAMvD"}
|
package/dist/utils/time.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
2
|
-
export declare function timeSince(timeMillis: number): string;
|
|
3
|
-
export declare function getSwapDate(pendingSwap: PendingSwap): string;
|
|
1
|
+
import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
2
|
+
export declare function timeSince(timeMillis: number): string;
|
|
3
|
+
export declare function getSwapDate(pendingSwap: PendingSwap): string;
|
|
4
4
|
//# sourceMappingURL=time.d.ts.map
|
package/dist/utils/time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAqCpD;AAED,wBAAgB,WAAW,CAAC,WAAW,EAAE,WAAW,UAInD"}
|
package/dist/utils/wallets.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { Network, WalletState, WalletType, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
|
-
import { WalletInfo as ModalWalletInfo, WalletState as WalletStatus, SelectableWallet } from '@rango-dev/ui';
|
|
3
|
-
import { BestRouteResponse, BlockchainMeta, Token, WalletDetail } from 'rango-sdk';
|
|
4
|
-
import { ConnectedWallet, TokenBalance } from '../store/wallets';
|
|
5
|
-
import { TokenWithBalance } from '../pages/SelectTokenPage';
|
|
6
|
-
import { Wallet } from '../types';
|
|
7
|
-
export declare function getStateWallet(state: WalletState): WalletStatus;
|
|
8
|
-
export declare const excludedWallets:
|
|
9
|
-
export declare function getlistWallet(getState: (type: WalletType) => WalletState, getWalletInfo: (type: WalletType) => WalletInfo, list: WalletType[]): ModalWalletInfo[];
|
|
10
|
-
export declare function walletAndSupportedChainsNames(supportedChains: BlockchainMeta[]): Network[] | null;
|
|
11
|
-
export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null): Wallet[];
|
|
12
|
-
export declare function getRequiredChains(route: BestRouteResponse | null): string[];
|
|
13
|
-
export declare function getSelectableWallets(connectedWallets: ConnectedWallet[], selectedWallets: Wallet[], getWalletInfo: (type: WalletType) => WalletInfo): SelectableWallet[];
|
|
14
|
-
export declare function getBalanceFromWallet(connectedWallets: ConnectedWallet[], chain: string, symbol: string, address: string | null): TokenBalance | null;
|
|
15
|
-
export declare function isAccountAndWalletMatched(account: Wallet, connectedWallet: ConnectedWallet): boolean;
|
|
16
|
-
export declare function makeBalanceFor(wallet: Wallet, retrivedBalance: WalletDetail, tokens: Token[]): ConnectedWallet;
|
|
17
|
-
export declare function resetConnectedWalletState(connectedWallet: ConnectedWallet): ConnectedWallet;
|
|
18
|
-
export declare const calculateWalletUsdValue: (connectedWallet: ConnectedWallet[]) => string;
|
|
19
|
-
export declare const sortTokens: (tokens: TokenWithBalance[]) => TokenWithBalance[];
|
|
20
|
-
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
21
|
-
export declare const isExperimentalChain: (blockchains: BlockchainMeta[], wallet: string) => boolean;
|
|
22
|
-
export declare const getKeplrCompatibleConnectedWallets: (selectableWallets: SelectableWallet[]) => WalletType[];
|
|
23
|
-
export declare function getTokensWithBalance(tokens: TokenWithBalance[], connectedWallets: ConnectedWallet[]): TokenWithBalance[];
|
|
24
|
-
export declare function getSortedTokens(chain: BlockchainMeta | null, tokens: Token[], connectedWallets: ConnectedWallet[], otherChainTokens: TokenWithBalance[]): TokenWithBalance[];
|
|
25
|
-
export declare function tokensAreEqual(tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null, tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null): boolean;
|
|
26
|
-
export declare function getDefaultToken(sortedTokens: TokenWithBalance[], otherToken: TokenWithBalance | null): TokenWithBalance;
|
|
27
|
-
export declare function sortWalletsBasedOnState(wallets: ModalWalletInfo[]): ModalWalletInfo[];
|
|
1
|
+
import { Network, WalletState, WalletType, WalletInfo, WalletTypes } from '@rango-dev/wallets-shared';
|
|
2
|
+
import { WalletInfo as ModalWalletInfo, WalletState as WalletStatus, SelectableWallet } from '@rango-dev/ui';
|
|
3
|
+
import { BestRouteResponse, BlockchainMeta, Token, WalletDetail } from 'rango-sdk';
|
|
4
|
+
import { ConnectedWallet, TokenBalance } from '../store/wallets';
|
|
5
|
+
import { TokenWithBalance } from '../pages/SelectTokenPage';
|
|
6
|
+
import { Wallet } from '../types';
|
|
7
|
+
export declare function getStateWallet(state: WalletState): WalletStatus;
|
|
8
|
+
export declare const excludedWallets: WalletTypes[];
|
|
9
|
+
export declare function getlistWallet(getState: (type: WalletType) => WalletState, getWalletInfo: (type: WalletType) => WalletInfo, list: WalletType[]): ModalWalletInfo[];
|
|
10
|
+
export declare function walletAndSupportedChainsNames(supportedChains: BlockchainMeta[]): Network[] | null;
|
|
11
|
+
export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null): Wallet[];
|
|
12
|
+
export declare function getRequiredChains(route: BestRouteResponse | null): string[];
|
|
13
|
+
export declare function getSelectableWallets(connectedWallets: ConnectedWallet[], selectedWallets: Wallet[], getWalletInfo: (type: WalletType) => WalletInfo): SelectableWallet[];
|
|
14
|
+
export declare function getBalanceFromWallet(connectedWallets: ConnectedWallet[], chain: string, symbol: string, address: string | null): TokenBalance | null;
|
|
15
|
+
export declare function isAccountAndWalletMatched(account: Wallet, connectedWallet: ConnectedWallet): boolean;
|
|
16
|
+
export declare function makeBalanceFor(wallet: Wallet, retrivedBalance: WalletDetail, tokens: Token[]): ConnectedWallet;
|
|
17
|
+
export declare function resetConnectedWalletState(connectedWallet: ConnectedWallet): ConnectedWallet;
|
|
18
|
+
export declare const calculateWalletUsdValue: (connectedWallet: ConnectedWallet[]) => string;
|
|
19
|
+
export declare const sortTokens: (tokens: TokenWithBalance[]) => TokenWithBalance[];
|
|
20
|
+
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
21
|
+
export declare const isExperimentalChain: (blockchains: BlockchainMeta[], wallet: string) => boolean;
|
|
22
|
+
export declare const getKeplrCompatibleConnectedWallets: (selectableWallets: SelectableWallet[]) => WalletType[];
|
|
23
|
+
export declare function getTokensWithBalance(tokens: TokenWithBalance[], connectedWallets: ConnectedWallet[]): TokenWithBalance[];
|
|
24
|
+
export declare function getSortedTokens(chain: BlockchainMeta | null, tokens: Token[], connectedWallets: ConnectedWallet[], otherChainTokens: TokenWithBalance[]): TokenWithBalance[];
|
|
25
|
+
export declare function tokensAreEqual(tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null, tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null): boolean;
|
|
26
|
+
export declare function getDefaultToken(sortedTokens: TokenWithBalance[], otherToken: TokenWithBalance | null): TokenWithBalance;
|
|
27
|
+
export declare function sortWalletsBasedOnState(wallets: ModalWalletInfo[]): ModalWalletInfo[];
|
|
28
28
|
//# sourceMappingURL=wallets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.d.ts","sourceRoot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gB,cAAc,CAC5B,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG,IAAI,EAC/D,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG,IAAI,WAOhE;AAED,wBAAgB,eAAe,CAC7B,YAAY,EAAE,gBAAgB,EAAE,EAChC,UAAU,EAAE,gBAAgB,GAAG,IAAI,GAClC,gBAAgB,CAQlB;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,eAAe,EAAE,GACzB,eAAe,EAAE,CAcnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20-next.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"typings": "dist/index.d.ts",
|
|
7
8
|
"files": [
|
|
@@ -10,7 +11,8 @@
|
|
|
10
11
|
],
|
|
11
12
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
12
13
|
"scripts": {
|
|
13
|
-
"build": "
|
|
14
|
+
"build": "node ../../scripts/build/command.mjs --path widget/embedded",
|
|
15
|
+
"clean": "rimraf dist"
|
|
14
16
|
},
|
|
15
17
|
"husky": {
|
|
16
18
|
"hooks": {
|
|
@@ -24,13 +26,13 @@
|
|
|
24
26
|
"trailingComma": "es5"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@rango-dev/provider-all": "^0.1.
|
|
28
|
-
"@rango-dev/queue-manager-core": "^0.1.
|
|
29
|
-
"@rango-dev/queue-manager-rango-preset": "^0.1.
|
|
30
|
-
"@rango-dev/queue-manager-react": "^0.1.
|
|
31
|
-
"@rango-dev/ui": "^0.1.
|
|
32
|
-
"@rango-dev/wallets-core": "^0.1.
|
|
33
|
-
"@rango-dev/wallets-shared": "^0.1.
|
|
29
|
+
"@rango-dev/provider-all": "^0.1.22-next.0",
|
|
30
|
+
"@rango-dev/queue-manager-core": "^0.1.15-next.1",
|
|
31
|
+
"@rango-dev/queue-manager-rango-preset": "^0.1.15-next.0",
|
|
32
|
+
"@rango-dev/queue-manager-react": "^0.1.14-next.0",
|
|
33
|
+
"@rango-dev/ui": "^0.1.16-next.0",
|
|
34
|
+
"@rango-dev/wallets-core": "^0.1.16-next.1",
|
|
35
|
+
"@rango-dev/wallets-shared": "^0.1.14",
|
|
34
36
|
"bignumber.js": "^9.1.1",
|
|
35
37
|
"copy-to-clipboard": "^3.3.3",
|
|
36
38
|
"dayjs": "^1.11.7",
|
|
@@ -42,13 +44,15 @@
|
|
|
42
44
|
"parcel": "^2.8.0",
|
|
43
45
|
"rango-sdk": "^0.1.27",
|
|
44
46
|
"rango-types": "^0.1.32",
|
|
45
|
-
"react": "^18.2.0",
|
|
46
|
-
"react-dom": "^18.2.0",
|
|
47
47
|
"react-i18next": "^12.2.0",
|
|
48
48
|
"react-router-dom": "^6.8.0",
|
|
49
49
|
"values.js": "2.1.1",
|
|
50
50
|
"zustand": "^4.3.2"
|
|
51
51
|
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": ">=16",
|
|
54
|
+
"react-dom": ">=16"
|
|
55
|
+
},
|
|
52
56
|
"publishConfig": {
|
|
53
57
|
"access": "public"
|
|
54
58
|
}
|
package/src/QueueManager.tsx
CHANGED
|
@@ -52,11 +52,14 @@ function QueueManager(props: PropsWithChildren<{}>) {
|
|
|
52
52
|
return connect(wallet, network);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
const isMobileWallet = (walletType: WalletType): boolean =>
|
|
56
|
+
!!getWalletInfo(walletType).mobileWallet;
|
|
57
|
+
|
|
55
58
|
// TODO: this code copy & pasted from rango, should be refactored.
|
|
56
59
|
const allBlockchains = blockchains
|
|
57
60
|
.filter((blockchain) => blockchain.enabled)
|
|
58
61
|
.reduce(
|
|
59
|
-
(blockchainsObj, blockchain) => (
|
|
62
|
+
(blockchainsObj: any, blockchain) => (
|
|
60
63
|
(blockchainsObj[blockchain.name] = blockchain), blockchainsObj
|
|
61
64
|
),
|
|
62
65
|
{}
|
|
@@ -106,6 +109,7 @@ function QueueManager(props: PropsWithChildren<{}>) {
|
|
|
106
109
|
switchNetwork,
|
|
107
110
|
connect,
|
|
108
111
|
state,
|
|
112
|
+
isMobileWallet,
|
|
109
113
|
notifier,
|
|
110
114
|
};
|
|
111
115
|
|
|
@@ -15,12 +15,7 @@ import { Layout } from './components/Layout';
|
|
|
15
15
|
import { globalFont } from './globalStyles';
|
|
16
16
|
import { useTheme } from './hooks/useTheme';
|
|
17
17
|
import { isEvmBlockchain } from 'rango-sdk';
|
|
18
|
-
import {
|
|
19
|
-
WidgetTheme,
|
|
20
|
-
WidgetConfig,
|
|
21
|
-
WidgetColors,
|
|
22
|
-
BlockchainAndTokenConfig,
|
|
23
|
-
} from './types';
|
|
18
|
+
import { WidgetConfig } from './types';
|
|
24
19
|
import useSelectLanguage from './hooks/useSelectLanguage';
|
|
25
20
|
import './i18n';
|
|
26
21
|
import QueueManager from './QueueManager';
|
|
@@ -28,14 +23,6 @@ import { useUiStore } from './store/ui';
|
|
|
28
23
|
import { navigationRoutes } from './constants/navigationRoutes';
|
|
29
24
|
import { initConfig } from './utils/configs';
|
|
30
25
|
|
|
31
|
-
export {
|
|
32
|
-
WidgetConfig,
|
|
33
|
-
WalletType,
|
|
34
|
-
WidgetTheme,
|
|
35
|
-
WidgetColors,
|
|
36
|
-
BlockchainAndTokenConfig,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
26
|
export type WidgetProps = {
|
|
40
27
|
config?: WidgetConfig;
|
|
41
28
|
};
|
|
@@ -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',
|
|
@@ -34,6 +34,11 @@ const Header = styled('div', {
|
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
const WalletImages = styled('div', {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
paddingLeft: '12px',
|
|
40
|
+
});
|
|
41
|
+
|
|
37
42
|
const WalletImageContainer = styled('div', {
|
|
38
43
|
marginLeft: -15,
|
|
39
44
|
marginRight: '$6',
|
|
@@ -52,7 +57,7 @@ export function Layout({ config }: LayoutProps) {
|
|
|
52
57
|
const { getWalletInfo } = useWallets();
|
|
53
58
|
const connectedWalletsImages = removeDuplicateFrom(
|
|
54
59
|
getSelectableWallets(connectedWallets, selectedWallets, getWalletInfo).map(
|
|
55
|
-
|
|
60
|
+
w => w.image
|
|
56
61
|
)
|
|
57
62
|
);
|
|
58
63
|
const { blockchains, tokens } = useMetaStore.use.meta();
|
|
@@ -64,8 +69,7 @@ export function Layout({ config }: LayoutProps) {
|
|
|
64
69
|
const setAffiliateRef = useSettingsStore.use.setAffiliateRef();
|
|
65
70
|
|
|
66
71
|
const totalBalance = calculateWalletUsdValue(connectedWallets);
|
|
67
|
-
const connectWalletsButtonDisabled =
|
|
68
|
-
useUiStore.use.connectWalletsButtonDisabled();
|
|
72
|
+
const connectWalletsButtonDisabled = useUiStore.use.connectWalletsButtonDisabled();
|
|
69
73
|
const loadingMetaStatus = useMetaStore.use.loadingStatus();
|
|
70
74
|
const fetchingBalance = useWalletsStore(fetchingBalanceSelector);
|
|
71
75
|
|
|
@@ -73,9 +77,9 @@ export function Layout({ config }: LayoutProps) {
|
|
|
73
77
|
useEffect(() => {
|
|
74
78
|
if (loadingMetaStatus === 'success') {
|
|
75
79
|
const chain = blockchains.find(
|
|
76
|
-
|
|
80
|
+
chain => chain.name === config?.to?.blockchain
|
|
77
81
|
);
|
|
78
|
-
const token = tokens.find(
|
|
82
|
+
const token = tokens.find(t =>
|
|
79
83
|
tokensAreEqual(t, config?.to?.token || null)
|
|
80
84
|
);
|
|
81
85
|
setToChain(chain || null);
|
|
@@ -90,9 +94,9 @@ export function Layout({ config }: LayoutProps) {
|
|
|
90
94
|
useEffect(() => {
|
|
91
95
|
if (loadingMetaStatus === 'success') {
|
|
92
96
|
const chain = blockchains.find(
|
|
93
|
-
|
|
97
|
+
chain => chain.name === config?.from?.blockchain
|
|
94
98
|
);
|
|
95
|
-
const token = tokens.find(
|
|
99
|
+
const token = tokens.find(t =>
|
|
96
100
|
tokensAreEqual(t, config?.from?.token || null)
|
|
97
101
|
);
|
|
98
102
|
|
|
@@ -118,16 +122,18 @@ export function Layout({ config }: LayoutProps) {
|
|
|
118
122
|
if (!connectWalletsButtonDisabled)
|
|
119
123
|
navigate(navigationRoutes.wallets);
|
|
120
124
|
}}
|
|
125
|
+
prefix={
|
|
126
|
+
connectedWalletsImages?.length ? (
|
|
127
|
+
<WalletImages>
|
|
128
|
+
{connectedWalletsImages.map((walletImage, index) => (
|
|
129
|
+
<WalletImageContainer key={index}>
|
|
130
|
+
<Image src={walletImage} size={24} />
|
|
131
|
+
</WalletImageContainer>
|
|
132
|
+
))}
|
|
133
|
+
</WalletImages>
|
|
134
|
+
) : null
|
|
135
|
+
}
|
|
121
136
|
>
|
|
122
|
-
{connectedWalletsImages?.length ? (
|
|
123
|
-
connectedWalletsImages.map((walletImage, index) => (
|
|
124
|
-
<WalletImageContainer key={index}>
|
|
125
|
-
<Image src={walletImage} size={24} />
|
|
126
|
-
</WalletImageContainer>
|
|
127
|
-
))
|
|
128
|
-
) : (
|
|
129
|
-
<></>
|
|
130
|
-
)}
|
|
131
137
|
<div className="balance">
|
|
132
138
|
<Typography variant="body2">
|
|
133
139
|
{!connectedWallets?.length
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { styled, ChevronRightIcon, GasIcon,
|
|
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
|
-
<
|
|
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
|
-
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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 {
|
|
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
|
|
17
17
|
{minRequiredSlippage}
|
|
18
18
|
for this route.
|
|
19
|
-
<
|
|
19
|
+
<Divider size={8}/>
|
|
20
20
|
<ChangeSlippageButton />
|
|
21
21
|
</StyledMessage>
|
|
22
22
|
);
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WidgetTheme,
|
|
3
|
+
WidgetConfig,
|
|
4
|
+
WidgetColors,
|
|
5
|
+
BlockchainAndTokenConfig,
|
|
6
|
+
} from './types';
|
|
7
|
+
import { WidgetProps, Widget } from './Widget';
|
|
8
|
+
import { WalletType } from '@rango-dev/wallets-shared';
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
WidgetConfig,
|
|
12
|
+
WalletType,
|
|
13
|
+
WidgetTheme,
|
|
14
|
+
WidgetColors,
|
|
15
|
+
BlockchainAndTokenConfig,
|
|
16
|
+
WidgetProps,
|
|
17
|
+
};
|
|
18
|
+
export { Widget };
|
|
@@ -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 {
|
|
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
|
-
|
|
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(
|
|
76
|
-
selectedWallets.map(
|
|
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(
|
|
98
|
-
|
|
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
|
|
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={
|
|
133
|
+
onChange={wallet => setSelectedWallet(wallet)}
|
|
132
134
|
confirmDisabled={loadingMetaStatus !== 'success' || confirmDisabled}
|
|
133
|
-
handleConnectChain={
|
|
134
|
-
isExperimentalChain={
|
|
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
|
-
<
|
|
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
|
-
<
|
|
205
|
+
<Divider />
|
|
204
206
|
)}
|
|
205
207
|
{showHighSlippageWarning && (
|
|
206
208
|
<ConfirmSwapExtraMessages selectedSlippage={selectedSlippage} />
|