Skip to content

Commit 12078b7

Browse files
committed
fix spark change address getter
1 parent 0cbb45b commit 12078b7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/wallets/wallet/impl/firo_wallet.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class FiroWallet<T extends ElectrumXCurrencyInterface> extends Bip39HDWallet<T>
339339
output = output.copyWith(walletOwns: true);
340340
} else if (isSparkMint && isMySpark) {
341341
wasReceivedInThisWallet = true;
342-
if (output.addresses.contains(sparkChangeAddress.value)) {
342+
if (output.addresses.contains(sparkChangeAddress)) {
343343
changeAmountReceivedInThisWallet += output.value;
344344
} else {
345345
amountReceivedInThisWallet += output.value;

lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
112112
String? _viewKeyHex;
113113
String? get sparkViewKey => _viewKeyHex!;
114114

115-
// Really we should just send change back to the same address.
116-
late Address sparkChangeAddress;
115+
Address? _sparkChangeAddress;
116+
117+
String? get sparkChangeAddress => _sparkChangeAddress?.value;
117118

118119
bool get isTestNet {
119120
return cryptoCurrency.network.isTestNet;
@@ -331,7 +332,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
331332
}
332333

333334
_currentSparkAddress = address;
334-
sparkChangeAddress = await _generateSparkAddress(libSpark.sparkChange);
335+
_sparkChangeAddress = await _generateSparkAddress(libSpark.sparkChange);
335336
} catch (e, s) {
336337
// do nothing, still allow user into wallet
337338
Logging.instance.e("$runtimeType init() failed", error: e, stackTrace: s);
@@ -654,7 +655,7 @@ mixin SparkInterface<T extends ElectrumXCurrencyInterface>
654655
),
655656
memo: txData.sparkRecipients![i].memo,
656657
isChange:
657-
sparkChangeAddress.value == txData.sparkRecipients![i].address,
658+
_sparkChangeAddress!.value == txData.sparkRecipients![i].address,
658659
));
659660
}
660661

0 commit comments

Comments
 (0)