Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Commit 0c48177

Browse files
committed
fix: example app list nodes in graph
1 parent 9c7139e commit 0c48177

3 files changed

Lines changed: 21 additions & 19 deletions

File tree

example/App.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -441,30 +441,32 @@ const App = (): ReactElement => {
441441
/>
442442

443443
<Button
444-
title={'Get network graph'}
444+
title={'Get network graph nodes'}
445445
onPress={async (): Promise<void> => {
446446
const nodesRes = await ldk.networkGraphListNodeIds();
447447
if (nodesRes.isErr()) {
448448
return setMessage(nodesRes.error.message);
449449
}
450450

451-
let msg = 'Nodes: \n\n';
452-
453-
for (let index = 0; index < nodesRes.value.length; index++) {
454-
const id = nodesRes.value[index];
455-
456-
const nodes = await ldk.networkGraphNodes([id]);
457-
if (nodes.isOk()) {
458-
msg += `${JSON.stringify(nodes.value)}`;
459-
}
451+
let msg = 'Nodes: \n';
452+
453+
const nodes = await ldk.networkGraphNodes(nodesRes.value);
454+
if (nodes.isOk()) {
455+
nodes.value.forEach((node) => {
456+
const {
457+
id,
458+
shortChannelIds,
459+
lowest_inbound_channel_fees_base_sat,
460+
announcement_info_last_update,
461+
} = node;
462+
let time = new Date(announcement_info_last_update);
463+
464+
msg += `\n\n${id}\nChannels: ${shortChannelIds.length}\n`;
465+
msg += `Lowest inbound fee: ${lowest_inbound_channel_fees_base_sat} sat\n`;
466+
msg += `Last announcement: ${time}`;
467+
});
460468
}
461469

462-
// const nodes = `Nodes:\n\n${nodesRes.value.map(async (id) => {
463-
// const res = await ldk.networkGraphNodes([id]);
464-
// const node = res.isOk() ? res.value : [];
465-
// return `\n${JSON.stringify(id)}\n${JSON.stringify(node[0])}\n`;
466-
// })}`;
467-
468470
setMessage(`${msg}`);
469471
}}
470472
/>

lib/ios/Helpers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ extension NodeInfo {
119119
var asJson: [String: Any] {
120120
return [
121121
"shortChannelIds": get_channels().map({ String($0) }),
122-
"lowest_inbound_channel_fees_base_msat": get_lowest_inbound_channel_fees().get_base_msat(),
122+
"lowest_inbound_channel_fees_base_sat": get_lowest_inbound_channel_fees().get_base_msat() / 1000,
123123
"lowest_inbound_channel_fees_proportional_millionths": get_lowest_inbound_channel_fees().get_proportional_millionths(),
124-
"announcement_info_last_update": get_announcement_info().get_last_update()
124+
"announcement_info_last_update": Int(get_announcement_info().get_last_update()) * 1000
125125
]
126126
}
127127
}

lib/src/utils/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export type TNetworkGraphChannelInfo = {
165165
export type TNetworkGraphNodeInfo = {
166166
id: string;
167167
shortChannelIds: string[];
168-
lowest_inbound_channel_fees_base_msat: number;
168+
lowest_inbound_channel_fees_base_sat: number;
169169
lowest_inbound_channel_fees_proportional_millionths: number;
170170
announcement_info_last_update: number;
171171
};

0 commit comments

Comments
 (0)