Skip to content

Commit 28f5083

Browse files
committed
xpay: add sendamount command
Changelog-Added: sendamount command, to make a payment specifying the desired amount to send instead of the amount to be received. Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
1 parent b581b7e commit 28f5083

15 files changed

Lines changed: 1046 additions & 138 deletions

File tree

‎.msggen.json‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3847,6 +3847,22 @@
38473847
"sendpay_success.status": 12,
38483848
"sendpay_success.updated_index": 5
38493849
},
3850+
"SendamountRequest": {
3851+
"SendAmount.amount_msat": 2,
3852+
"SendAmount.invstring": 1,
3853+
"SendAmount.layers[]": 4,
3854+
"SendAmount.maxdelay": 6,
3855+
"SendAmount.maxfee": 3,
3856+
"SendAmount.payer_note": 7,
3857+
"SendAmount.retry_for": 5
3858+
},
3859+
"SendamountResponse": {
3860+
"SendAmount.amount_msat": 4,
3861+
"SendAmount.amount_sent_msat": 5,
3862+
"SendAmount.failed_parts": 2,
3863+
"SendAmount.payment_preimage": 1,
3864+
"SendAmount.successful_parts": 3
3865+
},
38503866
"SendcustommsgRequest": {
38513867
"SendCustomMsg.msg": 2,
38523868
"SendCustomMsg.node_id": 1
@@ -13173,6 +13189,54 @@
1317313189
"added": "pre-v0.10.1",
1317413190
"deprecated": null
1317513191
},
13192+
"SendAmount": {
13193+
"added": "v26.06",
13194+
"deprecated": null
13195+
},
13196+
"SendAmount.amount_msat": {
13197+
"added": "v26.06",
13198+
"deprecated": null
13199+
},
13200+
"SendAmount.amount_sent_msat": {
13201+
"added": "v26.06",
13202+
"deprecated": null
13203+
},
13204+
"SendAmount.failed_parts": {
13205+
"added": "v26.06",
13206+
"deprecated": null
13207+
},
13208+
"SendAmount.invstring": {
13209+
"added": "v26.06",
13210+
"deprecated": null
13211+
},
13212+
"SendAmount.layers[]": {
13213+
"added": "v26.06",
13214+
"deprecated": null
13215+
},
13216+
"SendAmount.maxdelay": {
13217+
"added": "v26.06",
13218+
"deprecated": null
13219+
},
13220+
"SendAmount.maxfee": {
13221+
"added": "v26.06",
13222+
"deprecated": null
13223+
},
13224+
"SendAmount.payer_note": {
13225+
"added": "v26.06",
13226+
"deprecated": null
13227+
},
13228+
"SendAmount.payment_preimage": {
13229+
"added": "v26.06",
13230+
"deprecated": null
13231+
},
13232+
"SendAmount.retry_for": {
13233+
"added": "v26.06",
13234+
"deprecated": null
13235+
},
13236+
"SendAmount.successful_parts": {
13237+
"added": "v26.06",
13238+
"deprecated": null
13239+
},
1317613240
"SendCustomMsg": {
1317713241
"added": "v0.10.1",
1317813242
"deprecated": null

‎cln-grpc/proto/node.proto‎

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cln-grpc/src/convert.rs‎

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cln-grpc/src/server.rs‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4818,6 +4818,38 @@ impl Node for Server
48184818

48194819
}
48204820

4821+
async fn send_amount(
4822+
&self,
4823+
request: tonic::Request<pb::SendamountRequest>,
4824+
) -> Result<tonic::Response<pb::SendamountResponse>, tonic::Status> {
4825+
let req = request.into_inner();
4826+
let req: requests::SendamountRequest = req.into();
4827+
debug!("Client asked for send_amount");
4828+
trace!("send_amount request: {:?}", req);
4829+
let mut rpc = ClnRpc::new(&self.rpc_path)
4830+
.await
4831+
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
4832+
let result = rpc.call(Request::SendAmount(req))
4833+
.await
4834+
.map_err(|e| Status::new(
4835+
Code::Unknown,
4836+
format!("Error calling method SendAmount: {:?}", e)))?;
4837+
match result {
4838+
Response::SendAmount(r) => {
4839+
trace!("send_amount response: {:?}", r);
4840+
Ok(tonic::Response::new(r.into()))
4841+
},
4842+
r => Err(Status::new(
4843+
Code::Internal,
4844+
format!(
4845+
"Unexpected result {:?} to method call SendAmount",
4846+
r
4847+
)
4848+
)),
4849+
}
4850+
4851+
}
4852+
48214853

48224854

48234855
type SubscribeBalanceSnapshotStream = NotificationStream<pb::BalanceSnapshotNotification>;

‎cln-rpc/src/model.rs‎

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)