diff --git a/package.json b/package.json index 12ebfd658a..f62f23c31e 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,6 @@ "@babel/preset-stage-3": "^7.8.3", "@babel/preset-typescript": "^7.12.7", "@babel/register": "^7.6.2", - "@metamask/detect-provider": "^1.2.0", "@typescript-eslint/eslint-plugin": "^4.8.1", "@typescript-eslint/parser": "^4.8.1", "abortcontroller-polyfill": "^1.3.0", diff --git a/src/common/web3connect/index.ts b/src/common/web3connect/index.ts index eb93ffad0b..0e1d8c847a 100644 --- a/src/common/web3connect/index.ts +++ b/src/common/web3connect/index.ts @@ -6,7 +6,7 @@ import INJECTED_TYPE from './providers/InjectedType' import getProviderByName from './providers' import { isInjectedEnabled } from './providers' import { isMobile } from 'react-device-detect' -import detectEthereumProvider from '@metamask/detect-provider' + export default class Web3Connect extends EventEmitter { _cachedProvider = null @@ -105,13 +105,11 @@ export default class Web3Connect extends EventEmitter { getInjectedType() { if (window && window.ethereum) { - //@ts-ignore if (window.ethereum.isLiquality) return INJECTED_TYPE.LIQUALITY - //@ts-ignore if (window.ethereum.isTrust) return INJECTED_TYPE.TRUST if (window.ethereum.isMetaMask) return INJECTED_TYPE.METAMASK - //@ts-ignore - if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) return INJECTED_TYPE.OPERA + if ((!!window.opr && !!window.opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) return INJECTED_TYPE.OPERA + return INJECTED_TYPE.UNKNOWN } else { return INJECTED_TYPE.NONE @@ -129,11 +127,6 @@ export default class Web3Connect extends EventEmitter { } } - async tryDetect() { - const provider = await detectEthereumProvider() - console.log(provider) - } - isInjectedEnabled() { return isInjectedEnabled() } @@ -205,7 +198,6 @@ export default class Web3Connect extends EventEmitter { // @ToDo - Hard fix walletconnect // https://github.com/WalletConnect/walletconnect-monorepo/issues/384 if (window) { - //@ts-ignore window.send = (e,t) => { return _web3provider.send(e,t) } diff --git a/src/common/web3connect/providers/InjectedProvider.ts b/src/common/web3connect/providers/InjectedProvider.ts index 054db6c739..cedcb5f782 100644 --- a/src/common/web3connect/providers/InjectedProvider.ts +++ b/src/common/web3connect/providers/InjectedProvider.ts @@ -15,17 +15,12 @@ export default class InjectedProvider extends InjectedConnector { } async isConnected() { - //@ts-ignore - if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) { + if ((!!window.opr && !!window.opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) { // This is opera - //@ts-ignore await window.ethereum.enable() - //@ts-ignore return window.ethereum.isConnected() } else { - //@ts-ignore if (window.ethereum.isTrust) { - //@ts-ignore return window.ethereum.ready } return await super.isAuthorized() diff --git a/src/front/global.d.ts b/src/front/global.d.ts index a95d998e64..0a00d78886 100644 --- a/src/front/global.d.ts +++ b/src/front/global.d.ts @@ -6,4 +6,22 @@ declare module 'react' { type?: string; title?: any; } +} + +declare global { + interface IEtheriumProvider { + [key: string]: any; + isLiquality?: boolean; + isTrust?: boolean; + isMetaMask?: boolean; + } + + interface Window { + [key: string]: any; + ethereum?: IEtheriumProvider; + } + + interface Navigator { + [key: string]: any + } } \ No newline at end of file diff --git a/src/front/shared/components/Header/Header.tsx b/src/front/shared/components/Header/Header.tsx index e7dc2d2082..ebd64fd5c9 100644 --- a/src/front/shared/components/Header/Header.tsx +++ b/src/front/shared/components/Header/Header.tsx @@ -253,13 +253,10 @@ export default class Header extends Component { if (isWidgetBuild) { if ( - //@ts-ignore window.widgetERC20Tokens && - //@ts-ignore Object.keys(window.widgetERC20Tokens).length ) { // Multi token widget build - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetCurrencies.push(key.toUpperCase()); }); @@ -450,13 +447,12 @@ export default class Header extends Component { } = this.props; const { exchange, wallet } = links; + const onLogoClickLink = - //@ts-ignore window && window.LOGO_REDIRECT_LINK - //@ts-ignore ? window.LOGO_REDIRECT_LINK : localisedUrl(locale, links.home); - //@ts-ignore + const hasOwnLogoLink = window && window.LOGO_REDIRECT_LINK; const isWalletPage = @@ -470,7 +466,6 @@ export default class Header extends Component { logo @@ -491,8 +486,6 @@ export default class Header extends Component { :
- {/* - //@ts-ignore */} {window.logoUrl !== "#" && (
{hasOwnLogoLink ? ( @@ -520,7 +513,7 @@ export default class Header extends Component { declineRequest={this.declineRequest} /> ) - //@ts-ignore + if (isMobile && window.logoUrl) { return (
@@ -583,7 +576,6 @@ export default class Header extends Component {
{ } return ( - //@ts-ignore window.isUserRegisteredAndLoggedIn &&
{/* diff --git a/src/front/shared/components/Header/WidgetTours/WidgetWalletTour.tsx b/src/front/shared/components/Header/WidgetTours/WidgetWalletTour.tsx index 2d58fc624c..016aa45086 100644 --- a/src/front/shared/components/Header/WidgetTours/WidgetWalletTour.tsx +++ b/src/front/shared/components/Header/WidgetTours/WidgetWalletTour.tsx @@ -19,7 +19,6 @@ export class WidgetWalletTour extends Component { content: , placement: 'center', diff --git a/src/front/shared/components/Logo/Logo.tsx b/src/front/shared/components/Logo/Logo.tsx index 19eeaa8142..9907d8a212 100644 --- a/src/front/shared/components/Logo/Logo.tsx +++ b/src/front/shared/components/Logo/Logo.tsx @@ -30,15 +30,12 @@ export default class Logo extends Component { isExchange } = this.props; - //@ts-ignore const isNoLogo = !(window.logoUrl === `#`) const srcFiles = isColored ? images.colored : images.common; const { host, href } = window.location; const file = Object.keys(srcFiles).find(el => window.location.href.includes(el)) || "base" - //@ts-ignore const onLogoClickLink = (window && window.LOGO_REDIRECT_LINK) ? window.LOGO_REDIRECT_LINK : localisedUrl(locale, links.home) - //@ts-ignore const hasOwnLogoLink = (window && window.LOGO_REDIRECT_LINK) const imgNode = React.createElement("img", { @@ -76,7 +73,6 @@ export default class Logo extends Component { ) : (
{isNoLogo && ( - //@ts-ignore Wallet )}
diff --git a/src/front/shared/components/PreventMultiTabs/PreventMultiTabs.tsx b/src/front/shared/components/PreventMultiTabs/PreventMultiTabs.tsx index e1141f978c..bdee322c67 100644 --- a/src/front/shared/components/PreventMultiTabs/PreventMultiTabs.tsx +++ b/src/front/shared/components/PreventMultiTabs/PreventMultiTabs.tsx @@ -54,7 +54,6 @@ export default class PreventMultiTabs extends Component { )} diff --git a/src/front/shared/components/layout/DashboardLayout/DashboardLayout.tsx b/src/front/shared/components/layout/DashboardLayout/DashboardLayout.tsx index de85682412..573e94fe8c 100644 --- a/src/front/shared/components/layout/DashboardLayout/DashboardLayout.tsx +++ b/src/front/shared/components/layout/DashboardLayout/DashboardLayout.tsx @@ -84,13 +84,10 @@ const NewDesignLayout = (props) => { widgetCurrencies.push('ETH') if (isWidgetBuild) { if ( - //@ts-ignore window.widgetERC20Tokens && - //@ts-ignore Object.keys(window.widgetERC20Tokens).length ) { // Multi token widget build - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetCurrencies.push(key.toUpperCase()) }) @@ -145,14 +142,10 @@ const NewDesignLayout = (props) => { return (
- {/* - //@ts-ignore*/} {window.CUSTOM_LOGO && ( - //@ts-ignore logo )}
{ let widgetMultiTokens = [] if ( - //@ts-ignore window.widgetERC20Tokens && - //@ts-ignore Object.keys(window.widgetERC20Tokens).length ) { - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetMultiTokens.push(key.toUpperCase()) }) } const tokens = config && config.isWidget - //@ts-ignore ? window.widgetERC20Tokens && - //@ts-ignore Object.keys(window.widgetERC20Tokens).length ? widgetMultiTokens : [config.erc20token.toUpperCase()] diff --git a/src/front/shared/components/layout/ScrollToTop/ScrollToTop.ts b/src/front/shared/components/layout/ScrollToTop/ScrollToTop.ts index b8a705cd1b..d75433d964 100644 --- a/src/front/shared/components/layout/ScrollToTop/ScrollToTop.ts +++ b/src/front/shared/components/layout/ScrollToTop/ScrollToTop.ts @@ -4,7 +4,6 @@ import { withRouter } from 'react-router-dom' class ScrollToTop extends Component { componentDidUpdate(prevProps) { - //@ts-ignore if (this.props.location.pathname !== prevProps.location.pathname) { window.scrollTo(0, 0) } diff --git a/src/front/shared/components/modals/OfferModal/AddOffer/AddOffer.tsx b/src/front/shared/components/modals/OfferModal/AddOffer/AddOffer.tsx index d3a1f9efc1..2f25bcaad9 100644 --- a/src/front/shared/components/modals/OfferModal/AddOffer/AddOffer.tsx +++ b/src/front/shared/components/modals/OfferModal/AddOffer/AddOffer.tsx @@ -64,9 +64,7 @@ export default class AddOffer extends Component { super() if (config && config.isWidget) { - //@ts-ignore if (window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { minAmountOffer[key] = 1 }) diff --git a/src/front/shared/components/modals/RegisterSMSProtected/RegisterSMSProtected.tsx b/src/front/shared/components/modals/RegisterSMSProtected/RegisterSMSProtected.tsx index 7174111837..0df6bc1272 100644 --- a/src/front/shared/components/modals/RegisterSMSProtected/RegisterSMSProtected.tsx +++ b/src/front/shared/components/modals/RegisterSMSProtected/RegisterSMSProtected.tsx @@ -64,7 +64,6 @@ export default class RegisterSMSProtected extends React.Component { this.state = { version, - //@ts-ignore phone: window.DefaultCountryCode || '', step, error: false, diff --git a/src/front/shared/components/modals/Share/Share.tsx b/src/front/shared/components/modals/Share/Share.tsx index b80dc3efbe..a756a531a2 100644 --- a/src/front/shared/components/modals/Share/Share.tsx +++ b/src/front/shared/components/modals/Share/Share.tsx @@ -30,9 +30,8 @@ export default class Share extends Component { componentDidMount = () => { const { props: { data: { link, title } } } = this - //@ts-ignore + if (navigator.share) { - //@ts-ignore navigator.share({ title: title, url: link diff --git a/src/front/shared/containers/App/App.tsx b/src/front/shared/containers/App/App.tsx index 1a28863583..a67e37ad78 100644 --- a/src/front/shared/containers/App/App.tsx +++ b/src/front/shared/containers/App/App.tsx @@ -36,8 +36,6 @@ import { FormattedMessage, injectIntl, defineMessages } from 'react-intl' import metamask from 'helpers/metamask' - -//@ts-ignore const userLanguage = (navigator.userLanguage || navigator.language || "en-gb").split("-")[0]; moment.locale(userLanguage) @@ -306,7 +304,6 @@ class App extends React.Component, any> { this.processMetamask() this.checkIfDashboardModalsAllowed() - //@ts-ignore window.actions = actions; window.onerror = error => { @@ -324,9 +321,8 @@ class App extends React.Component, any> { actions.user.sign(); await createSwapApp(); - //@ts-ignore + this.setState(() => ({ fetching: true })); - //@ts-ignore window.prerenderReady = true; const appInstalled = (e) => { diff --git a/src/front/shared/helpers/constants/TRADE_TICKERS.ts b/src/front/shared/helpers/constants/TRADE_TICKERS.ts index 07d791d3aa..a97a888f06 100644 --- a/src/front/shared/helpers/constants/TRADE_TICKERS.ts +++ b/src/front/shared/helpers/constants/TRADE_TICKERS.ts @@ -28,9 +28,7 @@ Object.keys(config.erc20) if (config && config.isWidget) { swap.length = 0 - //@ts-ignore if (window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { swap.push(`${key.toUpperCase()}-BTC`) if (!config.opts.curEnabled || config.opts.curEnabled.ghost) swap.push(`${key.toUpperCase()}-GHOST`) diff --git a/src/front/shared/helpers/externalConfig.ts b/src/front/shared/helpers/externalConfig.ts index d2a984e26a..12ee82e833 100644 --- a/src/front/shared/helpers/externalConfig.ts +++ b/src/front/shared/helpers/externalConfig.ts @@ -64,61 +64,45 @@ const externalConfig = () => { if (window - //@ts-ignore && window._ui_footerDisabled ) { - //@ts-ignore config.opts.ui.footerDisabled = window._ui_footerDisabled } if (window - //@ts-ignore && window.WPuserHash ) { - //@ts-ignore config.opts.WPuserHash = window.WPuserHash - //@ts-ignore window.WPuserHash = false } if (window - //@ts-ignore && window.showHowItWorksOnExchangePage ) { - //@ts-ignore config.showHowItsWork = window.showHowItWorksOnExchangePage } if (window - //@ts-ignore && window.buildOptions - //@ts-ignore && Object.keys(window.buildOptions) - //@ts-ignore && Object.keys(window.buildOptions).length ) { - //@ts-ignore config.opts = { ...config.opts, ...window.buildOptions } } if (window - //@ts-ignore && window.DEFAULT_FIAT ) { - //@ts-ignore config.opts.activeFiat = window.DEFAULT_FIAT } reducers.user.setActiveFiat({ activeFiat: config.opts.activeFiat }) if (window - //@ts-ignore && window.EXCHANGE_DISABLED ) { - //@ts-ignore config.opts.exchangeDisabled = window.EXCHANGE_DISABLED } if (window - //@ts-ignore && window.CUR_BTC_DISABLED ) { if (!config.opts.curEnabled) config.opts.curEnabled = {} @@ -127,9 +111,7 @@ const externalConfig = () => { if (window) { if (!config.opts.curEnabled) config.opts.curEnabled = {} - //@ts-ignore if (window.CUR_GHOST_DISABLED !== undefined - //@ts-ignore && window.CUR_GHOST_DISABLED === false ) { config.opts.curEnabled.ghost = true @@ -138,9 +120,7 @@ const externalConfig = () => { if (window) { if (!config.opts.curEnabled) config.opts.curEnabled = {} - //@ts-ignore if (window.CUR_NEXT_DISABLED !== undefined - //@ts-ignore && window.CUR_NEXT_DISABLED === false ) { config.opts.curEnabled.next = true @@ -148,7 +128,6 @@ const externalConfig = () => { } if (window - //@ts-ignore && window.CUR_ETH_DISABLED ) { if (!config.opts.curEnabled) config.opts.curEnabled = {} @@ -156,67 +135,48 @@ const externalConfig = () => { } // Plugins if (window - //@ts-ignore && window.backupPlugin - //@ts-ignore && window.backupUrl - //@ts-ignore && window.restoreUrl ) { - //@ts-ignore config.opts.plugins.backupPlugin = window.backupPlugin - //@ts-ignore config.opts.plugins.backupPluginUrl = window.backupUrl - //@ts-ignore config.opts.plugins.restorePluginUrl = window.restoreUrl } if (window - //@ts-ignore && window.setItemPlugin ) { - //@ts-ignore config.opts.plugins.setItemPlugin = window.setItemPlugin } if (window - //@ts-ignore && window.getItemPlugin ) { - //@ts-ignore config.opts.plugins.getItemPlugin = window.getItemPlugin } if (window - //@ts-ignore && window.userDataPluginApi ) { - //@ts-ignore config.opts.plugins.userDataPluginApi = window.userDataPluginApi } // ------ if (window - //@ts-ignore && window.buyViaCreditCardLink ) { - //@ts-ignore config.opts.buyViaCreditCardLink = window.buyViaCreditCardLink } if (window - //@ts-ignore && window.SWAP_HIDE_EXPORT_PRIVATEKEY !== undefined ) { - //@ts-ignore config.opts.hideShowPrivateKey = window.SWAP_HIDE_EXPORT_PRIVATEKEY } if (window - //@ts-ignore && window.widgetERC20Tokens - //@ts-ignore && Object.keys(window.widgetERC20Tokens) ) { - //@ts-ignore config.opts.ownTokens = window.widgetERC20Tokens } @@ -266,19 +226,14 @@ const externalConfig = () => { // Comission config - default false if (window - //@ts-ignore && window.widgetERC20Comisions - //@ts-ignore && Object.keys(window.widgetERC20Comisions) ) { let setErc20FromEther = false - //@ts-ignore Object.keys(window.widgetERC20Comisions).filter((key) => { const curKey = key.toLowerCase() - //@ts-ignore if (window.widgetERC20Comisions[curKey]) { - //@ts-ignore let { fee, address, min } = window.widgetERC20Comisions[curKey] let feeOk = false let minOk = false diff --git a/src/front/shared/helpers/firebase/firestore.ts b/src/front/shared/helpers/firebase/firestore.ts index 9cd14d0144..b4decec456 100644 --- a/src/front/shared/helpers/firebase/firestore.ts +++ b/src/front/shared/helpers/firebase/firestore.ts @@ -33,11 +33,9 @@ const addData = (collection, doc, data) => { return new Promise(async (resolve) => { try { - //@ts-ignore const db = firebase.firestore(window.firebaseDefaultInstance) db.collection(collection).doc(doc).set(data) .then((docRef) => { - //@ts-ignore resolve(docRef) }) .catch((e) => console.error('Promise add data error: ', e)) @@ -68,11 +66,9 @@ const updateData = (collection, doc, data) => { return new Promise(async (resolve) => { try { - //@ts-ignore const db = firebase.firestore(window.firebaseDefaultInstance) db.collection(collection).doc(doc).update(data) .then((docRef) => { - //@ts-ignore resolve(docRef) }) .catch((e) => { diff --git a/src/front/shared/helpers/firebase/index.ts b/src/front/shared/helpers/firebase/index.ts index 11c63b570d..307eb0313a 100644 --- a/src/front/shared/helpers/firebase/index.ts +++ b/src/front/shared/helpers/firebase/index.ts @@ -67,7 +67,6 @@ const sendData = (userId, dataBasePath, data, isDefault = true) => new Promise(async (resolve) => { const database = isDefault ? firebase.database() - //@ts-ignore : firebase.database(window.clientDBinstance) const usersRef = database.ref(dataBasePath) @@ -111,7 +110,7 @@ const initialize = () => { try { const firebaseApp = firebase.initializeApp(config) - //@ts-ignore + window.firebaseDefaultInstance = firebaseApp firebase.firestore(firebaseApp) diff --git a/src/front/shared/helpers/links.ts b/src/front/shared/helpers/links.ts index 500b707915..4b16e2e1d8 100644 --- a/src/front/shared/helpers/links.ts +++ b/src/front/shared/helpers/links.ts @@ -184,7 +184,6 @@ export const getTokenWallet = (token) => { return `/token/${token.toUpperCase()}/${address}` } -//@ts-ignore window.getTokenWallet = getTokenWallet export const getFullOrigin = () => `${location.origin}${location.pathname}#` diff --git a/src/front/shared/helpers/metamask.ts b/src/front/shared/helpers/metamask.ts index ea9fd9f371..4003429ebf 100644 --- a/src/front/shared/helpers/metamask.ts +++ b/src/front/shared/helpers/metamask.ts @@ -191,7 +191,6 @@ const metamaskApi = { isCorrectNetwork, } -//@ts-ignore window.metamaskApi = metamaskApi export default metamaskApi diff --git a/src/front/shared/helpers/nimiq.ts b/src/front/shared/helpers/nimiq.ts index a8f17a8f78..15e3554afd 100644 --- a/src/front/shared/helpers/nimiq.ts +++ b/src/front/shared/helpers/nimiq.ts @@ -1,14 +1,10 @@ const ethKeyToKeyPair = (ethKey) => { - //@ts-ignore if (!window.Nimiq) throw new Error('include Nimiq from CDN') const raw = ethKey.slice(0, 2) === '0x' ? ethKey.substring(2) : ethKey const buf = Buffer.from(raw, 'hex') - //@ts-ignore const privKey = new window.Nimiq.PrivateKey(buf) - //@ts-ignore const publicKey = window.Nimiq.PublicKey.derive(privKey) - //@ts-ignore return new window.Nimiq.KeyPair(privKey, publicKey) } @@ -24,11 +20,8 @@ const followTransaction = ($, tx) => const prepareTransaction = ($, address, amount) => { const height = $.blockchain.height + 1 - //@ts-ignore const addr = window.Nimiq.Address.fromUserFriendlyAddress(address) - //@ts-ignore const value = window.Nimiq.Policy.coinsToSatoshis(amount) - //@ts-ignore const fee = window.Nimiq.Policy.coinsToSatoshis(0) return { addr, value, fee, height } diff --git a/src/front/shared/helpers/seo.ts b/src/front/shared/helpers/seo.ts index 9e306d3db9..c8b07f06fb 100644 --- a/src/front/shared/helpers/seo.ts +++ b/src/front/shared/helpers/seo.ts @@ -11,7 +11,6 @@ const seo = { pages: [ { uri: '/', - //@ts-ignore title: window.defaultWindowTitle || 'Hot Wallet with Atomic Swap Exchange', description: 'Our online wallet with Atomic swap algorithms will help you store and exchange' + ' cryptocurrency instantly and more secure without third-parties. Decentralized exchange.', diff --git a/src/front/shared/helpers/wpLogoutModal.ts b/src/front/shared/helpers/wpLogoutModal.ts index c3437d5b03..510e6da7ac 100644 --- a/src/front/shared/helpers/wpLogoutModal.ts +++ b/src/front/shared/helpers/wpLogoutModal.ts @@ -47,7 +47,7 @@ const handleConfirm = () => { } else { window.localStorage.clear() } - //@ts-ignore + window.location = (window && window.logoutUrl) ? window.logoutUrl : '/wp-login.php?action=logout' }) } diff --git a/src/front/shared/instances/newSwap.ts b/src/front/shared/instances/newSwap.ts index 219396b150..d12e8321e9 100644 --- a/src/front/shared/instances/newSwap.ts +++ b/src/front/shared/instances/newSwap.ts @@ -260,7 +260,6 @@ const createSwapApp = async () => { // }), // ) : null - //@ts-ignore window.SwapApp = SwapApp.shared() _inited = true }) diff --git a/src/front/shared/pages/CreateWallet/CreateWallet.tsx b/src/front/shared/pages/CreateWallet/CreateWallet.tsx index bb0c99fb66..9bbd31def3 100644 --- a/src/front/shared/pages/CreateWallet/CreateWallet.tsx +++ b/src/front/shared/pages/CreateWallet/CreateWallet.tsx @@ -78,10 +78,8 @@ const CreateWallet = (props) => { ] if (isWidgetBuild) { - //@ts-ignore if (window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { // Multi token widget build - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetCurrencies.push(key.toUpperCase()) }) @@ -145,10 +143,8 @@ const CreateWallet = (props) => { ] if (isWidgetBuild) { - //@ts-ignore if (window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { // Multi token widget build - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetCurrencies.push(key.toUpperCase()) }) diff --git a/src/front/shared/pages/CreateWallet/Steps/LogicForSteps.tsx b/src/front/shared/pages/CreateWallet/Steps/LogicForSteps.tsx index 9bba70db64..ad8b80e3ef 100644 --- a/src/front/shared/pages/CreateWallet/Steps/LogicForSteps.tsx +++ b/src/front/shared/pages/CreateWallet/Steps/LogicForSteps.tsx @@ -91,10 +91,8 @@ export default class LogicForSteps extends Component { const curState = {} items.forEach(({ currency }) => { curState[currency] = false }) if (isWidgetBuild && config && config.erc20) { - //@ts-ignore if (window && window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { // Multi token build - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((tokenSymbol) => { if (config.erc20[tokenSymbol]) { this.widgetStartPack.push({ diff --git a/src/front/shared/pages/Exchange/CurrencySlider/CurrencySlider.tsx b/src/front/shared/pages/Exchange/CurrencySlider/CurrencySlider.tsx index 35d2200faf..bb4da2dda1 100644 --- a/src/front/shared/pages/Exchange/CurrencySlider/CurrencySlider.tsx +++ b/src/front/shared/pages/Exchange/CurrencySlider/CurrencySlider.tsx @@ -10,7 +10,6 @@ import { FormattedMessage } from 'react-intl' import images from './images' -//@ts-ignore const tokens = window.widgetERC20Tokens ? Object.keys(window.widgetERC20Tokens) : ['swap'] const names = ['btc', 'eth', ...tokens] @@ -30,13 +29,9 @@ export default class CurrencySlider extends Component { } getItemImage(name) { - //@ts-ignore if (window.widgetERC20Tokens - //@ts-ignore && window.widgetERC20Tokens[name] - //@ts-ignore && window.widgetERC20Tokens[name].icon - //@ts-ignore ) return window.widgetERC20Tokens[name].icon if (images[name]) return images[name] diff --git a/src/front/shared/pages/Swap/Swap.tsx b/src/front/shared/pages/Swap/Swap.tsx index 7d12c0115f..9b624ea5ed 100644 --- a/src/front/shared/pages/Swap/Swap.tsx +++ b/src/front/shared/pages/Swap/Swap.tsx @@ -168,13 +168,10 @@ export default class SwapComponent extends PureComponent { }) try { - //@ts-ignore const swap = new Swap(orderId, SwapApp.shared()) console.log('Swap flow:', swap.flow._flowName); - //@ts-ignore window.swap = swap - //@ts-ignore window.flow = swap.flow const SwapComponent = swapComponents[swap.flow._flowName] @@ -327,7 +324,6 @@ export default class SwapComponent extends PureComponent { deleteThisSwap = (orderId) => { actions.core.saveDeletedOrder(orderId) actions.core.forgetOrders(orderId) - //@ts-ignore window.swap = null } diff --git a/src/front/shared/pages/Wallet/Row/Row.tsx b/src/front/shared/pages/Wallet/Row/Row.tsx index a1071e9092..f45e6eab05 100644 --- a/src/front/shared/pages/Wallet/Row/Row.tsx +++ b/src/front/shared/pages/Wallet/Row/Row.tsx @@ -364,7 +364,6 @@ export default class Row extends Component { if (decline.length === 0) { window.scrollTo(0, 0) - //@ts-ignore this.props.history.push( localisedUrl( locale, @@ -379,7 +378,6 @@ export default class Row extends Component { this.handleDeclineOrdersModalOpen(getDeclinedExistedSwapIndex) } else { window.scrollTo(0, 0) - //@ts-ignore this.props.history.push( localisedUrl( locale, @@ -605,7 +603,6 @@ export default class Row extends Component { getCustomRate = (cur) => { - //@ts-ignore const wTokens = window.widgetERC20Tokens const dataobj = wTokens && Object.keys(wTokens).find(el => el === cur.toLowerCase()) @@ -613,7 +610,6 @@ export default class Row extends Component { } handleShowMnemonic = () => { - //@ts-ignore actions.modals.open(constants.modals.SaveMnemonicModal) } diff --git a/src/front/shared/pages/Wallet/Wallet.tsx b/src/front/shared/pages/Wallet/Wallet.tsx index fca58a111e..7db130d715 100644 --- a/src/front/shared/pages/Wallet/Wallet.tsx +++ b/src/front/shared/pages/Wallet/Wallet.tsx @@ -63,18 +63,14 @@ const isDark = localStorage.getItem(constants.localStorage.isDark) ui: { dashboardModalsAllowed }, }) => { let widgetMultiTokens = [] - //@ts-ignore if (window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetMultiTokens.push(key.toUpperCase()) }) } const tokens = config && config.isWidget - ? // comment for ts-ignore - //@ts-ignore - window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length + ? window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length ? widgetMultiTokens : [config.erc20token.toUpperCase()] : Object.keys(tokensData).map((k) => tokensData[k].currency) @@ -345,10 +341,8 @@ export default class Wallet extends Component { widgetCurrencies.push('GHOST') widgetCurrencies.push('NEXT') if (isWidgetBuild) { - //@ts-ignore if (window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { // Multi token widget build - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetCurrencies.push(key.toUpperCase()) }) @@ -459,14 +453,12 @@ export default class Wallet extends Component { const ipInfo = await firebase.getIPInfo() const registrationData = { - //@ts-ignore locale: ipInfo.locale || - //@ts-ignore (navigator.userLanguage || navigator.language || 'en-gb').split('-')[0], ip: ipInfo.ip, } - //@ts-ignore + if (this.props.messagingToken) { //@ts-ignore registrationData.messaging_token = this.props.messagingToken @@ -542,10 +534,8 @@ export default class Wallet extends Component { widgetCurrencies.push('GHOST') widgetCurrencies.push('NEXT') if (isWidgetBuild) { - //@ts-ignore if (window.widgetERC20Tokens && Object.keys(window.widgetERC20Tokens).length) { // Multi token widget build - //@ts-ignore Object.keys(window.widgetERC20Tokens).forEach((key) => { widgetCurrencies.push(key.toUpperCase()) }) diff --git a/src/front/shared/pages/Wallet/components/NotityBlock/NotifyBock.tsx b/src/front/shared/pages/Wallet/components/NotityBlock/NotifyBock.tsx index 03f5ac89a7..568aba1bf5 100644 --- a/src/front/shared/pages/Wallet/components/NotityBlock/NotifyBock.tsx +++ b/src/front/shared/pages/Wallet/components/NotityBlock/NotifyBock.tsx @@ -18,7 +18,6 @@ const NotifyBlock = ({ const handleGoto = () => { firstFunc && firstFunc() if (link && link.includes('http')) { - //@ts-ignore window.location = link } else { if (link) { diff --git a/src/front/shared/pages/Wallet/components/WallerSlider/index.tsx b/src/front/shared/pages/Wallet/components/WallerSlider/index.tsx index 1bacd17dbe..800bb9b893 100644 --- a/src/front/shared/pages/Wallet/components/WallerSlider/index.tsx +++ b/src/front/shared/pages/Wallet/components/WallerSlider/index.tsx @@ -112,11 +112,9 @@ export default class WallerSlider extends React.Component { if ( window && - //@ts-ignore window.bannersOnMainPage !== undefined ) { // Используем банеры, которые были определены в index.html (используется в виджете вордпресса) - //@ts-ignore const widgetBanners = window.bannersOnMainPage.length ? window.bannersOnMainPage : [] if (!this._mounted) return diff --git a/src/front/shared/plugins/backupUserData.ts b/src/front/shared/plugins/backupUserData.ts index e80d14b3ef..c5ff7e3d4c 100644 --- a/src/front/shared/plugins/backupUserData.ts +++ b/src/front/shared/plugins/backupUserData.ts @@ -8,7 +8,6 @@ const lsCurrentUser = `${process.env.ENTRY}:wp_currentUserId` const backupUserData = { isUserLoggedIn: () => { - //@ts-ignore return (window && window.WPuserUid && config.opts.WPuserHash) }, isFirstBackup: () => { @@ -23,14 +22,12 @@ const backupUserData = { && config.opts.plugins.backupPlugin && config.opts.plugins.restorePluginUrl && window - //@ts-ignore && window.WPuserUid && config.opts.WPuserHash ) { const set = (key, value) => localStorage.setItem(constants.privateKeyNames[key], value) axios.post(config.opts.plugins.restorePluginUrl, { - //@ts-ignore WPuserUid: window.WPuserUid, WPuserHash: config.opts.WPuserHash, }).then((req) => { @@ -54,7 +51,7 @@ const backupUserData = { }, isUserChanged: () => { const currentUser = localStorage.getItem(lsCurrentUser) - //@ts-ignore + return (currentUser !== `${window.WPuserUid}` && window.WPuserUid) ? true : false }, backupUser: () => { @@ -65,7 +62,6 @@ const backupUserData = { && config.opts.plugins.backupPlugin && config.opts.plugins.backupPluginUrl && window - //@ts-ignore && window.WPuserUid && config.opts.WPuserHash ) { @@ -98,7 +94,6 @@ const backupUserData = { axios.post(config.opts.plugins.backupPluginUrl, { ...backup, - //@ts-ignore WPuserUid: window.WPuserUid, WPuserHash: config.opts.WPuserHash, }).then((answer) => { @@ -107,7 +102,6 @@ const backupUserData = { && data.answer && data.answer === `ok` ) { - //@ts-ignore localStorage.setItem(lsCurrentUser, window.WPuserUid) //@ts-ignore resolve(true, true) @@ -133,12 +127,10 @@ const backupUserData = { && config.opts.plugins.backupPlugin && config.opts.plugins.backupPluginUrl && window - //@ts-ignore && window.WPuserUid && config.opts.WPuserHash ) { axios.post(config.opts.plugins.backupPluginUrl, { - //@ts-ignore WPuserUid: window.WPuserUid, WPuserHash: config.opts.WPuserHash, action: 'cleanup', @@ -168,7 +160,6 @@ const backupUserData = { && config.opts.plugins.backupPlugin && config.opts.plugins.restorePluginUrl && window - //@ts-ignore && window.WPuserUid && config.opts.WPuserHash ) { @@ -177,7 +168,6 @@ const backupUserData = { } axios.post(config.opts.plugins.restorePluginUrl, { - //@ts-ignore WPuserUid: window.WPuserUid, WPuserHash: config.opts.WPuserHash, }).then((req) => { @@ -223,7 +213,6 @@ const backupUserData = { localStorage.setItem(constants.localStorage.wasOnWallet, true) localStorage.setItem(constants.localStorage.didProtectedBtcCreated, data.didProtectedBtcCreated) localStorage.setItem(constants.localStorage.didPinBtcCreated, data.didPinBtcCreated) - //@ts-ignore localStorage.setItem(lsCurrentUser, window.WPuserUid) diff --git a/src/front/shared/plugins/saveUserData.ts b/src/front/shared/plugins/saveUserData.ts index fc1c364885..8d4bd04a03 100644 --- a/src/front/shared/plugins/saveUserData.ts +++ b/src/front/shared/plugins/saveUserData.ts @@ -15,7 +15,6 @@ const saveUserData = function saveUserData(data) { && config.opts && config.opts.plugins && config.opts.plugins.userDataPluginApi - //@ts-ignore && window.WPuserUid && config.opts.WPuserHash ) { @@ -54,7 +53,6 @@ const saveUserData = function saveUserData(data) { if (data && Object.values(data).length) { axios.post(config.opts.plugins.userDataPluginApi, { ...data, - //@ts-ignore WPuserUid: window.WPuserUid, WPuserHash: config.opts.WPuserHash, }) diff --git a/src/front/shared/redux/actions/analytics.ts b/src/front/shared/redux/actions/analytics.ts index 642db1d516..c24590ec2c 100644 --- a/src/front/shared/redux/actions/analytics.ts +++ b/src/front/shared/redux/actions/analytics.ts @@ -1,4 +1,3 @@ -//@ts-ignore const getGtag = () => window.gtag || null //@ts-ignore @@ -62,13 +61,11 @@ const swapEvent = (eventAction, eventLabel) => { } const getTracker = () => { - //@ts-ignore if (!window.ga) { return } try { - //@ts-ignore return window.ga.getAll()[0] } catch (error) { console.error(error) diff --git a/src/front/shared/redux/actions/btc.ts b/src/front/shared/redux/actions/btc.ts index 521a546637..6aee405a13 100644 --- a/src/front/shared/redux/actions/btc.ts +++ b/src/front/shared/redux/actions/btc.ts @@ -164,9 +164,7 @@ const login = (privateKey, mnemonic, mnemonicKeys) => { isMnemonic: sweepToMnemonicReady, } - //@ts-ignore window.getBtcAddress = () => data.address - //@ts-ignore window.getBtcData = () => data console.info('Logged in with Bitcoin', data) diff --git a/src/front/shared/redux/actions/btcmultisig.ts b/src/front/shared/redux/actions/btcmultisig.ts index a447f40793..94ef1bcbf6 100644 --- a/src/front/shared/redux/actions/btcmultisig.ts +++ b/src/front/shared/redux/actions/btcmultisig.ts @@ -358,9 +358,7 @@ const createWallet = (privateKey, otherOwnerPublicKey) => { localStorage.setItem(constants.privateKeyNames.btcMultisigOtherOwnerKey, otherOwnerPublicKey) - //@ts-ignore window.getBtcMultisigData = () => data - //@ts-ignore window.getBtcMultisigAddress = () => data.address console.info('Logged in with BitcoinMultisig', data) @@ -378,7 +376,7 @@ const login_SMS = (privateKey, otherOwnerPublicKey) => { data.fullName = 'Bitcoin (SMS-Protected)' data.isRegistered = (otherOwnerPublicKey instanceof Array && otherOwnerPublicKey.length > 1) ? true : isRegistered data.isSmsProtected = true - //@ts-ignore + window.getBtcSmsData = () => data reducers.user.setAuthData({ name: 'btcMultisigSMSData', data }) } @@ -395,7 +393,7 @@ const login_PIN = (privateKey, otherOwnerPublicKey) => { data.fullName = 'Bitcoin (PIN-Protected)' data.isRegistered = (otherOwnerPublicKey instanceof Array && otherOwnerPublicKey.length > 1) ? true : isRegistered data.isPinProtected = true - //@ts-ignore + window.getBtcPinData = () => data reducers.user.setAuthData({ name: 'btcMultisigPinData', data }) } @@ -611,7 +609,7 @@ const broadcastTX2Room = (txData, cbSuccess, cbFail) => { }) return cancelFunc } -//@ts-ignore + window.broadcastTX2Room = broadcastTX2Room const _getSign = () => { @@ -958,7 +956,6 @@ const getBalanceUser = (checkAddress) => { } const getRate = async () => { - //@ts-ignore const activeFiat = window.DEFAULT_FIAT || 'USD' const exCurrencyRate = await actions.user.getExchangeRate('BTC', activeFiat.toLowerCase()) diff --git a/src/front/shared/redux/actions/eth.ts b/src/front/shared/redux/actions/eth.ts index c8ab97d01a..daac077cfb 100644 --- a/src/front/shared/redux/actions/eth.ts +++ b/src/front/shared/redux/actions/eth.ts @@ -147,7 +147,6 @@ const login = (privateKey, mnemonic, mnemonicKeys) => { data.isMnemonic = sweepToMnemonicReady reducers.user.setAuthData({ name: 'ethData', data }) - //@ts-ignore window.getEthAddress = () => data.address referral.newReferral(data.address) diff --git a/src/front/shared/redux/actions/ghost.ts b/src/front/shared/redux/actions/ghost.ts index d8d19c886e..885b764230 100644 --- a/src/front/shared/redux/actions/ghost.ts +++ b/src/front/shared/redux/actions/ghost.ts @@ -165,9 +165,8 @@ const login = (privateKey, mnemonic, mnemonicKeys) => { currency: 'GHOST', fullName: 'ghost', } - //@ts-ignore + window.getGhostAddress = () => data.address - //@ts-ignore window.getGhostData = () => data console.info('Logged in with Ghost', data) @@ -789,7 +788,7 @@ const signMessage = (message, encodedPrivateKey) => { } const getReputation = () => Promise.resolve(0) -//@ts-ignore + window.getMainPublicKey = getMainPublicKey /* @@ -825,7 +824,7 @@ const checkWithdraw = (scriptAddress) => { return false }) } -//@ts-ignore + window.ghostCheckWithdraw = checkWithdraw export default { diff --git a/src/front/shared/redux/actions/next.ts b/src/front/shared/redux/actions/next.ts index 9919650cc1..7ce000d7bc 100644 --- a/src/front/shared/redux/actions/next.ts +++ b/src/front/shared/redux/actions/next.ts @@ -163,9 +163,8 @@ const login = (privateKey, mnemonic, mnemonicKeys) => { currency: 'NEXT', fullName: 'NEXT.coin', } - //@ts-ignore + window.getNextAddress = () => data.address - //@ts-ignore window.getNextData = () => data console.info('Logged in with Next', data) diff --git a/src/front/shared/redux/actions/user.ts b/src/front/shared/redux/actions/user.ts index 3da88d419c..040b2c1947 100644 --- a/src/front/shared/redux/actions/user.ts +++ b/src/front/shared/redux/actions/user.ts @@ -30,7 +30,6 @@ const initReducerState = () => { } = getState() if (!activeCurrency) reducers.user.setActiveCurrency({ activeCurrency: 'BTC' }) - //@ts-ignore if (!activeFiat) reducers.user.setActiveFiat({ activeFiat: window.DEFAULT_FIAT || 'USD' }) } @@ -241,7 +240,6 @@ const getBalances = () => { } const customRate = (cur) => { - //@ts-ignore const wTokens = window.widgetERC20Tokens const dataobj = wTokens && Object.keys(wTokens).find(el => el === cur.toLowerCase()) @@ -648,7 +646,7 @@ const downloadPrivateKeys = () => { //@ts-ignore localStorage.setItem(constants.localStorage.privateKeysSaved, true) } -//@ts-ignore + window.downloadPrivateKeys = downloadPrivateKeys const getAuthData = (name) => { diff --git a/src/front/shared/redux/reducers/currencies.ts b/src/front/shared/redux/reducers/currencies.ts index 17650571d4..f18c492d53 100644 --- a/src/front/shared/redux/reducers/currencies.ts +++ b/src/front/shared/redux/reducers/currencies.ts @@ -17,26 +17,18 @@ let buildOpts = { } if (window - //@ts-ignore && window.buildOptions - //@ts-ignore && Object.keys(window.buildOptions) - //@ts-ignore && Object.keys(window.buildOptions).length ) { - //@ts-ignore buildOpts = { ...buildOpts, ...window.buildOptions } } if (window - //@ts-ignore && window.widgetERC20Tokens - //@ts-ignore && Object.keys(window.widgetERC20Tokens) - //@ts-ignore && Object.keys(window.widgetERC20Tokens).length ) { - //@ts-ignore buildOpts.ownTokens = window.widgetERC20Tokens } if (buildOpts.ownTokens && Object.keys(buildOpts.ownTokens).length) { @@ -239,13 +231,11 @@ if (config.isWidget) { ] // Мульти валюта с обратной совместимостью одиночного билда - //@ts-ignore const multiTokenNames = (window.widgetERC20Tokens) ? Object.keys(window.widgetERC20Tokens) : [] if (multiTokenNames.length > 0) { // First token in list - is main - fill single-token erc20 config config.erc20token = multiTokenNames[0] - //@ts-ignore config.erc20[config.erc20token] = window.widgetERC20Tokens[config.erc20token] multiTokenNames.forEach((key) => { //@ts-ignore @@ -254,7 +244,6 @@ if (config.isWidget) { title: key.toUpperCase(), icon: key, value: key, - //@ts-ignore fullTitle: window.widgetERC20Tokens[key].fullName, }) initialState.partialItems.push({ @@ -262,7 +251,6 @@ if (config.isWidget) { title: key.toUpperCase(), icon: key, value: key, - //@ts-ignore fullTitle: window.widgetERC20Tokens[key].fullName, }) }) diff --git a/src/front/shared/redux/reducers/user.ts b/src/front/shared/redux/reducers/user.ts index c364fbe50d..b3590f4c7d 100644 --- a/src/front/shared/redux/reducers/user.ts +++ b/src/front/shared/redux/reducers/user.ts @@ -77,7 +77,6 @@ export const initialState = { isFetching: false, isBalanceFetching: false, isTokenSigned: false, - //@ts-ignore activeFiat: window.DEFAULT_FIAT || 'USD', activeCurrency: 'BTC', multisigStatus: {}, diff --git a/src/front/shared/redux/store/index.ts b/src/front/shared/redux/store/index.ts index 4d3969bd21..d7e69d5c98 100644 --- a/src/front/shared/redux/store/index.ts +++ b/src/front/shared/redux/store/index.ts @@ -9,7 +9,6 @@ import { selectiveSaver } from 'redux/middleware' const history = createBrowserHistory() const middleware = routerMiddleware(history) const initialState = (localStorage['redux-store']) ? JSON.parse(localStorage['redux-store']) : {} -//@ts-ignore const devTools = window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : (v) => v const store = createStore({