mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-26 15:41:29 +01:00
* Refactor Wallet import code The code for wallet import was incredibly messy as it evolved over time from various requests. This PR: * splits up each supported format into its own file * Supports taproot descriptors (through a hack until NBitcoin supports it internally) fixes #5518 * Reduces different paths for handling electrum/non-electrum xpubs * Allows plugins to add their own import support formats for onchain wallets. * Update NBitcoin to parse tr descriptors * Fix warnings * Use dedicated type OnChainWalletParsers --------- Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
21 lines
599 B
C#
21 lines
599 B
C#
#nullable enable
|
|
using System;
|
|
using BTCPayServer;
|
|
namespace BTCPayServer.Services.WalletFileParsing;
|
|
public class NBXDerivGenericWalletFileParser : IWalletFileParser
|
|
{
|
|
public (BTCPayServer.DerivationSchemeSettings? DerivationSchemeSettings, string? Error) TryParse(BTCPayNetwork network,
|
|
string data)
|
|
{
|
|
try
|
|
{
|
|
var result = BTCPayServer.DerivationSchemeSettings.Parse(data, network);
|
|
result.Source = "Generic";
|
|
return (result, null);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return (null, null);
|
|
}
|
|
}
|
|
}
|