1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * An update_fulfill_htlc message to be sent or received from a peer
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class UpdateFulfillHTLC extends CommonBase {
15 UpdateFulfillHTLC(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.UpdateFulfillHTLC_free(ptr); }
25 public byte[] get_channel_id() {
26 byte[] ret = bindings.UpdateFulfillHTLC_get_channel_id(this.ptr);
33 public void set_channel_id(byte[] val) {
34 bindings.UpdateFulfillHTLC_set_channel_id(this.ptr, val);
40 public long get_htlc_id() {
41 long ret = bindings.UpdateFulfillHTLC_get_htlc_id(this.ptr);
48 public void set_htlc_id(long val) {
49 bindings.UpdateFulfillHTLC_set_htlc_id(this.ptr, val);
53 * The pre-image of the payment hash, allowing HTLC redemption
55 public byte[] get_payment_preimage() {
56 byte[] ret = bindings.UpdateFulfillHTLC_get_payment_preimage(this.ptr);
61 * The pre-image of the payment hash, allowing HTLC redemption
63 public void set_payment_preimage(byte[] val) {
64 bindings.UpdateFulfillHTLC_set_payment_preimage(this.ptr, val);
68 * Constructs a new UpdateFulfillHTLC given each field
70 public static UpdateFulfillHTLC of(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg) {
71 long ret = bindings.UpdateFulfillHTLC_new(channel_id_arg, htlc_id_arg, payment_preimage_arg);
72 if (ret < 1024) { return null; }
73 UpdateFulfillHTLC ret_hu_conv = new UpdateFulfillHTLC(null, ret);
74 ret_hu_conv.ptrs_to.add(ret_hu_conv);
79 * Creates a copy of the UpdateFulfillHTLC
81 public UpdateFulfillHTLC clone() {
82 long ret = bindings.UpdateFulfillHTLC_clone(this.ptr);
83 if (ret < 1024) { return null; }
84 UpdateFulfillHTLC ret_hu_conv = new UpdateFulfillHTLC(null, ret);
85 ret_hu_conv.ptrs_to.add(this);
90 * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
92 public byte[] write() {
93 byte[] ret = bindings.UpdateFulfillHTLC_write(this.ptr);
98 * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
100 public static Result_UpdateFulfillHTLCDecodeErrorZ read(byte[] ser) {
101 long ret = bindings.UpdateFulfillHTLC_read(ser);
102 if (ret < 1024) { return null; }
103 Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret);