btcpayserver/BTCPayServer/Services/WalletFileParsing/NBXDerivGenericWalletFileParser.cs
2024-04-04 16:31:04 +09:00

20 lines
774 B
C#

#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();
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;
}
}