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
7 changes: 7 additions & 0 deletions api/xverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
StackingPoolInfo,
SupportedCurrency,
TokenFiatRateResponse,
DappSectionData,
} from '../types';
import { handleAxiosError } from './error';
import { fetchBtcOrdinalsData } from './ordinals';
Expand Down Expand Up @@ -310,6 +311,12 @@ export async function getAppConfig(network: NetworkType) {
return appConfig;
}

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

export async function getSpamTokensList(network: NetworkType) {
const spamTokensUrl = `${XVERSE_API_BASE_URL(network)}/v1/spam-tokens`;
const spamTokens = await axios.get(spamTokensUrl);
Expand Down
18 changes: 18 additions & 0 deletions types/api/xverse/appConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export type FeaturedDapp = {
name: string;
url: string;
icon: string;
description: string;
order: number;
banner?: string;
};

export type DappSectionData = {
section: string;
view: string;
apps: FeaturedDapp[];
};

export type AppConfig = {
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