[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / PaymentRelay.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  * Parameters for relaying over a given [`BlindedHop`].
11  * 
12  * [`BlindedHop`]: crate::blinded_path::BlindedHop
13  */
14 public class PaymentRelay : CommonBase {
15         internal PaymentRelay(object _dummy, long ptr) : base(ptr) { }
16         ~PaymentRelay() {
17                 if (ptr != 0) { bindings.PaymentRelay_free(ptr); }
18         }
19
20         /**
21          * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
22          */
23         public short get_cltv_expiry_delta() {
24                 short ret = bindings.PaymentRelay_get_cltv_expiry_delta(this.ptr);
25                 GC.KeepAlive(this);
26                 return ret;
27         }
28
29         /**
30          * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
31          */
32         public void set_cltv_expiry_delta(short val) {
33                 bindings.PaymentRelay_set_cltv_expiry_delta(this.ptr, val);
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
40          * this [`BlindedHop`], (i.e., 10,000 is 1%).
41          */
42         public int get_fee_proportional_millionths() {
43                 int ret = bindings.PaymentRelay_get_fee_proportional_millionths(this.ptr);
44                 GC.KeepAlive(this);
45                 return ret;
46         }
47
48         /**
49          * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
50          * this [`BlindedHop`], (i.e., 10,000 is 1%).
51          */
52         public void set_fee_proportional_millionths(int val) {
53                 bindings.PaymentRelay_set_fee_proportional_millionths(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
60          */
61         public int get_fee_base_msat() {
62                 int ret = bindings.PaymentRelay_get_fee_base_msat(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
69          */
70         public void set_fee_base_msat(int val) {
71                 bindings.PaymentRelay_set_fee_base_msat(this.ptr, val);
72                 GC.KeepAlive(this);
73                 GC.KeepAlive(val);
74         }
75
76         /**
77          * Constructs a new PaymentRelay given each field
78          */
79         public static PaymentRelay of(short cltv_expiry_delta_arg, int fee_proportional_millionths_arg, int fee_base_msat_arg) {
80                 long ret = bindings.PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
81                 GC.KeepAlive(cltv_expiry_delta_arg);
82                 GC.KeepAlive(fee_proportional_millionths_arg);
83                 GC.KeepAlive(fee_base_msat_arg);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 org.ldk.structs.PaymentRelay ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentRelay(null, ret); }
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
87                 return ret_hu_conv;
88         }
89
90         internal long clone_ptr() {
91                 long ret = bindings.PaymentRelay_clone_ptr(this.ptr);
92                 GC.KeepAlive(this);
93                 return ret;
94         }
95
96         /**
97          * Creates a copy of the PaymentRelay
98          */
99         public PaymentRelay clone() {
100                 long ret = bindings.PaymentRelay_clone(this.ptr);
101                 GC.KeepAlive(this);
102                 if (ret >= 0 && ret <= 4096) { return null; }
103                 org.ldk.structs.PaymentRelay ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentRelay(null, ret); }
104                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105                 return ret_hu_conv;
106         }
107
108         /**
109          * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read
110          */
111         public byte[] write() {
112                 long ret = bindings.PaymentRelay_write(this.ptr);
113                 GC.KeepAlive(this);
114                 if (ret >= 0 && ret <= 4096) { return null; }
115                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
116                 return ret_conv;
117         }
118
119         /**
120          * Read a PaymentRelay from a byte array, created by PaymentRelay_write
121          */
122         public static Result_PaymentRelayDecodeErrorZ read(byte[] ser) {
123                 long ret = bindings.PaymentRelay_read(InternalUtils.encodeUint8Array(ser));
124                 GC.KeepAlive(ser);
125                 if (ret >= 0 && ret <= 4096) { return null; }
126                 Result_PaymentRelayDecodeErrorZ ret_hu_conv = Result_PaymentRelayDecodeErrorZ.constr_from_ptr(ret);
127                 return ret_hu_conv;
128         }
129
130 }
131 } } }