diff --git a/.github/workflows/pr-any.yml b/.github/workflows/pr-any.yml index 4eff72a9a3..5f2d26ea95 100644 --- a/.github/workflows/pr-any.yml +++ b/.github/workflows/pr-any.yml @@ -19,8 +19,8 @@ jobs: yarn install --frozen-lockfile yarn lint - test: - name: Test + ts-check: + name: ts-check runs-on: ubuntu-latest strategy: matrix: @@ -31,10 +31,10 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - name: test + - name: check run: | yarn install --frozen-lockfile - yarn test + yarn ts-check build_code: name: Build Code @@ -52,5 +52,3 @@ jobs: run: | yarn install --frozen-lockfile yarn build:dapp:production - -# yarn build:dashboard diff --git a/packages/apps/public/assets/websnark.js b/packages/apps/public/assets/websnark.js index 58a3bc6060..72ed0de356 100644 --- a/packages/apps/public/assets/websnark.js +++ b/packages/apps/public/assets/websnark.js @@ -5702,7 +5702,6 @@ object-assign triggerComponent(c) { this.log('Component Treiggered: ' + this.circuit.components[c].name); - // console.log("Start Component Treiggered: " + this.circuit.components[c].name); // Set notInitSignals to -1 to not initialize again this.notInitSignals[c]--; @@ -5723,7 +5722,6 @@ object-assign this.circuit.templates[template](this); this.scopes = oldScope; this.currentComponent = oldComponent; - // console.log("End Component Treiggered: " + this.circuit.components[c].name); } callFunction(functionName, params) { @@ -5943,7 +5941,6 @@ object-assign return S; }; const S = `[ ${lc2str(c[0])} ] * [ ${lc2str(c[1])} ] - [ ${lc2str(c[2])} ] = 0`; - console.log(S); } printConstraints() { diff --git a/packages/apps/src/configs/chains/chain-config.ts b/packages/apps/src/configs/chains/chain-config.ts index 46821a7cf2..a050bc80fe 100644 --- a/packages/apps/src/configs/chains/chain-config.ts +++ b/packages/apps/src/configs/chains/chain-config.ts @@ -1,5 +1,4 @@ // import ArbitrumLogo from '@webb-dapp/apps/configs/logos/chains/ArbitrumLogo'; -// import EdgewareLogo from '@webb-dapp/apps/configs/logos/chains/EdgewareLogo'; import GanacheLogo from '@webb-dapp/apps/configs/logos/chains/GanacheLogo'; // import HarmonyLogo from '@webb-dapp/apps/configs/logos/chains/HarmonyLogo'; // import OptimismLogo from '@webb-dapp/apps/configs/logos/chains/OptimismLogo'; @@ -33,39 +32,6 @@ export const chainsConfig: AppConfig['chains'] = { currencies: [WebbCurrencyId.WEBB, WebbCurrencyId.TEST], nativeCurrencyId: WebbCurrencyId.WEBB, }, - // this is the EVM edgeware - // [InternalChainId.EdgewareTestNet]: { - // chainType: ChainType.EVM, - // group: 'edgeware', - // tag: 'test', - // id: InternalChainId.EdgewareTestNet, - // chainId: EVMChainId.Beresheet, - // name: 'Beresheet (Edgeware Testnet)', - // url: 'wss://beresheet1.edgewa.re', - // evmRpcUrls: ['https://beresheet.edgewa.re/evm'], - // logo: EdgewareLogo, - // currencies: [WebbCurrencyId.TEDG], - // nativeCurrencyId: WebbCurrencyId.TEDG, - // }, - // [ChainId.Edgeware]: { - // chainType: ChainType, - // group: 'edgeware', - // tag: 'live', - // id: ChainId.Edgeware, - // evmId: EVMChain.Edgeware, - // name: 'Edgeware', - // evmRpcUrls: ['https://mainnet.edgewa.re/evm'], - // url: 'wss://mainnet1.edgewa.re', - // logo: EdgewareLogo, - // currencies: [ - // { - // currencyId: WebbCurrencyId.EDG, - // enabled: true, - // }, - // ], - // nativeCurrencyId: WebbCurrencyId.EDG, - // }, - // [InternalChainId.Rinkeby]: { // chainType: ChainType.EVM, // group: 'eth', diff --git a/packages/apps/src/configs/currencies/currency-config.ts b/packages/apps/src/configs/currencies/currency-config.ts index e3a8b277d5..296a97a9a4 100644 --- a/packages/apps/src/configs/currencies/currency-config.ts +++ b/packages/apps/src/configs/currencies/currency-config.ts @@ -1,11 +1,9 @@ -import EdgewareLogo from '@webb-dapp/apps/configs/logos/chains/EdgewareLogo'; import GanacheLogo from '@webb-dapp/apps/configs/logos/chains/GanacheLogo'; import HarmonyLogo from '@webb-dapp/apps/configs/logos/chains/HarmonyLogo'; import PolygonLogo from '@webb-dapp/apps/configs/logos/chains/PolygonLogo'; import ShidenLogo from '@webb-dapp/apps/configs/logos/chains/ShidenLogo'; import WEBBLogo from '@webb-dapp/apps/configs/logos/chains/WebbLogo'; import EtherLogo from '@webb-dapp/apps/configs/logos/Eth'; -import { PolkaLogo } from '@webb-dapp/apps/configs/logos/PolkaLogo'; import WebbWrappedLogo from '@webb-dapp/apps/configs/logos/WebbWrappedLogo'; import { AppConfig, @@ -13,32 +11,11 @@ import { CurrencyType, InternalChainId, WebbCurrencyId, - ZERO, zeroAddress, } from '@webb-tools/api-providers'; import React from 'react'; export const currenciesConfig: AppConfig['currencies'] = { - [WebbCurrencyId.EDG]: { - name: 'Edgeware token', - symbol: 'EDG', - color: '', - id: WebbCurrencyId.EDG, - type: CurrencyType.ORML, - role: CurrencyRole.Wrappable, - icon: React.createElement(EdgewareLogo), - addresses: new Map(), - }, - [WebbCurrencyId.TEDG]: { - name: 'Edgeware testnet token', - symbol: 'tEDG', - color: '', - id: WebbCurrencyId.TEDG, - type: CurrencyType.ORML, - role: CurrencyRole.Wrappable, - icon: React.createElement(EdgewareLogo), - addresses: new Map(), - }, [WebbCurrencyId.ETH]: { name: 'Ethereum', symbol: 'ETH', diff --git a/packages/apps/src/configs/ipfs/evm/anchors.ts b/packages/apps/src/configs/ipfs/evm/anchors.ts index 691e15cc54..f511e261d6 100644 --- a/packages/apps/src/configs/ipfs/evm/anchors.ts +++ b/packages/apps/src/configs/ipfs/evm/anchors.ts @@ -1,3 +1,4 @@ +// @ts-ignore import { getCachedFixtureURI, withLocalFixtures } from '@webb-dapp/utils/misc'; export const fetchWasmForEdges = async (maxEdges: number) => { diff --git a/packages/apps/src/configs/logos/chains/EdgewareLogo.tsx b/packages/apps/src/configs/logos/chains/EdgewareLogo.tsx deleted file mode 100644 index 36102f450b..0000000000 --- a/packages/apps/src/configs/logos/chains/EdgewareLogo.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import * as React from 'react'; - -function EdgewareLogo() { - return ( - - {'Bitmap'} - - - - - - - - - - - - - - - - ); -} - -export default EdgewareLogo; diff --git a/packages/apps/src/configs/logos/pages/TornadoPageLogo.tsx b/packages/apps/src/configs/logos/pages/MixerPageLogo.tsx similarity index 86% rename from packages/apps/src/configs/logos/pages/TornadoPageLogo.tsx rename to packages/apps/src/configs/logos/pages/MixerPageLogo.tsx index fb1665245b..20fedb360c 100644 --- a/packages/apps/src/configs/logos/pages/TornadoPageLogo.tsx +++ b/packages/apps/src/configs/logos/pages/MixerPageLogo.tsx @@ -1,6 +1,6 @@ import React from 'react'; -export const TornadoPageLogo: React.FC = () => { +export const MixerPageLogo: React.FC = () => { return ( , + icon: , }, { path: 'bridge', @@ -36,7 +36,7 @@ export const sideBarConfig: SidebarConfig = { rel: 'twitter', }, { - href: 'https://discord.gg/cBQHf6B7', + href: 'https://discord.gg/cv8EfJu3Tn', icon: , name: 'Discord', rel: 'discord', diff --git a/packages/bridge/src/components/Deposit/Deposit.tsx b/packages/bridge/src/components/Deposit/Deposit.tsx index a1022f2192..fbe5805a06 100644 --- a/packages/bridge/src/components/Deposit/Deposit.tsx +++ b/packages/bridge/src/components/Deposit/Deposit.tsx @@ -89,7 +89,7 @@ export const Deposit: React.FC = () => { const { tokens: bridgeCurrencies } = useBridge(); const bridgeDepositApi = useBridgeDeposit(); - const { depositApi, selectedBridgeCurrency, setSelectedCurrency } = bridgeDepositApi; + const { selectedBridgeCurrency, setSelectedCurrency } = bridgeDepositApi; const { setWrappableToken, wrappableToken, wrappableTokens } = useWrapUnwrap(); const { activeApi, activeChain, activeWallet, chains, loading, switchChain } = useWebContext(); diff --git a/packages/bridge/src/components/DepositConfirm/DepositAmountDecal.tsx b/packages/bridge/src/components/DepositConfirm/DepositAmountDecal.tsx index 9bdb0dc3b8..4f9b3c9974 100644 --- a/packages/bridge/src/components/DepositConfirm/DepositAmountDecal.tsx +++ b/packages/bridge/src/components/DepositConfirm/DepositAmountDecal.tsx @@ -40,7 +40,7 @@ interface DepositAmountDecalProps { } export const DepositAmountDecal: React.FC = ({ amount, symbol }) => { - const palette = useColorPallet(); + useColorPallet(); return ( diff --git a/packages/bridge/src/components/DepositConfirm/DepositConfirm.tsx b/packages/bridge/src/components/DepositConfirm/DepositConfirm.tsx index 8b59dd88c0..b548c9ec0d 100644 --- a/packages/bridge/src/components/DepositConfirm/DepositConfirm.tsx +++ b/packages/bridge/src/components/DepositConfirm/DepositConfirm.tsx @@ -99,8 +99,6 @@ export const DepositConfirm: React.FC = ({ destChain, mixerSize, onClose, - onSuccess, - open, provider, wrappableAsset, }) => { diff --git a/packages/bridge/src/components/Withdraw/Withdraw.tsx b/packages/bridge/src/components/Withdraw/Withdraw.tsx index 2e5ea1fffb..b75ef58f03 100644 --- a/packages/bridge/src/components/Withdraw/Withdraw.tsx +++ b/packages/bridge/src/components/Withdraw/Withdraw.tsx @@ -13,8 +13,6 @@ import { FeesInfo, RelayerApiAdapter, RelayerInput } from '@webb-dapp/ui-compone import { Modal } from '@webb-dapp/ui-components/Modal/Modal'; import { Pallet } from '@webb-dapp/ui-components/styling/colors'; import { - ActiveWebbRelayer, - ChainType, chainTypeIdToInternalId, getChainNameFromChainId, parseChainIdType, @@ -24,7 +22,7 @@ import { import { WalletConfig } from '@webb-tools/api-providers/types/wallet-config.interface'; import { Note } from '@webb-tools/sdk-core'; import { ethers } from 'ethers'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import styled, { css } from 'styled-components'; const WithdrawWrapper = styled.div<{ wallet: WalletConfig | undefined }>` @@ -160,7 +158,6 @@ export const Withdraw: React.FC = () => { note: depositNote, }); const appConfig = useAppConfig(); - const { currencies: currenciesConfig } = appConfig; const shouldSwitchChain = useMemo(() => { if (!depositNote || !activeChain) { diff --git a/packages/bridge/src/hooks/deposit/useBridgeDeposit.tsx b/packages/bridge/src/hooks/deposit/useBridgeDeposit.tsx index 3e1af48c6f..7e3b28fa90 100644 --- a/packages/bridge/src/hooks/deposit/useBridgeDeposit.tsx +++ b/packages/bridge/src/hooks/deposit/useBridgeDeposit.tsx @@ -10,11 +10,7 @@ import { MixerDeposit, MixerSize, } from '@webb-tools/api-providers'; -import { LoggerService } from '@webb-tools/app-util'; import { useCallback, useEffect, useMemo, useState } from 'react'; - -const logger = LoggerService.get('useBridgeDeposit'); - export interface BridgeDepositApi { mixerSizes: MixerSize[]; @@ -71,12 +67,10 @@ export const useBridgeDeposit = (): BridgeDepositApi => { const subscribe = bridgeApi.$store.subscribe((bridge) => { depositApi.getSizes().then((mixerSizes) => { mixerSizes.filter((mixerSize) => { - console.log('mixerSize: ', mixerSize); mixerSize.id === selectedBridgeCurrency?.id; }); setMixerSizes(mixerSizes); }); - console.log(bridgeApi.currency); setSelectedBridgeCurrency(bridgeApi.currency); }); return () => { diff --git a/packages/bridge/src/hooks/withdraw/useWithdraw.tsx b/packages/bridge/src/hooks/withdraw/useWithdraw.tsx index 88265fbd21..b8dbc784e3 100644 --- a/packages/bridge/src/hooks/withdraw/useWithdraw.tsx +++ b/packages/bridge/src/hooks/withdraw/useWithdraw.tsx @@ -7,14 +7,11 @@ import { WebbRelayer, WithdrawState, } from '@webb-tools/api-providers'; -import { LoggerService } from '@webb-tools/app-util'; import { Note } from '@webb-tools/sdk-core'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useBridge } from '../bridge/use-bridge'; -const logger = LoggerService.get('useWithdrawHook'); - export type UseWithdrawProps = { note: Note | null; recipient: string; diff --git a/packages/bridge/src/utils/currency/coins-icon/EDG.svg b/packages/bridge/src/utils/currency/coins-icon/EDG.svg deleted file mode 100644 index 6b65a57042..0000000000 --- a/packages/bridge/src/utils/currency/coins-icon/EDG.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - Bitmap - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/bridge/src/utils/currency/constants.ts b/packages/bridge/src/utils/currency/constants.ts index 61b7ca0b43..5b640e93b7 100644 --- a/packages/bridge/src/utils/currency/constants.ts +++ b/packages/bridge/src/utils/currency/constants.ts @@ -1,17 +1,7 @@ -import EdgewareIcon from './coins-icon/EDG.svg'; -import WebbIcon from './coins-icon/webb-icon.svg'; +const WebbIcon = require('./coins-icon/webb-icon.svg') as string; -export const TOKEN_COLOR: Map = new Map([ - ['SYSTEM', '#173DC9'], - ['EDG', '#173dc9'], -]); +export const TOKEN_COLOR: Map = new Map([['SYSTEM', '#173DC9']]); -export const TOKEN_IMAGES: Map = new Map([ - ['EDG', EdgewareIcon], - ['WEBB', WebbIcon], -]); +export const TOKEN_IMAGES: Map = new Map([['WEBB', WebbIcon]]); -export const TOKEN_FULLNAMES: Map = new Map([ - ['EDG', 'Edgeware'], - ['WEBB', 'WebbToken'], -]); +export const TOKEN_FULLNAMES: Map = new Map([['WEBB', 'WebbToken']]); diff --git a/packages/mixer/src/components/Deposit/Deposit.tsx b/packages/mixer/src/components/Deposit/Deposit.tsx index 4b6800a573..09661aa097 100644 --- a/packages/mixer/src/components/Deposit/Deposit.tsx +++ b/packages/mixer/src/components/Deposit/Deposit.tsx @@ -1,5 +1,4 @@ import { Typography } from '@material-ui/core'; -import { chainsConfig } from '@webb-dapp/apps/configs'; import { DepositConfirm } from '@webb-dapp/mixer/components/DepositConfirm/DepositConfirm'; import { useDeposit } from '@webb-dapp/mixer/hooks/deposit/useDeposit'; import { RequiredWalletSelection } from '@webb-dapp/react-components/RequiredWalletSelection/RequiredWalletSelection'; diff --git a/packages/mixer/src/components/DepositConfirm/DepositConfirm.tsx b/packages/mixer/src/components/DepositConfirm/DepositConfirm.tsx index f5393d26c2..99bb99f0de 100644 --- a/packages/mixer/src/components/DepositConfirm/DepositConfirm.tsx +++ b/packages/mixer/src/components/DepositConfirm/DepositConfirm.tsx @@ -131,7 +131,6 @@ export const DepositConfirm: React.FC = ({ mixerSize, onClose, return; } let desiredMixer: string | number = ''; - console.log('mixerId in depositConfirm: ', mixerSize.id); // MixerIds may be strings or numbers. EVM Mixer ids will have a 'Bridge' prefix. if (typeof mixerSize.id === 'string') { mixerSize.id.includes('Bridge') ? (desiredMixer = mixerSize.id) : (desiredMixer = Number(mixerSize.id)); diff --git a/packages/mixer/src/components/Withdraw/Withdraw.tsx b/packages/mixer/src/components/Withdraw/Withdraw.tsx index b8ab3418b6..f460e73af1 100644 --- a/packages/mixer/src/components/Withdraw/Withdraw.tsx +++ b/packages/mixer/src/components/Withdraw/Withdraw.tsx @@ -9,15 +9,14 @@ import { SpaceBox } from '@webb-dapp/ui-components'; import { SettingsIcon } from '@webb-dapp/ui-components/assets/SettingsIcon'; import { MixerButton } from '@webb-dapp/ui-components/Buttons/MixerButton'; import { MixerNoteInput } from '@webb-dapp/ui-components/Inputs/NoteInput/MixerNoteInput'; -import { FeesInfo, RelayerApiAdapter } from '@webb-dapp/ui-components/Inputs/RelayerInput/RelayerInput'; import { Modal } from '@webb-dapp/ui-components/Modal/Modal'; import { Pallet } from '@webb-dapp/ui-components/styling/colors'; -import { parseChainIdType, WithdrawState } from '@webb-tools/api-providers'; -import { ActiveWebbRelayer, WebbRelayer } from '@webb-tools/api-providers'; +import { WithdrawState } from '@webb-tools/api-providers'; +import { WebbRelayer } from '@webb-tools/api-providers'; import { WalletConfig } from '@webb-tools/api-providers'; import { Note } from '@webb-tools/sdk-core'; import { ethers } from 'ethers'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import styled, { css } from 'styled-components'; const WithdrawWrapper = styled.div<{ wallet: WalletConfig | undefined }>` @@ -124,7 +123,6 @@ export const Withdraw: React.FC = () => { const [recipient, setRecipient] = useState(''); const [showRelayerModal, setShowRelayerModal] = useState(false); - const [withdrawPercentage, setWithdrawPercentage] = useState(0); const [fees, setFees] = useState('0'); const { activeApi, activeChain, activeWallet } = useWebContext(); @@ -143,24 +141,12 @@ export const Withdraw: React.FC = () => { recipient, note: depositNote, }); - console.log(relayersState, 'relayersState'); const disabledButton = useMemo(() => { - console.log(depositNote, recipient); return !(depositNote && recipient); - /* if (depositNote && determineSwitchButton()) { - return false; - } else if (depositNote && recipient) { - return false; - } - return true;*/ }, [recipient, depositNote]); const determineSwitchButton = () => { return false; - /* if (depositNote && activeChain && activeChain.evmId != internalChainIdIntoEVMId(depositNote.note.chain)) { - return true; - } - return false;*/ }; const switchChain = async (note: Note | null) => { if (!note) { @@ -181,7 +167,7 @@ export const Withdraw: React.FC = () => { chainId: `0x${chain.chainId?.toString(16)}`, }) ?.catch(async (switchError: any) => { - console.log('inside catch for switchChain', switchError); + console.log('SwitchError: ', switchError); // cannot switch because network not recognized, so prompt to add it if (switchError.code === 4902) { diff --git a/packages/mixer/src/hooks/deposit/useDeposit.tsx b/packages/mixer/src/hooks/deposit/useDeposit.tsx index f4485c9007..152011e339 100644 --- a/packages/mixer/src/hooks/deposit/useDeposit.tsx +++ b/packages/mixer/src/hooks/deposit/useDeposit.tsx @@ -48,7 +48,7 @@ export const useDeposit = (): DepositApi => { const generateNote = useCallback( async (mixerId: number | string, chainTypeId: ChainTypeId) => { if (!depositApi) { - // TODO: fix this to be dependent ont he api state + // TODO: fix this to be dependent on the api state // disable buttons throw new Error('Not ready'); } else { diff --git a/packages/mixer/src/hooks/mixer-groups-entry-wrapper.class.ts b/packages/mixer/src/hooks/mixer-groups-entry-wrapper.class.ts index bd075a8577..f618f83b56 100644 --- a/packages/mixer/src/hooks/mixer-groups-entry-wrapper.class.ts +++ b/packages/mixer/src/hooks/mixer-groups-entry-wrapper.class.ts @@ -1,5 +1,6 @@ import { Currency } from '@webb-tools/api-providers'; import { Token } from '@webb-tools/sdk-core'; +// @ts-ignore import { Balance, PalletMixerMixerMetadata as MixerInfo } from '@webb-tools/types/interfaces'; import { StorageKey } from '@polkadot/types'; diff --git a/packages/mixer/src/hooks/note/index.ts b/packages/mixer/src/hooks/note/index.ts index 911c189faa..32910cc490 100644 --- a/packages/mixer/src/hooks/note/index.ts +++ b/packages/mixer/src/hooks/note/index.ts @@ -12,7 +12,6 @@ export const useDepositNote = (value: string): null | Note => { throw new Error('empty value'); } let d = await Note.deserialize(value); - // const noteLeaf = d.getLeaf(); // Check for legacy notes and update fields (like internal chain id -> chain id type) if (d.note.version === 'v1') { const newNoteInput: NoteGenInput = { diff --git a/packages/mixer/src/hooks/withdraw/useWithdraw.tsx b/packages/mixer/src/hooks/withdraw/useWithdraw.tsx index 748bb8c316..ee3d9491ca 100644 --- a/packages/mixer/src/hooks/withdraw/useWithdraw.tsx +++ b/packages/mixer/src/hooks/withdraw/useWithdraw.tsx @@ -7,12 +7,9 @@ import { WebbRelayer, WithdrawState, } from '@webb-tools/api-providers'; -import { LoggerService } from '@webb-tools/app-util'; import { Note } from '@webb-tools/sdk-core'; import { useCallback, useEffect, useMemo, useState } from 'react'; -const logger = LoggerService.get('useWithdrawHook'); - export type UseWithdrawProps = { note: Note | null; recipient: string; diff --git a/packages/mixer/src/utils/currency/coins-icon/EDG.svg b/packages/mixer/src/utils/currency/coins-icon/EDG.svg deleted file mode 100644 index 6b65a57042..0000000000 --- a/packages/mixer/src/utils/currency/coins-icon/EDG.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - Bitmap - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/mixer/src/utils/currency/constants.ts b/packages/mixer/src/utils/currency/constants.ts index 61b7ca0b43..5b640e93b7 100644 --- a/packages/mixer/src/utils/currency/constants.ts +++ b/packages/mixer/src/utils/currency/constants.ts @@ -1,17 +1,7 @@ -import EdgewareIcon from './coins-icon/EDG.svg'; -import WebbIcon from './coins-icon/webb-icon.svg'; +const WebbIcon = require('./coins-icon/webb-icon.svg') as string; -export const TOKEN_COLOR: Map = new Map([ - ['SYSTEM', '#173DC9'], - ['EDG', '#173dc9'], -]); +export const TOKEN_COLOR: Map = new Map([['SYSTEM', '#173DC9']]); -export const TOKEN_IMAGES: Map = new Map([ - ['EDG', EdgewareIcon], - ['WEBB', WebbIcon], -]); +export const TOKEN_IMAGES: Map = new Map([['WEBB', WebbIcon]]); -export const TOKEN_FULLNAMES: Map = new Map([ - ['EDG', 'Edgeware'], - ['WEBB', 'WebbToken'], -]); +export const TOKEN_FULLNAMES: Map = new Map([['WEBB', 'WebbToken']]); diff --git a/packages/page-mixer/src/index.tsx b/packages/page-mixer/src/index.tsx index 7a2750d6a5..0772ed8e62 100644 --- a/packages/page-mixer/src/index.tsx +++ b/packages/page-mixer/src/index.tsx @@ -1,52 +1,12 @@ -import WalletConnect from '@walletconnect/client'; -import QRCodeModal from '@walletconnect/qrcode-modal'; import Mixer from '@webb-dapp/mixer'; import { pageWithFeatures } from '@webb-dapp/react-components/utils/FeaturesGuard/pageWithFeatures'; import React, { FC } from 'react'; -/*// Create a connector -const connector = new WalletConnect({ - bridge: 'https://bridge.walletconnect.org', // Required - qrcodeModal: QRCodeModal, -}); -// Check if connection is already established -if (!connector.connected) { - // create new session - connector.createSession(); -} - -// Subscribe to connection events -connector.on('connect', (error, payload) => { - if (error) { - throw error; - } - - // Get provided accounts and chainId - const { accounts, chainId } = payload.params[0]; -}); - -connector.on('session_update', (error, payload) => { - if (error) { - throw error; - } - - // Get updated accounts and chainId - const { accounts, chainId } = payload.params[0]; -}); - -connector.on('disconnect', (error, payload) => { - if (error) { - throw error; - } - - // Delete connector -}); -*/ const PageMixer: FC = () => { return ; }; export default pageWithFeatures({ - features: ['tornado'], - message: 'The tornado module is not supported on the current chain, please change the current network.', + features: ['mixer'], + message: 'The mixer module is not supported on the current chain, please change the current network.', })(PageMixer); diff --git a/packages/react-components/src/AmountInput/AmountInput.tsx b/packages/react-components/src/AmountInput/AmountInput.tsx index 2b4381176c..2c0160af05 100644 --- a/packages/react-components/src/AmountInput/AmountInput.tsx +++ b/packages/react-components/src/AmountInput/AmountInput.tsx @@ -136,7 +136,7 @@ const AmountInput: React.FC = ({ items, onChange, value }) => const amount = new Token({ amount: item.amount.toString(), // TODO: Pull from active chain - chain: 'edgeware', + chain: 'dev', name: 'DEV', precision: 12, symbol: 'DEV', diff --git a/packages/react-components/src/AppBar/ThemeSwitcher.tsx b/packages/react-components/src/AppBar/ThemeSwitcher.tsx index a525019d4f..988671cafb 100644 --- a/packages/react-components/src/AppBar/ThemeSwitcher.tsx +++ b/packages/react-components/src/AppBar/ThemeSwitcher.tsx @@ -1,5 +1,4 @@ import { Slide } from '@material-ui/core'; -import { Pallet } from '@webb-dapp/ui-components/styling/colors'; import React, { useCallback, useRef } from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/IPDisplay/IPDisplay.tsx b/packages/react-components/src/IPDisplay/IPDisplay.tsx index 0ebf0b01fa..ce3434df5f 100644 --- a/packages/react-components/src/IPDisplay/IPDisplay.tsx +++ b/packages/react-components/src/IPDisplay/IPDisplay.tsx @@ -1,10 +1,9 @@ -import { Icon, Typography } from '@material-ui/core'; +import { Typography } from '@material-ui/core'; import { LocationLogo } from '@webb-dapp/apps/configs/logos/LocationLogo'; import { useIp } from '@webb-dapp/react-environment'; import { Pallet } from '@webb-dapp/ui-components/styling/colors'; import { FontFamilies } from '@webb-dapp/ui-components/styling/fonts/font-families.enum'; -import { above } from '@webb-dapp/ui-components/utils/responsive-utils'; -import React, { useState } from 'react'; +import React from 'react'; import styled, { css } from 'styled-components'; const IPDisplayWrapper = styled.div` diff --git a/packages/react-components/src/InteractiveFeedbackView/UnselectedNetworkView.tsx b/packages/react-components/src/InteractiveFeedbackView/UnselectedNetworkView.tsx index 8b4c58a778..608c87da70 100644 --- a/packages/react-components/src/InteractiveFeedbackView/UnselectedNetworkView.tsx +++ b/packages/react-components/src/InteractiveFeedbackView/UnselectedNetworkView.tsx @@ -1,6 +1,7 @@ import { Button, Typography } from '@material-ui/core'; import { useStore } from '@webb-dapp/react-environment'; import { CloseIcon } from '@webb-dapp/ui-components'; +// @ts-ignore import NetworksGlobeCircled from '@webb-dapp/ui-components/assets/NetworksGlobeCircled.png'; import { Padding } from '@webb-dapp/ui-components/Padding/Padding'; import { FeedbackEntry, InteractiveFeedback } from '@webb-tools/api-providers'; @@ -21,7 +22,7 @@ type UnselectedNetworkViewProps = { }; const UnselectedNetworkView: React.FC = ({ activeFeedback }) => { - const { setTheme, theme } = useStore('ui'); + const { theme } = useStore('ui'); const isDarkTheme = theme === 'dark'; return ( diff --git a/packages/react-components/src/Notices/NoExtensions.tsx b/packages/react-components/src/Notices/NoExtensions.tsx index a718f0ae1f..3ffa89904f 100644 --- a/packages/react-components/src/Notices/NoExtensions.tsx +++ b/packages/react-components/src/Notices/NoExtensions.tsx @@ -4,7 +4,6 @@ import React, { memo } from 'react'; import styled, { css } from 'styled-components'; const POLKADOT_EXTENSION_PAGE = 'https://polkadot.js.org/extension'; -const METAMASK_EXTENSION_PAGE = 'https://metamask.io/download'; const NoExtensionWrapper = styled.div` padding: 1rem; @@ -32,25 +31,6 @@ const GetPolkadotButton = styled.button` }} `; -const GetMetamaskButton = styled.button` - &&& { - width: 50%; - background: ${({ theme }) => theme.warning}; - border-radius: 31px; - color: #fff; - height: 60px; - font-weight: bold; - transition: all ease-in-out .3s; - - ${({ disabled, theme }) => { - return disabled - ? css` - background: ${theme.gray4}; - ` - : ''; - }} -`; - const handleOpenLink = (link: string): void => { window.open(link, '_blank'); }; @@ -63,10 +43,6 @@ export const NoExtensions: React.FC = memo(() => { handleOpenLink(POLKADOT_EXTENSION_PAGE)}> {'Get Polkadot{.js}'} - {/* handleOpenLink(METAMASK_EXTENSION_PAGE)}> - {'Get Metamask'} - */} ); }); diff --git a/packages/react-components/src/PermissionedAccess/PermissionedAccess.tsx b/packages/react-components/src/PermissionedAccess/PermissionedAccess.tsx index ee09be8bd8..44a4a31ba6 100644 --- a/packages/react-components/src/PermissionedAccess/PermissionedAccess.tsx +++ b/packages/react-components/src/PermissionedAccess/PermissionedAccess.tsx @@ -1,5 +1,4 @@ import { useIp, useWebContext } from '@webb-dapp/react-environment'; -import { useFetch } from '@webb-dapp/react-hooks/useFetch'; import { ContentWrapper } from '@webb-dapp/ui-components/ContentWrappers'; import { Spinner } from '@webb-dapp/ui-components/Spinner/Spinner'; import { Storage } from '@webb-dapp/utils'; diff --git a/packages/react-components/src/Sidebar/Products.tsx b/packages/react-components/src/Sidebar/Products.tsx index bb9ca12c06..c95aee9df8 100644 --- a/packages/react-components/src/Sidebar/Products.tsx +++ b/packages/react-components/src/Sidebar/Products.tsx @@ -85,9 +85,8 @@ const ProductSubItem: FC = memo(({ collapse, data }) => { const isMatch = useMatch(data.path ?? '__unset__path'); const handleClick = useCallback(() => { - console.log(data.path); setSubMenu(null); - }, [data.path, setSubMenu]); + }, [setSubMenu]); useEffect(() => { if (!isMatch) { @@ -124,9 +123,8 @@ const ProductItem: FC = memo(({ collapse, data }) => { const isMatch = useMatch(data.path ?? '__unset__path'); const handleClick = useCallback(() => { - console.log(data.path); setSubMenu(null); - }, [data.path, setSubMenu]); + }, [setSubMenu]); useEffect(() => { if (!isMatch) { diff --git a/packages/react-components/src/Sidebar/types.ts b/packages/react-components/src/Sidebar/types.ts index 0a966b518d..c1f5022a2e 100644 --- a/packages/react-components/src/Sidebar/types.ts +++ b/packages/react-components/src/Sidebar/types.ts @@ -1,5 +1,5 @@ import { AppFeatures } from '@webb-dapp/ui-components/types'; -import { FC, ReactElement } from 'react'; +import { ReactElement } from 'react'; export interface SideBarItem { icon?: ReactElement; diff --git a/packages/react-components/src/assets/NetworksGlobeCircled.png b/packages/react-components/src/assets/NetworksGlobeCircled.png new file mode 100644 index 0000000000..9ac2a8d53c Binary files /dev/null and b/packages/react-components/src/assets/NetworksGlobeCircled.png differ diff --git a/packages/react-components/src/assets/edgeware-network.svg b/packages/react-components/src/assets/edgeware-network.svg deleted file mode 100644 index 6b65a57042..0000000000 --- a/packages/react-components/src/assets/edgeware-network.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - Bitmap - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/react-components/src/types.ts b/packages/react-components/src/types.ts index d824b7a6aa..0f0fa12805 100644 --- a/packages/react-components/src/types.ts +++ b/packages/react-components/src/types.ts @@ -1,4 +1,5 @@ import { CurrencyLike } from '@webb-dapp/react-hooks/types'; +// @ts-ignore import { CurrencyId } from '@webb-tools/types/interfaces'; export type CurrencyChangeFN = diff --git a/packages/react-environment/src/SettingProvider.tsx b/packages/react-environment/src/SettingProvider.tsx index 6318701707..06ab2b1179 100644 --- a/packages/react-environment/src/SettingProvider.tsx +++ b/packages/react-environment/src/SettingProvider.tsx @@ -40,7 +40,6 @@ export interface SettingDate { changeEndpoint: (endpoints: string) => void; setTheme: (theme: Theme) => void; setLanguage: (language: Language) => void; - settingVisible: boolean; openSetting: () => void; closeSetting: () => void; diff --git a/packages/react-environment/src/WebbProvider.tsx b/packages/react-environment/src/WebbProvider.tsx index 1a29664a86..4a2c73d932 100644 --- a/packages/react-environment/src/WebbProvider.tsx +++ b/packages/react-environment/src/WebbProvider.tsx @@ -14,7 +14,7 @@ import { WalletId } from '@webb-dapp/apps/configs/wallets/wallet-id.enum'; import { appEvent } from '@webb-dapp/react-environment/app-event'; import { insufficientApiInterface } from '@webb-dapp/react-environment/error/interactive-errors/insufficient-api-interface'; import { DimensionsProvider } from '@webb-dapp/react-environment/layout'; -import { StoreProvier } from '@webb-dapp/react-environment/store'; +import { StoreProvider } from '@webb-dapp/react-environment/store'; import { netStorageFactory, WebbContext } from '@webb-dapp/react-environment/webb-context'; import { notificationApi } from '@webb-dapp/ui-components/notification'; import { AccountSwitchNotification } from '@webb-dapp/ui-components/notification/AccountSwitchNotification'; @@ -29,7 +29,6 @@ import { evmIdIntoInternalChainId, getEVMChainName, InteractiveFeedback, - InternalChainId, NetworkStorage, NotificationPayload, Wallet, @@ -78,8 +77,6 @@ const getDefaultBridge = (chain: Chain, bridgeConfig: Record = ({ applicationName = 'Webb Da case WalletId.Polkadot: { const url = chain.url; - console.log('url: ', url); const webbPolkadot = await WebbPolkadot.init( 'Webb DApp', [url], @@ -616,11 +612,11 @@ export const WebbProvider: FC = ({ applicationName = 'Webb Da }, }} > - + {children} - + ); }; diff --git a/packages/react-environment/src/app-event/app-event.spec.ts b/packages/react-environment/src/app-event/app-event.spec.ts deleted file mode 100644 index b1ef753903..0000000000 --- a/packages/react-environment/src/app-event/app-event.spec.ts +++ /dev/null @@ -1,5 +0,0 @@ -describe('place holder for CI', function () { - test('Placeholder for CI', () => { - expect(1).toEqual(1); - }); -}); diff --git a/packages/react-environment/src/app-event/app-events.class.ts b/packages/react-environment/src/app-event/app-events.class.ts index 910c55edb8..4df2c9913b 100644 --- a/packages/react-environment/src/app-event/app-events.class.ts +++ b/packages/react-environment/src/app-event/app-events.class.ts @@ -1,4 +1,5 @@ import { WalletId } from '@webb-dapp/apps/configs'; +// @ts-ignore import { Account } from '@webb-dapp/wallet/account/Accounts.adapter'; import { Chain, InternalChainId, Wallet } from '@webb-tools/api-providers'; import { EventBus } from '@webb-tools/app-util'; diff --git a/packages/react-environment/src/error/interactive-errors/evm-network-conflict.ts b/packages/react-environment/src/error/interactive-errors/evm-network-conflict.ts index 29f99ca33c..b5201897bf 100644 --- a/packages/react-environment/src/error/interactive-errors/evm-network-conflict.ts +++ b/packages/react-environment/src/error/interactive-errors/evm-network-conflict.ts @@ -51,15 +51,6 @@ export function evmChainConflict(params: EvmNetworkConflictParams, appEvent: TAp ...(params.switchChain ? addChainContent : []), ]); const actions = InteractiveFeedback.actionsBuilder() - // .action( - // 'Ok,I switched', - // () => { - // console.log('Ok,I switched'); - // interactiveFeedback?.cancelWithoutHandler(); - // }, - // 'success', - // USER_SWITCHED_TO_EXPECT_CHAIN - // ) .action( 'Reselect chain', () => { diff --git a/packages/react-environment/src/store/index.tsx b/packages/react-environment/src/store/index.tsx index 1b0a1b4c4f..0f43b9fd57 100644 --- a/packages/react-environment/src/store/index.tsx +++ b/packages/react-environment/src/store/index.tsx @@ -12,7 +12,7 @@ export type StoreData = { const StoreContext = createContext({} as any); -export const StoreProvier: FC = ({ children }) => { +export const StoreProvider: FC = ({ children }) => { const apiQuery = useApiQueryStore(); const ui = useUIConfig(); const data = useMemo( diff --git a/packages/react-environment/src/webb-context/webb-context.ts b/packages/react-environment/src/webb-context/webb-context.ts index baaf3d840a..6d8c2a117e 100644 --- a/packages/react-environment/src/webb-context/webb-context.ts +++ b/packages/react-environment/src/webb-context/webb-context.ts @@ -4,8 +4,6 @@ import { InteractiveFeedback } from '@webb-tools/api-providers/webb-error'; import React from 'react'; interface Note { serialize(): string; - - // deserialize(noteStr: string): Note; } type DepositStates = 'ideal' | 'generating-note' | 'depositing'; @@ -21,13 +19,9 @@ export interface WebbContextState { accounts: Account[]; activeAccount: Account | null; isConnecting: boolean; - setActiveAccount(account: T): Promise; - inactivateApi(): Promise; - switchChain(chain: Chain, wallet: Wallet): Promise | null>; - activeFeedback: InteractiveFeedback | null; registerInteractiveFeedback: (interactiveFeedback: InteractiveFeedback) => void; } diff --git a/packages/react-hooks/src/councilHooks.ts b/packages/react-hooks/src/councilHooks.ts deleted file mode 100644 index 05813fac57..0000000000 --- a/packages/react-hooks/src/councilHooks.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* -import { AccountId } from '@webb-tools/types/interfaces/types'; -import { useEffect, useMemo, useState } from 'react'; -import { combineLatest, Observable, of } from 'rxjs'; -import { map, switchMap } from 'rxjs/operators'; - -import { ApiRx } from '@polkadot/api'; -import { Option, Vec } from '@polkadot/types'; -import { Hash, Proposal, Votes } from '@polkadot/types/interfaces'; - -import { useApi } from './useApi'; -import { useCall } from './useCall'; - -export interface ProposalData { - proposal: Proposal; - vote: Votes; - hash: string; - council: string; -} - -function getAllCouncil(api: ApiRx): string[] { - return Object.keys(api.query).filter((key: string): boolean => key.endsWith('Council')); -} - -function fetchProposalAndVote(api: ApiRx, council: string, hash: string): Observable { - return combineLatest( - api.query[council].proposalOf>(hash), - api.query[council].voting>(hash) - ).pipe( - map(([proposal, vote]) => { - return { - council, - hash: hash, - proposal: proposal.unwrap(), - vote: vote.unwrap(), - }; - }) - ); -} - -function fetchAllProposalAndVote(api: ApiRx, council: string): Observable { - return api.query[council].proposals>().pipe( - switchMap((result) => { - if (result.isEmpty) return of([]); - - return combineLatest(result.map((hash) => fetchProposalAndVote(api, council, hash.toString()))); - }) - ); -} - -export const useCouncilList = (): string[] => { - const { api } = useApi(); - - return useMemo(() => { - if (!api) return []; - - return getAllCouncil(api); - }, [api]); -}; - -export const useCouncilMembers = (council: string): Vec | undefined => { - const _council = council.endsWith('Council') ? council : council + 'Council'; - const members = useCall>(`query.${_council}.members`, []); - - return members; -}; - -export const useProposal = (council: string, hash: string): ProposalData | null => { - const _council = council.endsWith('Council') ? council : council + 'Council'; - const { api } = useApi(); - const [data, setData] = useState(null); - - useEffect(() => { - if (!api || !api.query[_council]) return; - - console.log(_council, hash); - - const subscriber = fetchProposalAndVote(api, _council, hash).subscribe((data) => setData(data)); - - return (): void => subscriber.unsubscribe(); - }, [api, _council, hash]); - - return data; -}; - -export const useProposals = (council: string): ProposalData[] => { - const _council = council.endsWith('Council') ? council : council + 'Council'; - const { api } = useApi(); - const [data, setData] = useState([]); - - useEffect(() => { - if (!api || !api.query[_council]) return; - - const subscriber = fetchAllProposalAndVote(api, _council).subscribe((data) => setData(data)); - - return (): void => subscriber.unsubscribe(); - }, [api, _council]); - - return data; -}; - -export const useRecentProposals = (): ProposalData[] => { - const { api } = useApi(); - const [data, setData] = useState([]); - - useEffect(() => { - if (!api) return; - - const councils = getAllCouncil(api); - - const subscriber = combineLatest(councils.map((item) => fetchAllProposalAndVote(api, item))).subscribe((result) => { - const _data = result - .reduce((acc, cur): ProposalData[] => [...acc, ...cur], []) - .sort((a, b) => a.vote.end.toNumber() - b.vote.end.toNumber()) - .slice(0, 4); - - setData(_data); - }); - - return (): void => subscriber.unsubscribe(); - }, [api]); - - return data; -}; -*/ -export {}; diff --git a/packages/react-hooks/src/index.ts b/packages/react-hooks/src/index.ts index 99e65cb0e7..168275ecfd 100644 --- a/packages/react-hooks/src/index.ts +++ b/packages/react-hooks/src/index.ts @@ -7,9 +7,6 @@ export * from './useFetch'; // system export * from './useAccounts'; export * from './useApi'; -export * from './useCall'; -export * from './useIsAppReady'; -export * from './useStorage'; export * from './useSetting'; export * from './useConstants'; export * from './useExtrinsicHistory'; @@ -24,6 +21,3 @@ export * from './useModal'; export * from './useSubscription'; export * from './useInputValue'; export * from './currency'; - -// council -export * from './councilHooks'; diff --git a/packages/react-hooks/src/types.ts b/packages/react-hooks/src/types.ts index 1d2dc02924..18bb135d14 100644 --- a/packages/react-hooks/src/types.ts +++ b/packages/react-hooks/src/types.ts @@ -2,6 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +// @ts-ignore import { AccountId, CurrencyId } from '@webb-tools/types/interfaces'; export type CallParam = any; diff --git a/packages/react-hooks/src/useCall.ts b/packages/react-hooks/src/useCall.ts deleted file mode 100644 index 7734385a71..0000000000 --- a/packages/react-hooks/src/useCall.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* -import { useStore } from '@webb-dapp/react-environment'; -import { LoggerService } from '@webb-tools/app-util'; -import { get, isEmpty } from 'lodash'; -import { useEffect, useMemo } from 'react'; -import { Observable, Subscription } from 'rxjs'; - -import { ApiRx } from '@polkadot/api'; - -import { CallParams } from './types'; -import { useApi } from './useApi'; -import { useIsAppReady } from './useIsAppReady'; - -const logger = LoggerService.get('App'); - -class Tracker { - private trackerList: Record; - - constructor() { - this.trackerList = {}; - } - - subscribe( - api: ApiRx, - path: string, - params: CallParams, - key: string, - callback: (key: string, valeu: any) => void - ): void { - if (isEmpty(api)) return; - - if (!path) return; - - // update tracker list - if (this.trackerList[key]) { - this.trackerList[key].refCount += 1; - - return; - } - - const fn = get(api, path); - - if (!fn) throw new Error(`can't find method:${path} in api`); - - const subscriber = (fn(...params) as Observable).subscribe({ - next: (result: any) => callback(key, result), - }); - - // update tracker list - this.trackerList[key] = { - refCount: 1, - subscriber, - }; - } - - unsubscribe(key: string): void { - if (this.trackerList[key]) { - this.trackerList[key].refCount -= 1; - } - } -} - -const tracker = new Tracker(); - -export function useCall( - path: string, - params: CallParams = [], - options?: { - cacheKey: string; - }, - fallback?: T, - canCall?: () => boolean -): T | undefined { - const callable = !canCall ? true : canCall(); - const { api } = useApi(); - const isAppReady = useIsAppReady(); - const { get: _get, set } = useStore('apiQuery'); - const get: typeof _get = (...args) => { - try { - if (!callable) { - return fallback; - } - return _get(...args); - } catch (e) { - return fallback; - } - }; - const key = useMemo( - () => - `${path}${params.toString() ? '-' + JSON.stringify(params) : ''}${ - options?.cacheKey ? '-' + options.cacheKey : '' - }`, - [path, params, options] - ); - - // on changes, re-subscribe - useEffect(() => { - let isSubscribed = true; - if (!callable) { - return; - } - // check if we have a function & that we are mounted - if (!isAppReady) return; - - // if path equal __mock, doesn't du anything - if (path === '__mock') return; - try { - tracker.subscribe(api, path, params, key, set); - } catch (e) { - logger.error(' useCall ', e); - return undefined; - } - - return (): void => { - try { - tracker.unsubscribe(key); - } catch (e) { - logger.error(' useCall ', e); - } - }; - }, [isAppReady, api, path, params, key, set, callable]); - - return get(key); -} -*/ -export {}; diff --git a/packages/react-hooks/src/useConstants.tsx b/packages/react-hooks/src/useConstants.tsx index a475fa1a5e..6c59be90c6 100644 --- a/packages/react-hooks/src/useConstants.tsx +++ b/packages/react-hooks/src/useConstants.tsx @@ -1,10 +1,7 @@ +// @ts-ignore import { CurrencyId } from '@webb-tools/types/interfaces'; import { useMemo } from 'react'; -import { useApi } from './useApi'; - -const CURRENCIES_WEIGHT = new Map([['EDG', 9]]); - export type HooksReturnType = { allCurrencies: CurrencyId[]; [key: string]: any; diff --git a/packages/react-hooks/src/useFeatures.ts b/packages/react-hooks/src/useFeatures.ts index 282c9776ca..dc31af6db6 100644 --- a/packages/react-hooks/src/useFeatures.ts +++ b/packages/react-hooks/src/useFeatures.ts @@ -1,24 +1,5 @@ -import { useApi, useSetting } from '@webb-dapp/react-hooks'; import { AppFeatures } from '@webb-dapp/ui-components/types'; -import { useMemo } from 'react'; export const useFeatures = (features: AppFeatures[]): boolean => { - /* - const selectedEndpoint = useMemo( - () => - Object.values(selectableEndpoints) - .flat() - .find( - (endpoint) => String(endpoint.name).toLocaleLowerCase() === String(chainInfo.chainName).toLocaleLowerCase() - ), - [, selectableEndpoints] - ); - if (!selectedEndpoint) { - return false; - } - return features.reduce((acc: boolean, reqFeat) => { - return acc && selectedEndpoint.features[reqFeat]; - }, true); -*/ return true; }; diff --git a/packages/react-hooks/src/useIsAppReady.ts b/packages/react-hooks/src/useIsAppReady.ts deleted file mode 100644 index fefaa255b8..0000000000 --- a/packages/react-hooks/src/useIsAppReady.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* -import { get, isEmpty, noop } from 'lodash'; -import { useEffect, useState } from 'react'; - -import { useAccounts } from './useAccounts'; -import { useApi } from './useApi'; - -interface Options { - onSuccess?: () => void; - onError?: () => void; -} - -/!** - * @name useIsAppReady - * @description check app status, return true when chain connected and has active account, in ohter case return false. - *!/ -export const useIsAppReady = (options?: Options): boolean => { - const [appReadyStatus, setAppReadyStatus] = useState(false); - const { api } = useApi(); - const { active: activeAccount, authRequired } = useAccounts(); - - useEffect(() => { - const accountStatus = !authRequired || (!!activeAccount && !!activeAccount.address); - - const status = accountStatus && !isEmpty(api); - - // handle onSuccess or onError callback - (status ? get(options, 'onSuccess', noop) : get(options, 'onError', noop))(); - - if (status !== appReadyStatus) { - setAppReadyStatus(status); - } - /!* eslint-disable-next-line *!/ - }, [authRequired, activeAccount, api, options]); - - return appReadyStatus; -}; -*/ -export {}; diff --git a/packages/react-hooks/src/useStorage.ts b/packages/react-hooks/src/useStorage.ts deleted file mode 100644 index 0c017585bd..0000000000 --- a/packages/react-hooks/src/useStorage.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* -import { useCallback } from 'react'; - -import { useAccounts } from './useAccounts'; -import { useIsAppReady } from './useIsAppReady'; -import { useMemorized } from './useMemorized'; - -interface Options { - customPrefix?: string; - useAccountPrefix?: boolean; - useCustomPrefix?: boolean; -} - -type Get = (key: string) => string | null; -type Set = (key: string, value: string) => void; - -const getPrefixKey = (key: string, options: Options & { address: string }): string => { - if (options.useAccountPrefix) { - return `${options.address}_${key}`; - } - - if (options.useCustomPrefix) { - return `${options.customPrefix}_${key}`; - } - - return key; -}; - -export const useStorage = ( - _options: Options = { customPrefix: '', useAccountPrefix: true, useCustomPrefix: false } -): { getStorage: Get; setStorage: Set } => { - const options = useMemorized(_options); - const isReady = useIsAppReady(); - const { active: activeAccount } = useAccounts(); - - const getStorage: Get = useCallback( - (key) => { - if (options.useAccountPrefix) { - if (isReady && activeAccount) { - const _key = getPrefixKey(key, { ...options, address: activeAccount.address }); - - return window.localStorage.getItem(_key); - } - } else { - const _key = getPrefixKey(key, { ...options, address: '' }); - - return window.localStorage.getItem(_key); - } - - return null; - }, - [activeAccount, isReady, options] - ); - - const setStorage: Set = useCallback( - (key, value) => { - if (options.useAccountPrefix) { - if (isReady && activeAccount) { - const _key = getPrefixKey(key, { ...options, address: activeAccount.address }); - - window.localStorage.setItem(_key, value); - } - } else { - const _key = getPrefixKey(key, { ...options, address: '' }); - - window.localStorage.setItem(_key, value); - } - }, - [activeAccount, isReady, options] - ); - - return { getStorage, setStorage }; -}; -*/ -export {}; diff --git a/packages/react-hooks/src/utils/isSupportedCurrency.ts b/packages/react-hooks/src/utils/isSupportedCurrency.ts index 8287f104b3..f40906e3d5 100644 --- a/packages/react-hooks/src/utils/isSupportedCurrency.ts +++ b/packages/react-hooks/src/utils/isSupportedCurrency.ts @@ -1,3 +1,4 @@ +// @ts-ignore import { CurrencyId } from '@webb-tools/types/interfaces/types'; export const isSupportedCurrency = (currency: CurrencyId): boolean => { diff --git a/packages/ui-components/src/AmountInput/AmountInput.tsx b/packages/ui-components/src/AmountInput/AmountInput.tsx index f4e9bc700c..498e78c9fc 100644 --- a/packages/ui-components/src/AmountInput/AmountInput.tsx +++ b/packages/ui-components/src/AmountInput/AmountInput.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import styled, { css } from 'styled-components'; +import styled from 'styled-components'; const AmountInputWrapper = styled.div``; type AmountInputProps = {}; diff --git a/packages/ui-components/src/Icon.tsx b/packages/ui-components/src/Icon.tsx index 1fd817eeae..b24b1fb13c 100644 --- a/packages/ui-components/src/Icon.tsx +++ b/packages/ui-components/src/Icon.tsx @@ -1,3 +1,4 @@ +// @ts-nocheck import React, { ReactNode } from 'react'; import * as ArrowPixelIcon from './assets/arrow-pixel.svg'; diff --git a/packages/ui-components/src/Inputs/ChainInput/ChainInput.tsx b/packages/ui-components/src/Inputs/ChainInput/ChainInput.tsx index b02ec16c7b..fb9a3940b5 100644 --- a/packages/ui-components/src/Inputs/ChainInput/ChainInput.tsx +++ b/packages/ui-components/src/Inputs/ChainInput/ChainInput.tsx @@ -120,7 +120,6 @@ const DropdownInput: React.FC = ({ chains, onChange, value } const $wrapper = useRef(null); const [isOpen, setIsOpen] = useState(false); const theme = useColorPallet(); - console.log('Selected', selected); return ( <>
@@ -209,7 +208,6 @@ const DropdownInput: React.FC = ({ chains, onChange, value } role={'button'} onClick={() => { setIsOpen(false); - console.log(chainTypeId); onChange(chainTypeId); }} className={isSelected ? 'selected' : ''} diff --git a/packages/ui-components/src/Inputs/HeadlessDropDown/HeadlessDropDown.tsx b/packages/ui-components/src/Inputs/HeadlessDropDown/HeadlessDropDown.tsx index 9e0954c8b3..1ba072d772 100644 --- a/packages/ui-components/src/Inputs/HeadlessDropDown/HeadlessDropDown.tsx +++ b/packages/ui-components/src/Inputs/HeadlessDropDown/HeadlessDropDown.tsx @@ -1,6 +1,6 @@ import { MenuItem } from '@material-ui/core'; import Menu from '@material-ui/core/Menu'; -import React, { ComponentProps } from 'react'; +import React from 'react'; import styled from 'styled-components'; const HeadlessDropdownWrapper = styled.div` diff --git a/packages/ui-components/src/Inputs/InputLabel/InputLabel.tsx b/packages/ui-components/src/Inputs/InputLabel/InputLabel.tsx index fed43218df..49d48e3437 100644 --- a/packages/ui-components/src/Inputs/InputLabel/InputLabel.tsx +++ b/packages/ui-components/src/Inputs/InputLabel/InputLabel.tsx @@ -1,8 +1,7 @@ import { Typography } from '@material-ui/core'; -import { Pallet } from '@webb-dapp/ui-components/styling/colors'; import { FontFamilies } from '@webb-dapp/ui-components/styling/fonts/font-families.enum'; import React from 'react'; -import styled, { css } from 'styled-components'; +import styled from 'styled-components'; type LabelStatus = 'initial' | 'highlighted' | 'error'; diff --git a/packages/ui-components/src/Inputs/NoteInput/MixerNoteInput.tsx b/packages/ui-components/src/Inputs/NoteInput/MixerNoteInput.tsx index 2978e9d002..e45ab64f85 100644 --- a/packages/ui-components/src/Inputs/NoteInput/MixerNoteInput.tsx +++ b/packages/ui-components/src/Inputs/NoteInput/MixerNoteInput.tsx @@ -13,13 +13,6 @@ type NoteInputProps = { onChange(next: string): void; error?: string; }; -const NoteDetails = styled.div` - ${({ theme }: { theme: Pallet }) => css` - border-top: 2px solid ${theme.borderColor2}; - `}; - padding: 11px; - margin: 0 -11px; -`; export const MixerNoteInput: React.FC = ({ error, onChange, value }) => { const depositNote = useDepositNote(value); @@ -54,7 +47,6 @@ export const MixerNoteInput: React.FC = ({ error, onChange, valu value={value} inputProps={{ style: { fontSize: 14 } }} onChange={(event) => { - console.log(event.target.value); if (event.target.value && event.target.value != '') { onChange?.(event.target.value as string); } diff --git a/packages/ui-components/src/Inputs/WalletSelect/WalletDetails.tsx b/packages/ui-components/src/Inputs/WalletSelect/WalletDetails.tsx index 4387b86001..3839c8e0c5 100644 --- a/packages/ui-components/src/Inputs/WalletSelect/WalletDetails.tsx +++ b/packages/ui-components/src/Inputs/WalletSelect/WalletDetails.tsx @@ -10,28 +10,6 @@ import styled, { css } from 'styled-components'; import { getRoundedAmountString } from '../..'; -const ColorCircle1 = styled.div<{ color: string }>` - position: absolute; - border-radius: 50%; - top: 80px; - left: 40px; - height: 120px; - width: 120px; - transform: rotate(-15deg) - background: ${({ color }) => color}; -`; - -const ColorCircle2 = styled.div<{ color: string }>` - position: absolute; - border-radius: 50%; - top: 80px; - left: 60px; - height: 120px; - width: 120px; - transform: rotate(-15deg); - background: ${({ color }) => color}; -`; - const ConnectionDetails = styled.div<{ walletId: number }>` display: flex; border-radius: 10px; diff --git a/packages/ui-components/src/Inputs/WalletSelect/WalletManager.tsx b/packages/ui-components/src/Inputs/WalletSelect/WalletManager.tsx index 27a1507315..455c783bcf 100644 --- a/packages/ui-components/src/Inputs/WalletSelect/WalletManager.tsx +++ b/packages/ui-components/src/Inputs/WalletSelect/WalletManager.tsx @@ -1,6 +1,5 @@ import { useWebContext } from '@webb-dapp/react-environment/webb-context'; import { useWallets } from '@webb-dapp/react-hooks/useWallets'; -import { above } from '@webb-dapp/ui-components/utils/responsive-utils'; import { ManagedWallet } from '@webb-tools/api-providers/types/wallet-config.interface'; import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/ui-components/src/Modal/Modal.tsx b/packages/ui-components/src/Modal/Modal.tsx index 78b3d07546..2d97d5bbb2 100644 --- a/packages/ui-components/src/Modal/Modal.tsx +++ b/packages/ui-components/src/Modal/Modal.tsx @@ -1,14 +1,11 @@ /* eslint-disable sort-keys */ import { createStyles, Theme } from '@material-ui/core'; -import Icon from '@material-ui/core/Icon'; import MuiModel, { ModalProps as MuiModalProps } from '@material-ui/core/Modal'; import Slide from '@material-ui/core/Slide'; import { makeStyles } from '@material-ui/core/styles'; import Tooltip from '@material-ui/core/Tooltip'; import React from 'react'; -// import PerfectScrollbar from 'react-perfect-scrollbar'; - export interface ModalProps extends Omit { closeButton?: boolean; unlimitedWidth?: boolean; @@ -91,7 +88,6 @@ export const Modal: React.FC = ({ children, closeButton, unlimitedWi