mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
cln-grpc: Add glue to get all pieces to work together
This commit is contained in:
parent
62dc078271
commit
24e44ecbb6
5 changed files with 26 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"cln-rpc",
|
||||
"cln-grpc",
|
||||
]
|
||||
|
|
|
@ -2,13 +2,7 @@ syntax = "proto3";
|
|||
package cln;
|
||||
|
||||
message Amount {
|
||||
oneof unit {
|
||||
uint64 millisatoshi = 1;
|
||||
uint64 satoshi = 2;
|
||||
uint64 bitcoin = 3;
|
||||
bool all = 4;
|
||||
bool any = 5;
|
||||
}
|
||||
uint64 msat = 1;
|
||||
}
|
||||
|
||||
enum ChannelSide {
|
||||
|
|
5
cln-grpc/src/lib.rs
Normal file
5
cln-grpc/src/lib.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
mod convert;
|
||||
pub mod pb;
|
||||
mod server;
|
||||
|
||||
pub use crate::server::Server;
|
15
cln-grpc/src/pb.rs
Normal file
15
cln-grpc/src/pb.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
tonic::include_proto!("cln");
|
||||
|
||||
use cln_rpc::primitives::Amount as JAmount;
|
||||
|
||||
impl From<JAmount> for Amount {
|
||||
fn from(a: JAmount) -> Self {
|
||||
Amount { msat: a.msat() }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Amount> for JAmount {
|
||||
fn from(a: Amount) -> Self {
|
||||
JAmount::from_msat(a.msat)
|
||||
}
|
||||
}
|
|
@ -62,6 +62,10 @@ impl Amount {
|
|||
msat: 100_000_000_000 * btc,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn msat(&self) -> u64 {
|
||||
self.msat
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Serialize, Deserialize, Debug, PartialEq)]
|
||||
|
|
Loading…
Add table
Reference in a new issue