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:
parent
523c04b47a
commit
3af174b590
@ -1937,7 +1937,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolve(res);
|
return resolve(res.toString(16));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -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 =
|
||||||
|
@ -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 = {
|
||||||
|
Loading…
Reference in New Issue
Block a user