Skip to content

Commit

Permalink
chore: revert initial implementation except for csps
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture committed Oct 10, 2023
1 parent 6167806 commit 0ead0fe
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 48 deletions.
2 changes: 0 additions & 2 deletions .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,3 @@ REACT_APP_EXPERIMENTAL_MM_SNAPPY_FINGERS=true

# Experemental features (not production ready)
REACT_APP_EXPERIMENTAL_CUSTOM_SEND_NONCE=false

REACT_APP_TRM_LABS_API_URL=https://api.trmlabs.com/public/v1/sanctions/screening
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ const validators = {
REACT_APP_EXPERIMENTAL_MM_SNAPPY_FINGERS: bool({ default: false }),
REACT_APP_SNAP_ID: str(),
REACT_APP_FEATURE_FOX_DISCOUNTS: bool({ default: false }),
REACT_APP_TRM_LABS_API_URL: url(),
}

function reporter<T>({ errors }: envalid.ReporterOptions<T>) {
Expand Down
19 changes: 0 additions & 19 deletions src/lib/swapper/swapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {
SwapperName,
TradeQuote,
} from './types'
import { isValidSwapAddress } from './utils'

export const getTradeQuotes = async (
getTradeQuoteInput: GetTradeQuoteInput,
Expand All @@ -20,24 +19,6 @@ export const getTradeQuotes = async (
if (bnOrZero(getTradeQuoteInput.affiliateBps).lt(0)) return []
if (getTradeQuoteInput.sellAmountIncludingProtocolFeesCryptoBaseUnit === '0') return []

try {
if (getTradeQuoteInput.sendAddress !== undefined) {
const isSenderValid = await isValidSwapAddress(getTradeQuoteInput.sendAddress)
if (!isSenderValid) {
return [] // no quotes available for this address
}
}

if (getTradeQuoteInput.sendAddress !== getTradeQuoteInput.receiveAddress) {
const isReceiverValid = await isValidSwapAddress(getTradeQuoteInput.receiveAddress)
if (!isReceiverValid) {
return [] // no quotes available for this address
}
}
} catch (e) {
console.error(e) // log error but don't fail
}

const quotes = await Promise.allSettled(
swappers
.filter(({ swapperName }) => enabledSwappers.includes(swapperName))
Expand Down
26 changes: 0 additions & 26 deletions src/lib/swapper/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import type { AssetId } from '@shapeshiftoss/caip'
import type { Result } from '@sniptt/monads'
import { Err, Ok } from '@sniptt/monads'
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
import axios from 'axios'
import type { ISetupCache } from 'axios-cache-adapter'
import { setupCache } from 'axios-cache-adapter'
import { getConfig } from 'config'
import type { FeatureFlags } from 'state/slices/preferencesSlice/preferencesSlice'

import { isCrossAccountTradeSupported } from '../../state/helpers'
Expand Down Expand Up @@ -135,27 +133,3 @@ export const createTradeAmountTooSmallErr = (details?: {
message: 'Sell amount is too small',
details,
})

export const isValidSwapAddress = async (address: string): Promise<boolean> => {
type trmResponse = [
{
address: string
isSanctioned: boolean
},
]

const response = await axios.post<trmResponse>(
getConfig().REACT_APP_TRM_LABS_API_URL,
[
{
address,
},
],
{
headers: {
Accept: 'application/json',
},
},
)
return !response.data[0].isSanctioned
}

0 comments on commit 0ead0fe

Please sign in to comment.