Merge pull request #1177 from 0xProject/fix/web3-wrapper-transaction-type
Make getTransactionByHashAsync return the correct type
This commit is contained in:
commit
2110ac32b7
@ -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",
|
"version": "3.1.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -23,7 +23,13 @@ import {
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { marshaller } from './marshaller';
|
import { marshaller } from './marshaller';
|
||||||
import { BlockWithoutTransactionDataRPC, BlockWithTransactionDataRPC, NodeType, Web3WrapperErrors } from './types';
|
import {
|
||||||
|
BlockWithoutTransactionDataRPC,
|
||||||
|
BlockWithTransactionDataRPC,
|
||||||
|
NodeType,
|
||||||
|
TransactionRPC,
|
||||||
|
Web3WrapperErrors,
|
||||||
|
} from './types';
|
||||||
import { utils } from './utils';
|
import { utils } from './utils';
|
||||||
|
|
||||||
const BASE_TEN = 10;
|
const BASE_TEN = 10;
|
||||||
@ -228,10 +234,11 @@ export class Web3Wrapper {
|
|||||||
*/
|
*/
|
||||||
public async getTransactionByHashAsync(txHash: string): Promise<Transaction> {
|
public async getTransactionByHashAsync(txHash: string): Promise<Transaction> {
|
||||||
assert.isHexString('txHash', txHash);
|
assert.isHexString('txHash', txHash);
|
||||||
const transaction = await this.sendRawPayloadAsync<Transaction>({
|
const transactionRpc = await this.sendRawPayloadAsync<TransactionRPC>({
|
||||||
method: 'eth_getTransactionByHash',
|
method: 'eth_getTransactionByHash',
|
||||||
params: [txHash],
|
params: [txHash],
|
||||||
});
|
});
|
||||||
|
const transaction = marshaller.unmarshalTransaction(transactionRpc);
|
||||||
return transaction;
|
return transaction;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user