cake_wallet/cw_zano/lib/model/pending_zano_transaction.dart
Czarek Nakamoto bea81d2c67
call sync call in isolate to make it async
generate framework for iOS as well
fix UR issues
2024-11-11 08:30:32 -05:00

52 lines
1.3 KiB
Dart

import 'package:cw_core/pending_transaction.dart';
import 'package:cw_zano/api/model/destination.dart';
import 'package:cw_zano/api/model/transfer_result.dart';
import 'package:cw_zano/zano_formatter.dart';
import 'package:cw_zano/zano_wallet.dart';
class PendingZanoTransaction with PendingTransaction {
PendingZanoTransaction({
required this.zanoWallet,
required this.destinations,
required this.fee,
required this.comment,
required this.assetId,
required this.ticker,
this.decimalPoint = ZanoFormatter.defaultDecimalPoint,
required this.amount,
});
final ZanoWalletBase zanoWallet;
final List<Destination> destinations;
final BigInt fee;
final String comment;
final String assetId;
final String ticker;
final int decimalPoint;
final BigInt amount;
@override
String get id => transferResult?.txHash ?? '';
@override
String get hex => '';
@override
String get amountFormatted => '${ZanoFormatter.bigIntAmountToString(amount, decimalPoint)} $ticker';
@override
String get feeFormatted => '${ZanoFormatter.bigIntAmountToString(fee)} ZANO';
TransferResult? transferResult;
@override
Future<void> commit() async {
await zanoWallet.transfer(destinations, fee, comment);
zanoWallet.fetchTransactions();
}
@override
Future<String?> commitUR() {
throw UnimplementedError();
}
}