aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/order-watcher/src/types.ts')
-rw-r--r--packages/order-watcher/src/types.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/order-watcher/src/types.ts b/packages/order-watcher/src/types.ts
new file mode 100644
index 000000000..57fa20e47
--- /dev/null
+++ b/packages/order-watcher/src/types.ts
@@ -0,0 +1,48 @@
+import { BigNumber } from '@0xproject/utils';
+
+import {
+ BlockParam,
+ BlockParamLiteral,
+ ContractAbi,
+ ContractEventArg,
+ ExchangeContractErrs,
+ FilterObject,
+ LogEntryEvent,
+ LogWithDecodedArgs,
+ Order,
+ OrderState,
+ SignedOrder,
+} from '@0xproject/types';
+
+export enum OrderWatcherError {
+ SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT',
+ SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
+}
+
+export type EventWatcherCallback = (err: null | Error, log?: LogEntryEvent) => void;
+
+/**
+ * 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.
+ * stateLayer: Optional blockchain state layer OrderWatcher will monitor for new events. Default=latest.
+ */
+export interface OrderWatcherConfig {
+ orderExpirationCheckingIntervalMs?: number;
+ eventPollingIntervalMs?: number;
+ expirationMarginMs?: number;
+ cleanupJobIntervalMs?: number;
+ stateLayer: BlockParamLiteral;
+}
+
+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',
+}
+
+// tslint:disable:max-file-line-count