2
2
import LDKHeaders
3
3
#endif
4
4
5
- public class APIError : NativeTypeWrapper {
5
+ public typealias APIError = Bindings . APIError
6
6
7
- private static var instanceCounter : UInt = 0
8
- internal let instanceNumber : UInt
7
+ extension Bindings {
9
8
10
- internal var cOpaqueStruct : LDKAPIError ?
9
+ public class APIError : NativeTypeWrapper {
11
10
12
-
11
+ private static var instanceCounter : UInt = 0
12
+ internal let instanceNumber : UInt
13
13
14
- public init ( pointer: LDKAPIError ) {
15
- Self . instanceCounter += 1
16
- self . instanceNumber = Self . instanceCounter
17
- self . cOpaqueStruct = pointer
18
- super. init ( conflictAvoidingVariableName: 0 )
19
- }
14
+ internal var cOpaqueStruct : LDKAPIError ?
20
15
21
- public init ( pointer : LDKAPIError , anchor : NativeTypeWrapper ) {
22
- Self . instanceCounter += 1
23
- self . instanceNumber = Self . instanceCounter
24
- self . cOpaqueStruct = pointer
25
- super . init ( conflictAvoidingVariableName : 0 )
26
- self . dangling = true
27
- try ! self . addAnchor ( anchor : anchor )
28
- }
16
+
17
+
18
+ public init ( pointer : LDKAPIError ) {
19
+ Self . instanceCounter += 1
20
+ self . instanceNumber = Self . instanceCounter
21
+ self . cOpaqueStruct = pointer
22
+ super . init ( conflictAvoidingVariableName : 0 )
23
+ }
29
24
30
- /* OPTION_METHODS_START */
25
+ public init ( pointer: LDKAPIError , anchor: NativeTypeWrapper ) {
26
+ Self . instanceCounter += 1
27
+ self . instanceNumber = Self . instanceCounter
28
+ self . cOpaqueStruct = pointer
29
+ super. init ( conflictAvoidingVariableName: 0 )
30
+ self . dangling = true
31
+ try ! self . addAnchor ( anchor: anchor)
32
+ }
33
+
34
+ /* OPTION_METHODS_START */
31
35
32
36
public enum APIErrorValueType {
33
37
case APIMisuseError, FeeRateTooHigh, RouteError, ChannelUnavailable, IncompatibleShutdownScript
34
38
}
35
-
39
+
36
40
public func getValueType( ) -> APIErrorValueType ? {
37
41
switch self . cOpaqueStruct? . tag {
38
42
@@ -50,7 +54,7 @@ public class APIError: NativeTypeWrapper {
50
54
return nil
51
55
}
52
56
}
53
-
57
+
54
58
55
59
public func getValueAsAPIMisuseError( ) -> APIMisuseError ? {
56
60
if self . cOpaqueStruct? . tag != LDKAPIError_APIMisuseError {
@@ -88,16 +92,16 @@ public class APIError: NativeTypeWrapper {
88
92
}
89
93
90
94
91
- internal func free( ) -> Void {
92
-
93
- return APIError_free ( self . cOpaqueStruct!) ;
94
- }
95
+ internal func free( ) -> Void {
96
+
97
+ return APIError_free ( self . cOpaqueStruct!) ;
98
+ }
95
99
96
100
internal func dangle( ) -> APIError {
97
101
self . dangling = true
98
102
return self
99
103
}
100
-
104
+
101
105
deinit {
102
106
if !self . dangling {
103
107
Bindings . print ( " Freeing APIError \( self . instanceNumber) . " )
@@ -108,12 +112,12 @@ public class APIError: NativeTypeWrapper {
108
112
}
109
113
110
114
111
- public func clone( ) -> APIError {
112
-
113
- return APIError ( pointer: withUnsafePointer ( to: self . cOpaqueStruct!) { ( origPointer: UnsafePointer < LDKAPIError > ) in
115
+ public func clone( ) -> APIError {
116
+
117
+ return APIError ( pointer: withUnsafePointer ( to: self . cOpaqueStruct!) { ( origPointer: UnsafePointer < LDKAPIError > ) in
114
118
APIError_clone ( origPointer)
115
119
} ) ;
116
- }
120
+ }
117
121
118
122
internal func danglingClone( ) -> APIError {
119
123
let dangledClone = self . clone ( )
@@ -122,42 +126,42 @@ APIError_clone(origPointer)
122
126
}
123
127
124
128
125
- public class func apimisuse_error( err: String ) -> APIError {
126
-
127
- return APIError ( pointer: APIError_apimisuse_error ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) ) ) ;
128
- }
129
+ public class func apimisuse_error( err: String ) -> APIError {
130
+
131
+ return APIError ( pointer: APIError_apimisuse_error ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) ) ) ;
132
+ }
129
133
130
- public class func fee_rate_too_high( err: String , feerate: UInt32 ) -> APIError {
131
-
132
- return APIError ( pointer: APIError_fee_rate_too_high ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) , feerate) ) ;
133
- }
134
+ public class func fee_rate_too_high( err: String , feerate: UInt32 ) -> APIError {
135
+
136
+ return APIError ( pointer: APIError_fee_rate_too_high ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) , feerate) ) ;
137
+ }
134
138
135
- public class func route_error( err: String ) -> APIError {
136
-
137
- return APIError ( pointer: APIError_route_error ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) ) ) ;
138
- }
139
+ public class func route_error( err: String ) -> APIError {
140
+
141
+ return APIError ( pointer: APIError_route_error ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) ) ) ;
142
+ }
139
143
140
- public class func channel_unavailable( err: String ) -> APIError {
141
-
142
- return APIError ( pointer: APIError_channel_unavailable ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) ) ) ;
143
- }
144
+ public class func channel_unavailable( err: String ) -> APIError {
145
+
146
+ return APIError ( pointer: APIError_channel_unavailable ( Bindings . new_LDKStr ( string: err, chars_is_owned: true ) ) ) ;
147
+ }
144
148
145
- public class func monitor_update_failed( ) -> APIError {
146
-
147
- return APIError ( pointer: APIError_monitor_update_failed ( ) ) ;
148
- }
149
+ public class func monitor_update_failed( ) -> APIError {
150
+
151
+ return APIError ( pointer: APIError_monitor_update_failed ( ) ) ;
152
+ }
149
153
150
- public class func incompatible_shutdown_script( script: ShutdownScript ) -> APIError {
151
-
152
- return APIError ( pointer: APIError_incompatible_shutdown_script ( script. danglingClone ( ) . cOpaqueStruct!) ) ;
153
- }
154
+ public class func incompatible_shutdown_script( script: Bindings . ShutdownScript ) -> APIError {
155
+
156
+ return APIError ( pointer: APIError_incompatible_shutdown_script ( script. danglingClone ( ) . cOpaqueStruct!) ) ;
157
+ }
154
158
155
- /* OPTION_METHODS_END */
159
+ /* OPTION_METHODS_END */
156
160
157
-
161
+
158
162
159
163
public class APIMisuseError : NativeTypeWrapper {
160
-
164
+
161
165
162
166
var cOpaqueStruct : LDKAPIError_LDKAPIMisuseError_Body ? ;
163
167
fileprivate init ( pointer: LDKAPIError_LDKAPIMisuseError_Body ) {
@@ -171,18 +175,18 @@ APIError_clone(origPointer)
171
175
try ! self . addAnchor ( anchor: anchor)
172
176
}
173
177
174
-
178
+
175
179
176
180
public func getErr( ) -> String {
177
181
return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
178
182
}
179
183
180
-
184
+
181
185
}
182
186
183
187
184
188
public class FeeRateTooHigh : NativeTypeWrapper {
185
-
189
+
186
190
187
191
var cOpaqueStruct : LDKAPIError_LDKFeeRateTooHigh_Body ? ;
188
192
fileprivate init ( pointer: LDKAPIError_LDKFeeRateTooHigh_Body ) {
@@ -196,7 +200,7 @@ APIError_clone(origPointer)
196
200
try ! self . addAnchor ( anchor: anchor)
197
201
}
198
202
199
-
203
+
200
204
201
205
public func getErr( ) -> String {
202
206
return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
@@ -206,12 +210,12 @@ APIError_clone(origPointer)
206
210
return self . cOpaqueStruct!. feerate
207
211
}
208
212
209
-
213
+
210
214
}
211
215
212
216
213
217
public class RouteError : NativeTypeWrapper {
214
-
218
+
215
219
216
220
var cOpaqueStruct : LDKAPIError_LDKRouteError_Body ? ;
217
221
fileprivate init ( pointer: LDKAPIError_LDKRouteError_Body ) {
@@ -225,18 +229,18 @@ APIError_clone(origPointer)
225
229
try ! self . addAnchor ( anchor: anchor)
226
230
}
227
231
228
-
232
+
229
233
230
234
public func getErr( ) -> String {
231
235
return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
232
236
}
233
237
234
-
238
+
235
239
}
236
240
237
241
238
242
public class ChannelUnavailable : NativeTypeWrapper {
239
-
243
+
240
244
241
245
var cOpaqueStruct : LDKAPIError_LDKChannelUnavailable_Body ? ;
242
246
fileprivate init ( pointer: LDKAPIError_LDKChannelUnavailable_Body ) {
@@ -250,18 +254,18 @@ APIError_clone(origPointer)
250
254
try ! self . addAnchor ( anchor: anchor)
251
255
}
252
256
253
-
257
+
254
258
255
259
public func getErr( ) -> String {
256
260
return Bindings . LDKStr_to_string ( nativeType: self . cOpaqueStruct!. err)
257
261
}
258
262
259
-
263
+
260
264
}
261
265
262
266
263
267
public class IncompatibleShutdownScript : NativeTypeWrapper {
264
-
268
+
265
269
266
270
var cOpaqueStruct : LDKAPIError_LDKIncompatibleShutdownScript_Body ? ;
267
271
fileprivate init ( pointer: LDKAPIError_LDKIncompatibleShutdownScript_Body ) {
@@ -275,13 +279,15 @@ APIError_clone(origPointer)
275
279
try ! self . addAnchor ( anchor: anchor)
276
280
}
277
281
282
+
278
283
279
-
280
- public func getScript( ) -> ShutdownScript {
281
- return ShutdownScript ( pointer: self . cOpaqueStruct!. script, anchor: self )
284
+ public func getScript( ) -> Bindings . ShutdownScript {
285
+ return Bindings . ShutdownScript ( pointer: self . cOpaqueStruct!. script, anchor: self )
282
286
}
283
287
284
-
288
+
285
289
}
286
290
291
+ }
292
+
287
293
}
0 commit comments