| | | 1 | | namespace NLightning.Domain.Bitcoin.Wallet.Models; |
| | | 2 | | |
| | | 3 | | using Channels.ValueObjects; |
| | | 4 | | using Enums; |
| | | 5 | | using Money; |
| | | 6 | | using ValueObjects; |
| | | 7 | | |
| | | 8 | | public sealed class UtxoModel |
| | | 9 | | { |
| | 0 | 10 | | public TxId TxId { get; } |
| | 0 | 11 | | public uint Index { get; } |
| | 0 | 12 | | public LightningMoney Amount { get; } |
| | 0 | 13 | | public uint BlockHeight { get; } |
| | 0 | 14 | | public uint AddressIndex { get; private set; } |
| | 0 | 15 | | public bool IsAddressChange { get; private set; } |
| | 0 | 16 | | public AddressType AddressType { get; private set; } |
| | 0 | 17 | | public ChannelId? LockedToChannelId { get; set; } |
| | | 18 | | |
| | 0 | 19 | | public WalletAddressModel? WalletAddress { get; private set; } |
| | | 20 | | |
| | 0 | 21 | | public UtxoModel(TxId txId, uint index, LightningMoney amount, uint blockHeight, uint addressIndex, |
| | 0 | 22 | | bool isAddressChange, AddressType addressType) |
| | | 23 | | { |
| | 0 | 24 | | TxId = txId; |
| | 0 | 25 | | Index = index; |
| | 0 | 26 | | Amount = amount; |
| | 0 | 27 | | BlockHeight = blockHeight; |
| | 0 | 28 | | AddressIndex = addressIndex; |
| | 0 | 29 | | IsAddressChange = isAddressChange; |
| | 0 | 30 | | AddressType = addressType; |
| | 0 | 31 | | } |
| | | 32 | | |
| | 0 | 33 | | public UtxoModel(TxId txId, uint index, LightningMoney amount, uint blockHeight, WalletAddressModel walletAddress) |
| | | 34 | | { |
| | 0 | 35 | | TxId = txId; |
| | 0 | 36 | | Index = index; |
| | 0 | 37 | | Amount = amount; |
| | 0 | 38 | | BlockHeight = blockHeight; |
| | 0 | 39 | | SetWalletAddress(walletAddress); |
| | 0 | 40 | | } |
| | | 41 | | |
| | | 42 | | public void SetWalletAddress(WalletAddressModel walletAddress) |
| | | 43 | | { |
| | 0 | 44 | | WalletAddress = walletAddress; |
| | | 45 | | |
| | 0 | 46 | | AddressIndex = walletAddress.Index; |
| | 0 | 47 | | IsAddressChange = walletAddress.IsChange; |
| | 0 | 48 | | AddressType = walletAddress.AddressType; |
| | 0 | 49 | | } |
| | | 50 | | } |