@broxus/js-core
Version:
MobX-based JavaScript Core library
137 lines (136 loc) • 4.37 kB
TypeScript
import { type AddressUrlParam, type CommonGraphRequestParams, type OhlcvKind, type OhlcvModel, type TvlResponseModel, type VolumeResponseModel } from '../api/types';
import { Endpoint } from '../core';
export declare enum PoolsOrdering {
TvlAscending = "tvlascending",
TvlDescending = "tvldescending",
Volume24hAscending = "volume24hascending",
Volume24hDescending = "volume24hdescending",
Volume7dAscending = "volume7dascending",
Volume7dDescending = "volume7ddescending"
}
export interface PoolMeta {
beneficiaryAddress: string;
currencies: string[];
currencyAddresses: string[];
currencyScales: number[];
fee: string;
feeBeneficiary: string;
lpAddress: string;
pairType: 'default' | 'stable';
poolAddress: string;
}
export interface PoolResponse {
count24Transactions: number;
fee7d: string;
fee24h: string;
feeAllTime: string;
lpLocked: string;
meta: PoolMeta;
prices: string[];
stableOneSwap: string[];
tvl: string;
tvlChange: string;
volume7d: string;
volume24h: string;
volume24hChange: string;
volumesLocked: string[];
}
export interface PoolsRequestParams {
currencyAddress?: string;
currencyAddresses?: string[];
favoritePools?: string[];
limit: number;
offset: number;
ordering?: PoolsOrdering;
tvlAmountGe?: string;
tvlAmountLe?: string;
whiteListUri?: string;
}
export interface PoolsResponse {
count: number;
offset: number;
pools: PoolResponse[];
totalCount: number;
}
export interface PoolOhlcvRequestParams extends CommonGraphRequestParams {
firstCurrencyAddress?: string;
ohlcvKind: OhlcvKind;
poolAddress: string;
secondCurrencyAddress?: string;
}
export interface PoolOhlcvResponseModel extends Omit<OhlcvModel, 'volume'> {
countTransactions: number;
usdtVolume: string;
}
export type PoolOhlcvResponse<T extends OhlcvKind = any> = T extends OhlcvKind.Price ? PoolOhlcvResponseModel[] : T extends OhlcvKind.Tvl ? TvlResponseModel[] : T extends OhlcvKind.Volume ? VolumeResponseModel[] : never;
export declare enum PoolTransactionsOrdering {
BlockTimeAscending = "blocktimeascending",
BlockTimeDescending = "blocktimedescending",
FromExecAscending = "fromexecascending",
FromExecDescending = "fromexecdescending",
ToExecAscending = "toexecascending",
ToExecDescending = "toexecdescending",
TvAscending = "tvascending",
TvDescending = "tvdescending"
}
export declare enum PoolTransactionEventType {
Deposit = "deposit",
Swap = "swap",
Withdraw = "withdraw"
}
export interface PoolTransactionResponse {
beneficiaryAddresses: string[];
beneficiaryFees: string;
beneficiaryFeeUsdt: string;
currencies: string[];
currencyAddresses: string[];
eventType: PoolTransactionEventType;
feeCurrencies: string[];
feeCurrencyAddresses: string[];
fees: string;
feeUsdt: string;
lp: string;
lpAddress: string;
lpVolume: string;
messageHash: string;
poolAddress: string;
timestampBlock: number;
transactionHash: string;
tv: string;
userAddress: string;
volumes: string[];
}
export interface PoolTransactionsRequestParams {
createdAtGe?: number;
createdAtLe?: number;
currencyAddress?: string;
currencyAddresses?: string[];
displayTotalCount?: boolean;
eventType?: PoolTransactionEventType[];
leftAmountGe?: string;
leftAmountLe?: string;
limit: number;
offset: number;
ordering?: PoolTransactionsOrdering;
poolAddress?: string;
rightAmountGe?: string;
rightAmountLe?: string;
timestampBlockGe?: number;
timestampBlockLe?: number;
tvGe?: number;
tvLe?: number;
userAddress?: string;
whiteListUri?: string;
}
export interface PoolTransactionsResponse {
count: number;
offset: number;
totalCount: number;
transactions: PoolTransactionResponse[];
}
export declare function usePoolsApi(baseUrl?: string): {
pool: Endpoint<AddressUrlParam, never, PoolResponse>;
poolOhlcv: Endpoint<AddressUrlParam, PoolOhlcvRequestParams, TvlResponseModel[] | VolumeResponseModel[] | PoolOhlcvResponseModel[]>;
pools: Endpoint<never, PoolsRequestParams, PoolsResponse>;
transactions: Endpoint<never, PoolTransactionsRequestParams, PoolTransactionsResponse>;
};