5f6ed3f5e0248d785ba2fb5de935515a44bc487d
[ldk-java] / src / main / java / org / ldk / structs / ClosingSignedFeeRange.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
13  * 
14  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
15  * to use.
16  */
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class ClosingSignedFeeRange extends CommonBase {
19         ClosingSignedFeeRange(Object _dummy, long ptr) { super(ptr); }
20         @Override @SuppressWarnings("deprecation")
21         protected void finalize() throws Throwable {
22                 super.finalize();
23                 if (ptr != 0) { bindings.ClosingSignedFeeRange_free(ptr); }
24         }
25
26         /**
27          * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
28          * transaction.
29          */
30         public long get_min_fee_satoshis() {
31                 long ret = bindings.ClosingSignedFeeRange_get_min_fee_satoshis(this.ptr);
32                 Reference.reachabilityFence(this);
33                 return ret;
34         }
35
36         /**
37          * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
38          * transaction.
39          */
40         public void set_min_fee_satoshis(long val) {
41                 bindings.ClosingSignedFeeRange_set_min_fee_satoshis(this.ptr, val);
42                 Reference.reachabilityFence(this);
43                 Reference.reachabilityFence(val);
44         }
45
46         /**
47          * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
48          * transaction.
49          */
50         public long get_max_fee_satoshis() {
51                 long ret = bindings.ClosingSignedFeeRange_get_max_fee_satoshis(this.ptr);
52                 Reference.reachabilityFence(this);
53                 return ret;
54         }
55
56         /**
57          * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
58          * transaction.
59          */
60         public void set_max_fee_satoshis(long val) {
61                 bindings.ClosingSignedFeeRange_set_max_fee_satoshis(this.ptr, val);
62                 Reference.reachabilityFence(this);
63                 Reference.reachabilityFence(val);
64         }
65
66         /**
67          * Constructs a new ClosingSignedFeeRange given each field
68          */
69         public static ClosingSignedFeeRange of(long min_fee_satoshis_arg, long max_fee_satoshis_arg) {
70                 long ret = bindings.ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
71                 Reference.reachabilityFence(min_fee_satoshis_arg);
72                 Reference.reachabilityFence(max_fee_satoshis_arg);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 org.ldk.structs.ClosingSignedFeeRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSignedFeeRange(null, ret); }
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
76                 return ret_hu_conv;
77         }
78
79         long clone_ptr() {
80                 long ret = bindings.ClosingSignedFeeRange_clone_ptr(this.ptr);
81                 Reference.reachabilityFence(this);
82                 return ret;
83         }
84
85         /**
86          * Creates a copy of the ClosingSignedFeeRange
87          */
88         public ClosingSignedFeeRange clone() {
89                 long ret = bindings.ClosingSignedFeeRange_clone(this.ptr);
90                 Reference.reachabilityFence(this);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.ClosingSignedFeeRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSignedFeeRange(null, ret); }
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
94                 return ret_hu_conv;
95         }
96
97         /**
98          * Checks if two ClosingSignedFeeRanges contain equal inner contents.
99          * This ignores pointers and is_owned flags and looks at the values in fields.
100          * Two objects with NULL inner values will be considered "equal" here.
101          */
102         public boolean eq(org.ldk.structs.ClosingSignedFeeRange b) {
103                 boolean ret = bindings.ClosingSignedFeeRange_eq(this.ptr, b == null ? 0 : b.ptr);
104                 Reference.reachabilityFence(this);
105                 Reference.reachabilityFence(b);
106                 if (this != null) { this.ptrs_to.add(b); };
107                 return ret;
108         }
109
110         @Override public boolean equals(Object o) {
111                 if (!(o instanceof ClosingSignedFeeRange)) return false;
112                 return this.eq((ClosingSignedFeeRange)o);
113         }
114         /**
115          * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
116          */
117         public byte[] write() {
118                 byte[] ret = bindings.ClosingSignedFeeRange_write(this.ptr);
119                 Reference.reachabilityFence(this);
120                 return ret;
121         }
122
123         /**
124          * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
125          */
126         public static Result_ClosingSignedFeeRangeDecodeErrorZ read(byte[] ser) {
127                 long ret = bindings.ClosingSignedFeeRange_read(ser);
128                 Reference.reachabilityFence(ser);
129                 if (ret >= 0 && ret <= 4096) { return null; }
130                 Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
131                 return ret_hu_conv;
132         }
133
134 }