blob: 7991df58c9a54824952e9416f4469fdaa259f335 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import { OrderState } from '@0xproject/types';
import { BlockParamLiteral, LogEntryEvent } from 'ethereum-types';
export enum OrderWatcherError {
SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT',
SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
}
export type EventWatcherCallback = (err: null | Error, log?: LogEntryEvent) => void;
/**
* stateLayer: Optional blockchain state layer OrderWatcher will monitor for new events. Default=latest.
* orderExpirationCheckingIntervalMs: How often to check for expired orders. Default=50.
* eventPollingIntervalMs: How often to poll the Ethereum node for new events. Default=200.
* expirationMarginMs: Amount of time before order expiry that you'd like to be notified
* of an orders expiration. Default=0.
* cleanupJobIntervalMs: How often to run a cleanup job which revalidates all the orders. Default=1hr.
* isVerbose: Weather the order watcher should be verbose. Default=true.
*/
export interface OrderWatcherConfig {
stateLayer: BlockParamLiteral;
orderExpirationCheckingIntervalMs: number;
eventPollingIntervalMs: number;
expirationMarginMs: number;
cleanupJobIntervalMs: number;
isVerbose: boolean;
}
export type OnOrderStateChangeCallback = (err: Error | null, orderState?: OrderState) => void;
export enum InternalOrderWatcherError {
NoAbiDecoder = 'NO_ABI_DECODER',
ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY',
WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY',
}
|