2018-01-08 22:45:09 +09:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-05-08 20:37:37 +02:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
2018-01-08 22:45:09 +09:00
|
|
|
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
2018-04-12 11:48:33 +09:00
|
|
|
|
using NBitcoin;
|
2018-01-08 22:45:09 +09:00
|
|
|
|
|
|
|
|
|
namespace BTCPayServer.Models.StoreViewModels
|
|
|
|
|
{
|
|
|
|
|
public class DerivationSchemeViewModel
|
|
|
|
|
{
|
2020-04-13 08:48:35 +02:00
|
|
|
|
|
2018-01-08 22:45:09 +09:00
|
|
|
|
public DerivationSchemeViewModel()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
public string DerivationScheme
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-10 21:22:46 +09:00
|
|
|
|
public List<(string KeyPath, string Address, RootedKeyPath RootedKeyPath)> AddressSamples
|
2018-01-08 22:45:09 +09:00
|
|
|
|
{
|
|
|
|
|
get; set;
|
2019-12-10 21:22:46 +09:00
|
|
|
|
} = new List<(string KeyPath, string Address, RootedKeyPath RootedKeyPath)>();
|
2020-04-29 00:57:41 +09:00
|
|
|
|
|
2018-03-21 02:48:11 +09:00
|
|
|
|
public string CryptoCode { get; set; }
|
2018-12-26 14:04:00 +09:00
|
|
|
|
public string KeyPath { get; set; }
|
2019-05-10 01:05:37 +09:00
|
|
|
|
public string RootFingerprint { get; set; }
|
2018-03-24 20:40:26 +09:00
|
|
|
|
[Display(Name = "Hint address")]
|
|
|
|
|
public string HintAddress { get; set; }
|
2018-02-07 21:59:16 +09:00
|
|
|
|
public bool Confirmation { get; set; }
|
2018-07-27 13:37:16 +02:00
|
|
|
|
public bool Enabled { get; set; } = true;
|
2018-02-07 21:59:16 +09:00
|
|
|
|
|
2018-04-12 11:48:33 +09:00
|
|
|
|
public KeyPath RootKeyPath { get; set; }
|
2019-05-08 20:37:37 +02:00
|
|
|
|
|
|
|
|
|
[Display(Name = "Coldcard Wallet File")]
|
|
|
|
|
public IFormFile ColdcardPublicFile{ get; set; }
|
2019-05-09 16:11:09 +09:00
|
|
|
|
public string Config { get; set; }
|
2019-05-10 01:05:37 +09:00
|
|
|
|
public string Source { get; set; }
|
2019-05-25 12:53:03 +09:00
|
|
|
|
public string DerivationSchemeFormat { get; set; }
|
2019-05-10 19:30:10 +09:00
|
|
|
|
public string AccountKey { get; set; }
|
2019-05-25 02:45:36 +00:00
|
|
|
|
public BTCPayNetwork Network { get; set; }
|
2019-12-18 22:28:03 +09:00
|
|
|
|
public bool CanUseHotWallet { get; set; }
|
2020-04-13 08:48:35 +02:00
|
|
|
|
public bool CanUseRPCImport { get; set; }
|
2019-12-10 21:22:46 +09:00
|
|
|
|
|
|
|
|
|
public RootedKeyPath GetAccountKeypath()
|
|
|
|
|
{
|
|
|
|
|
if (KeyPath != null && RootFingerprint != null &&
|
|
|
|
|
NBitcoin.KeyPath.TryParse(KeyPath, out var p) &&
|
|
|
|
|
HDFingerprint.TryParse(RootFingerprint, out var fp))
|
|
|
|
|
{
|
|
|
|
|
return new RootedKeyPath(fp, p);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2018-01-08 22:45:09 +09:00
|
|
|
|
}
|
|
|
|
|
}
|