Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / CommitmentSigned.swift
1 import LDKCHeaders
2
3 public class CommitmentSigned {
4
5     public internal(set) var cOpaqueStruct: LDKCommitmentSigned?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(channel_id_arg: [UInt8], signature_arg: [UInt8], htlc_signatures_arg: [[UInt8]]) {
9         
10         self.cOpaqueStruct = CommitmentSigned_new(Bindings.new_LDKThirtyTwoBytes(array: channel_id_arg), Bindings.new_LDKSignature(array: signature_arg), Bindings.new_LDKCVec_SignatureZ(array: htlc_signatures_arg))
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKCommitmentSigned){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_channel_id() -> [UInt8] {
21         
22         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentSigned>) in
23 CommitmentSigned_get_channel_id(this_ptrPointer)
24 }.pointee);
25     }
26
27     public func set_channel_id(val: [UInt8]) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentSigned>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return CommitmentSigned_set_channel_id(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
33     }
34
35     public func get_signature() -> [UInt8] {
36         
37         return Bindings.LDKSignature_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentSigned>) in
38 CommitmentSigned_get_signature(this_ptrPointer)
39 });
40     }
41
42     public func set_signature(val: [UInt8]) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentSigned>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return CommitmentSigned_set_signature(this_ptrPointer, Bindings.new_LDKSignature(array: val));
48     }
49
50     public func set_htlc_signatures(val: [[UInt8]]) -> Void {
51         
52                                                         let this_ptrPointer = UnsafeMutablePointer<LDKCommitmentSigned>.allocate(capacity: 1)
53                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
54                                                 
55         return CommitmentSigned_set_htlc_signatures(this_ptrPointer, Bindings.new_LDKCVec_SignatureZ(array: val));
56     }
57
58     public func clone(orig: CommitmentSigned) -> CommitmentSigned {
59         
60         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKCommitmentSigned>) in
61 CommitmentSigned(pointer: CommitmentSigned_clone(origPointer))
62 };
63     }
64
65     public func write(obj: CommitmentSigned) -> [UInt8] {
66         
67         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKCommitmentSigned>) in
68 CommitmentSigned_write(objPointer)
69 });
70     }
71
72     public func read(ser: [UInt8]) -> Result_CommitmentSignedDecodeErrorZ {
73         
74         return Result_CommitmentSignedDecodeErrorZ(pointer: CommitmentSigned_read(Bindings.new_LDKu8slice(array: ser)));
75     }
76
77                                 
78         deinit {
79                                         if self.cOpaqueStruct?.is_owned == false {
80
81                                         
82                                         
83                 CommitmentSigned_free(self.cOpaqueStruct!)
84                                         
85 }
86                                 
87         }
88                         
89     /* STRUCT_METHODS_END */
90
91 }