mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
20 lines
774 B
C#
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;
|
|
}
|
|
}
|