MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_keysend

Function test_keysend

cln-grpc/src/test.rs:244–301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

242
243#[test]
244fn test_keysend() {
245 let g =
246 KeysendRequest {
247 destination: hex::decode(
248 "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
249 )
250 .unwrap(),
251 amount_msat: Some(Amount { msat: 10000 }),
252
253 label: Some("hello".to_string()),
254 exemptfee: None,
255 maxdelay: None,
256 retry_for: None,
257 maxfeepercent: None,
258 routehints: Some(RoutehintList {
259 hints: vec![Routehint {
260 hops: vec![RouteHop {
261 id: hex::decode(
262 "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
263 )
264 .unwrap(),
265 short_channel_id: "12345x678x90".to_string(),
266 feebase: Some(Amount { msat: 123 }),
267 feeprop: 1234,
268 expirydelta: 9,
269 },RouteHop {
270 id: hex::decode(
271 "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
272 )
273 .unwrap(),
274 short_channel_id: "12345x678x90".to_string(),
275 feebase: Some(Amount { msat: 123 }),
276 feeprop: 1234,
277 expirydelta: 9,
278 }],
279 }],
280 }),
281 };
282
283 let u: cln_rpc::model::KeysendRequest = g.into();
284 let _ser = serde_json::to_string(&u);
285
286 let j = r#"{
287 "destination": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
288 "payment_hash": "e74b03a98453dcb5a7ed5406b97ec3566dde4be85ef71685110f4c0ebc600592",
289 "created_at": 1648222556.498,
290 "parts": 1,
291 "msatoshi": 10000,
292 "amount_msat": "10000msat",
293 "msatoshi_sent": 10001,
294 "amount_sent_msat": "10001msat",
295 "payment_preimage": "e56c22b9ed85560b021e1577daad5742502d25c0c2f636b817f5c0c7580a66a8",
296 "status": "complete"
297 }"#;
298 let u: cln_rpc::model::KeysendResponse = serde_json::from_str(j).unwrap();
299 let g: KeysendResponse = u.into();
300 println!("{:?}", g);
301}

Callers

nothing calls this directly

Calls 4

unwrapMethod · 0.80
to_stringMethod · 0.80
decodeFunction · 0.50
to_stringFunction · 0.50

Tested by

no test coverage detected