/** * encoding.js * * This NPM module provide encoding and decoding utilities for interacting with * dFusion smart contracts where manual byte encoding was needed because of * solidity ABI limitations. */ import BN from "bn.js"; export interface Order { user: string; sellTokenBalance: T; buyToken: number; sellToken: number; validFrom: number; validUntil: number; priceNumerator: T; priceDenominator: T; remainingAmount: T; } export interface IndexedOrder extends Order { orderId: number; } /** * Decodes a byte-encoded variable length array of orders. This can be used to * decode the result of `BatchExchange.getEncodedUserOrders` and * `BatchExchange.getEncodedOrders`. */ export declare function decodeOrders(bytes: string | null): Order[]; /** * Decodes a byte-encoded variable length array of orders and their indices. * This can be used to decode the result of `BatchExchangeViewer.getOpenOrderBook` and * `BatchExchangeViewer.getFinalizedOrderBook`. */ export declare function decodeIndexedOrders(bytes: string | null): IndexedOrder[]; declare type EncodableInt = string | { toString(base: number): string; }; /** * Encodes an array of orders into a `Uint8Array` of bytes. This uses the same * format as `BatchExchange.getEncodedOrders`. */ export declare function encodeOrders(orders: Order[]): Uint8Array; /** * Encodes an array of indexed orders into a `Uint8Array` of bytes. This uses * the same format as `BatchExchangeViewer.getFilteredOrderBook`. */ export declare function encodeIndexedOrders(orders: IndexedOrder[]): Uint8Array; export {};