Stringify gas estimate in backend, before it is serialized and sent to ui (#11266)

* Stringify gas estimate in backend, before it is serialized and sent to ui

* Fix send.utils.test.js
feature/default_network_editable
Dan J Miller 3 years ago committed by GitHub
parent a75092762f
commit 432d6508ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/scripts/metamask-controller.js
  2. 6
      ui/pages/send/send.utils.js
  3. 2
      ui/pages/send/send.utils.test.js

@ -1962,7 +1962,7 @@ export default class MetamaskController extends EventEmitter {
return reject(err);
}
return resolve(res);
return resolve(res.toString(16));
},
);
});

@ -253,11 +253,7 @@ async function estimateGasForSend({
// run tx
try {
const estimatedGas = await estimateGasMethod(paramsForGasEstimate);
const estimateWithBuffer = addGasBuffer(
estimatedGas.toString(16),
blockGasLimit,
1.5,
);
const estimateWithBuffer = addGasBuffer(estimatedGas, blockGasLimit, 1.5);
return addHexPrefix(estimateWithBuffer);
} catch (error) {
const simulationFailed =

@ -289,7 +289,7 @@ describe('send utils', () => {
if (typeof to === 'string' && to.match(/willFailBecauseOf:/u)) {
throw new Error(to.match(/:(.+)$/u)[1]);
}
return { toString: (n) => `0xabc${n}` };
return '0xabc16';
}),
};
const baseexpectedCall = {

Loading…
Cancel
Save