6 namespace org { namespace ldk { namespace structs {
10 * The context of a payment made for an invoice sent for a BOLT 12 [`Refund`].
12 * [`Refund`]: crate::offers::refund::Refund
14 public class Bolt12RefundContext : CommonBase {
15 internal Bolt12RefundContext(object _dummy, long ptr) : base(ptr) { }
16 ~Bolt12RefundContext() {
17 if (ptr != 0) { bindings.Bolt12RefundContext_free(ptr); }
21 * Constructs a new Bolt12RefundContext given each field
23 public static Bolt12RefundContext of() {
24 long ret = bindings.Bolt12RefundContext_new();
25 if (ret >= 0 && ret <= 4096) { return null; }
26 org.ldk.structs.Bolt12RefundContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12RefundContext(null, ret); }
27 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
31 internal long clone_ptr() {
32 long ret = bindings.Bolt12RefundContext_clone_ptr(this.ptr);
38 * Creates a copy of the Bolt12RefundContext
40 public Bolt12RefundContext clone() {
41 long ret = bindings.Bolt12RefundContext_clone(this.ptr);
43 if (ret >= 0 && ret <= 4096) { return null; }
44 org.ldk.structs.Bolt12RefundContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12RefundContext(null, ret); }
45 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
50 * Checks if two Bolt12RefundContexts contain equal inner contents.
51 * This ignores pointers and is_owned flags and looks at the values in fields.
52 * Two objects with NULL inner values will be considered "equal" here.
54 public bool eq(org.ldk.structs.Bolt12RefundContext b) {
55 bool ret = bindings.Bolt12RefundContext_eq(this.ptr, b.ptr);
58 if (this != null) { this.ptrs_to.AddLast(b); };
62 public override bool Equals(object o) {
63 if (!(o is Bolt12RefundContext)) return false;
64 return this.eq((Bolt12RefundContext)o);
67 * Serialize the Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read
69 public byte[] write() {
70 long ret = bindings.Bolt12RefundContext_write(this.ptr);
72 if (ret >= 0 && ret <= 4096) { return null; }
73 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
78 * Read a Bolt12RefundContext from a byte array, created by Bolt12RefundContext_write
80 public static Result_Bolt12RefundContextDecodeErrorZ read(byte[] ser) {
81 long ret = bindings.Bolt12RefundContext_read(InternalUtils.encodeUint8Array(ser));
83 if (ret >= 0 && ret <= 4096) { return null; }
84 Result_Bolt12RefundContextDecodeErrorZ ret_hu_conv = Result_Bolt12RefundContextDecodeErrorZ.constr_from_ptr(ret);