Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡ Manage nostr-bot certify with lightning address via phoenixd getln… #1583

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4e7fd7c
handle zap request
ithiame Sep 10, 2024
beca9f5
handle zap request
ithiame Sep 10, 2024
71fc935
handle zap request
ithiame Sep 10, 2024
2b79d39
display zap on /admin/nostr
ithiame Oct 1, 2024
d12ad40
Merge branch 'main' of https://github.com/B2Bitcoin/B2BitcoinBootik i…
ithiame Oct 1, 2024
8ddb81e
Bolt 12 address phoenixD
ithiame Nov 4, 2024
2b57198
Bolt 12 address phoenixD
ithiame Nov 4, 2024
af88021
lightning payment qr code clickable
ithiame Nov 4, 2024
c77e0ab
⚡ Manage nostr-bot certify with lightning address via phoenixd getln…
ithiame Nov 5, 2024
418648c
test branch
ithiame Nov 6, 2024
6fd12ad
Merge branch 'lightning-qr-code-clickable' of https://github.com/B2Bi…
ithiame Nov 6, 2024
37ea850
update
ithiame Nov 6, 2024
406fa8b
update
ithiame Nov 6, 2024
8111c87
update
ithiame Nov 6, 2024
9138b5c
update
ithiame Nov 8, 2024
0d5eb4f
update
ithiame Nov 8, 2024
df15c01
update
ithiame Nov 8, 2024
fe0d8da
update
ithiame Nov 8, 2024
9d358dd
update
ithiame Nov 8, 2024
ae889fb
update
ithiame Nov 8, 2024
52e2e2e
update
ithiame Nov 8, 2024
d1ec38b
Merge branch 'nostr-zap' of https://github.com/B2Bitcoin/beBOP into t…
ithiame Nov 8, 2024
f6ca63c
update
ithiame Nov 8, 2024
aa5cea6
update
ithiame Nov 8, 2024
2f1ac66
update
ithiame Nov 8, 2024
5042347
update
ithiame Nov 8, 2024
8032344
update
ithiame Nov 8, 2024
4cba907
update
ithiame Nov 11, 2024
ddee47e
fix phoenixd bolt12 : save value in phoenixd runtimeConfig
ithiame Nov 18, 2024
e5a0e6b
fix suggested changes
ithiame Nov 18, 2024
0f0cd6c
fix suggested changes
ithiame Nov 18, 2024
1dc8c6b
fix suggested changes7
ithiame Nov 18, 2024
2a981e0
fix suggested changes7
ithiame Nov 18, 2024
a93522f
fix suggested changes7
ithiame Nov 19, 2024
cb78ca3
Merge branch 'main' into manage-nostr-bot-certify
Tirodem Nov 30, 2024
b865d4e
update
ithiame Dec 2, 2024
d54c514
update
ithiame Dec 2, 2024
892333e
Merge branch 'main' of https://github.com/B2Bitcoin/beBOP into test-b…
ithiame Dec 2, 2024
5281a9c
merge
ithiame Dec 2, 2024
07d1f7e
merge
ithiame Dec 2, 2024
b958236
fix conflict
ithiame Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/lib/server/phoenixd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ export async function phoenixdBalance(): Promise<{ balanceSat: number; feeCredit
return await res.json();
}

export async function phoenixdLndAddress(): Promise<string> {
const res = await fetch(`${runtimeConfig.phoenixd.url}/getlnaddress`, {
headers: {
Authorization: `Basic ${Buffer.from(`:${runtimeConfig.phoenixd.password}`).toString(
'base64'
)}`
}
});
if (!res.ok) {
throw error(500, `Could not get lnaddress: ${res.status} ${await res.text()}`);
}

return await res.text();
}

export async function phoenixdDetected(url?: string): Promise<boolean> {
return await Promise.race<boolean>([
fetch(`${url || runtimeConfig.phoenixd.url}/getinfo`).then(
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/runtime-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ const baseConfig = {
phoenixd: {
url: 'http://localhost:9740',
enabled: false,
password: ''
password: '',
lndAddress: ''
},
productActionSettings: {
eShop: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { setTimeout } from 'node:timers/promises';
import type { Event } from 'nostr-tools';
import { uniqBy } from '$lib/utils/uniqBy';
import { NOSTR_PROTOCOL_VERSION } from '$lib/server/locks/handle-messages';
import { phoenixdLndAddress } from '$lib/server/phoenixd';

export function load() {
return {
Expand Down Expand Up @@ -47,7 +48,7 @@ export const actions = {
: null;

const lndInfo = isLightningConfigured ? await lndGetInfo() : null;
const lnAddress = lndInfo?.uris?.[0];
const lnAddress = lndInfo?.uris?.[0] ?? (await phoenixdLndAddress());
ithiame marked this conversation as resolved.
Show resolved Hide resolved

await collections.nostrNotifications.insertOne({
_id: new ObjectId(),
Expand Down
Loading