[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / Bolt12RefundContext.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * The context of a payment made for an invoice sent for a BOLT 12 [`Refund`].
11  * 
12  * [`Refund`]: crate::offers::refund::Refund
13  */
14 public class Bolt12RefundContext : CommonBase {
15         internal Bolt12RefundContext(object _dummy, long ptr) : base(ptr) { }
16         ~Bolt12RefundContext() {
17                 if (ptr != 0) { bindings.Bolt12RefundContext_free(ptr); }
18         }
19
20         /**
21          * Constructs a new Bolt12RefundContext given each field
22          */
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); };
28                 return ret_hu_conv;
29         }
30
31         internal long clone_ptr() {
32                 long ret = bindings.Bolt12RefundContext_clone_ptr(this.ptr);
33                 GC.KeepAlive(this);
34                 return ret;
35         }
36
37         /**
38          * Creates a copy of the Bolt12RefundContext
39          */
40         public Bolt12RefundContext clone() {
41                 long ret = bindings.Bolt12RefundContext_clone(this.ptr);
42                 GC.KeepAlive(this);
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); };
46                 return ret_hu_conv;
47         }
48
49         /**
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.
53          */
54         public bool eq(org.ldk.structs.Bolt12RefundContext b) {
55                 bool ret = bindings.Bolt12RefundContext_eq(this.ptr, b.ptr);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(b);
58                 if (this != null) { this.ptrs_to.AddLast(b); };
59                 return ret;
60         }
61
62         public override bool Equals(object o) {
63                 if (!(o is Bolt12RefundContext)) return false;
64                 return this.eq((Bolt12RefundContext)o);
65         }
66         /**
67          * Serialize the Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read
68          */
69         public byte[] write() {
70                 long ret = bindings.Bolt12RefundContext_write(this.ptr);
71                 GC.KeepAlive(this);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
74                 return ret_conv;
75         }
76
77         /**
78          * Read a Bolt12RefundContext from a byte array, created by Bolt12RefundContext_write
79          */
80         public static Result_Bolt12RefundContextDecodeErrorZ read(byte[] ser) {
81                 long ret = bindings.Bolt12RefundContext_read(InternalUtils.encodeUint8Array(ser));
82                 GC.KeepAlive(ser);
83                 if (ret >= 0 && ret <= 4096) { return null; }
84                 Result_Bolt12RefundContextDecodeErrorZ ret_hu_conv = Result_Bolt12RefundContextDecodeErrorZ.constr_from_ptr(ret);
85                 return ret_hu_conv;
86         }
87
88 }
89 } } }