2026-06-15 14:20:10 +02:00
|
|
|
using NBitcoin;
|
|
|
|
|
using PalladiumWallet.Core.Chain;
|
|
|
|
|
|
|
|
|
|
namespace PalladiumWallet.Core.Crypto;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-06-16 14:40:06 +02:00
|
|
|
/// Abstraction over all wallet account types (HD from seed, HD from imported xpub/xprv,
|
|
|
|
|
/// imported WIF keys). Allows WalletSynchronizer and TransactionFactory to operate
|
|
|
|
|
/// independently of the underlying keystore type (blueprint §4.4–§4.5).
|
2026-06-15 14:20:10 +02:00
|
|
|
/// </summary>
|
|
|
|
|
public interface IWalletAccount
|
|
|
|
|
{
|
|
|
|
|
ScriptKind Kind { get; }
|
|
|
|
|
ChainProfile Profile { get; }
|
|
|
|
|
|
2026-06-16 14:40:06 +02:00
|
|
|
/// <summary>True if the account cannot sign (no private keys present).</summary>
|
2026-06-15 14:20:10 +02:00
|
|
|
bool IsWatchOnly { get; }
|
|
|
|
|
|
|
|
|
|
BitcoinAddress GetAddress(bool isChange, int index);
|
|
|
|
|
BitcoinAddress GetReceiveAddress(int index);
|
|
|
|
|
BitcoinAddress GetChangeAddress(int index);
|
|
|
|
|
|
2026-06-16 14:40:06 +02:00
|
|
|
/// <summary>Null if the public key cannot be derived from the account (pure watch-only addresses).</summary>
|
2026-06-15 14:20:10 +02:00
|
|
|
PubKey? GetPublicKey(bool isChange, int index);
|
|
|
|
|
|
2026-06-16 14:40:06 +02:00
|
|
|
/// <summary>Null if the account is watch-only or the index is out of range.</summary>
|
2026-06-15 14:20:10 +02:00
|
|
|
Key? GetPrivateKey(bool isChange, int index);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-06-16 14:40:06 +02:00
|
|
|
/// For accounts with fixed addresses (imported WIF keys) returns the full list
|
|
|
|
|
/// to scan; null for HD accounts that use the gap limit.
|
2026-06-15 14:20:10 +02:00
|
|
|
/// </summary>
|
|
|
|
|
IReadOnlyList<(BitcoinAddress Address, bool IsChange, int Index)>? FixedAddresses { get; }
|
|
|
|
|
}
|