@velora-dex/sdk
Version:
27 lines • 1.46 kB
TypeScript
import type { LimitOrderFromApi } from '../../limitOrders/helpers/types';
import type { OrderType } from './types';
type GetBaseFetchUrlInput = {
apiURL: string;
chainId: number;
};
export type BaseFetchUrlInputConstructor<Kind extends OrderKind> = (params: GetBaseFetchUrlInput) => UrlByTypeFunction<Kind>;
type OrderType2URLPart = {
LIMIT: 'orders';
P2P: 'p2p';
};
type OrderKind = 'nft' | 'ft';
export type BaseFetchUrl<Kind extends OrderKind, Type extends OrderType = OrderType> = `${string}/${Kind}/${OrderType2URLPart[Type]}/${number}`;
export type MinFetchUrl<Kind extends OrderKind> = `${string}/${Kind}/order`;
export type OrderFillableBalanceFetchUrl<Kind extends OrderKind> = `${string}/${Kind}/fillablebalance/${number}`;
interface UrlByTypeFunction<Kind extends OrderKind> {
(): MinFetchUrl<Kind>;
(type: 'LIMIT'): BaseFetchUrl<Kind, 'LIMIT'>;
(type: 'P2P'): BaseFetchUrl<Kind, 'P2P'>;
(type: OrderType): BaseFetchUrl<Kind>;
(type: 'fillablebalance'): OrderFillableBalanceFetchUrl<Kind>;
(type?: OrderType | 'fillablebalance'): BaseFetchUrl<Kind> | MinFetchUrl<Kind> | OrderFillableBalanceFetchUrl<Kind>;
}
export declare function baseFetchUrlGetterFactory<Kind extends OrderKind>(orderKind: Kind): BaseFetchUrlInputConstructor<Kind>;
export declare function isOrderFillableDirectlyOnRFQOnly(order: Pick<LimitOrderFromApi, 'taker' | 'takerFromMeta'>): boolean;
export {};
//# sourceMappingURL=misc.d.ts.map