2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
2023-10-12 22:50:16 +00:00
|
|
|
import 'package:cw_core/unspent_transaction_output.dart';
|
2023-11-30 17:28:29 +00:00
|
|
|
import 'package:bitcoin_flutter/bitcoin_flutter.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
class BitcoinUnspent extends Unspent {
|
2023-11-30 10:01:58 +00:00
|
|
|
BitcoinUnspent(BitcoinAddressRecord addressRecord, String hash, int value, int vout,
|
2023-11-30 17:28:29 +00:00
|
|
|
{this.silentPaymentTweak, this.type})
|
2023-10-12 22:50:16 +00:00
|
|
|
: bitcoinAddressRecord = addressRecord,
|
|
|
|
super(addressRecord.address, hash, value, vout, null);
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2023-11-30 10:01:58 +00:00
|
|
|
factory BitcoinUnspent.fromJSON(BitcoinAddressRecord address, Map<String, dynamic> json) =>
|
|
|
|
BitcoinUnspent(
|
2023-11-30 17:28:29 +00:00
|
|
|
address,
|
|
|
|
json['tx_hash'] as String,
|
|
|
|
json['value'] as int,
|
|
|
|
json['tx_pos'] as int,
|
|
|
|
silentPaymentTweak: json['silent_payment_tweak'] as String?,
|
|
|
|
type: json['type'] == null ? null : AddressType.values[json['type'] as int],
|
|
|
|
);
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
final BitcoinAddressRecord bitcoinAddressRecord;
|
2023-11-30 10:01:58 +00:00
|
|
|
String? silentPaymentTweak;
|
2023-11-30 17:28:29 +00:00
|
|
|
AddressType? type;
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|