@hydro-protocol/hydro-client-js
Version:
Javascript SDK for the Hydro API
83 lines (82 loc) • 2.61 kB
TypeScript
import { BigNumber } from 'bignumber.js';
import { OrderType, Side } from './Order';
/**
* Data used by 0x to construct an order.
*
* See https://0xproject.com/wiki#Create,-Validate,-Fill-Order
*/
export declare class OrderData {
/**
* The address of the order creator
*/
readonly trader: string;
/**
* The address of the relayer in charge of matching orders
*/
readonly relayer: string;
/**
* The address of the base token
*/
readonly baseToken: string;
/**
* The address of quote token
*/
readonly quoteToken: string;
/**
* The amount of base token to be filled by this order
*/
readonly baseTokenAmount: BigNumber;
/**
* The amount of quote token related to the base token. This essentially determines price.
*/
readonly quoteTokenAmount: BigNumber;
/**
* The amount of gas in base token charged by the relayer to cover ethereum gas costs
*/
readonly gasTokenAmount: BigNumber;
/**
* A data field containing a compact representation of various properties of the order
*/
readonly data: string;
constructor(json: any);
/**
* Which version of Hydro was used to construct this order
*/
getVersion(): number;
/**
* Whether this is a buy or sell order
*/
getSide(): Side;
/**
* Whether this is a limit or market order
*/
getType(): OrderType;
/**
* Return a Date object representing when this order will expire
*/
getExpiration(): Date;
/**
* Return a BigNumber representing the rate for the fee the maker will pay
*/
getMakerFeeRate(): BigNumber;
/**
* Return a BigNumber representing the rate for the fee the taker will pay
*/
getTakerFeeRate(): BigNumber;
/**
* Return a BigNumber representing the rate for the rebate the maker will get
*/
getMakerRebateRate(): BigNumber;
/**
* Returns decimal representation of the data at a certain offset with a certain size.
* Offet will not include the prepended 0x, and both parameters will be defined by bytes, or a
* 2 digit hex representation. For example in the string 0x12345678, passing (0, 1) would get the
* hex value 12, convert it to decimal and return 18. Passing (1, 2) would get the hex value 3456
* and return 13398.
*
* @param offset The number of bytes to offset into the data field
* @param size The number of bytes to grab at that offset
* @return The decimal representation of the hex found
*/
private sliceData;
}