Skip to content

Commit

Permalink
Fixes calling toHexString on undefined gasPrice
Browse files Browse the repository at this point in the history
Fixes web3#4902
  • Loading branch information
drub0y committed Mar 29, 2022
1 parent d46d922 commit b9ea1ed
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/web3-core-method/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Method.prototype.formatOutput = function (result) {
Method.prototype.toPayload = function (args) {
var call = this.getCall(args);
var callback = this.extractCallback(args);

var params = this.formatInput(args);
this.validateArgs(params);

Expand Down Expand Up @@ -455,7 +455,7 @@ Method.prototype._confirmTransaction = function (defer, result, payload) {
to: parsedTx.to,
from: parsedTx.from,
gas: parsedTx.gasLimit.toHexString(),
gasPrice: parsedTx.gasPrice.toHexString(),
gasPrice: parsedTx.gasPrice ? parsedTx.gasPrice.toHexString() : undefined,
value: parsedTx.value.toHexString()
});
}
Expand Down Expand Up @@ -551,20 +551,20 @@ Method.prototype._confirmTransaction = function (defer, result, payload) {

// start watching for confirmation depending on the support features of the provider
var startWatching = function (existingReceipt) {
let blockHeaderArrived = false;
let blockHeaderArrived = false;

const startInterval = () => {
intervalId = setInterval(checkConfirmation.bind(null, existingReceipt, true), method.transactionPollingInterval);
};

// If provider do not support event subscription use polling
if(!this.requestManager.provider.on) {
return startInterval();
return startInterval();
}

// Subscribe to new block headers to look for tx receipt
_ethereumCall.subscribe('newBlockHeaders', function (err, blockHeader, sub) {
blockHeaderArrived = true;
blockHeaderArrived = true;

if (err || !blockHeader) {
// fall back to polling
Expand Down Expand Up @@ -706,7 +706,7 @@ Method.prototype.buildCall = function () {
// SENDS the SIGNED SIGNATURE
var sendSignedTx = function (sign) {

var signedPayload = { ... payload,
var signedPayload = { ... payload,
method: 'eth_sendRawTransaction',
params: [sign.rawTransaction]
};
Expand Down

0 comments on commit b9ea1ed

Please sign in to comment.