mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
init work
This commit is contained in:
@@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NBitcoin;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
using NBXplorer.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -319,6 +320,31 @@ namespace BTCPayServer.Controllers
|
||||
return ShowAddresses(vm, strategy);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("{storeId}/derivations/{cryptoCode}/generatenbxwallet")]
|
||||
public async Task<IActionResult> GenerateNBXWallet(string storeId, string cryptoCode, GenerateWalletRequest request)
|
||||
{
|
||||
var network = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
||||
var client = _ExplorerProvider.GetExplorerClient(cryptoCode);
|
||||
var response = await client.GenerateWalletAsync(request);
|
||||
var result = await AddDerivationScheme(storeId, new DerivationSchemeViewModel()
|
||||
{
|
||||
Confirmation = false,
|
||||
Network = network,
|
||||
RootFingerprint = response.AccountKeyPath.MasterFingerprint.ToString(),
|
||||
RootKeyPath = response.AccountKeyPath.KeyPath,
|
||||
CryptoCode = cryptoCode,
|
||||
DerivationScheme = response.DerivationScheme.ToString(),
|
||||
Source = "NBXplorer",
|
||||
AccountKey = response.AccountHDKey.ToWif(),
|
||||
DerivationSchemeFormat = "BTCPay",
|
||||
KeyPath = response.AccountKeyPath.KeyPath.ToString(),
|
||||
Enabled = true
|
||||
}, cryptoCode);
|
||||
((ViewResult)result).ViewName = nameof(AddDerivationScheme);
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<string> ReadAllText(IFormFile file)
|
||||
{
|
||||
using (var stream = new StreamReader(file.OpenReadStream()))
|
||||
|
||||
Reference in New Issue
Block a user