speed up swap page

This commit is contained in:
tjs 2022-06-28 13:38:21 -04:00
parent 9a920e7120
commit 57b3e1bf4d
1 changed files with 8 additions and 13 deletions

View File

@ -191,24 +191,19 @@ const JupiterForm: FunctionComponent = () => {
}
}, [inputTokenInfo, formValue.amount])
const { routeMap, allTokenMints, routes, loading, exchange, error, refresh } =
useJupiter({
...formValue,
amount: amountInDecimal ? amountInDecimal : 0,
slippage,
})
const { routeMap, routes, loading, exchange, error, refresh } = useJupiter({
...formValue,
amount: amountInDecimal ? amountInDecimal : 0,
slippage,
})
useEffect(() => {
// Fetch token list from Jupiter API
fetch(TOKEN_LIST_URL['mainnet-beta'])
.then((response) => response.json())
.then((result) => {
const tokens = allTokenMints.map((mint) =>
result.find((item) => item?.address === mint)
)
setTokens(tokens)
})
}, [allTokenMints])
.then((result) => setTokens(result))
}, [])
useEffect(() => {
if (routes) {