mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
cln-rpc: Add invoice RPC methods
This commit is contained in:
parent
d90aafeed6
commit
a7f3c54600
12 changed files with 930 additions and 7 deletions
99
.msggen.json
99
.msggen.json
|
@ -16,6 +16,11 @@
|
|||
"in": 0,
|
||||
"out": 1
|
||||
},
|
||||
"CreateinvoiceStatus": {
|
||||
"expired": 1,
|
||||
"paid": 0,
|
||||
"unpaid": 2
|
||||
},
|
||||
"DatastoreMode": {
|
||||
"create-or-append": 4,
|
||||
"create-or-replace": 2,
|
||||
|
@ -23,6 +28,11 @@
|
|||
"must-create": 0,
|
||||
"must-replace": 1
|
||||
},
|
||||
"DelinvoiceStatus": {
|
||||
"expired": 1,
|
||||
"paid": 0,
|
||||
"unpaid": 2
|
||||
},
|
||||
"GetinfoAddressType": {
|
||||
"dns": 0,
|
||||
"ipv4": 1,
|
||||
|
@ -43,6 +53,11 @@
|
|||
"spent": 2,
|
||||
"unconfirmed": 0
|
||||
},
|
||||
"ListinvoicesInvoicesStatus": {
|
||||
"expired": 2,
|
||||
"paid": 1,
|
||||
"unpaid": 0
|
||||
},
|
||||
"ListpeersPeersChannelsHtlcsDirection": {
|
||||
"in": 0,
|
||||
"out": 1
|
||||
|
@ -134,6 +149,27 @@
|
|||
"Connect.features": 2,
|
||||
"Connect.id": 1
|
||||
},
|
||||
"CreateinvoiceRequest": {
|
||||
"CreateInvoice.invstring": 1,
|
||||
"CreateInvoice.label": 2,
|
||||
"CreateInvoice.preimage": 3
|
||||
},
|
||||
"CreateinvoiceResponse": {
|
||||
"CreateInvoice.amount_msat": 5,
|
||||
"CreateInvoice.amount_received_msat": 10,
|
||||
"CreateInvoice.bolt11": 2,
|
||||
"CreateInvoice.bolt12": 3,
|
||||
"CreateInvoice.description": 7,
|
||||
"CreateInvoice.expires_at": 8,
|
||||
"CreateInvoice.label": 1,
|
||||
"CreateInvoice.local_offer_id": 13,
|
||||
"CreateInvoice.paid_at": 11,
|
||||
"CreateInvoice.pay_index": 9,
|
||||
"CreateInvoice.payer_note": 14,
|
||||
"CreateInvoice.payment_hash": 4,
|
||||
"CreateInvoice.payment_preimage": 12,
|
||||
"CreateInvoice.status": 6
|
||||
},
|
||||
"DatastoreRequest": {
|
||||
"Datastore.generation": 4,
|
||||
"Datastore.hex": 2,
|
||||
|
@ -156,6 +192,25 @@
|
|||
"DelDatastore.key[]": 1,
|
||||
"DelDatastore.string": 4
|
||||
},
|
||||
"DelexpiredinvoiceRequest": {
|
||||
"DelExpiredInvoice.maxexpirytime": 1
|
||||
},
|
||||
"DelinvoiceRequest": {
|
||||
"DelInvoice.label": 1,
|
||||
"DelInvoice.status": 2
|
||||
},
|
||||
"DelinvoiceResponse": {
|
||||
"DelInvoice.amount_msat": 4,
|
||||
"DelInvoice.bolt11": 2,
|
||||
"DelInvoice.bolt12": 3,
|
||||
"DelInvoice.description": 5,
|
||||
"DelInvoice.expires_at": 8,
|
||||
"DelInvoice.label": 1,
|
||||
"DelInvoice.local_offer_id": 9,
|
||||
"DelInvoice.payer_note": 10,
|
||||
"DelInvoice.payment_hash": 6,
|
||||
"DelInvoice.status": 7
|
||||
},
|
||||
"GetinfoAddress": {
|
||||
"Getinfo.address[].address": 3,
|
||||
"Getinfo.address[].port": 2,
|
||||
|
@ -192,6 +247,25 @@
|
|||
"Getinfo.warning_bitcoind_sync": 16,
|
||||
"Getinfo.warning_lightningd_sync": 17
|
||||
},
|
||||
"InvoiceRequest": {
|
||||
"Invoice.cltv": 6,
|
||||
"Invoice.description": 2,
|
||||
"Invoice.fallbacks[]": 4,
|
||||
"Invoice.label": 3,
|
||||
"Invoice.msatoshi": 1,
|
||||
"Invoice.preimage": 5
|
||||
},
|
||||
"InvoiceResponse": {
|
||||
"Invoice.bolt11": 1,
|
||||
"Invoice.expires_at": 4,
|
||||
"Invoice.payment_hash": 2,
|
||||
"Invoice.payment_secret": 3,
|
||||
"Invoice.warning_capacity": 5,
|
||||
"Invoice.warning_deadends": 7,
|
||||
"Invoice.warning_mpp": 9,
|
||||
"Invoice.warning_offline": 6,
|
||||
"Invoice.warning_private_unused": 8
|
||||
},
|
||||
"ListchannelsChannels": {
|
||||
"ListChannels.channels[].active": 8,
|
||||
"ListChannels.channels[].amount_msat": 5,
|
||||
|
@ -256,6 +330,31 @@
|
|||
"ListFunds.channels[]": 2,
|
||||
"ListFunds.outputs[]": 1
|
||||
},
|
||||
"ListinvoicesInvoices": {
|
||||
"ListInvoices.invoices[].amount_msat": 6,
|
||||
"ListInvoices.invoices[].amount_received_msat": 12,
|
||||
"ListInvoices.invoices[].bolt11": 7,
|
||||
"ListInvoices.invoices[].bolt12": 8,
|
||||
"ListInvoices.invoices[].description": 2,
|
||||
"ListInvoices.invoices[].expires_at": 5,
|
||||
"ListInvoices.invoices[].label": 1,
|
||||
"ListInvoices.invoices[].local_offer_id": 9,
|
||||
"ListInvoices.invoices[].paid_at": 13,
|
||||
"ListInvoices.invoices[].pay_index": 11,
|
||||
"ListInvoices.invoices[].payer_note": 10,
|
||||
"ListInvoices.invoices[].payment_hash": 3,
|
||||
"ListInvoices.invoices[].payment_preimage": 14,
|
||||
"ListInvoices.invoices[].status": 4
|
||||
},
|
||||
"ListinvoicesRequest": {
|
||||
"ListInvoices.invstring": 2,
|
||||
"ListInvoices.label": 1,
|
||||
"ListInvoices.offer_id": 4,
|
||||
"ListInvoices.payment_hash": 3
|
||||
},
|
||||
"ListinvoicesResponse": {
|
||||
"ListInvoices.invoices[]": 1
|
||||
},
|
||||
"ListpeersPeers": {
|
||||
"ListPeers.peers[].channels[]": 4,
|
||||
"ListPeers.peers[].connected": 2,
|
||||
|
|
|
@ -17,9 +17,14 @@ service Node {
|
|||
rpc CheckMessage(CheckmessageRequest) returns (CheckmessageResponse) {}
|
||||
rpc Close(CloseRequest) returns (CloseResponse) {}
|
||||
rpc ConnectPeer(ConnectRequest) returns (ConnectResponse) {}
|
||||
rpc CreateInvoice(CreateinvoiceRequest) returns (CreateinvoiceResponse) {}
|
||||
rpc Datastore(DatastoreRequest) returns (DatastoreResponse) {}
|
||||
rpc DelDatastore(DeldatastoreRequest) returns (DeldatastoreResponse) {}
|
||||
rpc DelExpiredInvoice(DelexpiredinvoiceRequest) returns (DelexpiredinvoiceResponse) {}
|
||||
rpc DelInvoice(DelinvoiceRequest) returns (DelinvoiceResponse) {}
|
||||
rpc Invoice(InvoiceRequest) returns (InvoiceResponse) {}
|
||||
rpc ListDatastore(ListdatastoreRequest) returns (ListdatastoreResponse) {}
|
||||
rpc ListInvoices(ListinvoicesRequest) returns (ListinvoicesResponse) {}
|
||||
}
|
||||
|
||||
message GetinfoRequest {
|
||||
|
@ -376,6 +381,35 @@ message ConnectAddress {
|
|||
optional uint32 port = 4;
|
||||
}
|
||||
|
||||
message CreateinvoiceRequest {
|
||||
string invstring = 1;
|
||||
string label = 2;
|
||||
bytes preimage = 3;
|
||||
}
|
||||
|
||||
message CreateinvoiceResponse {
|
||||
// CreateInvoice.status
|
||||
enum CreateinvoiceStatus {
|
||||
PAID = 0;
|
||||
EXPIRED = 1;
|
||||
UNPAID = 2;
|
||||
}
|
||||
string label = 1;
|
||||
optional string bolt11 = 2;
|
||||
optional string bolt12 = 3;
|
||||
bytes payment_hash = 4;
|
||||
optional Amount amount_msat = 5;
|
||||
CreateinvoiceStatus status = 6;
|
||||
string description = 7;
|
||||
uint64 expires_at = 8;
|
||||
optional uint64 pay_index = 9;
|
||||
optional Amount amount_received_msat = 10;
|
||||
optional uint64 paid_at = 11;
|
||||
optional bytes payment_preimage = 12;
|
||||
optional bytes local_offer_id = 13;
|
||||
optional string payer_note = 14;
|
||||
}
|
||||
|
||||
message DatastoreRequest {
|
||||
// Datastore.mode
|
||||
enum DatastoreMode {
|
||||
|
@ -410,6 +444,64 @@ message DeldatastoreResponse {
|
|||
optional string string = 4;
|
||||
}
|
||||
|
||||
message DelexpiredinvoiceRequest {
|
||||
uint32 maxexpirytime = 1;
|
||||
}
|
||||
|
||||
message DelexpiredinvoiceResponse {
|
||||
}
|
||||
|
||||
message DelinvoiceRequest {
|
||||
// DelInvoice.status
|
||||
enum DelinvoiceStatus {
|
||||
PAID = 0;
|
||||
EXPIRED = 1;
|
||||
UNPAID = 2;
|
||||
}
|
||||
string label = 1;
|
||||
DelinvoiceStatus status = 2;
|
||||
}
|
||||
|
||||
message DelinvoiceResponse {
|
||||
// DelInvoice.status
|
||||
enum DelinvoiceStatus {
|
||||
PAID = 0;
|
||||
EXPIRED = 1;
|
||||
UNPAID = 2;
|
||||
}
|
||||
string label = 1;
|
||||
optional string bolt11 = 2;
|
||||
optional string bolt12 = 3;
|
||||
optional Amount amount_msat = 4;
|
||||
optional string description = 5;
|
||||
bytes payment_hash = 6;
|
||||
DelinvoiceStatus status = 7;
|
||||
uint64 expires_at = 8;
|
||||
optional bytes local_offer_id = 9;
|
||||
optional string payer_note = 10;
|
||||
}
|
||||
|
||||
message InvoiceRequest {
|
||||
Amount msatoshi = 1;
|
||||
string description = 2;
|
||||
string label = 3;
|
||||
repeated string fallbacks = 4;
|
||||
optional bytes preimage = 5;
|
||||
optional uint32 cltv = 6;
|
||||
}
|
||||
|
||||
message InvoiceResponse {
|
||||
string bolt11 = 1;
|
||||
bytes payment_hash = 2;
|
||||
bytes payment_secret = 3;
|
||||
uint64 expires_at = 4;
|
||||
optional string warning_capacity = 5;
|
||||
optional string warning_offline = 6;
|
||||
optional string warning_deadends = 7;
|
||||
optional string warning_private_unused = 8;
|
||||
optional string warning_mpp = 9;
|
||||
}
|
||||
|
||||
message ListdatastoreRequest {
|
||||
repeated string key = 1;
|
||||
}
|
||||
|
@ -424,3 +516,37 @@ message ListdatastoreDatastore {
|
|||
optional bytes hex = 3;
|
||||
optional string string = 4;
|
||||
}
|
||||
|
||||
message ListinvoicesRequest {
|
||||
optional string label = 1;
|
||||
optional string invstring = 2;
|
||||
optional bytes payment_hash = 3;
|
||||
optional string offer_id = 4;
|
||||
}
|
||||
|
||||
message ListinvoicesResponse {
|
||||
repeated ListinvoicesInvoices invoices = 1;
|
||||
}
|
||||
|
||||
message ListinvoicesInvoices {
|
||||
// ListInvoices.invoices[].status
|
||||
enum ListinvoicesInvoicesStatus {
|
||||
UNPAID = 0;
|
||||
PAID = 1;
|
||||
EXPIRED = 2;
|
||||
}
|
||||
string label = 1;
|
||||
string description = 2;
|
||||
bytes payment_hash = 3;
|
||||
ListinvoicesInvoicesStatus status = 4;
|
||||
uint64 expires_at = 5;
|
||||
optional Amount amount_msat = 6;
|
||||
optional string bolt11 = 7;
|
||||
optional string bolt12 = 8;
|
||||
optional bytes local_offer_id = 9;
|
||||
optional string payer_note = 10;
|
||||
optional uint64 pay_index = 11;
|
||||
optional Amount amount_received_msat = 12;
|
||||
optional uint64 paid_at = 13;
|
||||
optional bytes payment_preimage = 14;
|
||||
}
|
||||
|
|
|
@ -300,6 +300,28 @@ impl From<&responses::ConnectResponse> for pb::ConnectResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::CreateinvoiceResponse> for pb::CreateinvoiceResponse {
|
||||
fn from(c: &responses::CreateinvoiceResponse) -> Self {
|
||||
Self {
|
||||
label: c.label.clone(),
|
||||
bolt11: c.bolt11.clone(),
|
||||
bolt12: c.bolt12.clone(),
|
||||
payment_hash: hex::decode(&c.payment_hash).unwrap(),
|
||||
amount_msat: c.amount_msat.map(|f| f.into()),
|
||||
status: c.status as i32,
|
||||
description: c.description.clone(),
|
||||
expires_at: c.expires_at.clone(),
|
||||
pay_index: c.pay_index.clone(),
|
||||
amount_received_msat: c.amount_received_msat.map(|f| f.into()),
|
||||
paid_at: c.paid_at.clone(),
|
||||
payment_preimage: c.payment_preimage.as_ref().map(|v| hex::decode(&v).unwrap()),
|
||||
local_offer_id: c.local_offer_id.as_ref().map(|v| hex::decode(&v).unwrap()),
|
||||
payer_note: c.payer_note.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::DatastoreResponse> for pb::DatastoreResponse {
|
||||
fn from(c: &responses::DatastoreResponse) -> Self {
|
||||
|
@ -324,6 +346,49 @@ impl From<&responses::DeldatastoreResponse> for pb::DeldatastoreResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::DelexpiredinvoiceResponse> for pb::DelexpiredinvoiceResponse {
|
||||
fn from(c: &responses::DelexpiredinvoiceResponse) -> Self {
|
||||
Self {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::DelinvoiceResponse> for pb::DelinvoiceResponse {
|
||||
fn from(c: &responses::DelinvoiceResponse) -> Self {
|
||||
Self {
|
||||
label: c.label.clone(),
|
||||
bolt11: c.bolt11.clone(),
|
||||
bolt12: c.bolt12.clone(),
|
||||
amount_msat: c.amount_msat.map(|f| f.into()),
|
||||
description: c.description.clone(),
|
||||
payment_hash: hex::decode(&c.payment_hash).unwrap(),
|
||||
status: c.status as i32,
|
||||
expires_at: c.expires_at.clone(),
|
||||
local_offer_id: c.local_offer_id.as_ref().map(|v| hex::decode(&v).unwrap()),
|
||||
payer_note: c.payer_note.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::InvoiceResponse> for pb::InvoiceResponse {
|
||||
fn from(c: &responses::InvoiceResponse) -> Self {
|
||||
Self {
|
||||
bolt11: c.bolt11.clone(),
|
||||
payment_hash: hex::decode(&c.payment_hash).unwrap(),
|
||||
payment_secret: hex::decode(&c.payment_secret).unwrap(),
|
||||
expires_at: c.expires_at.clone(),
|
||||
warning_capacity: c.warning_capacity.clone(),
|
||||
warning_offline: c.warning_offline.clone(),
|
||||
warning_deadends: c.warning_deadends.clone(),
|
||||
warning_private_unused: c.warning_private_unused.clone(),
|
||||
warning_mpp: c.warning_mpp.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::ListdatastoreDatastore> for pb::ListdatastoreDatastore {
|
||||
fn from(c: &responses::ListdatastoreDatastore) -> Self {
|
||||
|
@ -345,6 +410,37 @@ impl From<&responses::ListdatastoreResponse> for pb::ListdatastoreResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::ListinvoicesInvoices> for pb::ListinvoicesInvoices {
|
||||
fn from(c: &responses::ListinvoicesInvoices) -> Self {
|
||||
Self {
|
||||
label: c.label.clone(),
|
||||
description: c.description.clone(),
|
||||
payment_hash: hex::decode(&c.payment_hash).unwrap(),
|
||||
status: c.status as i32,
|
||||
expires_at: c.expires_at.clone(),
|
||||
amount_msat: c.amount_msat.map(|f| f.into()),
|
||||
bolt11: c.bolt11.clone(),
|
||||
bolt12: c.bolt12.clone(),
|
||||
local_offer_id: c.local_offer_id.as_ref().map(|v| hex::decode(&v).unwrap()),
|
||||
payer_note: c.payer_note.clone(),
|
||||
pay_index: c.pay_index.clone(),
|
||||
amount_received_msat: c.amount_received_msat.map(|f| f.into()),
|
||||
paid_at: c.paid_at.clone(),
|
||||
payment_preimage: c.payment_preimage.as_ref().map(|v| hex::decode(&v).unwrap()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&responses::ListinvoicesResponse> for pb::ListinvoicesResponse {
|
||||
fn from(c: &responses::ListinvoicesResponse) -> Self {
|
||||
Self {
|
||||
invoices: c.invoices.iter().map(|s| s.into()).collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::GetinfoRequest> for requests::GetinfoRequest {
|
||||
fn from(c: &pb::GetinfoRequest) -> Self {
|
||||
|
@ -438,6 +534,17 @@ impl From<&pb::ConnectRequest> for requests::ConnectRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::CreateinvoiceRequest> for requests::CreateinvoiceRequest {
|
||||
fn from(c: &pb::CreateinvoiceRequest) -> Self {
|
||||
Self {
|
||||
invstring: c.invstring.clone(),
|
||||
label: c.label.clone(),
|
||||
preimage: hex::encode(&c.preimage),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::DatastoreRequest> for requests::DatastoreRequest {
|
||||
fn from(c: &pb::DatastoreRequest) -> Self {
|
||||
|
@ -460,6 +567,39 @@ impl From<&pb::DeldatastoreRequest> for requests::DeldatastoreRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::DelexpiredinvoiceRequest> for requests::DelexpiredinvoiceRequest {
|
||||
fn from(c: &pb::DelexpiredinvoiceRequest) -> Self {
|
||||
Self {
|
||||
maxexpirytime: c.maxexpirytime.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::DelinvoiceRequest> for requests::DelinvoiceRequest {
|
||||
fn from(c: &pb::DelinvoiceRequest) -> Self {
|
||||
Self {
|
||||
label: c.label.clone(),
|
||||
status: c.status.try_into().unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::InvoiceRequest> for requests::InvoiceRequest {
|
||||
fn from(c: &pb::InvoiceRequest) -> Self {
|
||||
Self {
|
||||
msatoshi: c.msatoshi.as_ref().unwrap().into(),
|
||||
description: c.description.clone(),
|
||||
label: c.label.clone(),
|
||||
fallbacks: c.fallbacks.iter().map(|s| s.into()).collect(),
|
||||
preimage: c.preimage.clone().map(|v| hex::encode(v)),
|
||||
cltv: c.cltv.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::ListdatastoreRequest> for requests::ListdatastoreRequest {
|
||||
fn from(c: &pb::ListdatastoreRequest) -> Self {
|
||||
|
@ -469,3 +609,15 @@ impl From<&pb::ListdatastoreRequest> for requests::ListdatastoreRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<&pb::ListinvoicesRequest> for requests::ListinvoicesRequest {
|
||||
fn from(c: &pb::ListinvoicesRequest) -> Self {
|
||||
Self {
|
||||
label: c.label.clone(),
|
||||
invstring: c.invstring.clone(),
|
||||
payment_hash: c.payment_hash.clone().map(|v| hex::encode(v)),
|
||||
offer_id: c.offer_id.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -296,6 +296,36 @@ async fn connect_peer(
|
|||
|
||||
}
|
||||
|
||||
async fn create_invoice(
|
||||
&self,
|
||||
request: tonic::Request<pb::CreateinvoiceRequest>,
|
||||
) -> Result<tonic::Response<pb::CreateinvoiceResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::CreateinvoiceRequest = (&req).into();
|
||||
debug!("Client asked for getinfo");
|
||||
let mut rpc = ClnRpc::new(&self.rpc_path)
|
||||
.await
|
||||
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
|
||||
let result = rpc.call(Request::CreateInvoice(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method CreateInvoice: {:?}", e)))?;
|
||||
match result {
|
||||
Response::CreateInvoice(r) => Ok(
|
||||
tonic::Response::new((&r).into())
|
||||
),
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call CreateInvoice",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn datastore(
|
||||
&self,
|
||||
request: tonic::Request<pb::DatastoreRequest>,
|
||||
|
@ -356,6 +386,96 @@ async fn del_datastore(
|
|||
|
||||
}
|
||||
|
||||
async fn del_expired_invoice(
|
||||
&self,
|
||||
request: tonic::Request<pb::DelexpiredinvoiceRequest>,
|
||||
) -> Result<tonic::Response<pb::DelexpiredinvoiceResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::DelexpiredinvoiceRequest = (&req).into();
|
||||
debug!("Client asked for getinfo");
|
||||
let mut rpc = ClnRpc::new(&self.rpc_path)
|
||||
.await
|
||||
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
|
||||
let result = rpc.call(Request::DelExpiredInvoice(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method DelExpiredInvoice: {:?}", e)))?;
|
||||
match result {
|
||||
Response::DelExpiredInvoice(r) => Ok(
|
||||
tonic::Response::new((&r).into())
|
||||
),
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call DelExpiredInvoice",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn del_invoice(
|
||||
&self,
|
||||
request: tonic::Request<pb::DelinvoiceRequest>,
|
||||
) -> Result<tonic::Response<pb::DelinvoiceResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::DelinvoiceRequest = (&req).into();
|
||||
debug!("Client asked for getinfo");
|
||||
let mut rpc = ClnRpc::new(&self.rpc_path)
|
||||
.await
|
||||
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
|
||||
let result = rpc.call(Request::DelInvoice(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method DelInvoice: {:?}", e)))?;
|
||||
match result {
|
||||
Response::DelInvoice(r) => Ok(
|
||||
tonic::Response::new((&r).into())
|
||||
),
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call DelInvoice",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn invoice(
|
||||
&self,
|
||||
request: tonic::Request<pb::InvoiceRequest>,
|
||||
) -> Result<tonic::Response<pb::InvoiceResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::InvoiceRequest = (&req).into();
|
||||
debug!("Client asked for getinfo");
|
||||
let mut rpc = ClnRpc::new(&self.rpc_path)
|
||||
.await
|
||||
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
|
||||
let result = rpc.call(Request::Invoice(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method Invoice: {:?}", e)))?;
|
||||
match result {
|
||||
Response::Invoice(r) => Ok(
|
||||
tonic::Response::new((&r).into())
|
||||
),
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call Invoice",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn list_datastore(
|
||||
&self,
|
||||
request: tonic::Request<pb::ListdatastoreRequest>,
|
||||
|
@ -386,4 +506,34 @@ async fn list_datastore(
|
|||
|
||||
}
|
||||
|
||||
async fn list_invoices(
|
||||
&self,
|
||||
request: tonic::Request<pb::ListinvoicesRequest>,
|
||||
) -> Result<tonic::Response<pb::ListinvoicesResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::ListinvoicesRequest = (&req).into();
|
||||
debug!("Client asked for getinfo");
|
||||
let mut rpc = ClnRpc::new(&self.rpc_path)
|
||||
.await
|
||||
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
|
||||
let result = rpc.call(Request::ListInvoices(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method ListInvoices: {:?}", e)))?;
|
||||
match result {
|
||||
Response::ListInvoices(r) => Ok(
|
||||
tonic::Response::new((&r).into())
|
||||
),
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call ListInvoices",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,9 +25,14 @@ pub enum Request {
|
|||
CheckMessage(requests::CheckmessageRequest),
|
||||
Close(requests::CloseRequest),
|
||||
ConnectPeer(requests::ConnectRequest),
|
||||
CreateInvoice(requests::CreateinvoiceRequest),
|
||||
Datastore(requests::DatastoreRequest),
|
||||
DelDatastore(requests::DeldatastoreRequest),
|
||||
DelExpiredInvoice(requests::DelexpiredinvoiceRequest),
|
||||
DelInvoice(requests::DelinvoiceRequest),
|
||||
Invoice(requests::InvoiceRequest),
|
||||
ListDatastore(requests::ListdatastoreRequest),
|
||||
ListInvoices(requests::ListinvoicesRequest),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
|
@ -43,9 +48,14 @@ pub enum Response {
|
|||
CheckMessage(responses::CheckmessageResponse),
|
||||
Close(responses::CloseResponse),
|
||||
ConnectPeer(responses::ConnectResponse),
|
||||
CreateInvoice(responses::CreateinvoiceResponse),
|
||||
Datastore(responses::DatastoreResponse),
|
||||
DelDatastore(responses::DeldatastoreResponse),
|
||||
DelExpiredInvoice(responses::DelexpiredinvoiceResponse),
|
||||
DelInvoice(responses::DelinvoiceResponse),
|
||||
Invoice(responses::InvoiceResponse),
|
||||
ListDatastore(responses::ListdatastoreResponse),
|
||||
ListInvoices(responses::ListinvoicesResponse),
|
||||
}
|
||||
|
||||
pub mod requests {
|
||||
|
@ -132,6 +142,16 @@ pub mod requests {
|
|||
pub port: Option<u16>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct CreateinvoiceRequest {
|
||||
#[serde(alias = "invstring")]
|
||||
pub invstring: String,
|
||||
#[serde(alias = "label")]
|
||||
pub label: String,
|
||||
#[serde(alias = "preimage")]
|
||||
pub preimage: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum DatastoreMode {
|
||||
|
@ -174,12 +194,74 @@ pub mod requests {
|
|||
pub generation: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DelexpiredinvoiceRequest {
|
||||
#[serde(alias = "maxexpirytime")]
|
||||
pub maxexpirytime: u32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum DelinvoiceStatus {
|
||||
PAID,
|
||||
EXPIRED,
|
||||
UNPAID,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for DelinvoiceStatus {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<DelinvoiceStatus, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(DelinvoiceStatus::PAID),
|
||||
1 => Ok(DelinvoiceStatus::EXPIRED),
|
||||
2 => Ok(DelinvoiceStatus::UNPAID),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum DelinvoiceStatus", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DelinvoiceRequest {
|
||||
#[serde(alias = "label")]
|
||||
pub label: String,
|
||||
// Path `DelInvoice.status`
|
||||
#[serde(rename = "status")]
|
||||
pub status: DelinvoiceStatus,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct InvoiceRequest {
|
||||
#[serde(alias = "msatoshi")]
|
||||
pub msatoshi: Amount,
|
||||
#[serde(alias = "description")]
|
||||
pub description: String,
|
||||
#[serde(alias = "label")]
|
||||
pub label: String,
|
||||
#[serde(alias = "fallbacks")]
|
||||
pub fallbacks: Vec<String>,
|
||||
#[serde(alias = "preimage", skip_serializing_if = "Option::is_none")]
|
||||
pub preimage: Option<String>,
|
||||
#[serde(alias = "cltv", skip_serializing_if = "Option::is_none")]
|
||||
pub cltv: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListdatastoreRequest {
|
||||
#[serde(alias = "key")]
|
||||
pub key: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListinvoicesRequest {
|
||||
#[serde(alias = "label", skip_serializing_if = "Option::is_none")]
|
||||
pub label: Option<String>,
|
||||
#[serde(alias = "invstring", skip_serializing_if = "Option::is_none")]
|
||||
pub invstring: Option<String>,
|
||||
#[serde(alias = "payment_hash", skip_serializing_if = "Option::is_none")]
|
||||
pub payment_hash: Option<String>,
|
||||
#[serde(alias = "offer_id", skip_serializing_if = "Option::is_none")]
|
||||
pub offer_id: Option<String>,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -863,6 +945,59 @@ pub mod responses {
|
|||
pub direction: ConnectDirection,
|
||||
}
|
||||
|
||||
/// Whether it has been paid, or can no longer be paid
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum CreateinvoiceStatus {
|
||||
PAID,
|
||||
EXPIRED,
|
||||
UNPAID,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for CreateinvoiceStatus {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<CreateinvoiceStatus, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(CreateinvoiceStatus::PAID),
|
||||
1 => Ok(CreateinvoiceStatus::EXPIRED),
|
||||
2 => Ok(CreateinvoiceStatus::UNPAID),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum CreateinvoiceStatus", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct CreateinvoiceResponse {
|
||||
#[serde(alias = "label")]
|
||||
pub label: String,
|
||||
#[serde(alias = "bolt11", skip_serializing_if = "Option::is_none")]
|
||||
pub bolt11: Option<String>,
|
||||
#[serde(alias = "bolt12", skip_serializing_if = "Option::is_none")]
|
||||
pub bolt12: Option<String>,
|
||||
#[serde(alias = "payment_hash")]
|
||||
pub payment_hash: String,
|
||||
#[serde(alias = "amount_msat", skip_serializing_if = "Option::is_none")]
|
||||
pub amount_msat: Option<Amount>,
|
||||
// Path `CreateInvoice.status`
|
||||
#[serde(rename = "status")]
|
||||
pub status: CreateinvoiceStatus,
|
||||
#[serde(alias = "description")]
|
||||
pub description: String,
|
||||
#[serde(alias = "expires_at")]
|
||||
pub expires_at: u64,
|
||||
#[serde(alias = "pay_index", skip_serializing_if = "Option::is_none")]
|
||||
pub pay_index: Option<u64>,
|
||||
#[serde(alias = "amount_received_msat", skip_serializing_if = "Option::is_none")]
|
||||
pub amount_received_msat: Option<Amount>,
|
||||
#[serde(alias = "paid_at", skip_serializing_if = "Option::is_none")]
|
||||
pub paid_at: Option<u64>,
|
||||
#[serde(alias = "payment_preimage", skip_serializing_if = "Option::is_none")]
|
||||
pub payment_preimage: Option<String>,
|
||||
#[serde(alias = "local_offer_id", skip_serializing_if = "Option::is_none")]
|
||||
pub local_offer_id: Option<String>,
|
||||
#[serde(alias = "payer_note", skip_serializing_if = "Option::is_none")]
|
||||
pub payer_note: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DatastoreResponse {
|
||||
#[serde(alias = "key")]
|
||||
|
@ -887,6 +1022,77 @@ pub mod responses {
|
|||
pub string: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DelexpiredinvoiceResponse {
|
||||
}
|
||||
|
||||
/// State of invoice
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum DelinvoiceStatus {
|
||||
PAID,
|
||||
EXPIRED,
|
||||
UNPAID,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for DelinvoiceStatus {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<DelinvoiceStatus, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(DelinvoiceStatus::PAID),
|
||||
1 => Ok(DelinvoiceStatus::EXPIRED),
|
||||
2 => Ok(DelinvoiceStatus::UNPAID),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum DelinvoiceStatus", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DelinvoiceResponse {
|
||||
#[serde(alias = "label")]
|
||||
pub label: String,
|
||||
#[serde(alias = "bolt11", skip_serializing_if = "Option::is_none")]
|
||||
pub bolt11: Option<String>,
|
||||
#[serde(alias = "bolt12", skip_serializing_if = "Option::is_none")]
|
||||
pub bolt12: Option<String>,
|
||||
#[serde(alias = "amount_msat", skip_serializing_if = "Option::is_none")]
|
||||
pub amount_msat: Option<Amount>,
|
||||
#[serde(alias = "description", skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
#[serde(alias = "payment_hash")]
|
||||
pub payment_hash: String,
|
||||
// Path `DelInvoice.status`
|
||||
#[serde(rename = "status")]
|
||||
pub status: DelinvoiceStatus,
|
||||
#[serde(alias = "expires_at")]
|
||||
pub expires_at: u64,
|
||||
#[serde(alias = "local_offer_id", skip_serializing_if = "Option::is_none")]
|
||||
pub local_offer_id: Option<String>,
|
||||
#[serde(alias = "payer_note", skip_serializing_if = "Option::is_none")]
|
||||
pub payer_note: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct InvoiceResponse {
|
||||
#[serde(alias = "bolt11")]
|
||||
pub bolt11: String,
|
||||
#[serde(alias = "payment_hash")]
|
||||
pub payment_hash: String,
|
||||
#[serde(alias = "payment_secret")]
|
||||
pub payment_secret: String,
|
||||
#[serde(alias = "expires_at")]
|
||||
pub expires_at: u64,
|
||||
#[serde(alias = "warning_capacity", skip_serializing_if = "Option::is_none")]
|
||||
pub warning_capacity: Option<String>,
|
||||
#[serde(alias = "warning_offline", skip_serializing_if = "Option::is_none")]
|
||||
pub warning_offline: Option<String>,
|
||||
#[serde(alias = "warning_deadends", skip_serializing_if = "Option::is_none")]
|
||||
pub warning_deadends: Option<String>,
|
||||
#[serde(alias = "warning_private_unused", skip_serializing_if = "Option::is_none")]
|
||||
pub warning_private_unused: Option<String>,
|
||||
#[serde(alias = "warning_mpp", skip_serializing_if = "Option::is_none")]
|
||||
pub warning_mpp: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListdatastoreDatastore {
|
||||
#[serde(alias = "key")]
|
||||
|
@ -905,5 +1111,64 @@ pub mod responses {
|
|||
pub datastore: Vec<ListdatastoreDatastore>,
|
||||
}
|
||||
|
||||
/// Whether it's paid, unpaid or unpayable
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ListinvoicesInvoicesStatus {
|
||||
UNPAID,
|
||||
PAID,
|
||||
EXPIRED,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for ListinvoicesInvoicesStatus {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<ListinvoicesInvoicesStatus, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(ListinvoicesInvoicesStatus::UNPAID),
|
||||
1 => Ok(ListinvoicesInvoicesStatus::PAID),
|
||||
2 => Ok(ListinvoicesInvoicesStatus::EXPIRED),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum ListinvoicesInvoicesStatus", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListinvoicesInvoices {
|
||||
#[serde(alias = "label")]
|
||||
pub label: String,
|
||||
#[serde(alias = "description")]
|
||||
pub description: String,
|
||||
#[serde(alias = "payment_hash")]
|
||||
pub payment_hash: String,
|
||||
// Path `ListInvoices.invoices[].status`
|
||||
#[serde(rename = "status")]
|
||||
pub status: ListinvoicesInvoicesStatus,
|
||||
#[serde(alias = "expires_at")]
|
||||
pub expires_at: u64,
|
||||
#[serde(alias = "amount_msat", skip_serializing_if = "Option::is_none")]
|
||||
pub amount_msat: Option<Amount>,
|
||||
#[serde(alias = "bolt11", skip_serializing_if = "Option::is_none")]
|
||||
pub bolt11: Option<String>,
|
||||
#[serde(alias = "bolt12", skip_serializing_if = "Option::is_none")]
|
||||
pub bolt12: Option<String>,
|
||||
#[serde(alias = "local_offer_id", skip_serializing_if = "Option::is_none")]
|
||||
pub local_offer_id: Option<String>,
|
||||
#[serde(alias = "payer_note", skip_serializing_if = "Option::is_none")]
|
||||
pub payer_note: Option<String>,
|
||||
#[serde(alias = "pay_index", skip_serializing_if = "Option::is_none")]
|
||||
pub pay_index: Option<u64>,
|
||||
#[serde(alias = "amount_received_msat", skip_serializing_if = "Option::is_none")]
|
||||
pub amount_received_msat: Option<Amount>,
|
||||
#[serde(alias = "paid_at", skip_serializing_if = "Option::is_none")]
|
||||
pub paid_at: Option<u64>,
|
||||
#[serde(alias = "payment_preimage", skip_serializing_if = "Option::is_none")]
|
||||
pub payment_preimage: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListinvoicesResponse {
|
||||
#[serde(alias = "invoices")]
|
||||
pub invoices: Vec<ListinvoicesInvoices>,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -51,14 +51,14 @@ def load_jsonrpc_service():
|
|||
# "check", # No point in mapping this one
|
||||
"Close",
|
||||
"Connect",
|
||||
# "createinvoice",
|
||||
"CreateInvoice",
|
||||
# "createonion",
|
||||
"Datastore",
|
||||
# "decodepay",
|
||||
# "decode",
|
||||
"DelDatastore",
|
||||
# "delexpiredinvoice",
|
||||
# "delinvoice",
|
||||
"DelExpiredInvoice",
|
||||
"DelInvoice",
|
||||
# "delpay",
|
||||
# "disableoffer",
|
||||
# "disconnect",
|
||||
|
@ -75,18 +75,17 @@ def load_jsonrpc_service():
|
|||
# "getroute",
|
||||
# "getsharedsecret",
|
||||
# "help",
|
||||
# "invoice",
|
||||
"Invoice",
|
||||
# "keysend",
|
||||
# "listchannels",
|
||||
# "listconfigs",
|
||||
"ListDatastore",
|
||||
# "listforwards",
|
||||
# "listfunds",
|
||||
# "listinvoices",
|
||||
"ListInvoices",
|
||||
# "listnodes",
|
||||
# "listoffers",
|
||||
# "listpays",
|
||||
# "listpeers",
|
||||
# "listsendpays",
|
||||
# "listtransactions",
|
||||
# "multifundchannel",
|
||||
|
|
|
@ -362,7 +362,7 @@ class GrpcUnconverterGenerator(GrpcConverterGenerator):
|
|||
|
||||
elif isinstance(f, EnumField):
|
||||
if f.required:
|
||||
self.write(f"{name}: c.{name}.into(),\n", numindent=3)
|
||||
self.write(f"{name}: c.{name}.try_into().unwrap(),\n", numindent=3)
|
||||
else:
|
||||
self.write(f"{name}: c.{name}.map(|v| v.try_into().unwrap()),\n", numindent=3)
|
||||
pass
|
||||
|
|
24
doc/schemas/createinvoice.request.json
Normal file
24
doc/schemas/createinvoice.request.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"invstring",
|
||||
"label",
|
||||
"preimage"
|
||||
],
|
||||
"properties": {
|
||||
"invstring": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
},
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
},
|
||||
"preimage": {
|
||||
"type": "hex",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
14
doc/schemas/delexpiredinvoice.request.json
Normal file
14
doc/schemas/delexpiredinvoice.request.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"maxexpirytime"
|
||||
],
|
||||
"properties": {
|
||||
"maxexpirytime": {
|
||||
"type": "u32",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
23
doc/schemas/delinvoice.request.json
Normal file
23
doc/schemas/delinvoice.request.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"label",
|
||||
"status"
|
||||
],
|
||||
"properties": {
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"paid",
|
||||
"expired",
|
||||
"unpaid"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
47
doc/schemas/invoice.request.json
Normal file
47
doc/schemas/invoice.request.json
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"msatoshi",
|
||||
"label",
|
||||
"description"
|
||||
],
|
||||
"properties": {
|
||||
"msatoshi": {
|
||||
"type": "msat",
|
||||
"description": ""
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
},
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
},
|
||||
"expiry": {
|
||||
"type": "",
|
||||
"description": ""
|
||||
},
|
||||
"fallbacks": {
|
||||
"type": "array",
|
||||
"description": "",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"preimage": {
|
||||
"type": "hex",
|
||||
"description": ""
|
||||
},
|
||||
"exposeprivatechannels": {
|
||||
"type": "bool",
|
||||
"description": ""
|
||||
},
|
||||
"cltv": {
|
||||
"type": "u32",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
24
doc/schemas/listinvoices.request.json
Normal file
24
doc/schemas/listinvoices.request.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [],
|
||||
"properties": {
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
},
|
||||
"invstring": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
},
|
||||
"payment_hash": {
|
||||
"type": "hex",
|
||||
"description": ""
|
||||
},
|
||||
"offer_id": {
|
||||
"type": "string",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue