/// <summary> /// Filter the coins which contains a HD Key path matching this master root key /// </summary> /// <param name="masterKey">The master root key</param> /// <returns>Inputs with HD keys matching master root key</returns> public IEnumerable <PSBTCoin> CoinsFor(IHDKey masterKey) { if (masterKey == null) { throw new ArgumentNullException(nameof(masterKey)); } return(Inputs.CoinsFor(masterKey).OfType <PSBTCoin>().Concat(Outputs.CoinsFor(masterKey).OfType <PSBTCoin>())); }
/// <summary> /// Filter the coins which contains the <paramref name="accountKey"/> and <paramref name="accountKeyPath"/> in the HDKeys and derive /// the same scriptPubKeys as <paramref name="accountHDScriptPubKey"/>. /// </summary> /// <param name="accountHDScriptPubKey">The hdScriptPubKey used to generate addresses</param> /// <param name="accountKey">The account key that will be used to sign (ie. 49'/0'/0')</param> /// <param name="accountKeyPath">The account key path</param> /// <returns>Inputs with HD keys matching masterFingerprint and account key</returns> public IEnumerable <PSBTCoin> CoinsFor(IHDScriptPubKey accountHDScriptPubKey, IHDKey accountKey, RootedKeyPath accountKeyPath = null) { if (accountKey == null) { throw new ArgumentNullException(nameof(accountKey)); } if (accountHDScriptPubKey == null) { throw new ArgumentNullException(nameof(accountHDScriptPubKey)); } accountHDScriptPubKey = accountHDScriptPubKey.AsHDKeyCache(); accountKey = accountKey.AsHDKeyCache(); return(Inputs.CoinsFor(accountHDScriptPubKey, accountKey, accountKeyPath).OfType <PSBTCoin>().Concat(Outputs.CoinsFor(accountHDScriptPubKey, accountKey, accountKeyPath).OfType <PSBTCoin>())); }
/// <summary> /// Filter the coins which contains a HD Key path matching this masterFingerprint/account key /// </summary> /// <param name="masterFingerprint">The master root fingerprint</param> /// <param name="accountKey">The account key (ie. 49'/0'/0')</param> /// <returns>Inputs with HD keys matching masterFingerprint and account key</returns> public IEnumerable <PSBTCoin> CoinsFor(HDFingerprint?masterFingerprint, IHDKey accountKey) { if (accountKey == null) { throw new ArgumentNullException(nameof(accountKey)); } return(Inputs.CoinsFor(masterFingerprint, accountKey).OfType <PSBTCoin>().Concat(Outputs.CoinsFor(masterFingerprint, accountKey).OfType <PSBTCoin>())); }