-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from DyadStablecoin/bug/earn-keroseene
earn kerosene
- Loading branch information
Showing
2 changed files
with
46 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import useSWR from "swr"; | ||
|
||
export default function useKerosenePrice() { | ||
|
||
const { data } = useSWR("https://api.coingecko.com/api/v3/coins/kerosene/tickers", async (url) => { | ||
const res = await fetch(url); | ||
const result = await res.json(); | ||
return result.tickers[0]?.converted_last?.usd || 0; | ||
}); | ||
const { data, error } = useSWR( | ||
"https://api.coingecko.com/api/v3/coins/kerosene/tickers", | ||
async (url) => { | ||
const res = await fetch(url); | ||
const result = await res.json(); | ||
return result.tickers[0]?.converted_last?.usd || 0; | ||
} | ||
); | ||
|
||
return { | ||
kerosenePrice: data || 0 | ||
kerosenePrice: data || 0, | ||
error: error, | ||
}; | ||
} | ||
|