btcpayserver/BTCPayServer/Services/WalletFileParsing/NBXDerivGenericWalletFileParser.cs

21 lines
794 B
C#
Raw Normal View History

#nullable enable
using System.Diagnostics.CodeAnalysis;
namespace BTCPayServer.Services.WalletFileParsing;
public class NBXDerivGenericWalletFileParser : IWalletFileParser
{
public bool TryParse(BTCPayNetwork network, string data, [MaybeNullWhen(false)] out DerivationSchemeSettings derivationSchemeSettings)
{
var result = new DerivationSchemeSettings { Network = network };
var parser = network.GetDerivationSchemeParser();
if (parser.TryParseXpub(data, ref result, electrum: true) ||
parser.TryParseXpub(data, ref result))
{
derivationSchemeSettings = result;
derivationSchemeSettings.Source = "GenericFile";
return true;
}
derivationSchemeSettings = null;
return false;
}
}