add simpleMemoize

This commit is contained in:
Mikhail Mikheev 2019-04-25 18:48:37 +04:00
parent fb881df323
commit d89564dcfb
1 changed files with 3 additions and 2 deletions

View File

@ -18,7 +18,7 @@ export const simpleMemoize = (fn: Function) => {
}
// eslint-disable-next-line
export const addressIsTokenContract = async (tokenAddress: string) => {
export const addressIsTokenContract = simpleMemoize(async (tokenAddress: string) => {
// SECOND APPROACH:
// They both seem to work the same
// const tokenContract = await getStandardTokenContract()
@ -34,8 +34,9 @@ export const addressIsTokenContract = async (tokenAddress: string) => {
if (call === '0x') {
return 'Not a token address'
}
}
})
// eslint-disable-next-line
export const doesntExistInTokenList = (tokenList: List<Token>) => simpleMemoize((tokenAddress: string) => {
const tokenIndex = tokenList.findIndex(({ address }) => sameAddress(address, tokenAddress))