2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
|
|
|
|
|
|
|
class BitcoinUnspent {
|
2023-10-06 15:20:45 +00:00
|
|
|
BitcoinUnspent(this.address, this.hash, this.value, this.vout, {bool? isSilent})
|
2021-12-24 12:52:08 +00:00
|
|
|
: isSending = true,
|
|
|
|
isFrozen = false,
|
2023-10-06 15:20:45 +00:00
|
|
|
note = '',
|
|
|
|
isSilent = isSilent ?? false;
|
2021-12-24 12:52:08 +00:00
|
|
|
|
2023-10-06 15:20:45 +00:00
|
|
|
factory BitcoinUnspent.fromJSON(BitcoinAddressRecord address, Map<String, dynamic> json,
|
|
|
|
{bool? isSilent}) =>
|
|
|
|
BitcoinUnspent(
|
|
|
|
address, json['tx_hash'] as String, json['value'] as int, json['tx_pos'] as int,
|
|
|
|
isSilent: isSilent);
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
final BitcoinAddressRecord address;
|
|
|
|
final String hash;
|
|
|
|
final int value;
|
|
|
|
final int vout;
|
|
|
|
|
|
|
|
bool get isP2wpkh =>
|
2023-10-06 15:20:45 +00:00
|
|
|
address.address.startsWith('bc') ||
|
|
|
|
// testnet
|
|
|
|
address.address.startsWith('tb') ||
|
|
|
|
address.address.startsWith('ltc');
|
2021-12-24 12:52:08 +00:00
|
|
|
bool isSending;
|
|
|
|
bool isFrozen;
|
2023-10-06 15:20:45 +00:00
|
|
|
bool isSilent;
|
2021-12-24 12:52:08 +00:00
|
|
|
String note;
|
|
|
|
}
|