mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
fix for '0' gasPrice from web3
if i had some accounts already saved and initSendForm requested "gasPrice" from web3 which didn't exists in this moment yet, returned value was '0'. This commit fixes that by returning defaultGasPrice instead of '0' and also initializes web3 during Backend.subscribe (before account is shown)
This commit is contained in:
parent
ac0b9508de
commit
647d196e1e
@ -57,7 +57,7 @@ export const getTokenBalance = (token: Token): PromiseAction<string> => async (d
|
||||
export const getGasPrice = (network: string, defaultGasPrice: number): PromiseAction<BigNumber> => async (dispatch: Dispatch): Promise<BigNumber> => {
|
||||
try {
|
||||
const gasPrice = await dispatch(Web3Actions.getCurrentGasPrice(network));
|
||||
return new BigNumber(gasPrice);
|
||||
return gasPrice === '0' ? new BigNumber(defaultGasPrice) : new BigNumber(gasPrice);
|
||||
} catch (error) {
|
||||
return new BigNumber(defaultGasPrice);
|
||||
}
|
||||
@ -175,6 +175,8 @@ export const subscribe = (network: string): PromiseAction<void> => async (dispat
|
||||
accounts: [],
|
||||
coin: network,
|
||||
});
|
||||
// init web3 instance if not exists
|
||||
await dispatch(Web3Actions.initWeb3(network));
|
||||
};
|
||||
|
||||
// Conditionally subscribe to blockchain backend
|
||||
|
Loading…
Reference in New Issue
Block a user