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

Featured Apps api utils #287

Merged
15 changes: 12 additions & 3 deletions api/xverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import {
StackingPoolInfo,
SupportedCurrency,
TokenFiatRateResponse,
FeaturedDapp,
AppConfig,
FeaturedDappOld,
} from '../types';
import { handleAxiosError } from './error';
import { fetchBtcOrdinalsData } from './ordinals';
Expand Down Expand Up @@ -304,10 +307,16 @@ export async function getInscription(
return response.data;
}

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

export async function getFeaturedDapps(sectionsEnabled = false): Promise<(FeaturedDapp | FeaturedDappOld)[]> {
jordankzf marked this conversation as resolved.
Show resolved Hide resolved
const url = `${XVERSE_API_BASE_URL}/v1/featured/dapp`;
const response = await axios.get(url, { params: { sectionsEnabled } });
return response.data.featuredDapp;
}

export async function getSpamTokensList(network: NetworkType) {
Expand Down
21 changes: 21 additions & 0 deletions types/api/xverse/appConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export interface FeaturedDappOld {
name: string;
url: string;
image: string;
description: string;
order: number;
banner?: string;
}

export interface FeaturedDapp {
jordankzf marked this conversation as resolved.
Show resolved Hide resolved
name: string;
url: string;
icon: string;
description: string;
order: number;
banner?: string;
}

export interface AppConfig {
jordankzf marked this conversation as resolved.
Show resolved Hide resolved
btcApiURL: string;
}
1 change: 1 addition & 0 deletions types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export * from './api/xverse/sponsor';
export type { Pool, StackerInfo, StackingData, StackingPoolInfo, StackingStateData } from './api/xverse/stacking';
export * from './api/xverse/transaction';
export * from './api/xverse/wallet';
export * from './api/xverse/appConfig';
export * from './api/xverseInscribe';
export * from './currency';
export type { SupportedCurrency } from './currency';
Expand Down
Loading