mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
fix transaction details screen
This commit is contained in:
parent
b4316581c8
commit
7f2b837c2e
3 changed files with 11 additions and 23 deletions
|
@ -119,13 +119,10 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.isEmpty) {
|
if (inputs.isEmpty) throw BitcoinTransactionNoInputsException();
|
||||||
throw BitcoinTransactionNoInputsException();
|
|
||||||
}
|
|
||||||
|
|
||||||
final int feeRate = transactionCredentials.feeRate != null
|
final int feeRate = transactionCredentials.feeRate ??
|
||||||
? transactionCredentials.feeRate!
|
BitcoinCashFeeRates.feeRate(transactionCredentials.priority!);
|
||||||
: BitcoinCashFeeRates.feeRate(transactionCredentials.priority!);
|
|
||||||
|
|
||||||
final int allAmountFee =
|
final int allAmountFee =
|
||||||
bitbox.BitcoinCash.getByteCount(inputs.length, transactionCredentials.outputs.length) *
|
bitbox.BitcoinCash.getByteCount(inputs.length, transactionCredentials.outputs.length) *
|
||||||
|
@ -145,8 +142,6 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
|
||||||
return acc + value.formattedCryptoAmount!;
|
return acc + value.formattedCryptoAmount!;
|
||||||
});
|
});
|
||||||
|
|
||||||
print(credentialsAmount);
|
|
||||||
|
|
||||||
if (allAmount - credentialsAmount < minAmount) {
|
if (allAmount - credentialsAmount < minAmount) {
|
||||||
throw BitcoinTransactionWrongBalanceException(currency);
|
throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
}
|
}
|
||||||
|
@ -164,9 +159,7 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
|
||||||
final output = outputs.first;
|
final output = outputs.first;
|
||||||
credentialsAmount = !output.sendAll ? output.formattedCryptoAmount! : 0;
|
credentialsAmount = !output.sendAll ? output.formattedCryptoAmount! : 0;
|
||||||
|
|
||||||
if (credentialsAmount > allAmount) {
|
if (credentialsAmount > allAmount) throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
throw BitcoinTransactionWrongBalanceException(currency);
|
|
||||||
}
|
|
||||||
|
|
||||||
amount = output.sendAll || allAmount - credentialsAmount < minAmount
|
amount = output.sendAll || allAmount - credentialsAmount < minAmount
|
||||||
? allAmount
|
? allAmount
|
||||||
|
@ -181,9 +174,7 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fee == 0) {
|
if (fee == 0) throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
throw BitcoinTransactionWrongBalanceException(currency);
|
|
||||||
}
|
|
||||||
|
|
||||||
final totalAmount = amount + fee;
|
final totalAmount = amount + fee;
|
||||||
|
|
||||||
|
@ -203,15 +194,11 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {
|
||||||
totalInputAmount += utx.value;
|
totalInputAmount += utx.value;
|
||||||
inputs.add(utx);
|
inputs.add(utx);
|
||||||
|
|
||||||
if (leftAmount <= 0) {
|
if (leftAmount <= 0) break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.isEmpty) {
|
if (inputs.isEmpty) throw BitcoinTransactionNoInputsException();
|
||||||
throw BitcoinTransactionNoInputsException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amount <= 0 || totalInputAmount < totalAmount) {
|
if (amount <= 0 || totalInputAmount < totalAmount) {
|
||||||
throw BitcoinTransactionWrongBalanceException(currency);
|
throw BitcoinTransactionWrongBalanceException(currency);
|
||||||
|
|
|
@ -325,9 +325,7 @@ abstract class SendViewModelBase with Store {
|
||||||
Object _credentials() {
|
Object _credentials() {
|
||||||
final priority = _settingsStore.priority[_wallet.type];
|
final priority = _settingsStore.priority[_wallet.type];
|
||||||
|
|
||||||
if (priority == null) {
|
if (priority == null) throw Exception('Priority is null for wallet type: ${_wallet.type}');
|
||||||
throw Exception('Priority is null for wallet type: ${_wallet.type}');
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (_wallet.type) {
|
switch (_wallet.type) {
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
|
|
|
@ -39,6 +39,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
break;
|
break;
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
|
case WalletType.bitcoinCash:
|
||||||
_addElectrumListItems(tx, dateFormat);
|
_addElectrumListItems(tx, dateFormat);
|
||||||
break;
|
break;
|
||||||
case WalletType.haven:
|
case WalletType.haven:
|
||||||
|
@ -111,6 +112,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
return 'https://mempool.space/tx/${txId}';
|
return 'https://mempool.space/tx/${txId}';
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
|
case WalletType.bitcoinCash:
|
||||||
return 'https://blockchair.com/litecoin/transaction/${txId}';
|
return 'https://blockchair.com/litecoin/transaction/${txId}';
|
||||||
case WalletType.haven:
|
case WalletType.haven:
|
||||||
return 'https://explorer.havenprotocol.org/search?value=${txId}';
|
return 'https://explorer.havenprotocol.org/search?value=${txId}';
|
||||||
|
@ -128,6 +130,7 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
return S.current.view_transaction_on + 'mempool.space';
|
return S.current.view_transaction_on + 'mempool.space';
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
|
case WalletType.bitcoinCash:
|
||||||
return S.current.view_transaction_on + 'Blockchair.com';
|
return S.current.view_transaction_on + 'Blockchair.com';
|
||||||
case WalletType.haven:
|
case WalletType.haven:
|
||||||
return S.current.view_transaction_on + 'explorer.havenprotocol.org';
|
return S.current.view_transaction_on + 'explorer.havenprotocol.org';
|
||||||
|
|
Loading…
Reference in a new issue