UNPKG

@bayswap/sdk

Version:

SDK for BaySwap smart contract

53 lines (52 loc) 1.7 kB
import { JsonRpcProvider, TransactionBlock } from '@mysten/sui.js'; import { LimitOrderRegistry, TurbofishTypes } from '../types'; import { TxBuilderConfig } from '../sdk'; export interface PlaceSwapOrderTypes { coinX: string; coinY: string; curve: string; } export interface PlaceSwapOrderParams { inputIds: string[]; inputType: string; swapAmt: bigint; minOut: bigint; expired: bigint; } export interface CancelSwapOrderTypes { coinX: string; coinY: string; curve: string; } export interface CancelSwapOrderParams { orderId: string; } type OrderStatusTypes = 'pending' | 'executed' | 'cancel'; export interface SwapOrder { id: string; owner: string; expired: number; status: OrderStatusTypes; coinX: string; coinY: string; curve: string; minOutX: bigint; minOutY: bigint; amountX: bigint; amountY: bigint; isReverse: boolean; timestamp: bigint; } export declare class LimitOrderModule { protected _registry: LimitOrderRegistry; protected _provider: JsonRpcProvider; protected _txBuilderConfig: TxBuilderConfig; constructor(provider: JsonRpcProvider, registry: LimitOrderRegistry, txBuilderConfig: TxBuilderConfig); getSwapOrders(owner: string, filter?: TurbofishTypes): Promise<SwapOrder[]>; getAllOrderIds(owner?: string): Promise<string[]>; getBatchOrderDetails(ids: string[]): Promise<SwapOrder[]>; buildPlaceSwapOrder(t: PlaceSwapOrderTypes, p: PlaceSwapOrderParams): TransactionBlock; buildCancelSwapOrder(t: CancelSwapOrderTypes, p: CancelSwapOrderParams): TransactionBlock; parseEventRegisterSwapOrderManager(eventType: string): string[]; } export {};