Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / InMemorySigner.swift
1 import LDKCHeaders
2
3 public class InMemorySigner {
4
5     public internal(set) var cOpaqueStruct: LDKInMemorySigner?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(funding_key: [UInt8], revocation_base_key: [UInt8], payment_key: [UInt8], delayed_payment_base_key: [UInt8], htlc_base_key: [UInt8], commitment_seed: [UInt8], channel_value_satoshis: UInt64, channel_keys_id: [UInt8]) {
9         
10         self.cOpaqueStruct = InMemorySigner_new(Bindings.new_LDKSecretKey(array: funding_key), Bindings.new_LDKSecretKey(array: revocation_base_key), Bindings.new_LDKSecretKey(array: payment_key), Bindings.new_LDKSecretKey(array: delayed_payment_base_key), Bindings.new_LDKSecretKey(array: htlc_base_key), Bindings.new_LDKThirtyTwoBytes(array: commitment_seed), channel_value_satoshis, Bindings.new_LDKThirtyTwoBytes(array: channel_keys_id))
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKInMemorySigner){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_funding_key() -> [UInt8] {
21         
22         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKInMemorySigner>) in
23 InMemorySigner_get_funding_key(this_ptrPointer)
24 }.pointee);
25     }
26
27     public func set_funding_key(val: [UInt8]) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKInMemorySigner>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return InMemorySigner_set_funding_key(this_ptrPointer, Bindings.new_LDKSecretKey(array: val));
33     }
34
35     public func get_revocation_base_key() -> [UInt8] {
36         
37         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKInMemorySigner>) in
38 InMemorySigner_get_revocation_base_key(this_ptrPointer)
39 }.pointee);
40     }
41
42     public func set_revocation_base_key(val: [UInt8]) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKInMemorySigner>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return InMemorySigner_set_revocation_base_key(this_ptrPointer, Bindings.new_LDKSecretKey(array: val));
48     }
49
50     public func get_payment_key() -> [UInt8] {
51         
52         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKInMemorySigner>) in
53 InMemorySigner_get_payment_key(this_ptrPointer)
54 }.pointee);
55     }
56
57     public func set_payment_key(val: [UInt8]) -> Void {
58         
59                                                         let this_ptrPointer = UnsafeMutablePointer<LDKInMemorySigner>.allocate(capacity: 1)
60                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
61                                                 
62         return InMemorySigner_set_payment_key(this_ptrPointer, Bindings.new_LDKSecretKey(array: val));
63     }
64
65     public func get_delayed_payment_base_key() -> [UInt8] {
66         
67         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKInMemorySigner>) in
68 InMemorySigner_get_delayed_payment_base_key(this_ptrPointer)
69 }.pointee);
70     }
71
72     public func set_delayed_payment_base_key(val: [UInt8]) -> Void {
73         
74                                                         let this_ptrPointer = UnsafeMutablePointer<LDKInMemorySigner>.allocate(capacity: 1)
75                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
76                                                 
77         return InMemorySigner_set_delayed_payment_base_key(this_ptrPointer, Bindings.new_LDKSecretKey(array: val));
78     }
79
80     public func get_htlc_base_key() -> [UInt8] {
81         
82         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKInMemorySigner>) in
83 InMemorySigner_get_htlc_base_key(this_ptrPointer)
84 }.pointee);
85     }
86
87     public func set_htlc_base_key(val: [UInt8]) -> Void {
88         
89                                                         let this_ptrPointer = UnsafeMutablePointer<LDKInMemorySigner>.allocate(capacity: 1)
90                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
91                                                 
92         return InMemorySigner_set_htlc_base_key(this_ptrPointer, Bindings.new_LDKSecretKey(array: val));
93     }
94
95     public func get_commitment_seed() -> [UInt8] {
96         
97         return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKInMemorySigner>) in
98 InMemorySigner_get_commitment_seed(this_ptrPointer)
99 }.pointee);
100     }
101
102     public func set_commitment_seed(val: [UInt8]) -> Void {
103         
104                                                         let this_ptrPointer = UnsafeMutablePointer<LDKInMemorySigner>.allocate(capacity: 1)
105                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
106                                                 
107         return InMemorySigner_set_commitment_seed(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
108     }
109
110     public func clone(orig: InMemorySigner) -> InMemorySigner {
111         
112         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKInMemorySigner>) in
113 InMemorySigner(pointer: InMemorySigner_clone(origPointer))
114 };
115     }
116
117     public func counterparty_pubkeys() -> ChannelPublicKeys {
118         
119         return ChannelPublicKeys(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
120 InMemorySigner_counterparty_pubkeys(this_argPointer)
121 });
122     }
123
124     public func counterparty_selected_contest_delay() -> UInt16 {
125         
126         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
127 InMemorySigner_counterparty_selected_contest_delay(this_argPointer)
128 };
129     }
130
131     public func holder_selected_contest_delay() -> UInt16 {
132         
133         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
134 InMemorySigner_holder_selected_contest_delay(this_argPointer)
135 };
136     }
137
138     public func is_outbound() -> Bool {
139         
140         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
141 InMemorySigner_is_outbound(this_argPointer)
142 };
143     }
144
145     public func funding_outpoint() -> OutPoint {
146         
147         return OutPoint(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
148 InMemorySigner_funding_outpoint(this_argPointer)
149 });
150     }
151
152     public func get_channel_parameters() -> ChannelTransactionParameters {
153         
154         return ChannelTransactionParameters(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
155 InMemorySigner_get_channel_parameters(this_argPointer)
156 });
157     }
158
159     public func sign_counterparty_payment_input(spend_tx: [UInt8], input_idx: UInt, descriptor: StaticPaymentOutputDescriptor) -> Result_CVec_CVec_u8ZZNoneZ {
160         
161         return Result_CVec_CVec_u8ZZNoneZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
162 withUnsafePointer(to: descriptor.cOpaqueStruct!) { (descriptorPointer: UnsafePointer<LDKStaticPaymentOutputDescriptor>) in
163 InMemorySigner_sign_counterparty_payment_input(this_argPointer, Bindings.new_LDKTransaction(array: spend_tx), input_idx, descriptorPointer)
164 }
165 });
166     }
167
168     public func sign_dynamic_p2wsh_input(spend_tx: [UInt8], input_idx: UInt, descriptor: DelayedPaymentOutputDescriptor) -> Result_CVec_CVec_u8ZZNoneZ {
169         
170         return Result_CVec_CVec_u8ZZNoneZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
171 withUnsafePointer(to: descriptor.cOpaqueStruct!) { (descriptorPointer: UnsafePointer<LDKDelayedPaymentOutputDescriptor>) in
172 InMemorySigner_sign_dynamic_p2wsh_input(this_argPointer, Bindings.new_LDKTransaction(array: spend_tx), input_idx, descriptorPointer)
173 }
174 });
175     }
176
177     public func as_BaseSign() -> BaseSign {
178         
179         return NativelyImplementedBaseSign(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
180 InMemorySigner_as_BaseSign(this_argPointer)
181 });
182     }
183
184     public func as_Sign() -> Sign {
185         
186         return NativelyImplementedSign(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInMemorySigner>) in
187 InMemorySigner_as_Sign(this_argPointer)
188 });
189     }
190
191     public func write(obj: InMemorySigner) -> [UInt8] {
192         
193         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKInMemorySigner>) in
194 InMemorySigner_write(objPointer)
195 });
196     }
197
198     public func read(ser: [UInt8]) -> Result_InMemorySignerDecodeErrorZ {
199         
200         return Result_InMemorySignerDecodeErrorZ(pointer: InMemorySigner_read(Bindings.new_LDKu8slice(array: ser)));
201     }
202
203                                 
204         deinit {
205                                         if self.cOpaqueStruct?.is_owned == false {
206
207                                         
208                                         
209                 InMemorySigner_free(self.cOpaqueStruct!)
210                                         
211 }
212                                 
213         }
214                         
215     /* STRUCT_METHODS_END */
216
217 }