Skip to content

Commit

Permalink
cln-rpc: Add invoice RPC methods
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker authored and rustyrussell committed Apr 1, 2022
1 parent d90aafe commit a7f3c54
Show file tree
Hide file tree
Showing 12 changed files with 930 additions and 7 deletions.
99 changes: 99 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,23 @@
"in": 0,
"out": 1
},
"CreateinvoiceStatus": {
"expired": 1,
"paid": 0,
"unpaid": 2
},
"DatastoreMode": {
"create-or-append": 4,
"create-or-replace": 2,
"must-append": 3,
"must-create": 0,
"must-replace": 1
},
"DelinvoiceStatus": {
"expired": 1,
"paid": 0,
"unpaid": 2
},
"GetinfoAddressType": {
"dns": 0,
"ipv4": 1,
Expand All @@ -43,6 +53,11 @@
"spent": 2,
"unconfirmed": 0
},
"ListinvoicesInvoicesStatus": {
"expired": 2,
"paid": 1,
"unpaid": 0
},
"ListpeersPeersChannelsHtlcsDirection": {
"in": 0,
"out": 1
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
126 changes: 126 additions & 0 deletions cln-grpc/proto/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Loading

0 comments on commit a7f3c54

Please sign in to comment.