Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / CommitmentUpdate.swift
1 import LDKCHeaders
2
3 public class CommitmentUpdate {
4
5     public internal(set) var cOpaqueStruct: LDKCommitmentUpdate?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(update_add_htlcs_arg: [LDKUpdateAddHTLC], update_fulfill_htlcs_arg: [LDKUpdateFulfillHTLC], update_fail_htlcs_arg: [LDKUpdateFailHTLC], update_fail_malformed_htlcs_arg: [LDKUpdateFailMalformedHTLC], update_fee_arg: UpdateFee, commitment_signed_arg: CommitmentSigned) {
9         
10         self.cOpaqueStruct = CommitmentUpdate_new(Bindings.new_LDKCVec_UpdateAddHTLCZ(array: update_add_htlcs_arg), Bindings.new_LDKCVec_UpdateFulfillHTLCZ(array: update_fulfill_htlcs_arg), Bindings.new_LDKCVec_UpdateFailHTLCZ(array: update_fail_htlcs_arg), Bindings.new_LDKCVec_UpdateFailMalformedHTLCZ(array: update_fail_malformed_htlcs_arg), update_fee_arg.cOpaqueStruct!, commitment_signed_arg.cOpaqueStruct!)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKCommitmentUpdate){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func set_update_add_htlcs(val: [LDKUpdateAddHTLC]) -> Void {
21         
22                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentUpdate>.allocate(capacity: 1)
23                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
24                                                 
25         return CommitmentUpdate_set_update_add_htlcs(this_ptrPointer, Bindings.new_LDKCVec_UpdateAddHTLCZ(array: val));
26     }
27
28     public func set_update_fulfill_htlcs(val: [LDKUpdateFulfillHTLC]) -> Void {
29         
30                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentUpdate>.allocate(capacity: 1)
31                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
32                                                 
33         return CommitmentUpdate_set_update_fulfill_htlcs(this_ptrPointer, Bindings.new_LDKCVec_UpdateFulfillHTLCZ(array: val));
34     }
35
36     public func set_update_fail_htlcs(val: [LDKUpdateFailHTLC]) -> Void {
37         
38                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentUpdate>.allocate(capacity: 1)
39                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
40                                                 
41         return CommitmentUpdate_set_update_fail_htlcs(this_ptrPointer, Bindings.new_LDKCVec_UpdateFailHTLCZ(array: val));
42     }
43
44     public func set_update_fail_malformed_htlcs(val: [LDKUpdateFailMalformedHTLC]) -> Void {
45         
46                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentUpdate>.allocate(capacity: 1)
47                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
48                                                 
49         return CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptrPointer, Bindings.new_LDKCVec_UpdateFailMalformedHTLCZ(array: val));
50     }
51
52     public func get_update_fee() -> UpdateFee {
53         
54         return UpdateFee(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
55 CommitmentUpdate_get_update_fee(this_ptrPointer)
56 });
57     }
58
59     public func set_update_fee(val: UpdateFee) -> Void {
60         
61                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentUpdate>.allocate(capacity: 1)
62                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
63                                                 
64         return CommitmentUpdate_set_update_fee(this_ptrPointer, val.cOpaqueStruct!);
65     }
66
67     public func get_commitment_signed() -> CommitmentSigned {
68         
69         return CommitmentSigned(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
70 CommitmentUpdate_get_commitment_signed(this_ptrPointer)
71 });
72     }
73
74     public func set_commitment_signed(val: CommitmentSigned) -> Void {
75         
76                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentUpdate>.allocate(capacity: 1)
77                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
78                                                 
79         return CommitmentUpdate_set_commitment_signed(this_ptrPointer, val.cOpaqueStruct!);
80     }
81
82     public func clone(orig: CommitmentUpdate) -> CommitmentUpdate {
83         
84         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKCommitmentUpdate>) in
85 CommitmentUpdate(pointer: CommitmentUpdate_clone(origPointer))
86 };
87     }
88
89                                 
90         deinit {
91                                         if self.cOpaqueStruct?.is_owned == false {
92
93                                         
94                                         
95                 CommitmentUpdate_free(self.cOpaqueStruct!)
96                                         
97 }
98                                 
99         }
100                         
101     /* STRUCT_METHODS_END */
102
103 }