Initial checkin
[ldk-swift-linux] / LDKSwift / Sources / LDKSwift / structs / ChannelConfig.swift
1 import LDKCHeaders
2
3 public class ChannelConfig {
4
5     public internal(set) var cOpaqueStruct: LDKChannelConfig?;
6
7         /* DEFAULT_CONSTRUCTOR_START */
8     public init() {
9         
10         self.cOpaqueStruct = ChannelConfig_default()
11     }
12     /* DEFAULT_CONSTRUCTOR_END */
13
14     public init(pointer: LDKChannelConfig){
15                 self.cOpaqueStruct = pointer
16         }
17
18     /* STRUCT_METHODS_START */
19
20     public func get_forwarding_fee_proportional_millionths() -> UInt32 {
21         
22         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
23 ChannelConfig_get_forwarding_fee_proportional_millionths(this_ptrPointer)
24 };
25     }
26
27     public func set_forwarding_fee_proportional_millionths(val: UInt32) -> Void {
28         
29                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelConfig>.allocate(capacity: 1)
30                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
31                                                 
32         return ChannelConfig_set_forwarding_fee_proportional_millionths(this_ptrPointer, val);
33     }
34
35     public func get_forwarding_fee_base_msat() -> UInt32 {
36         
37         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
38 ChannelConfig_get_forwarding_fee_base_msat(this_ptrPointer)
39 };
40     }
41
42     public func set_forwarding_fee_base_msat(val: UInt32) -> Void {
43         
44                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelConfig>.allocate(capacity: 1)
45                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
46                                                 
47         return ChannelConfig_set_forwarding_fee_base_msat(this_ptrPointer, val);
48     }
49
50     public func get_cltv_expiry_delta() -> UInt16 {
51         
52         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
53 ChannelConfig_get_cltv_expiry_delta(this_ptrPointer)
54 };
55     }
56
57     public func set_cltv_expiry_delta(val: UInt16) -> Void {
58         
59                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelConfig>.allocate(capacity: 1)
60                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
61                                                 
62         return ChannelConfig_set_cltv_expiry_delta(this_ptrPointer, val);
63     }
64
65     public func get_announced_channel() -> Bool {
66         
67         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
68 ChannelConfig_get_announced_channel(this_ptrPointer)
69 };
70     }
71
72     public func set_announced_channel(val: Bool) -> Void {
73         
74                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelConfig>.allocate(capacity: 1)
75                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
76                                                 
77         return ChannelConfig_set_announced_channel(this_ptrPointer, val);
78     }
79
80     public func get_commit_upfront_shutdown_pubkey() -> Bool {
81         
82         return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
83 ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptrPointer)
84 };
85     }
86
87     public func set_commit_upfront_shutdown_pubkey(val: Bool) -> Void {
88         
89                                                         let this_ptrPointer = UnsafeMutablePointer<LDKChannelConfig>.allocate(capacity: 1)
90                                                         this_ptrPointer.initialize(to: self.cOpaqueStruct!)
91                                                 
92         return ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptrPointer, val);
93     }
94
95     public func clone(orig: ChannelConfig) -> ChannelConfig {
96         
97         return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKChannelConfig>) in
98 ChannelConfig(pointer: ChannelConfig_clone(origPointer))
99 };
100     }
101
102     public func write(obj: ChannelConfig) -> [UInt8] {
103         
104         return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKChannelConfig>) in
105 ChannelConfig_write(objPointer)
106 });
107     }
108
109     public func read(ser: [UInt8]) -> Result_ChannelConfigDecodeErrorZ {
110         
111         return Result_ChannelConfigDecodeErrorZ(pointer: ChannelConfig_read(Bindings.new_LDKu8slice(array: ser)));
112     }
113
114                                 
115         deinit {
116                                         if self.cOpaqueStruct?.is_owned == false {
117
118                                         
119                                         
120                 ChannelConfig_free(self.cOpaqueStruct!)
121                                         
122 }
123                                 
124         }
125                         
126     /* STRUCT_METHODS_END */
127
128 }