Skip to content

Commit d3f7047

Browse files
ShahanaFarooquicdecker
authored andcommitted
gl-sdk: Expose methods and struct fields publicly
Make the new query methods and related struct fields public so downstream crates like `gl-sdk-napi` can access them directly from Rust, rather than only through UniFFI bindings.
1 parent f5516a3 commit d3f7047

1 file changed

Lines changed: 36 additions & 36 deletions

File tree

libs/gl-sdk/src/node.rs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl Node {
174174
///
175175
/// Returns basic information about the node including its ID,
176176
/// alias, network, and channel counts.
177-
fn get_info(&self) -> Result<GetInfoResponse, Error> {
177+
pub fn get_info(&self) -> Result<GetInfoResponse, Error> {
178178
let mut cln_client = exec(self.get_cln_client())?.clone();
179179

180180
let req = clnpb::GetinfoRequest {};
@@ -189,7 +189,7 @@ impl Node {
189189
///
190190
/// Returns information about all peers including their connection
191191
/// status.
192-
fn list_peers(&self) -> Result<ListPeersResponse, Error> {
192+
pub fn list_peers(&self) -> Result<ListPeersResponse, Error> {
193193
let mut cln_client = exec(self.get_cln_client())?.clone();
194194

195195
let req = clnpb::ListpeersRequest {
@@ -207,7 +207,7 @@ impl Node {
207207
///
208208
/// Returns detailed information about all channels including their
209209
/// state, capacity, and balances.
210-
fn list_peer_channels(&self) -> Result<ListPeerChannelsResponse, Error> {
210+
pub fn list_peer_channels(&self) -> Result<ListPeerChannelsResponse, Error> {
211211
let mut cln_client = exec(self.get_cln_client())?.clone();
212212

213213
let req = clnpb::ListpeerchannelsRequest { id: None };
@@ -222,7 +222,7 @@ impl Node {
222222
///
223223
/// Returns information about on-chain outputs and channel funds
224224
/// that are available or pending.
225-
fn list_funds(&self) -> Result<ListFundsResponse, Error> {
225+
pub fn list_funds(&self) -> Result<ListFundsResponse, Error> {
226226
let mut cln_client = exec(self.get_cln_client())?.clone();
227227

228228
let req = clnpb::ListfundsRequest { spent: None };
@@ -415,12 +415,12 @@ pub struct ListPeersResponse {
415415
#[allow(unused)]
416416
#[derive(Clone, uniffi::Record)]
417417
pub struct Peer {
418-
id: Vec<u8>,
419-
connected: bool,
420-
num_channels: Option<u32>,
421-
netaddr: Vec<String>,
422-
remote_addr: Option<String>,
423-
features: Option<Vec<u8>>,
418+
pub id: Vec<u8>,
419+
pub connected: bool,
420+
pub num_channels: Option<u32>,
421+
pub netaddr: Vec<String>,
422+
pub remote_addr: Option<String>,
423+
pub features: Option<Vec<u8>>,
424424
}
425425

426426
impl From<clnpb::ListpeersResponse> for ListPeersResponse {
@@ -459,17 +459,17 @@ pub struct ListPeerChannelsResponse {
459459
#[allow(unused)]
460460
#[derive(Clone, uniffi::Record)]
461461
pub struct PeerChannel {
462-
peer_id: Vec<u8>,
463-
peer_connected: bool,
464-
state: ChannelState,
465-
short_channel_id: Option<String>,
466-
channel_id: Option<Vec<u8>>,
467-
funding_txid: Option<Vec<u8>>,
468-
funding_outnum: Option<u32>,
469-
to_us_msat: Option<u64>,
470-
total_msat: Option<u64>,
471-
spendable_msat: Option<u64>,
472-
receivable_msat: Option<u64>,
462+
pub peer_id: Vec<u8>,
463+
pub peer_connected: bool,
464+
pub state: ChannelState,
465+
pub short_channel_id: Option<String>,
466+
pub channel_id: Option<Vec<u8>>,
467+
pub funding_txid: Option<Vec<u8>>,
468+
pub funding_outnum: Option<u32>,
469+
pub to_us_msat: Option<u64>,
470+
pub total_msat: Option<u64>,
471+
pub spendable_msat: Option<u64>,
472+
pub receivable_msat: Option<u64>,
473473
}
474474

475475
#[derive(Clone, uniffi::Enum)]
@@ -553,12 +553,12 @@ pub struct ListFundsResponse {
553553
#[allow(unused)]
554554
#[derive(Clone, uniffi::Record)]
555555
pub struct FundOutput {
556-
txid: Vec<u8>,
557-
output: u32,
558-
amount_msat: u64,
559-
status: OutputStatus,
560-
address: Option<String>,
561-
blockheight: Option<u32>,
556+
pub txid: Vec<u8>,
557+
pub output: u32,
558+
pub amount_msat: u64,
559+
pub status: OutputStatus,
560+
pub address: Option<String>,
561+
pub blockheight: Option<u32>,
562562
}
563563

564564
#[derive(Clone, uniffi::Enum)]
@@ -584,15 +584,15 @@ impl OutputStatus {
584584
#[allow(unused)]
585585
#[derive(Clone, uniffi::Record)]
586586
pub struct FundChannel {
587-
peer_id: Vec<u8>,
588-
our_amount_msat: u64,
589-
amount_msat: u64,
590-
funding_txid: Vec<u8>,
591-
funding_output: u32,
592-
connected: bool,
593-
state: ChannelState,
594-
short_channel_id: Option<String>,
595-
channel_id: Option<Vec<u8>>,
587+
pub peer_id: Vec<u8>,
588+
pub our_amount_msat: u64,
589+
pub amount_msat: u64,
590+
pub funding_txid: Vec<u8>,
591+
pub funding_output: u32,
592+
pub connected: bool,
593+
pub state: ChannelState,
594+
pub short_channel_id: Option<String>,
595+
pub channel_id: Option<Vec<u8>>,
596596
}
597597

598598
impl From<clnpb::ListfundsResponse> for ListFundsResponse {

0 commit comments

Comments
 (0)