Merge branch 'master' into max-base-fee

This commit is contained in:
Keyan 2024-10-20 18:25:16 -05:00 committed by GitHub
commit d146e50660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 41 additions and 26 deletions

3
.gitignore vendored
View File

@ -56,3 +56,6 @@ docker-compose.*.yml
# nostr wallet connect
scripts/nwc-keys.json
# lnbits
docker/lnbits/data

View File

@ -135,3 +135,5 @@ toyota-corolla0,pr,#1449,,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2
toyota-corolla0,pr,#1455,#1437,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2024-10-02
SouthKoreaLN,issue,#1436,,easy,,,,10k,south_korea_ln@stacker.news,2024-10-02
TonyGiorgio,issue,#1462,,easy,urgent,,,30k,TonyGiorgio@stacker.news,2024-10-07
hkarani,issue,#1369,#1458,good-first-issue,,,,2k,???,???
toyota-corolla0,pr,#1369,#1458,good-first-issue,,,,20k,toyota_corolla0@stacker.news,2024-10-20

1 name type pr id issue ids difficulty priority changes requested notes amount receive method date paid
135 toyota-corolla0 pr #1455 #1437 good-first-issue 20k toyota_corolla0@stacker.news 2024-10-02
136 SouthKoreaLN issue #1436 easy 10k south_korea_ln@stacker.news 2024-10-02
137 TonyGiorgio issue #1462 easy urgent 30k TonyGiorgio@stacker.news 2024-10-07
138 hkarani issue #1369 #1458 good-first-issue 2k ??? ???
139 toyota-corolla0 pr #1369 #1458 good-first-issue 20k toyota_corolla0@stacker.news 2024-10-20

View File

@ -586,7 +586,8 @@ services:
- 'keys-file.json'
cpu_shares: "${CPU_SHARES_LOW}"
lnbits:
image: lnbits/lnbits:0.12.5
build:
context: ./docker/lnbits
container_name: lnbits
profiles:
- wallets
@ -596,6 +597,7 @@ services:
depends_on:
- stacker_lnd
environment:
- LNBITS_ADMIN_UI=true
- LNBITS_BACKEND_WALLET_CLASS=LndWallet
- LND_GRPC_ENDPOINT=stacker_lnd
- LND_GRPC_PORT=10009

5
docker/lnbits/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM lnbits/lnbits:0.12.5
COPY ["./data/database.sqlite3", "/app/data/database.sqlite3"]
COPY ["./data/.super_user", "/app/data/.super_user"]

View File

@ -0,0 +1 @@
e46288268b67457399a5fca81809573e

Binary file not shown.

View File

@ -1,27 +1,24 @@
For testing LNbits, you need to create a LNbits account first via the web interface.
LNbits' database is seeded with a superuser (see https://docs.lnbits.org/guide/admin_ui.html).
By default, you can access it at `localhost:5001` (see `LNBITS_WEB_PORT` in .env.development).
The following credentials were used:
After you created a wallet, you should find the invoice and admin key under `Node URL, API keys and API docs`.
- username: `stackernews`
- password: `stackernews`
> [!IMPORTANT]
>
> Since your browser is running on your host machine but the server is running inside a docker container, the server will not be able to reach LNbits with `localhost:5001` to create invoices. This makes it hard to test send+receive at the same time.
>
> For now, you need to patch the `_createInvoice` function in wallets/lnbits/server.js to always use `lnbits:5000` as the URL:
>
> ```diff
> diff --git a/wallets/lnbits/server.js b/wallets/lnbits/server.js
> index 39949775..e3605c45 100644
> --- a/wallets/lnbits/server.js
> +++ b/wallets/lnbits/server.js
> @@ -11,6 +11,7 @@ async function _createInvoice ({ url, invoiceKey, amount, expiry }, { me }) {
> const memo = me.hideInvoiceDesc ? undefined : 'autowithdraw to LNbits from SN'
> const body = JSON.stringify({ amount, unit: 'sat', expiry, memo, out: false })
>
> + url = 'http://lnbits:5000'
> const res = await fetch(url + path, { method: 'POST', headers, body })
> if (!res.ok) {
> const errBody = await res.json()
> ```
>
To get access to the superuser, you need to visit the admin UI:
http://localhost:5001/wallet?usr=e46288268b67457399a5fca81809573e
After that, the cookies will be set to access this wallet:
http://localhost:5001/wallet?&wal=15ffe06c74cc4082a91f528d016d9028
Or simply copy the keys from here:
* admin key: `640cc7b031eb427c891eeaa4d9c34180`
* invoice key: `5deed7cd634e4306bb5e696f4a03cdac`
( These keys can be found under `Node URL, API keys and API docs`. )
To use the same URL to connect to LNbits in the browser and server during local development, `localhost:<port>` is mapped to `lnbits:5000` on the server.

View File

@ -28,9 +28,14 @@ export async function createInvoice (
out: false
})
const hostname = url.replace(/^https?:\/\//, '')
let hostname = url.replace(/^https?:\/\//, '')
const agent = getAgent({ hostname })
if (process.env.NODE_ENV !== 'production' && hostname.startsWith('localhost:')) {
// to make it possible to attach LNbits for receives during local dev
hostname = 'lnbits:5000'
}
const res = await fetch(`${agent.protocol}//${hostname}${path}`, {
method: 'POST',
headers,