/* Generated by ts-generator ver. 0.0.8 */
/* tslint:disable */

import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
  Callback,
  PayableTransactionObject,
  NonPayableTransactionObject,
  BlockType,
  ContractEventLog,
  BaseContract
} from "./types";

interface EventOptions {
  filter?: object;
  fromBlock?: BlockType;
  topics?: string[];
}

export interface BatchExchangeViewer extends BaseContract {
  constructor(
    jsonInterface: any[],
    address?: string,
    options?: ContractOptions
  ): BatchExchangeViewer;
  clone(): BatchExchangeViewer;
  methods: {
    INDEXED_AUCTION_ELEMENT_WIDTH(): NonPayableTransactionObject<string>;

    ADDRESS_WIDTH(): NonPayableTransactionObject<string>;

    LARGE_PAGE_SIZE(): NonPayableTransactionObject<string>;

    AUCTION_ELEMENT_WIDTH(): NonPayableTransactionObject<string>;

    ALL_TOKEN_FILTER(
      arg0: number | string
    ): NonPayableTransactionObject<string>;

    /**
     * Queries the orderbook for the auction that is still accepting orders
     * @param tokenFilter all returned order will have buy *and* sell token from this list (leave empty for "no filter")
     * @returns encoded bytes representing orders, maxed at 5000 elements
     */
    getOpenOrderBook(
      tokenFilter: string[]
    ): NonPayableTransactionObject<string>;

    /**
     * Queries a page of the orderbook for the auction that is still accepting orders
     * @param maxPageSize count of elements to be returned per page (same value is used for subqueries on the exchange)
     * @param previousPageUser address taken from nextPageUser return value from last page (address(0) for first page)
     * @param previousPageUserOffset offset taken nextPageUserOffset return value from last page (0 for first page)
     * @param tokenFilter all returned order will have buy *and* sell token from this list (leave empty for "no filter")
     * @returns encoded bytes representing orders and page information for next page
     */
    getOpenOrderBookPaginated(
      tokenFilter: string[],
      previousPageUser: string,
      previousPageUserOffset: number | string,
      maxPageSize: number | string
    ): NonPayableTransactionObject<{
      elements: string;
      hasNextPage: boolean;
      nextPageUser: string;
      nextPageUserOffset: string;
      0: string;
      1: boolean;
      2: string;
      3: string;
    }>;

    /**
     * Queries the orderbook for the auction that is currently being solved
     * @param tokenFilter all returned order will have buy *and* sell token from this list (leave empty for "no filter")
     * @returns encoded bytes representing orders, maxed at 5000 elements
     */
    getFinalizedOrderBook(
      tokenFilter: string[]
    ): NonPayableTransactionObject<string>;

    /**
     * Queries a page of the orderbook for the auction that is currently being solved
     * @param maxPageSize count of elements to be returned per page (same value is used for subqueries on the exchange)
     * @param previousPageUser address taken from nextPageUser return value from last page (address(0) for first page)
     * @param previousPageUserOffset offset taken nextPageUserOffset return value from last page (0 for first page)
     * @param tokenFilter all returned order will have buy *and* sell token from this list (leave empty for "no filter")
     * @returns encoded bytes representing orders and page information for next page
     */
    getFinalizedOrderBookPaginated(
      tokenFilter: string[],
      previousPageUser: string,
      previousPageUserOffset: number | string,
      maxPageSize: number | string
    ): NonPayableTransactionObject<{
      elements: string;
      hasNextPage: boolean;
      nextPageUser: string;
      nextPageUserOffset: string;
      0: string;
      1: boolean;
      2: string;
      3: string;
    }>;

    /**
     * Queries a page in the list of all orders
     * @param batchIds Triple with the following values [maxValidFrom, minValidUntil, sellBalanceTargetBatchIndex] Batched together as we are running out of local variables (Solidity does not compile with Stack too deep error)     - maxValidFrom: all returned orders will have a validFrom <= this value (they were placed at or before that batch)     - minValidUntil all returned orders will have a validUntil >= this value (validity ends at or after that batch)     - sellBalanceTargetBatchIndex the batchIndex at which we are expecting the sellTokenBalance to be valid (e.g. in the current live orderbook we want to include sellBalances that are valid in currentBatch + 1).
     * @param maxPageSize maximum count of elements to be returned per page (same value is used for subqueries on the exchange)
     * @param previousPageUser address taken from nextPageUser return value from last page (address(0) for first page)
     * @param previousPageUserOffset offset taken nextPageUserOffset return value from last page (0 for first page)
     * @param tokenFilter all returned order will have buy *and* sell token from this list (leave empty for "no filter")
     * @returns encoded bytes representing orders and page information for next page. Result can contain less elements than maxPageSize if remaining gas is low.
     */
    getFilteredOrdersPaginated(
      batchIds: (number | string)[],
      tokenFilter: (number | string)[],
      previousPageUser: string,
      previousPageUserOffset: number | string,
      maxPageSize: number | string
    ): NonPayableTransactionObject<{
      elements: string;
      hasNextPage: boolean;
      nextPageUser: string;
      nextPageUserOffset: string;
      0: string;
      1: boolean;
      2: string;
      3: string;
    }>;

    /**
     * View returning byte-encoded sell orders in paginated form. It has the same behavior as BatchExchange.getEncodedUsersPaginated but uses less memory and thus is more gas efficient.
     * @param pageSize uint determining the count of orders to be returned per page
     * @param previousPageUser address of last user received in the previous page (address(0) for first page)
     * @param previousPageUserOffset the number of orders received for the last user on the previous page (0 for first page).
     * @returns encoded bytes representing a page of orders ordered by (user, index)
     */
    getEncodedOrdersPaginated(
      previousPageUser: string,
      previousPageUserOffset: number | string,
      pageSize: number | string
    ): NonPayableTransactionObject<string>;

    getEncodedOrdersPaginatedWithTokenFilter(
      tokenFilter: (number | string)[],
      previousPageUser: string,
      previousPageUserOffset: number | string,
      pageSize: number | string
    ): NonPayableTransactionObject<string>;

    writeEncodedOrdersPaginatedWithTokenFilter(
      tokenFilter: (number | string)[],
      previousPageUser: string,
      previousPageUserOffset: number | string,
      elements: string | number[]
    ): NonPayableTransactionObject<string>;

    matchesTokenFilter(
      buyToken: number | string,
      sellToken: number | string,
      filter: (number | string)[]
    ): NonPayableTransactionObject<boolean>;

    getUser(element: string | number[]): NonPayableTransactionObject<string>;

    getSellTokenBalance(
      element: string | number[]
    ): NonPayableTransactionObject<string>;

    updateSellTokenBalance(
      element: string | number[],
      amount: number | string
    ): NonPayableTransactionObject<string>;

    getBuyToken(
      element: string | number[]
    ): NonPayableTransactionObject<string>;

    getSellToken(
      element: string | number[]
    ): NonPayableTransactionObject<string>;

    getValidFrom(
      element: string | number[]
    ): NonPayableTransactionObject<string>;

    getValidUntil(
      element: string | number[]
    ): NonPayableTransactionObject<string>;

    getTokenIdsFromAdresses(
      tokenIds: string[]
    ): NonPayableTransactionObject<string[]>;

    updateSellTokenBalanceForBatchId(
      element: string | number[],
      targetBatchIndex: number | string
    ): NonPayableTransactionObject<string>;

    /**
     * Queries the token information for the given tokenId. Can handle symbols of type string and bytes (e.g. MKR). Returns "Unknown" as symbol value if it cannot be retrieved and reverts if decimals can not be fetched (to avoid ambiguity with a "valid" value).
     * @param tokenId the ID of a token listed on BatchExchange
     * @returns the address, symbol and decimals of the token contract
     */
    getTokenInfo(
      tokenId: number | string
    ): NonPayableTransactionObject<{
      symbol: string;
      decimals: string;
      0: string;
      1: string;
      2: string;
    }>;

    /**
     * returns the symbol() of the given address assuming it is returned as a string. Reverts if method does not exist or returns data that is not a valid string.
     * @param token the token address from which to receive the symbol
     * @returns the token's symbol
     */
    getTokenSymbolString(token: string): NonPayableTransactionObject<string>;

    /**
     * returns the symbol() of the given address assuming it is returned as a bytes. Reverts if method does not exist or returns data that cannot be casted into a string.
     * @param token the token address from which to receive the symbol
     * @returns the token's symbol converted into a trimmed (trailing 0 bytes remove) string.
     */
    getTokenSymbolBytes(token: string): NonPayableTransactionObject<string>;

    /**
     * Sets the length of the given buffer (truncating any items exceeding the length). Note, that this can lead to memory leakage or undefined behavior if length  is larger than the size that was originally allocated by the buffer.
     */
    setLength(
      buffer: string | number[],
      length: number | string
    ): NonPayableTransactionObject<void>;

    copyInPlace(
      source: string | number[],
      destination: string | number[],
      offset: number | string
    ): NonPayableTransactionObject<void>;
  };
  events: {
    allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
  };
}
