Compare commits
60 Commits
v1.0.3.144
...
v1.0.3.145
Author | SHA1 | Date | |
---|---|---|---|
b8f6ef8844 | |||
6f6b4c8ead | |||
5d87dd5861 | |||
02c8bf4469 | |||
540cb912f3 | |||
93f490f570 | |||
de2e222ae5 | |||
12055a000b | |||
6addb3e481 | |||
d9cd916440 | |||
452a705b75 | |||
1c8206c749 | |||
062c42e524 | |||
2d932ebb21 | |||
0e0fa53517 | |||
4e20730379 | |||
1d70d935b8 | |||
9b8f42cdf6 | |||
eb85b1a7b4 | |||
df7e2073df | |||
84d943d6cc | |||
a1d82b0e8b | |||
ab7c124302 | |||
544597348b | |||
1559c510be | |||
3e08581e9b | |||
49c70d9b04 | |||
50e7d8389c | |||
ea5bd6d435 | |||
cbb37674e3 | |||
e70d5ceb08 | |||
5d7b253edd | |||
df38b84bbb | |||
a3fc75ea3b | |||
71a8166027 | |||
564dd95d81 | |||
eb16b435df | |||
f94daed06d | |||
e841bfa148 | |||
03b76380e7 | |||
c6671f7122 | |||
db56c2b106 | |||
f7b2c836b7 | |||
6ec379b538 | |||
d6e1d34ebf | |||
bc2a039ea2 | |||
e31e600144 | |||
91f83d751f | |||
b8288f1efa | |||
fa61c2bcdd | |||
2d168e1d9b | |||
3e7ad4a4f6 | |||
d2357ee8b9 | |||
9f04c7d0bc | |||
9baa7eed80 | |||
287fbc523f | |||
ea6df35c87 | |||
2e0db1a430 | |||
7ccf0c3612 | |||
84bbbcbe10 |
@ -3,8 +3,8 @@
|
||||
<Import Project="../Build/Common.csproj" />
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.14" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
|
||||
<PackageReference Include="NBXplorer.Client" Version="2.0.0.26" />
|
||||
<PackageReference Include="NBXplorer.Client" Version="3.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -2,9 +2,9 @@
|
||||
<Import Project="../Build/Version.csproj" Condition="Exists('../Build/Version.csproj')" />
|
||||
<Import Project="../Build/Common.csproj" />
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" AllowExplicitVersion="true" Version="2.1.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" AllowExplicitVersion="true" Version="2.1.14" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.14" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.4" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.1.2" />
|
||||
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="3.0.0-alpha1.19515.63" />
|
||||
</ItemGroup>
|
||||
|
@ -7,7 +7,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.14" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.3.1" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1.505-alpine3.7 AS builder
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1.607-alpine3.9 AS builder
|
||||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false
|
||||
RUN apk add --no-cache icu-libs
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
@ -76,7 +76,7 @@ services:
|
||||
- customer_lnd
|
||||
- merchant_lnd
|
||||
nbxplorer:
|
||||
image: nicolasdorier/nbxplorer:2.0.0.66
|
||||
image: nicolasdorier/nbxplorer:2.1.2
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "32838:32838"
|
||||
|
@ -27,7 +27,7 @@
|
||||
<EmbeddedResource Include="Currencies.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BTCPayServer.Hwi" Version="1.1.2" />
|
||||
<PackageReference Include="BTCPayServer.Hwi" Version="1.1.3" />
|
||||
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.1.5" />
|
||||
<PackageReference Include="BuildBundlerMinifier" Version="3.1.430" />
|
||||
<PackageReference Include="BundlerMinifier.Core" Version="3.1.430" />
|
||||
@ -57,7 +57,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.9" AllowExplicitVersion="true" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.14" AllowExplicitVersion="true" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
|
||||
<PackageReference Include="TwentyTwenty.Storage" Version="2.11.2" />
|
||||
<PackageReference Include="TwentyTwenty.Storage.Amazon" Version="2.11.2" />
|
||||
<PackageReference Include="TwentyTwenty.Storage.Azure" Version="2.11.2" />
|
||||
|
@ -294,6 +294,10 @@ namespace BTCPayServer.Controllers
|
||||
};
|
||||
|
||||
paymentMethodHandler.PreparePaymentModel(model, dto, storeBlob);
|
||||
if (model.IsLightning && storeBlob.LightningAmountInSatoshi && model.CryptoCode == "Sats")
|
||||
{
|
||||
model.Rate = _CurrencyNameTable.DisplayFormatCurrency(paymentMethod.Rate / 100_000_000, paymentMethod.ParentEntity.ProductInformation.Currency);
|
||||
}
|
||||
model.UISettings = paymentMethodHandler.GetCheckoutUISettings();
|
||||
model.PaymentMethodId = paymentMethodId.ToString();
|
||||
var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds);
|
||||
|
@ -337,8 +337,10 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var keyPath = deposit.GetKeyPath((uint)i);
|
||||
var rootedKeyPath = vm.GetAccountKeypath()?.Derive(keyPath);
|
||||
var address = line.Derive((uint)i);
|
||||
vm.AddressSamples.Add((deposit.GetKeyPath((uint)i).ToString(), address.ScriptPubKey.GetDestinationAddress(strategy.Network.NBitcoinNetwork).ToString()));
|
||||
vm.AddressSamples.Add((keyPath.ToString(), address.ScriptPubKey.GetDestinationAddress(strategy.Network.NBitcoinNetwork).ToString(), rootedKeyPath));
|
||||
}
|
||||
}
|
||||
vm.Confirmation = true;
|
||||
|
@ -64,7 +64,6 @@ namespace BTCPayServer.Controllers
|
||||
HwiEnumerateEntry deviceEntry = null;
|
||||
HDFingerprint? fingerprint = null;
|
||||
string password = null;
|
||||
int? pin = null;
|
||||
var websocketHelper = new WebSocketHelper(websocket);
|
||||
|
||||
async Task<bool> RequireDeviceUnlocking()
|
||||
@ -74,15 +73,28 @@ namespace BTCPayServer.Controllers
|
||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
||||
return true;
|
||||
}
|
||||
if (deviceEntry.NeedsPinSent is true && pin is null)
|
||||
if (deviceEntry.Code is HwiErrorCode.DeviceNotInitialized)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
|
||||
await websocketHelper.Send("{ \"error\": \"need-initialized\"}", cancellationToken);
|
||||
return true;
|
||||
}
|
||||
if (deviceEntry.NeedsPassphraseSent is true && password == null)
|
||||
if (deviceEntry.Code is HwiErrorCode.DeviceNotReady)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-passphrase\"}", cancellationToken);
|
||||
return true;
|
||||
if (IsTrezorT(deviceEntry))
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-passphrase-on-device\"}", cancellationToken);
|
||||
return true;
|
||||
}
|
||||
else if (deviceEntry.NeedsPinSent is true)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
|
||||
return true;
|
||||
}
|
||||
else if (deviceEntry.NeedsPassphraseSent is true && password is null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-passphrase\"}", cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -130,6 +142,19 @@ namespace BTCPayServer.Controllers
|
||||
await websocketHelper.Send("{ \"error\": \"wrong-wallet\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
var signableInputs = psbt.Inputs
|
||||
.SelectMany(i => i.HDKeyPaths)
|
||||
.Where(i => i.Value.MasterFingerprint == fingerprint)
|
||||
.ToArray();
|
||||
if (signableInputs.Length > 0)
|
||||
{
|
||||
var actualPubKey = (await device.GetXPubAsync(signableInputs[0].Value.KeyPath)).GetPublicKey();
|
||||
if (actualPubKey != signableInputs[0].Key)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"wrong-keypath\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
psbt = await device.SignPSBTAsync(psbt, cancellationToken);
|
||||
@ -143,67 +168,125 @@ namespace BTCPayServer.Controllers
|
||||
o.Add("psbt", psbt.ToBase64());
|
||||
await websocketHelper.Send(o.ToString(), cancellationToken);
|
||||
break;
|
||||
case "display-address":
|
||||
if (await RequireDeviceUnlocking())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var k = RootedKeyPath.Parse(await websocketHelper.NextMessageAsync(cancellationToken));
|
||||
await device.DisplayAddressAsync(GetScriptPubKeyType(k), k.KeyPath, cancellationToken);
|
||||
await websocketHelper.Send("{ \"info\": \"ok\"}", cancellationToken);
|
||||
break;
|
||||
case "ask-pin":
|
||||
if (device == null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
await device.PromptPinAsync(cancellationToken);
|
||||
await websocketHelper.Send("{ \"info\": \"prompted, please input the pin\"}", cancellationToken);
|
||||
pin = int.Parse(await websocketHelper.NextMessageAsync(cancellationToken), CultureInfo.InvariantCulture);
|
||||
if (await device.SendPinAsync(pin.Value, cancellationToken))
|
||||
try
|
||||
{
|
||||
await websocketHelper.Send("{ \"info\": \"the pin is correct\"}", cancellationToken);
|
||||
await device.PromptPinAsync(cancellationToken);
|
||||
}
|
||||
catch (HwiException ex) when (ex.ErrorCode == HwiErrorCode.DeviceAlreadyUnlocked)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"device-already-unlocked\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
await websocketHelper.Send("{ \"info\": \"prompted, please input the pin\"}", cancellationToken);
|
||||
var pin = int.Parse(await websocketHelper.NextMessageAsync(cancellationToken), CultureInfo.InvariantCulture);
|
||||
if (await device.SendPinAsync(pin, cancellationToken))
|
||||
{
|
||||
goto askdevice;
|
||||
}
|
||||
else
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"incorrect-pin\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case "ask-xpubs":
|
||||
case "ask-xpub":
|
||||
if (await RequireDeviceUnlocking())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
await websocketHelper.Send("{ \"info\": \"ok\"}", cancellationToken);
|
||||
var askedXpub = JObject.Parse(await websocketHelper.NextMessageAsync(cancellationToken));
|
||||
var addressType = askedXpub["addressType"].Value<string>();
|
||||
var accountNumber = askedXpub["accountNumber"].Value<int>();
|
||||
JObject result = new JObject();
|
||||
var factory = network.NBXplorerNetwork.DerivationStrategyFactory;
|
||||
var keyPath = new KeyPath("84'").Derive(network.CoinType).Derive(0, true);
|
||||
BitcoinExtPubKey xpub = await device.GetXPubAsync(keyPath);
|
||||
if (fingerprint is null)
|
||||
{
|
||||
fingerprint = (await device.GetXPubAsync(new KeyPath("44'"), cancellationToken)).ExtPubKey.ParentFingerprint;
|
||||
}
|
||||
result["fingerprint"] = fingerprint.Value.ToString();
|
||||
var strategy = factory.CreateDirectDerivationStrategy(xpub, new DerivationStrategyOptions()
|
||||
|
||||
DerivationStrategyBase strategy = null;
|
||||
KeyPath keyPath = null;
|
||||
BitcoinExtPubKey xpub = null;
|
||||
|
||||
if (!network.NBitcoinNetwork.Consensus.SupportSegwit && addressType != "legacy")
|
||||
{
|
||||
ScriptPubKeyType = ScriptPubKeyType.Segwit
|
||||
});
|
||||
AddDerivationSchemeToJson("segwit", result, keyPath, xpub, strategy);
|
||||
keyPath = new KeyPath("49'").Derive(network.CoinType).Derive(0, true);
|
||||
xpub = await device.GetXPubAsync(keyPath);
|
||||
strategy = factory.CreateDirectDerivationStrategy(xpub, new DerivationStrategyOptions()
|
||||
await websocketHelper.Send("{ \"error\": \"segwit-notsupported\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (addressType == "segwit")
|
||||
{
|
||||
ScriptPubKeyType = ScriptPubKeyType.SegwitP2SH
|
||||
});
|
||||
AddDerivationSchemeToJson("segwitWrapped", result, keyPath, xpub, strategy);
|
||||
keyPath = new KeyPath("44'").Derive(network.CoinType).Derive(0, true);
|
||||
xpub = await device.GetXPubAsync(keyPath);
|
||||
strategy = factory.CreateDirectDerivationStrategy(xpub, new DerivationStrategyOptions()
|
||||
keyPath = new KeyPath("84'").Derive(network.CoinType).Derive(accountNumber, true);
|
||||
xpub = await device.GetXPubAsync(keyPath);
|
||||
strategy = factory.CreateDirectDerivationStrategy(xpub, new DerivationStrategyOptions()
|
||||
{
|
||||
ScriptPubKeyType = ScriptPubKeyType.Segwit
|
||||
});
|
||||
}
|
||||
else if (addressType == "segwitWrapped")
|
||||
{
|
||||
ScriptPubKeyType = ScriptPubKeyType.Legacy
|
||||
});
|
||||
AddDerivationSchemeToJson("legacy", result, keyPath, xpub, strategy);
|
||||
keyPath = new KeyPath("49'").Derive(network.CoinType).Derive(accountNumber, true);
|
||||
xpub = await device.GetXPubAsync(keyPath);
|
||||
strategy = factory.CreateDirectDerivationStrategy(xpub, new DerivationStrategyOptions()
|
||||
{
|
||||
ScriptPubKeyType = ScriptPubKeyType.SegwitP2SH
|
||||
});
|
||||
}
|
||||
else if (addressType == "legacy")
|
||||
{
|
||||
keyPath = new KeyPath("44'").Derive(network.CoinType).Derive(accountNumber, true);
|
||||
xpub = await device.GetXPubAsync(keyPath);
|
||||
strategy = factory.CreateDirectDerivationStrategy(xpub, new DerivationStrategyOptions()
|
||||
{
|
||||
ScriptPubKeyType = ScriptPubKeyType.Legacy
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"invalid-addresstype\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
result.Add(new JProperty("strategy", strategy.ToString()));
|
||||
result.Add(new JProperty("accountKey", xpub.ToString()));
|
||||
result.Add(new JProperty("keyPath", keyPath.ToString()));
|
||||
await websocketHelper.Send(result.ToString(), cancellationToken);
|
||||
break;
|
||||
case "ask-passphrase":
|
||||
if (command == "ask-passphrase")
|
||||
{
|
||||
if (deviceEntry == null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
// The make the trezor T ask for password
|
||||
await device.GetXPubAsync(new KeyPath("44'"), cancellationToken);
|
||||
}
|
||||
goto askdevice;
|
||||
case "ask-device":
|
||||
askdevice:
|
||||
var selector = deviceEntry?.DeviceSelector;
|
||||
password = null;
|
||||
pin = null;
|
||||
deviceEntry = null;
|
||||
device = null;
|
||||
var entries = (await hwi.EnumerateEntriesAsync(cancellationToken)).ToList();
|
||||
deviceEntry = entries.FirstOrDefault();
|
||||
deviceEntry = entries.Where(e => selector == null || SameSelector(selector, e.DeviceSelector)).FirstOrDefault();
|
||||
if (deviceEntry == null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"no-device\"}", cancellationToken);
|
||||
@ -219,10 +302,22 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
JObject obj = new JObject();
|
||||
obj.Add("error", "invalid-network");
|
||||
obj.Add("details", ex.ToString());
|
||||
try
|
||||
{
|
||||
await websocketHelper.Send(obj.ToString(), cancellationToken);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
JObject obj = new JObject();
|
||||
obj.Add("error", "unknown-error");
|
||||
obj.Add("message", ex.Message);
|
||||
obj.Add("details", ex.ToString());
|
||||
try
|
||||
{
|
||||
@ -238,6 +333,39 @@ namespace BTCPayServer.Controllers
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
private ScriptPubKeyType GetScriptPubKeyType(RootedKeyPath keyPath)
|
||||
{
|
||||
var path = keyPath.KeyPath.ToString();
|
||||
if (path.StartsWith("84'", StringComparison.OrdinalIgnoreCase))
|
||||
return ScriptPubKeyType.Segwit;
|
||||
if (path.StartsWith("49'", StringComparison.OrdinalIgnoreCase))
|
||||
return ScriptPubKeyType.SegwitP2SH;
|
||||
if (path.StartsWith("44'", StringComparison.OrdinalIgnoreCase))
|
||||
return ScriptPubKeyType.Legacy;
|
||||
throw new NotSupportedException("Unsupported keypath");
|
||||
}
|
||||
|
||||
private bool SameSelector(DeviceSelector a, DeviceSelector b)
|
||||
{
|
||||
var aargs = new List<string>();
|
||||
a.AddArgs(aargs);
|
||||
var bargs = new List<string>();
|
||||
b.AddArgs(bargs);
|
||||
if (aargs.Count != bargs.Count)
|
||||
return false;
|
||||
for (int i = 0; i < aargs.Count; i++)
|
||||
{
|
||||
if (aargs[i] != bargs[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsTrezorT(HwiEnumerateEntry deviceEntry)
|
||||
{
|
||||
return (deviceEntry.Model == HardwareWalletModels.Trezor_T || deviceEntry.Model == HardwareWalletModels.Trezor_T_Simulator);
|
||||
}
|
||||
|
||||
public StoreData CurrentStore
|
||||
{
|
||||
get
|
||||
@ -254,15 +382,5 @@ namespace BTCPayServer.Controllers
|
||||
.FirstOrDefault(p => p.PaymentId.PaymentType == Payments.PaymentTypes.BTCLike && p.PaymentId.CryptoCode == walletId.CryptoCode);
|
||||
return paymentMethod;
|
||||
}
|
||||
|
||||
private void AddDerivationSchemeToJson(string propertyName, JObject result, KeyPath keyPath, BitcoinExtPubKey xpub, DerivationStrategyBase strategy)
|
||||
{
|
||||
result.Add(new JProperty(propertyName, new JObject()
|
||||
{
|
||||
new JProperty("strategy", strategy.ToString()),
|
||||
new JProperty("accountKey", xpub.ToString()),
|
||||
new JProperty("keyPath", keyPath.ToString()),
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ namespace BTCPayServer.Controllers
|
||||
WalletId walletId, WalletPSBTViewModel vm)
|
||||
{
|
||||
var network = NetworkProvider.GetNetwork<BTCPayNetwork>(walletId.CryptoCode);
|
||||
vm.CryptoCode = network.CryptoCode;
|
||||
if (await vm.GetPSBT(network.NBitcoinNetwork) is PSBT psbt)
|
||||
{
|
||||
vm.Decoded = psbt.ToString();
|
||||
@ -72,6 +73,7 @@ namespace BTCPayServer.Controllers
|
||||
if (command == null)
|
||||
return await WalletPSBT(walletId, vm);
|
||||
var network = NetworkProvider.GetNetwork<BTCPayNetwork>(walletId.CryptoCode);
|
||||
vm.CryptoCode = network.CryptoCode;
|
||||
var psbt = await vm.GetPSBT(network.NBitcoinNetwork);
|
||||
if (psbt == null)
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ namespace BTCPayServer.Controllers
|
||||
vm.Id = tx.TransactionId.ToString();
|
||||
vm.Link = string.Format(CultureInfo.InvariantCulture, paymentMethod.Network.BlockExplorerLink, vm.Id);
|
||||
vm.Timestamp = tx.Timestamp;
|
||||
vm.Positive = tx.BalanceChange >= Money.Zero;
|
||||
vm.Positive = tx.BalanceChange.GetValue(wallet.Network) >= 0;
|
||||
vm.Balance = tx.BalanceChange.ToString();
|
||||
vm.IsConfirmed = tx.Confirmations != 0;
|
||||
|
||||
@ -313,7 +313,7 @@ namespace BTCPayServer.Controllers
|
||||
var feeProvider = _feeRateProvider.CreateFeeProvider(network);
|
||||
var recommendedFees = feeProvider.GetFeeRateAsync();
|
||||
var balance = _walletProvider.GetWallet(network).GetBalance(paymentMethod.AccountDerivation);
|
||||
model.CurrentBalance = (await balance).ToDecimal(MoneyUnit.BTC);
|
||||
model.CurrentBalance = await balance;
|
||||
model.RecommendedSatoshiPerByte = (int)(await recommendedFees).GetFee(1).Satoshi;
|
||||
model.FeeSatoshiPerByte = model.RecommendedSatoshiPerByte;
|
||||
model.SupportRBF = network.SupportRBF;
|
||||
@ -387,9 +387,20 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
subtractFeesOutputsCount.Add(i);
|
||||
}
|
||||
var destination = ParseDestination(transactionOutput.DestinationAddress, network.NBitcoinNetwork);
|
||||
if (destination == null)
|
||||
ModelState.AddModelError(nameof(transactionOutput.DestinationAddress), "Invalid address");
|
||||
transactionOutput.DestinationAddress = transactionOutput.DestinationAddress.Trim();
|
||||
|
||||
try
|
||||
{
|
||||
BitcoinAddress.Create(transactionOutput.DestinationAddress, network.NBitcoinNetwork);
|
||||
}
|
||||
catch
|
||||
{
|
||||
var inputName =
|
||||
string.Format(CultureInfo.InvariantCulture, "Outputs[{0}].", i.ToString(CultureInfo.InvariantCulture)) +
|
||||
nameof(transactionOutput.DestinationAddress);
|
||||
|
||||
ModelState.AddModelError(inputName, "Invalid address");
|
||||
}
|
||||
|
||||
if (transactionOutput.Amount.HasValue)
|
||||
{
|
||||
@ -425,7 +436,7 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
if (!ModelState.IsValid)
|
||||
return View(vm);
|
||||
|
||||
DerivationSchemeSettings derivationScheme = GetDerivationSchemeSettings(walletId);
|
||||
@ -600,19 +611,6 @@ namespace BTCPayServer.Controllers
|
||||
return v.ToString() + " " + network.CryptoCode;
|
||||
}
|
||||
|
||||
private IDestination[] ParseDestination(string destination, Network network)
|
||||
{
|
||||
try
|
||||
{
|
||||
destination = destination?.Trim();
|
||||
return new IDestination[] { BitcoinAddress.Create(destination, network) };
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IActionResult RedirectToWalletTransaction(WalletId walletId, Transaction transaction)
|
||||
{
|
||||
var network = NetworkProvider.GetNetwork<BTCPayNetwork>(walletId.CryptoCode);
|
||||
@ -728,7 +726,7 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return (await wallet.GetBalance(derivationStrategy, cts.Token)).ToString();
|
||||
return (await wallet.GetBalance(derivationStrategy, cts.Token)).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -912,7 +910,7 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
else if (command == "prune")
|
||||
{
|
||||
var result = await ExplorerClientProvider.GetExplorerClient(walletId.CryptoCode).PruneAsync(derivationScheme.AccountDerivation, cancellationToken);
|
||||
var result = await ExplorerClientProvider.GetExplorerClient(walletId.CryptoCode).PruneAsync(derivationScheme.AccountDerivation, new PruneRequest(), cancellationToken);
|
||||
if (result.TotalPruned == 0)
|
||||
{
|
||||
TempData[WellKnownTempData.SuccessMessage] = $"The wallet is already pruned";
|
||||
|
29
BTCPayServer/Extensions/MoneyExtensions.cs
Normal file
29
BTCPayServer/Extensions/MoneyExtensions.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using NBitcoin;
|
||||
|
||||
namespace BTCPayServer
|
||||
{
|
||||
public static class MoneyExtensions
|
||||
{
|
||||
public static decimal GetValue(this IMoney m, BTCPayNetwork network = null)
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case Money money:
|
||||
return money.ToDecimal(MoneyUnit.BTC);
|
||||
// case MoneyBag mb:
|
||||
// return mb.Select(money => money.GetValue(network)).Sum();
|
||||
// case AssetMoney assetMoney:
|
||||
// if (network is ElementsBTCPayNetwork elementsBTCPayNetwork)
|
||||
// {
|
||||
// return elementsBTCPayNetwork.AssetId == assetMoney.AssetId
|
||||
// ? new Money(assetMoney.Quantity)
|
||||
// : Money.Zero;
|
||||
// }
|
||||
// throw new NotSupportedException("IMoney type not supported");
|
||||
default:
|
||||
throw new NotSupportedException("IMoney type not supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -26,6 +26,11 @@ namespace BTCPayServer.HostedServices
|
||||
else
|
||||
_themeUri = data.ThemeCssUri;
|
||||
|
||||
if (String.IsNullOrWhiteSpace(data.CustomThemeCssUri))
|
||||
_customThemeUri = null;
|
||||
else
|
||||
_customThemeUri = data.CustomThemeCssUri;
|
||||
|
||||
if (String.IsNullOrWhiteSpace(data.BootstrapCssUri))
|
||||
_bootstrapUri = "/main/bootstrap/bootstrap.css";
|
||||
else
|
||||
@ -35,6 +40,7 @@ namespace BTCPayServer.HostedServices
|
||||
_creativeStartUri = "/main/bootstrap4-creativestart/creative.css";
|
||||
else
|
||||
_creativeStartUri = data.CreativeStartCssUri;
|
||||
|
||||
FirstRun = data.FirstRun;
|
||||
}
|
||||
|
||||
@ -44,6 +50,12 @@ namespace BTCPayServer.HostedServices
|
||||
get { return _themeUri; }
|
||||
}
|
||||
|
||||
private string _customThemeUri;
|
||||
public string CustomThemeUri
|
||||
{
|
||||
get { return _customThemeUri; }
|
||||
}
|
||||
|
||||
private string _bootstrapUri;
|
||||
public string BootstrapUri
|
||||
{
|
||||
@ -108,6 +120,10 @@ namespace BTCPayServer.HostedServices
|
||||
{
|
||||
policies.Clear();
|
||||
}
|
||||
if (manager.CustomThemeUri != null && Uri.TryCreate(manager.CustomThemeUri, UriKind.Absolute, out uri))
|
||||
{
|
||||
policies.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace BTCPayServer.Models.AppViewModels
|
||||
[Display(Name = "Callback Notification Url")]
|
||||
[Uri]
|
||||
public string NotificationUrl { get; set; }
|
||||
[Display(Name = "Invoice Email Notification")]
|
||||
[Display(Name = "Invoice IPN Notification")]
|
||||
[EmailAddress]
|
||||
public string NotificationEmail { get; set; }
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace BTCPayServer.Models.AppViewModels
|
||||
[Display(Name = "Callback Notification Url")]
|
||||
[Uri]
|
||||
public string NotificationUrl { get; set; }
|
||||
[Display(Name = "Invoice Email Notification")]
|
||||
[Display(Name = "Invoice IPN Notification")]
|
||||
[EmailAddress]
|
||||
public string NotificationEmail { get; set; }
|
||||
|
||||
|
@ -78,6 +78,5 @@ namespace BTCPayServer.Models.InvoicingModels
|
||||
public string RootPath { get; set; }
|
||||
public decimal CoinSwitchAmountMarkupPercentage { get; set; }
|
||||
public bool RedirectAutomatically { get; set; }
|
||||
public string RateBaseAmount { get; set; } = "1";
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ namespace BTCPayServer.Models.StoreViewModels
|
||||
get; set;
|
||||
}
|
||||
|
||||
public List<(string KeyPath, string Address)> AddressSamples
|
||||
public List<(string KeyPath, string Address, RootedKeyPath RootedKeyPath)> AddressSamples
|
||||
{
|
||||
get; set;
|
||||
} = new List<(string KeyPath, string Address)>();
|
||||
} = new List<(string KeyPath, string Address, RootedKeyPath RootedKeyPath)>();
|
||||
|
||||
public string CryptoCode { get; set; }
|
||||
public string KeyPath { get; set; }
|
||||
@ -41,5 +41,16 @@ namespace BTCPayServer.Models.StoreViewModels
|
||||
public string DerivationSchemeFormat { get; set; }
|
||||
public string AccountKey { get; set; }
|
||||
public BTCPayNetwork Network { get; set; }
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,10 @@ namespace BTCPayServer.Models.WalletViewModels
|
||||
[Required]
|
||||
public string DestinationAddress { get; set; }
|
||||
|
||||
[Display(Name = "Amount")] [Required] [Range(0.0, double.MaxValue)]public decimal? Amount { get; set; }
|
||||
|
||||
[Display(Name = "Amount")]
|
||||
[Required]
|
||||
[Range(1E-08, 21E6)]
|
||||
public decimal? Amount { get; set; }
|
||||
|
||||
[Display(Name = "Subtract fees from amount")]
|
||||
public bool SubtractFeesFromOutput { get; set; }
|
||||
|
@ -20,10 +20,10 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||
{
|
||||
|
||||
}
|
||||
public BitcoinLikePaymentData(Coin coin, bool rbf)
|
||||
public BitcoinLikePaymentData(TxOut txout, OutPoint outpoint, bool rbf)
|
||||
{
|
||||
Outpoint = coin.Outpoint;
|
||||
Output = coin.TxOut;
|
||||
Outpoint = outpoint;
|
||||
Output = txout;
|
||||
ConfirmationCount = 0;
|
||||
RBF = rbf;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||
var invoice = (await _InvoiceRepository.GetInvoicesFromAddresses(new [] {key})).FirstOrDefault();
|
||||
if (invoice != null)
|
||||
{
|
||||
var paymentData = new BitcoinLikePaymentData(txCoin, evt.TransactionData.Transaction.RBF);
|
||||
var paymentData = new BitcoinLikePaymentData(txCoin.TxOut, txCoin.Outpoint, evt.TransactionData.Transaction.RBF);
|
||||
var alreadyExist = GetAllBitcoinPaymentData(invoice).Where(c => c.GetPaymentId() == paymentData.GetPaymentId()).Any();
|
||||
if (!alreadyExist)
|
||||
{
|
||||
@ -338,7 +338,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||
foreach (var coin in coins.Where(c => !alreadyAccounted.Contains(c.Coin.Outpoint)))
|
||||
{
|
||||
var transaction = await wallet.GetTransactionAsync(coin.Coin.Outpoint.Hash);
|
||||
var paymentData = new BitcoinLikePaymentData(coin.Coin, transaction.Transaction.RBF);
|
||||
var paymentData = new BitcoinLikePaymentData(coin.Coin.TxOut, coin.Coin.Outpoint, transaction.Transaction.RBF);
|
||||
var payment = await _InvoiceRepository.AddPayment(invoice.Id, coin.Timestamp, paymentData, network).ConfigureAwait(false);
|
||||
alreadyAccounted.Add(coin.Coin.Outpoint);
|
||||
if (payment != null)
|
||||
|
@ -185,7 +185,6 @@ namespace BTCPayServer.Payments.Lightning
|
||||
model.BtcPaid = Money.Parse(model.BtcPaid).ToUnit(MoneyUnit.Satoshi).ToString(CultureInfo.InvariantCulture);
|
||||
model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi);
|
||||
model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi).ToString(CultureInfo.InvariantCulture);
|
||||
model.RateBaseAmount = Money.FromUnit(1, MoneyUnit.BTC).Satoshi.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
public override string GetCryptoImage(PaymentMethodId paymentMethodId)
|
||||
|
@ -14,12 +14,18 @@ namespace BTCPayServer.Services
|
||||
[Display(Name = "Select Theme")]
|
||||
public string ThemeCssUri { get; set; }
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
[MaxLength(500)]
|
||||
[Display(Name = "Custom Theme CSS file")]
|
||||
public string CustomThemeCssUri { get; set; }
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
[MaxLength(500)]
|
||||
[Display(Name = "Custom bootstrap CSS file")]
|
||||
public string BootstrapCssUri { get; set; }
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
[Display(Name = "Custom Creative Start CSS file")]
|
||||
public string CreativeStartCssUri { get; set; }
|
||||
public bool FirstRun { get; set; }
|
||||
public override string ToString()
|
||||
|
@ -178,10 +178,10 @@ namespace BTCPayServer.Services.Wallets
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
public async Task<Money> GetBalance(DerivationStrategyBase derivationStrategy, CancellationToken cancellation = default(CancellationToken))
|
||||
public async Task<decimal> GetBalance(DerivationStrategyBase derivationStrategy, CancellationToken cancellation = default(CancellationToken))
|
||||
{
|
||||
UTXOChanges changes = await GetUTXOChanges(derivationStrategy, cancellation);
|
||||
return changes.GetUnspentUTXOs().Select(c => c.Value).Sum();
|
||||
var result = await _Client.GetBalanceAsync(derivationStrategy, cancellation);
|
||||
return result.Total.GetValue(_Network);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,14 @@
|
||||
ViewData["Title"] = "Access denied";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h2 class="text-danger">ViewData["Title"]</h2>
|
||||
<p class="text-danger">You do not have access to this resource.</p>
|
||||
</header>
|
||||
<section>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h4>@ViewData["Title"]</h4>
|
||||
<hr />
|
||||
<p class="text-danger">You do not have access to this resource.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -100,7 +100,8 @@
|
||||
<span>{{ srvModel.btcDue }} {{ srvModel.cryptoCode }}</span>
|
||||
</div>
|
||||
<div class="single-item-order__right__ex-rate" v-if="srvModel.orderAmountFiat && srvModel.cryptoCode">
|
||||
{{srvModel.rateBaseAmount}} {{ srvModel.cryptoCodeSrv }} = {{ srvModel.rate }}
|
||||
<span v-if="srvModel.cryptoCodeSrv === 'Sats'">1 Sat = {{ srvModel.rate }}</span>
|
||||
<span v-else>1 {{ srvModel.cryptoCodeSrv }} = {{ srvModel.rate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="fa fa-angle-double-down"></span>
|
||||
|
@ -13,14 +13,23 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<form method="post">
|
||||
<div class="form-group mb-5">
|
||||
<h4>Custom theme</h4>
|
||||
<p>Select one of our predefined themes. Optionally you can also provide a CSS file that customizes the chosen theme.</p>
|
||||
<div class="form-group">
|
||||
<label asp-for="ThemeCssUri"></label>
|
||||
<select id=themes asp-for="ThemeCssUri" class="form-control">
|
||||
<select asp-for="ThemeCssUri" class="form-control">
|
||||
<option value="/main/themes/classic.css">Classic</option>
|
||||
<option value="/main/themes/casa.css">Casa</option>
|
||||
</select>
|
||||
<span asp-validation-for="ThemeCssUri" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group mb-5">
|
||||
<label asp-for="CustomThemeCssUri"></label>
|
||||
<a href="https://docs.btcpayserver.org/development/theme#custom-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<input asp-for="CustomThemeCssUri" class="form-control" />
|
||||
<span asp-validation-for="CustomThemeCssUri" class="text-danger"></span>
|
||||
</div>
|
||||
<h4>Bootstrap theme</h4>
|
||||
<div class="form-group">
|
||||
<label asp-for="BootstrapCssUri"></label>
|
||||
<a href="https://docs.btcpayserver.org/development/theme#bootstrap-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
|
@ -7,13 +7,17 @@
|
||||
<meta name="author" content="">
|
||||
@if (themeManager.DiscourageSearchEngines)
|
||||
{
|
||||
<META NAME="robots" CONTENT="noindex">
|
||||
<meta name="robots" content="noindex">
|
||||
}
|
||||
<title>@ViewData["Title"]</title>
|
||||
@* CSS *@
|
||||
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.BootstrapUri)" rel="stylesheet" />
|
||||
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.CreativeStartUri)" rel="stylesheet" />
|
||||
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.ThemeUri)" rel="stylesheet" />
|
||||
@if (!String.IsNullOrWhiteSpace(themeManager.CustomThemeUri))
|
||||
{
|
||||
<link href="@this.Context.Request.GetRelativePathOrAbsolute(themeManager.CustomThemeUri)" rel="stylesheet" />
|
||||
}
|
||||
<bundle name="wwwroot/bundles/main-bundle.min.css" />
|
||||
@* JS *@
|
||||
<bundle name="wwwroot/bundles/main-bundle.min.js" />
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
@section HeadScripts {
|
||||
<style type="text/css">
|
||||
|
||||
.hw-fields {
|
||||
display: none;
|
||||
}
|
||||
@ -18,12 +19,42 @@
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="btcpayservervault" tabindex="-1" role="dialog" aria-labelledby="btcpayservervault" aria-hidden="true">
|
||||
|
||||
</div>
|
||||
<partial name="VaultElements" />
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div id="WebsocketPath" style="display:none;">@Url.Action("VaultBridgeConnection", "Vault", new { cryptoCode = Model.CryptoCode })</div>
|
||||
@if (!Model.Confirmation)
|
||||
{
|
||||
<partial name="AddDerivationSchemes_HardwareWalletDialogs" model="@Model" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<template id="btcpayservervault_template">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form class="modal-content" form method="post" enctype="multipart/form-data">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Address verification</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Confirm on the device that you see address <b id="displayedAddress"></b></p>
|
||||
<div class="form-group">
|
||||
<div id="vaultPlaceholder"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
}
|
||||
<form method="post">
|
||||
|
||||
<input id="Config" asp-for="Config" type="hidden" />
|
||||
@ -44,14 +75,15 @@
|
||||
|
||||
<div class="dropdown mt-2 text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-link dropdown-toggle" type="button" id="hardwarewlletimportdropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<button class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Import from...
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="hardwarewlletimportdropdown">
|
||||
<button class="dropdown-item" type="button" data-toggle="modal" data-target="#coldcardimport">... Coldcard (air gap)</button>
|
||||
<button class="dropdown-item check-for-ledger" data-toggle="modal" data-target="#ledgerimport" type="button">... Ledger Wallet</button>
|
||||
@if (Model.CryptoCode == "BTC") {
|
||||
<button class="dropdown-item check-for-vault" data-toggle="modal" data-target="#btcpayservervault" type="button">... the vault (preview)</button>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<button class="dropdown-item" type="button">... Coldcard (air gap)</button>
|
||||
<button class="dropdown-item check-for-ledger" type="button">... Ledger Wallet</button>
|
||||
@if (Model.CryptoCode == "BTC")
|
||||
{
|
||||
<button class="dropdown-item check-for-vault" type="button">... the vault (preview)</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@ -133,6 +165,10 @@
|
||||
<tr>
|
||||
<th>Key path</th>
|
||||
<th>Address</th>
|
||||
@if (Model.Source == "Vault")
|
||||
{
|
||||
<th>Actions</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -141,6 +177,10 @@
|
||||
<tr>
|
||||
<td>@sample.KeyPath</td>
|
||||
<td>@sample.Address</td>
|
||||
@if (Model.Source == "Vault")
|
||||
{
|
||||
<td><a class="showaddress" href="#" onclick='showAddress(@Safe.Json(sample.RootedKeyPath.ToString()), @Safe.Json(sample.Address)); return false;'>Show on device</a></td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
@ -80,8 +80,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="WebsocketPath" style="display:none;">@Url.Action("VaultBridgeConnection", "Vault", new { cryptoCode = Model.CryptoCode })</div>
|
||||
<div class="modal fade" id="btcpayservervault" tabindex="-1" role="dialog" aria-labelledby="btcpayservervault" aria-hidden="true">
|
||||
<template id="btcpayservervault_template">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form class="modal-content" form method="post" enctype="multipart/form-data">
|
||||
<div class="modal-header">
|
||||
@ -92,26 +91,33 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>You may import from BTCPayServer Vault.</p>
|
||||
<div id="vaultPlaceholder"></div>
|
||||
<div class="form-group">
|
||||
<div id="vaultPlaceholder"></div>
|
||||
</div>
|
||||
<div id="vault-xpub" style="display:none;">
|
||||
<div class="form-group">
|
||||
<label for="addressType">Address type</label>
|
||||
<select name="addressType" class="form-control">
|
||||
<option value="segwit">Segwit (Recommended, cheapest transaction fee)</option>
|
||||
<option value="segwitWrapped">Segwit wrapped (less cheap but compatible with old wallets)</option>
|
||||
<option value="legacy">Legacy (Not recommended)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="accountNumber">Account</label>
|
||||
<select name="accountNumber" class="form-control">
|
||||
@for (int i = 0; i < 20; i++)
|
||||
{
|
||||
<option value="@i">@i</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
|
||||
<div id="vault-dropdown" style="display:none;" class="dropdown">
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Select the type of address you want
|
||||
</button>
|
||||
<div class="dropdown-menu overflow-auto" style="max-height: 200px;">
|
||||
<a class="dropdown-item" href="#" id="vault-segwit">Segwit (Recommended, cheapest transaction fee)</a>
|
||||
<a class="dropdown-item" href="#" id="vault-segwitWrapped">Segwit wrapped (less cheap but compatible with old wallets)</a>
|
||||
<a class="dropdown-item" href="#" id="vault-legacy">Legacy (Not recommended)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="vault-confirm" class="btn btn-primary" style="display:none;" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
||||
<button id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<partial name="VaultElements" />
|
||||
</template>
|
||||
|
@ -66,7 +66,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Note that the <code>certthumbprint</code> to connect to your LND node can be obtained through this command line:</p>
|
||||
<p><pre><code>openssl x509 -noout -fingerprint -sha256 -inform pem -in /root/.lnd/tls.cert</code></pre></p>
|
||||
<p><pre><code>openssl x509 -noout -fingerprint -sha256 -inform pem -in /root/.lnd/tls.cert | sed -e 's/.*=//' -e 's/://g'</code></pre></p>
|
||||
<p>You can omit <code>certthumbprint</code> if you the certificate is trusted by your machine</p>
|
||||
<p>You can set <code>allowinsecure</code> to <code>true</code> if your LND REST server is using HTTP or HTTPS with an untrusted certificate which you don't know the <code>certthumbprint</code></p>
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<div class="col-lg-12 section-heading">
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<hr class="primary">
|
||||
<p>Create and manage wallets. <a href="https://docs.btcpayserver.org/features/wallet" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a></p>
|
||||
<p>Connect and manage wallets. <a href="https://docs.btcpayserver.org/features/wallet" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
}
|
||||
<div class="row">
|
||||
<div class="col-lg-12 section-heading">
|
||||
<div class="col-lg-12 section-heading text-center">
|
||||
<h2>Transaction review</h2>
|
||||
<hr class="primary">
|
||||
@if (Model.CanCalculateBalance)
|
||||
|
@ -18,7 +18,7 @@
|
||||
<input type="hidden" asp-for="WebsocketPath" />
|
||||
</form>
|
||||
<div id="vaultPlaceholder"></div>
|
||||
<button id="vault-confirm" class="btn btn-primary" style="display:none;" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
||||
<button id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
<script src="~/js/vaultbridge.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/vaultbridge.ui.js" type="text/javascript" defer="defer"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
async function askSign() {
|
||||
var websocketPath = $("#WebsocketPath").val();
|
||||
var loc = window.location, ws_uri;
|
||||
if (loc.protocol === "https:") {
|
||||
@ -43,15 +43,16 @@
|
||||
$("#vaultPlaceholder").html(html);
|
||||
|
||||
var vaultUI = new vaultui.VaultBridgeUI(ws_uri);
|
||||
vaultUI.askSignPSBT({
|
||||
if (await vaultUI.askForDevice() && await vaultUI.askSignPSBT({
|
||||
walletId: $("#WalletId").val(),
|
||||
psbt: $("#PSBT").val()
|
||||
}).then(function (ok) {
|
||||
if (ok) {
|
||||
$("#PSBT").val(vaultUI.psbt);
|
||||
$("#broadcastForm").submit();
|
||||
}
|
||||
});
|
||||
})) {
|
||||
$("#PSBT").val(vaultUI.psbt);
|
||||
$("#broadcastForm").submit();
|
||||
}
|
||||
}
|
||||
$(function () {
|
||||
askSign();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
@ -87,6 +87,42 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getVaultUI() {
|
||||
var websocketPath = $("#WebsocketPath").text();
|
||||
var loc = window.location, ws_uri;
|
||||
if (loc.protocol === "https:") {
|
||||
ws_uri = "wss:";
|
||||
} else {
|
||||
ws_uri = "ws:";
|
||||
}
|
||||
ws_uri += "//" + loc.host;
|
||||
ws_uri += websocketPath;
|
||||
return new vaultui.VaultBridgeUI(ws_uri);
|
||||
}
|
||||
|
||||
function showModal() {
|
||||
var html = $("#btcpayservervault_template").html();
|
||||
$("#btcpayservervault").html(html);
|
||||
html = $("#VaultConnection").html();
|
||||
$("#vaultPlaceholder").html(html);
|
||||
$('#btcpayservervault').modal();
|
||||
}
|
||||
|
||||
async function showAddress(rootedKeyPath, address) {
|
||||
$(".showaddress").addClass("disabled");
|
||||
showModal();
|
||||
$("#btcpayservervault #displayedAddress").text(address);
|
||||
var vaultUI = getVaultUI();
|
||||
$('#btcpayservervault').on('hidden.bs.modal', function () {
|
||||
vaultUI.closeBridge();
|
||||
$(".showaddress").removeClass("disabled");
|
||||
});
|
||||
if (await vaultUI.askForDevice())
|
||||
await vaultUI.askForDisplayAddress(rootedKeyPath);
|
||||
$('#btcpayservervault').modal("hide");
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
var ledgerInit = false;
|
||||
$(".check-for-ledger").on("click", function () {
|
||||
@ -102,44 +138,25 @@ $(document).ready(function () {
|
||||
$("#" + id).css("display", "block");
|
||||
}
|
||||
|
||||
var websocketPath = $("#WebsocketPath").text();
|
||||
var loc = window.location, ws_uri;
|
||||
if (loc.protocol === "https:") {
|
||||
ws_uri = "wss:";
|
||||
} else {
|
||||
ws_uri = "ws:";
|
||||
}
|
||||
ws_uri += "//" + loc.host;
|
||||
ws_uri += websocketPath;
|
||||
|
||||
function displayXPubs(xpubs) {
|
||||
$("#vault-dropdown").css("display", "block");
|
||||
$("#vault-dropdown .dropdown-item").click(function () {
|
||||
var id = $(this).attr('id').replace("vault-", "");
|
||||
var xpub = xpubs[id];
|
||||
$("#DerivationScheme").val(xpub.strategy);
|
||||
$("#RootFingerprint").val(xpubs.fingerprint);
|
||||
$("#AccountKey").val(xpub.accountKey);
|
||||
$("#Source").val("Vault");
|
||||
$("#DerivationSchemeFormat").val("BTCPay");
|
||||
$("#KeyPath").val(xpub.keyPath);
|
||||
$(".modal").modal('hide');
|
||||
$(".hw-fields").show();
|
||||
});
|
||||
function displayXPubs(xpub) {
|
||||
$("#DerivationScheme").val(xpub.strategy);
|
||||
$("#RootFingerprint").val(xpub.fingerprint);
|
||||
$("#AccountKey").val(xpub.accountKey);
|
||||
$("#Source").val("Vault");
|
||||
$("#DerivationSchemeFormat").val("BTCPay");
|
||||
$("#KeyPath").val(xpub.keyPath);
|
||||
$(".modal").modal('hide');
|
||||
$(".hw-fields").show();
|
||||
}
|
||||
|
||||
var vaultInit = false;
|
||||
$(".check-for-vault").on("click", async function () {
|
||||
if (vaultInit)
|
||||
return;
|
||||
vaultInit = true;
|
||||
|
||||
var html = $("#VaultConnection").html();
|
||||
$("#vaultPlaceholder").html(html);
|
||||
|
||||
var vaultUI = new vaultui.VaultBridgeUI(ws_uri);
|
||||
if (await vaultUI.askForXPubs()) {
|
||||
displayXPubs(vaultUI.xpubs);
|
||||
var vaultUI = getVaultUI();
|
||||
showModal();
|
||||
$('#btcpayservervault').on('hidden.bs.modal', function () {
|
||||
vaultUI.closeBridge();
|
||||
});
|
||||
if (await vaultUI.askForDevice() && await vaultUI.askForXPubs()) {
|
||||
displayXPubs(vaultUI.xpub);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -9,7 +9,7 @@
|
||||
this.socket = websocket;
|
||||
this.onerror = function (error) { };
|
||||
this.onbackendmessage = function (json) { };
|
||||
|
||||
this.close = function () { if (websocket) websocket.close(); };
|
||||
/**
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@ -34,7 +34,8 @@
|
||||
self.onerror(vault.errors.denied);
|
||||
}
|
||||
};
|
||||
request.open('POST', 'http://localhost:65092/hwi-bridge/v1');
|
||||
request.overrideMimeType("text/plain");
|
||||
request.open('POST', 'http://127.0.0.1:65092/hwi-bridge/v1');
|
||||
request.send(JSON.stringify(jsonObject));
|
||||
}
|
||||
else {
|
||||
@ -85,7 +86,8 @@
|
||||
reject(vault.errors.denied);
|
||||
}
|
||||
};
|
||||
request.open('GET', 'http://localhost:65092/hwi-bridge/v1/request-permission');
|
||||
request.overrideMimeType("text/plain");
|
||||
request.open('GET', 'http://127.0.0.1:65092/hwi-bridge/v1/request-permission');
|
||||
request.send();
|
||||
});
|
||||
}
|
||||
|
@ -33,17 +33,23 @@ var vaultui = (function () {
|
||||
errorWebsockets: new VaultFeedback("failed", "Error of the websocket while connecting to the backend.", "vault-feedback1", "error-websocket"),
|
||||
bridgeConnected: new VaultFeedback("ok", "BTCPayServer successfully connected to the vault.", "vault-feedback1", "bridge-connected"),
|
||||
noDevice: new VaultFeedback("failed", "No device connected.", "vault-feedback2", "no-device"),
|
||||
needInitialized: new VaultFeedback("failed", "The device has not been initialized.", "vault-feedback2", "need-initialized"),
|
||||
fetchingDevice: new VaultFeedback("?", "Fetching device...", "vault-feedback2", "fetching-device"),
|
||||
deviceFound: new VaultFeedback("ok", "Device found: {{0}}", "vault-feedback2", "device-selected"),
|
||||
fetchingXpubs: new VaultFeedback("?", "Fetching public keys...", "vault-feedback3", "fetching-xpubs"),
|
||||
askXpubs: new VaultFeedback("?", "Select your address type and account", "vault-feedback3", "fetching-xpubs"),
|
||||
fetchedXpubs: new VaultFeedback("ok", "Public keys successfully fetched.", "vault-feedback3", "xpubs-fetched"),
|
||||
unexpectedError: new VaultFeedback("failed", "An unexpected error happened.", "vault-feedback3", "unknown-error"),
|
||||
unexpectedError: new VaultFeedback("failed", "An unexpected error happened. ({{0}})", "vault-feedback3", "unknown-error"),
|
||||
invalidNetwork: new VaultFeedback("failed", "The device is targetting a different chain.", "vault-feedback3", "invalid-network"),
|
||||
needPin: new VaultFeedback("?", "Enter the pin.", "vault-feedback3", "need-pin"),
|
||||
incorrectPin: new VaultFeedback("failed", "Incorrect pin code.", "vault-feedback3", "incorrect-pin"),
|
||||
invalidPasswordConfirmation: new VaultFeedback("failed", "Invalid password confirmation.", "vault-feedback3", "invalid-password-confirm"),
|
||||
wrongWallet: new VaultFeedback("failed", "This device can't sign the transaction.", "vault-feedback3", "wrong-wallet"),
|
||||
wrongWallet: new VaultFeedback("failed", "This device can't sign the transaction. (Wrong device, wrong passphrase or wrong device fingerprint in your wallet settings)", "vault-feedback3", "wrong-wallet"),
|
||||
wrongKeyPath: new VaultFeedback("failed", "This device can't sign the transaction. (The wallet keypath in your wallet settings seems incorrect)", "vault-feedback3", "wrong-keypath"),
|
||||
needPassphrase: new VaultFeedback("?", "Enter the passphrase.", "vault-feedback3", "need-passphrase"),
|
||||
signingTransaction: new VaultFeedback("?", "Signing the transaction...", "vault-feedback3", "ask-signing"),
|
||||
needPassphraseOnDevice: new VaultFeedback("?", "Please, enter the passphrase on the device.", "vault-feedback3", "need-passphrase-on-device"),
|
||||
signingTransaction: new VaultFeedback("?", "Please review and confirm the transaction on your device...", "vault-feedback3", "ask-signing"),
|
||||
reviewAddress: new VaultFeedback("?", "Please review the address on your device...", "vault-feedback3", "ask-signing"),
|
||||
signingRejected: new VaultFeedback("failed", "The user refused to sign the transaction", "vault-feedback3", "user-reject"),
|
||||
};
|
||||
|
||||
@ -66,7 +72,7 @@ var vaultui = (function () {
|
||||
*/
|
||||
this.psbt = null;
|
||||
|
||||
this.xpubs = null;
|
||||
this.xpub = null;
|
||||
/**
|
||||
* @param {VaultFeedback} feedback
|
||||
*/
|
||||
@ -90,13 +96,18 @@ var vaultui = (function () {
|
||||
if (json.hasOwnProperty("error")) {
|
||||
for (var key in VaultFeedbacks) {
|
||||
if (VaultFeedbacks.hasOwnProperty(key) && VaultFeedbacks[key].id == json.error) {
|
||||
show(VaultFeedbacks[key]);
|
||||
if (VaultFeedbacks.unexpectedError === VaultFeedbacks[key]) {
|
||||
show(VaultFeedbacks.unexpectedError.replace("{{0}}", json.message));
|
||||
}
|
||||
else {
|
||||
show(VaultFeedbacks[key]);
|
||||
}
|
||||
if (json.hasOwnProperty("details"))
|
||||
console.warn(json.details);
|
||||
return;
|
||||
}
|
||||
}
|
||||
show(VaultFeedbacks.unexpectedError);
|
||||
show(VaultFeedbacks.unexpectedError.replace("{{0}}", json.message));
|
||||
if (json.hasOwnProperty("details"))
|
||||
console.warn(json.details);
|
||||
}
|
||||
@ -119,6 +130,18 @@ var vaultui = (function () {
|
||||
if (await self.askForPassphrase())
|
||||
return true;
|
||||
}
|
||||
if (json.error === "need-passphrase-on-device") {
|
||||
handled = true;
|
||||
show(VaultFeedbacks.needPassphraseOnDevice);
|
||||
self.bridge.socket.send("ask-passphrase");
|
||||
var json = await self.bridge.waitBackendMessage();
|
||||
if (json.hasOwnProperty("error")) {
|
||||
showError(json);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
showError(json);
|
||||
}
|
||||
@ -153,6 +176,20 @@ var vaultui = (function () {
|
||||
}
|
||||
return true;
|
||||
};
|
||||
this.askForDisplayAddress = async function (rootedKeyPath) {
|
||||
if (!await self.ensureConnectedToBackend())
|
||||
return false;
|
||||
show(VaultFeedbacks.reviewAddress);
|
||||
self.bridge.socket.send("display-address");
|
||||
self.bridge.socket.send(rootedKeyPath);
|
||||
var json = await self.bridge.waitBackendMessage();
|
||||
if (json.hasOwnProperty("error")) {
|
||||
if (await needRetry(json))
|
||||
return await self.askForDisplayAddress(rootedKeyPath);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.askForDevice = async function () {
|
||||
if (!await self.ensureConnectedToBackend())
|
||||
return false;
|
||||
@ -169,19 +206,49 @@ var vaultui = (function () {
|
||||
this.askForXPubs = async function () {
|
||||
if (!await self.ensureConnectedToBackend())
|
||||
return false;
|
||||
show(VaultFeedbacks.fetchingXpubs);
|
||||
self.bridge.socket.send("ask-xpubs");
|
||||
self.bridge.socket.send("ask-xpub");
|
||||
var json = await self.bridge.waitBackendMessage();
|
||||
if (json.hasOwnProperty("error")) {
|
||||
if (await needRetry(json))
|
||||
return await self.askForXPubs();
|
||||
return false;
|
||||
}
|
||||
var selectedXPubs = await self.getXpubSettings();
|
||||
self.bridge.socket.send(JSON.stringify(selectedXPubs));
|
||||
show(VaultFeedbacks.fetchingXpubs);
|
||||
json = await self.bridge.waitBackendMessage();
|
||||
if (json.hasOwnProperty("error")) {
|
||||
if (await needRetry(json))
|
||||
return await self.askForXPubs();
|
||||
return false;
|
||||
}
|
||||
show(VaultFeedbacks.fetchedXpubs);
|
||||
self.xpubs = json;
|
||||
self.xpub = json;
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Promise<{addressType:string, accountNumber:number}>}
|
||||
*/
|
||||
this.getXpubSettings = function () {
|
||||
show(VaultFeedbacks.askXpubs);
|
||||
$("#vault-xpub").css("display", "block");
|
||||
$("#vault-confirm").css("display", "block");
|
||||
$("#vault-confirm").text("Confirm");
|
||||
return new Promise(function (resolve, reject) {
|
||||
$("#vault-confirm").click(async function (e) {
|
||||
e.preventDefault();
|
||||
$("#vault-xpub").css("display", "none");
|
||||
$("#vault-confirm").css("display", "none");
|
||||
$(this).unbind();
|
||||
resolve({
|
||||
addressType: $("select[name=\"addressType\"]").val(),
|
||||
accountNumber: parseInt($("select[name=\"accountNumber\"]").val())
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
@ -192,7 +259,8 @@ var vaultui = (function () {
|
||||
$("#vault-confirm").text("Confirm the pin code");
|
||||
return new Promise(function (resolve, reject) {
|
||||
var pinCode = "";
|
||||
$("#vault-confirm").click(async function () {
|
||||
$("#vault-confirm").click(async function (e) {
|
||||
e.preventDefault();
|
||||
$("#pin-input").css("display", "none");
|
||||
$("#vault-confirm").css("display", "none");
|
||||
$(this).unbind();
|
||||
@ -221,7 +289,8 @@ var vaultui = (function () {
|
||||
$("#vault-confirm").css("display", "block");
|
||||
$("#vault-confirm").text("Confirm the passphrase");
|
||||
return new Promise(function (resolve, reject) {
|
||||
$("#vault-confirm").click(async function () {
|
||||
$("#vault-confirm").click(async function (e) {
|
||||
e.preventDefault();
|
||||
var passphrase = $("#Password").val();
|
||||
if (passphrase !== $("#PasswordConfirmation").val()) {
|
||||
show(VaultFeedbacks.invalidPasswordConfirmation);
|
||||
@ -250,10 +319,12 @@ var vaultui = (function () {
|
||||
this.askForPin = async function () {
|
||||
if (!await self.ensureConnectedToBackend())
|
||||
return false;
|
||||
|
||||
|
||||
self.bridge.socket.send("ask-pin");
|
||||
var json = await self.bridge.waitBackendMessage();
|
||||
if (json.hasOwnProperty("error")) {
|
||||
if (json.error == "device-already-unlocked")
|
||||
return true;
|
||||
if (await needRetry(json))
|
||||
return await self.askForPin();
|
||||
return false;
|
||||
@ -293,6 +364,12 @@ var vaultui = (function () {
|
||||
self.psbt = json.psbt;
|
||||
return true;
|
||||
};
|
||||
|
||||
this.closeBridge = function () {
|
||||
if (self.bridge) {
|
||||
self.bridge.close();
|
||||
}
|
||||
};
|
||||
}
|
||||
return {
|
||||
VaultFeedback: VaultFeedback,
|
||||
|
@ -48,5 +48,5 @@
|
||||
"Pay with Changelly": "Pagar com Changelly",
|
||||
"Close": "Fechar",
|
||||
"NotPaid_ExtraTransaction": "A fatura não foi paga integralmente. Por favor, envie outra transação para cobrir o valor devido.",
|
||||
"Recommended_Fee": "Recommended fee: {{feeRate}} sat/byte"
|
||||
"Recommended_Fee": "Taxa recomendada: {{feeRate}} sat/byte"
|
||||
}
|
@ -48,5 +48,5 @@
|
||||
"Pay with Changelly": "Оплатить с помощью Changelly",
|
||||
"Close": "Закрыть",
|
||||
"NotPaid_ExtraTransaction": "Счет не был оплачен полностью. Пожалуйста, отправьте еще одну транзакцию для покрытия суммы задолженности.",
|
||||
"Recommended_Fee": "Recommended fee: {{feeRate}} sat/byte"
|
||||
"Recommended_Fee": "Рекомендуемая комиссия: {{feeRate}} сат/байт"
|
||||
}
|
@ -42,11 +42,6 @@ a {
|
||||
transition-property: background, color;
|
||||
}
|
||||
|
||||
/* Admin Sections */
|
||||
.section-heading {
|
||||
text-align: var(--btcpay-section-heading-text-align, center);
|
||||
}
|
||||
|
||||
/* Admin Sidebar Navigation */
|
||||
a.nav-link {
|
||||
color: var(--btcpay-nav-color-link, var(--btcpay-color-neutral-600));
|
||||
|
@ -6,6 +6,7 @@
|
||||
--btcpay-brand-darker: #19154B;
|
||||
--btcpay-brand-darkest: #02000C;
|
||||
|
||||
/* Color definitions for specific purposes - map the general colors or define additional ones */
|
||||
--btcpay-color-white: #fff;
|
||||
--btcpay-color-black: #000;
|
||||
|
||||
@ -19,7 +20,6 @@
|
||||
--btcpay-color-neutral-800: #181334;
|
||||
--btcpay-color-neutral-900: #100d20;
|
||||
|
||||
/* Color definitions for specific purposes - map the general colors or define additional ones */
|
||||
--btcpay-color-primary: var(--btcpay-brand-medium); /* Usage: Text color */
|
||||
--btcpay-color-primary-backdrop: #baa4fd; /* Usage: Backgrounds, borders, shadows */
|
||||
--btcpay-color-primary-accent: #4b3bc0; /* Usage: Background on Focus/Hover */
|
||||
@ -55,8 +55,6 @@
|
||||
--btcpay-body-color-link: var(--btcpay-color-primary);
|
||||
--btcpay-body-color-link-accent: var(--btcpay-color-primary-accent);
|
||||
|
||||
--btcpay-section-heading-text-align: left;
|
||||
|
||||
--btcpay-nav-color-link-accent: var(--btcpay-color-neutral-100);
|
||||
|
||||
--btcpay-header-bg: var(--btcpay-brand-darker);
|
||||
|
@ -6,6 +6,7 @@
|
||||
--btcpay-brand-darker: #0F3B21;
|
||||
--btcpay-brand-darkest: #05120a;
|
||||
|
||||
/* Color definitions for specific purposes - map the general colors or define additional ones */
|
||||
--btcpay-color-white: #fff;
|
||||
--btcpay-color-black: #000;
|
||||
|
||||
@ -19,10 +20,9 @@
|
||||
--btcpay-color-neutral-800: #343a40;
|
||||
--btcpay-color-neutral-900: #212529;
|
||||
|
||||
/* Color definitions for specific purposes - map the general colors or define additional ones */
|
||||
--btcpay-color-primary: #329f80;
|
||||
--btcpay-color-primary-backdrop: rgba(81, 173, 147, 0.25);
|
||||
--btcpay-color-primary-accent: #267861;
|
||||
--btcpay-color-primary: #329f80; /* Usage: Text color */
|
||||
--btcpay-color-primary-backdrop: rgba(81, 173, 147, 0.25); /* Usage: Backgrounds, borders, shadows */
|
||||
--btcpay-color-primary-accent: #267861; /* Usage: Background on Focus/Hover */
|
||||
--btcpay-color-secondary: var(--btcpay-color-neutral-600);
|
||||
--btcpay-color-secondary-backdrop: rgba(130, 138, 145, 0.25);
|
||||
--btcpay-color-secondary-accent: var(--btcpay-color-neutral-800);
|
||||
|
@ -1,78 +0,0 @@
|
||||
:root {
|
||||
--btcpay-color-white: #fff;
|
||||
--btcpay-color-black: #000;
|
||||
|
||||
--btcpay-color-neutral-100: #FBFAF8;
|
||||
--btcpay-color-neutral-200: #F5F5F3;
|
||||
--btcpay-color-neutral-300: #E5E5E5;
|
||||
--btcpay-color-neutral-400: #ced4da;
|
||||
--btcpay-color-neutral-500: #adb5bd;
|
||||
--btcpay-color-neutral-600: #536E8D;
|
||||
--btcpay-color-neutral-700: #465C76;
|
||||
--btcpay-color-neutral-800: #244B71;
|
||||
--btcpay-color-neutral-900: #202C39;
|
||||
|
||||
--btcpay-color-primary: #329f80;
|
||||
--btcpay-color-primary-accent: #267861;
|
||||
--btcpay-color-primary-backdrop: rgba(81, 173, 147, 0.2);
|
||||
--btcpay-color-secondary: var(--btcpay-color-neutral-600);
|
||||
--btcpay-color-secondary-accent: var(--btcpay-color-neutral-800);
|
||||
--btcpay-color-secondary-backdrop: rgba(130, 138, 145, 0.25);
|
||||
--btcpay-color-success: #329f80;
|
||||
--btcpay-color-success-accent: #1e7e34;
|
||||
--btcpay-color-success-backdrop: rgba(72, 180, 97, 0.25);
|
||||
--btcpay-color-info: #17a2b8;
|
||||
--btcpay-color-info-accent: #117a8b;
|
||||
--btcpay-color-info-backdrop: rgba(58, 176, 195, 0.25);
|
||||
--btcpay-color-warning: #ffc107;
|
||||
--btcpay-color-warning-accent: #d39e00;
|
||||
--btcpay-color-warning-backdrop: rgba(222, 170, 12, 0.25);
|
||||
--btcpay-color-danger: #dc3545;
|
||||
--btcpay-color-danger-accent: #bd2130;
|
||||
--btcpay-color-danger-backdrop: rgba(225, 83, 97, 0.25);
|
||||
--btcpay-color-light: var(--btcpay-color-neutral-100);
|
||||
--btcpay-color-light-accent: #dae0e5;
|
||||
--btcpay-color-light-backdrop: rgba(216, 217, 219, 0.25);
|
||||
--btcpay-color-dark: var(--btcpay-color-neutral-900);
|
||||
--btcpay-color-dark-accent: #1d2124;
|
||||
--btcpay-color-dark-backdrop: rgba(82, 88, 93, 0.25);
|
||||
|
||||
--btcpay-bg-body: var(--btcpay-color-neutral-100);
|
||||
--btcpay-bg-dark: var(--btcpay-color-neutral-900);
|
||||
--btcpay-bg-tile: var(--btcpay-color-white);
|
||||
--btcpay-bg-cta: var(--btcpay-bg-dark);
|
||||
|
||||
--btcpay-body-color: var(--btcpay-color-neutral-900);
|
||||
--btcpay-body-color-link: var(--btcpay-color-primary);
|
||||
--btcpay-body-color-link-accent: var(--btcpay-color-primary-accent);
|
||||
|
||||
--btcpay-section-heading-text-align: left;
|
||||
|
||||
--btcpay-preformatted-text-color: var(--btcpay-color-neutral-900);
|
||||
|
||||
--btcpay-font-size-base: 16px;
|
||||
--btcpay-font-family-head: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
|
||||
--btcpay-font-family-base: -apple-system, 'Open Sans', BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--btcpay-font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
}
|
||||
|
||||
/* Bootstrap modifications */
|
||||
html {
|
||||
font-size: var(--btcpay-font-size-base);
|
||||
}
|
||||
|
||||
.bg-dark {
|
||||
background-color: var(--btcpay-bg-dark) !important;
|
||||
}
|
||||
|
||||
header.masthead::before,
|
||||
.service-box img {
|
||||
filter: hue-rotate(410deg) saturate(33%); }
|
||||
|
||||
.table {
|
||||
margin: 1.5rem 0 3rem;
|
||||
}
|
||||
|
||||
.table th {
|
||||
border-top: 0;
|
||||
}
|
578
BTCPayServer/wwwroot/vendor/popper/popper.js
vendored
578
BTCPayServer/wwwroot/vendor/popper/popper.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>1.0.3.144</Version>
|
||||
<Version>1.0.3.145</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
51
Docs/Themes.md
Normal file
51
Docs/Themes.md
Normal file
@ -0,0 +1,51 @@
|
||||
# Developing and extending themes
|
||||
|
||||
The BTCPay Server user interface is built on a customized version of Bootstrap that supports [CSS custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*).
|
||||
This allows us to change theme related settings like fonts and colors without affecting the [`bootstrap.css`](#Notes-on-bootstrapcss).
|
||||
Also we can provide just the relevant customized parts instead of shipping a whole `bootstrap.css` file for each theme.
|
||||
|
||||
Take a look at the [predefined themes](../BTCPayServer/wwwroot/main/themes) to get an overview of this approach.
|
||||
|
||||
## Modifying existing themes
|
||||
|
||||
The custom property definitions in the `:root` selector are divided into several sections, that can be seen as a cascade:
|
||||
|
||||
- The first section contains general definitions (i.e. for custom brand and neutral colors).
|
||||
- The second section defines variables for specific purposes.
|
||||
Here you can map the general definitions or create additional ones.
|
||||
- The third section contains definitions for specific parts of the page, sections or components.
|
||||
Here you should try to reuse definitions from above as much as possible to provide a consistent look and feel.
|
||||
|
||||
The variables defined in a theme file get used in the [`site.css`](../BTCPayServer/wwwroot/main/site.css) and [`creative.css`](../BTCPayServer/wwwroot/main/bootstrap4-creativestart/creative.css) files.
|
||||
|
||||
### Overriding Bootstrap selectors
|
||||
|
||||
In addition to the variables you can also provide styles by directly adding CSS selectors to this file.
|
||||
This can be seen as a last resort in case there is no variable for something you want to change or some minor tweaking.
|
||||
|
||||
### Adding theme variables
|
||||
|
||||
In general it is a good idea to introduce specific variables for special purposes (like setting the link colors of a specific section).
|
||||
This allows us to address individual portions of the styles without affecting other parts which might be tight to a general variable.
|
||||
|
||||
For cases in which you want to introduce new variables that are used across all themes, add them to the `site.css` file.
|
||||
This file contains our modifications of the Bootstrap styles.
|
||||
Refrain from modifying `bootstrap.css` directly – see the [additional notes](#Notes-on-bootstrapcss) for the reasoning behind this.
|
||||
|
||||
## Adding a new theme
|
||||
|
||||
You should copy one of our predefined themes and change the variables to fit your needs.
|
||||
|
||||
To test and play around with the adjustments, you can also use the developer tools of the browser:
|
||||
Inspect the `<html>` element and modify the variables in the `:root` section of the styles inspector.
|
||||
|
||||
## Notes on bootstrap.css
|
||||
|
||||
The `bootstrap.css` file itself is generated based on what the original vendor `bootstrap.css` provides.
|
||||
|
||||
Right now [Bootstrap](https://getbootstrap.com/docs/4.3/getting-started/theming/) does not use custom properties, but in the future it is likely that they might switch to this approach as well.
|
||||
Until then we created a build script [in this repo](https://github.com/dennisreimann/btcpayserver-ui-prototype) which generates the `bootstrap.css` file we are using here.
|
||||
|
||||
The general approach should be to not modify the `bootstrap.css`, so that we can keep it easily updatable.
|
||||
The initial modifications of this file were made in order to allow for this themeing approach.
|
||||
Because bootstrap has colors spread all over the place we'd otherwise have to override mostly everything, that's why these general modifications are in the main `bootstrap.css` file.
|
10
README.md
10
README.md
@ -7,7 +7,7 @@
|
||||
|
||||
# BTCPay Server
|
||||
|
||||
## Introduction
|
||||
## Introduction
|
||||
|
||||
BTCPay Server is a free and open-source cryptocurrency payment processor which allows you to receive payments in Bitcoin and altcoins directly, with no fees, transaction cost or a middleman.
|
||||
|
||||
@ -58,13 +58,13 @@ Thanks to the [apps](https://github.com/btcpayserver/btcpayserver-doc/blob/maste
|
||||
|
||||
## Getting Started
|
||||
|
||||
Firstly, decide if you want to host an instance yourself or use a [third-party host](https://docs.btcpayserver.org/deployment/thirdpartyhosting). If you've chosen to self-host, we documented plenty [ways to deploy BTCPay Server](https://docs.btcpayserver.org/deployment/deployment).
|
||||
Firstly, decide if you want to host an instance yourself or use a [third-party host](https://docs.btcpayserver.org/deployment/thirdpartyhosting). If you've chosen to self-host, we documented plenty [ways to deploy BTCPay Server](https://docs.btcpayserver.org/deployment/deployment).
|
||||
|
||||
After successful deployment, make sure to check our [getting started](https://docs.btcpayserver.org/getting-started/registeraccount) and [walkthrough](https://docs.btcpayserver.org/btcpay-basics/walkthrough) guides. In case you would like to use Lightning Network, see [Lightning guide](https://docs.btcpayserver.org/features/lightningnetwork).
|
||||
|
||||
## Documentation
|
||||
|
||||
Please check out our [official website](https://btcpayserver.org/), our [complete documentation](https://github.com/btcpayserver/btcpayserver-doc) and [FAQ](https://github.com/btcpayserver/btcpayserver-doc/tree/master/FAQ#btcpay-frequently-asked-questions-and-common-issues) for more details.
|
||||
Please check out our [official website](https://btcpayserver.org/), our [complete documentation](https://github.com/btcpayserver/btcpayserver-doc) and [FAQ](https://github.com/btcpayserver/btcpayserver-doc/tree/master/FAQ#btcpay-frequently-asked-questions-and-common-issues) for more details.
|
||||
|
||||
If you have trouble using BTCPay, consider joining [communities listed on official website](https://btcpayserver.org/#communityCTA) to get help from BTCPay community members. Only file [Github issue](https://github.com/btcpayserver/btcpayserver/issues) for technical issues you can't resolve through other channels or feature requests you've validated with other members of community.
|
||||
|
||||
@ -82,6 +82,8 @@ Contributors looking to do something a bit more challenging, before opening a pu
|
||||
|
||||
You also have an awesome video of our contributors which explains how to get started.[](https://www.youtube.com/embed/VNMnd-dX9Q8)
|
||||
|
||||
Here is some info about [how to extend the themes](Docs/Themes.md)
|
||||
|
||||
## How to build
|
||||
|
||||
While the documentation advises to use docker-compose, you may want to build BTCPay yourself.
|
||||
@ -183,4 +185,4 @@ The BTCPay Server Project is proudly supported by these entities through the [BT
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
If you'd like to support the project, please visit the [donation page](https://btcpayserver.org/donate/).
|
||||
If you'd like to support the project, please visit the [donation page](https://btcpayserver.org/donate/).
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1.505-alpine3.7 AS builder
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1.607 AS builder
|
||||
WORKDIR /source
|
||||
COPY nuget.config nuget.config
|
||||
COPY Build/Common.csproj Build/Common.csproj
|
||||
@ -14,7 +14,7 @@ COPY BTCPayServer/. BTCPayServer/.
|
||||
COPY Build/Version.csproj Build/Version.csproj
|
||||
RUN cd BTCPayServer && dotnet publish --output /app/ --configuration Release
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.9-alpine3.7
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.14-alpine3.9
|
||||
|
||||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false
|
||||
RUN apk add --no-cache icu-libs openssh-keygen
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This is a manifest image, will pull the image with the same arch as the builder machine
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1.505 AS builder
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1.607 AS builder
|
||||
RUN apt-get update \
|
||||
&& apt-get install -qq --no-install-recommends qemu qemu-user-static qemu-user binfmt-support
|
||||
|
||||
@ -19,7 +19,7 @@ COPY Build/Version.csproj Build/Version.csproj
|
||||
RUN cd BTCPayServer && dotnet publish --output /app/ --configuration Release
|
||||
|
||||
# Force the builder machine to take make an arm runtime image. This is fine as long as the builder does not run any program
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.9-stretch-slim-arm32v7
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.14-stretch-slim-arm32v7
|
||||
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends iproute2 openssh-client \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
Reference in New Issue
Block a user