From cdb6f39341c9600b45d44f4deeb3d83f66e192f2 Mon Sep 17 00:00:00 2001 From: Yana Date: Wed, 17 Sep 2025 20:42:08 +0300 Subject: [PATCH] Rename constants --- explorer-v2/src/app/api/index.tsx | 26 +++++++++---------- explorer-v2/src/app/api/urls.ts | 5 ++-- .../nodeTable/NodeTableWithAction.tsx | 5 +--- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/explorer-v2/src/app/api/index.tsx b/explorer-v2/src/app/api/index.tsx index e10b1a8c83..c841b243cb 100644 --- a/explorer-v2/src/app/api/index.tsx +++ b/explorer-v2/src/app/api/index.tsx @@ -16,10 +16,10 @@ import type { import { CURRENT_EPOCH, CURRENT_EPOCH_REWARDS, - DATA_OBSERVATORY_BALANCES_URL, + SPECTREDAO_BALANCES_URL, NS_API_NODES, NYM_ACCOUNT_ADDRESS, - NYM_PRICES_API, + SPECTREDAO_NYM_PRICES_API, OBSERVATORY_GATEWAYS_URL, } from "./urls"; @@ -44,7 +44,7 @@ export const fetchEpochRewards = async (): Promise< // Fetch gateway status based on identity key export const fetchGatewayStatus = async ( - identityKey: string, + identityKey: string ): Promise => { const response = await fetch(`${OBSERVATORY_GATEWAYS_URL}/${identityKey}`); @@ -56,7 +56,7 @@ export const fetchGatewayStatus = async ( }; export const fetchNodeDelegations = async ( - id: number, + id: number ): Promise => { const response = await fetch(`${NS_API_NODES}/${id}/delegations`, { headers: { @@ -88,7 +88,7 @@ export const fetchCurrentEpoch = async () => { const data: CurrentEpochData = await response.json(); const epochEndTime = addSeconds( new Date(data.current_epoch_start), - data.epoch_length.secs, + data.epoch_length.secs ).toISOString(); return { ...data, current_epoch_end: epochEndTime }; @@ -96,7 +96,7 @@ export const fetchCurrentEpoch = async () => { // Fetch balances based on the address export const fetchBalances = async (address: string): Promise => { - const response = await fetch(`${DATA_OBSERVATORY_BALANCES_URL}/${address}`, { + const response = await fetch(`${SPECTREDAO_BALANCES_URL}/${address}`, { headers: { Accept: "application/json", "Content-Type": "application/json; charset=utf-8", @@ -117,10 +117,8 @@ export const fetchBalances = async (address: string): Promise => { }; // Fetch function to get total staker rewards -export const fetchTotalStakerRewards = async ( - address: string, -): Promise => { - const response = await fetch(`${DATA_OBSERVATORY_BALANCES_URL}/${address}`, { +export const fetchTotalStakerRewards = async (address: string): Promise => { + const response = await fetch(`${SPECTREDAO_BALANCES_URL}/${address}`, { headers: { Accept: "application/json", "Content-Type": "application/json; charset=utf-8", @@ -139,7 +137,7 @@ export const fetchTotalStakerRewards = async ( // Fetch function to get the original stake export const fetchOriginalStake = async (address: string): Promise => { - const response = await fetch(`${DATA_OBSERVATORY_BALANCES_URL}/${address}`, { + const response = await fetch(`${SPECTREDAO_BALANCES_URL}/${address}`, { headers: { Accept: "application/json", "Content-Type": "application/json; charset=utf-8", @@ -159,7 +157,7 @@ export const fetchOriginalStake = async (address: string): Promise => { export const fetchNoise = async (): Promise => { if (!process.env.NEXT_PUBLIC_NS_API_MIXNODES_STATS) { throw new Error( - "NEXT_PUBLIC_NS_API_MIXNODES_STATS environment variable is not defined", + "NEXT_PUBLIC_NS_API_MIXNODES_STATS environment variable is not defined" ); } const response = await fetch(process.env.NEXT_PUBLIC_NS_API_MIXNODES_STATS, { @@ -175,7 +173,7 @@ export const fetchNoise = async (): Promise => { // Fetch Account Balance export const fetchAccountBalance = async ( - address: string, + address: string ): Promise => { const res = await fetch(`${NYM_ACCOUNT_ADDRESS}/${address}`, { headers: { @@ -193,7 +191,7 @@ export const fetchAccountBalance = async ( // 🔹 Fetch NYM Price export const fetchNymPrice = async (): Promise => { - const res = await fetch(NYM_PRICES_API, { + const res = await fetch(SPECTREDAO_NYM_PRICES_API, { headers: { Accept: "application/json", "Content-Type": "application/json; charset=utf-8", diff --git a/explorer-v2/src/app/api/urls.ts b/explorer-v2/src/app/api/urls.ts index b0631e617f..3653bb96bd 100644 --- a/explorer-v2/src/app/api/urls.ts +++ b/explorer-v2/src/app/api/urls.ts @@ -5,10 +5,11 @@ export const CURRENT_EPOCH_REWARDS = export const NYM_ACCOUNT_ADDRESS = "https://explorer.nymtech.net/api/v1/tmp/unstable/account"; -export const NYM_PRICES_API = "https://api.nym.spectredao.net/api/v1/nym-price"; +export const SPECTREDAO_NYM_PRICES_API = + "https://api.nym.spectredao.net/api/v1/nym-price"; export const VALIDATOR_BASE_URL = process.env.NEXT_PUBLIC_VALIDATOR_URL || "https://rpc.nymtech.net"; -export const DATA_OBSERVATORY_BALANCES_URL = +export const SPECTREDAO_BALANCES_URL = "https://api.nym.spectredao.net/api/v1/balances"; export const OBSERVATORY_GATEWAYS_URL = "https://mainnet-node-status-api.nymtech.cc/v2/gateways"; diff --git a/explorer-v2/src/components/nodeTable/NodeTableWithAction.tsx b/explorer-v2/src/components/nodeTable/NodeTableWithAction.tsx index bec7c0a131..835863ced8 100644 --- a/explorer-v2/src/components/nodeTable/NodeTableWithAction.tsx +++ b/explorer-v2/src/components/nodeTable/NodeTableWithAction.tsx @@ -14,10 +14,7 @@ import { countryName } from "../../utils/countryName"; import AdvancedFilters from "./AdvancedFilters"; import NodeTable from "./NodeTable"; -type Props = { - /** Recommended node IDs provided by the server page */ - recommendedIds: number[]; -}; + function getNodeSaturationPoint( totalStake: number,