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