aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-11-20 21:48:32 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-11-20 22:22:06 +0800
commit22cfdd9f0b5cd2b8d53384e16defc956570ccd6a (patch)
treee6b22283ae8855476ff6f372c106a7bee54e351c /packages/web3-wrapper/test
parent953f8c119b561eeb3463194494e6725869a68bec (diff)
downloaddexon-0x-contracts-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar
dexon-0x-contracts-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.gz
dexon-0x-contracts-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.bz2
dexon-0x-contracts-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.lz
dexon-0x-contracts-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.xz
dexon-0x-contracts-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.zst
dexon-0x-contracts-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.zip
Properly unmarshall TransactionReceiptRPC to TransactionReceipt
Diffstat (limited to 'packages/web3-wrapper/test')
-rw-r--r--packages/web3-wrapper/test/web3_wrapper_test.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/web3-wrapper/test/web3_wrapper_test.ts b/packages/web3-wrapper/test/web3_wrapper_test.ts
index 164253777..935c67636 100644
--- a/packages/web3-wrapper/test/web3_wrapper_test.ts
+++ b/packages/web3-wrapper/test/web3_wrapper_test.ts
@@ -1,5 +1,5 @@
import * as chai from 'chai';
-import { BlockParamLiteral, JSONRPCErrorCallback, JSONRPCRequestPayload } from 'ethereum-types';
+import { BlockParamLiteral, JSONRPCErrorCallback, JSONRPCRequestPayload, TransactionReceipt } from 'ethereum-types';
import * as Ganache from 'ganache-core';
import * as _ from 'lodash';
import 'mocha';
@@ -98,6 +98,18 @@ describe('Web3Wrapper tests', () => {
expect(typeof blockNumber).to.be.equal('number');
});
});
+ describe('#getTransactionReceiptAsync/awaitTransactionSuccessAsync', () => {
+ it('get block number', async () => {
+ const payload = { from: addresses[0], to: addresses[1], value: 1 };
+ const txHash = await web3Wrapper.sendTransactionAsync(payload);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ const receiptIfExists = await web3Wrapper.getTransactionReceiptIfExistsAsync(txHash);
+ expect(receiptIfExists).to.not.be.undefined();
+ const receipt = receiptIfExists as TransactionReceipt;
+ expect(receipt.transactionIndex).to.be.a('number');
+ expect(receipt.transactionHash).to.be.equal(txHash);
+ });
+ });
describe('#getBlockIfExistsAsync', () => {
it('gets block when supplied a valid BlockParamLiteral value', async () => {
const blockParamLiteral = BlockParamLiteral.Earliest;