From 96d2a55effa6666c1b8d90594ca5607dcc1bce8e Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 5 Sep 2017 10:29:51 +0200 Subject: Add TransationReceipt as a public exported type --- src/0x.ts | 12 +++++++++--- src/index.ts | 1 + src/types.ts | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/0x.ts b/src/0x.ts index 4a1d605a2..86976c4ab 100644 --- a/src/0x.ts +++ b/src/0x.ts @@ -16,7 +16,7 @@ import {TokenRegistryWrapper} from './contract_wrappers/token_registry_wrapper'; import {EtherTokenWrapper} from './contract_wrappers/ether_token_wrapper'; import {TokenWrapper} from './contract_wrappers/token_wrapper'; import {TokenTransferProxyWrapper} from './contract_wrappers/token_transfer_proxy_wrapper'; -import {ECSignature, ZeroExError, Order, SignedOrder, Web3Provider, ZeroExConfig} from './types'; +import {ECSignature, ZeroExError, Order, SignedOrder, Web3Provider, ZeroExConfig, TransactionReceipt} from './types'; // Customize our BigNumber instances bigNumberConfigs.configure(); @@ -249,9 +249,15 @@ export class ZeroEx { throw new Error(ZeroExError.InvalidSignature); } + /** + * Waits for transaction to be mined and returns the transaction receipt + * @param txHash Transaction hash + * @param pollingIntervalMs How often (in ms) should we check if the transaction is mined. + * @return Web3.TransactionReceipt + */ public async awaitTransactionMinedAsync(txHash: string, - pollingIntervalMs: number = 500): Promise { - const txReceiptPromise = new Promise((resolve: (receipt: Web3.TransactionReceipt) => void, reject) => { + pollingIntervalMs: number = 500): Promise { + const txReceiptPromise = new Promise((resolve: (receipt: TransactionReceipt) => void, reject) => { const intervalId = setInterval(async () => { const transactionReceipt = await this._web3Wrapper.getTransactionReceiptAsync(txHash); if (!_.isNull(transactionReceipt)) { diff --git a/src/index.ts b/src/index.ts index 6d6e4484c..44bd53547 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,4 +30,5 @@ export { ContractEventArgs, Web3Provider, ZeroExConfig, + TransactionReceipt, } from './types'; diff --git a/src/types.ts b/src/types.ts index 1aabe6e4f..b65ffda73 100644 --- a/src/types.ts +++ b/src/types.ts @@ -371,3 +371,5 @@ export interface JSONRPCPayload { export interface ZeroExConfig { gasPrice?: BigNumber.BigNumber; // Gas price to use with every transaction } + +export type TransactionReceipt = Web3.TransactionReceipt; -- cgit v1.2.3