- );
-}
diff --git a/src/app/components/WhitelistedNotification/Loadable.tsx b/src/app/components/WhitelistedNotification/Loadable.tsx
new file mode 100644
index 000000000..52bab513b
--- /dev/null
+++ b/src/app/components/WhitelistedNotification/Loadable.tsx
@@ -0,0 +1,12 @@
+/**
+ *
+ * Asynchronously loads the component for WhitelistedNotification
+ *
+ */
+
+import { lazyLoad } from 'utils/loadable';
+
+export const WhitelistedNotification = lazyLoad(
+ () => import('./index'),
+ module => module.WhitelistedNotification,
+);
diff --git a/src/app/components/WhitelistedNotification/index.tsx b/src/app/components/WhitelistedNotification/index.tsx
new file mode 100644
index 000000000..9143d9eac
--- /dev/null
+++ b/src/app/components/WhitelistedNotification/index.tsx
@@ -0,0 +1,24 @@
+import React from 'react';
+import { useIsWhitelisted } from '../../hooks/whitelist/useIsWhitelisted';
+import { Icon } from '@blueprintjs/core/lib/esm/components/icon/icon';
+
+export function WhitelistedNotification() {
+ const isWhitelisted = useIsWhitelisted();
+
+ if (isWhitelisted) return <>>;
+
+ return (
+
+
+
+
+
+
+ Currently Sovryn is available for invited users only and your wallet
+ is not yet whitelisted. All interactions is disabled until you switch
+ to whitelisted wallet or get whitelisted for current one.
+
+
+
+ );
+}
diff --git a/src/app/containers/LendBorrowSovryn/BorrowingContainer/index.tsx b/src/app/containers/LendBorrowSovryn/BorrowingContainer/index.tsx
index 7e6596f7f..783a31f38 100644
--- a/src/app/containers/LendBorrowSovryn/BorrowingContainer/index.tsx
+++ b/src/app/containers/LendBorrowSovryn/BorrowingContainer/index.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
+import { useDispatch } from 'react-redux';
import { useAssetBalanceOf } from '../../../hooks/useAssetBalanceOf';
-import { useIsConnected } from '../../../hooks/useAccount';
import { useWeiAmount } from '../../../hooks/useWeiAmount';
import { useApproveAndBorrow } from '../../../hooks/trading/useApproveAndBorrow';
import { useIsAmountWithinLimits } from '../../../hooks/useIsAmountWithinLimits';
@@ -17,8 +17,8 @@ import { weiTo4 } from '../../../../utils/blockchain/math-helpers';
import { TradeButton } from '../../../components/TradeButton';
import { SendTxProgress } from '../../../components/SendTxProgress';
import { bignumber } from 'mathjs';
-import { useDispatch } from 'react-redux';
import { actions } from '../slice';
+import { useCanInteract } from '../../../hooks/useCanInteract';
type Props = {
currency: Asset;
@@ -27,7 +27,7 @@ type Props = {
const BorrowingContainer: React.FC = ({ currency }) => {
const dispatch = useDispatch();
const [amount, setAmount] = useState('');
- const isConnected = useIsConnected();
+ const isConnected = useCanInteract();
const borrowAmount = useWeiAmount(amount);
// BORROW
diff --git a/src/app/containers/LiquidityAddContainer/index.tsx b/src/app/containers/LiquidityAddContainer/index.tsx
index 6d33749b2..8751ded22 100644
--- a/src/app/containers/LiquidityAddContainer/index.tsx
+++ b/src/app/containers/LiquidityAddContainer/index.tsx
@@ -20,12 +20,12 @@ import { AmountField } from '../AmountField';
import { AssetWalletBalance } from '../../components/AssetWalletBalance';
import { TradeButton } from '../../components/TradeButton';
import { useAssetBalanceOf } from '../../hooks/useAssetBalanceOf';
-import { useIsConnected } from '../../hooks/useAccount';
+import { useCanInteract } from '../../hooks/useCanInteract';
interface Props {}
export function LiquidityAddContainer(props: Props) {
- const isConnected = useIsConnected();
+ const isConnected = useCanInteract();
const tokens = liquidityPools.map(item => ({
key: item.source,
target: item.target,
diff --git a/src/app/containers/LiquidityRemoveContainer/index.tsx b/src/app/containers/LiquidityRemoveContainer/index.tsx
index 895625555..6ece230be 100644
--- a/src/app/containers/LiquidityRemoveContainer/index.tsx
+++ b/src/app/containers/LiquidityRemoveContainer/index.tsx
@@ -23,13 +23,13 @@ import { useRemoveLiquidityReturnAndFee } from '../../hooks/amm/useRemoveLiquidi
import { FieldGroup } from '../../components/FieldGroup';
import { AmountField } from '../AmountField';
import { TradeButton } from '../../components/TradeButton';
-import { useIsConnected } from '../../hooks/useAccount';
import { useApproveAndRemoveLiquidity } from '../../hooks/amm/useApproveAndRemoveLiquidity';
+import { useCanInteract } from 'app/hooks/useCanInteract';
interface Props {}
export function LiquidityRemoveContainer(props: Props) {
- const isConnected = useIsConnected();
+ const isConnected = useCanInteract();
const tokens = liquidityPools.map(item => ({
key: item.source,
label: item.tokenLabel,
diff --git a/src/app/containers/MarginTradeForm/index.tsx b/src/app/containers/MarginTradeForm/index.tsx
index 84f66531b..276349387 100644
--- a/src/app/containers/MarginTradeForm/index.tsx
+++ b/src/app/containers/MarginTradeForm/index.tsx
@@ -20,7 +20,6 @@ import { AmountField } from '../AmountField';
import { FormSelect } from '../../components/FormSelect';
import { FieldGroup } from '../../components/FieldGroup';
import { AssetWalletBalance } from '../../components/AssetWalletBalance';
-import { useIsConnected } from '../../hooks/useAccount';
import { TradeButton } from '../../components/TradeButton';
import { SendTxProgress } from '../../components/SendTxProgress';
import { useApproveAndTrade } from '../../hooks/trading/useApproveAndTrade';
@@ -28,13 +27,14 @@ import { useIsAmountWithinLimits } from '../../hooks/useIsAmountWithinLimits';
import { weiTo18 } from '../../../utils/blockchain/math-helpers';
import { useAssetBalanceOf } from '../../hooks/useAssetBalanceOf';
import { AssetsDictionary } from '../../../utils/blockchain/assets-dictionary';
+import { useCanInteract } from 'app/hooks/useCanInteract';
const s = translations.marginTradeForm;
interface Props {}
export function MarginTradeForm(props: Props) {
- const isConnected = useIsConnected();
+ const isConnected = useCanInteract();
const { tradingPair } = useSelector(selectTradingPage);
const pair = TradingPairDictionary.get(tradingPair);
diff --git a/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx b/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx
index f0a99f418..2ff78e285 100644
--- a/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx
+++ b/src/app/containers/RepayPositionHandler/RepayPositionForm.tsx
@@ -20,12 +20,14 @@ import { useAssetBalanceOf } from '../../hooks/useAssetBalanceOf';
import { weiTo18, weiTo4 } from '../../../utils/blockchain/math-helpers';
import { DummyField } from '../../components/DummyField';
import { useApproveAndCloseWithDeposit } from '../../hooks/trading/useApproveAndCloseWithDeposit';
+import { useCanInteract } from '../../hooks/useCanInteract';
interface Props {
loan: ActiveLoan;
}
export function RepayPositionForm({ loan }: Props) {
+ const canInteract = useCanInteract();
const { asset } = AssetsDictionary.getByTokenContractAddress(loan.loanToken);
const { value: balance } = useAssetBalanceOf(asset);
@@ -79,7 +81,7 @@ export function RepayPositionForm({ loan }: Props) {
send()}
/>
diff --git a/src/app/containers/SwapTradeForm/index.tsx b/src/app/containers/SwapTradeForm/index.tsx
index 1897be08f..c40a35d42 100644
--- a/src/app/containers/SwapTradeForm/index.tsx
+++ b/src/app/containers/SwapTradeForm/index.tsx
@@ -14,7 +14,6 @@ import { weiTo18, weiToFixed } from '../../../utils/blockchain/math-helpers';
import { TradeButton } from '../../components/TradeButton';
import { Asset } from '../../../types/asset';
import { useWeiAmount } from '../../hooks/useWeiAmount';
-import { useIsConnected } from '../../hooks/useAccount';
import { translations } from 'locales/i18n';
import { DummyField } from '../../components/DummyField';
import { LoadableValue } from '../../components/LoadableValue';
@@ -26,6 +25,7 @@ import { useSwapNetwork_approveAndConvertByPath } from '../../hooks/swap-network
import { SendTxProgress } from '../../components/SendTxProgress';
import { AssetWalletBalance } from '../../components/AssetWalletBalance';
import { useAssetBalanceOf } from '../../hooks/useAssetBalanceOf';
+import { useCanInteract } from '../../hooks/useCanInteract';
const s = translations.swapTradeForm;
@@ -39,7 +39,7 @@ const color = 'var(--teal)';
export function SwapTradeForm(props: Props) {
const { t } = useTranslation();
- const isConnected = useIsConnected();
+ const isConnected = useCanInteract();
const [amount, setAmount] = useState('');
const [sourceToken, setSourceToken] = useState(Asset.DOC);
diff --git a/src/app/containers/TopUpTradingPositionHandler/index.tsx b/src/app/containers/TopUpTradingPositionHandler/index.tsx
index dcfd4c014..533ffbecc 100644
--- a/src/app/containers/TopUpTradingPositionHandler/index.tsx
+++ b/src/app/containers/TopUpTradingPositionHandler/index.tsx
@@ -20,6 +20,7 @@ import { DialogButton } from '../../components/DialogButton';
import { AmountField } from '../AmountField';
import { DummyField } from '../../components/DummyField';
import { FieldGroup } from '../../components/FieldGroup';
+import { useCanInteract } from '../../hooks/useCanInteract';
interface Props {
item: ActiveLoan;
@@ -28,6 +29,7 @@ interface Props {
}
export function TopUpTradingPositionHandler(props: Props) {
+ const canInteract = useCanInteract();
const tokenDetails = AssetsDictionary.getByTokenContractAddress(
props.item.collateralToken,
);
@@ -94,7 +96,7 @@ export function TopUpTradingPositionHandler(props: Props) {
handleConfirm()}
- disabled={rest.loading || !valid}
+ disabled={rest.loading || !valid || !canInteract}
loading={rest.loading}
/>
diff --git a/src/app/containers/TradingToken/index.tsx b/src/app/containers/TradingToken/index.tsx
deleted file mode 100644
index 497f4bec2..000000000
--- a/src/app/containers/TradingToken/index.tsx
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- *
- * TradingToken
- *
- */
-import React, { useCallback, useEffect, useState } from 'react';
-import { Asset } from '../../../types/asset';
-import { LeverageSelector } from '../../components/LeverageSelector';
-import { TradingPosition } from '../../../types/trading-position';
-import { TradingPositionSelector } from '../../components/TradingPositionSelector';
-import { BorrowInterestRate } from '../../components/BorrowInterestRate';
-import { BorrowAssetPrice } from '../../components/BorrowAssetPrice';
-import { BorrowLiquidationPrice } from '../../components/BorrowLiquidationPrice';
-import { TradeDialog } from '../../components/TradeDialog';
-import { useWeiAmount } from '../../hooks/useWeiAmount';
-import btcIcon from 'assets/images/rBTC-logo.png';
-import { AssetsDictionary } from '../../../utils/blockchain/assets-dictionary';
-
-interface Props {
- marketToken: Asset;
-}
-
-/**
- * @deprecated
- * @param props
- * @constructor
- */
-export function TradingToken(props: Props) {
- const [position, setPosition] = useState(TradingPosition.LONG);
-
- const resolveLoanToken = useCallback(() => {
- if (position === TradingPosition.LONG) {
- return Asset.DOC;
- }
- return Asset.BTC;
- }, [position]);
-
- const [leverage, setLeverage] = useState(2);
- const [loanToken, setLoanToken] = useState(resolveLoanToken());
- const [collateral, setCollateral] = useState(
- AssetsDictionary.get(loanToken).getCollateralAssets()[0],
- );
-
- const [amount, setAmount] = useState('0');
- const weiAmount = useWeiAmount(amount);
-
- useEffect(() => {
- setLoanToken(resolveLoanToken());
- // eslint-disable-next-line
- }, [position]);
-
- return (
-