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