mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
87178b2a54
* fix coin freezing * fix frozen balance * update monero_c hash * update monero_c hash (after merge) * fix test E make it ready * revert local change * throw error on wow as well * experiment with view model code * move view model into di.dart
33 lines
992 B
Dart
33 lines
992 B
Dart
import 'package:cw_core/unspent_transaction_output.dart';
|
|
import 'package:cw_monero/api/coins_info.dart';
|
|
import 'package:monero/monero.dart' as monero;
|
|
|
|
class MoneroUnspent extends Unspent {
|
|
MoneroUnspent(
|
|
String address, String hash, String keyImage, int value, bool isFrozen, this.isUnlocked)
|
|
: super(address, hash, value, 0, keyImage) {
|
|
}
|
|
|
|
@override
|
|
set isFrozen(bool freeze) {
|
|
print("set isFrozen: $freeze ($keyImage): $freeze");
|
|
final coinId = getCoinByKeyImage(keyImage!);
|
|
if (coinId == null) throw Exception("Unable to find a coin for address $address");
|
|
if (freeze) {
|
|
freezeCoin(coinId);
|
|
} else {
|
|
thawCoin(coinId);
|
|
}
|
|
}
|
|
|
|
@override
|
|
bool get isFrozen {
|
|
print("get isFrozen");
|
|
final coinId = getCoinByKeyImage(keyImage!);
|
|
if (coinId == null) throw Exception("Unable to find a coin for address $address");
|
|
final coin = getCoin(coinId);
|
|
return monero.CoinsInfo_frozen(coin);
|
|
}
|
|
|
|
final bool isUnlocked;
|
|
}
|