export const fetchTokens = async (get: Getter) => {
const customTokens = get(customTokensAtom)
const { data } = await axios.post<Token[]>('/api/tokens', {
customTokens
})
console.log(data.find((v) => v.symbol.toLowerCase() === 'bnb'.toLowerCase()))
return data
}
export const [tokenListAtom] = atomsWithQuery((get) => {
return {
queryKey: ['tokenList_atom'],
queryFn: () => fetchTokens(get),
initialData: []
}
})
export const allTokenListAtom = atom((get) => {
console.log(get(tokenListAtom).find((v) => v.symbol.toLowerCase() === 'bnb'.toLowerCase()))
return [...get(tokenListAtom)]
})
export const fetchTokens = async (get: Getter) => {
const customTokens = get(customTokensAtom)
const { data } = await axios.post<Token[]>('/api/tokens', {
customTokens
})
console.log(data.find((v) => v.symbol.toLowerCase() === 'bnb'.toLowerCase()))
return data
}
export const [tokenListAtom] = atomsWithQuery((get) => {
return {
queryKey: ['tokenList_atom'],
queryFn: () => fetchTokens(get),
initialData: []
}
})
export const allTokenListAtom = atom((get) => {
console.log(get(tokenListAtom).find((v) => v.symbol.toLowerCase() === 'bnb'.toLowerCase()))
return [...get(tokenListAtom)]
})