@rango-dev/widget-embedded 0.1.18 → 0.1.20-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/QueueManager.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/Layout.d.ts.map +1 -1
- package/dist/components/RoutesOverview.d.ts +111 -1
- package/dist/components/RoutesOverview.d.ts.map +1 -1
- package/dist/components/SwapDetailsPlaceholder.d.ts +111 -1
- package/dist/components/SwapDetailsPlaceholder.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +43 -40
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +43 -40
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +45 -37
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +12 -10
- package/src/QueueManager.tsx +4 -0
- 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.tsx +1 -7
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletState, InfoCircleIcon, Typography, Button, Image,
|
|
1
|
+
import { WalletState, InfoCircleIcon, Typography, Button, Image, Divider, styled, ChevronRightIcon, GasIcon, Alert, ConfirmSwap, LoadingFailedAlert, History, AngleDownIcon, TextField, Tooltip, RetryIcon, HistoryIcon, SettingsIcon, Header as Header$1, VerticalSwapIcon, BestRoute, LiquiditySourcesSelector, BlockchainSelector, TokenSelector, Settings, SecondaryPage, Spinner, Wallet, useCopyToClipboard, SwapHistory, AddWalletIcon, globalCss, generateRangeColors, createTheme, SwapContainer } from '@rango-dev/ui';
|
|
2
2
|
import React, { useRef, useEffect, Fragment, useState, useLayoutEffect, useMemo } from 'react';
|
|
3
3
|
import { useInRouterContext, MemoryRouter } from 'react-router';
|
|
4
4
|
import { PendingSwapNetworkStatus, useQueueManager, calculatePendingSwap, getCurrentStep, getCurrentBlockchainOfOrNull, getRelatedWalletOrNull, cancelSwap, makeQueueDefinition, checkWaitingForNetworkChange } from '@rango-dev/queue-manager-rango-preset';
|
|
@@ -8,8 +8,7 @@ import { create } from 'zustand';
|
|
|
8
8
|
import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
|
|
9
9
|
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
|
10
10
|
import { RangoClient, isEvmBlockchain as isEvmBlockchain$1 } from 'rango-sdk';
|
|
11
|
-
import { Network, isEvmAddress, KEPLR_COMPATIBLE_WALLETS, detectInstallLink,
|
|
12
|
-
export { WalletType } from '@rango-dev/wallets-shared';
|
|
11
|
+
import { Network, isEvmAddress, KEPLR_COMPATIBLE_WALLETS, detectInstallLink, WalletTypes, getCosmosExperimentalChainInfo, detectMobileScreens, convertEvmBlockchainMetaToEvmChainInfo } from '@rango-dev/wallets-shared';
|
|
13
12
|
import { readAccountAddress, useWallets, Provider as Provider$1, Events } from '@rango-dev/wallets-core';
|
|
14
13
|
import { shallow } from 'zustand/shallow';
|
|
15
14
|
import { allProviders } from '@rango-dev/provider-all';
|
|
@@ -292,7 +291,7 @@ function getStateWallet(state) {
|
|
|
292
291
|
return WalletState.DISCONNECTED;
|
|
293
292
|
}
|
|
294
293
|
}
|
|
295
|
-
const excludedWallets = [
|
|
294
|
+
const excludedWallets = [WalletTypes.LEAP];
|
|
296
295
|
function getlistWallet(getState, getWalletInfo, list) {
|
|
297
296
|
return list.filter(wallet => !excludedWallets.includes(wallet)).map(type => {
|
|
298
297
|
const {
|
|
@@ -475,7 +474,9 @@ const isExperimentalChain = (blockchains, wallet) => {
|
|
|
475
474
|
return cosmosExperimentalChainInfo && !!cosmosExperimentalChainInfo[wallet];
|
|
476
475
|
};
|
|
477
476
|
const getKeplrCompatibleConnectedWallets = selectableWallets => {
|
|
478
|
-
const connectedWalletTypes = new Set(selectableWallets.map(
|
|
477
|
+
const connectedWalletTypes = new Set(selectableWallets.map(wallet => {
|
|
478
|
+
return wallet.walletType;
|
|
479
|
+
}));
|
|
479
480
|
return KEPLR_COMPATIBLE_WALLETS.filter(compatibleWallet => connectedWalletTypes.has(compatibleWallet));
|
|
480
481
|
};
|
|
481
482
|
function getTokensWithBalance(tokens, connectedWallets) {
|
|
@@ -1439,8 +1440,9 @@ function TokenPreview(props) {
|
|
|
1439
1440
|
suffix: ItemSuffix,
|
|
1440
1441
|
align: "start",
|
|
1441
1442
|
size: "large"
|
|
1442
|
-
}, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(
|
|
1443
|
-
size: 12
|
|
1443
|
+
}, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Divider, {
|
|
1444
|
+
size: 12,
|
|
1445
|
+
direction: "horizontal"
|
|
1444
1446
|
}), React.createElement(Button, {
|
|
1445
1447
|
className: "selectors",
|
|
1446
1448
|
variant: "outlined",
|
|
@@ -1452,8 +1454,9 @@ function TokenPreview(props) {
|
|
|
1452
1454
|
suffix: ItemSuffix,
|
|
1453
1455
|
size: "large",
|
|
1454
1456
|
align: "start"
|
|
1455
|
-
}, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(
|
|
1456
|
-
size: 12
|
|
1457
|
+
}, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Divider, {
|
|
1458
|
+
size: 12,
|
|
1459
|
+
direction: "horizontal"
|
|
1457
1460
|
}), React.createElement("div", {
|
|
1458
1461
|
className: "amount"
|
|
1459
1462
|
}, React.createElement(OutputContainer, null, React.createElement(Typography, {
|
|
@@ -1499,8 +1502,9 @@ function RoutesOverview(props) {
|
|
|
1499
1502
|
className: "fee"
|
|
1500
1503
|
}, React.createElement(GasIcon, {
|
|
1501
1504
|
size: 12
|
|
1502
|
-
}), React.createElement(
|
|
1503
|
-
size: 4
|
|
1505
|
+
}), React.createElement(Divider, {
|
|
1506
|
+
size: 4,
|
|
1507
|
+
direction: "horizontal"
|
|
1504
1508
|
}), "$", props.totalFee) : null);
|
|
1505
1509
|
}
|
|
1506
1510
|
|
|
@@ -1671,9 +1675,8 @@ function MinRequiredSlippage(_ref) {
|
|
|
1671
1675
|
} = _ref;
|
|
1672
1676
|
return React.createElement(StyledMessage, {
|
|
1673
1677
|
variant: "body2"
|
|
1674
|
-
}, "We recommend you to increase slippage to at least \u00A0", minRequiredSlippage, "\u00A0 for this route.", React.createElement(
|
|
1675
|
-
size: 8
|
|
1676
|
-
direction: "vertical"
|
|
1678
|
+
}, "We recommend you to increase slippage to at least \u00A0", minRequiredSlippage, "\u00A0 for this route.", React.createElement(Divider, {
|
|
1679
|
+
size: 8
|
|
1677
1680
|
}), React.createElement(ChangeSlippageButton, null));
|
|
1678
1681
|
}
|
|
1679
1682
|
|
|
@@ -1710,9 +1713,8 @@ function BalanceErrors(_ref) {
|
|
|
1710
1713
|
className: "title",
|
|
1711
1714
|
variant: "title",
|
|
1712
1715
|
color: 'error'
|
|
1713
|
-
}, "Insufficent Balance:"), React.createElement(
|
|
1714
|
-
size: 8
|
|
1715
|
-
direction: "vertical"
|
|
1716
|
+
}, "Insufficent Balance:"), React.createElement(Divider, {
|
|
1717
|
+
size: 8
|
|
1716
1718
|
}), React.createElement(List, {
|
|
1717
1719
|
showListStyle: showListStyle
|
|
1718
1720
|
}, messages.map((warning, index) => React.createElement(ListItem, {
|
|
@@ -1894,9 +1896,8 @@ function ConfirmSwapPage() {
|
|
|
1894
1896
|
amount: fromAmount,
|
|
1895
1897
|
label: t('From'),
|
|
1896
1898
|
loadingStatus: loadingMetaStatus !== 'success' ? loadingMetaStatus : bestRouteloadingStatus
|
|
1897
|
-
}), React.createElement(
|
|
1898
|
-
size: 12
|
|
1899
|
-
direction: "vertical"
|
|
1899
|
+
}), React.createElement(Divider, {
|
|
1900
|
+
size: 12
|
|
1900
1901
|
}), React.createElement(TokenPreview, {
|
|
1901
1902
|
chain: {
|
|
1902
1903
|
displayName: lastStep?.to.blockchain || '',
|
|
@@ -1922,9 +1923,7 @@ function ConfirmSwapPage() {
|
|
|
1922
1923
|
loading: fetchingConfirmedRoute,
|
|
1923
1924
|
errors: dbErrorMessage ? [dbErrorMessage, ...ConfirmSwapErrors(errors)] : ConfirmSwapErrors(errors),
|
|
1924
1925
|
warnings: ConfirmSwapWarnings(warnings),
|
|
1925
|
-
extraMessages: React.createElement(React.Fragment, null, loadingMetaStatus === 'failed' && React.createElement(LoadingFailedAlert, null), loadingMetaStatus === 'failed' && showHighSlippageWarning && React.createElement(
|
|
1926
|
-
direction: "vertical"
|
|
1927
|
-
}), showHighSlippageWarning && React.createElement(ConfirmSwapExtraMessages, {
|
|
1926
|
+
extraMessages: React.createElement(React.Fragment, null, loadingMetaStatus === 'failed' && React.createElement(LoadingFailedAlert, null), loadingMetaStatus === 'failed' && showHighSlippageWarning && React.createElement(Divider, null), showHighSlippageWarning && React.createElement(ConfirmSwapExtraMessages, {
|
|
1928
1927
|
selectedSlippage: selectedSlippage
|
|
1929
1928
|
})),
|
|
1930
1929
|
confirmButtonTitle: warnings.length > 0 || errors.length > 0 ? 'Proceed anyway!' : 'Confirm swap!'
|
|
@@ -2128,7 +2127,7 @@ function TokenInfo(props) {
|
|
|
2128
2127
|
}, React.createElement(Typography, {
|
|
2129
2128
|
variant: "body3",
|
|
2130
2129
|
color: "neutral600"
|
|
2131
|
-
}, `${t('Balance')}: ${tokenBalance} ${fromToken?.symbol || ''}`), React.createElement(
|
|
2130
|
+
}, `${t('Balance')}: ${tokenBalance} ${fromToken?.symbol || ''}`), React.createElement(Divider, {
|
|
2132
2131
|
size: 4
|
|
2133
2132
|
}), React.createElement(Button, {
|
|
2134
2133
|
type: "primary",
|
|
@@ -2159,8 +2158,9 @@ function TokenInfo(props) {
|
|
|
2159
2158
|
suffix: ItemSuffix,
|
|
2160
2159
|
align: "start",
|
|
2161
2160
|
size: "large"
|
|
2162
|
-
}, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(
|
|
2163
|
-
size: 12
|
|
2161
|
+
}, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Divider, {
|
|
2162
|
+
size: 12,
|
|
2163
|
+
direction: "horizontal"
|
|
2164
2164
|
}), React.createElement(Button, {
|
|
2165
2165
|
className: "selectors",
|
|
2166
2166
|
onClick: () => {
|
|
@@ -2176,8 +2176,9 @@ function TokenInfo(props) {
|
|
|
2176
2176
|
suffix: ItemSuffix,
|
|
2177
2177
|
size: "large",
|
|
2178
2178
|
align: "start"
|
|
2179
|
-
}, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(
|
|
2180
|
-
size: 12
|
|
2179
|
+
}, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Divider, {
|
|
2180
|
+
size: 12,
|
|
2181
|
+
direction: "horizontal"
|
|
2181
2182
|
}), React.createElement("div", {
|
|
2182
2183
|
className: "amount"
|
|
2183
2184
|
}, props.type === 'From' ? React.createElement(TextField, {
|
|
@@ -2639,7 +2640,7 @@ function WalletsPage(_ref) {
|
|
|
2639
2640
|
getWalletInfo,
|
|
2640
2641
|
connect
|
|
2641
2642
|
} = useWallets();
|
|
2642
|
-
const wallets = getlistWallet(state, getWalletInfo, supportedWallets || Object.values(
|
|
2643
|
+
const wallets = getlistWallet(state, getWalletInfo, supportedWallets || Object.values(WalletTypes));
|
|
2643
2644
|
const walletsRef = useRef();
|
|
2644
2645
|
let sortedWallets = detectMobileScreens() ? wallets.filter(wallet => wallet.showOnMobile) : wallets;
|
|
2645
2646
|
sortedWallets = sortWalletsBasedOnState(sortedWallets);
|
|
@@ -2828,7 +2829,7 @@ function SwapDetailsPage() {
|
|
|
2828
2829
|
label={t('From')}
|
|
2829
2830
|
loadingStatus={'success'}
|
|
2830
2831
|
/>
|
|
2831
|
-
<
|
|
2832
|
+
<Divider size={12} />
|
|
2832
2833
|
<TokenPreview
|
|
2833
2834
|
chain={{
|
|
2834
2835
|
displayName: lastStep?.toBlockchain || '',
|
|
@@ -2940,6 +2941,10 @@ const Header = /*#__PURE__*/styled('div', {
|
|
|
2940
2941
|
display: 'flex'
|
|
2941
2942
|
}
|
|
2942
2943
|
});
|
|
2944
|
+
const WalletImages = /*#__PURE__*/styled('div', {
|
|
2945
|
+
display: 'flex',
|
|
2946
|
+
paddingLeft: '12px'
|
|
2947
|
+
});
|
|
2943
2948
|
const WalletImageContainer = /*#__PURE__*/styled('div', {
|
|
2944
2949
|
marginLeft: -15,
|
|
2945
2950
|
marginRight: '$6',
|
|
@@ -3010,13 +3015,14 @@ function Layout(_ref) {
|
|
|
3010
3015
|
disabled: loadingMetaStatus === 'failed',
|
|
3011
3016
|
onClick: () => {
|
|
3012
3017
|
if (!connectWalletsButtonDisabled) navigate(navigationRoutes.wallets);
|
|
3013
|
-
}
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3018
|
+
},
|
|
3019
|
+
prefix: connectedWalletsImages?.length ? React.createElement(WalletImages, null, connectedWalletsImages.map((walletImage, index) => React.createElement(WalletImageContainer, {
|
|
3020
|
+
key: index
|
|
3021
|
+
}, React.createElement(Image, {
|
|
3022
|
+
src: walletImage,
|
|
3023
|
+
size: 24
|
|
3024
|
+
})))) : null
|
|
3025
|
+
}, React.createElement("div", {
|
|
3020
3026
|
className: "balance"
|
|
3021
3027
|
}, React.createElement(Typography, {
|
|
3022
3028
|
variant: "body2"
|
|
@@ -3249,6 +3255,7 @@ function QueueManager(props) {
|
|
|
3249
3255
|
}
|
|
3250
3256
|
return connect(wallet, network);
|
|
3251
3257
|
};
|
|
3258
|
+
const isMobileWallet = walletType => !!getWalletInfo(walletType).mobileWallet;
|
|
3252
3259
|
// TODO: this code copy & pasted from rango, should be refactored.
|
|
3253
3260
|
const allBlockchains = blockchains.filter(blockchain => blockchain.enabled).reduce((blockchainsObj, blockchain) => (blockchainsObj[blockchain.name] = blockchain, blockchainsObj), {});
|
|
3254
3261
|
const evmBasedChains = blockchains.filter(isEvmBlockchain$1);
|
|
@@ -3285,6 +3292,7 @@ function QueueManager(props) {
|
|
|
3285
3292
|
switchNetwork,
|
|
3286
3293
|
connect,
|
|
3287
3294
|
state,
|
|
3295
|
+
isMobileWallet,
|
|
3288
3296
|
notifier
|
|
3289
3297
|
};
|
|
3290
3298
|
return React.createElement(Provider, {
|