[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / FinalOnionHopData.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Information communicated in the onion to the recipient for multi-part tracking and proof that
11  * the payment is associated with an invoice.
12  */
13 public class FinalOnionHopData : CommonBase {
14         internal FinalOnionHopData(object _dummy, long ptr) : base(ptr) { }
15         ~FinalOnionHopData() {
16                 if (ptr != 0) { bindings.FinalOnionHopData_free(ptr); }
17         }
18
19         /**
20          * When sending a multi-part payment, this secret is used to identify a payment across HTLCs.
21          * Because it is generated by the recipient and included in the invoice, it also provides
22          * proof to the recipient that the payment was sent by someone with the generated invoice.
23          */
24         public byte[] get_payment_secret() {
25                 long ret = bindings.FinalOnionHopData_get_payment_secret(this.ptr);
26                 GC.KeepAlive(this);
27                 if (ret >= 0 && ret <= 4096) { return null; }
28                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
29                 return ret_conv;
30         }
31
32         /**
33          * When sending a multi-part payment, this secret is used to identify a payment across HTLCs.
34          * Because it is generated by the recipient and included in the invoice, it also provides
35          * proof to the recipient that the payment was sent by someone with the generated invoice.
36          */
37         public void set_payment_secret(byte[] val) {
38                 bindings.FinalOnionHopData_set_payment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
39                 GC.KeepAlive(this);
40                 GC.KeepAlive(val);
41         }
42
43         /**
44          * The intended total amount that this payment is for.
45          * 
46          * Message serialization may panic if this value is more than 21 million Bitcoin.
47          */
48         public long get_total_msat() {
49                 long ret = bindings.FinalOnionHopData_get_total_msat(this.ptr);
50                 GC.KeepAlive(this);
51                 return ret;
52         }
53
54         /**
55          * The intended total amount that this payment is for.
56          * 
57          * Message serialization may panic if this value is more than 21 million Bitcoin.
58          */
59         public void set_total_msat(long val) {
60                 bindings.FinalOnionHopData_set_total_msat(this.ptr, val);
61                 GC.KeepAlive(this);
62                 GC.KeepAlive(val);
63         }
64
65         /**
66          * Constructs a new FinalOnionHopData given each field
67          */
68         public static FinalOnionHopData of(byte[] payment_secret_arg, long total_msat_arg) {
69                 long ret = bindings.FinalOnionHopData_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_secret_arg, 32)), total_msat_arg);
70                 GC.KeepAlive(payment_secret_arg);
71                 GC.KeepAlive(total_msat_arg);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.FinalOnionHopData ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FinalOnionHopData(null, ret); }
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
75                 return ret_hu_conv;
76         }
77
78         internal long clone_ptr() {
79                 long ret = bindings.FinalOnionHopData_clone_ptr(this.ptr);
80                 GC.KeepAlive(this);
81                 return ret;
82         }
83
84         /**
85          * Creates a copy of the FinalOnionHopData
86          */
87         public FinalOnionHopData clone() {
88                 long ret = bindings.FinalOnionHopData_clone(this.ptr);
89                 GC.KeepAlive(this);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 org.ldk.structs.FinalOnionHopData ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FinalOnionHopData(null, ret); }
92                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
93                 return ret_hu_conv;
94         }
95
96         /**
97          * Serialize the FinalOnionHopData object into a byte array which can be read by FinalOnionHopData_read
98          */
99         public byte[] write() {
100                 long ret = bindings.FinalOnionHopData_write(this.ptr);
101                 GC.KeepAlive(this);
102                 if (ret >= 0 && ret <= 4096) { return null; }
103                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
104                 return ret_conv;
105         }
106
107         /**
108          * Read a FinalOnionHopData from a byte array, created by FinalOnionHopData_write
109          */
110         public static Result_FinalOnionHopDataDecodeErrorZ read(byte[] ser) {
111                 long ret = bindings.FinalOnionHopData_read(InternalUtils.encodeUint8Array(ser));
112                 GC.KeepAlive(ser);
113                 if (ret >= 0 && ret <= 4096) { return null; }
114                 Result_FinalOnionHopDataDecodeErrorZ ret_hu_conv = Result_FinalOnionHopDataDecodeErrorZ.constr_from_ptr(ret);
115                 return ret_hu_conv;
116         }
117
118 }
119 } } }