Merge pull request #1177 from 0xProject/fix/web3-wrapper-transaction-type

Make getTransactionByHashAsync return the correct type
This commit is contained in:
Alex Browne 2018-10-23 16:25:51 -07:00 committed by GitHub
commit 2110ac32b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -1,4 +1,14 @@
[
{
"version": "3.1.1",
"changes": [
{
"note":
"Fix bug in `getTransactionByHashAsync` which was causing the return value to have the wrong type (raw fields instead of unmarshalled fields).",
"pr": 1177
}
]
},
{
"version": "3.1.0",
"changes": [

View File

@ -23,7 +23,13 @@ import {
import * as _ from 'lodash';
import { marshaller } from './marshaller';
import { BlockWithoutTransactionDataRPC, BlockWithTransactionDataRPC, NodeType, Web3WrapperErrors } from './types';
import {
BlockWithoutTransactionDataRPC,
BlockWithTransactionDataRPC,
NodeType,
TransactionRPC,
Web3WrapperErrors,
} from './types';
import { utils } from './utils';
const BASE_TEN = 10;
@ -228,10 +234,11 @@ export class Web3Wrapper {
*/
public async getTransactionByHashAsync(txHash: string): Promise<Transaction> {
assert.isHexString('txHash', txHash);
const transaction = await this.sendRawPayloadAsync<Transaction>({
const transactionRpc = await this.sendRawPayloadAsync<TransactionRPC>({
method: 'eth_getTransactionByHash',
params: [txHash],
});
const transaction = marshaller.unmarshalTransaction(transactionRpc);
return transaction;
}
/**