Skip to content

Commit

Permalink
add listing options to listpays
Browse files Browse the repository at this point in the history
Changelog-Added: JSON-RPC: `listpays` has `index`, `start` and `limit` parameters for listing control.
  • Loading branch information
daywalker90 committed Jun 11, 2024
1 parent 11586ab commit 4e29a45
Show file tree
Hide file tree
Showing 10 changed files with 705 additions and 466 deletions.
31 changes: 30 additions & 1 deletion .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@
"torv3": 4,
"websocket": 5
},
"ListpaysIndex": {
"created": 0,
"updated": 1
},
"ListpaysPaysStatus": {
"complete": 2,
"failed": 1,
Expand Down Expand Up @@ -2212,18 +2216,23 @@
"ListPays.pays[].bolt12": 7,
"ListPays.pays[].completed_at": 12,
"ListPays.pays[].created_at": 4,
"ListPays.pays[].created_index": 15,
"ListPays.pays[].description": 11,
"ListPays.pays[].destination": 3,
"ListPays.pays[].erroronion": 10,
"ListPays.pays[].label": 5,
"ListPays.pays[].number_of_parts": 14,
"ListPays.pays[].payment_hash": 1,
"ListPays.pays[].preimage": 13,
"ListPays.pays[].status": 2
"ListPays.pays[].status": 2,
"ListPays.pays[].updated_index": 16
},
"ListpaysRequest": {
"ListPays.bolt11": 1,
"ListPays.index": 4,
"ListPays.limit": 6,
"ListPays.payment_hash": 2,
"ListPays.start": 5,
"ListPays.status": 3
},
"ListpaysResponse": {
Expand Down Expand Up @@ -8238,6 +8247,14 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"ListPays.index": {
"added": "v24.08",
"deprecated": false
},
"ListPays.limit": {
"added": "v24.08",
"deprecated": false
},
"ListPays.payment_hash": {
"added": "pre-v0.10.1",
"deprecated": false
Expand Down Expand Up @@ -8270,6 +8287,10 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"ListPays.pays[].created_index": {
"added": "v24.08",
"deprecated": false
},
"ListPays.pays[].description": {
"added": "pre-v0.10.1",
"deprecated": false
Expand Down Expand Up @@ -8302,6 +8323,14 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"ListPays.pays[].updated_index": {
"added": "v24.08",
"deprecated": false
},
"ListPays.start": {
"added": "v24.08",
"deprecated": false
},
"ListPays.status": {
"added": "pre-v0.10.1",
"deprecated": false
Expand Down
10 changes: 10 additions & 0 deletions cln-grpc/proto/node.proto

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

8 changes: 8 additions & 0 deletions cln-grpc/src/convert.rs

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

39 changes: 39 additions & 0 deletions cln-rpc/src/model.rs

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

55 changes: 52 additions & 3 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19046,6 +19046,32 @@
"complete",
"failed"
]
},
"index": {
"type": "string",
"added": "v24.08",
"enum": [
"created",
"updated"
],
"description": [
"If neither *in_channel* nor *out_channel* is specified, it controls ordering."
],
"default": "`created`"
},
"start": {
"type": "u64",
"added": "v24.08",
"description": [
"If `index` is specified, `start` may be specified to start from that value, which is generally returned from lightning-wait(7)."
]
},
"limit": {
"type": "u32",
"added": "v24.08",
"description": [
"If `index` is specified, `limit` can be used to specify the maximum number of entries to return."
]
}
}
},
Expand All @@ -19062,7 +19088,8 @@
"required": [
"payment_hash",
"status",
"created_at"
"created_at",
"created_index"
],
"properties": {
"payment_hash": {
Expand Down Expand Up @@ -19123,6 +19150,20 @@
"description": [
"The bolt12 string (if supplied for pay: **experimental-offers** only)."
]
},
"created_index": {
"type": "u64",
"added": "v24.08",
"description": [
"1-based index indicating order this invoice was created in."
]
},
"updated_index": {
"type": "u64",
"added": "v24.08",
"description": [
"1-based index indicating order this invoice was changed (only present if it has changed since creation)."
]
}
},
"allOf": [
Expand All @@ -19144,6 +19185,8 @@
"preimage"
],
"properties": {
"created_index": {},
"updated_index": {},
"payment_hash": {},
"status": {},
"destination": {},
Expand Down Expand Up @@ -19197,6 +19240,8 @@
"amount_sent_msat"
],
"properties": {
"created_index": {},
"updated_index": {},
"payment_hash": {},
"status": {},
"destination": {},
Expand Down Expand Up @@ -19242,7 +19287,9 @@
"payment_hash": "bf75a41a19d1e559ebd4a33ca295b3d82ae8d50178a66e3cc2eddb8ac443455e",
"status": "failed",
"created_at": 1706231854,
"amount_sent_msat": 0
"amount_sent_msat": 0,
"created_index": 1,
"updated_index": 1
}
]
}
Expand All @@ -19268,7 +19315,9 @@
"completed_at": 1706231854,
"preimage": "89ce412a2089cbcb72a73ce755337cf693859ea58f21ef0d1caf286a9b0f2a7c",
"amount_msat": 12300,
"amount_sent_msat": 12301
"amount_sent_msat": 12301,
"created_index": 1,
"updated_index": 1
}
]
}
Expand Down
7 changes: 5 additions & 2 deletions contrib/pyln-client/pyln/client/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def listnodes(self, node_id=None):
}
return self.call("listnodes", payload)

def listpays(self, bolt11=None, payment_hash=None, status=None):
def listpays(self, bolt11=None, payment_hash=None, status=None, index=None, start=None, limit=None):
"""
Show outgoing payments, regarding {bolt11} or {payment_hash} if set
Can only specify one of {bolt11} or {payment_hash}. It is possible
Expand All @@ -995,7 +995,10 @@ def listpays(self, bolt11=None, payment_hash=None, status=None):
payload = {
"bolt11": bolt11,
"payment_hash": payment_hash,
"status": status
"status": status,
"index": index,
"start": start,
"limit": limit,
}
return self.call("listpays", payload)

Expand Down
914 changes: 458 additions & 456 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,13 +1625,15 @@ def listpays_pays2py(m):
"bolt12": m.bolt12, # PrimitiveField in generate_composite
"completed_at": m.completed_at, # PrimitiveField in generate_composite
"created_at": m.created_at, # PrimitiveField in generate_composite
"created_index": m.created_index, # PrimitiveField in generate_composite
"description": m.description, # PrimitiveField in generate_composite
"destination": hexlify(m.destination), # PrimitiveField in generate_composite
"erroronion": hexlify(m.erroronion), # PrimitiveField in generate_composite
"label": m.label, # PrimitiveField in generate_composite
"number_of_parts": m.number_of_parts, # PrimitiveField in generate_composite
"payment_hash": hexlify(m.payment_hash), # PrimitiveField in generate_composite
"preimage": hexlify(m.preimage), # PrimitiveField in generate_composite
"updated_index": m.updated_index, # PrimitiveField in generate_composite
})


Expand Down
Loading

0 comments on commit 4e29a45

Please sign in to comment.