Skip to content

Commit

Permalink
Merge pull request #21 from DarkFlorist/remove-moonpay
Browse files Browse the repository at this point in the history
remove moonpay
  • Loading branch information
KillariDev authored Jan 2, 2024
2 parents 1c88529 + 4c68b3c commit 634753c
Show file tree
Hide file tree
Showing 27 changed files with 14 additions and 1,035 deletions.
3 changes: 0 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ REACT_APP_AWS_API_ENDPOINT="https://beta.api.uniswap.org/v1/graphql"
REACT_APP_BNB_RPC_URL="https://rough-sleek-hill.bsc.quiknode.pro/413cc98cbc776cda8fdf1d0f47003583ff73d9bf"
REACT_APP_INFURA_KEY="4bf032f2d38a4ed6bb975b80d6340847"
REACT_APP_QUICKNODE_MAINNET_RPC_URL="https://magical-alien-tab.quiknode.pro/669e87e569a8277d3fbd9e202f9df93189f19f4c"
REACT_APP_MOONPAY_API="https://api.moonpay.com"
REACT_APP_MOONPAY_LINK="https://us-central1-uniswap-mobile.cloudfunctions.net/signMoonpayLinkV2?platform=web&env=staging"
REACT_APP_MOONPAY_PUBLISHABLE_KEY="pk_test_DycfESRid31UaSxhI5yWKe1r5E5kKSz"
REACT_APP_SENTRY_DSN="https://[email protected]/4504255148851200"
REACT_APP_STATSIG_PROXY_URL="https://api.uniswap.org/v1/statsig-proxy"
REACT_APP_TEMP_API_URL="https://temp.api.uniswap.org/v1"
Expand Down
3 changes: 0 additions & 3 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ REACT_APP_FIREBASE_KEY="AIzaSyBcZWwTcTJHj_R6ipZcrJkXdq05PuX0Rs0"
REACT_APP_FORTMATIC_KEY="pk_live_F937DF033A1666BF"
REACT_APP_GOOGLE_ANALYTICS_ID="G-KDP9B6W4H8"
REACT_APP_INFURA_KEY="099fc58e0de9451d80b18d7c74caa7c1"
REACT_APP_MOONPAY_API="https://api.moonpay.com"
REACT_APP_MOONPAY_LINK="https://us-central1-uniswap-mobile.cloudfunctions.net/signMoonpayLinkV2?platform=web&env=production"
REACT_APP_MOONPAY_PUBLISHABLE_KEY="pk_live_uQG4BJC4w3cxnqpcSqAfohdBFDTsY6E"
REACT_APP_SENTRY_ENABLED=true
REACT_APP_SENTRY_TRACES_SAMPLE_RATE=0.00003
REACT_APP_STATSIG_PROXY_URL="https://api.uniswap.org/v1/statsig-proxy"
Expand Down
28 changes: 0 additions & 28 deletions cypress/e2e/buy-crypto-modal.test.ts

This file was deleted.

6 changes: 0 additions & 6 deletions cypress/e2e/wallet-dropdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ describe('Wallet Dropdown', () => {
cy.viewport('iphone-6').visit('/')
})

it('should dismiss the wallet bottom sheet when clicking buy crypto', () => {
cy.get(getTestSelector('web3-status-connected')).click()
cy.get(getTestSelector('wallet-buy-crypto')).click()
cy.contains('Buy crypto').should('not.be.visible')
})

it('should use a bottom sheet and dismiss when on a mobile screen size', () => {
cy.get(getTestSelector('web3-status-connected')).click()
cy.root().click(15, 40)
Expand Down
1 change: 0 additions & 1 deletion src/assets/svg/moonpay.svg

This file was deleted.

12 changes: 1 addition & 11 deletions src/components/About/constants.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { DollarSign, Terminal } from 'react-feather'
import { Terminal } from 'react-feather'
import styled from 'styled-components'
import { lightTheme } from 'theme/colors'

import darkArrowImgSrc from './images/aboutArrowDark.png'
import lightArrowImgSrc from './images/aboutArrowLight.png'
import darkDollarImgSrc from './images/aboutDollarDark.png'
import darkTerminalImgSrc from './images/aboutTerminalDark.png'
import nftCardImgSrc from './images/nftCard.png'
import swapCardImgSrc from './images/swapCard.png'
Expand Down Expand Up @@ -36,15 +35,6 @@ const StyledCardLogo = styled.img`
`

export const MORE_CARDS = [
{
to: 'https://support.uniswap.org/hc/en-us/articles/11306574799117-How-to-use-Moon-Pay-on-the-Uniswap-web-app-',
external: true,
title: 'Buy crypto',
description: 'Buy crypto with your credit card or bank account at the best rates.',
lightIcon: <DollarSign color={lightTheme.neutral3} size={48} />,
darkIcon: <StyledCardLogo src={darkDollarImgSrc} alt="Earn" />,
cta: 'Buy now',
},
{
to: '/pools',
title: 'Earn',
Expand Down
101 changes: 3 additions & 98 deletions src/components/AccountDrawer/AuthenticatedHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
import { Trans } from '@lingui/macro'
import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { ButtonEmphasis, ButtonSize, LoadingButtonSpinner, ThemeButton } from 'components/Button'
import { ButtonEmphasis, ButtonSize, ThemeButton } from 'components/Button'
import Column from 'components/Column'
import { Power } from 'components/Icons/Power'
import { Settings } from 'components/Icons/Settings'
import { AutoRow } from 'components/Row'
import { LoadingBubble } from 'components/Tokens/loading'
import { DeltaArrow } from 'components/Tokens/TokenDetails/Delta'
import Tooltip from 'components/Tooltip'
import { getConnection } from 'connection'
import { useDisableNFTRoutes } from 'hooks/useDisableNFTRoutes'
import useENSName from 'hooks/useENSName'
import { useIsNotOriginCountry } from 'hooks/useIsNotOriginCountry'
import { useProfilePageState, useSellAsset, useWalletCollections } from 'nft/hooks'
import { useIsNftClaimAvailable } from 'nft/hooks/useIsNftClaimAvailable'
import { ProfilePageStateType } from 'nft/types'
import { useCallback, useState } from 'react'
import { CreditCard, Info } from 'react-feather'
import { useNavigate } from 'react-router-dom'
import { useAppDispatch } from 'state/hooks'
import { updateSelectedWallet } from 'state/user/reducer'
import styled from 'styled-components'
import { CopyHelper, ExternalLink, ThemedText } from 'theme/components'
import { CopyHelper, ThemedText } from 'theme/components'
import { shortenAddress } from 'utils'
import { NumberType, useFormatter } from 'utils/formatNumbers'

import { useCloseModal, useFiatOnrampAvailability, useOpenModal, useToggleModal } from '../../state/application/hooks'
import { useCloseModal, useToggleModal } from '../../state/application/hooks'
import { ApplicationModal } from '../../state/application/reducer'
import { useUserHasAvailableClaim, useUserUnclaimedAmount } from '../../state/claim/hooks'
import StatusIcon from '../Identicon/StatusIcon'
Expand Down Expand Up @@ -86,20 +83,6 @@ const IconContainer = styled.div`
}
}
`
const FiatOnrampNotAvailableText = styled(ThemedText.BodySmall)`
align-items: center;
color: ${({ theme }) => theme.neutral2};
display: flex;
justify-content: center;
`
const FiatOnrampAvailabilityExternalLink = styled(ExternalLink)`
align-items: center;
display: flex;
height: 14px;
justify-content: center;
margin-left: 6px;
width: 14px;
`

const StatusWrapper = styled.div`
display: inline-block;
Expand All @@ -119,15 +102,6 @@ const AccountNamesWrapper = styled.div`
margin-left: 8px;
`

const StyledInfoIcon = styled(Info)`
height: 12px;
width: 12px;
flex: 1 1 auto;
`
const StyledLoadingButtonSpinner = styled(LoadingButtonSpinner)`
fill: ${({ theme }) => theme.accent1};
`

const HeaderWrapper = styled.div`
margin-bottom: 20px;
display: flex;
Expand Down Expand Up @@ -158,7 +132,6 @@ export default function AuthenticatedHeader({ account, openSettings }: { account
const resetSellAssets = useSellAsset((state) => state.reset)
const clearCollectionFilters = useWalletCollections((state) => state.clearCollectionFilters)
const isClaimAvailable = useIsNftClaimAvailable((state) => state.isClaimAvailable)
const shouldShowBuyFiatButton = useIsNotOriginCountry('GB')
const { formatNumber, formatPercent } = useFormatter()

const shouldDisableNFTRoutes = useDisableNFTRoutes()
Expand Down Expand Up @@ -187,34 +160,6 @@ export default function AuthenticatedHeader({ account, openSettings }: { account
closeModal()
}, [clearCollectionFilters, closeModal, navigate, resetSellAssets, setSellPageState, toggleWalletDrawer])

const openFiatOnrampModal = useOpenModal(ApplicationModal.FIAT_ONRAMP)
const openFoRModalWithAnalytics = useCallback(() => {
toggleWalletDrawer()
openFiatOnrampModal()
}, [openFiatOnrampModal, toggleWalletDrawer])

const [shouldCheck, setShouldCheck] = useState(false)
const {
available: fiatOnrampAvailable,
availabilityChecked: fiatOnrampAvailabilityChecked,
error,
loading: fiatOnrampAvailabilityLoading,
} = useFiatOnrampAvailability(shouldCheck, openFoRModalWithAnalytics)

const handleBuyCryptoClick = useCallback(() => {
if (!fiatOnrampAvailabilityChecked) {
setShouldCheck(true)
} else if (fiatOnrampAvailable) {
openFoRModalWithAnalytics()
}
}, [fiatOnrampAvailabilityChecked, fiatOnrampAvailable, openFoRModalWithAnalytics])
const disableBuyCryptoButton = Boolean(
error || (!fiatOnrampAvailable && fiatOnrampAvailabilityChecked) || fiatOnrampAvailabilityLoading
)
const [showFiatOnrampUnavailableTooltip, setShow] = useState<boolean>(false)
const openFiatOnrampUnavailableTooltip = useCallback(() => setShow(true), [setShow])
const closeFiatOnrampUnavailableTooltip = useCallback(() => setShow(false), [setShow])

const { data: portfolioBalances } = useCachedPortfolioBalancesQuery({ account })
const portfolio = portfolioBalances?.portfolios?.[0]
const totalBalance = portfolio?.tokensTotalDenominatedValue?.value
Expand Down Expand Up @@ -297,46 +242,6 @@ export default function AuthenticatedHeader({ account, openSettings }: { account
<Trans>View and sell NFTs</Trans>
</HeaderButton>
)}
{shouldShowBuyFiatButton && (
<HeaderButton
size={ButtonSize.medium}
emphasis={ButtonEmphasis.highSoft}
onClick={handleBuyCryptoClick}
disabled={disableBuyCryptoButton}
data-testid="wallet-buy-crypto"
>
{error ? (
<ThemedText.BodyPrimary>{error}</ThemedText.BodyPrimary>
) : (
<>
{fiatOnrampAvailabilityLoading ? (
<StyledLoadingButtonSpinner />
) : (
<CreditCard height="20px" width="20px" />
)}{' '}
<Trans>Buy crypto</Trans>
</>
)}
</HeaderButton>
)}
{Boolean(!fiatOnrampAvailable && fiatOnrampAvailabilityChecked) && (
<FiatOnrampNotAvailableText marginTop="8px">
<Trans>Not available in your region</Trans>
<Tooltip
show={showFiatOnrampUnavailableTooltip}
text={<Trans>Moonpay is not available in some regions. Click to learn more.</Trans>}
>
<FiatOnrampAvailabilityExternalLink
onMouseEnter={openFiatOnrampUnavailableTooltip}
onMouseLeave={closeFiatOnrampUnavailableTooltip}
style={{ color: 'inherit' }}
href="https://support.uniswap.org/hc/en-us/articles/11306664890381-Why-isn-t-MoonPay-available-in-my-region-"
>
<StyledInfoIcon />
</FiatOnrampAvailabilityExternalLink>
</Tooltip>
</FiatOnrampNotAvailableText>
)}
<MiniPortfolio account={account} />
{isUnclaimed && (
<UNIButton onClick={openClaimModal} size={ButtonSize.medium} emphasis={ButtonEmphasis.medium}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,6 @@ Object {
}
`;

exports[`parseRemote parseRemoteActivities should parse moonpay purchase 1`] = `
Object {
"chainId": 1,
"currencies": Array [
Token {
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"chainId": 1,
"decimals": 18,
"isNative": false,
"isToken": true,
"name": "Wrapped Ether",
"symbol": "WETH",
},
],
"descriptor": "100 WETH for 100",
"from": "0x50EC05ADe8280758E2077fcBC08D878D4aef79C3",
"hash": "someHash",
"logos": Array [
"moonpay.svg",
],
"nonce": 12345,
"status": "CONFIRMED",
"timestamp": 10000,
"title": "Purchased",
}
`;

exports[`parseRemote parseRemoteActivities should parse nft purchase 1`] = `
Object {
"chainId": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import {
TransactionType,
} from 'graphql/data/__generated__/types-and-hooks'

import { MOONPAY_SENDER_ADDRESSES } from '../../constants'

const MockOrderTimestamp = 10000
const MockRecipientAddress = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
const MockSenderAddress = '0x50EC05ADe8280758E2077fcBC08D878D4aef79C3'
Expand Down Expand Up @@ -469,20 +467,6 @@ export const MockRemoveLiquidity = {
},
} as AssetActivityPartsFragment

export const MockMoonpayPurchase = {
...mockAssetActivityPartsFragment,
details: {
...commonTransactionDetailsFields,
type: TransactionType.Receive,
assetChanges: [
{
...mockTokenTransferInPartsFragment,
sender: MOONPAY_SENDER_ADDRESSES[0],
},
],
},
} as AssetActivityPartsFragment

export const MockNFTReceive = {
...mockAssetActivityPartsFragment,
details: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ms from 'ms'

import {
MockClosedUniswapXOrder,
MockMoonpayPurchase,
MockNFTApproval,
MockNFTApprovalForAll,
MockNFTPurchase,
Expand Down Expand Up @@ -73,10 +72,6 @@ describe('parseRemote', () => {
const result = parseRemoteActivities(jest.fn().mockReturnValue(100), [MockRemoveLiquidity])
expect(result?.['someHash']).toMatchSnapshot()
})
it('should parse moonpay purchase', () => {
const result = parseRemoteActivities(jest.fn().mockReturnValue('100'), [MockMoonpayPurchase])
expect(result?.['someHash']).toMatchSnapshot()
})
it('should parse swap order', () => {
const result = parseRemoteActivities(jest.fn().mockReturnValue('100'), [MockSwapOrder])
expect(result?.['someHash']).toMatchSnapshot()
Expand Down
Loading

0 comments on commit 634753c

Please sign in to comment.