fix: Remove full balance

This commit is contained in:
Blazebrain 2024-07-25 11:32:01 +01:00
parent 139bcb75ea
commit ea3da361d6
8 changed files with 3 additions and 43 deletions

View file

@ -43,16 +43,6 @@ class ElectrumBalance extends Balance {
return frozenFormatted == '0.0' ? '' : frozenFormatted; return frozenFormatted == '0.0' ? '' : frozenFormatted;
} }
@override
String get formattedFullBalance {
bool isOutgoingTx = unconfirmed.isNegative;
final fullBalance =
isOutgoingTx ? (confirmed + frozen) : (confirmed + (unconfirmed.abs()) + frozen);
final result = bitcoinAmountToString(amount: fullBalance);
return result;
}
String toJSON() => String toJSON() =>
json.encode({'confirmed': confirmed, 'unconfirmed': unconfirmed, 'frozen': frozen}); json.encode({'confirmed': confirmed, 'unconfirmed': unconfirmed, 'frozen': frozen});
} }

View file

@ -7,7 +7,7 @@ abstract class Balance {
String get formattedAvailableBalance; String get formattedAvailableBalance;
String get formattedAdditionalBalance => ''; String get formattedAdditionalBalance;
String get formattedUnAvailableBalance => ''; String get formattedUnAvailableBalance => '';
} }

View file

@ -16,9 +16,6 @@ class EVMChainERC20Balance extends Balance {
@override @override
String get formattedAvailableBalance => _balance(); String get formattedAvailableBalance => _balance();
@override
String get formattedFullBalance => _balance();
String _balance() { String _balance() {
final String formattedBalance = (balance / BigInt.from(10).pow(exponent)).toString(); final String formattedBalance = (balance / BigInt.from(10).pow(exponent)).toString();
return formattedBalance.substring(0, min(12, formattedBalance.length)); return formattedBalance.substring(0, min(12, formattedBalance.length));

View file

@ -32,14 +32,4 @@ class BananoBalance extends Balance {
String get formattedAdditionalBalance { String get formattedAdditionalBalance {
return NanoAmounts.getRawAsUsableString(receivableBalance.toString(), NanoAmounts.rawPerBanano); return NanoAmounts.getRawAsUsableString(receivableBalance.toString(), NanoAmounts.rawPerBanano);
} }
@override
String get formattedFullBalance {
final totalBalanceInDouble = currentBalance.toDouble() + receivableBalance.toDouble();
return NanoAmounts.getRawAsUsableString(
(totalBalanceInDouble).toString(),
NanoAmounts.rawPerBanano,
);
}
} }

View file

@ -31,14 +31,4 @@ class NanoBalance extends Balance {
String get formattedAdditionalBalance { String get formattedAdditionalBalance {
return NanoAmounts.getRawAsUsableString(receivableBalance.toString(), NanoAmounts.rawPerNano); return NanoAmounts.getRawAsUsableString(receivableBalance.toString(), NanoAmounts.rawPerNano);
} }
@override
String get formattedFullBalance {
final totalBalanceInDouble = currentBalance.toDouble() + receivableBalance.toDouble();
return NanoAmounts.getRawAsUsableString(
(totalBalanceInDouble).toString(),
NanoAmounts.rawPerNano,
);
}
} }

View file

@ -13,9 +13,6 @@ class SolanaBalance extends Balance {
@override @override
String get formattedAvailableBalance => _balanceFormatted(); String get formattedAvailableBalance => _balanceFormatted();
@override
String get formattedFullBalance => _balanceFormatted();
String _balanceFormatted() { String _balanceFormatted() {
String stringBalance = balance.toString(); String stringBalance = balance.toString();
if (stringBalance.toString().length >= 12) { if (stringBalance.toString().length >= 12) {

View file

@ -31,7 +31,4 @@ class TronBalance extends Balance {
return TronBalance(BigInt.zero); return TronBalance(BigInt.zero);
} }
} }
@override
String get formattedFullBalance => TronHelper.fromSun(balance);
} }

View file

@ -235,12 +235,11 @@ class CryptoBalanceWidget extends StatelessWidget {
'${dashboardViewModel.balanceViewModel.additionalBalanceLabel}', '${dashboardViewModel.balanceViewModel.additionalBalanceLabel}',
additionalBalance: balance.additionalBalance, additionalBalance: balance.additionalBalance,
additionalFiatBalance: balance.fiatAdditionalBalance, additionalFiatBalance: balance.fiatAdditionalBalance,
hasAdditionalBalance:
dashboardViewModel.balanceViewModel.hasAdditionalBalance,
frozenBalance: balance.frozenBalance, frozenBalance: balance.frozenBalance,
frozenFiatBalance: balance.fiatFrozenBalance, frozenFiatBalance: balance.fiatFrozenBalance,
currency: balance.asset, currency: balance.asset,
hasAdditionalBalance:
dashboardViewModel.balanceViewModel.hasAdditionalBalance,
isTestnet: dashboardViewModel.isTestnet, isTestnet: dashboardViewModel.isTestnet,
); );
}); });