1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-28 03:08:30 +00:00

fix: change fee level while sending tx with data

This commit is contained in:
Szymon Lesisz 2018-05-21 14:00:20 +02:00
parent fd2eb58e22
commit 2aa77610e0

View File

@ -590,7 +590,11 @@ export const onFeeLevelChange = (feeLevel: FeeLevel): ThunkAction => {
if (customLevel) if (customLevel)
customLevel.label = ''; customLevel.label = '';
state.gasPrice = feeLevel.gasPrice; state.gasPrice = feeLevel.gasPrice;
state.gasLimit = isToken ? coin.defaultGasLimitTokens.toString() : coin.defaultGasLimit.toString(); if (isToken) {
state.gasLimit = coin.defaultGasLimitTokens.toString()
} else {
state.gasLimit = state.data.length > 0 ? state.gasLimit : coin.defaultGasLimit.toString();
}
} }
if (currentState.setMax) { if (currentState.setMax) {
@ -817,7 +821,7 @@ const estimateGasPrice = (): AsyncAction => {
const data: string = '0x' + (currentState.data.length % 2 === 0 ? currentState.data : '0' + currentState.data); const data: string = '0x' + (currentState.data.length % 2 === 0 ? currentState.data : '0' + currentState.data);
const gasLimit = await estimateGas(web3instance.web3, { const gasLimit = await estimateGas(web3instance.web3, {
to: '0xdb6e09ddca62d0959dc4725697e66b8152222aee', // TODO: real adress to: '0x0000000000000000000000000000000000000000',
data, data,
value: web3.toHex(web3.toWei(currentState.amount, 'ether')), value: web3.toHex(web3.toWei(currentState.amount, 'ether')),
gasPrice: web3.toHex( EthereumjsUnits.convert(currentState.gasPrice, 'gwei', 'wei') ), gasPrice: web3.toHex( EthereumjsUnits.convert(currentState.gasPrice, 'gwei', 'wei') ),