Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / BestBlock.swift
1 import LDKCHeaders
2
3 public class BestBlock {
4
5     public internal(set) var cOpaqueStruct: LDKBestBlock?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init(block_hash: [UInt8], height: UInt32) {
9         
10         self.cOpaqueStruct = BestBlock_new(Bindings.new_LDKThirtyTwoBytes(array: block_hash), height)
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKBestBlock){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func clone(orig: BestBlock) -> BestBlock {
21         
22         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKBestBlock>) in
23 BestBlock(pointer: BestBlock_clone(origPointer))
24 };
25     }
26
27     public func block_hash() -> [UInt8] {
28         
29         return Bindings.LDKThirtyTwoBytes_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKBestBlock>) in
30 BestBlock_block_hash(this_argPointer)
31 });
32     }
33
34     public func height() -> UInt32 {
35         
36         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKBestBlock>) in
37 BestBlock_height(this_argPointer)
38 };
39     }
40
41                                 
42         deinit {
43                                         if self.cOpaqueStruct?.is_owned == false {
44
45                                         
46                                         
47                 BestBlock_free(self.cOpaqueStruct!)
48                                         
49 }
50                                 
51         }
52                         
53     /* STRUCT_METHODS_END */
54
55 }