Compare commits
304 Commits
v1.13.2-rc
...
plugins
Author | SHA1 | Date | |
---|---|---|---|
3c7751ae80 | |||
6d9bbb50d6 | |||
508002503e | |||
031bb7b224 | |||
2d6827dd19 | |||
5e00bc43d5 | |||
db8a2930a4 | |||
7325610ac5 | |||
36b064b50f | |||
7ecf6504d0 | |||
7c971df109 | |||
c7f6784364 | |||
b816c4462e | |||
ca750f4152 | |||
6be968f7bf | |||
89cd1079fe | |||
fa5470c587 | |||
820421fcbc | |||
a4ab2dcd84 | |||
d14f4f8173 | |||
386c18b897 | |||
5d98fe7b34 | |||
2008d15dda | |||
d206a88e3a | |||
bbce88f269 | |||
edbfafcaf2 | |||
b64ddab08b | |||
c34b4d64e5 | |||
90308ce6b9 | |||
a3b702c360 | |||
4f9820ae1b | |||
6884db431f | |||
349dbdc85d | |||
dc795311fa | |||
7ff2f58f34 | |||
c736babd40 | |||
b5174dcbcd | |||
ffe40daaa6 | |||
43649026c1 | |||
84212de830 | |||
d958ef2ec7 | |||
b60dcb6927 | |||
9af32e7089 | |||
7b10067ce5 | |||
7746e5beef | |||
38fd1d338b | |||
b0e4186733 | |||
c6c0a7b6ac | |||
f2e35529e9 | |||
1deddbcf14 | |||
c14f26340e | |||
ab5497eb3d | |||
1b1fdd4360 | |||
fbc4dde974 | |||
4d1f8c1d16 | |||
524ad8393d | |||
0def52416d | |||
375405ba51 | |||
9ce1ba0019 | |||
ff6043cf67 | |||
e6e3efb709 | |||
ec029fa5cd | |||
5f9926896a | |||
e68cb1805f | |||
f554478254 | |||
45a8852799 | |||
92dae8dff6 | |||
beb58cb90b | |||
f379593a2f | |||
15ddf9d619 | |||
82b479cc7c | |||
ba2db52859 | |||
8f5af29f23 | |||
7b5049099c | |||
5d37f31d72 | |||
05aac2801c | |||
160a19f6c7 | |||
afedb48eeb | |||
25716c8ab7 | |||
61c9466374 | |||
4b3d7fd004 | |||
e8657da952 | |||
b4e3c8f0b5 | |||
405def199f | |||
ea9fe8386d | |||
5dd8b3701f | |||
e6b4b83bc0 | |||
253cfda4b4 | |||
f03063e390 | |||
5e295bab89 | |||
92cf26dc3b | |||
a3ed557244 | |||
475f16b280 | |||
b3b54ccaf7 | |||
07cba914bb | |||
7e569c044f | |||
7bb32e3fdf | |||
8aea701f6c | |||
177628d05b | |||
fe644bb979 | |||
70168f73ce | |||
5a27155984 | |||
b38c05f33f | |||
2ff1c80661 | |||
6f7bce216c | |||
f7981b2b12 | |||
2b81ea5040 | |||
733dc7561a | |||
c323ef51fa | |||
4d97de8208 | |||
dd99fec838 | |||
539352f598 | |||
a63288fce8 | |||
0f57c09aff | |||
15068c1398 | |||
6ef4822ad2 | |||
f2f3e472b0 | |||
57e42df769 | |||
0918c79305 | |||
ef0f61dafa | |||
4e1c841615 | |||
713e0bf5e5 | |||
aa6f41bace | |||
d44c06320e | |||
0d2603dd5a | |||
c87a4511cd | |||
3b61be1b82 | |||
28d05edd96 | |||
21d159d5f9 | |||
d2d02e18e7 | |||
47208db8db | |||
ea6ad0995f | |||
0c1b474c35 | |||
0e90f1219c | |||
abb21c68cb | |||
9c1404c261 | |||
ceb722c71f | |||
d863dfa0c8 | |||
0cc849be91 | |||
110524391b | |||
d452c1e578 | |||
86fead2809 | |||
6c80ca1d18 | |||
aa742b3079 | |||
01eb93bc43 | |||
e6d29afed6 | |||
3f88ea1e15 | |||
409b6df8a2 | |||
8304afd36c | |||
56400dcc27 | |||
d59ab2ef01 | |||
458f8979fb | |||
ca7b306dea | |||
f509b937fd | |||
19c75f51bd | |||
ca821a643e | |||
d8d3172b17 | |||
14ce5dd41f | |||
505b1d8310 | |||
c60a95a6fe | |||
63119c63f1 | |||
c5f4db4df6 | |||
77932f6e20 | |||
2d67e0e75c | |||
db8b7a4621 | |||
a6ac322246 | |||
8b5ea9fd56 | |||
d9aa8f7dbc | |||
5341b4eb08 | |||
935577de71 | |||
3d15ff31f5 | |||
e68942056d | |||
eff872148c | |||
3692602b15 | |||
3de38298b6 | |||
eb7d8694f5 | |||
8e53b3c9f0 | |||
6a714e6d9c | |||
f227b9aec5 | |||
a741ad446c | |||
e4d45798f1 | |||
e5b4f2a399 | |||
55fb4ec233 | |||
c5b4b1b9e6 | |||
ad6effa3bb | |||
c5e48eb975 | |||
675bb63d14 | |||
5c64a4ac40 | |||
0adb2cf233 | |||
316ed2a9bb | |||
cea2a3f513 | |||
5d01e07e2d | |||
ee0547448e | |||
08580eb244 | |||
e127478c2e | |||
9b7bd57cb1 | |||
f771b6dd70 | |||
f4ed031f99 | |||
b7d8077467 | |||
8197375845 | |||
74a3c6739c | |||
392023219b | |||
97420dfd3e | |||
30d1bcfa4d | |||
36b5a13d1c | |||
0dadac914e | |||
3a76bebcbc | |||
53f46d4b8d | |||
5911b998b5 | |||
45885c5137 | |||
1b5a7ed1e1 | |||
9be0810fb7 | |||
a3efae4cc5 | |||
2141eafa37 | |||
b403f6f1e8 | |||
0055746be6 | |||
2885335780 | |||
d1524a5e5d | |||
775101a31f | |||
48a0ed7b98 | |||
7843b6173c | |||
4446d506e9 | |||
7b824d5ec0 | |||
967c91f711 | |||
f7271f6ffb | |||
0b83d2b859 | |||
fc4a7a26fe | |||
f6e3ca32fb | |||
0a3b4f5d61 | |||
60d8dd81a4 | |||
0e2a7b5efd | |||
a664937526 | |||
00354de289 | |||
c70f58fd70 | |||
21c08acfd5 | |||
f38432e15e | |||
58309dd7aa | |||
59017e77eb | |||
be323ba147 | |||
f3350bcdbf | |||
79df9a027a | |||
3fe981d6f5 | |||
80265b56b8 | |||
90ce5acf99 | |||
eef2780e70 | |||
cedb04cc42 | |||
1fd8f48bda | |||
4f63ca4af4 | |||
6d72d7f6de | |||
78e4cb868d | |||
560117fe59 | |||
ee0e199add | |||
fb48b9fa52 | |||
c888a845ab | |||
c3e43cb5b3 | |||
9a855deca4 | |||
41bdbd784d | |||
e2e87652e1 | |||
c29b1be070 | |||
82fc59cc76 | |||
1f1f2ca819 | |||
d43119e4ac | |||
2b4c3e68b1 | |||
a35e8fa69a | |||
e855441455 | |||
62f426fea8 | |||
094db3dab9 | |||
14770d7a6b | |||
ac0722246b | |||
14785278ec | |||
359247542e | |||
e028f5d0c1 | |||
66c90ae5f7 | |||
72c876b62b | |||
89204f2256 | |||
0580e5bf9b | |||
6bfcb02a8c | |||
b9d73415a4 | |||
beaac40222 | |||
17bd4a3d9c | |||
ce61a07111 | |||
cadd197dd9 | |||
f97275ae16 | |||
6845c511c6 | |||
34c482a991 | |||
250762c758 | |||
06df50c5d0 | |||
240cb72d24 | |||
22678d2b50 | |||
1f593d0710 | |||
ec41e806dd | |||
bac5ad4bbc | |||
28ae60faf3 | |||
c9544b22d1 | |||
01d7ff2525 | |||
4f67a443c5 | |||
1f333058c9 | |||
6ef90503df | |||
cece43a921 | |||
8aae72f63e | |||
d3df78e71b | |||
4f6bd1a523 | |||
4b2d70e3fa | |||
ab729b0f7c |
58
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
58
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
name: "\U0001F41B Bug report"
|
||||
about: Report a bug or a technical issue
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Thank you for reporting a technical issue with one of my BTCPay Server plugins, like LNbank or PodServer.
|
||||
|
||||
For general issues with BTCPay Server please visit https://github.com/btcpayserver/btcpayserver/issues
|
||||
|
||||
General support is available on our community chat chat.btcpayserver.org
|
||||
|
||||
Please fill in as much of the template below as you're able.
|
||||
-->
|
||||
|
||||
**Plugin**
|
||||
Name and version of the plugin. <!--[available on the Server Settings > Plugins page] -->
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce the bug**
|
||||
Steps to reproduce the reported bug:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
|
||||
<!--
|
||||
A clear and concise description of what you expected to happen.
|
||||
-->
|
||||
|
||||
**Screenshots**
|
||||
|
||||
<!--
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
-->
|
||||
|
||||
**Your BTCPay Environment (please complete the following information):**
|
||||
- BTCPay Server Version: <!--[available in the right bottom corner of footer] -->
|
||||
- Lightning implementation <!--[e.g. LND, Core Lightning] -->
|
||||
- Deployment Method: <!--[e.g. Docker, Manual, Third-Party-host]-->
|
||||
- Browser: <!--[e.g. Chrome, Safari]-->
|
||||
|
||||
**Logs (if applicable)**
|
||||
|
||||
<!--
|
||||
If you are using the Docker setup, please post the output of the following command:
|
||||
|
||||
docker logs generated_btcpayserver_1
|
||||
|
||||
Otherwise, basic logs can be found in Server Settings > Logs.
|
||||
More logs https://docs.btcpayserver.org/Troubleshooting/#2-looking-through-the-logs
|
||||
-->
|
68
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
68
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -1,68 +0,0 @@
|
||||
name: 🐛 Bug Report
|
||||
description: File a bug report
|
||||
title: "[Bug]: "
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report! Please provide as much information as you can. It helps us better understand the problem and fix it faster.
|
||||
- type: textarea
|
||||
id: version
|
||||
attributes:
|
||||
label: What is your BTCPay version?
|
||||
description: You can see the version in the footer's bottom right corner
|
||||
placeholder: I'm running BTCPay v1.X.X.X
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: deployment
|
||||
attributes:
|
||||
label: How did you deploy BTCPay Server?
|
||||
description: Docker, manual, third-party host? Read more on deployment methods [here](https://docs.btcpayserver.org/Deployment/)
|
||||
placeholder: I'm running BTCPay Server on a...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: What happened?
|
||||
description: A clear and concise description of what the bug is.
|
||||
placeholder: Tell us what you see!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: How did you encounter this bug?
|
||||
description: Step by step describe how did you encounter the bug?
|
||||
placeholder: 1. I clicked X 2. Then I clicked Y 3. See error
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logoutput
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. Logs can be found in Server Settings > Logs. Here's how you can [troubleshoot an issue](https://docs.btcpayserver.org/Troubleshooting/)
|
||||
render: shell
|
||||
- type: textarea
|
||||
id: browser
|
||||
attributes:
|
||||
label: What browser do you use?
|
||||
description: Provide your browser and it's version. If you replicated issues on multiple browsers, let us know which ones.
|
||||
placeholder: For example Safari 15.00, Chrome 10.0, Tor, Edge, etc
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: additonal
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: Feel free to provide additional information. Screenshots are always helpful.
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Are you sure this is a bug report?
|
||||
description: By submitting this report, you agree that this is not a support or a feature request. For general questions please read our [documentation](https://docs.btcpayserver.org). You can ask questions in [discussions](https://github.com/btcpayserver/btcpayserver/discussions) and [on our community chat](https://chat.btcpayserver.org)
|
||||
options:
|
||||
- label: I confirm this is a bug report
|
||||
required: true
|
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
[submodule "LNbank"]
|
||||
path = Plugins/BTCPayServer.Plugins.LNbank
|
||||
url = git@github.com:dennisreimann/btcpayserver-plugin-lnbank.git
|
||||
[submodule "PodServer"]
|
||||
path = Plugins/BTCPayServer.Plugins.PodServer
|
||||
url = git@github.com:dennisreimann/btcpayserver-plugin-podserver.git
|
250
BTCPayServer.Tests/LNbankTests.cs
Normal file
250
BTCPayServer.Tests/LNbankTests.cs
Normal file
@ -0,0 +1,250 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Plugins.LNbank.Data.Models;
|
||||
using NBitcoin;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Support.UI;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace BTCPayServer.Tests
|
||||
{
|
||||
[Trait("Selenium", "Selenium")]
|
||||
[Collection(nameof(NonParallelizableCollectionDefinition))]
|
||||
public class LNbankTests : UnitTestBase
|
||||
{
|
||||
private const int TestTimeout = TestUtils.TestTimeout;
|
||||
|
||||
public LNbankTests(ITestOutputHelper helper) : base(helper)
|
||||
{
|
||||
}
|
||||
|
||||
[Fact(Timeout = TestTimeout)]
|
||||
[Trait("Lightning", "Lightning")]
|
||||
public async Task CanUseLNbank()
|
||||
{
|
||||
var implementations = new []
|
||||
{
|
||||
LightningConnectionType.CLightning,
|
||||
LightningConnectionType.LndREST
|
||||
};
|
||||
|
||||
foreach (var nodeType in implementations)
|
||||
{
|
||||
using var s = CreateSeleniumTester();
|
||||
|
||||
s.Server.ActivateLightning(nodeType);
|
||||
await s.StartAsync();
|
||||
s.RegisterNewUser(true);
|
||||
|
||||
// Setup store LN node with LNbank
|
||||
s.CreateNewStore();
|
||||
s.Driver.FindElement(By.Id("StoreNav-LightningBTC")).Click();
|
||||
s.Driver.FindElement(By.CssSelector("label[for=\"LightningNodeType-LNbank\"]")).Click();
|
||||
s.Driver.WaitForElement(By.Id("LNbank-CreateWallet"));
|
||||
Assert.Equal("", s.Driver.FindElement(By.Id("LNbankWallet")).GetAttribute("value"));
|
||||
|
||||
// Create new wallet, which is pre-selected afterwards
|
||||
s.Driver.FindElement(By.Id("LNbank-CreateWallet")).Click();
|
||||
var walletName = "Wallet" + RandomUtils.GetUInt64();
|
||||
s.Driver.FindElement(By.Id("Wallet_Name")).SendKeys(walletName);
|
||||
s.Driver.FindElement(By.Id("LNbank-Create")).Click();
|
||||
s.Driver.WaitForElement(By.Id("LNbankWallet"));
|
||||
var walletSelect = new SelectElement(s.Driver.FindElement(By.Id("LNbankWallet")));
|
||||
Assert.Equal(walletName, walletSelect.SelectedOption.Text);
|
||||
|
||||
// Finish and validate setup
|
||||
s.Driver.FindElement(By.Id("save")).Click();
|
||||
Assert.Contains("LNbank", s.Driver.FindElement(By.Id("CustomNodeInfo")).Text);
|
||||
|
||||
// LNbank wallets
|
||||
s.Driver.FindElement(By.Id("Nav-LNbank")).Click();
|
||||
Assert.Contains(walletName, s.Driver.FindElement(By.Id("LNbank-Wallets")).Text);
|
||||
Assert.Single(s.Driver.FindElements(By.CssSelector("#LNbank-Wallets a")));
|
||||
s.Driver.FindElement(By.CssSelector("#LNbank-Wallets a")).Click();
|
||||
|
||||
// Wallet
|
||||
Assert.Contains("0 sats", s.Driver.FindElement(By.Id("LNbank-WalletBalance")).Text);
|
||||
Assert.Contains("There are no transactions yet.", s.Driver.FindElement(By.Id("LNbank-WalletTransactions")).Text);
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletSettings")).Click();
|
||||
Assert.Contains(walletName, s.Driver.FindElement(By.Id("LNbank-WalletName")).Text);
|
||||
|
||||
// Receive
|
||||
var description = "First invoice";
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletReceive")).Click();
|
||||
s.Driver.FindElement(By.Id("Description")).SendKeys(description);
|
||||
s.Driver.FindElement(By.Id("Amount")).Clear();
|
||||
s.Driver.FindElement(By.Id("Amount")).SendKeys("21");
|
||||
s.Driver.FindElement(By.Id("LNbank-CreateInvoice")).Click();
|
||||
|
||||
// Details
|
||||
Assert.Contains(description, s.Driver.FindElement(By.Id("LNbank-TransactionDescription")).Text);
|
||||
Assert.Contains("21 sats unpaid", s.Driver.FindElement(By.Id("LNbank-TransactionAmount")).Text);
|
||||
var bolt11 = s.Driver.FindElement(By.Id("LNbank-CopyPaymentRequest")).GetAttribute("data-clipboard");
|
||||
var shareUrl = s.Driver.FindElement(By.Id("LNbank-CopyShareUrl")).GetAttribute("data-clipboard");
|
||||
Assert.StartsWith("ln", bolt11);
|
||||
|
||||
// List
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletOverview")).Click();
|
||||
var listUrl = s.Driver.Url;
|
||||
Assert.Single(s.Driver.FindElements(By.CssSelector("#LNbank-WalletTransactions tr")));
|
||||
Assert.Contains("21 sats", s.Driver.FindElement(By.CssSelector("#LNbank-WalletTransactions tr .transaction-amount")).Text);
|
||||
Assert.Contains(description, s.Driver.FindElement(By.CssSelector("#LNbank-WalletTransactions tr .transaction-description")).Text);
|
||||
Assert.Contains("unpaid", s.Driver.FindElement(By.CssSelector("#LNbank-WalletTransactions tr .transaction-status")).Text);
|
||||
Assert.Contains("0 sats", s.Driver.FindElement(By.Id("LNbank-WalletBalance")).Text);
|
||||
|
||||
// Share
|
||||
s.GoToUrl(shareUrl);
|
||||
Assert.Contains(description, s.Driver.FindElement(By.Id("LNbank-TransactionDescription")).Text);
|
||||
Assert.Contains("21 sats unpaid", s.Driver.FindElement(By.Id("LNbank-TransactionAmount")).Text);
|
||||
|
||||
// Pay invoice
|
||||
var resp = await s.Server.CustomerLightningD.Pay(bolt11);
|
||||
Assert.Equal(PayResult.Ok, resp.Result);
|
||||
TestUtils.Eventually(() =>
|
||||
{
|
||||
s.Driver.Navigate().Refresh();
|
||||
Assert.Contains("21 sats settled", s.Driver.FindElement(By.Id("LNbank-TransactionSettled")).Text);
|
||||
});
|
||||
|
||||
// List
|
||||
s.GoToUrl(listUrl);
|
||||
Assert.Single(s.Driver.FindElements(By.CssSelector("#LNbank-WalletTransactions tr")));
|
||||
Assert.Contains("21 sats", s.Driver.FindElement(By.CssSelector("#LNbank-WalletTransactions tr .transaction-settled")).Text);
|
||||
Assert.Contains("21 sats", s.Driver.FindElement(By.Id("LNbank-WalletBalance")).Text);
|
||||
|
||||
// Send
|
||||
var memo = "Donation";
|
||||
var amount = LightMoney.Satoshis(5);
|
||||
var invoice = await s.Server.CustomerLightningD.CreateInvoice(amount, memo, TimeSpan.FromHours(1));
|
||||
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletSend")).Click();
|
||||
s.Driver.FindElement(By.Id("Destination")).SendKeys(invoice.BOLT11);
|
||||
s.Driver.FindElement(By.Id("LNbank-Decode")).Click();
|
||||
|
||||
// Confirm
|
||||
Assert.Contains(memo, s.Driver.FindElement(By.Id("Description")).GetAttribute("value"));
|
||||
Assert.Contains("5 sats", s.Driver.FindElement(By.Id("LNbank-Amount")).Text);
|
||||
s.Driver.FindElement(By.Id("Description")).Clear();
|
||||
s.Driver.FindElement(By.Id("Description")).SendKeys("For Uncle Jim");
|
||||
s.Driver.FindElement(By.Id("LNbank-Send")).Click();
|
||||
Assert.Contains("Payment successfully sent and settled.", s.FindAlertMessage().Text);
|
||||
|
||||
// List
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletOverview")).Click();
|
||||
var amountEl = s.Driver.FindElement(By.CssSelector("#LNbank-WalletTransactions tr .transaction-amount"));
|
||||
var settledEl = s.Driver.FindElement(By.CssSelector("#LNbank-WalletTransactions tr .transaction-settled"));
|
||||
var amountMoney = LightMoney.MilliSatoshis(long.Parse(amountEl.GetAttribute("data-amount")));
|
||||
var amountSettledMoney = LightMoney.MilliSatoshis(long.Parse(settledEl.GetAttribute("data-amount-settled")));
|
||||
var feeMoney = LightMoney.MilliSatoshis(long.Parse(settledEl.GetAttribute("data-transaction-fee")));
|
||||
var amountSettled = (amountMoney + feeMoney) * -1;
|
||||
var balance = LightMoney.Satoshis(21) + amountSettled;
|
||||
Assert.Equal(2, s.Driver.FindElements(By.CssSelector("#LNbank-WalletTransactions tr")).Count);
|
||||
Assert.Equal(amount, amountMoney);
|
||||
Assert.Equal(amountSettled, amountSettledMoney);
|
||||
Assert.Contains("For Uncle Jim", s.Driver.FindElement(By.CssSelector("#LNbank-WalletTransactions tr .transaction-description")).Text);
|
||||
Assert.Contains($"{amount.ToUnit(LightMoneyUnit.Satoshi)} sats", amountEl.Text);
|
||||
Assert.Contains($"{amountSettled.ToUnit(LightMoneyUnit.Satoshi)} sats", settledEl.Text);
|
||||
Assert.Contains($"{balance.ToUnit(LightMoneyUnit.Satoshi)} sats", s.Driver.FindElement(By.Id("LNbank-WalletBalance")).Text);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(Timeout = TestTimeout)]
|
||||
[Trait("Lightning", "Lightning")]
|
||||
public async Task CanUseLNbankAccessKeys()
|
||||
{
|
||||
using var s = CreateSeleniumTester();
|
||||
|
||||
s.Server.ActivateLightning(LightningConnectionType.CLightning);
|
||||
await s.StartAsync();
|
||||
|
||||
s.GoToRegister();
|
||||
var user = s.RegisterNewUser();
|
||||
|
||||
s.GoToRegister();
|
||||
var admin = s.RegisterNewUser(true);
|
||||
|
||||
// Create new wallet
|
||||
s.Driver.FindElement(By.Id("Nav-LNbank")).Click();
|
||||
var walletName = "AccessKeys" + RandomUtils.GetUInt64();
|
||||
s.Driver.FindElement(By.Id("Wallet_Name")).SendKeys(walletName);
|
||||
s.Driver.FindElement(By.Id("LNbank-Create")).Click();
|
||||
Assert.Contains("Wallet successfully created.", s.FindAlertMessage().Text);
|
||||
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletSettings")).Click();
|
||||
var walletId = s.Driver.FindElement(By.Id("LNbank-WalletId")).Text;
|
||||
var walletNavId = $"Nav-LNbank-Wallet-{walletId}";
|
||||
|
||||
// Check if the user sees it
|
||||
s.Logout();
|
||||
s.LogIn(user);
|
||||
s.Driver.AssertElementNotFound(By.Id(walletNavId));
|
||||
|
||||
void SetAccessLevel(AccessLevel level)
|
||||
{
|
||||
s.Logout();
|
||||
s.LogIn(admin);
|
||||
s.Driver.FindElement(By.Id(walletNavId)).Click();
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletSettings")).Click();
|
||||
s.Driver.FindElement(By.Id("SectionNav-WalletAccessKeys")).Click();
|
||||
s.Driver.FindElement(By.Id("AccessKey_Email")).SendKeys(user);
|
||||
var levelSelect = new SelectElement(s.Driver.FindElement(By.Id("AccessKey_Level")));
|
||||
levelSelect.SelectByValue(level.ToString());
|
||||
s.Driver.FindElement(By.Id("LNbank-CreateAccessKey")).Click();
|
||||
Assert.Contains("Access key added successfully.", s.FindAlertMessage().Text);
|
||||
|
||||
// Switch user
|
||||
s.Logout();
|
||||
s.LogIn(user);
|
||||
s.Driver.FindElement(By.Id(walletNavId)).Click();
|
||||
}
|
||||
|
||||
// Add read-only access key for user
|
||||
SetAccessLevel(AccessLevel.ReadOnly);
|
||||
|
||||
s.Driver.AssertElementNotFound(By.Id("LNbank-WalletSend"));
|
||||
s.Driver.AssertElementNotFound(By.Id("LNbank-WalletReceive"));
|
||||
s.Driver.AssertElementNotFound(By.Id("LNbank-WalletSettings"));
|
||||
|
||||
// Update access key for user: Invoice
|
||||
SetAccessLevel(AccessLevel.Invoice);
|
||||
|
||||
s.Driver.AssertElementNotFound(By.Id("LNbank-WalletSend"));
|
||||
s.Driver.AssertElementNotFound(By.Id("LNbank-WalletSettings"));
|
||||
|
||||
// Receive is allowed now
|
||||
var description = "My invoice";
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletReceive")).Click();
|
||||
s.Driver.FindElement(By.Id("Description")).SendKeys(description);
|
||||
s.Driver.SetCheckbox(By.Id("AttachDescription"), true);
|
||||
s.Driver.FindElement(By.Id("Amount")).Clear();
|
||||
s.Driver.FindElement(By.Id("Amount")).SendKeys("21");
|
||||
s.Driver.FindElement(By.Id("LNbank-CreateInvoice")).Click();
|
||||
Assert.Contains(description, s.Driver.FindElement(By.Id("LNbank-TransactionDescription")).Text);
|
||||
Assert.Contains("21 sats unpaid", s.Driver.FindElement(By.Id("LNbank-TransactionAmount")).Text);
|
||||
var bolt11 = s.Driver.FindElement(By.Id("LNbank-CopyPaymentRequest")).GetAttribute("data-clipboard");
|
||||
Assert.StartsWith("ln", bolt11);
|
||||
|
||||
// Update access key for user: Send
|
||||
SetAccessLevel(AccessLevel.Send);
|
||||
|
||||
s.Driver.AssertElementNotFound(By.Id("LNbank-WalletSettings"));
|
||||
|
||||
// Send is allowed now
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletSend")).Click();
|
||||
s.Driver.FindElement(By.Id("Destination")).SendKeys(bolt11);
|
||||
s.Driver.FindElement(By.Id("LNbank-Decode")).Click();
|
||||
Assert.Contains(description, s.Driver.FindElement(By.Id("Description")).GetAttribute("value"));
|
||||
Assert.Contains("21 sats", s.Driver.FindElement(By.Id("LNbank-Amount")).Text);
|
||||
s.Driver.FindElement(By.Id("LNbank-Send")).Click();
|
||||
Assert.Contains("Insufficient balance: 0 sats — tried to send 21 sats.", s.FindAlertMessage(StatusMessageModel.StatusSeverity.Error).Text);
|
||||
|
||||
// Update access key for user: Send
|
||||
SetAccessLevel(AccessLevel.Admin);
|
||||
|
||||
s.Driver.FindElement(By.Id("LNbank-WalletSettings")).Click();
|
||||
}
|
||||
}
|
||||
}
|
16
BTCPayServer.Tests/docker-customer-holdinvoice.sh
Executable file
16
BTCPayServer.Tests/docker-customer-holdinvoice.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
PREIMAGE=$(cat /dev/urandom | tr -dc 'a-f0-9' | fold -w 64 | head -n 1)
|
||||
HASH=`node -e "console.log(require('crypto').createHash('sha256').update(Buffer.from('$PREIMAGE', 'hex')).digest('hex'))"`
|
||||
PAYREQ=$(./docker-customer-lncli.sh addholdinvoice --memo "hodl invoice $@" $HASH "$@" | jq -r ".payment_request")
|
||||
|
||||
echo "HASH: $HASH"
|
||||
echo "PREIMAGE: $PREIMAGE"
|
||||
echo "PAY REQ: $PAYREQ"
|
||||
echo ""
|
||||
echo "SETTLE: ./docker-customer-lncli.sh settleinvoice $PREIMAGE"
|
||||
echo "CANCEL: ./docker-customer-lncli.sh cancelinvoice $HASH"
|
||||
echo "LOOKUP: ./docker-customer-lncli.sh lookupinvoice $HASH"
|
||||
echo ""
|
||||
echo "TRACK: ./docker-merchant-lncli.sh trackpayment $HASH"
|
||||
echo "PAY: ./docker-merchant-lncli.sh payinvoice $PAYREQ"
|
@ -97,8 +97,17 @@ connect $C_LN $m_ln_uri "Customer (LND) to Merchant (LND)"
|
||||
# Channels
|
||||
printf "\n\rEstablishing channels\n\r----------------------\n\r"
|
||||
|
||||
|
||||
create_channel $M_LN $c_ln_id "Merchant (LND) to Customer (LND)"
|
||||
create_channel $C_LN $c_cl_id "Customer (LND) to Customer (c-lightning)"
|
||||
create_channel $C_CL $m_cl_id "Customer (c-lightning) to Merchant (c-lightning)"
|
||||
create_channel $C_CL $m_cl_id "Customer (c-lightning) to Merchant (c-lightning)"
|
||||
create_channel $C_CL $m_ln_id "Customer (c-lightning) to Merchant (LND)"
|
||||
create_channel $C_LN $c_cl_id "Customer (LND) to Customer (c-lightning)"
|
||||
create_channel $C_LN $m_cl_id "Customer (LND) to Merchant (c-lightning)"
|
||||
create_channel $M_CL $m_ln_id "Merchant (c-lightning) to Merchant (LND)" "announce=false"
|
||||
create_channel $M_CL $c_ln_id "Merchant (c-lightning) to Customer (LND)" "announce=false"
|
||||
create_channel $M_CL $c_cl_id "Merchant (c-lightning) to Customer (c-lightning)" "announce=false"
|
||||
create_channel $M_LN $c_ln_id "Merchant (LND) to Customer (LND)"
|
||||
create_channel $M_LN $c_cl_id "Merchant (LND) to Customer (c-lightning)"
|
||||
create_channel $C_LN $m_ln_id "Customer (LND) to Merchant (LND)" --private
|
||||
|
@ -133,6 +133,8 @@
|
||||
<ProjectReference Include="..\BTCPayServer.Data\BTCPayServer.Data.csproj" />
|
||||
<ProjectReference Include="..\BTCPayServer.Rating\BTCPayServer.Rating.csproj" />
|
||||
<ProjectReference Include="..\BTCPayServer.Common\BTCPayServer.Common.csproj" />
|
||||
<ProjectReference Include="..\Plugins\BTCPayServer.Plugins.LNbank\BTCPayServer.Plugins.LNbank.csproj" />
|
||||
<ProjectReference Include="..\Plugins\BTCPayServer.Plugins.PodServer\BTCPayServer.Plugins.PodServer.csproj" />
|
||||
<ProjectReference Include="..\Plugins\BTCPayServer.Plugins.Custodians.FakeCustodian\BTCPayServer.Plugins.Custodians.FakeCustodian.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
"BTCPAY_NETWORK": "regtest",
|
||||
"BTCPAY_LAUNCHSETTINGS": "true",
|
||||
"BTCPAY_BTCLIGHTNING": "type=clightning;server=tcp://127.0.0.1:30993",
|
||||
"BTCPAY_BTCEXTERNALCLIGHTNING": "type=clightning;server=tcp://127.0.0.1:30993",
|
||||
"BTCPAY_BTCEXTERNALLNDREST": "type=lnd-rest;server=http://lnd:lnd@127.0.0.1:35531/;allowinsecure=true",
|
||||
"BTCPAY_BTCEXTERNALLNDSEEDBACKUP": "../BTCPayServer.Tests/TestData/LndSeedBackup/walletunlock.json",
|
||||
"BTCPAY_BTCEXTERNALSPARK": "server=/spark/btc/;cookiefile=fake",
|
||||
@ -31,7 +32,7 @@
|
||||
"BTCPAY_CHEATMODE": "true",
|
||||
"BTCPAY_EXPLORERPOSTGRES": "User ID=postgres;Include Error Detail=true;Host=127.0.0.1;Port=39372;Database=nbxplorer"
|
||||
},
|
||||
"applicationUrl": "http://localhost:14142/"
|
||||
"applicationUrl": "http://0.0.0.0:14142/"
|
||||
},
|
||||
"Bitcoin-HTTPS": {
|
||||
"commandName": "Project",
|
||||
@ -42,7 +43,8 @@
|
||||
"BTCPAY_PORT": "14142",
|
||||
"BTCPAY_HttpsUseDefaultCertificate": "true",
|
||||
"BTCPAY_VERBOSE": "true",
|
||||
"BTCPAY_BTCLIGHTNING": "type=clightning;server=tcp://127.0.0.1:30993",
|
||||
"BTCPAY_BTCLIGHTNING": "type=lnd-rest;server=http://lnd:lnd@127.0.0.1:35531/;allowinsecure=true",
|
||||
"BTCPAY_BTCEXTERNALCLIGHTNING": "type=clightning;server=tcp://127.0.0.1:30993",
|
||||
"BTCPAY_BTCEXTERNALLNDREST": "type=lnd-rest;server=http://lnd:lnd@127.0.0.1:35531/;allowinsecure=true",
|
||||
"BTCPAY_BTCEXTERNALLNDSEEDBACKUP": "../BTCPayServer.Tests/TestData/LndSeedBackup/walletunlock.json",
|
||||
"BTCPAY_BTCEXTERNALSPARK": "server=/spark/btc/;cookiefile=fake",
|
||||
@ -68,7 +70,7 @@
|
||||
"BTCPAY_CHEATMODE": "true",
|
||||
"BTCPAY_EXPLORERPOSTGRES": "User ID=postgres;Include Error Detail=true;Host=127.0.0.1;Port=39372;Database=nbxplorer"
|
||||
},
|
||||
"applicationUrl": "https://localhost:14142/"
|
||||
"applicationUrl": "https://0.0.0.0:14142/"
|
||||
},
|
||||
"Altcoins-HTTPS": {
|
||||
"commandName": "Project",
|
||||
@ -107,7 +109,7 @@
|
||||
"BTCPAY_CHEATMODE": "true",
|
||||
"BTCPAY_EXPLORERPOSTGRES": "User ID=postgres;Include Error Detail=true;Host=127.0.0.1;Port=39372;Database=nbxplorer"
|
||||
},
|
||||
"applicationUrl": "https://localhost:14142/"
|
||||
"applicationUrl": "https://0.0.0.0:14142/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
Plugins/BTCPayServer.Plugins.LNbank
Submodule
1
Plugins/BTCPayServer.Plugins.LNbank
Submodule
Submodule Plugins/BTCPayServer.Plugins.LNbank added at 0108a6827a
1
Plugins/BTCPayServer.Plugins.PodServer
Submodule
1
Plugins/BTCPayServer.Plugins.PodServer
Submodule
Submodule Plugins/BTCPayServer.Plugins.PodServer added at 097cf33c4c
@ -39,6 +39,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.PluginPacker",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.Plugins.Custodians.FakeCustodian", "Plugins\BTCPayServer.Plugins.Custodians.FakeCustodian\BTCPayServer.Plugins.Custodians.FakeCustodian.csproj", "{49E1FE45-FE71-49DF-8701-8394E974BE82}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BTCPayServer.Plugins.LNbank", "Plugins\BTCPayServer.Plugins.LNbank\BTCPayServer.Plugins.LNbank.csproj", "{8A4E2012-B044-44B2-BF79-8F745FFB7527}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BTCPayServer.Plugins.PodServer", "Plugins\BTCPayServer.Plugins.PodServer\BTCPayServer.Plugins.PodServer.csproj", "{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Altcoins-Debug|Any CPU = Altcoins-Debug|Any CPU
|
||||
@ -295,6 +299,54 @@ Global
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|x64.Build.0 = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|x86.Build.0 = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Release|x64.Build.0 = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Altcoins-Release|x86.Build.0 = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527}.Release|x86.Build.0 = Release|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Debug|x64.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Debug|x86.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Release|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Release|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Release|x64.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Release|x64.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Release|x86.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Altcoins-Release|x86.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Release|x64.Build.0 = Release|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -302,6 +354,8 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{545AFC8E-7BC2-43D9-84CA-F9468F4FF295} = {1FC7F660-ADF1-4D55-B61A-85C6AB083C33}
|
||||
{7DC94B25-1CFC-4170-AA41-7BA983E4C0B8} = {1FC7F660-ADF1-4D55-B61A-85C6AB083C33}
|
||||
{8A4E2012-B044-44B2-BF79-8F745FFB7527} = {1FC7F660-ADF1-4D55-B61A-85C6AB083C33}
|
||||
{5A50CF65-8364-4BB5-8EFF-26A8CC3C056D} = {1FC7F660-ADF1-4D55-B61A-85C6AB083C33}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {203A3162-BE45-4721-937D-6804E0E1AFF8}
|
||||
|
Reference in New Issue
Block a user