diff --git a/packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxCoin/selectors.ts b/packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxCoin/selectors.ts index 70a87994faf..0a60f518f50 100644 --- a/packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxCoin/selectors.ts +++ b/packages/blockchain-wallet-v4-frontend/src/components/Form/SelectBoxCoin/selectors.ts @@ -14,7 +14,8 @@ export const getData = (state) => { (products.includes('PrivateKey') || products.includes('CustodialWalletBalance') || products.includes('DynamicSelfCustody')) && - coinfig.type.name !== 'FIAT' + coinfig.type.name !== 'FIAT' && + !coinfig.categories.some((cat) => cat?.id === 'MEME') ) }) .map((coinfig) => ({ text: coinfig.name, value: coinfig.symbol })) diff --git a/packages/blockchain-wallet-v4-frontend/src/data/preferences/sagaRegister.ts b/packages/blockchain-wallet-v4-frontend/src/data/preferences/sagaRegister.ts index e6cf8dca2af..b74b0b803f5 100644 --- a/packages/blockchain-wallet-v4-frontend/src/data/preferences/sagaRegister.ts +++ b/packages/blockchain-wallet-v4-frontend/src/data/preferences/sagaRegister.ts @@ -1,7 +1,7 @@ import { takeLatest } from 'redux-saga/effects' -import { actions } from './slice' import sagas from './sagas' +import { actions } from './slice' export default () => { const preferencesSagas = sagas() diff --git a/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/WalletLayout.styles.ts b/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/WalletLayout.styles.ts index 1bdaf0213ef..de5c469e075 100644 --- a/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/WalletLayout.styles.ts +++ b/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/WalletLayout.styles.ts @@ -61,4 +61,4 @@ const PageContent = styled.div<{ center: boolean }>` } ` -export { PageContent, Container, Content, Nav, Wrapper } +export { Container, Content, Nav, PageContent, Wrapper } diff --git a/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/index.tsx b/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/index.tsx index b8f4e89f0d0..a6c28e34d31 100644 --- a/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/index.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/layouts/Wallet/WalletLayout/index.tsx @@ -2,6 +2,7 @@ import React, { ReactElement } from 'react' import { useIdleTimer } from 'react-idle-timer' import { useDispatch, useSelector } from 'react-redux' +import { getAutoLogoutTime } from '@core/redux/wallet/selectors' import Alerts from 'components/Alerts' import { ServiceAnnouncement, StaticAnnouncement } from 'components/Announcements' import { SofiBanner, UkBanner, UkFooterBanner } from 'components/Banner' @@ -9,6 +10,8 @@ import { CowboysCardComponent } from 'components/Card/CowboysCard' import ExchangePromo from 'components/Card/ExchangePromo' import { SupportChatForGoldUserOnly } from 'components/SupportChat' import Tooltips from 'components/Tooltips' +import { modals } from 'data/actions' +import { RootState } from 'data/rootReducer' import { ModalName } from 'data/types' import ErrorBoundary from 'providers/ErrorBoundaryProvider' @@ -16,9 +19,6 @@ import Modals from '../../../modals' import MenuLeft from '../MenuLeft' import MenuTop from '../MenuTop' import { Container, Content, Nav, PageContent, Wrapper } from './WalletLayout.styles' -import { modals } from 'data/actions' -import { RootState } from 'data/rootReducer' -import { getAutoLogoutTime } from '@core/redux/wallet/selectors' const WalletLayout = ({ approvalDate, diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/DepositConfirm.tsx b/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/DepositConfirm.tsx index 7d8ad2a075e..87d8a4121cd 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/DepositConfirm.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/DepositConfirm.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useState } from 'react' import { FormattedMessage } from 'react-intl' import { useDispatch, useSelector } from 'react-redux' +import { Padding } from '@blockchain-com/constellation' import { addDays, format } from 'date-fns' import styled from 'styled-components' @@ -26,7 +27,7 @@ import { DepositTerms } from 'data/types' import { useShowConversionAlert } from 'hooks' -import { Padding } from '@blockchain-com/constellation' + import { MoreInfoContainer } from './MoreInfoContainer' // Auto margin top so it gets pushed to the bottom diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/MoreInfoContainer.tsx b/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/MoreInfoContainer.tsx index 0ac60bf9076..ea6bed96523 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/MoreInfoContainer.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/modals/Brokerage/Banks/Deposit/Confirm/MoreInfoContainer.tsx @@ -1,8 +1,9 @@ -import { Padding, Button, Text } from '@blockchain-com/constellation' -import { FlyoutWrapper } from 'components/Flyout' import React, { FC, ReactNode, useState } from 'react' +import { Button, Padding, Text } from '@blockchain-com/constellation' import styled from 'styled-components' +import { FlyoutWrapper } from 'components/Flyout' + const Container = styled(FlyoutWrapper)` display: flex; flex-direction: column; diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/BuySell/CheckoutConfirm/models/quoteSummaryViewModel.test.ts b/packages/blockchain-wallet-v4-frontend/src/modals/BuySell/CheckoutConfirm/models/quoteSummaryViewModel.test.ts index 66a708db96a..c5b7cf739c3 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/BuySell/CheckoutConfirm/models/quoteSummaryViewModel.test.ts +++ b/packages/blockchain-wallet-v4-frontend/src/modals/BuySell/CheckoutConfirm/models/quoteSummaryViewModel.test.ts @@ -6,6 +6,7 @@ import * as QuoteSummaryViewModel from './quoteSummaryViewModel' const makeCoins = (): Coins => ({ BTC: { coinfig: { + categories: [], displaySymbol: 'BTC', name: 'Bitcoin', precision: 8, @@ -22,6 +23,7 @@ const makeCoins = (): Coins => ({ }, USD: { coinfig: { + categories: [], displaySymbol: 'USD', name: 'US Dollar', precision: 2, diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/Onboarding/KycVerification/ExtraFields/template.success.tsx b/packages/blockchain-wallet-v4-frontend/src/modals/Onboarding/KycVerification/ExtraFields/template.success.tsx index 106e0c40057..33ac8b43f12 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/Onboarding/KycVerification/ExtraFields/template.success.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/modals/Onboarding/KycVerification/ExtraFields/template.success.tsx @@ -8,15 +8,14 @@ import { HeaderType, NodeItem, NodeItemTypes, NodeTextType } from '@core/types' import { BlockchainLoader, Button, HeartbeatLoader, Icon, Text } from 'blockchain-info-components' import { FlyoutWrapper } from 'components/Flyout' import CheckBox from 'components/Form/CheckBox' +import DateInputBox from 'components/Form/DateInputBox' import Form from 'components/Form/Form' import FormGroup from 'components/Form/FormGroup' import FormItem from 'components/Form/FormItem' import SelectBox from 'components/Form/SelectBox' import TextBox from 'components/Form/TextBox' -import DateInputBox from 'components/Form/DateInputBox' - import { model } from 'data' -import { required, validFormat, ageOverEighteen } from 'services/forms' +import { ageOverEighteen, required, validFormat } from 'services/forms' import { Props as OwnProps, SuccessStateType } from '.' import { GetInputPlaceholder, GetNodeQuestionElements } from './model' @@ -257,7 +256,6 @@ const Success: React.FC & Props> = (props) => { } const onChangeInput = (e, value) => { - console.log({ e, value }) const itemId = e.currentTarget.name const { blocking, context, nodes } = props.extraSteps @@ -629,7 +627,6 @@ const Success: React.FC & Props> = (props) => { if (node.type === NodeItemTypes.DATE_SELECTION) { return RenderDateQuestion(node) } - console.log('UNRECOGNIZED NODE_TYPE', node.type) return null })} diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/RequestCrypto/ShowAddress/index.tsx b/packages/blockchain-wallet-v4-frontend/src/modals/RequestCrypto/ShowAddress/index.tsx index 4e8d1f175c4..488bb45a980 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/RequestCrypto/ShowAddress/index.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/modals/RequestCrypto/ShowAddress/index.tsx @@ -13,6 +13,10 @@ import { NetworkWarning, NetworkWarningVariant } from 'components/NetworkWarning import QRCodeWrapper from 'components/QRCode/Wrapper' import { actions, selectors } from 'data' import { SwapBaseCounterTypes } from 'data/types' + +import { Props as OwnProps } from '../index' +import { ClipboardWrapper } from '../model' +import { RequestSteps } from '../types' import { AddressDisplay, AddressWrapper, @@ -22,9 +26,6 @@ import { QRCodeContainer, Wrapper } from './styled' -import { Props as OwnProps } from '../index' -import { ClipboardWrapper } from '../model' -import { RequestSteps } from '../types' const { formatAddr, hasPrefix } = utils.bch diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/Swap/EnterAmount/test-utils/makeCoinfig.ts b/packages/blockchain-wallet-v4-frontend/src/modals/Swap/EnterAmount/test-utils/makeCoinfig.ts index 9b40d0891d2..f8e13166ff0 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/Swap/EnterAmount/test-utils/makeCoinfig.ts +++ b/packages/blockchain-wallet-v4-frontend/src/modals/Swap/EnterAmount/test-utils/makeCoinfig.ts @@ -1,4 +1,5 @@ export const makeCoinfig = () => ({ + categories: [], displaySymbol: '', name: '', precision: 10, diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Prices/template.success.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/Prices/template.success.tsx index 4c9b8e09e30..9b01341f051 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Prices/template.success.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Prices/template.success.tsx @@ -7,8 +7,8 @@ import styled from 'styled-components' import { getCurrency } from '@core/redux/settings/selectors' import { getCoinViewV2 } from '@core/redux/walletOptions/selectors' -import { CellText, HeaderText, HeaderToggle, TableWrapper } from 'components/Table' import { getData as getUserCountry } from 'components/Banner/selectors' +import { CellText, HeaderText, HeaderToggle, TableWrapper } from 'components/Table' import { Props as _P, SuccessStateType as _S } from '.' import { getTableColumns } from './Table' @@ -33,7 +33,7 @@ const PricesTable = (props: Props) => { const textFilter = useSelector((state) => formValueSelector('prices')(state, 'textFilter')) const walletCurrency = useSelector(getCurrency).getOrElse('USD') const isUkUser = isUserFromUK || isIpFromUK - + const { analyticsActions, buySellActions, diff --git a/packages/blockchain-wallet-v4-frontend/src/store/worker.assets.js b/packages/blockchain-wallet-v4-frontend/src/store/worker.assets.js index 27b9f2198ed..5cc8e509555 100644 --- a/packages/blockchain-wallet-v4-frontend/src/store/worker.assets.js +++ b/packages/blockchain-wallet-v4-frontend/src/store/worker.assets.js @@ -18,9 +18,12 @@ addEventListener('message', ({ data }) => { let assets = {} const supportedCoins = custodialAssets.currencies.concat(erc20Assets.currencies) - supportedCoins.forEach((coin) => { - assets[coin.symbol] = { coinfig: coin } - }) + supportedCoins + .filter((coin) => !coin.categories.some((cat) => cat?.id === 'MEME')) + .forEach((coin) => { + console.log('coin', coin) + assets[coin.symbol] = { coinfig: coin } + }) assets.MATIC.coinfig.type.logoPngUrl = assets['MATIC.MATIC'].coinfig.type.logoPngUrl assets.STX.coinfig.products.push('DynamicSelfCustody') diff --git a/packages/blockchain-wallet-v4/src/network/api/kyc/types.ts b/packages/blockchain-wallet-v4/src/network/api/kyc/types.ts index 68df264af33..22b88bb8a37 100644 --- a/packages/blockchain-wallet-v4/src/network/api/kyc/types.ts +++ b/packages/blockchain-wallet-v4/src/network/api/kyc/types.ts @@ -15,13 +15,13 @@ export enum ExtraKYCContext { } export enum NodeItemTypes { + DATE_SELECTION = 'DATE_SELECTION', INFO = 'INFO', MULTIPLE_SELECTION = 'MULTIPLE_SELECTION', OPEN_ENDED = 'OPEN_ENDED', SELECTION = 'SELECTION', SINGLE_CHECKBOX = 'SINGLE_CHECKBOX', - SINGLE_SELECTION = 'SINGLE_SELECTION', - DATE_SELECTION = 'DATE_SELECTION' + SINGLE_SELECTION = 'SINGLE_SELECTION' } export type VerifiedType = { diff --git a/packages/blockchain-wallet-v4/src/redux/data/bch/sagas.ts b/packages/blockchain-wallet-v4/src/redux/data/bch/sagas.ts index 5ca246243ee..790de4e011d 100755 --- a/packages/blockchain-wallet-v4/src/redux/data/bch/sagas.ts +++ b/packages/blockchain-wallet-v4/src/redux/data/bch/sagas.ts @@ -41,6 +41,23 @@ export default ({ api }: { api: APIType }) => { } } + const __processTxs = function* (txs) { + // Page == Remote ([Tx]) + // Remote(wallet) + const wallet = yield select(walletSelectors.getWallet) + const walletR = Remote.of(wallet) + const accountList = (yield select(getAccountsList)).getOrElse([]) + const txNotes = (yield select(getBchTxNotes)).getOrElse({}) + + // transformTx :: wallet -> Tx + // ProcessPage :: wallet -> [Tx] -> [Tx] + const ProcessTxs = (wallet, txList, txNotes) => + map(transformTx.bind(undefined, wallet.getOrFail(MISSING_WALLET), [], txNotes), txList) + // ProcessRemotePage :: Page -> Page + const processedTxs = ProcessTxs(walletR, txs, txNotes) + return addFromToAccountNames(wallet, accountList, processedTxs) + } + const fetchTransactions = function* (action) { try { const { payload } = action @@ -95,23 +112,6 @@ export default ({ api }: { api: APIType }) => { } } - const __processTxs = function* (txs) { - // Page == Remote ([Tx]) - // Remote(wallet) - const wallet = yield select(walletSelectors.getWallet) - const walletR = Remote.of(wallet) - const accountList = (yield select(getAccountsList)).getOrElse([]) - const txNotes = (yield select(getBchTxNotes)).getOrElse({}) - - // transformTx :: wallet -> Tx - // ProcessPage :: wallet -> [Tx] -> [Tx] - const ProcessTxs = (wallet, txList, txNotes) => - map(transformTx.bind(undefined, wallet.getOrFail(MISSING_WALLET), [], txNotes), txList) - // ProcessRemotePage :: Page -> Page - const processedTxs = ProcessTxs(walletR, txs, txNotes) - return addFromToAccountNames(wallet, accountList, processedTxs) - } - const fetchTransactionHistory = function* ({ payload }) { const { address, end, start } = payload const startDate = format(new Date(start), 'dd/MM/yyyy') diff --git a/packages/blockchain-wallet-v4/src/redux/data/coins/selectors.spec.ts b/packages/blockchain-wallet-v4/src/redux/data/coins/selectors.spec.ts index 2175a1a37e7..59c053141fb 100644 --- a/packages/blockchain-wallet-v4/src/redux/data/coins/selectors.spec.ts +++ b/packages/blockchain-wallet-v4/src/redux/data/coins/selectors.spec.ts @@ -3,6 +3,7 @@ import * as selectors from './selectors' const COINS_STUB: Window['coins'] = { USDC: { coinfig: { + categories: [], displaySymbol: 'USDC', name: 'USD Coin', precision: 6, diff --git a/packages/blockchain-wallet-v4/src/redux/wallet/walletReducers.spec.js b/packages/blockchain-wallet-v4/src/redux/wallet/walletReducers.spec.js index dc31b1d39cf..6f42ca3a67a 100755 --- a/packages/blockchain-wallet-v4/src/redux/wallet/walletReducers.spec.js +++ b/packages/blockchain-wallet-v4/src/redux/wallet/walletReducers.spec.js @@ -4,7 +4,8 @@ import { AddressMap, Wallet, Wrapper } from '../../types' import * as Actions from './actions' import walletReducer from './reducers' -const wrapperFixture = require('../../types/__mocks__/wrapper.v4') + +const wrapperFixture = jest.mock('../../types/__mocks__/wrapper.v4') describe('reducers', () => { describe('wallet', () => { @@ -12,7 +13,7 @@ describe('reducers', () => { it('should handle SET_WRAPPER', () => { const action = Actions.setWrapper(wrapped) - const next = walletReducer(void 0, action) + const next = walletReducer(0, action) expect(next).toEqual(wrapped) }) diff --git a/packages/blockchain-wallet-v4/src/redux/walletOptions/types.ts b/packages/blockchain-wallet-v4/src/redux/walletOptions/types.ts index 2ffb8106336..48e06733bf4 100644 --- a/packages/blockchain-wallet-v4/src/redux/walletOptions/types.ts +++ b/packages/blockchain-wallet-v4/src/redux/walletOptions/types.ts @@ -3,7 +3,14 @@ import { CoinType, RemoteDataType, WalletFiatType } from '../../types' export type WalletOptionsType = typeof WalletOptions +type Category = { + description: string + id: string + name: string +} + export type CoinfigType = { + categories: Category[] displaySymbol: string name: string precision: number diff --git a/packages/blockchain-wallet-v4/src/walletCrypto/index.ts b/packages/blockchain-wallet-v4/src/walletCrypto/index.ts index 8ea173bdada..877996614f5 100755 --- a/packages/blockchain-wallet-v4/src/walletCrypto/index.ts +++ b/packages/blockchain-wallet-v4/src/walletCrypto/index.ts @@ -76,11 +76,14 @@ const decryptBufferWithKey = (payload, iv, key, options) => { return decryptedBytes.toString('utf8') } +// sha256 :: Buffer -> Buffer +export const sha256 = (data) => crypto.createHash('sha256').update(data).digest() + // hashNTimes :: Integer -> String -> String export const hashNTimes = curry((iterations, data) => { assert(iterations > 0, '`iterations` must be a number greater than 0') let result = data - for (let i = 1; i <= iterations; i++) { + for (let i = 1; i <= iterations; i += 1) { result = sha256(result) } return result @@ -123,9 +126,6 @@ export const decryptDataWithKey = curry((data, key) => { return decryptBufferWithKey(payload, iv, key) }) -// sha256 :: Buffer -> Buffer -export const sha256 = (data) => crypto.createHash('sha256').update(data).digest() - // generateMnemonic :: Api -> Promise String export const generateMnemonic = (api) => { return createRng(16, api).then((rng) => BIP39.generateMnemonic(null, rng)) diff --git a/typings/window.d.ts b/typings/window.d.ts index 2225054a24a..18d2b5a710e 100644 --- a/typings/window.d.ts +++ b/typings/window.d.ts @@ -20,10 +20,13 @@ declare global { // build injected recaptcha key SARDINE_CLIENT_ID: string // build injected sardine access key - SARDINE_ENVIRONMENT: string // sardine environment sandbox or production - _Sardine: any // Sardine integration - _SardineContext: any // Sardine integration + SARDINE_ENVIRONMENT: string + // Sardine integration WALLET_V5_LINK: string + // sardine environment sandbox or production + _Sardine: any + // Sardine integration + _SardineContext: any coins: Coins grecaptcha: any // google recaptcha sets this on window history?: {