Skip to content

Commit

Permalink
Merge branch 'main' into points-estimation-update
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska authored Oct 24, 2024
2 parents b99ba72 + a8ec584 commit 7c97f01
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 72 deletions.
2 changes: 0 additions & 2 deletions dapp/.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ VITE_ACRE_API_ENDPOINT="http://localhost:8788/api/v1/"
VITE_GELATO_RELAY_API_KEY="htaJCy_XHj8WsE3w53WBMurfySDtjLP_TrNPPa6IPIc_" # this key should not be used on production
# Get the API key from: https://thegraph.com/studio/apikeys/.
VITE_SUBGRAPH_API_KEY=""
# Get the API key from: 1Password.
VITE_MEZO_PORTAL_API_KEY=""

# Feature flags
VITE_FEATURE_FLAG_GAMIFICATION_ENABLED="false"
Expand Down
3 changes: 0 additions & 3 deletions dapp/src/constants/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const GELATO_RELAY_API_KEY = import.meta.env.VITE_GELATO_RELAY_API_KEY

const SUBGRAPH_API_KEY = import.meta.env.VITE_SUBGRAPH_API_KEY

const MEZO_PORTAL_API_KEY = import.meta.env.VITE_MEZO_PORTAL_API_KEY

const NETWORK_TYPE = USE_TESTNET ? "testnet" : "mainnet"

const LATEST_COMMIT_HASH = import.meta.env.VITE_LATEST_COMMIT_HASH
Expand All @@ -34,7 +32,6 @@ export default {
TBTC_API_ENDPOINT,
GELATO_RELAY_API_KEY,
SUBGRAPH_API_KEY,
MEZO_PORTAL_API_KEY,
NETWORK_TYPE,
LATEST_COMMIT_HASH,
ACRE_API_ENDPOINT,
Expand Down
4 changes: 2 additions & 2 deletions dapp/src/hooks/useMats.ts
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,
})
}
14 changes: 2 additions & 12 deletions dapp/src/store/btc/btcThunk.ts
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(),
)
2 changes: 0 additions & 2 deletions dapp/src/types/coingecko.ts

This file was deleted.

1 change: 0 additions & 1 deletion dapp/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from "./callback"
export * from "./chain"
export * from "./action-flow"
export * from "./activity"
export * from "./coingecko"
export * from "./time"
export * from "./core"
export * from "./fee"
Expand Down
18 changes: 18 additions & 0 deletions dapp/src/utils/acreApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,29 @@ const claimPoints = async (address: string) => {
}
}

async function getMats() {
const response = await axios.get<{ totalMats: number; dailyMats: number }>(
"mezo/points",
)

return {
totalMats: response.data.totalMats,
dailyMats: response.data.dailyMats,
}
}

async function getBtcUsdPrice(): Promise<number> {
const response = await axios.get<{ btcUsdPrice: number }>("currency/btc")
return response.data.btcUsdPrice
}

export default {
createSession,
getSession,
deleteSession,
getPointsData,
getPointsDataByUser,
claimPoints,
getMats,
getBtcUsdPrice,
}
20 changes: 0 additions & 20 deletions dapp/src/utils/exchangeApi.ts

This file was deleted.

2 changes: 0 additions & 2 deletions dapp/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * from "./chain"
export * from "./text"
export * from "./time"
export * from "./promise"
export * from "./exchangeApi"
export * from "./verifyDepositAddress"
export * from "./json"
export * from "./activities"
Expand All @@ -15,6 +14,5 @@ export { default as eip1193 } from "./eip1193"
export { default as orangeKit } from "./orangeKit"
export { default as userAgent } from "./userAgent"
export { default as referralProgram } from "./referralProgram"
export { default as mezoPortalAPI } from "./mezoPortalApi"
export { default as acreApi } from "./acreApi"
export { default as router } from "./router"
27 changes: 0 additions & 27 deletions dapp/src/utils/mezoPortalApi.ts

This file was deleted.

1 change: 0 additions & 1 deletion dapp/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ interface ImportMetaEnv {
readonly VITE_FEATURE_FLAG_ACRE_POINTS_ENABLED: string
readonly VITE_FEATURE_FLAG_TVL_ENABLED: string
readonly VITE_SUBGRAPH_API_KEY: string
readonly VITE_MEZO_PORTAL_API_KEY: string
readonly VITE_LATEST_COMMIT_HASH: string
readonly VITE_ACRE_API_ENDPOINT: string
}
Expand Down

0 comments on commit 7c97f01

Please sign in to comment.