From c58117a872fb4c26456f717808cdb27a6b7e2ec5 Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Wed, 18 May 2022 20:51:31 -0500 Subject: [PATCH] chore: initial repo clean (#392) --- .github/workflows/pr-any.yml | 10 +- packages/apps/public/assets/websnark.js | 3 - .../apps/src/configs/chains/chain-config.ts | 34 ----- .../src/configs/currencies/currency-config.ts | 23 ---- packages/apps/src/configs/ipfs/evm/anchors.ts | 1 + .../src/configs/logos/chains/EdgewareLogo.tsx | 31 ----- ...{TornadoPageLogo.tsx => MixerPageLogo.tsx} | 2 +- packages/apps/src/configs/relayer-config.ts | 2 - .../src/configs/wallets/wallets-config.ts | 3 - packages/apps/src/sidebar-config.tsx | 6 +- .../bridge/src/components/Deposit/Deposit.tsx | 2 +- .../DepositConfirm/DepositAmountDecal.tsx | 2 +- .../DepositConfirm/DepositConfirm.tsx | 2 - .../src/components/Withdraw/Withdraw.tsx | 5 +- .../src/hooks/deposit/useBridgeDeposit.tsx | 6 - .../bridge/src/hooks/withdraw/useWithdraw.tsx | 3 - .../src/utils/currency/coins-icon/EDG.svg | 20 --- .../bridge/src/utils/currency/constants.ts | 18 +-- .../mixer/src/components/Deposit/Deposit.tsx | 1 - .../DepositConfirm/DepositConfirm.tsx | 1 - .../src/components/Withdraw/Withdraw.tsx | 22 +-- .../mixer/src/hooks/deposit/useDeposit.tsx | 2 +- .../hooks/mixer-groups-entry-wrapper.class.ts | 1 + packages/mixer/src/hooks/note/index.ts | 1 - .../mixer/src/hooks/withdraw/useWithdraw.tsx | 3 - .../src/utils/currency/coins-icon/EDG.svg | 20 --- .../mixer/src/utils/currency/constants.ts | 18 +-- packages/page-mixer/src/index.tsx | 44 +----- .../src/AmountInput/AmountInput.tsx | 2 +- .../src/AppBar/ThemeSwitcher.tsx | 1 - .../src/IPDisplay/IPDisplay.tsx | 5 +- .../UnselectedNetworkView.tsx | 3 +- .../src/Notices/NoExtensions.tsx | 24 ---- .../PermissionedAccess/PermissionedAccess.tsx | 1 - .../react-components/src/Sidebar/Products.tsx | 6 +- .../react-components/src/Sidebar/types.ts | 2 +- .../src/assets/NetworksGlobeCircled.png | Bin 0 -> 11186 bytes .../src/assets/edgeware-network.svg | 20 --- packages/react-components/src/types.ts | 1 + .../react-environment/src/SettingProvider.tsx | 1 - .../react-environment/src/WebbProvider.tsx | 10 +- .../src/app-event/app-event.spec.ts | 5 - .../src/app-event/app-events.class.ts | 1 + .../evm-network-conflict.ts | 9 -- .../react-environment/src/store/index.tsx | 2 +- .../src/webb-context/webb-context.ts | 6 - packages/react-hooks/src/councilHooks.ts | 126 ------------------ packages/react-hooks/src/index.ts | 6 - packages/react-hooks/src/types.ts | 1 + packages/react-hooks/src/useCall.ts | 126 ------------------ packages/react-hooks/src/useConstants.tsx | 5 +- packages/react-hooks/src/useFeatures.ts | 19 --- packages/react-hooks/src/useIsAppReady.ts | 39 ------ packages/react-hooks/src/useStorage.ts | 75 ----------- .../src/utils/isSupportedCurrency.ts | 1 + .../src/AmountInput/AmountInput.tsx | 2 +- packages/ui-components/src/Icon.tsx | 1 + .../src/Inputs/ChainInput/ChainInput.tsx | 2 - .../HeadlessDropDown/HeadlessDropDown.tsx | 2 +- .../src/Inputs/InputLabel/InputLabel.tsx | 3 +- .../src/Inputs/NoteInput/MixerNoteInput.tsx | 8 -- .../src/Inputs/WalletSelect/WalletDetails.tsx | 22 --- .../src/Inputs/WalletSelect/WalletManager.tsx | 1 - packages/ui-components/src/Modal/Modal.tsx | 4 - packages/ui-components/src/types.ts | 2 +- packages/utils/src/edg-to-evm.ts | 10 -- packages/utils/src/evm-to-edg.ts | 1 - scripts/add-snark.js | 3 - scripts/deploy-dev.js | 14 -- 69 files changed, 50 insertions(+), 808 deletions(-) delete mode 100644 packages/apps/src/configs/logos/chains/EdgewareLogo.tsx rename packages/apps/src/configs/logos/pages/{TornadoPageLogo.tsx => MixerPageLogo.tsx} (86%) delete mode 100644 packages/bridge/src/utils/currency/coins-icon/EDG.svg delete mode 100644 packages/mixer/src/utils/currency/coins-icon/EDG.svg create mode 100644 packages/react-components/src/assets/NetworksGlobeCircled.png delete mode 100644 packages/react-components/src/assets/edgeware-network.svg delete mode 100644 packages/react-environment/src/app-event/app-event.spec.ts delete mode 100644 packages/react-hooks/src/councilHooks.ts delete mode 100644 packages/react-hooks/src/useCall.ts delete mode 100644 packages/react-hooks/src/useIsAppReady.ts delete mode 100644 packages/react-hooks/src/useStorage.ts delete mode 100644 packages/utils/src/edg-to-evm.ts delete mode 100644 packages/utils/src/evm-to-edg.ts 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 0000000000000000000000000000000000000000..9ac2a8d53c0a60e9dd5da8dc6c78d731d3e80e6e GIT binary patch literal 11186 zcmb_?WmjBH({(}!0fM``4estbxVr@igS-2MySoPu5Fj`V7Tk4k2@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D0ZG*U^kTo1 z51*1uvpsWF;tKDaOX#!rHgo5V#m$UuK8yG`8n-yPbjH-9B(~%Za5<7lh1Zx5CL@6U z@-!B3LCRI4fdD0#yXfcc+`c)lm!w{z+oYB7S?d=2*1WhLK<*PM9?v(eL5EH`Mh|n7?)}K zHx}wdAIB(W3W=>J3QdQ0`A?uw5G2a$#?z}Qc#w*cT&!!~!J909Ht-y~$oF3Ae*pF` z4i$sH$qMAs)IJzpz|}2MG9738I=6Z@g`0e$waNWM_K)$ArDqyi)K$> zV!jDdnP-4AFgWSdC*GR!`0OC`)47~dtg+9$S7B(s+4**BA-S;t1hPcD{Z7VaG7C1n zKexc&gk`C#K(URS*ZpJOA-Is3BiOzNe8Kj+rYACb6rP|1A9}YRrZbsV7W1a>AIR3i zseFSi+UJZIp7n!|K8xO7R!K_s(krhkn&OWpm&Tk_52Q87DEaAvyv_ty(*kQEUuVQM zneY}Tn_Xm@vtgI}niO@Xs>r=MO)}4~#c)bcRE^h?e5O}j;Hs?<8p4E9#?cb z@8GIRyp`c1xgL70W-VS!ST&+v+uTrCKF9R$W`xmjn=1|LS&xR(BPX55Bf=c&E)S3! z^zwtjf|S?4<*}cfIvu6u|f>+5L?5V<#jAh@I=xzu*n zh&K2e0)qnt&qitG#RM+;5ff_!sS9CT^aiAaZkvhty@&8N5JP9$Tj(qXmfCI{BJV>9 zxr3_55;3}AW=yJ*xeI5INh6bZ*oouJgSA}eBs46Sp zCgF;}cdf2*dqzZaIB|D+@fRFy3MjK95!*6#+~~!&lA709kIiQ}r)yM&1fDz7d;j@b z@16l-hYIV9wsFz{BEM{nQ8oO%*x@JjczgugO&{qk`DJL)RO~x5dP!gMNy4=-hxwws zrbk6i#*L2g_N^GdZf;mJm7InZ#S|P>AQS#BVWSXhuj&asrk}vhyO`E N73I`q>!rVh{U5z$51{}6 literal 0 HcmV?d00001 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