Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / QueryChannelRange.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 javax.annotation.Nullable;
8
9
10 /**
11  * A query_channel_range message is used to query a peer for channel
12  * UTXOs in a range of blocks. The recipient of a query makes a best
13  * effort to reply to the query using one or more reply_channel_range
14  * messages.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class QueryChannelRange extends CommonBase {
18         QueryChannelRange(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.QueryChannelRange_free(ptr); }
23         }
24
25         /**
26          * The genesis hash of the blockchain being queried
27          */
28         public byte[] get_chain_hash() {
29                 byte[] ret = bindings.QueryChannelRange_get_chain_hash(this.ptr);
30                 return ret;
31         }
32
33         /**
34          * The genesis hash of the blockchain being queried
35          */
36         public void set_chain_hash(byte[] val) {
37                 bindings.QueryChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
38         }
39
40         /**
41          * The height of the first block for the channel UTXOs being queried
42          */
43         public int get_first_blocknum() {
44                 int ret = bindings.QueryChannelRange_get_first_blocknum(this.ptr);
45                 return ret;
46         }
47
48         /**
49          * The height of the first block for the channel UTXOs being queried
50          */
51         public void set_first_blocknum(int val) {
52                 bindings.QueryChannelRange_set_first_blocknum(this.ptr, val);
53         }
54
55         /**
56          * The number of blocks to include in the query results
57          */
58         public int get_number_of_blocks() {
59                 int ret = bindings.QueryChannelRange_get_number_of_blocks(this.ptr);
60                 return ret;
61         }
62
63         /**
64          * The number of blocks to include in the query results
65          */
66         public void set_number_of_blocks(int val) {
67                 bindings.QueryChannelRange_set_number_of_blocks(this.ptr, val);
68         }
69
70         /**
71          * Constructs a new QueryChannelRange given each field
72          */
73         public static QueryChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg) {
74                 long ret = bindings.QueryChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg);
75                 if (ret >= 0 && ret <= 4096) { return null; }
76                 QueryChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryChannelRange(null, ret); }
77                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
78                 return ret_hu_conv;
79         }
80
81         long clone_ptr() {
82                 long ret = bindings.QueryChannelRange_clone_ptr(this.ptr);
83                 return ret;
84         }
85
86         /**
87          * Creates a copy of the QueryChannelRange
88          */
89         public QueryChannelRange clone() {
90                 long ret = bindings.QueryChannelRange_clone(this.ptr);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 QueryChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryChannelRange(null, ret); }
93                 ret_hu_conv.ptrs_to.add(this);
94                 return ret_hu_conv;
95         }
96
97         /**
98          * \n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t
99          */
100         public int end_blocknum() {
101                 int ret = bindings.QueryChannelRange_end_blocknum(this.ptr);
102                 return ret;
103         }
104
105         /**
106          * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
107          */
108         public byte[] write() {
109                 byte[] ret = bindings.QueryChannelRange_write(this.ptr);
110                 return ret;
111         }
112
113         /**
114          * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
115          */
116         public static Result_QueryChannelRangeDecodeErrorZ read(byte[] ser) {
117                 long ret = bindings.QueryChannelRange_read(ser);
118                 if (ret >= 0 && ret <= 4096) { return null; }
119                 Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret);
120                 return ret_hu_conv;
121         }
122
123 }