Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / HolderCommitmentTransaction.swift
1 import LDKCHeaders
2
3 public class HolderCommitmentTransaction {
4
5     public internal(set) var cOpaqueStruct: LDKHolderCommitmentTransaction?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(commitment_tx: CommitmentTransaction, counterparty_sig: [UInt8], counterparty_htlc_sigs: [[UInt8]], holder_funding_key: [UInt8], counterparty_funding_key: [UInt8]) {
9         
10         self.cOpaqueStruct = HolderCommitmentTransaction_new(commitment_tx.cOpaqueStruct!, Bindings.new_LDKSignature(array: counterparty_sig), Bindings.new_LDKCVec_SignatureZ(array: counterparty_htlc_sigs), Bindings.new_LDKPublicKey(array: holder_funding_key), Bindings.new_LDKPublicKey(array: counterparty_funding_key))
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKHolderCommitmentTransaction){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_counterparty_sig() -> [UInt8] {
21         
22         return Bindings.LDKSignature_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHolderCommitmentTransaction>) in
23 HolderCommitmentTransaction_get_counterparty_sig(this_ptrPointer)
24 });
25     }
26
27     public func set_counterparty_sig(val: [UInt8]) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKHolderCommitmentTransaction>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return HolderCommitmentTransaction_set_counterparty_sig(this_ptrPointer, Bindings.new_LDKSignature(array: val));
33     }
34
35     public func set_counterparty_htlc_sigs(val: [[UInt8]]) -> Void {
36         
37                                                         let this_ptrPointer = UnsafeMutablePointer<LDKHolderCommitmentTransaction>.allocate(capacity: 1)
38                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
39                                                 
40         return HolderCommitmentTransaction_set_counterparty_htlc_sigs(this_ptrPointer, Bindings.new_LDKCVec_SignatureZ(array: val));
41     }
42
43     public func clone(orig: HolderCommitmentTransaction) -> HolderCommitmentTransaction {
44         
45         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKHolderCommitmentTransaction>) in
46 HolderCommitmentTransaction(pointer: HolderCommitmentTransaction_clone(origPointer))
47 };
48     }
49
50     public func write(obj: HolderCommitmentTransaction) -> [UInt8] {
51         
52         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKHolderCommitmentTransaction>) in
53 HolderCommitmentTransaction_write(objPointer)
54 });
55     }
56
57     public func read(ser: [UInt8]) -> Result_HolderCommitmentTransactionDecodeErrorZ {
58         
59         return Result_HolderCommitmentTransactionDecodeErrorZ(pointer: HolderCommitmentTransaction_read(Bindings.new_LDKu8slice(array: ser)));
60     }
61
62                                 
63         deinit {
64                                         if self.cOpaqueStruct?.is_owned == false {
65
66                                         
67                                         
68                 HolderCommitmentTransaction_free(self.cOpaqueStruct!)
69                                         
70 }
71                                 
72         }
73                         
74     /* STRUCT_METHODS_END */
75
76 }