Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(meme): hide meme coins from supported list #6483

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ const PageContent = styled.div<{ center: boolean }>`
}
`

export { PageContent, Container, Content, Nav, Wrapper }
export { Container, Content, Nav, PageContent, Wrapper }
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ 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'
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'

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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as QuoteSummaryViewModel from './quoteSummaryViewModel'
const makeCoins = (): Coins => ({
BTC: {
coinfig: {
categories: [],
displaySymbol: 'BTC',
name: 'Bitcoin',
precision: 8,
Expand All @@ -22,6 +23,7 @@ const makeCoins = (): Coins => ({
},
USD: {
coinfig: {
categories: [],
displaySymbol: 'USD',
name: 'US Dollar',
precision: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -257,7 +256,6 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = (props) => {
}

const onChangeInput = (e, value) => {
console.log({ e, value })
const itemId = e.currentTarget.name

const { blocking, context, nodes } = props.extraSteps
Expand Down Expand Up @@ -629,7 +627,6 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = (props) => {
if (node.type === NodeItemTypes.DATE_SELECTION) {
return RenderDateQuestion(node)
}
console.log('UNRECOGNIZED NODE_TYPE', node.type)
return null
})}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const makeCoinfig = () => ({
categories: [],
displaySymbol: '',
name: '',
precision: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we filter supported coins for entire app to prevent showing of them on v4

.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')
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain-wallet-v4/src/network/api/kyc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
34 changes: 17 additions & 17 deletions packages/blockchain-wallet-v4/src/redux/data/bch/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as selectors from './selectors'
const COINS_STUB: Window['coins'] = {
USDC: {
coinfig: {
categories: [],
displaySymbol: 'USDC',
name: 'USD Coin',
precision: 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ 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', () => {
const wrapped = Wrapper.fromJS(wrapperFixture)

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)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions packages/blockchain-wallet-v4/src/walletCrypto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
9 changes: 6 additions & 3 deletions typings/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed ordering

coins: Coins
grecaptcha: any // google recaptcha sets this on window
history?: {
Expand Down
Loading