Skip to content

Commit

Permalink
consolidate NUMIA_BASE_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
jonator committed Dec 6, 2024
1 parent bac2426 commit f39024a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
3 changes: 0 additions & 3 deletions packages/server/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export const ASSET_LIST_COMMIT_HASH = process.env.ASSET_LIST_COMMIT_HASH;
export const HISTORICAL_DATA_URL =
process.env.NEXT_PUBLIC_HISTORICAL_DATA_URL ??
"https://data.stage.osmosis.zone";
export const NUMIA_BASE_URL =
process.env.NEXT_PUBLIC_NUMIA_BASE_URL ??
"https://public-osmosis-api.numia.xyz";
export const NUMIA_API_KEY = process.env.NUMIA_API_KEY;

// sqs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apiClient } from "@osmosis-labs/utils";

import { NUMIA_BASE_URL } from "../../env";
import { HISTORICAL_DATA_URL } from "../../env";

export interface HistoricalLimitOrder {
place_timestamp: string;
Expand All @@ -22,7 +22,7 @@ export function queryHistoricalOrders(
): Promise<HistoricalLimitOrder[]> {
const url = new URL(
`/users/limit_orders/history/closed?address=${userOsmoAddress}`,
NUMIA_BASE_URL
HISTORICAL_DATA_URL
);
return apiClient<HistoricalLimitOrder[]>(url.toString());
}
6 changes: 3 additions & 3 deletions packages/server/src/queries/data-services/pool-aprs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apiClient } from "@osmosis-labs/utils";

import { NUMIA_BASE_URL } from "../../env";
import { HISTORICAL_DATA_URL } from "../../env";

type PoolApr<T = number> = {
pool_id: string;
Expand All @@ -13,7 +13,7 @@ type PoolApr<T = number> = {

/** Queries numia for a breakdown of APRs per pool. */
export function queryPoolAprs(): Promise<PoolApr[]> {
const url = new URL("/pools_apr", NUMIA_BASE_URL);
const url = new URL("/pools_apr", HISTORICAL_DATA_URL);
return apiClient(url.toString());
}

Expand All @@ -24,6 +24,6 @@ export type PoolDataRange<T = number> = {

/** Queries numia for a breakdown of APRs per pool with range. */
export function queryPoolAprsRange(): Promise<PoolApr<PoolDataRange>[]> {
const url = new URL("/pools_apr_range", NUMIA_BASE_URL);
const url = new URL("/pools_apr_range", HISTORICAL_DATA_URL);
return apiClient(url.toString());
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apiClient } from "@osmosis-labs/utils";

import { NUMIA_BASE_URL } from "../../env";
import { HISTORICAL_DATA_URL } from "../../env";

export interface PortfolioOverTimeResponse {
timestamp: string;
Expand All @@ -14,7 +14,7 @@ export async function queryPortfolioOverTime({
address: string;
range: string;
}): Promise<PortfolioOverTimeResponse[]> {
const url = new URL("/users/portfolio/over_time", NUMIA_BASE_URL);
const url = new URL("/users/portfolio/over_time", HISTORICAL_DATA_URL);

url.searchParams.append("address", address);
url.searchParams.append("range", range);
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/queries/data-services/staking-apr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apiClient } from "@osmosis-labs/utils";

Check failure on line 1 in packages/server/src/queries/data-services/staking-apr.ts

View workflow job for this annotation

GitHub Actions / test (20.x, server)

Run autofix to sort these imports!

import { NUMIA_API_KEY, NUMIA_BASE_URL } from "../../env";
import { NUMIA_API_KEY, HISTORICAL_DATA_URL } from "../../env";

interface StakingAprResponse {
labels: string;
Expand All @@ -14,7 +14,7 @@ export async function queryStakingApr({
startDate: string;
endDate: string;
}): Promise<StakingAprResponse[]> {
const url = new URL("/apr", NUMIA_BASE_URL);
const url = new URL("/apr", HISTORICAL_DATA_URL);

url.searchParams.append("start_date", startDate);
url.searchParams.append("end_date", endDate);
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/queries/data-services/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apiClient } from "@osmosis-labs/utils";

import { NUMIA_BASE_URL } from "../../env";
import { HISTORICAL_DATA_URL } from "../../env";

interface Route {
pools: Pool[];
Expand Down Expand Up @@ -88,7 +88,7 @@ export async function queryTransactions({
page: string;
pageSize: string;
}): Promise<Transaction[]> {
const url = new URL(`/v2/txs/${address}`, NUMIA_BASE_URL);
const url = new URL(`/v2/txs/${address}`, HISTORICAL_DATA_URL);

url.searchParams.append("page", page);
url.searchParams.append("pageSize", pageSize);
Expand Down

0 comments on commit f39024a

Please sign in to comment.