1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

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
This commit is contained in:
Dan J Miller 2021-06-09 22:18:05 -02:30 committed by ryanml
parent 523c04b47a
commit 3af174b590
3 changed files with 3 additions and 7 deletions

View File

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

View File

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

View File

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