mirror of
https://github.com/status-im/status-react.git
synced 2025-01-10 19:16:59 +00:00
Be more defensive when checking user balance
This commit is contained in:
parent
9ab7ebdcf2
commit
e2f36d4935
@ -321,7 +321,20 @@ function validateSend(params, context) {
|
||||
};
|
||||
}
|
||||
|
||||
var balance = web3.eth.getBalance(context.from);
|
||||
try {
|
||||
var balance = web3.eth.getBalance(context.from);
|
||||
if (isNaN(balance)) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch (err) {
|
||||
return {
|
||||
markup: status.components.validationMessage(
|
||||
I18n.t('validation_internal_title'),
|
||||
I18n.t('validation_balance')
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
var fee = calculateFee(
|
||||
params["bot-db"]["sliderValue"],
|
||||
{
|
||||
|
@ -22,6 +22,8 @@ I18n.translations = {
|
||||
request_requesting: 'Requesting ',
|
||||
request_requesting_from: 'from ',
|
||||
|
||||
validation_internal_title: 'Internal error',
|
||||
validation_balance: 'Could not fetch current balance',
|
||||
validation_title: 'Amount',
|
||||
validation_tx_title: 'Transaction',
|
||||
validation_tx_failed: 'Transaction failed',
|
||||
|
Loading…
x
Reference in New Issue
Block a user