diff --git a/.changeset/old-moles-float.md b/.changeset/old-moles-float.md new file mode 100644 index 00000000..a845151c --- /dev/null +++ b/.changeset/old-moles-float.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/commitlint.config.cjs b/commitlint.config.cjs index e9380af8..e1545242 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -1,6 +1,6 @@ module.exports = { extends: ['@commitlint/config-conventional'], rules: { - 'header-max-length': [0, 'always', 150] - } + 'header-max-length': [0, 'always', 150], + }, } diff --git a/manifest.json b/manifest.json index be65b858..0e6ad858 100644 --- a/manifest.json +++ b/manifest.json @@ -11,7 +11,7 @@ "src": "favicon.ico", "type": "image/png", "sizes": "512x512 128x128" - } + } ], "start_url": ".", "display": "standalone", diff --git a/public/manifest.json b/public/manifest.json index be65b858..0e6ad858 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -11,7 +11,7 @@ "src": "favicon.ico", "type": "image/png", "sizes": "512x512 128x128" - } + } ], "start_url": ".", "display": "standalone", diff --git a/scripts/fetch-addresses-assets.js b/scripts/fetch-addresses-assets.js index 49874cf4..af6380eb 100644 --- a/scripts/fetch-addresses-assets.js +++ b/scripts/fetch-addresses-assets.js @@ -1,7 +1,9 @@ // NOTE: before run this scripts go to settings/swap-assets and change export default into module.exports = -const { constants, helpers } = require('ptokens-utils') -const { NodeSelector } = require('ptokens-node-selector') const fs = require('fs') + +const { NodeSelector } = require('ptokens-node-selector') +const { constants, helpers } = require('ptokens-utils') + const assets = require('../src/settings/swap-assets') const start = async () => { @@ -19,12 +21,12 @@ const start = async () => { { pToken: workingName, blockchain: helpers.getBlockchainType(blockchain.toLowerCase()), - network + network, }, helpers.getNativeBlockchainFromPtokenName(workingName) ) - return new Promise(_resolve => + return new Promise((_resolve) => nodeSelector .select({ timeout: 20 * 1000, @@ -32,10 +34,10 @@ const start = async () => { nativeBlockchain, nativeNetwork, hostBlockchain, - hostNetwork + hostNetwork, }) .then(_resolve) - .catch(_err => { + .catch((_err) => { console.error(_err) _resolve(null) }) @@ -45,8 +47,8 @@ const start = async () => { const pTokensAddresses = await Promise.all( nodes.map( - _node => - new Promise(_resolve => + (_node) => + new Promise((_resolve) => _node ? _node .getInfo() @@ -59,7 +61,7 @@ const start = async () => { : null ) }) - .catch(_err => { + .catch((_err) => { console.error(_err) _resolve(null) }) @@ -75,7 +77,7 @@ const start = async () => { return { address: nativeAddress ? nativeAddress : pTokensAddresses[_index], - ..._asset + ..._asset, } }) diff --git a/scripts/generate-buildno.cjs b/scripts/generate-buildno.cjs index 9c8551d3..ce3916cb 100644 --- a/scripts/generate-buildno.cjs +++ b/scripts/generate-buildno.cjs @@ -1,22 +1,23 @@ -const childProcess = require("child_process") -const fs = require("fs") -const os = require("os") +const childProcess = require('child_process') +const fs = require('fs') +const os = require('os') const file = './.env' function setEnvValue(key, value) { - if (!fs.existsSync(file)) - fs.writeFileSync('.env', '') - const ENV_VARS = fs.readFileSync(file, "utf8").split(os.EOL); - const target = ENV_VARS.indexOf(ENV_VARS.find((line) => { - return line.match(new RegExp(key)) - })); + if (!fs.existsSync(file)) fs.writeFileSync('.env', '') + const ENV_VARS = fs.readFileSync(file, 'utf8').split(os.EOL) + const target = ENV_VARS.indexOf( + ENV_VARS.find((line) => { + return line.match(new RegExp(key)) + }) + ) ENV_VARS.splice(target, 1, `${key}=${value}`) fs.writeFileSync(file, ENV_VARS.join(os.EOL)) } -(() => { - childProcess.exec("git rev-parse --short HEAD", (err, stdout) => { - setEnvValue("VITE_REACT_APP_GIT_SHA", stdout) - }); -})(); +;(() => { + childProcess.exec('git rev-parse --short HEAD', (err, stdout) => { + setEnvValue('VITE_REACT_APP_GIT_SHA', stdout) + }) +})() diff --git a/scripts/redirect-old-links.js b/scripts/redirect-old-links.js index 800cc0ed..3f339646 100644 --- a/scripts/redirect-old-links.js +++ b/scripts/redirect-old-links.js @@ -1,29 +1,30 @@ -const fs = require('fs'); -const dirList = ['swap', 'migration', 'migration/a', 'migration/b', 'migration/c', 'migration/d', 'risks', 'nfts']; +const fs = require('fs') + +const dirList = ['swap', 'migration', 'migration/a', 'migration/b', 'migration/c', 'migration/d', 'risks', 'nfts'] const basePath = './build' for (let i = 0; i < dirList.length; i++) { - let dir = dirList[i] - let dirSub = dir - let path = basePath + '/' + dir - if (!fs.existsSync(path)){ - fs.mkdirSync(path); - } - /* - * This script takes the current url and adds '/#/' before the directory name. - * Afterwords it redirects the browser to the new created URL. - * This allows to redirect old links of the type 'https://dapp/directory' to - * 'https://dapp/#/directory' for all the directories listed in `dirList` - */ - if (dir == 'migration/a') { - dirSub = 'migration/pBTC-v1-to-v2' - } - fs.writeFileSync( - `${path}/index.html`, - ` `, - {encoding:'utf8', flag:'w'} - ); + { encoding: 'utf8', flag: 'w' } + ) } diff --git a/src/App.jsx b/src/App.jsx index 44164409..99ad82b9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,21 +1,9 @@ -import React, { useEffect, useState } from 'react' import PropTypes from 'prop-types' -import { Route, Switch, Redirect, useRouteMatch } from 'react-router-dom' import queryString from 'query-string' +import React, { useEffect, useState } from 'react' import { connect } from 'react-redux' +import { Route, Switch, Redirect, useRouteMatch } from 'react-router-dom' -import SwapController from './components/pages/swap/SwapController' -import { sendPageView, setPageLocation } from './ga4' -import SwapOldPntController from './components/pages/swapOldPnt/SwapOldPntController' -import { loadSwapData } from './store/swap/swap.actions' -import { loadMigrationData } from './store/migration/migration.actions' -import { loadSwapOldPntData } from './store/swap-old-pnt/swap-old-pnt.actions' -import { selectPage, setTheme } from './store/pages/pages.actions' -import history from './utils/history' -import MigrationController from './components/pages/migration/MigrationController' -import MigrationHomeController from './components/pages/migrationHome/MigrationHomeController' -import NftsController from './components/pages/nfts/NftsController' -import Risks from './components/pages/risks/Risks' import MainWrapper from './components/atoms/mainWrapper/MainWrapper' import Notifications from './components/molecules/notifications/Notifications' import Popup from './components/molecules/popup/Popup' @@ -24,6 +12,18 @@ import WarningPopup from './components/molecules/popup/Warning' import SocialLinks from './components/molecules/socials/Socials' import Version from './components/molecules/version/Version' import HeaderController from './components/organisms/header/HeaderController' +import MigrationController from './components/pages/migration/MigrationController' +import MigrationHomeController from './components/pages/migrationHome/MigrationHomeController' +import NftsController from './components/pages/nfts/NftsController' +import Risks from './components/pages/risks/Risks' +import SwapController from './components/pages/swap/SwapController' +import SwapOldPntController from './components/pages/swapOldPnt/SwapOldPntController' +import { sendPageView, setPageLocation } from './ga4' +import { loadMigrationData } from './store/migration/migration.actions' +import { selectPage, setTheme } from './store/pages/pages.actions' +import { loadSwapData } from './store/swap/swap.actions' +import { loadSwapOldPntData } from './store/swap-old-pnt/swap-old-pnt.actions' +import history from './utils/history' history.listen((location) => { setPageLocation(location.pathname) @@ -112,7 +112,7 @@ const App = ({ loading, setTheme, loadSwapData, loadSwapOldPntData, loadMigratio - + setShowWarningPopup(false)} /> } /> @@ -121,7 +121,6 @@ const App = ({ loading, setTheme, loadSwapData, loadSwapOldPntData, loadMigratio path={'/nfts'} render={() => ( - {/* */} )} diff --git a/src/components/atoms/icon/Icon.jsx b/src/components/atoms/icon/Icon.jsx index 037c8a15..9c19861b 100644 --- a/src/components/atoms/icon/Icon.jsx +++ b/src/components/atoms/icon/Icon.jsx @@ -1,6 +1,7 @@ -import React from 'react' import PropTypes from 'prop-types' +import React from 'react' import styled, { css } from 'styled-components' + import getIconSource from './icon-importer' const commonCss = css` diff --git a/src/components/atoms/icon/icon-importer.js b/src/components/atoms/icon/icon-importer.js index cf05be60..773c721c 100644 --- a/src/components/atoms/icon/icon-importer.js +++ b/src/components/atoms/icon/icon-importer.js @@ -7,14 +7,14 @@ import close from './icons/close.svg?raw' import copy from './icons/copy.svg?raw' import descendant from './icons/descendant.svg?raw' import downArrow from './icons/down-arrow.svg?raw' +import info from './icons/info.svg?raw' import metamask from './icons/metamask.svg?raw' import moon from './icons/moon.svg?raw' import sort from './icons/sort.svg?raw' import sun from './icons/sun.svg?raw' import wallet from './icons/wallet.svg?raw' -import world from './icons/world.svg?raw' import warning from './icons/warning.svg?raw' -import info from './icons/info.svg?raw' +import world from './icons/world.svg?raw' const getIconSource = (icon) => { switch (icon) { diff --git a/src/components/atoms/loader/Loader.jsx b/src/components/atoms/loader/Loader.jsx deleted file mode 100644 index 05161945..00000000 --- a/src/components/atoms/loader/Loader.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react' -// import LoadingOverlay from 'react-loading-overlay' -import styled from 'styled-components' - -// const StyledLoadingOverlay = styled(LoadingOverlay)` -// position: initial !important; -// ` - -const Loader = ({ loading: { isLoading, text } }) => { - // return - return -} - -export default Loader diff --git a/src/components/atoms/switch/Switch.jsx b/src/components/atoms/switch/Switch.jsx index 4372d380..0b6316be 100644 --- a/src/components/atoms/switch/Switch.jsx +++ b/src/components/atoms/switch/Switch.jsx @@ -1,6 +1,6 @@ import React, { useContext } from 'react' -import { ThemeContext } from 'styled-components' import Switch from 'react-switch' +import { ThemeContext } from 'styled-components' const CustomSwitch = ({ checked, onChange, ..._props }) => { const theme = useContext(ThemeContext) diff --git a/src/components/molecules/banner/Banner.jsx b/src/components/molecules/banner/Banner.jsx index 4510f65a..b928f235 100644 --- a/src/components/molecules/banner/Banner.jsx +++ b/src/components/molecules/banner/Banner.jsx @@ -1,6 +1,7 @@ import React, { useState } from 'react' -import styled from 'styled-components' import { Row, Col, Container } from 'react-bootstrap' +import styled from 'styled-components' + import Icon from '../../atoms/icon/Icon' const ContainerBanner = styled(Container)` diff --git a/src/components/molecules/modal/Modal.jsx b/src/components/molecules/modal/Modal.jsx index 1b6979de..0c1ab7cf 100644 --- a/src/components/molecules/modal/Modal.jsx +++ b/src/components/molecules/modal/Modal.jsx @@ -1,7 +1,7 @@ +import PropTypes from 'prop-types' import React from 'react' import { Modal } from 'react-bootstrap' import styled from 'styled-components' -import PropTypes from 'prop-types' const StyledModalTitle = styled(Modal.Title)` color: ${({ theme }) => theme.text1}; diff --git a/src/components/molecules/popup/AddressWarning.jsx b/src/components/molecules/popup/AddressWarning.jsx index 340c85a9..5410232a 100644 --- a/src/components/molecules/popup/AddressWarning.jsx +++ b/src/components/molecules/popup/AddressWarning.jsx @@ -1,7 +1,7 @@ -import React from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' +import React from 'react' import { Modal } from 'react-bootstrap' +import styled from 'styled-components' const StyledModalTitle = styled(Modal.Title)` color: ${({ theme }) => theme.text1}; diff --git a/src/components/molecules/popup/Popup.jsx b/src/components/molecules/popup/Popup.jsx index be201c16..0d0d93d5 100644 --- a/src/components/molecules/popup/Popup.jsx +++ b/src/components/molecules/popup/Popup.jsx @@ -1,8 +1,9 @@ -import React, { useState } from 'react' import PropTypes from 'prop-types' -import styled, { keyframes } from 'styled-components' +import React, { useState } from 'react' import { bounceInUp } from 'react-animations' import { Card } from 'react-bootstrap' +import styled, { keyframes } from 'styled-components' + import Icon from '../../atoms/icon/Icon' const StyledCard = styled(Card)` diff --git a/src/components/molecules/popup/RedirectBanner.jsx b/src/components/molecules/popup/RedirectBanner.jsx index 73346afe..c811679c 100644 --- a/src/components/molecules/popup/RedirectBanner.jsx +++ b/src/components/molecules/popup/RedirectBanner.jsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types' import React from 'react' import { Alert, Row } from 'react-bootstrap' import styled from 'styled-components' diff --git a/src/components/molecules/popup/TermsOfService.jsx b/src/components/molecules/popup/TermsOfService.jsx index 01190655..f34000e7 100644 --- a/src/components/molecules/popup/TermsOfService.jsx +++ b/src/components/molecules/popup/TermsOfService.jsx @@ -1,7 +1,7 @@ -import React from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' +import React from 'react' import { Modal } from 'react-bootstrap' +import styled from 'styled-components' const StyledModalTitle = styled(Modal.Title)` color: ${({ theme }) => theme.text1}; diff --git a/src/components/molecules/popup/__test__/RedirectBanner.test.jsx b/src/components/molecules/popup/__test__/RedirectBanner.test.jsx index 6457b55e..822f2563 100644 --- a/src/components/molecules/popup/__test__/RedirectBanner.test.jsx +++ b/src/components/molecules/popup/__test__/RedirectBanner.test.jsx @@ -1,6 +1,6 @@ /* eslint-disable import/first */ import { render, screen } from '@testing-library/react' -import { describe, expect, it, vi } from 'vitest' +import { describe, expect } from 'vitest' import RedirectBanner from '../RedirectBanner' diff --git a/src/components/molecules/progress/Progress.jsx b/src/components/molecules/progress/Progress.jsx index 0873e119..16d4768e 100644 --- a/src/components/molecules/progress/Progress.jsx +++ b/src/components/molecules/progress/Progress.jsx @@ -1,7 +1,7 @@ -import React from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' +import React from 'react' import { ProgressBar, Step } from 'react-step-progress-bar' +import styled from 'styled-components' const ContainerProgress = styled.div` padding-left: 10px; diff --git a/src/components/molecules/socials/Socials.jsx b/src/components/molecules/socials/Socials.jsx index b8f41973..6c1342f0 100644 --- a/src/components/molecules/socials/Socials.jsx +++ b/src/components/molecules/socials/Socials.jsx @@ -1,5 +1,6 @@ import React from 'react' import { FaTelegram, FaTwitter } from 'react-icons/fa' + import settings from '../../../settings' import './styles.css' diff --git a/src/components/organisms/depositAddressModal/DepositAddressModal.jsx b/src/components/organisms/depositAddressModal/DepositAddressModal.jsx index 21be54a7..04193761 100644 --- a/src/components/organisms/depositAddressModal/DepositAddressModal.jsx +++ b/src/components/organisms/depositAddressModal/DepositAddressModal.jsx @@ -1,9 +1,10 @@ -import React, { useEffect, useState } from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' import QRCode from 'qrcode.react' -import { blockchainSymbolToCoin } from '../../../utils/maps' +import React, { useEffect, useState } from 'react' import ReactTooltip from 'react-tooltip' +import styled from 'styled-components' + +import { blockchainSymbolToCoin } from '../../../utils/maps' import { copyToClipboard } from '../../../utils/utils' import Modal from '../../molecules/modal/Modal' diff --git a/src/components/organisms/header/HeaderController.jsx b/src/components/organisms/header/HeaderController.jsx index 93525501..80837286 100644 --- a/src/components/organisms/header/HeaderController.jsx +++ b/src/components/organisms/header/HeaderController.jsx @@ -1,10 +1,12 @@ +import PropTypes from 'prop-types' import React from 'react' import { connect } from 'react-redux' -import Header from './Header' -import PropTypes from 'prop-types' -import { connectWithWallet, disconnectFromWallet } from '../../../store/wallets/wallets.actions' + import { selectPage, setTheme } from '../../../store/pages/pages.actions' import { loadSwapData } from '../../../store/swap/swap.actions' +import { connectWithWallet, disconnectFromWallet } from '../../../store/wallets/wallets.actions' + +import Header from './Header' const mapStateToProps = (_state) => { return { diff --git a/src/components/organisms/infoModal/InfoModal.jsx b/src/components/organisms/infoModal/InfoModal.jsx index 920d6def..00ff3fdb 100644 --- a/src/components/organisms/infoModal/InfoModal.jsx +++ b/src/components/organisms/infoModal/InfoModal.jsx @@ -1,8 +1,9 @@ -import React, { useEffect, useState } from 'react' import PropTypes from 'prop-types' +import React, { useEffect, useState } from 'react' import styled from 'styled-components' -import Modal from '../../molecules/modal/Modal' + import Icon from '../../atoms/icon/Icon' +import Modal from '../../molecules/modal/Modal' const Message = styled.div` margin-top: 30px; diff --git a/src/components/organisms/migrationInfo/MigrationInfo.jsx b/src/components/organisms/migrationInfo/MigrationInfo.jsx index 766bebcc..4152fb99 100644 --- a/src/components/organisms/migrationInfo/MigrationInfo.jsx +++ b/src/components/organisms/migrationInfo/MigrationInfo.jsx @@ -1,10 +1,11 @@ -import React from 'react' -import styled from 'styled-components' import PropTypes from 'prop-types' +import React from 'react' import { Row, Col, Container } from 'react-bootstrap' -import Switch from '../../atoms/switch/Switch' import ReactTooltip from 'react-tooltip' +import styled from 'styled-components' + import { getMigrationFees } from '../../../utils/fee' +import Switch from '../../atoms/switch/Switch' const ContainerInfo = styled(Container)` background: ${({ theme }) => theme.secondary3Transparentized}; diff --git a/src/components/organisms/moveModal/MoveModal.jsx b/src/components/organisms/moveModal/MoveModal.jsx index 8bc2406f..147460d3 100644 --- a/src/components/organisms/moveModal/MoveModal.jsx +++ b/src/components/organisms/moveModal/MoveModal.jsx @@ -1,10 +1,11 @@ +import PropTypes from 'prop-types' import React, { useCallback, useMemo, useState } from 'react' import { Row, Col } from 'react-bootstrap' -import PropTypes from 'prop-types' import styled from 'styled-components' + import { isValidAccountByBlockchain } from '../../../utils/account-validator' -import Modal from '../../molecules/modal/Modal' import { blockchainSymbolToName } from '../../../utils/maps' +import Modal from '../../molecules/modal/Modal' const ContainerRow = styled.div` padding-top: 10px; diff --git a/src/components/organisms/nftCard/NftCard.jsx b/src/components/organisms/nftCard/NftCard.jsx index 95d91cc0..aedd3de3 100644 --- a/src/components/organisms/nftCard/NftCard.jsx +++ b/src/components/organisms/nftCard/NftCard.jsx @@ -1,7 +1,8 @@ +import PropTypes from 'prop-types' import React, { useState } from 'react' import { Card, Row, Col } from 'react-bootstrap' -import PropTypes from 'prop-types' import styled from 'styled-components' + import MoveModal from '../moveModal/MoveModal' const StyledCard = styled(Card)` diff --git a/src/components/organisms/supportedNftsCarousel/SupportedNftsCarousel.jsx b/src/components/organisms/supportedNftsCarousel/SupportedNftsCarousel.jsx index 76aeca6c..dfc57e23 100644 --- a/src/components/organisms/supportedNftsCarousel/SupportedNftsCarousel.jsx +++ b/src/components/organisms/supportedNftsCarousel/SupportedNftsCarousel.jsx @@ -1,6 +1,7 @@ import React from 'react' -import styled from 'styled-components' import { Carousel } from 'react-responsive-carousel' +import styled from 'styled-components' + import settings from '../../../settings' const ContainerNft = styled.div`` diff --git a/src/components/organisms/swapInfo/SwapInfo.jsx b/src/components/organisms/swapInfo/SwapInfo.jsx index 9ba11934..ceaed42c 100644 --- a/src/components/organisms/swapInfo/SwapInfo.jsx +++ b/src/components/organisms/swapInfo/SwapInfo.jsx @@ -1,16 +1,18 @@ -import React, { useEffect, useState } from 'react' -import styled from 'styled-components' +import BigNumber from 'bignumber.js' import PropTypes from 'prop-types' +import React, { useEffect, useState } from 'react' import { Row, Col, Container } from 'react-bootstrap' -import { useSwapInfo } from '../../../hooks/use-swap-info' -import Switch from '../../atoms/switch/Switch' -import Icon from '../../atoms/icon/Icon' +import Skeleton from 'react-loading-skeleton' import ReactTooltip from 'react-tooltip' +import styled from 'styled-components' + import { MAX_IMPACT } from '../../../constants' -import BigNumber from 'bignumber.js' -import Skeleton from 'react-loading-skeleton' -import 'react-loading-skeleton/dist/skeleton.css' +import { useSwapInfo } from '../../../hooks/use-swap-info' import { getFormattedNetworkFee, getFormattedProtocolFee } from '../../../utils/fee' +import Icon from '../../atoms/icon/Icon' +import Switch from '../../atoms/switch/Switch' + +import 'react-loading-skeleton/dist/skeleton.css' const ContainerInfo = styled(Container)` background: ${({ theme }) => theme.secondary3Transparentized}; diff --git a/src/components/organisms/swapInfo/__test__/SwapInfo.test.jsx b/src/components/organisms/swapInfo/__test__/SwapInfo.test.jsx index e5aac6c7..7d6991f3 100644 --- a/src/components/organisms/swapInfo/__test__/SwapInfo.test.jsx +++ b/src/components/organisms/swapInfo/__test__/SwapInfo.test.jsx @@ -1,11 +1,12 @@ +import { render, screen, getByRole, getByText } from '@testing-library/react' +import UserEvent from '@testing-library/user-event' import React from 'react' +import ReactTooltip from 'react-tooltip' import { ThemeContext } from 'styled-components' -import UserEvent from '@testing-library/user-event' import { describe, expect, it } from 'vitest' -import { render, screen, getByRole, getByText } from '@testing-library/react' -import SwapInfo from '../SwapInfo' + import assets from '../../../../settings/swap-assets' -import ReactTooltip from 'react-tooltip' +import SwapInfo from '../SwapInfo' describe('SwapInfo', () => { it('Should not show if from is missing', async () => { diff --git a/src/components/organisms/walletInfoModal/WalletInfoModal.jsx b/src/components/organisms/walletInfoModal/WalletInfoModal.jsx index 7a8ff28f..9decfad5 100644 --- a/src/components/organisms/walletInfoModal/WalletInfoModal.jsx +++ b/src/components/organisms/walletInfoModal/WalletInfoModal.jsx @@ -1,9 +1,10 @@ +import PropTypes from 'prop-types' import React from 'react' import { Row, Col } from 'react-bootstrap' -import PropTypes from 'prop-types' +import ReactTooltip from 'react-tooltip' import styled from 'styled-components' + import Modal from '../../molecules/modal/Modal' -import ReactTooltip from 'react-tooltip' const ContainerAccountInfo = styled.div` border-radius: 20px; diff --git a/src/components/pages/migration/MigrationController.jsx b/src/components/pages/migration/MigrationController.jsx index c6c1e467..67c9fc92 100644 --- a/src/components/pages/migration/MigrationController.jsx +++ b/src/components/pages/migration/MigrationController.jsx @@ -1,11 +1,12 @@ +import PropTypes from 'prop-types' import React from 'react' import { connect } from 'react-redux' -import PropTypes from 'prop-types' -import Migration from './Migration' -import { connectWithWallet } from '../../../store/wallets/wallets.actions' + import { migrate, resetProgress, updateMigrateButton } from '../../../store/migration/migration.actions' -import { selectPage } from '../../../store/pages/pages.actions' -import { updateInfoModal } from '../../../store/pages/pages.actions' +import { selectPage, updateInfoModal } from '../../../store/pages/pages.actions' +import { connectWithWallet } from '../../../store/wallets/wallets.actions' + +import Migration from './Migration' const mapStateToProps = (_state) => { return { diff --git a/src/components/pages/migration/__test__/Migration.test.jsx b/src/components/pages/migration/__test__/Migration.test.jsx index e1b0b677..1ed89ea3 100644 --- a/src/components/pages/migration/__test__/Migration.test.jsx +++ b/src/components/pages/migration/__test__/Migration.test.jsx @@ -1,18 +1,19 @@ -/* eslint-disable import/first */ -import BigNumber from 'bignumber.js' -import UserEvent from '@testing-library/user-event' -import { describe, expect, it, vi } from 'vitest' import { render, screen } from '@testing-library/react' +import UserEvent from '@testing-library/user-event' +import BigNumber from 'bignumber.js' +import { useCallback, useState } from 'react' import { ThemeContext } from 'styled-components' +import { describe, expect, it, vi } from 'vitest' + +import { ETHPNT_ON_ETH_MAINNET, PNT_ON_ETH_MAINNET } from '../../../../constants' +import assets from '../../../../settings/migration-assets' +import { getDefaultSelection } from '../../../../store/migration/utils/default-selection' +import * as feeUtils from '../../../../utils/fee' import * as Icon from '../../../atoms/icon/Icon' -vi.spyOn(Icon, 'default').mockImplementation((props) =>
) import * as MigrationInfo from '../../../organisms/migrationInfo/MigrationInfo' -import * as feeUtils from '../../../../utils/fee' import Migration from '../Migration' -import assets from '../../../../settings/migration-assets' -import { getDefaultSelection } from '../../../../store/migration/utils/default-selection' -import { useCallback, useState } from 'react' -import { ETHPNT_ON_ETH_MAINNET, PNT_ON_ETH_MAINNET } from '../../../../constants' + +vi.spyOn(Icon, 'default').mockImplementation((props) =>
) const Wrapper = ({ strategy, connectWithWallet, migrate, assets }) => { const ThemeContextMock = {} diff --git a/src/components/pages/migrationHome/MigrationHomeController.jsx b/src/components/pages/migrationHome/MigrationHomeController.jsx index 6f4c4173..77b82e88 100644 --- a/src/components/pages/migrationHome/MigrationHomeController.jsx +++ b/src/components/pages/migrationHome/MigrationHomeController.jsx @@ -1,9 +1,11 @@ +import PropTypes from 'prop-types' import React from 'react' import { connect } from 'react-redux' -import MigrationHome from './MigrationHome' -import PropTypes from 'prop-types' -import { selectPage } from '../../../store/pages/pages.actions' + import { loadMigrationData } from '../../../store/migration/migration.actions' +import { selectPage } from '../../../store/pages/pages.actions' + +import MigrationHome from './MigrationHome' const mapStateToProps = (_state) => { return { diff --git a/src/components/pages/nfts/Nfts.jsx b/src/components/pages/nfts/Nfts.jsx index c8b05813..715b6a0f 100644 --- a/src/components/pages/nfts/Nfts.jsx +++ b/src/components/pages/nfts/Nfts.jsx @@ -1,10 +1,11 @@ -import React from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' +import React from 'react' import { Row, Container, Col } from 'react-bootstrap' +import styled from 'styled-components' + +import { useWallets } from '../../../hooks/use-wallets' import NftCard from '../../organisms/nftCard/NftCard' import SupportedNfstCarousel from '../../organisms/supportedNftsCarousel/SupportedNftsCarousel' -import { useWallets } from '../../../hooks/use-wallets' const ContainerNftCard = styled(Col)` margin-top: 100px; diff --git a/src/components/pages/nfts/NftsController.jsx b/src/components/pages/nfts/NftsController.jsx index 8419ba0c..02a99331 100644 --- a/src/components/pages/nfts/NftsController.jsx +++ b/src/components/pages/nfts/NftsController.jsx @@ -1,9 +1,11 @@ +import PropTypes from 'prop-types' import React from 'react' import { connect } from 'react-redux' -import Nfts from './Nfts' -import PropTypes from 'prop-types' + import { move } from '../../../store/nfts/nfts.actions' +import Nfts from './Nfts' + const mapStateToProps = (_state) => { return { nfts: _state.nfts.all, diff --git a/src/components/pages/risks/Risks.jsx b/src/components/pages/risks/Risks.jsx index bcd0f166..2168a02c 100644 --- a/src/components/pages/risks/Risks.jsx +++ b/src/components/pages/risks/Risks.jsx @@ -1,6 +1,6 @@ import React from 'react' -import styled from 'styled-components' import { Container } from 'react-bootstrap' +import styled from 'styled-components' const Section = styled.div` font-size: 28px; diff --git a/src/components/pages/swap/SwapController.jsx b/src/components/pages/swap/SwapController.jsx index 58441653..37a9a3ce 100644 --- a/src/components/pages/swap/SwapController.jsx +++ b/src/components/pages/swap/SwapController.jsx @@ -1,11 +1,12 @@ +import PropTypes from 'prop-types' import React from 'react' import { connect } from 'react-redux' -import PropTypes from 'prop-types' -import Swap from './Swap' -import { connectWithWallet } from '../../../store/wallets/wallets.actions' + +import { updateInfoModal, selectPage } from '../../../store/pages/pages.actions' import { hideDepositAddressModal, swap, resetProgress, updateSwapButton } from '../../../store/swap/swap.actions' -import { updateInfoModal } from '../../../store/pages/pages.actions' -import { selectPage } from '../../../store/pages/pages.actions' +import { connectWithWallet } from '../../../store/wallets/wallets.actions' + +import Swap from './Swap' const mapStateToProps = (_state) => { return { diff --git a/src/components/pages/swap/__test__/Swap.test.jsx b/src/components/pages/swap/__test__/Swap.test.jsx index adc910b7..2eaa9095 100644 --- a/src/components/pages/swap/__test__/Swap.test.jsx +++ b/src/components/pages/swap/__test__/Swap.test.jsx @@ -71,7 +71,7 @@ describe('Swap', async () => { render() await waitFor(() => expect(screen.getByText(/balance is 0/)).toBeInTheDocument()) const [, , swapButton] = screen.getAllByRole('button') - const [fromInput, toInput, addressInput] = screen.getAllByRole('textbox') + const [fromInput, toInput] = screen.getAllByRole('textbox') await UserEvent.type(fromInput, '1') expect(fromInput).toHaveAttribute('value', '1') expect(toInput).toHaveAttribute('value', '-2') diff --git a/src/components/pages/swapOldPnt/SwapOldPnt.jsx b/src/components/pages/swapOldPnt/SwapOldPnt.jsx index 18adc92f..f8c7f3f3 100644 --- a/src/components/pages/swapOldPnt/SwapOldPnt.jsx +++ b/src/components/pages/swapOldPnt/SwapOldPnt.jsx @@ -1,12 +1,14 @@ -import React from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' +import React from 'react' import { Row, Container, Col } from 'react-bootstrap' -import Progress from '../../molecules/progress/Progress' -import { useSwap } from '../../../hooks/use-old-pnt-swap' -import SwapLine from '../../organisms/swapLine/SwapLine' +import styled from 'styled-components' + import { useAssets } from '../../../hooks/use-assets' +import { useSwap } from '../../../hooks/use-old-pnt-swap' +import Button from '../../atoms/button/Button' +import Progress from '../../molecules/progress/Progress' import InfoModal from '../../organisms/infoModal/InfoModal' +import SwapLine from '../../organisms/swapLine/SwapLine' import { OuterContainerSwap, ContainerSwap, @@ -15,7 +17,6 @@ import { ArrowContainer, SortIcon, } from '../swap/Swap' -import Button from '../../atoms/button/Button' const StyledArrowContainer = styled(ArrowContainer)` cursor: default; diff --git a/src/components/pages/swapOldPnt/SwapOldPntController.jsx b/src/components/pages/swapOldPnt/SwapOldPntController.jsx index 9ee719cb..dc4d8378 100644 --- a/src/components/pages/swapOldPnt/SwapOldPntController.jsx +++ b/src/components/pages/swapOldPnt/SwapOldPntController.jsx @@ -1,11 +1,13 @@ +import PropTypes from 'prop-types' import React from 'react' import { connect } from 'react-redux' -import PropTypes from 'prop-types' -import SwapOldPnt from './SwapOldPnt' -import { connectWithWallet } from '../../../store/wallets/wallets.actions' + +import { updateInfoModal } from '../../../store/pages/pages.actions' import { resetProgress, updateSwapButton } from '../../../store/swap/swap.actions' import { swap } from '../../../store/swap-old-pnt/swap-old-pnt.actions' -import { updateInfoModal } from '../../../store/pages/pages.actions' +import { connectWithWallet } from '../../../store/wallets/wallets.actions' + +import SwapOldPnt from './SwapOldPnt' const mapStateToProps = (_state) => { return { diff --git a/src/hooks/use-migration.js b/src/hooks/use-migration.js index 219ad8ce..0bd88aa7 100644 --- a/src/hooks/use-migration.js +++ b/src/hooks/use-migration.js @@ -1,8 +1,10 @@ +import BigNumber from 'bignumber.js' import { useState, useEffect, useCallback, useMemo } from 'react' -import { useWalletByBlockchain } from './use-wallets' -import history from '../utils/history' + import { computeMigrationAmount } from '../utils/fee' -import BigNumber from 'bignumber.js' +import history from '../utils/history' + +import { useWalletByBlockchain } from './use-wallets' const useMigration = ({ wallets, diff --git a/src/hooks/use-old-pnt-swap.js b/src/hooks/use-old-pnt-swap.js index dc2d89db..4846026f 100644 --- a/src/hooks/use-old-pnt-swap.js +++ b/src/hooks/use-old-pnt-swap.js @@ -1,6 +1,8 @@ +import BigNumber from 'bignumber.js' import { useState, useEffect, useCallback, useMemo } from 'react' + import { isValidAccountByBlockchain } from '../utils/account-validator' -import BigNumber from 'bignumber.js' + import { useWalletByBlockchain } from './use-wallets' const useSwap = ({ wallets, assets, connectWithWallet, swap, progress, swapButton, updateSwapButton }) => { diff --git a/src/hooks/use-swap.js b/src/hooks/use-swap.js index 2436f2f3..86f2868d 100644 --- a/src/hooks/use-swap.js +++ b/src/hooks/use-swap.js @@ -15,7 +15,7 @@ import { isValidAccountByBlockchain } from '../utils/account-validator' import { getSwapFees, computeSwapAmount } from '../utils/fee' import { getReadOnlyProviderByBlockchain } from '../utils/read-only-providers' import { isValidSwap } from '../utils/swap-valildator' -import { getLegacyUrl, updateUrlForSwap } from '../utils/url' +import { updateUrlForSwap } from '../utils/url' import { useSwapInfo } from './use-swap-info' import { useWalletByBlockchain } from './use-wallets' diff --git a/src/lib/algoWalletModal/connectors/pera-wallet.js b/src/lib/algoWalletModal/connectors/pera-wallet.js index 49f3d26d..831c4d40 100644 --- a/src/lib/algoWalletModal/connectors/pera-wallet.js +++ b/src/lib/algoWalletModal/connectors/pera-wallet.js @@ -1,5 +1,5 @@ -import { EventEmitter } from 'eventemitter3' import { PeraWalletConnect } from '@perawallet/connect' +import { EventEmitter } from 'eventemitter3' class Provider extends EventEmitter { constructor(_peraWallet, _accounts) { diff --git a/src/lib/algoWalletModal/connectors/wallet-connect.js b/src/lib/algoWalletModal/connectors/wallet-connect.js index 46676037..33f7ebd8 100644 --- a/src/lib/algoWalletModal/connectors/wallet-connect.js +++ b/src/lib/algoWalletModal/connectors/wallet-connect.js @@ -1,8 +1,8 @@ +import { formatJsonRpcRequest } from '@json-rpc-tools/utils' import WalletConnect from '@walletconnect/client' import QRCodeModal from 'algorand-walletconnect-qrcode-modal' -import { EventEmitter } from 'eventemitter3' -import { formatJsonRpcRequest } from '@json-rpc-tools/utils' import algosdk from 'algosdk' +import { EventEmitter } from 'eventemitter3' class Provider extends EventEmitter { constructor(_connector) { diff --git a/src/lib/eosAccountSuggester/index.js b/src/lib/eosAccountSuggester/index.js index 41e776fb..68d5a9dc 100644 --- a/src/lib/eosAccountSuggester/index.js +++ b/src/lib/eosAccountSuggester/index.js @@ -1,6 +1,7 @@ -import { getReadOnlyProviderByBlockchain } from '../../utils/read-only-providers' import { Mutex } from 'async-mutex' +import { getReadOnlyProviderByBlockchain } from '../../utils/read-only-providers' + const mutex = new Mutex() class EosAccountSuggester { diff --git a/src/lib/eosConnect/components/Modal.jsx b/src/lib/eosConnect/components/Modal.jsx index 15d60a9e..51051c83 100644 --- a/src/lib/eosConnect/components/Modal.jsx +++ b/src/lib/eosConnect/components/Modal.jsx @@ -1,7 +1,7 @@ -import * as React from 'react' import * as PropTypes from 'prop-types' +import * as React from 'react' import styled from 'styled-components' -import { Provider } from './Provider' + import { MODAL_LIGHTBOX_CLASSNAME, MODAL_CONTAINER_CLASSNAME, @@ -9,6 +9,8 @@ import { MODAL_CARD_CLASSNAME, } from '../constants' +import { Provider } from './Provider' + const SLightbox = styled.div` transition: opacity 0.1s ease-in-out; text-align: center; @@ -144,7 +146,7 @@ export default class Modal extends React.Component { ref={(c) => (this.mainModalCard = c)} > {userOptions.map((provider) => - !!provider ? ( + provider ? ( { - console.log( + console.info( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://bit.ly/CRA-PWA' ) @@ -39,14 +40,14 @@ function registerValidSW(swUrl, config) { installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { - console.log( + console.info( 'New content is available and will be used when all ' + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' ) if (config && config.onUpdate) config.onUpdate(registration) } else { - console.log('Content is cached for offline use.') + console.info('Content is cached for offline use.') if (config && config.onSuccess) config.onSuccess(registration) } } @@ -73,7 +74,7 @@ function checkValidServiceWorker(swUrl, config) { } }) .catch(() => { - console.log('No internet connection found. App is running in offline mode.') + console.info('No internet connection found. App is running in offline mode.') }) } diff --git a/src/settings/__tests__/utils.test.js b/src/settings/__tests__/utils.test.js index 7613f4d6..20b84c71 100644 --- a/src/settings/__tests__/utils.test.js +++ b/src/settings/__tests__/utils.test.js @@ -1,8 +1,9 @@ import { test, describe, expect } from 'vitest' + import generateRpcSettings from '../utils' describe('generateRpcSettings', () => { - test('Should generate a setting object for https://www.npmjs.com/package/react-web3-settings', () => { + test('Should generate a setting object for https://www.npmjs.com/package/@p.network/react-web3-settings', () => { const settings = { eos: { chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', diff --git a/src/store/index.js b/src/store/index.js index cb5a4c09..63b6129e 100755 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,14 +1,15 @@ -import { createStore, applyMiddleware, compose } from 'redux' -import { middleware } from '../middleware' -import thunk from 'redux-thunk' -import { combineReducers } from 'redux' import { reducer as toastrReducer } from 'react-redux-toastr' -import walletsReducer from './wallets/wallets.reducer' +import { createStore, applyMiddleware, compose, combineReducers } from 'redux' +import thunk from 'redux-thunk' + +import { middleware } from '../middleware' + import migrationReducer from './migration/migration.reducer' +import nftsReducer from './nfts/nfts.reducer' +import pagesReducer from './pages/pages.reducer' import swapReducer from './swap/swap.reducer' import swapOldPntReducer from './swap-old-pnt/swap-old-pnt.reducer' -import pagesReducer from './pages/pages.reducer' -import nftsReducer from './nfts/nfts.reducer' +import walletsReducer from './wallets/wallets.reducer' const rootReducer = combineReducers({ migration: migrationReducer, diff --git a/src/store/migration/migration.actions.js b/src/store/migration/migration.actions.js index 4149c696..b7362c00 100644 --- a/src/store/migration/migration.actions.js +++ b/src/store/migration/migration.actions.js @@ -1,4 +1,5 @@ -import assets from '../../settings/migration-assets' +import axios from 'axios' + import { MIGRATION_ASSETS_LOADED, MIGRATION_BALANCE_LOADED, @@ -7,13 +8,14 @@ import { UPDATE_MIGRATE_BUTTON, APYS_LOADED, } from '../../constants/index' +import assets from '../../settings/migration-assets' import { loadEvmCompatibleBalances, loadEvmCompatibleBalance } from '../swap/utils/balances' -import { getAssetsByBlockchain, getAssetById } from './migration.selectors' import { getWalletByBlockchain } from '../wallets/wallets.selectors' -import { getDefaultSelection } from './utils/default-selection' -import migratePBTC from './migrations/pBTC-migration' + +import { getAssetsByBlockchain, getAssetById } from './migration.selectors' import migratePNT from './migrations/ethPNT-migration' -import axios from 'axios' +import migratePBTC from './migrations/pBTC-migration' +import { getDefaultSelection } from './utils/default-selection' const loadMigrationData = (_opts = {}) => { const { strategy } = _opts diff --git a/src/store/migration/migrations/pBTC-migration.js b/src/store/migration/migrations/pBTC-migration.js index 52f6dac2..50423797 100644 --- a/src/store/migration/migrations/pBTC-migration.js +++ b/src/store/migration/migrations/pBTC-migration.js @@ -1,12 +1,13 @@ -import Web3 from 'web3' import BigNumber from 'bignumber.js' +import Web3 from 'web3' + +import settings from '../../../settings' import ERC20Abi from '../../../utils/abi/ERC20.json' +import { parseError } from '../../../utils/errors' import { getCorrespondingTxExplorerLinkByBlockchain } from '../../../utils/explorer' -import settings from '../../../settings' -import { updateProgress, loadBalanceByAssetId, resetProgress, updateMigrateButton } from '../migration.actions' -import { getWalletByBlockchain } from '../../wallets/wallets.selectors' import { updateInfoModal } from '../../pages/pages.actions' -import { parseError } from '../../../utils/errors' +import { getWalletByBlockchain } from '../../wallets/wallets.selectors' +import { updateProgress, loadBalanceByAssetId, resetProgress, updateMigrateButton } from '../migration.actions' const migratePBTC = async (_amount, _from, _to, { dispatch }) => { try { diff --git a/src/store/migration/utils/migration-pegin.js b/src/store/migration/utils/migration-pegin.js index acfd8f3f..4d9fe325 100644 --- a/src/store/migration/utils/migration-pegin.js +++ b/src/store/migration/utils/migration-pegin.js @@ -1,9 +1,9 @@ -import { getCorrespondingTxExplorerLinkByBlockchain } from '../../../utils/explorer' -import { updateProgress, loadBalanceByAssetId, resetProgress, updateMigrateButton } from '../migration.actions' -import { updateInfoModal } from '../../pages/pages.actions' +import { sendEvent } from '../../../ga4' import { parseError } from '../../../utils/errors' +import { getCorrespondingTxExplorerLinkByBlockchain } from '../../../utils/explorer' import { approveTransaction, getBigNumber } from '../../evm-approve' -import { sendEvent } from '../../../ga4' +import { updateInfoModal } from '../../pages/pages.actions' +import { updateProgress, loadBalanceByAssetId, resetProgress, updateMigrateButton } from '../migration.actions' const migrationPegin = async ({ swap, ptokenFrom, ptokenTo, web3, dispatch }) => { let link diff --git a/src/store/nfts/adapters/cgt.js b/src/store/nfts/adapters/cgt.js index 20272e09..0ea1deff 100644 --- a/src/store/nfts/adapters/cgt.js +++ b/src/store/nfts/adapters/cgt.js @@ -1,11 +1,13 @@ import Web3 from 'web3' + import CGTAbi from '../../../utils/abi/CHAINGUARDIANS/CGT.json' -import NativeAbi from '../../../utils/abi/CHAINGUARDIANS/Native.json' import HostAbi from '../../../utils/abi/CHAINGUARDIANS/Host.json' +import NativeAbi from '../../../utils/abi/CHAINGUARDIANS/Native.json' import { executeEvmCompatibleTxWithToast } from '../../../utils/tx-utils' +import { loadNftData } from '../nfts.actions' import { getProviderByBlockchain, getAccountByBlockchain } from '../nfts.selectors' + import { loadErc721Data } from './erc721' -import { loadNftData } from '../nfts.actions' const moveChainGuardians = async ({ nft, destinationAccount, dispatch }) => { try { diff --git a/src/store/nfts/adapters/erc1155.js b/src/store/nfts/adapters/erc1155.js index c89431e1..71eddb7d 100644 --- a/src/store/nfts/adapters/erc1155.js +++ b/src/store/nfts/adapters/erc1155.js @@ -1,5 +1,6 @@ -import BigNumber from 'bignumber.js' import axios from 'axios' +import BigNumber from 'bignumber.js' + import ERC1155Abi from '../../../utils/abi/ERC1155.json' import { nftsDataLoaded } from '../nfts.actions' diff --git a/src/store/nfts/adapters/erc721.js b/src/store/nfts/adapters/erc721.js index 13462ff0..43ece61c 100644 --- a/src/store/nfts/adapters/erc721.js +++ b/src/store/nfts/adapters/erc721.js @@ -1,5 +1,6 @@ -import BigNumber from 'bignumber.js' import axios from 'axios' +import BigNumber from 'bignumber.js' + import ERC721Abi from '../../../utils/abi/ERC721.json' import { nftsDataLoaded } from '../nfts.actions' diff --git a/src/store/nfts/adapters/rarebit-bunnies.js b/src/store/nfts/adapters/rarebit-bunnies.js index caed3e27..50d507d6 100644 --- a/src/store/nfts/adapters/rarebit-bunnies.js +++ b/src/store/nfts/adapters/rarebit-bunnies.js @@ -1,10 +1,11 @@ import Web3 from 'web3' -import NativeAbi from '../../../utils/abi/RAREBITBUNNIES/Native.json' + +import ERC1155Abi from '../../../utils/abi/ERC1155.json' import HostAbi from '../../../utils/abi/RAREBITBUNNIES/Host.json' +import NativeAbi from '../../../utils/abi/RAREBITBUNNIES/Native.json' import { executeEvmCompatibleTxWithToast } from '../../../utils/tx-utils' -import { getProviderByBlockchain, getAccountByBlockchain } from '../nfts.selectors' -import ERC1155Abi from '../../../utils/abi/ERC1155.json' import { loadNftData } from '../nfts.actions' +import { getProviderByBlockchain, getAccountByBlockchain } from '../nfts.selectors' const moveRarebitBunnies = async ({ nft, destinationAccount, amount, dispatch }) => { try { diff --git a/src/store/nfts/nfts.actions.js b/src/store/nfts/nfts.actions.js index 9672bd44..b9b55ac2 100644 --- a/src/store/nfts/nfts.actions.js +++ b/src/store/nfts/nfts.actions.js @@ -1,14 +1,15 @@ -import nfts from '../../settings/nfts' -import Web3 from 'web3' import _ from 'lodash' -import { getReadOnlyProviderByBlockchain } from '../../utils/read-only-providers' +import Web3 from 'web3' + import { NFTS_DATA_LOADED } from '../../constants' +import nfts from '../../settings/nfts' +import { getReadOnlyProviderByBlockchain } from '../../utils/read-only-providers' import { setLoading } from '../pages/pages.actions' +import { getWalletAccountByBlockchain } from '../wallets/wallets.selectors' + +import { moveChainGuardians, loadChainGuardiansData } from './adapters/cgt' import { loadERC155Data } from './adapters/erc1155' -import { moveChainGuardians } from './adapters/cgt' import { moveRarebitBunnies } from './adapters/rarebit-bunnies' -import { loadChainGuardiansData } from './adapters/cgt' -import { getWalletAccountByBlockchain } from '../wallets/wallets.selectors' const loadNftsData = (_account, _blockchain) => { return async (_dispatch) => { diff --git a/src/store/swap-old-pnt/swap-old-pnt-selector.js b/src/store/swap-old-pnt/swap-old-pnt-selector.js index 35ae024d..b05dcf6e 100644 --- a/src/store/swap-old-pnt/swap-old-pnt-selector.js +++ b/src/store/swap-old-pnt/swap-old-pnt-selector.js @@ -1,5 +1,5 @@ -import store from '../index' import { PNT_ON_BSC_MAINNET_OLD, PNT_ON_BSC_MAINNET } from '../../constants' +import store from '../index' const getOldPnt = () => store.getState().swapOldPnt.assets.find(({ id }) => id === PNT_ON_BSC_MAINNET_OLD) diff --git a/src/store/swap-old-pnt/swap-old-pnt.actions.js b/src/store/swap-old-pnt/swap-old-pnt.actions.js index af935a0d..58a9ddae 100644 --- a/src/store/swap-old-pnt/swap-old-pnt.actions.js +++ b/src/store/swap-old-pnt/swap-old-pnt.actions.js @@ -1,15 +1,17 @@ -import assets from '../../settings/swap-assets' -import { loadEvmCompatibleBalance } from '../swap/utils/balances' -import settings from '../../settings' +import BigNumber from 'bignumber.js' +import Web3 from 'web3' + import { ASSETS_LOADED_SWAP_OLD_PNT, PNT_ON_BSC_MAINNET } from '../../constants/index' -import { resetProgress, updateSwapButton, updateProgress, loadBalances } from '../swap/swap.actions' -import { getWalletByBlockchain } from '../wallets/wallets.selectors' +import settings from '../../settings' +import assets from '../../settings/swap-assets' import Erc20Abi from '../../utils/abi/ERC20.json' import SwapOldPntAbi from '../../utils/abi/SWAP_OLD_PNT/Swap.json' -import Web3 from 'web3' -import { getOldPnt } from './swap-old-pnt-selector' -import BigNumber from 'bignumber.js' import { getCorrespondingTxExplorerLinkByBlockchain } from '../../utils/explorer' +import { resetProgress, updateSwapButton, updateProgress, loadBalances } from '../swap/swap.actions' +import { loadEvmCompatibleBalance } from '../swap/utils/balances' +import { getWalletByBlockchain } from '../wallets/wallets.selectors' + +import { getOldPnt } from './swap-old-pnt-selector' const loadSwapOldPntData = () => ({ type: ASSETS_LOADED_SWAP_OLD_PNT, diff --git a/src/store/swap/utils/algorand.js b/src/store/swap/utils/algorand.js index 25580803..9ffde9a6 100644 --- a/src/store/swap/utils/algorand.js +++ b/src/store/swap/utils/algorand.js @@ -1,5 +1,6 @@ -import algosdk from 'algosdk' import { encode } from '@msgpack/msgpack' +import algosdk from 'algosdk' + import { getReadOnlyProviderByBlockchain } from '../../../utils/read-only-providers' function encodeUint64Number(num) { diff --git a/src/store/swap/utils/opt-in-algo.js b/src/store/swap/utils/opt-in-algo.js index dd6f1892..4255cc25 100644 --- a/src/store/swap/utils/opt-in-algo.js +++ b/src/store/swap/utils/opt-in-algo.js @@ -1,8 +1,9 @@ import algosdk from 'algosdk' -import { getWalletAccountByBlockchain, getWalletProviderByBlockchain } from '../../wallets/wallets.selectors' -import { getReadOnlyProviderByBlockchain } from '../../../utils/read-only-providers' import { toastr } from 'react-redux-toastr' +import { getReadOnlyProviderByBlockchain } from '../../../utils/read-only-providers' +import { getWalletAccountByBlockchain, getWalletProviderByBlockchain } from '../../wallets/wallets.selectors' + export const maybeOptInAlgoAsset = async (_account, _assetIndex, updateButton = undefined) => { try { const walletAccount = getWalletAccountByBlockchain('ALGORAND') diff --git a/src/store/wallets/wallets.utils.js b/src/store/wallets/wallets.utils.js index 0610f894..2ae9546c 100644 --- a/src/store/wallets/wallets.utils.js +++ b/src/store/wallets/wallets.utils.js @@ -1,4 +1,4 @@ -import EthereumProvider from '@walletconnect/ethereum-provider' +import Provider from '@walletconnect/ethereum-provider' const walletConnectV2Connector = async (_package, options) => { const provider = await _package.init({ @@ -26,6 +26,6 @@ export const createWalletConnect2 = (_chainId) => ({ chainId: [_chainId], showQrModal: true, }, - package: EthereumProvider, + package: Provider, connector: walletConnectV2Connector, }) diff --git a/src/test.setup.js b/src/test.setup.js index 33691597..459e7cb2 100644 --- a/src/test.setup.js +++ b/src/test.setup.js @@ -1,6 +1,6 @@ -import { expect, afterEach } from 'vitest' -import { cleanup } from '@testing-library/react' import matchers from '@testing-library/jest-dom/matchers' +import { cleanup } from '@testing-library/react' +import { expect, afterEach } from 'vitest' import 'jest-styled-components' // extends Vitest's expect method with methods from react-testing-library diff --git a/src/theme/ThemeProvider.jsx b/src/theme/ThemeProvider.jsx index 42b1500d..c141b810 100644 --- a/src/theme/ThemeProvider.jsx +++ b/src/theme/ThemeProvider.jsx @@ -1,6 +1,6 @@ import React, { useMemo } from 'react' -import { ThemeProvider as StyledComponentsThemeProvider, createGlobalStyle } from 'styled-components' import { useSelector } from 'react-redux' +import { ThemeProvider as StyledComponentsThemeProvider, createGlobalStyle } from 'styled-components' export const colors = (_darkMode) => ({ white: '#FFFFFF', diff --git a/src/utils/__tests__/amount-utils.test.js b/src/utils/__tests__/amount-utils.test.js index ead84f17..2a67735e 100644 --- a/src/utils/__tests__/amount-utils.test.js +++ b/src/utils/__tests__/amount-utils.test.js @@ -1,4 +1,5 @@ import { test, vi, describe, expect } from 'vitest' + import { getDecimalSeparator, getThousandSeparator, formatDecimalSeparator } from '../amount-utils' describe('getDecimalSeparator', () => { diff --git a/src/utils/tx-utils.js b/src/utils/tx-utils.js index 6eb34b10..21e7cec3 100644 --- a/src/utils/tx-utils.js +++ b/src/utils/tx-utils.js @@ -1,4 +1,5 @@ import { toastr } from 'react-redux-toastr' + import { getCorrespondingTxExplorerLinkByBlockchain } from './explorer' const executeEvmCompatibleTxWithToast = (_fx, { from, blockchain }) =>