Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / Shutdown.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 shutdown message to be sent or received from a peer
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class Shutdown extends CommonBase {
15         Shutdown(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.Shutdown_free(ptr); }
20         }
21
22         /**
23          * The channel ID
24          */
25         public byte[] get_channel_id() {
26                 byte[] ret = bindings.Shutdown_get_channel_id(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * The channel ID
32          */
33         public void set_channel_id(byte[] val) {
34                 bindings.Shutdown_set_channel_id(this.ptr, val);
35         }
36
37         /**
38          * The destination of this peer's funds on closing.
39          * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
40          */
41         public byte[] get_scriptpubkey() {
42                 byte[] ret = bindings.Shutdown_get_scriptpubkey(this.ptr);
43                 return ret;
44         }
45
46         /**
47          * The destination of this peer's funds on closing.
48          * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
49          */
50         public void set_scriptpubkey(byte[] val) {
51                 bindings.Shutdown_set_scriptpubkey(this.ptr, val);
52         }
53
54         /**
55          * Constructs a new Shutdown given each field
56          */
57         public static Shutdown of(byte[] channel_id_arg, byte[] scriptpubkey_arg) {
58                 long ret = bindings.Shutdown_new(channel_id_arg, scriptpubkey_arg);
59                 if (ret >= 0 && ret <= 4096) { return null; }
60                 Shutdown ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Shutdown(null, ret); }
61                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Creates a copy of the Shutdown
67          */
68         public Shutdown clone() {
69                 long ret = bindings.Shutdown_clone(this.ptr);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 Shutdown ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Shutdown(null, ret); }
72                 ret_hu_conv.ptrs_to.add(this);
73                 return ret_hu_conv;
74         }
75
76         /**
77          * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
78          */
79         public byte[] write() {
80                 byte[] ret = bindings.Shutdown_write(this.ptr);
81                 return ret;
82         }
83
84         /**
85          * Read a Shutdown from a byte array, created by Shutdown_write
86          */
87         public static Result_ShutdownDecodeErrorZ read(byte[] ser) {
88                 long ret = bindings.Shutdown_read(ser);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret);
91                 return ret_hu_conv;
92         }
93
94 }