UNPKG

@velora-dex/sdk

Version:
43 lines 2.43 kB
import type { Address, ConstructFetchInput, RequestParameters } from '../../types'; import type { DeltaAuction, DeltaAuctionStatus } from './helpers/types'; export type DeltaOrderFromAPI = Omit<DeltaAuction, 'signature'>; export type DeltaOrderFilterByStatus = DeltaAuctionStatus | 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_ALLOWANCE' | 'INVALIDATED' | 'ACTIVE' | 'INACTIVE'; type GetDeltaOrderById = (orderId: string, requestParams?: RequestParameters) => Promise<DeltaOrderFromAPI>; type GetDeltaOrderByHash = (orderHash: string, requestParams?: RequestParameters) => Promise<DeltaOrderFromAPI>; type OrdersFilter = { /** @description Order.owner to fetch Delta Order for */ userAddress: Address; /** @description Pagination option, page. Default 1 */ page?: number; /** @description Pagination option, limit. Default 100 */ limit?: number; /** @description Filter by chainId, without this filter, orders from all chains are returned */ chainId?: number[]; /** * @description * Filter by any known DeltaAuctionStatus and some custom statuses: * - **INSUFFICIENT_BALANCE** — returned as SUSPENDED from API * - **INSUFFICIENT_ALLOWANCE** — returned as SUSPENDED from API * - **INVALIDATED** — returned as FAILED from API * - **ACTIVE** — All orders with NOT_STARTED, RUNNING, EXECUTING or SUSPENDED statuses. * - **INACTIVE** — All orders with EXECUTED, FAILED, EXPIRED, CANCELLED or INVALIDATED statuses. */ status?: DeltaOrderFilterByStatus[]; /** @description Filter by type. MARKET, LIMIT. Orders with both types are returned if not specified */ type?: 'MARKET' | 'LIMIT'; }; type GetDeltaOrders = (options: OrdersFilter, requestParams?: RequestParameters) => Promise<DeltaOrderFromAPI[]>; type GetRequiredBalanceParams = { userAddress: Address; tokenAddress?: Address; }; type GetRequiredBalance = (userParams: GetRequiredBalanceParams, requestParams?: RequestParameters) => Promise<Record<string, string>>; export type GetDeltaOrdersFunctions = { getDeltaOrderById: GetDeltaOrderById; getDeltaOrderByHash: GetDeltaOrderByHash; getDeltaOrders: GetDeltaOrders; getRequiredBalanceForDeltaLimitOrders: GetRequiredBalance; }; export declare const constructGetDeltaOrders: ({ apiURL, fetcher, chainId, }: ConstructFetchInput) => GetDeltaOrdersFunctions; export {}; //# sourceMappingURL=getDeltaOrders.d.ts.map