cln-rpc 0.7.0

An async RPC client for Core Lightning.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
// This file is autogenerated by `msggen`
// Do not edit it manually, your changes will be overwritten



use serde::{Serialize, Deserialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum Hook {
    #[serde(rename = "peer_connected")]
    PeerConnected(events::PeerConnectedEvent),
    #[serde(rename = "recover_hook")]
    RecoverHook(events::RecoverHookEvent),
    #[serde(rename = "commitment_revocation")]
    CommitmentRevocation(events::CommitmentRevocationEvent),
    #[serde(rename = "db_write")]
    DbWrite(events::DbWriteEvent),
    #[serde(rename = "invoice_payment_hook")]
    InvoicePaymentHook(events::InvoicePaymentHookEvent),
    #[serde(rename = "openchannel")]
    Openchannel(events::OpenchannelEvent),
    #[serde(rename = "openchannel2")]
    Openchannel2(events::Openchannel2Event),
    #[serde(rename = "openchannel2_changed")]
    Openchannel2Changed(events::Openchannel2ChangedEvent),
    #[serde(rename = "openchannel2_sign")]
    Openchannel2Sign(events::Openchannel2SignEvent),
    #[serde(rename = "rbf_channel")]
    RbfChannel(events::RbfChannelEvent),
    #[serde(rename = "htlc_accepted")]
    HtlcAccepted(events::HtlcAcceptedEvent),
    #[serde(rename = "rpc_command")]
    RpcCommand(events::RpcCommandEvent),
    #[serde(rename = "custommsg_hook")]
    CustommsgHook(events::CustommsgHookEvent),
    #[serde(rename = "onion_message_recv")]
    OnionMessageRecv(events::OnionMessageRecvEvent),
    #[serde(rename = "onion_message_recv_secret")]
    OnionMessageRecvSecret(events::OnionMessageRecvSecretEvent),
}


pub mod events{
    use crate::primitives::*;
    use serde::{Serialize, Deserialize};

    /// ['Connection direction: `in` for incoming, `out` for outgoing.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum PeerConnectedPeerDirection {
        #[serde(rename = "in")]
        IN = 0,
        #[serde(rename = "out")]
        OUT = 1,
    }

    impl TryFrom<i32> for PeerConnectedPeerDirection {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<PeerConnectedPeerDirection, anyhow::Error> {
            match c {
        0 => Ok(PeerConnectedPeerDirection::IN),
        1 => Ok(PeerConnectedPeerDirection::OUT),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum PeerConnectedPeerDirection", o)),
            }
        }
    }

    impl ToString for PeerConnectedPeerDirection {
        fn to_string(&self) -> String {
            match self {
                PeerConnectedPeerDirection::IN => "IN",
                PeerConnectedPeerDirection::OUT => "OUT",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct PeerConnectedPeer {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub remote_addr: Option<String>,
        // Path `peer_connected.peer.direction`
        pub direction: PeerConnectedPeerDirection,
        pub addr: String,
        pub features: String,
        pub id: PublicKey,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct PeerConnectedEvent {
        pub peer: PeerConnectedPeer,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RecoverHookEvent {
        pub codex32: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct CommitmentRevocationEvent {
        pub channel_id: Sha256,
        pub commitment_txid: String,
        pub commitnum: u64,
        pub penalty_tx: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct DbWriteEvent {
        pub data_version: u32,
        pub writes: Vec<String>,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct InvoicePaymentHookPayment {
        pub label: String,
        pub msat: Amount,
        pub preimage: Secret,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct InvoicePaymentHookEvent {
        pub payment: InvoicePaymentHookPayment,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OpenchannelOpenchannelChannelType {
        pub bits: Vec<u32>,
        pub names: Vec<String>,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OpenchannelOpenchannel {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub channel_type: Option<OpenchannelOpenchannelChannelType>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub shutdown_scriptpubkey: Option<String>,
        pub channel_flags: u8,
        pub channel_reserve_msat: Amount,
        pub dust_limit_msat: Amount,
        pub feerate_per_kw: u32,
        pub funding_msat: Amount,
        pub htlc_minimum_msat: Amount,
        pub id: PublicKey,
        pub max_accepted_htlcs: u32,
        pub max_htlc_value_in_flight_msat: Amount,
        pub push_msat: Amount,
        pub to_self_delay: u32,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OpenchannelEvent {
        pub openchannel: OpenchannelOpenchannel,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2Openchannel2ChannelType {
        pub bits: Vec<u32>,
        pub names: Vec<String>,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2Openchannel2 {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub channel_type: Option<Openchannel2Openchannel2ChannelType>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub lease_blockheight_start: Option<u32>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub node_blockheight: Option<u32>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub requested_lease_msat: Option<Amount>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub shutdown_scriptpubkey: Option<String>,
        pub channel_flags: u8,
        pub channel_id: Sha256,
        pub channel_max_msat: Amount,
        pub commitment_feerate_per_kw: u32,
        pub dust_limit_msat: Amount,
        pub feerate_our_max: u32,
        pub feerate_our_min: u32,
        pub funding_feerate_per_kw: u32,
        pub htlc_minimum_msat: Amount,
        pub id: PublicKey,
        pub locktime: u32,
        pub max_accepted_htlcs: u16,
        pub max_htlc_value_in_flight_msat: Amount,
        pub require_confirmed_inputs: bool,
        pub their_funding_msat: Amount,
        pub to_self_delay: u16,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2Event {
        pub openchannel2: Openchannel2Openchannel2,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2ChangedOpenchannel2Changed {
        pub channel_id: Sha256,
        pub psbt: String,
        pub require_confirmed_inputs: bool,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2ChangedEvent {
        pub openchannel2_changed: Openchannel2ChangedOpenchannel2Changed,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2SignOpenchannel2Sign {
        pub channel_id: Sha256,
        pub psbt: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2SignEvent {
        pub openchannel2_sign: Openchannel2SignOpenchannel2Sign,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RbfChannelRbfChannel {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub requested_lease_msat: Option<Amount>,
        pub channel_id: Sha256,
        pub channel_max_msat: Amount,
        pub feerate_our_max: u32,
        pub feerate_our_min: u32,
        pub funding_feerate_per_kw: u32,
        pub id: PublicKey,
        pub locktime: u32,
        pub our_last_funding_msat: Amount,
        pub require_confirmed_inputs: bool,
        pub their_funding_msat: Amount,
        pub their_last_funding_msat: Amount,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RbfChannelEvent {
        pub rbf_channel: RbfChannelRbfChannel,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct HtlcAcceptedHtlc {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub extra_tlvs: Option<String>,
        pub amount_msat: Amount,
        pub cltv_expiry: u32,
        pub cltv_expiry_relative: u32,
        pub id: u64,
        pub payment_hash: Sha256,
        pub short_channel_id: ShortChannelId,
    }

    /// ['Indicates that the payload is TLV formatted.', 'Only present if the payload was successfully parsed.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum HtlcAcceptedOnionType {
        #[serde(rename = "tlv")]
        TLV = 0,
    }

    impl TryFrom<i32> for HtlcAcceptedOnionType {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<HtlcAcceptedOnionType, anyhow::Error> {
            match c {
        0 => Ok(HtlcAcceptedOnionType::TLV),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum HtlcAcceptedOnionType", o)),
            }
        }
    }

    impl ToString for HtlcAcceptedOnionType {
        fn to_string(&self) -> String {
            match self {
                HtlcAcceptedOnionType::TLV => "TLV",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct HtlcAcceptedOnion {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub forward_msat: Option<Amount>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub item_type: Option<HtlcAcceptedOnionType>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub next_node_id: Option<PublicKey>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub outgoing_cltv_value: Option<u32>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub payment_metadata: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub payment_secret: Option<Secret>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub short_channel_id: Option<ShortChannelId>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub total_msat: Option<Amount>,
        pub next_onion: String,
        pub payload: String,
        pub shared_secret: Secret,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct HtlcAcceptedEvent {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub forward_to: Option<Sha256>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub peer_id: Option<PublicKey>,
        pub htlc: HtlcAcceptedHtlc,
        pub onion: HtlcAcceptedOnion,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RpcCommandRpcCommand {
        pub id: JsonScalar,
        pub method: String,
        pub params: JsonObjectOrArray,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RpcCommandEvent {
        pub rpc_command: RpcCommandRpcCommand,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct CustommsgHookEvent {
        pub payload: String,
        pub peer_id: PublicKey,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvOnionMessageReplyBlindedpathHops {
        pub blinded_node_id: PublicKey,
        pub encrypted_recipient_data: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvOnionMessageReplyBlindedpath {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_node_id: Option<PublicKey>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_path_key: Option<PublicKey>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_scid: Option<ShortChannelId>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_scid_dir: Option<u32>,
        #[serde(skip_serializing_if = "crate::is_none_or_empty")]
        pub hops: Option<Vec<OnionMessageRecvOnionMessageReplyBlindedpathHops>>,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvOnionMessageUnknownFields {
        pub number: u64,
        pub value: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvOnionMessage {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub invoice: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub invoice_error: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub invoice_request: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub reply_blindedpath: Option<OnionMessageRecvOnionMessageReplyBlindedpath>,
        #[serde(skip_serializing_if = "crate::is_none_or_empty")]
        pub unknown_fields: Option<Vec<OnionMessageRecvOnionMessageUnknownFields>>,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvEvent {
        pub onion_message: OnionMessageRecvOnionMessage,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvSecretOnionMessageReplyBlindedpathHops {
        pub blinded_node_id: PublicKey,
        pub encrypted_recipient_data: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvSecretOnionMessageReplyBlindedpath {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_node_id: Option<PublicKey>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_path_key: Option<PublicKey>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_scid: Option<ShortChannelId>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub first_scid_dir: Option<u32>,
        #[serde(skip_serializing_if = "crate::is_none_or_empty")]
        pub hops: Option<Vec<OnionMessageRecvSecretOnionMessageReplyBlindedpathHops>>,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvSecretOnionMessageUnknownFields {
        pub number: u64,
        pub value: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvSecretOnionMessage {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub invoice: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub invoice_error: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub invoice_request: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub reply_blindedpath: Option<OnionMessageRecvSecretOnionMessageReplyBlindedpath>,
        #[serde(skip_serializing_if = "crate::is_none_or_empty")]
        pub unknown_fields: Option<Vec<OnionMessageRecvSecretOnionMessageUnknownFields>>,
        pub pathsecret: Secret,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvSecretEvent {
        pub onion_message: OnionMessageRecvSecretOnionMessage,
    }

}
pub mod actions{
    use crate::primitives::*;
    use serde::{Serialize, Deserialize};

    /// ['Whether to allow the connection to proceed or disconnect the peer.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum PeerConnectedResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
        #[serde(rename = "disconnect")]
        DISCONNECT = 1,
    }

    impl TryFrom<i32> for PeerConnectedResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<PeerConnectedResult, anyhow::Error> {
            match c {
        0 => Ok(PeerConnectedResult::CONTINUE),
        1 => Ok(PeerConnectedResult::DISCONNECT),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum PeerConnectedResult", o)),
            }
        }
    }

    impl ToString for PeerConnectedResult {
        fn to_string(&self) -> String {
            match self {
                PeerConnectedResult::CONTINUE => "CONTINUE",
                PeerConnectedResult::DISCONNECT => "DISCONNECT",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct PeerConnectedAction {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub error_message: Option<String>,
        // Path `peer_connected.result`
        pub result: PeerConnectedResult,
    }

    /// ['Returning "continue" resumes normal execution.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum RecoverHookResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
    }

    impl TryFrom<i32> for RecoverHookResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<RecoverHookResult, anyhow::Error> {
            match c {
        0 => Ok(RecoverHookResult::CONTINUE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum RecoverHookResult", o)),
            }
        }
    }

    impl ToString for RecoverHookResult {
        fn to_string(&self) -> String {
            match self {
                RecoverHookResult::CONTINUE => "CONTINUE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RecoverHookAction {
        // Path `recover_hook.result`
        pub result: RecoverHookResult,
    }

    /// ['Plugins should always return "continue", otherwise subsequent hook subscribers would not get called.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum CommitmentRevocationResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
    }

    impl TryFrom<i32> for CommitmentRevocationResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<CommitmentRevocationResult, anyhow::Error> {
            match c {
        0 => Ok(CommitmentRevocationResult::CONTINUE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum CommitmentRevocationResult", o)),
            }
        }
    }

    impl ToString for CommitmentRevocationResult {
        fn to_string(&self) -> String {
            match self {
                CommitmentRevocationResult::CONTINUE => "CONTINUE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct CommitmentRevocationAction {
        // Path `commitment_revocation.result`
        pub result: CommitmentRevocationResult,
    }

    /// ['Must be "continue" for the database commit to proceed.', 'Any other value will abort the commit and cause `lightningd` to error.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum DbWriteResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
    }

    impl TryFrom<i32> for DbWriteResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<DbWriteResult, anyhow::Error> {
            match c {
        0 => Ok(DbWriteResult::CONTINUE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum DbWriteResult", o)),
            }
        }
    }

    impl ToString for DbWriteResult {
        fn to_string(&self) -> String {
            match self {
                DbWriteResult::CONTINUE => "CONTINUE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct DbWriteAction {
        // Path `db_write.result`
        pub result: DbWriteResult,
    }

    /// ['Controls whether the payment is accepted or rejected.', '"continue" accepts the payment.', '"reject" fails the payment.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum InvoicePaymentHookResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
        #[serde(rename = "reject")]
        REJECT = 1,
    }

    impl TryFrom<i32> for InvoicePaymentHookResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<InvoicePaymentHookResult, anyhow::Error> {
            match c {
        0 => Ok(InvoicePaymentHookResult::CONTINUE),
        1 => Ok(InvoicePaymentHookResult::REJECT),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum InvoicePaymentHookResult", o)),
            }
        }
    }

    impl ToString for InvoicePaymentHookResult {
        fn to_string(&self) -> String {
            match self {
                InvoicePaymentHookResult::CONTINUE => "CONTINUE",
                InvoicePaymentHookResult::REJECT => "REJECT",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct InvoicePaymentHookAction {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub failure_message: Option<String>,
        // Path `invoice_payment_hook.result`
        pub result: InvoicePaymentHookResult,
    }

    /// ['Whether to accept or reject the channel opening request.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum OpenchannelResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
        #[serde(rename = "reject")]
        REJECT = 1,
    }

    impl TryFrom<i32> for OpenchannelResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<OpenchannelResult, anyhow::Error> {
            match c {
        0 => Ok(OpenchannelResult::CONTINUE),
        1 => Ok(OpenchannelResult::REJECT),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum OpenchannelResult", o)),
            }
        }
    }

    impl ToString for OpenchannelResult {
        fn to_string(&self) -> String {
            match self {
                OpenchannelResult::CONTINUE => "CONTINUE",
                OpenchannelResult::REJECT => "REJECT",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OpenchannelAction {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub close_to: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub error_message: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub mindepth: Option<u32>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub reserve: Option<Amount>,
        // Path `openchannel.result`
        pub result: OpenchannelResult,
    }

    /// ['Indicates whether to accept or reject the channel proposal.', 'Returning "continue" allows the channel negotiation to proceed.', 'Returning "reject" aborts the channel opening.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum Openchannel2Result {
        #[serde(rename = "continue")]
        CONTINUE = 0,
        #[serde(rename = "reject")]
        REJECT = 1,
    }

    impl TryFrom<i32> for Openchannel2Result {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<Openchannel2Result, anyhow::Error> {
            match c {
        0 => Ok(Openchannel2Result::CONTINUE),
        1 => Ok(Openchannel2Result::REJECT),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum Openchannel2Result", o)),
            }
        }
    }

    impl ToString for Openchannel2Result {
        fn to_string(&self) -> String {
            match self {
                Openchannel2Result::CONTINUE => "CONTINUE",
                Openchannel2Result::REJECT => "REJECT",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2Action {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub close_to: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub error_message: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub our_funding_msat: Option<Amount>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub psbt: Option<String>,
        // Path `openchannel2.result`
        pub result: Openchannel2Result,
    }

    /// ['Must be set to `continue` to proceed with the channel opening negotiation.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum Openchannel2ChangedResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
    }

    impl TryFrom<i32> for Openchannel2ChangedResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<Openchannel2ChangedResult, anyhow::Error> {
            match c {
        0 => Ok(Openchannel2ChangedResult::CONTINUE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum Openchannel2ChangedResult", o)),
            }
        }
    }

    impl ToString for Openchannel2ChangedResult {
        fn to_string(&self) -> String {
            match self {
                Openchannel2ChangedResult::CONTINUE => "CONTINUE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2ChangedAction {
        // Path `openchannel2_changed.result`
        pub result: Openchannel2ChangedResult,
        pub psbt: String,
    }

    /// ['Must be set to `continue` to proceed with channel opening.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum Openchannel2SignResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
    }

    impl TryFrom<i32> for Openchannel2SignResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<Openchannel2SignResult, anyhow::Error> {
            match c {
        0 => Ok(Openchannel2SignResult::CONTINUE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum Openchannel2SignResult", o)),
            }
        }
    }

    impl ToString for Openchannel2SignResult {
        fn to_string(&self) -> String {
            match self {
                Openchannel2SignResult::CONTINUE => "CONTINUE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Openchannel2SignAction {
        // Path `openchannel2_sign.result`
        pub result: Openchannel2SignResult,
        pub psbt: String,
    }

    /// ['Whether to accept or reject the RBF proposal.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum RbfChannelResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
        #[serde(rename = "reject")]
        REJECT = 1,
    }

    impl TryFrom<i32> for RbfChannelResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<RbfChannelResult, anyhow::Error> {
            match c {
        0 => Ok(RbfChannelResult::CONTINUE),
        1 => Ok(RbfChannelResult::REJECT),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum RbfChannelResult", o)),
            }
        }
    }

    impl ToString for RbfChannelResult {
        fn to_string(&self) -> String {
            match self {
                RbfChannelResult::CONTINUE => "CONTINUE",
                RbfChannelResult::REJECT => "REJECT",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RbfChannelAction {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub error_message: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub our_funding_msat: Option<Amount>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub psbt: Option<String>,
        // Path `rbf_channel.result`
        pub result: RbfChannelResult,
    }

    /// ['Determines how the HTLC should be handled.', '', '`continue` means that the plugin does not want to do anything special and lightningd should continue processing it normally,', "i.e., resolve the payment if we're the recipient, or attempt to forward it otherwise. Notice that the usual checks such as sufficient fees and CLTV deltas are still enforced.", '', 'It can also replace the onion.payload by specifying a payload in the response. Note that this is always a TLV-style payload,', 'so unlike onion.payload there is no length prefix (and it must be at least 4 hex digits long). This will be re-parsed;', "it's useful for removing onion fields which a plugin doesn't want lightningd to consider.", '', 'It can also specify forward_to in the response, replacing the destination.', 'This usually only makes sense if it wants to choose an alternate channel to the same next peer, but is useful if the payload is also replaced.', '', 'Also, it can specify extra_tlvs in the response. This will replace the TLV-stream update_add_htlc_tlvs in the update_add_htlc message for forwarded htlcs.', '', 'If the node is the final destination, the plugin can also replace the amount of the invoice that belongs to the payment_hash by specifying invoice_msat.', '', '', '`fail` will tell lightningd to fail the HTLC with a given hex-encoded `failure_message` (please refer to BOLT #4 for details: `incorrect_or_unknown_payment_details` is the most common).', '', 'Instead of `failure_message` the response can contain a hex-encoded `failure_onion` that will be used instead (please refer to the BOLT #4 for details).', "This can be used, for example, if you're writing a bridge between two Lightning Networks. Note that lightningd will apply the obfuscation step to the value", 'returned here with its own shared secret (and key type `ammag`) before returning it to the previous hop.', '', '', '`resolve` instructs lightningd to claim the HTLC by providing the preimage matching the `payment_hash` presented in the call.', 'Notice that the plugin must ensure that the `payment_key` really matches the `payment_hash` since lightningd will not check and the wrong value could result in the channel being closed.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum HtlcAcceptedResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
        #[serde(rename = "fail")]
        FAIL = 1,
        #[serde(rename = "resolve")]
        RESOLVE = 2,
    }

    impl TryFrom<i32> for HtlcAcceptedResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<HtlcAcceptedResult, anyhow::Error> {
            match c {
        0 => Ok(HtlcAcceptedResult::CONTINUE),
        1 => Ok(HtlcAcceptedResult::FAIL),
        2 => Ok(HtlcAcceptedResult::RESOLVE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum HtlcAcceptedResult", o)),
            }
        }
    }

    impl ToString for HtlcAcceptedResult {
        fn to_string(&self) -> String {
            match self {
                HtlcAcceptedResult::CONTINUE => "CONTINUE",
                HtlcAcceptedResult::FAIL => "FAIL",
                HtlcAcceptedResult::RESOLVE => "RESOLVE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct HtlcAcceptedAction {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub extra_tlvs: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub failure_message: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub failure_onion: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub forward_to: Option<Sha256>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub invoice_msat: Option<Amount>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub payload: Option<String>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub payment_key: Option<Secret>,
        // Path `htlc_accepted.result`
        pub result: HtlcAcceptedResult,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RpcCommandReturnError {
        pub code: i64,
        pub message: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RpcCommandReturnResult {
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RpcCommandReturn {
        #[serde(skip_serializing_if = "Option::is_none")]
        pub error: Option<RpcCommandReturnError>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub result: Option<RpcCommandReturnResult>,
    }

    /// ['The JSON-RPC version.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum RpcCommandReplaceJsonrpc {
        #[serde(rename = "2.0")]
        NUM_2_0 = 0,
    }

    impl TryFrom<i32> for RpcCommandReplaceJsonrpc {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<RpcCommandReplaceJsonrpc, anyhow::Error> {
            match c {
        0 => Ok(RpcCommandReplaceJsonrpc::NUM_2_0),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum RpcCommandReplaceJsonrpc", o)),
            }
        }
    }

    impl ToString for RpcCommandReplaceJsonrpc {
        fn to_string(&self) -> String {
            match self {
                RpcCommandReplaceJsonrpc::NUM_2_0 => "NUM_2_0",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RpcCommandReplace {
        // Path `rpc_command.replace.jsonrpc`
        pub jsonrpc: RpcCommandReplaceJsonrpc,
        pub id: JsonScalar,
        pub method: String,
        pub params: JsonObjectOrArray,
    }

    /// ['Indicates that lightningd should continue processing the RPC command normally.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum RpcCommandResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
    }

    impl TryFrom<i32> for RpcCommandResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<RpcCommandResult, anyhow::Error> {
            match c {
        0 => Ok(RpcCommandResult::CONTINUE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum RpcCommandResult", o)),
            }
        }
    }

    impl ToString for RpcCommandResult {
        fn to_string(&self) -> String {
            match self {
                RpcCommandResult::CONTINUE => "CONTINUE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct RpcCommandAction {
        #[serde(rename = "return")]
        #[serde(skip_serializing_if = "Option::is_none")]
        pub return_: Option<RpcCommandReturn>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub replace: Option<RpcCommandReplace>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub result: Option<RpcCommandResult>,
    }

    /// ['Must always be `continue`. Any other value will cause the hook to fail.']
    #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
    #[allow(non_camel_case_types)]
    pub enum CustommsgHookResult {
        #[serde(rename = "continue")]
        CONTINUE = 0,
    }

    impl TryFrom<i32> for CustommsgHookResult {
        type Error = anyhow::Error;
        fn try_from(c: i32) -> Result<CustommsgHookResult, anyhow::Error> {
            match c {
        0 => Ok(CustommsgHookResult::CONTINUE),
                o => Err(anyhow::anyhow!("Unknown variant {} for enum CustommsgHookResult", o)),
            }
        }
    }

    impl ToString for CustommsgHookResult {
        fn to_string(&self) -> String {
            match self {
                CustommsgHookResult::CONTINUE => "CONTINUE",
            }.to_string()
        }
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct CustommsgHookAction {
        // Path `custommsg_hook.result`
        pub result: CustommsgHookResult,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvAction {
        pub result: String,
    }

    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct OnionMessageRecvSecretAction {
        pub result: String,
    }

}