Skip to content

Commit

Permalink
Dev commands on GL: return output as pretty-printed JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 committed May 26, 2024
1 parent 7cdd002 commit 9277af7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions libs/sdk-core/src/greenlight/node_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ impl NodeAPI for Greenlight {
.list_peers(cln::ListpeersRequest::default())
.await?
.into_inner();
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
NodeCommand::ListPeerChannels => {
let resp = self
Expand All @@ -1470,7 +1470,7 @@ impl NodeAPI for Greenlight {
.list_peer_channels(cln::ListpeerchannelsRequest::default())
.await?
.into_inner();
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
NodeCommand::ListFunds => {
let resp = self
Expand All @@ -1479,7 +1479,7 @@ impl NodeAPI for Greenlight {
.list_funds(cln::ListfundsRequest::default())
.await?
.into_inner();
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
NodeCommand::ListPayments => {
let resp = self
Expand All @@ -1488,7 +1488,7 @@ impl NodeAPI for Greenlight {
.list_pays(cln::ListpaysRequest::default())
.await?
.into_inner();
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
NodeCommand::ListInvoices => {
let resp = self
Expand All @@ -1497,7 +1497,7 @@ impl NodeAPI for Greenlight {
.list_invoices(cln::ListinvoicesRequest::default())
.await?
.into_inner();
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
NodeCommand::CloseAllChannels => {
let peers_res = self
Expand All @@ -1519,11 +1519,11 @@ impl NodeAPI for Greenlight {
.getinfo(cln::GetinfoRequest::default())
.await?
.into_inner();
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
NodeCommand::GenerateDiagnosticData => {
let resp = self.generate_diagnostic_data().await?;
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
NodeCommand::Stop => {
let resp = self
Expand All @@ -1532,7 +1532,7 @@ impl NodeAPI for Greenlight {
.stop(cln::StopRequest::default())
.await?
.into_inner();
Ok(format!("{resp:?}"))
Ok(serde_json::to_string_pretty(&resp)?)
}
}
}
Expand Down

0 comments on commit 9277af7

Please sign in to comment.