speed up swap page
This commit is contained in:
parent
9a920e7120
commit
57b3e1bf4d
|
@ -191,24 +191,19 @@ const JupiterForm: FunctionComponent = () => {
|
||||||
}
|
}
|
||||||
}, [inputTokenInfo, formValue.amount])
|
}, [inputTokenInfo, formValue.amount])
|
||||||
|
|
||||||
const { routeMap, allTokenMints, routes, loading, exchange, error, refresh } =
|
const { routeMap, routes, loading, exchange, error, refresh } = useJupiter({
|
||||||
useJupiter({
|
...formValue,
|
||||||
...formValue,
|
amount: amountInDecimal ? amountInDecimal : 0,
|
||||||
amount: amountInDecimal ? amountInDecimal : 0,
|
slippage,
|
||||||
slippage,
|
})
|
||||||
})
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Fetch token list from Jupiter API
|
// Fetch token list from Jupiter API
|
||||||
|
|
||||||
fetch(TOKEN_LIST_URL['mainnet-beta'])
|
fetch(TOKEN_LIST_URL['mainnet-beta'])
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((result) => {
|
.then((result) => setTokens(result))
|
||||||
const tokens = allTokenMints.map((mint) =>
|
}, [])
|
||||||
result.find((item) => item?.address === mint)
|
|
||||||
)
|
|
||||||
setTokens(tokens)
|
|
||||||
})
|
|
||||||
}, [allTokenMints])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (routes) {
|
if (routes) {
|
||||||
|
|
Loading…
Reference in New Issue