-
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.
Fetch Mezo points and BTC/USD price from Acre API (#782)
In thesis/acre-bots#49 we exposed the Mezo mats data and BTC/USD price from the Acre API. The data are cached on the Acre API side, so we don't need to worry about hitting the external endpoints rate limits from the dApp. We don't need to worry about maintaining the Mezo API URL and API_KEY in the dApp.
- Loading branch information
Showing
11 changed files
with
22 additions
and
72 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
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,13 +1,13 @@ | ||
import { useQuery } from "@tanstack/react-query" | ||
import { REFETCH_INTERVAL_IN_MILLISECONDS, queryKeysFactory } from "#/constants" | ||
import { mezoPortalAPI } from "#/utils" | ||
import { acreApi } from "#/utils" | ||
|
||
const { acreKeys } = queryKeysFactory | ||
|
||
export default function useMats() { | ||
return useQuery({ | ||
queryKey: [...acreKeys.mats()], | ||
queryFn: async () => mezoPortalAPI.getMats(), | ||
queryFn: async () => acreApi.getMats(), | ||
refetchInterval: REFETCH_INTERVAL_IN_MILLISECONDS, | ||
}) | ||
} |
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,17 +1,7 @@ | ||
import { createAsyncThunk } from "@reduxjs/toolkit" | ||
import { fetchCryptoCurrencyPriceUSD } from "#/utils/exchangeApi" | ||
import sentry from "#/sentry" | ||
import { acreApi } from "#/utils" | ||
|
||
export const fetchBTCPriceUSD = createAsyncThunk( | ||
"btc/fetchBTCPriceUSD", | ||
async () => { | ||
try { | ||
const priceUSD = await fetchCryptoCurrencyPriceUSD("bitcoin") | ||
return priceUSD | ||
} catch (error) { | ||
sentry.captureException(error) | ||
console.error(error) | ||
return 0 | ||
} | ||
}, | ||
async () => acreApi.getBtcUsdPrice(), | ||
) |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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