///
import { BigNumber } from "bignumber.js";
import { Augur, FormattedEventLog } from "augur.js";
import { EventEmitter } from "events";
import { NetworkConfiguration } from "augur-core";
import * as Knex from "knex";
import * as WebSocket from "ws";
import * as https from "https";
import * as http from "http";
import * as t from "io-ts";
export { BlockDetail, FormattedEventLog } from "augur.js";
export declare enum ReportingState {
PRE_REPORTING = "PRE_REPORTING",
DESIGNATED_REPORTING = "DESIGNATED_REPORTING",
OPEN_REPORTING = "OPEN_REPORTING",
CROWDSOURCING_DISPUTE = "CROWDSOURCING_DISPUTE",
AWAITING_NEXT_WINDOW = "AWAITING_NEXT_WINDOW",
AWAITING_FINALIZATION = "AWAITING_FINALIZATION",
FINALIZED = "FINALIZED",
FORKING = "FORKING",
AWAITING_NO_REPORT_MIGRATION = "AWAITING_NO_REPORT_MIGRATION",
AWAITING_FORK_MIGRATION = "AWAITING_FORK_MIGRATION"
}
export declare enum FeeWindowState {
PAST = "PAST",
CURRENT = "CURRENT",
FUTURE = "FUTURE"
}
export declare enum OrderState {
ALL = "ALL",
OPEN = "OPEN",
FILLED = "FILLED",
CANCELED = "CANCELED"
}
export declare enum Action {
ALL = "ALL",
BUY = "BUY",
SELL = "SELL",
CANCEL = "CANCEL",
CLAIM_MARKET_CREATOR_FEES = "CLAIM_MARKET_CREATOR_FEES",
CLAIM_PARTICIPATION_TOKENS = "CLAIM_PARTICIPATION_TOKENS",
CLAIM_TRADING_PROCEEDS = "CLAIM_TRADING_PROCEEDS",
CLAIM_WINNING_CROWDSOURCERS = "CLAIM_WINNING_CROWDSOURCERS",
DISPUTE = "DISPUTE",
INITIAL_REPORT = "INITIAL_REPORT",
MARKET_CREATION = "MARKET_CREATION",
COMPLETE_SETS = "COMPLETE_SETS"
}
export declare enum Coin {
ALL = "ALL",
ETH = "ETH",
REP = "REP"
}
export interface ConnectOptions extends NetworkConfiguration {
propagationDelayWaitMillis?: number;
maxRetries?: number;
blocksPerChunk?: number;
}
export interface BaseTransactionRow {
blockNumber: number;
logIndex: number;
transactionHash: Bytes32;
}
export interface BaseTransaction extends BaseTransactionRow {
blockHash: Bytes32;
}
export interface WebSocketConfigs {
pingMs?: number;
ws?: {
[config: string]: any;
};
wss?: {
[config: string]: any;
};
}
export interface EthereumNodeEndpoints {
[protocol: string]: string;
}
export interface UploadBlockNumbers {
[networkId: string]: number;
}
export declare type AbiEncodedData = string;
export declare type Address = string;
export declare type Bytes32 = string;
export declare type Int256 = string;
export interface MarketCreatedLogExtraInfo {
minPrice?: string;
maxPrice?: string;
tags?: Array;
outcomeNames?: Array;
description?: string;
longDescription?: string | null;
_scalarDenomination?: string | null;
resolutionSource?: string | null;
marketType?: string;
}
export interface MarketCreatedOnContractInfo {
marketCreatorFeeRate: string;
feeWindow: Address;
endTime: string;
designatedReporter: Address;
designatedReportStake: string;
numTicks: string;
}
export declare type ErrorCallback = (err: Error | null) => void;
export declare type GenericCallback = (err: Error | null, result?: ResultType) => void;
export declare type AsyncCallback = (err: Error | null, result?: any) => void;
export declare type LogProcessor = (augur: Augur, log: FormattedEventLog) => Promise<(db: Knex) => Promise>;
export interface EventLogProcessor {
add: LogProcessor;
remove: LogProcessor;
noAutoEmit?: boolean;
}
export interface LogProcessors {
[contractName: string]: {
[eventName: string]: EventLogProcessor;
};
}
export interface JsonRpcRequest {
id: string | number | null;
jsonrpc: string;
method: string;
params: any;
}
export interface JsonRpcResponse {
id: string | number | null;
jsonrpc: string;
result: any;
}
export declare const OutcomeParam: t.KeyofType<{
0: null;
1: null;
2: null;
3: null;
4: null;
5: null;
6: null;
7: null;
}>;
export declare const SortLimitParams: t.PartialType<{
sortBy: t.UnionType<(t.NullType | t.UndefinedType | t.StringType)[], string | null | undefined, string | null | undefined, t.mixed>;
isSortDescending: t.UnionType<(t.NullType | t.UndefinedType | t.BooleanType)[], boolean | null | undefined, boolean | null | undefined, t.mixed>;
limit: t.UnionType<(t.NullType | t.UndefinedType | t.NumberType)[], number | null | undefined, number | null | undefined, t.mixed>;
offset: t.UnionType<(t.NullType | t.UndefinedType | t.NumberType)[], number | null | undefined, number | null | undefined, t.mixed>;
}, t.TypeOfPartialProps<{
sortBy: t.UnionType<(t.NullType | t.UndefinedType | t.StringType)[], string | null | undefined, string | null | undefined, t.mixed>;
isSortDescending: t.UnionType<(t.NullType | t.UndefinedType | t.BooleanType)[], boolean | null | undefined, boolean | null | undefined, t.mixed>;
limit: t.UnionType<(t.NullType | t.UndefinedType | t.NumberType)[], number | null | undefined, number | null | undefined, t.mixed>;
offset: t.UnionType<(t.NullType | t.UndefinedType | t.NumberType)[], number | null | undefined, number | null | undefined, t.mixed>;
}>, t.OutputOfPartialProps<{
sortBy: t.UnionType<(t.NullType | t.UndefinedType | t.StringType)[], string | null | undefined, string | null | undefined, t.mixed>;
isSortDescending: t.UnionType<(t.NullType | t.UndefinedType | t.BooleanType)[], boolean | null | undefined, boolean | null | undefined, t.mixed>;
limit: t.UnionType<(t.NullType | t.UndefinedType | t.NumberType)[], number | null | undefined, number | null | undefined, t.mixed>;
offset: t.UnionType<(t.NullType | t.UndefinedType | t.NumberType)[], number | null | undefined, number | null | undefined, t.mixed>;
}>, t.mixed>;
export interface SortLimit {
sortBy: string | null | undefined;
isSortDescending: boolean | null | undefined;
limit: number | null | undefined;
offset: number | null | undefined;
}
export interface GetMarketInfoRequest {
jsonrpc: string;
id: string | number;
method: string;
params: {
market: string;
};
}
export interface GetAccountTransferHistoryRequest {
jsonrpc: string;
id: string | number;
method: string;
params: {
account: Address;
token: Address | null;
};
}
export interface MarketsContractAddressRow {
marketId: Address;
}
export interface MarketIdUniverseFeeWindow extends MarketsContractAddressRow {
universe: Address;
feeWindow: Address;
}
export interface MarketPricing {
minPrice: BigNumberType;
maxPrice: BigNumberType;
numTicks: BigNumberType;
}
export interface MarketsRow extends MarketPricing {
marketId: Address;
transactionHash: Bytes32;
logIndex: number;
universe: Address;
marketType: string;
marketCreator: Address;
numOutcomes: number;
creationBlockNumber: number;
creationFee: BigNumberType;
reportingFeeRate: BigNumberType;
marketCreatorFeeRate: BigNumberType;
marketCreatorFeesBalance: BigNumberType | null;
marketCreatorMailbox: Address;
marketCreatorMailboxOwner: Address;
initialReportSize: BigNumberType | null;
validityBondSize: BigNumberType;
category: string;
tag1: string | null;
tag2: string | null;
volume: BigNumberType;
openInterest: BigNumberType;
sharesOutstanding: BigNumberType;
marketStateId: number;
feeWindow: Address;
endTime: number;
finalizationBlockNumber?: number | null;
lastTradeBlockNumber?: number | null;
reportingState?: ReportingState | null;
shortDescription: string;
longDescription?: string | null;
scalarDenomination?: string | null;
designatedReporter: Address;
designatedReportStake: BigNumberType;
resolutionSource?: string | null;
consensusPayoutId?: number | null;
isInvalid?: boolean | null;
forking: number;
needsMigration: number;
needsDisavowal: number;
spreadPercent: BigNumberType;
invalidROIPercent: BigNumberType;
bestBidTakerInvalidProfitTokens: BigNumberType;
bestAskTakerInvalidProfitTokens: BigNumberType;
initialReporterAddress: string;
}
export interface SearchRow {
marketId: Address;
category: string;
tags: string | null;
shortDescription: string;
longDescription?: string | null;
scalarDenomination?: string | null;
resolutionSource?: string | null;
}
export interface PositionsRow {
outcome: number;
marketId?: Address;
numShares: BigNumberType | null;
account: Address | null;
realizedProfitLoss?: BigNumberType;
unrealizedProfitLoss?: BigNumberType;
numSharesAdjustedForUserIntention?: BigNumberType;
}
export interface OutcomesRow {
marketId: Address;
outcome: number;
price: BigNumberType;
volume: BigNumberType;
shareVolume: BigNumberType;
description: string | null;
spreadPercent: BigNumberType;
invalidROIPercent: BigNumberType;
bestBidTakerInvalidProfitTokens: BigNumberType;
bestAskTakerInvalidProfitTokens: BigNumberType;
}
export interface TotalInitialREPStakeRow {
marketId: Address;
totalInitialREPStake: BigNumberType;
endTime: number;
}
export interface TokensRow {
contractAddress?: Address;
symbol: string;
marketId: Address;
outcome?: number;
}
export interface CategoriesRow {
category: string;
nonFinalizedOpenInterest: BigNumberType;
openInterest: BigNumberType;
universe: Address;
}
export interface BlocksRow {
blockNumber: number;
timestamp: number;
}
export interface TransactionHashesRow {
blockNumber: number;
transactionHash: number;
}
export interface DisputeTokensRow extends Payout {
disputeToken: Address;
marketId: Address;
amountStaked: BigNumberType;
claimed: BigNumberType;
winning: BigNumberType | null;
}
export interface DisputeTokensRowWithTokenState extends DisputeTokensRow {
ReportingState: ReportingState;
}
export interface PayoutRow extends Payout {
payoutId: number;
tentativeWinning: number;
}
export interface PayoutNumerators {
payout0: BigNumberType;
payout1: BigNumberType;
payout2: BigNumberType | null;
payout3: BigNumberType | null;
payout4: BigNumberType | null;
payout5: BigNumberType | null;
payout6: BigNumberType | null;
payout7: BigNumberType | null;
}
export interface Payout extends PayoutNumerators {
isInvalid: boolean | number;
}
export interface NormalizedPayoutNumerators {
payout: Array;
}
export interface NormalizedPayout extends NormalizedPayoutNumerators {
isInvalid: boolean | number;
}
export interface UIDisputeTokenInfo extends Payout {
disputeToken: Address;
marketId: Address;
amountStaked: BigNumberType;
claimed: boolean;
winningToken: boolean | null;
ReportingState: ReportingState;
}
export interface UIDisputeTokens {
[stakeToken: string]: UIDisputeTokenInfo;
}
export interface StakeDetails extends NormalizedPayout {
stakeCompleted: BigNumberType;
size?: BigNumberType;
stakeCurrent?: BigNumberType;
tentativeWinning: boolean;
}
export interface UIStakeInfo {
marketId: Address;
disputeRound: number | null;
stakeCompletedTotal: BigNumberType;
bondSizeOfNewStake: BigNumberType;
stakes: Array>;
}
export interface UIFeeWindowCurrent {
endTime: number;
feeWindow: Address | null;
feeWindowId: number;
startTime: number;
universe: Address;
totalStake?: BigNumberType;
feeWindowEthFees?: BigNumberType;
feeWindowRepStaked?: BigNumberType;
feeWindowFeeTokens?: BigNumberType;
feeWindowParticipationTokens?: BigNumberType;
participantContributions?: BigNumberType;
participantContributionsCrowdsourcer?: BigNumberType;
participantContributionsInitialReport?: BigNumberType;
participantParticipationTokens?: BigNumberType;
participationTokens?: BigNumberType;
}
export interface UIMarketCreatorFee {
marketId: Address;
unclaimedFee: string;
}
export interface UIConsensusInfo {
outcomeId: number;
isInvalid: boolean;
}
export interface UIOutcomeInfo {
id: number;
volume: BigNumberType;
price: BigNumberType;
description: string | null;
}
export interface UIMarketInfo {
id: Address;
universe: Address;
marketType: string;
numOutcomes: number;
minPrice: BigNumberType;
maxPrice: BigNumberType;
cumulativeScale: BigNumberType;
author: Address;
creationTime: number;
creationBlock: number;
creationFee: BigNumberType;
settlementFee: BigNumberType;
reportingFeeRate: BigNumberType;
marketCreatorFeeRate: BigNumberType;
marketCreatorFeesBalance: BigNumberType | null;
marketCreatorMailbox: Address;
marketCreatorMailboxOwner: Address;
initialReportSize: BigNumberType | null;
category: string;
tags: Array;
volume: BigNumberType;
openInterest: BigNumberType;
outstandingShares: BigNumberType;
feeWindow: Address;
endTime: number;
finalizationBlockNumber?: number | null;
finalizationTime?: number | null;
lastTradeBlockNumber?: number | null;
lastTradeTime?: number | null;
reportingState?: ReportingState | null;
forking: number;
needsMigration: number;
description: string;
details?: string | null;
scalarDenomination?: string | null;
designatedReporter: Address;
designatedReportStake: BigNumberType;
resolutionSource?: string | null;
numTicks: BigNumberType;
tickSize: BigNumberType;
consensus: NormalizedPayout | null;
outcomes: Array>;
totalInitialREPStake: BigNumberType;
passesInitialREPFilter: boolean;
initialReporterAddress: string;
}
export declare type UIMarketsInfo = Array | null>;
export interface OpenInterestAggregation {
nonFinalizedOpenInterest: BigNumberType;
openInterest: BigNumberType;
liquidityTokens: BigNumberType;
}
export interface TagAggregation extends OpenInterestAggregation {
tagName: string;
numberOfMarketsWithThisTag: number;
}
export interface UICategory extends OpenInterestAggregation {
categoryName: string;
tags: Array>;
}
export interface UIOrder {
orderId: Bytes32;
transactionHash: Bytes32;
logIndex: number;
shareToken: Address;
owner: Address;
creationTime: number;
creationBlockNumber: number;
orderState: OrderState;
price: BigNumberType;
amount: BigNumberType;
originalAmount: BigNumberType;
fullPrecisionPrice: BigNumberType;
fullPrecisionAmount: BigNumberType;
originalFullPrecisionAmount: BigNumberType;
originalTokensEscrowed: BigNumberType;
originalSharesEscrowed: BigNumberType;
tokensEscrowed: BigNumberType;
sharesEscrowed: BigNumberType;
canceledBlockNumber?: Bytes32;
canceledTransactionHash?: Bytes32;
canceledTime?: Bytes32;
}
export interface UIOrders {
[marketId: string]: {
[outcome: number]: {
[orderType: string]: {
[orderId: string]: UIOrder;
};
};
};
}
export interface OrdersRow extends BaseTransactionRow {
orderId?: Bytes32;
marketId: Address;
outcome: number;
shareToken: Address;
orderType: string;
orderCreator: Address;
orderState: OrderState;
price: BigNumberType;
amount: BigNumberType;
originalAmount: BigNumberType;
fullPrecisionPrice: BigNumberType;
fullPrecisionAmount: BigNumberType;
originalFullPrecisionAmount: BigNumberType;
originalTokensEscrowed: BigNumberType;
originalSharesEscrowed: BigNumberType;
tokensEscrowed: BigNumberType;
sharesEscrowed: BigNumberType;
tradeGroupId: Bytes32 | null;
}
export interface OutcomesLiquidityRow {
marketId: Address;
outcome: number;
spreadPercent: BigNumberType;
liquidityTokens: BigNumberType;
}
export interface UITrade {
transactionHash: string;
logIndex: number;
orderId: string;
type: string;
price: string;
amount: string;
maker: boolean | null;
selfFilled: boolean;
marketCreatorFees: string;
reporterFees: string;
settlementFees: string;
marketId: Address;
outcome: number;
shareToken: Address;
timestamp: number;
tradeGroupId: Bytes32 | null;
}
export interface TradesRow extends BaseTransactionRow {
orderId: Bytes32;
marketId: Address;
outcome: number;
shareToken: Address;
orderType: string;
creator: Address;
filler: Address;
numCreatorTokens: BigNumberType;
numCreatorShares: BigNumberType;
numFillerTokens: BigNumberType;
numFillerShares: BigNumberType;
price: BigNumberType;
amount: BigNumberType;
marketCreatorFees: BigNumberType;
reporterFees: BigNumberType;
tradeGroupId: Bytes32 | null;
}
export interface CompleteSetsRow extends BaseTransactionRow {
marketId: Address;
account: Address;
universe: Address;
eventName: string;
numPurchasedOrSold: BigNumberType;
numCompleteSets: BigNumberType;
}
export interface UICompleteSetsRow extends CompleteSetsRow {
timestamp: number;
}
export interface TradingHistoryRow extends TradesRow {
timestamp: number;
}
export interface ProceedTradesRow {
logIndex: number;
blockNumber: number;
timestamp: number;
marketId: Address;
outcome: number;
price: BigNumberType;
amount: BigNumberType;
type: "sell";
maker: false;
}
export interface TimestampedPriceAmount {
price: BigNumberType;
amount: BigNumberType;
timestamp: number;
}
export interface MarketPriceHistory {
[outcome: number]: Array>;
}
export interface MarketsRowWithTime extends MarketsRow {
creationTime: number;
finalizationTime?: null | number;
lastTradeTime?: null | number;
}
export interface JoinedReportsMarketsRow extends Payout {
creationBlockNumber: number;
creationTime: number;
logIndex: number;
transactionHash: Bytes32;
blockHash: Bytes32;
marketId: Address;
universe: Address;
feeWindow: Address;
crowdsourcerId?: Address;
initialReporter?: Address;
marketType: string;
participantType: string;
amountStaked: BigNumberType;
}
export interface UIReport {
creationBlockNumber: number;
creationTime: number;
logIndex: number;
transactionHash: Bytes32;
blockHash: Bytes32;
marketId: Address;
feeWindow: Address;
payoutNumerators: Array;
amountStaked: BigNumberType;
crowdsourcerId: Address;
isCategorical: boolean;
isScalar: boolean;
isInvalid: boolean;
isSubmitted: boolean;
}
export interface FeeWindowRow {
feeWindow: Address;
feeToken: Address;
feeWindowId: number;
universe: Address;
startTime: number;
state: FeeWindowState;
endTime: number;
fees: number | string;
}
export interface InitialReportersRow {
marketId: Address;
reporter: Address;
amountStaked: BigNumberType;
initialReporter: number;
redeemed: boolean;
isDesignatedReporter: boolean;
repBalance: BigNumberType;
}
export interface UnclaimedFeeWindowsRow {
feeWindow: Address;
startTime: number;
endTime: number;
balance: BigNumberType;
participationTokenStake: BigNumberType;
feeTokenStake: BigNumberType;
totalFees: BigNumberType;
}
export interface UnclaimedFeeWindowInfo {
startTime: number;
endTime: number;
balance: BigNumberType;
expectedFees: BigNumberType;
}
export interface UnclaimedFeeWindows {
[feeWindow: string]: UnclaimedFeeWindowInfo;
}
export interface UIInitialReporters {
[initialReporter: string]: InitialReportersRow;
}
export interface ForkMigrationTotalsRow extends Payout {
universe: Address;
repTotal: BigNumberType;
}
export interface UIForkMigrationTotalsRow extends NormalizedPayout {
universe: Address;
repTotal: BigNumberType;
}
export interface UIForkMigrationTotals {
[universe: string]: UIForkMigrationTotalsRow;
}
export interface UniverseInfoRow extends Payout {
universe: Address;
parentUniverse: Address;
balance: BigNumberType;
supply: BigNumberType;
numMarkets: BigNumberType;
}
export interface UIUniverseInfoRow extends NormalizedPayout {
universe: Address;
parentUniverse: Address;
balance: BigNumberType;
supply: BigNumberType;
numMarkets: BigNumberType;
}
export interface ServersData {
servers: Array;
httpServers: Array;
controlEmitter: EventEmitter;
}
export interface AllOrdersRow {
orderId: Address;
originalTokensEscrowed: BigNumberType;
originalSharesEscrowed: BigNumberType;
tokensEscrowed: BigNumberType;
sharesEscrowed: BigNumberType;
marketId: Address;
}
export interface PendingOrphanedOrderData {
marketId: Address;
outcome: number;
orderType: string;
}
export interface AccountTransactionHistoryRow {
action: Action;
coin: string;
details: string;
fee: BigNumberType;
marketId: string;
marketDescription: string;
marketType: string;
outcome: number;
outcomeDescription: string;
payout0: BigNumberType;
payout1: BigNumberType;
payout2: BigNumberType;
payout3: BigNumberType;
payout4: BigNumberType;
payout5: BigNumberType;
payout6: BigNumberType;
payout7: BigNumberType;
isInvalid: boolean;
price: BigNumberType;
quantity: BigNumberType;
scalarDenomination: string;
timestamp: number;
total: BigNumberType;
transactionHash: string;
marketCreatorFees: BigNumberType;
minPrice: BigNumberType;
maxPrice: BigNumberType;
numCreatorShares: BigNumberType;
numCreatorTokens: BigNumberType;
numPayoutTokens: BigNumberType;
numShares: BigNumberType;
reporterFees: BigNumberType;
}
export interface UIAccountTransactionHistoryRow {
action: Action;
coin: string;
details: string;
fee: BigNumberType;
marketDescription: string;
outcome: number;
outcomeDescription: string;
price: BigNumberType;
quantity: BigNumberType;
timestamp: number;
total: BigNumberType;
transactionHash: string;
}