aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/contract_wrappers/contract_wrapper.ts3
-rw-r--r--src/types.ts8
2 files changed, 9 insertions, 2 deletions
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts
index 925537173..0b65445c1 100644
--- a/src/contract_wrappers/contract_wrapper.ts
+++ b/src/contract_wrappers/contract_wrapper.ts
@@ -13,6 +13,7 @@ import {
SubscriptionOpts,
IndexedFilterValues,
EventCallback,
+ BlockParamLiteral,
} from '../types';
import {constants} from '../utils/constants';
import {intervalUtils} from '../utils/interval_utils';
@@ -120,7 +121,7 @@ export class ContractWrapper {
delete this._blockAndLogStreamer;
}
private async _reconcileBlockAsync(): Promise<void> {
- const latestBlock = await this._web3Wrapper.getBlockAsync('latest');
+ const latestBlock = await this._web3Wrapper.getBlockAsync(BlockParamLiteral.Latest);
// We need to coerce to Block type cause Web3.Block includes types for mempool bloks
(this._blockAndLogStreamer as BlockAndLogStreamer).reconcileNewBlock(latestBlock as any as Block);
}
diff --git a/src/types.ts b/src/types.ts
index f0f37bfca..44094f442 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -345,7 +345,13 @@ export interface IndexedFilterValues {
[index: string]: ContractEventArg;
}
-export type BlockParam = 'latest'|'earliest'|'pending'|number;
+export enum BlockParamLiteral {
+ Latest = 'latest',
+ Earliest = 'earliest',
+ Pending = 'pending',
+}
+
+export type BlockParam = BlockParamLiteral|number;
export interface SubscriptionOpts {
fromBlock: BlockParam;