Skip to content

Commit

Permalink
Use v2 instead of v1 + sectionsEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jordankzf committed Feb 15, 2024
1 parent d65eb43 commit fef4a21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
17 changes: 7 additions & 10 deletions api/xverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import {
StackingPoolInfo,
SupportedCurrency,
TokenFiatRateResponse,
FeaturedDapp,
AppConfig,
FeaturedDappOld,
DappSectionData,
} from '../types';
import { handleAxiosError } from './error';
import { fetchBtcOrdinalsData } from './ordinals';
Expand Down Expand Up @@ -307,18 +305,17 @@ export async function getInscription(
return response.data;
}

export async function getAppConfig(network: NetworkType): Promise<AppConfig> {
export async function getAppConfig(network: NetworkType) {
const appConfigUrl = `${XVERSE_API_BASE_URL(network)}/v1/app-config`;
const response = await axios.get(appConfigUrl);
return response.data.appConfig;
const appConfig = await axios.get(appConfigUrl);
return appConfig;
}

export async function getFeaturedDapps(
network: NetworkType,
sectionsEnabled = false,
): Promise<(FeaturedDapp | FeaturedDappOld)[]> {
const url = `${XVERSE_API_BASE_URL(network)}/v1/featured/dapp`;
const response = await axios.get(url, { params: { sectionsEnabled } });
): Promise<DappSectionData[]> {
const url = `${XVERSE_API_BASE_URL(network)}/v2/featured/dapp`;
const response = await axios.get(url);
return response.data.featuredDapp;
}

Expand Down
17 changes: 7 additions & 10 deletions types/api/xverse/appConfig.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
export interface FeaturedDappOld {
export type FeaturedDapp = {
name: string;
url: string;
image: string;
icon: string;
description: string;
order: number;
banner?: string;
}

export interface FeaturedDapp {
name: string;
url: string;
icon: string;
description: string;
order: number;
banner?: string;
export type DappSectionData = {
section: string;
view: string;
apps: FeaturedDapp[];
}

export interface AppConfig {
export type AppConfig = {
btcApiURL: string;
}

0 comments on commit fef4a21

Please sign in to comment.