Fix NS api endpoint for dev and prod, add env variables

This commit is contained in:
Yana
2025-03-20 11:57:50 +02:00
parent 52ffd2e798
commit f982cb49c2
3 changed files with 7 additions and 5 deletions
+6 -2
View File
@@ -16,7 +16,6 @@ import {
CURRENT_EPOCH_REWARDS,
DATA_OBSERVATORY_BALANCES_URL,
DATA_OBSERVATORY_NODES_URL,
NS_API_MIXNODES_STATS,
NYM_ACCOUNT_ADDRESS,
NYM_PRICES_API,
OBSERVATORY_GATEWAYS_URL,
@@ -174,7 +173,12 @@ export const fetchOriginalStake = async (address: string): Promise<number> => {
};
export const fetchNoise = async (): Promise<IPacketsAndStakingData[]> => {
const response = await fetch(NS_API_MIXNODES_STATS, {
if (!process.env.NEXT_PUBLIC_NS_API_MIXNODES_STATS) {
throw new Error(
"NEXT_PUBLIC_NS_API_MIXNODES_STATS environment variable is not defined",
);
}
const response = await fetch(process.env.NEXT_PUBLIC_NS_API_MIXNODES_STATS, {
headers: {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
-2
View File
@@ -1,6 +1,4 @@
export const NS_API_MIXNODES_STATS =
"https://staging-node-status-api.nymte.ch/v2/mixnodes/stats";
export const CURRENT_EPOCH =
"https://validator.nymtech.net/api/v1/epoch/current";
export const CURRENT_EPOCH_REWARDS =
@@ -98,7 +98,7 @@ export const LineChart = ({
format: "%Y-%m-%d",
}}
yScale={{
min: 120000000, // Keeping the minimum static
min: 0, // Keeping the minimum static
max: maxYValue, // **Dynamically set max value**
type: "linear",
}}