Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / traits / Confirm.swift
1 import LDKCHeaders
2 import LDKCHeaders
3 open class Confirm {
4
5     public var cOpaqueStruct: LDKConfirm?;
6
7     public init() {
8
9         /* NATIVE_CALLBACKS_START */
10
11                 func transactions_confirmedCallback(pointer: UnsafeRawPointer?, headerPointer: 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,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,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>?, txdata: LDKCVec_C2Tuple_usizeTransactionZZ, height: UInt32) -> Void {
12                         let instance: Confirm = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Confirm.swift::transactions_confirmed")
13                         
14                                                                 var header: [UInt8]? = nil
15                                                                 if let headerUnwrapped = headerPointer {
16                                                                         header = Bindings.tuple80_to_array(nativeType: headerUnwrapped.pointee)
17                                                                 }
18                                                         
19                         return instance.transactions_confirmed(header: header, txdata: Bindings.LDKCVec_C2Tuple_usizeTransactionZZ_to_array(nativeType: txdata), height: height);
20                 }
21
22                 func transaction_unconfirmedCallback(pointer: UnsafeRawPointer?, txidPointer: 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)>?) -> Void {
23                         let instance: Confirm = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Confirm.swift::transaction_unconfirmed")
24                         
25                                                                 var txid: [UInt8]? = nil
26                                                                 if let txidUnwrapped = txidPointer {
27                                                                         txid = Bindings.tuple32_to_array(nativeType: txidUnwrapped.pointee)
28                                                                 }
29                                                         
30                         return instance.transaction_unconfirmed(txid: txid);
31                 }
32
33                 func best_block_updatedCallback(pointer: UnsafeRawPointer?, headerPointer: 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,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,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>?, height: UInt32) -> Void {
34                         let instance: Confirm = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Confirm.swift::best_block_updated")
35                         
36                                                                 var header: [UInt8]? = nil
37                                                                 if let headerUnwrapped = headerPointer {
38                                                                         header = Bindings.tuple80_to_array(nativeType: headerUnwrapped.pointee)
39                                                                 }
40                                                         
41                         return instance.best_block_updated(header: header, height: height);
42                 }
43
44                 func get_relevant_txidsCallback(pointer: UnsafeRawPointer?) -> LDKCVec_TxidZ {
45                         let instance: Confirm = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Confirm.swift::get_relevant_txids")
46                         
47                         return Bindings.new_LDKCVec_TxidZ(array: instance.get_relevant_txids());
48                 }
49
50                 func freeCallback(pointer: UnsafeMutableRawPointer?) -> Void {
51                         let instance: Confirm = Bindings.pointerToInstance(pointer: pointer!, sourceMarker: "Confirm.swift::free")
52                         
53                         return instance.free();
54                 }
55
56                 /* NATIVE_CALLBACKS_END */
57
58         self.cOpaqueStruct = LDKConfirm(this_arg: Bindings.instanceToPointer(instance: self), 
59                         transactions_confirmed: transactions_confirmedCallback,
60                         transaction_unconfirmed: transaction_unconfirmedCallback,
61                         best_block_updated: best_block_updatedCallback,
62                         get_relevant_txids: get_relevant_txidsCallback,
63                         free: freeCallback)
64     }
65
66     public init(pointer: LDKConfirm){
67                 self.cOpaqueStruct = pointer
68         }
69
70     /* SWIFT_CALLBACKS_START */
71
72     open func transactions_confirmed(header: [UInt8]?, txdata: [LDKC2Tuple_usizeTransactionZ], height: UInt32) -> Void {
73         /* EDIT ME */
74                 
75     }
76
77     open func transaction_unconfirmed(txid: [UInt8]?) -> Void {
78         /* EDIT ME */
79                 
80     }
81
82     open func best_block_updated(header: [UInt8]?, height: UInt32) -> Void {
83         /* EDIT ME */
84                 
85     }
86
87     open func get_relevant_txids() -> [LDKTxid] {
88         /* EDIT ME */
89                 return [LDKTxid]()
90     }
91
92     open func free() -> Void {
93         /* EDIT ME */
94                 
95     }
96
97     /* SWIFT_CALLBACKS_END */
98
99 }
100
101
102 public class NativelyImplementedConfirm: Confirm {
103         /* SWIFT_DEFAULT_CALLBACKS_START */
104
105         public override func transactions_confirmed(header: [UInt8]?, txdata: [LDKC2Tuple_usizeTransactionZ], height: UInt32) -> Void {
106                 
107                                 withUnsafePointer(to: Bindings.array_to_tuple80(array: header!)) { (headerPointer: 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,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,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
108
109                                 self.cOpaqueStruct!.transactions_confirmed(self.cOpaqueStruct!.this_arg, headerPointer, Bindings.new_LDKCVec_C2Tuple_usizeTransactionZZ(array: txdata), height)
110                                 
111 }
112                         
113         }
114
115         public override func transaction_unconfirmed(txid: [UInt8]?) -> Void {
116                 
117                                 withUnsafePointer(to: Bindings.array_to_tuple32(array: txid!)) { (txidPointer: 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
118
119                                 self.cOpaqueStruct!.transaction_unconfirmed(self.cOpaqueStruct!.this_arg, txidPointer)
120                                 
121 }
122                         
123         }
124
125         public override func best_block_updated(header: [UInt8]?, height: UInt32) -> Void {
126                 
127                                 withUnsafePointer(to: Bindings.array_to_tuple80(array: header!)) { (headerPointer: 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,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,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
128
129                                 self.cOpaqueStruct!.best_block_updated(self.cOpaqueStruct!.this_arg, headerPointer, height)
130                                 
131 }
132                         
133         }
134
135         public override func get_relevant_txids() -> [LDKTxid] {
136                 
137                                 return 
138                                 Bindings.LDKCVec_TxidZ_to_array(nativeType: self.cOpaqueStruct!.get_relevant_txids(self.cOpaqueStruct!.this_arg))
139                                 
140                         
141         }
142
143         public override func free() -> Void {
144                 
145                                 
146                                 self.cOpaqueStruct!.free(self.cOpaqueStruct!.this_arg)
147                                 
148                         
149         }
150
151         /* SWIFT_DEFAULT_CALLBACKS_END */
152 }