Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / ChannelTransactionParameters.swift
1 import LDKCHeaders
2
3 public class ChannelTransactionParameters {
4
5     public internal(set) var cOpaqueStruct: LDKChannelTransactionParameters?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(holder_pubkeys_arg: ChannelPublicKeys, holder_selected_contest_delay_arg: UInt16, is_outbound_from_holder_arg: Bool, counterparty_parameters_arg: CounterpartyChannelTransactionParameters, funding_outpoint_arg: OutPoint) {
9         
10         self.cOpaqueStruct = ChannelTransactionParameters_new(holder_pubkeys_arg.cOpaqueStruct!, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg.cOpaqueStruct!, funding_outpoint_arg.cOpaqueStruct!)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKChannelTransactionParameters){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_holder_pubkeys() -> ChannelPublicKeys {
21         
22         return ChannelPublicKeys(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelTransactionParameters>) in
23 ChannelTransactionParameters_get_holder_pubkeys(this_ptrPointer)
24 });
25     }
26
27     public func set_holder_pubkeys(val: ChannelPublicKeys) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelTransactionParameters>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return ChannelTransactionParameters_set_holder_pubkeys(this_ptrPointer, val.cOpaqueStruct!);
33     }
34
35     public func get_holder_selected_contest_delay() -> UInt16 {
36         
37         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelTransactionParameters>) in
38 ChannelTransactionParameters_get_holder_selected_contest_delay(this_ptrPointer)
39 };
40     }
41
42     public func set_holder_selected_contest_delay(val: UInt16) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelTransactionParameters>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return ChannelTransactionParameters_set_holder_selected_contest_delay(this_ptrPointer, val);
48     }
49
50     public func get_is_outbound_from_holder() -> Bool {
51         
52         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelTransactionParameters>) in
53 ChannelTransactionParameters_get_is_outbound_from_holder(this_ptrPointer)
54 };
55     }
56
57     public func set_is_outbound_from_holder(val: Bool) -> Void {
58         
59                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelTransactionParameters>.allocate(capacity: 1)
60                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
61                                                 
62         return ChannelTransactionParameters_set_is_outbound_from_holder(this_ptrPointer, val);
63     }
64
65     public func get_counterparty_parameters() -> CounterpartyChannelTransactionParameters {
66         
67         return CounterpartyChannelTransactionParameters(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelTransactionParameters>) in
68 ChannelTransactionParameters_get_counterparty_parameters(this_ptrPointer)
69 });
70     }
71
72     public func set_counterparty_parameters(val: CounterpartyChannelTransactionParameters) -> Void {
73         
74                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelTransactionParameters>.allocate(capacity: 1)
75                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
76                                                 
77         return ChannelTransactionParameters_set_counterparty_parameters(this_ptrPointer, val.cOpaqueStruct!);
78     }
79
80     public func get_funding_outpoint() -> OutPoint {
81         
82         return OutPoint(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelTransactionParameters>) in
83 ChannelTransactionParameters_get_funding_outpoint(this_ptrPointer)
84 });
85     }
86
87     public func set_funding_outpoint(val: OutPoint) -> Void {
88         
89                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelTransactionParameters>.allocate(capacity: 1)
90                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
91                                                 
92         return ChannelTransactionParameters_set_funding_outpoint(this_ptrPointer, val.cOpaqueStruct!);
93     }
94
95     public func clone(orig: ChannelTransactionParameters) -> ChannelTransactionParameters {
96         
97         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKChannelTransactionParameters>) in
98 ChannelTransactionParameters(pointer: ChannelTransactionParameters_clone(origPointer))
99 };
100     }
101
102     public func is_populated() -> Bool {
103         
104         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelTransactionParameters>) in
105 ChannelTransactionParameters_is_populated(this_argPointer)
106 };
107     }
108
109     public func as_holder_broadcastable() -> DirectedChannelTransactionParameters {
110         
111         return DirectedChannelTransactionParameters(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelTransactionParameters>) in
112 ChannelTransactionParameters_as_holder_broadcastable(this_argPointer)
113 });
114     }
115
116     public func as_counterparty_broadcastable() -> DirectedChannelTransactionParameters {
117         
118         return DirectedChannelTransactionParameters(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelTransactionParameters>) in
119 ChannelTransactionParameters_as_counterparty_broadcastable(this_argPointer)
120 });
121     }
122
123     public func write(obj: ChannelTransactionParameters) -> [UInt8] {
124         
125         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKChannelTransactionParameters>) in
126 ChannelTransactionParameters_write(objPointer)
127 });
128     }
129
130     public func read(ser: [UInt8]) -> Result_ChannelTransactionParametersDecodeErrorZ {
131         
132         return Result_ChannelTransactionParametersDecodeErrorZ(pointer: ChannelTransactionParameters_read(Bindings.new_LDKu8slice(array: ser)));
133     }
134
135                                 
136         deinit {
137                                         if self.cOpaqueStruct?.is_owned == false {
138
139                                         
140                                         
141                 ChannelTransactionParameters_free(self.cOpaqueStruct!)
142                                         
143 }
144                                 
145         }
146                         
147     /* STRUCT_METHODS_END */
148
149 }