Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / HTLCOutputInCommitment.swift
1 import LDKCHeaders
2
3 public class HTLCOutputInCommitment {
4
5     public internal(set) var cOpaqueStruct: LDKHTLCOutputInCommitment?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(offered_arg: Bool, amount_msat_arg: UInt64, cltv_expiry_arg: UInt32, payment_hash_arg: [UInt8], transaction_output_index_arg: Option_u32Z) {
9         
10         self.cOpaqueStruct = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, Bindings.new_LDKThirtyTwoBytes(array: payment_hash_arg), transaction_output_index_arg.cOpaqueStruct!)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKHTLCOutputInCommitment){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_offered() -> Bool {
21         
22         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
23 HTLCOutputInCommitment_get_offered(this_ptrPointer)
24 };
25     }
26
27     public func set_offered(val: Bool) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return HTLCOutputInCommitment_set_offered(this_ptrPointer, val);
33     }
34
35     public func get_amount_msat() -> UInt64 {
36         
37         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
38 HTLCOutputInCommitment_get_amount_msat(this_ptrPointer)
39 };
40     }
41
42     public func set_amount_msat(val: UInt64) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return HTLCOutputInCommitment_set_amount_msat(this_ptrPointer, val);
48     }
49
50     public func get_cltv_expiry() -> UInt32 {
51         
52         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
53 HTLCOutputInCommitment_get_cltv_expiry(this_ptrPointer)
54 };
55     }
56
57     public func set_cltv_expiry(val: UInt32) -> Void {
58         
59                                                         let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
60                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
61                                                 
62         return HTLCOutputInCommitment_set_cltv_expiry(this_ptrPointer, val);
63     }
64
65     public func get_payment_hash() -> [UInt8] {
66         
67         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
68 HTLCOutputInCommitment_get_payment_hash(this_ptrPointer)
69 }.pointee);
70     }
71
72     public func set_payment_hash(val: [UInt8]) -> Void {
73         
74                                                         let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
75                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
76                                                 
77         return HTLCOutputInCommitment_set_payment_hash(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
78     }
79
80     public func get_transaction_output_index() -> Option_u32Z {
81         
82         return Option_u32Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
83 HTLCOutputInCommitment_get_transaction_output_index(this_ptrPointer)
84 });
85     }
86
87     public func set_transaction_output_index(val: Option_u32Z) -> Void {
88         
89                                                         let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
90                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
91                                                 
92         return HTLCOutputInCommitment_set_transaction_output_index(this_ptrPointer, val.cOpaqueStruct!);
93     }
94
95     public func clone(orig: HTLCOutputInCommitment) -> HTLCOutputInCommitment {
96         
97         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
98 HTLCOutputInCommitment(pointer: HTLCOutputInCommitment_clone(origPointer))
99 };
100     }
101
102     public func write(obj: HTLCOutputInCommitment) -> [UInt8] {
103         
104         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
105 HTLCOutputInCommitment_write(objPointer)
106 });
107     }
108
109     public func read(ser: [UInt8]) -> Result_HTLCOutputInCommitmentDecodeErrorZ {
110         
111         return Result_HTLCOutputInCommitmentDecodeErrorZ(pointer: HTLCOutputInCommitment_read(Bindings.new_LDKu8slice(array: ser)));
112     }
113
114                                 
115         deinit {
116                                         if self.cOpaqueStruct?.is_owned == false {
117
118                                         
119                                         
120                 HTLCOutputInCommitment_free(self.cOpaqueStruct!)
121                                         
122 }
123                                 
124         }
125                         
126     /* STRUCT_METHODS_END */
127
128 }