Skip to content

Commit

Permalink
chore(api): remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
schnogz committed Apr 16, 2021
1 parent 2e9d293 commit ffd7af4
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ export default ({
yield put(A.fetchCustodialEligibilityLoading())
const {
eligible
}: ReturnType<typeof api.checkCustodialEligiblity> = yield call(
api.checkCustodialEligiblity
}: ReturnType<typeof api.checkCustodialSwapEligibility> = yield call(
api.checkCustodialSwapEligibility
)
yield put(A.fetchCustodialEligibilitySuccess(eligible))
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { model } from 'data'
import { CountryType } from 'data/components/identityVerification/types'
import {
ageOverEighteen,
countryUsesPostalcode,
countryUsesPostalCode,
countryUsesZipcode,
required,
requiredDOB,
Expand Down Expand Up @@ -145,7 +145,7 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
props.countryCode
const countryIsUS = countryCode === 'US'
const countryUsesZipOrPostcode =
countryUsesZipcode(countryCode) || countryUsesPostalcode(countryCode)
countryUsesZipcode(countryCode) || countryUsesPostalCode(countryCode)

const defaultCountry = props.supportedCountries.find(
country => country.code === countryCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
import { CountryType } from 'data/components/identityVerification/types'
import { SBAddCardErrorType } from 'data/types'
import {
countryUsesPostalcode,
countryUsesPostalCode,
countryUsesZipcode,
required,
requiredZipCode
Expand Down Expand Up @@ -121,7 +121,7 @@ const Success: React.FC<InjectedFormProps<{}, Props, ErrorType> &

const countryIsUS = countryCode === 'US'
const countryUsesZipOrPostcode =
countryUsesZipcode(countryCode) || countryUsesPostalcode(countryCode)
countryUsesZipcode(countryCode) || countryUsesPostalCode(countryCode)

const defaultCountry = props.supportedCountries.find(
country => country.code === countryCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TextBox
} from 'components/Form'
import {
countryUsesPostalcode,
countryUsesPostalCode,
countryUsesZipcode,
required,
requiredZipCode
Expand All @@ -40,7 +40,7 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
const countryCode = props.formValues.country
const countryIsUS = countryCode === 'US'
const countryUsesZipOrPostcode =
countryUsesZipcode(countryCode) || countryUsesPostalcode(countryCode)
countryUsesZipcode(countryCode) || countryUsesPostalCode(countryCode)

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ class CoinSelection extends PureComponent<Props> {
custodialEligibility: boolean,
account: SwapAccountType
) => {
if (account.type === 'CUSTODIAL' && !custodialEligibility) {
return false
} else {
return true
}
return !(account.type === 'CUSTODIAL' && !custodialEligibility)
}

render() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import bip39 from 'bip39'
import { isValidBIC, isValidIBAN } from 'ibantools'
import isObject from 'isobject'
import { isValidNumber } from 'libphonenumber-js'
import { validate } from 'postal-codes-js'
import postalCodes from 'postal-codes-js/generated/postal-codes-alpha2'
Expand All @@ -25,6 +24,10 @@ import * as M from './validationMessages'

const { BAD_2FA } = model.profile.ERROR_TYPES

const isObject = val => {
return val != null && typeof val === 'object' && Array.isArray(val) === false
}

export const required = value => (value ? undefined : <M.RequiredMessage />)

export const maxValue = (max, canEqual = false) => value =>
Expand Down Expand Up @@ -214,7 +217,7 @@ export const requiredDOB = value =>
export const requiredUsZipcode = value =>
isUsZipcode(value) ? undefined : <M.RequiredUSZipCodeMessage />

export const countryUsesPostalcode = countryCode => {
export const countryUsesPostalCode = countryCode => {
return path([countryCode, 'postalCodeFormat'], postalCodes)
}

Expand Down
2 changes: 0 additions & 2 deletions packages/blockchain-wallet-v4/src/network/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import settings from './settings'
import settingsComponent from './settingsComponent'
import simpleBuy from './simpleBuy'
import swap from './swap'
import trades from './trades'
import wallet from './wallet'
import xlm from './xlm'

Expand Down Expand Up @@ -103,7 +102,6 @@ const api = ({
...http
}),
...rates({ nabuUrl, ...authorizedHttp }),
...trades({ nabuUrl, ...authorizedHttp }),
...wallet({ rootUrl, ...http }),
...xlm({ apiUrl, horizonUrl, ...http })
}
Expand Down
6 changes: 3 additions & 3 deletions packages/blockchain-wallet-v4/src/network/api/swap/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CoinType, FiatType } from 'core/types'

import {
EligibilityResponseType,
SwapEligibilityResponseType,
SwapOrderDirectionType,
SwapOrderStateType,
SwapOrderType,
Expand All @@ -21,7 +21,7 @@ export default ({ authorizedGet, authorizedPost, nabuUrl }) => {
}
})

const checkCustodialEligiblity = (): EligibilityResponseType =>
const checkCustodialSwapEligibility = (): SwapEligibilityResponseType =>
authorizedGet({
url: nabuUrl,
endPoint: '/eligible/product/swap'
Expand Down Expand Up @@ -136,7 +136,7 @@ export default ({ authorizedGet, authorizedPost, nabuUrl }) => {

return {
cancelSwapOrder,
checkCustodialEligiblity,
checkCustodialSwapEligibility,
createSwapOrder,
getSwapLimits,
getSwapPairs,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FiatType } from 'core/types'

export type EligibilityResponseType = {
export type SwapEligibilityResponseType = {
eligible: boolean
}

Expand Down
84 changes: 0 additions & 84 deletions packages/blockchain-wallet-v4/src/network/api/trades/index.js

This file was deleted.

1 comment on commit ffd7af4

@kosp4n
Copy link

@kosp4n kosp4n commented on ffd7af4 Apr 29, 2021

Choose a reason for hiding this comment

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

@

Please sign in to comment.