Skip to content

Commit

Permalink
Embedded LND: Network info fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Dec 2, 2024
1 parent 0844f8b commit bfb2720
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
15 changes: 15 additions & 0 deletions models/NetworkInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import BaseModel from './BaseModel';

export default class NetworkInfo extends BaseModel {
graph_diameter: number;
avg_out_degree: number;
max_out_degree: number;
num_nodes: number;
num_channels: number;
total_network_capacity: string;
avg_channel_size: number;
min_channel_size: string;
max_channel_size: string;
median_channel_size_sat: string;
num_zombie_chans: string;
}
5 changes: 3 additions & 2 deletions stores/NodeInfoStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { action, observable } from 'mobx';
import NetworkInfo from '../models/NetworkInfo';
import NodeInfo from '../models/NodeInfo';
import ChannelsStore from './ChannelsStore';
import SettingsStore from './SettingsStore';
Expand All @@ -12,7 +13,7 @@ export default class NodeInfoStore {
@observable public error = false;
@observable public errorMsg: string;
@observable public nodeInfo: NodeInfo | any = {};
@observable public networkInfo: any = {};
@observable public networkInfo: NetworkInfo | any = {};
@observable public testnet: boolean;
@observable public regtest: boolean;
channelsStore: ChannelsStore;
Expand Down Expand Up @@ -91,7 +92,7 @@ export default class NodeInfoStore {
this.loading = true;
return BackendUtils.getNetworkInfo()
.then((data: any) => {
this.networkInfo = data;
this.networkInfo = new NetworkInfo(data);
this.loading = false;
this.error = false;
return this.networkInfo;
Expand Down
14 changes: 6 additions & 8 deletions views/NetworkInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ export default class NetworkInfo extends React.Component<NetworkInfoProps, {}> {

<FlatList
data={NETWORK_INFO}
renderItem={({ item }) => {
return (
<KeyValue
keyValue={localeString(item.label)}
value={item.value}
/>
);
}}
renderItem={({ item }) => (
<KeyValue
keyValue={localeString(item.label)}
value={item.value}
/>
)}
onRefresh={() => getNetworkInfo}
refreshing={loading}
style={styles.content}
Expand Down

0 comments on commit bfb2720

Please sign in to comment.