Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix/deploy-api-urls #100

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deploy-web/src/pages/providers/[owner]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export default ProviderDetailPage;

export async function getServerSideProps({ params, query }) {
const apiUrl = getNetworkBaseApiUrl(query.network as string);
const response = await axios.get(`${apiUrl}/providers/${params?.owner}`);
const response = await axios.get(`${apiUrl}/v1/providers/${params?.owner}`);

return {
props: {
Expand Down
51 changes: 26 additions & 25 deletions deploy-web/src/utils/apiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import axios from "axios";
import { appendSearchParams } from "./urlUtils";

export class ApiUrlService {
static BASE_API_URL = `${BASE_API_URL}/v1`;
static deploymentList(apiEndpoint: string, address: string) {
return `${apiEndpoint}/akash/deployment/${networkVersion}/deployments/list?filters.owner=${address}`;
}
Expand All @@ -19,13 +20,13 @@ export class ApiUrlService {
return `${apiEndpoint}/akash/provider/${networkVersion}/providers`;
}
static providerList() {
return `${BASE_API_URL}/providers`;
return `${this.BASE_API_URL}/providers`;
}
static providerDetail(owner: string) {
return `${BASE_API_URL}/providers/${owner}`;
return `${this.BASE_API_URL}/providers/${owner}`;
}
static providerRegions() {
return `${BASE_API_URL}/provider-regions`;
return `${this.BASE_API_URL}/provider-regions`;
}
static block(apiEndpoint: string, id: string) {
return `${apiEndpoint}/blocks/${id}`;
Expand Down Expand Up @@ -58,71 +59,71 @@ export class ApiUrlService {
return `${apiEndpoint}/cosmos/feegrant/v1beta1/allowances/${address}`;
}
static dashboardData() {
return `${BASE_API_URL}/dashboard-data`;
return `${this.BASE_API_URL}/dashboard-data`;
}
static marketData() {
return `${BASE_API_URL}/market-data`;
return `${this.BASE_API_URL}/market-data`;
}
static proposals() {
return `${BASE_API_URL}/proposals`;
return `${this.BASE_API_URL}/proposals`;
}
static apiProviders() {
return `${BASE_API_URL}/providers`;
return `${this.BASE_API_URL}/providers`;
}
static templates() {
return `${BASE_API_URL}/templates`;
return `${this.BASE_API_URL}/templates`;
}
static validators() {
return `${BASE_API_URL}/validators`;
return `${this.BASE_API_URL}/validators`;
}
static transactions(limit: number) {
return `${BASE_API_URL}/transactions${appendSearchParams({ limit })}`;
return `${this.BASE_API_URL}/transactions${appendSearchParams({ limit })}`;
}
static addressTransactions(address: string, skip: number, limit: number) {
return `${BASE_API_URL}/addresses/${address}/transactions/${skip}/${limit}`;
return `${this.BASE_API_URL}/addresses/${address}/transactions/${skip}/${limit}`;
}
static addressDeployments(address: string, skip: number, limit: number, reverseSorting: boolean, filters: { [key: string]: string }) {
return `${BASE_API_URL}/addresses/${address}/deployments/${skip}/${limit}${appendSearchParams({ reverseSorting, ...filters })}`;
return `${this.BASE_API_URL}/addresses/${address}/deployments/${skip}/${limit}${appendSearchParams({ reverseSorting, ...filters })}`;
}
static graphData(snapshot: string) {
return `${BASE_API_URL}/graph-data/${snapshot}`;
return `${this.BASE_API_URL}/graph-data/${snapshot}`;
}
static providerGraphData(snapshot: string) {
return `${BASE_API_URL}/provider-graph-data/${snapshot}`;
return `${this.BASE_API_URL}/provider-graph-data/${snapshot}`;
}
static blocks(limit: number) {
return `${BASE_API_URL}/blocks${appendSearchParams({ limit })}`;
return `${this.BASE_API_URL}/blocks${appendSearchParams({ limit })}`;
}
static providerActiveLeasesGraph(providerAddress: string) {
return `${BASE_API_URL}/provider-active-leases-graph-data/${providerAddress}`;
return `${this.BASE_API_URL}/provider-active-leases-graph-data/${providerAddress}`;
}
static providerAttributesSchema() {
return `${BASE_API_URL}/provider-attributes-schema`;
return `${this.BASE_API_URL}/provider-attributes-schema`;
}
static networkCapacity() {
return `${BASE_API_URL}/network-capacity`;
return `${this.BASE_API_URL}/network-capacity`;
}
// Github
static auditors() {
return `${BASE_API_URL}/auditors`;
return `${this.BASE_API_URL}/auditors`;
}
static mainnetNodes() {
return `${BASE_API_URL}/nodes/mainnet`;
return `${this.BASE_API_URL}/nodes/mainnet`;
}
static testnetNodes() {
return `${BASE_API_URL}/nodes/testnet`;
return `${this.BASE_API_URL}/nodes/testnet`;
}
static sandboxNodes() {
return `${BASE_API_URL}/nodes/sandbox`;
return `${this.BASE_API_URL}/nodes/sandbox`;
}
static mainnetVersion() {
return `${BASE_API_URL}/version/mainnet`;
return `${this.BASE_API_URL}/version/mainnet`;
}
static testnetVersion() {
return `${BASE_API_URL}/version/testnet`;
return `${this.BASE_API_URL}/version/testnet`;
}
static sandboxVersion() {
return `${BASE_API_URL}/version/sandbox`;
return `${this.BASE_API_URL}/version/sandbox`;
}
}

Expand Down
8 changes: 4 additions & 4 deletions deploy-web/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ export const BASE_API_MAINNET_URL = getApiMainnetUrl();
export const BASE_API_TESTNET_URL = getApiTestnetUrl();
export const BASE_API_SANDBOX_URL = getApiSandboxUrl();

export const BASE_API_URL = getApiUrl() + "/v1";
export const BASE_API_URL = getApiUrl();

export function getNetworkBaseApiUrl(network: string) {
switch (network) {
case testnetId:
return BASE_API_TESTNET_URL + "/v1";
return BASE_API_TESTNET_URL;
case sandboxId:
return BASE_API_SANDBOX_URL + "/v1";
return BASE_API_SANDBOX_URL;
default:
return BASE_API_MAINNET_URL + "/v1";
return BASE_API_MAINNET_URL;
}
}

Expand Down
Loading