diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-06 18:04:51 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-06 18:04:51 +0800 |
commit | 637183e4b214cc7a215ebf83d18c1a65263d8e7e (patch) | |
tree | 2736abe7bb0bde6e68757bf7a07b00d358c289f1 /src | |
parent | 44e2929a4c3cec6666a2e3ad340028aff2884f69 (diff) | |
download | dexon-sol-tools-637183e4b214cc7a215ebf83d18c1a65263d8e7e.tar dexon-sol-tools-637183e4b214cc7a215ebf83d18c1a65263d8e7e.tar.gz dexon-sol-tools-637183e4b214cc7a215ebf83d18c1a65263d8e7e.tar.bz2 dexon-sol-tools-637183e4b214cc7a215ebf83d18c1a65263d8e7e.tar.lz dexon-sol-tools-637183e4b214cc7a215ebf83d18c1a65263d8e7e.tar.xz dexon-sol-tools-637183e4b214cc7a215ebf83d18c1a65263d8e7e.tar.zst dexon-sol-tools-637183e4b214cc7a215ebf83d18c1a65263d8e7e.zip |
introduce BlockParamLiteral
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/contract_wrapper.ts | 3 | ||||
-rw-r--r-- | src/types.ts | 8 |
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; |