Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / KeysManager.swift
1 import LDKCHeaders
2
3 public class KeysManager {
4
5     public internal(set) var cOpaqueStruct: LDKKeysManager?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(seed: [UInt8], starting_time_secs: UInt64, starting_time_nanos: UInt32) {
9         
10         self.cOpaqueStruct = withUnsafePointer(to: Bindings.array_to_tuple32(array: seed)) { (seedPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
11 KeysManager_new(seedPointer, starting_time_secs, starting_time_nanos)
12 }
13     }
14     /* DEFAULT_CONSTRUCTOR_END */
15
16     public init(pointer: LDKKeysManager){
17                 self.cOpaqueStruct = pointer
18         }
19
20     /* STRUCT_METHODS_START */
21
22     public func derive_channel_keys(channel_value_satoshis: UInt64, params: [UInt8]) -> InMemorySigner {
23         
24         return InMemorySigner(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKKeysManager>) in
25 withUnsafePointer(to: Bindings.array_to_tuple32(array: params)) { (paramsPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
26 KeysManager_derive_channel_keys(this_argPointer, channel_value_satoshis, paramsPointer)
27 }
28 });
29     }
30
31     public func spend_spendable_outputs(descriptors: [LDKSpendableOutputDescriptor], outputs: [LDKTxOut], change_destination_script: [UInt8], feerate_sat_per_1000_weight: UInt32) -> Result_TransactionNoneZ {
32         
33         return Result_TransactionNoneZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKKeysManager>) in
34 KeysManager_spend_spendable_outputs(this_argPointer, Bindings.new_LDKCVec_SpendableOutputDescriptorZ(array: descriptors), Bindings.new_LDKCVec_TxOutZ(array: outputs), Bindings.new_LDKCVec_u8Z(array: change_destination_script), feerate_sat_per_1000_weight)
35 });
36     }
37
38     public func as_KeysInterface() -> KeysInterface {
39         
40         return NativelyImplementedKeysInterface(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKKeysManager>) in
41 KeysManager_as_KeysInterface(this_argPointer)
42 });
43     }
44
45                                 
46         deinit {
47                                         if self.cOpaqueStruct?.is_owned == false {
48
49                                         
50                                         
51                 KeysManager_free(self.cOpaqueStruct!)
52                                         
53 }
54                                 
55         }
56                         
57     /* STRUCT_METHODS_END */
58
59 }