UNPKG

@nexex/api

Version:
80 lines (79 loc) 4.58 kB
import { Artifact, ECSignature, PlainDexOrder } from '@nexex/types'; import { Signer } from 'ethers'; import { TransactionRequest, TransactionResponse } from 'ethers/providers'; import { BigNumber } from 'ethers/utils'; import { AnyNumber } from '../types'; import { BaseContract } from './BaseContract'; export declare class Exchange extends BaseContract { feeAccount(): Promise<string>; changeFeeAccount(signer: Signer, newFeeAccount: string, opt?: TransactionRequest): Promise<TransactionResponse>; makerExFeeRate(): Promise<BigNumber>; changeFeeMake(signer: Signer, newMakeFeeRate: AnyNumber, opt?: TransactionRequest): Promise<TransactionResponse>; takerExFeeRate(): Promise<BigNumber>; changeFeeTake(signer: Signer, newTakeFeeRate: AnyNumber, opt?: TransactionRequest): Promise<TransactionResponse>; tokenTransferProxy(): Promise<string>; changeTokenTransferProxy(signer: Signer, newTokenTransferProxy: string, opt?: TransactionRequest): Promise<TransactionResponse>; maxMakerFeeRate(): Promise<BigNumber>; changeMaxMakerFeeRate(signer: Signer, newFeeRate: AnyNumber, opt?: TransactionRequest): Promise<TransactionResponse>; maxTakerFeeRate(): Promise<BigNumber>; changeMaxTakerFeeRate(signer: Signer, newFeeRate: AnyNumber, opt?: TransactionRequest): Promise<TransactionResponse>; isValidOrder(order: PlainDexOrder): Promise<boolean>; isValidSignature(maker: string, orderHash: string, ecSignature: ECSignature): Promise<boolean>; availableVolume(order: PlainDexOrder): Promise<BigNumber>; testFillOrder(order: PlainDexOrder, fillAmount: AnyNumber, takerFeeAccount: string, taker: string): Promise<boolean>; /** * Fills the input order. * @param signer * @param order * @param fillAmount * @param takerFeeAccount * @param shouldThrowOnInsufficientBalanceOrAllowance * @param opt */ fillOrder(signer: Signer, order: PlainDexOrder, fillAmount: AnyNumber, takerFeeAccount?: string, shouldThrowOnInsufficientBalanceOrAllowance?: boolean, opt?: TransactionRequest): Promise<TransactionResponse>; /** * Fills an order with specified parameters and ECDSA signature, throws if specified amount not filled entirely. * @param signer * @param order * @param fillAmount * @param takerFeeAccount * @param shouldThrowOnInsufficientBalanceOrAllowance * @param opt */ fillOrKillOrder(signer: Signer, order: PlainDexOrder, fillAmount: AnyNumber, takerFeeAccount?: string, shouldThrowOnInsufficientBalanceOrAllowance?: boolean, opt?: TransactionRequest): Promise<TransactionResponse>; /** * Synchronously executes multiple fill orders in a single transaction until total fillTakerTokenAmount filled. * @param signer * @param orders don't pass more than 40 orders * @param fillAmount Desired total amount of takerToken to fill in orders. * @param takerFeeAccount * @param shouldThrowOnInsufficientBalanceOrAllowance * @param opt */ fillOrdersUpTo(signer: Signer, orders: Array<PlainDexOrder>, fillAmount: AnyNumber, takerFeeAccount?: string, shouldThrowOnInsufficientBalanceOrAllowance?: boolean, opt?: TransactionRequest): Promise<TransactionResponse>; /** * Synchronously executes multiple fill orders in a single transaction. * @param signer * @param orders * @param fillAmounts * @param takerFeeAccount * @param shouldThrowOnInsufficientBalanceOrAllowance * @param opt */ batchFillOrders(signer: Signer, orders: Array<PlainDexOrder>, fillAmounts: Array<AnyNumber>, takerFeeAccount?: string, shouldThrowOnInsufficientBalanceOrAllowance?: boolean, opt?: TransactionRequest): Promise<TransactionResponse>; /** * Synchronously executes multiple fillOrKill orders in a single transaction. * @param signer * @param orders * @param fillAmounts * @param takerFeeAccount * @param shouldThrowOnInsufficientBalanceOrAllowance * @param opt */ batchFillOrKillOrders(signer: Signer, orders: Array<PlainDexOrder>, fillAmounts: Array<AnyNumber>, takerFeeAccount?: string, shouldThrowOnInsufficientBalanceOrAllowance?: boolean, opt?: TransactionRequest): Promise<TransactionResponse>; cancelOrder(signer: Signer, order: PlainDexOrder, cancelTakerAmount?: AnyNumber, opt?: TransactionRequest): Promise<TransactionResponse>; getOrderHash(order: PlainDexOrder): Promise<string>; protected getArtifact(): Artifact; private extractOrderAddressArray; private extractOrderValueArray; }