use final

This commit is contained in:
julian 2024-05-06 18:25:10 -06:00
parent accc9a9b4e
commit 309a483026
2 changed files with 16 additions and 15 deletions

View file

@ -62,14 +62,15 @@ class FiroWallet extends Bip39HDWallet
@override @override
Future<void> updateTransactions() async { Future<void> updateTransactions() async {
List<Address> allAddressesOld = await fetchAddressesForElectrumXScan(); final List<Address> allAddressesOld =
await fetchAddressesForElectrumXScan();
Set<String> receivingAddresses = allAddressesOld final Set<String> receivingAddresses = allAddressesOld
.where((e) => e.subType == AddressSubType.receiving) .where((e) => e.subType == AddressSubType.receiving)
.map((e) => convertAddressString(e.value)) .map((e) => convertAddressString(e.value))
.toSet(); .toSet();
Set<String> changeAddresses = allAddressesOld final Set<String> changeAddresses = allAddressesOld
.where((e) => e.subType == AddressSubType.change) .where((e) => e.subType == AddressSubType.change)
.map((e) => convertAddressString(e.value)) .map((e) => convertAddressString(e.value))
.toSet(); .toSet();
@ -98,7 +99,7 @@ class FiroWallet extends Bip39HDWallet
} }
} }
List<Map<String, dynamic>> allTransactions = []; final List<Map<String, dynamic>> allTransactions = [];
// some lelantus transactions aren't fetched via wallet addresses so they // some lelantus transactions aren't fetched via wallet addresses so they
// will never show as confirmed in the gui. // will never show as confirmed in the gui.
@ -177,7 +178,7 @@ class FiroWallet extends Bip39HDWallet
bool isMint = false; bool isMint = false;
bool isJMint = false; bool isJMint = false;
bool isSparkMint = false; bool isSparkMint = false;
bool isMasterNodePayment = false; final bool isMasterNodePayment = false;
final bool isSparkSpend = txData["type"] == 9 && txData["version"] == 3; final bool isSparkSpend = txData["type"] == 9 && txData["version"] == 3;
final bool isMySpark = sparkTxids.contains(txData["txid"] as String); final bool isMySpark = sparkTxids.contains(txData["txid"] as String);
@ -555,7 +556,7 @@ class FiroWallet extends Bip39HDWallet
Map<String, dynamic>? jsonTX, Map<String, dynamic>? jsonTX,
String? utxoOwnerAddress, String? utxoOwnerAddress,
) async { ) async {
bool blocked = false; final bool blocked = false;
String? blockedReason; String? blockedReason;
// //
// if (jsonTX != null) { // if (jsonTX != null) {

View file

@ -193,8 +193,8 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
.log('utxoObjectsToUse: $utxoObjectsToUse', level: LogLevel.Info); .log('utxoObjectsToUse: $utxoObjectsToUse', level: LogLevel.Info);
// numberOfOutputs' length must always be equal to that of recipientsArray and recipientsAmtArray // numberOfOutputs' length must always be equal to that of recipientsArray and recipientsAmtArray
List<String> recipientsArray = [recipientAddress]; final List<String> recipientsArray = [recipientAddress];
List<int> recipientsAmtArray = [satoshiAmountToSend]; final List<int> recipientsAmtArray = [satoshiAmountToSend];
// gather required signing data // gather required signing data
final utxoSigningData = await fetchBuildTxData(utxoObjectsToUse); final utxoSigningData = await fetchBuildTxData(utxoObjectsToUse);
@ -325,7 +325,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
feeForOneOutput + cryptoCurrency.dustLimit.raw.toInt()) { feeForOneOutput + cryptoCurrency.dustLimit.raw.toInt()) {
// Here, we know that theoretically, we may be able to include another output(change) but we first need to // Here, we know that theoretically, we may be able to include another output(change) but we first need to
// factor in the value of this output in satoshis. // factor in the value of this output in satoshis.
int changeOutputSize = final int changeOutputSize =
satoshisBeingUsed - satoshiAmountToSend - feeForTwoOutputs; satoshisBeingUsed - satoshiAmountToSend - feeForTwoOutputs;
// We check to see if the user can pay for the new transaction with 2 outputs instead of one. If they can and // We check to see if the user can pay for the new transaction with 2 outputs instead of one. If they can and
// the second output's size > cryptoCurrency.dustLimit satoshis, we perform the mechanics required to properly generate and use a new // the second output's size > cryptoCurrency.dustLimit satoshis, we perform the mechanics required to properly generate and use a new
@ -370,7 +370,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
// make sure minimum fee is accurate if that is being used // make sure minimum fee is accurate if that is being used
if (txn.vSize! - feeBeingPaid == 1) { if (txn.vSize! - feeBeingPaid == 1) {
int changeOutputSize = final int changeOutputSize =
satoshisBeingUsed - satoshiAmountToSend - txn.vSize!; satoshisBeingUsed - satoshiAmountToSend - txn.vSize!;
feeBeingPaid = feeBeingPaid =
satoshisBeingUsed - satoshiAmountToSend - changeOutputSize; satoshisBeingUsed - satoshiAmountToSend - changeOutputSize;
@ -526,7 +526,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
List<UTXO> utxosToUse, List<UTXO> utxosToUse,
) async { ) async {
// return data // return data
List<SigningData> signingData = []; final List<SigningData> signingData = [];
try { try {
// Populating the addresses to check // Populating the addresses to check
@ -879,7 +879,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
DerivePathType type, DerivePathType type,
int chain, int chain,
) async { ) async {
List<Address> addressArray = []; final List<Address> addressArray = [];
int gapCounter = 0; int gapCounter = 0;
int highestIndexWithHistory = 0; int highestIndexWithHistory = 0;
@ -891,7 +891,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
"index: $index, \t GapCounter $chain ${type.name}: $gapCounter", "index: $index, \t GapCounter $chain ${type.name}: $gapCounter",
level: LogLevel.Info); level: LogLevel.Info);
List<String> txCountCallArgs = []; final List<String> txCountCallArgs = [];
for (int j = 0; j < txCountBatchSize; j++) { for (int j = 0; j < txCountBatchSize; j++) {
final derivePath = cryptoCurrency.constructDerivePath( final derivePath = cryptoCurrency.constructDerivePath(
@ -960,7 +960,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
DerivePathType type, DerivePathType type,
int chain, int chain,
) async { ) async {
List<Address> addressArray = []; final List<Address> addressArray = [];
int gapCounter = 0; int gapCounter = 0;
int index = 0; int index = 0;
for (; for (;
@ -1023,7 +1023,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
Iterable<String> allAddresses, Iterable<String> allAddresses,
) async { ) async {
try { try {
List<Map<String, dynamic>> allTxHashes = []; final List<Map<String, dynamic>> allTxHashes = [];
if (serverCanBatch) { if (serverCanBatch) {
final Map<int, List<List<dynamic>>> batches = {}; final Map<int, List<List<dynamic>>> batches = {};