Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions libs/gl-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ categories = ["command-line-utilities", "cryptography::cryptocurrencies"]
license = "MIT"
readme = "README.md"

[features]
experimental-splicing = ["gl-client/experimental-splicing"]

[[bin]]
name = "glcli"
test = true
Expand Down
1 change: 1 addition & 0 deletions libs/gl-client-py/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ thiserror = "1"
[features]
default = ["permissive"]
permissive = ["gl-client/permissive"]
experimental-splicing = ["gl-client/experimental-splicing"]
18 changes: 8 additions & 10 deletions libs/gl-client-py/glclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def __init__(self, node_id: bytes, grpc_uri: str, creds: Credentials) -> None:
self.inner = native.Node(node_id=node_id, grpc_uri=grpc_uri, creds=creds)
self.logger = logging.getLogger("glclient.Node")

def call(self, path: str, request: bytes) -> bytes:
return bytes(self.inner.call(path, bytes(request)))

def get_info(self) -> clnpb.GetinfoResponse:
uri = "/cln.Node/Getinfo"
req = clnpb.GetinfoRequest().SerializeToString()
Expand Down Expand Up @@ -279,16 +282,11 @@ def decode(self, string: str) -> clnpb.DecodeResponse:
return res.FromString(bytes(self.inner.call(uri, bytes(req))))

def decodepay(
self, bolt11: str, description: Optional[str]
) -> clnpb.DecodepayResponse:
uri = "/cln.Node/DecodePay"
res = clnpb.DecodepayResponse
req = clnpb.DecodepayRequest(
bolt11=bolt11,
description=description,
).SerializeToString()

return res.FromString(bytes(self.inner.call(uri, bytes(req))))
self, bolt11: str, description: Optional[str] = None
) -> clnpb.DecodeResponse:
if description is not None:
raise ValueError("CLN's Decode RPC does not accept a description")
return self.decode(bolt11)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ISSUE] Shouldn't we rather remove the decodepay method, or are we keeping it for backwards compatibility?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was meant for backward compatibility. It was removed in CLN and the updated python bindings, but I wasn't sure if anyone depends on it. But if you are ok with removing it, let's do it


def disconnect_peer(self, peer_id: str, force=False) -> clnpb.DisconnectResponse:
uri = "/cln.Node/Disconnect"
Expand Down
2 changes: 2 additions & 0 deletions libs/gl-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ default = ["permissive", "export"]
permissive = []
export = ["chacha20poly1305", "secp256k1"]
backup = []
experimental-splicing = []

[dependencies]
aes = "0.8"
Expand All @@ -35,6 +36,7 @@ picky-asn1-der = "0.4"
pin-project = "1.1.5"
prost = "0.12"
prost-derive = "0.12"
psbt-v2 = { version = "0.3.0", default-features = false, features = ["std"] }
# `rustls-tls-webpki-roots` compiles Mozilla's CA bundle into the
# binary. Identical TLS behaviour on every platform — Android, iOS,
# desktop — with no runtime OS root-store discovery. We previously
Expand Down
3 changes: 2 additions & 1 deletion libs/gl-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ pub mod scheduler;
/// move your funds.
pub mod signer;

pub mod persist;
pub mod metrics;
pub mod persist;
pub mod psbt;

pub mod lnurl;

Expand Down
18 changes: 16 additions & 2 deletions libs/gl-client/src/persist.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
mod canonical;
mod splice;

pub use splice::{
candidate_funding_facts_from_psbt, parse_base64_psbt, wallet_inputs_from_psbt, FeePolicy,
FundPsbtResponseFacts, FundingOutpoint, LocalSpliceIntent, OldSpliceState, PsbtCaptureFacts,
SignPsbtIntentFacts, SpliceSignedResponseFacts, SpliceUpdateResponseFacts,
WalletInputReservation,
};
#[cfg(test)]
pub(crate) use splice::{CandidateFundingFacts, WalletInput};
pub(crate) use splice::{SpliceOrigin, SplicePhase, SpliceSessionV1};

use anyhow::anyhow;
use lightning_signer::bitcoin::secp256k1::PublicKey;
Expand Down Expand Up @@ -1092,10 +1103,13 @@ mod tests {

#[test]
fn state_entry_canonical_value_bytes_sorts_nested_object_keys() {
let entry = StateEntry::new(0, json!({
let entry = StateEntry::new(
0,
json!({
"z": {"b": 1, "a": 2},
"a": [{"d": 4, "c": 3}]
}));
}),
);

let bytes = entry.canonical_value_bytes().unwrap();

Expand Down
Loading
Loading