Get actual gasPrice from transaction instead of setting default

This commit is contained in:
Amir Bandeali
2018-07-18 13:31:29 -07:00
parent 4636d5fbc2
commit 0a976a3fb8
2 changed files with 48 additions and 35 deletions

View File

@@ -14,6 +14,7 @@ import {
Provider,
RawLogEntry,
TraceParams,
Transaction,
TransactionReceipt,
TransactionReceiptWithDecodedLogs,
TransactionTrace,
@@ -220,6 +221,19 @@ export class Web3Wrapper {
}
return transactionReceipt;
}
/**
* Retrieves the transaction data for a given transaction
* @param txHash Transaction hash
* @returns The raw transaction data
*/
public async getTransactionByHashAsync(txHash: string): Promise<Transaction> {
assert.isHexString('txHash', txHash);
const transaction = await this._sendRawPayloadAsync<Transaction>({
method: 'eth_getTransactionByHash',
params: [txHash],
});
return transaction;
}
/**
* Retrieves an accounts Ether balance in wei
* @param owner Account whose balance you wish to check