Skip to content

Commit 9846008

Browse files
committed
fix trait default value returns in non-abstract classes
1 parent 7fcc5f0 commit 9846008

35 files changed

+768
-509
lines changed

bindings/LDK/Bindings.swift

Lines changed: 317 additions & 295 deletions
Large diffs are not rendered by default.

bindings/LDK/structs/DelayedPaymentOutputDescriptor.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ class DelayedPaymentOutputDescriptor {
33
var cOpaqueStruct: LDKDelayedPaymentOutputDescriptor?;
44

55
/* DEFAULT_CONSTRUCTOR_START */
6-
init(outpoint_arg: OutPoint, per_commitment_point_arg: [UInt8], to_self_delay_arg: UInt16, output_arg: TxOut, revocation_pubkey_arg: [UInt8], channel_keys_id_arg: [UInt8], channel_value_satoshis_arg: UInt64) {
6+
init(outpoint_arg: OutPoint, per_commitment_point_arg: [UInt8], to_self_delay_arg: UInt16, output_arg: LDKTxOut, revocation_pubkey_arg: [UInt8], channel_keys_id_arg: [UInt8], channel_value_satoshis_arg: UInt64) {
77

88
let converted_per_commitment_point_arg = Bindings.new_LDKPublicKey(array: per_commitment_point_arg)
99
let converted_revocation_pubkey_arg = Bindings.new_LDKPublicKey(array: revocation_pubkey_arg)
1010
let converted_channel_keys_id_arg = Bindings.new_LDKThirtyTwoBytes(array: channel_keys_id_arg)
11-
self.cOpaqueStruct = DelayedPaymentOutputDescriptor_new(outpoint_arg.cOpaqueStruct!, converted_per_commitment_point_arg, to_self_delay_arg, output_arg.cOpaqueStruct!, converted_revocation_pubkey_arg, converted_channel_keys_id_arg, channel_value_satoshis_arg)
11+
self.cOpaqueStruct = DelayedPaymentOutputDescriptor_new(outpoint_arg.cOpaqueStruct!, converted_per_commitment_point_arg, to_self_delay_arg, output_arg, converted_revocation_pubkey_arg, converted_channel_keys_id_arg, channel_value_satoshis_arg)
1212
}
1313
/* DEFAULT_CONSTRUCTOR_END */
1414

@@ -90,7 +90,7 @@ class DelayedPaymentOutputDescriptor {
9090
return DelayedPaymentOutputDescriptor_set_to_self_delay(this_ptrPointer, val);
9191
}
9292

93-
func set_output(val: TxOut) -> Void {
93+
func set_output(val: LDKTxOut) -> Void {
9494

9595

9696
let this_ptrPointer = withUnsafeMutablePointer(to: &self.cOpaqueStruct!) { (pointer: UnsafeMutablePointer<LDKDelayedPaymentOutputDescriptor>) in
@@ -99,7 +99,7 @@ class DelayedPaymentOutputDescriptor {
9999

100100
}
101101

102-
return DelayedPaymentOutputDescriptor_set_output(this_ptrPointer, val.cOpaqueStruct!);
102+
return DelayedPaymentOutputDescriptor_set_output(this_ptrPointer, val);
103103
}
104104

105105
func get_revocation_pubkey() -> [UInt8] {

bindings/LDK/structs/Description.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class Description {
2424

2525
func new(description: String) -> Result_DescriptionCreationErrorZ {
2626

27-
return Result_DescriptionCreationErrorZ(pointer: Description_new(description));
27+
return Result_DescriptionCreationErrorZ(pointer: Description_new(Bindings.new_LDKStr(string: description)));
2828
}
2929

3030
func into_inner(this_arg: Description) -> String {
3131

32-
return Description_into_inner(this_arg.cOpaqueStruct!);
32+
return Bindings.LDKStr_to_string(nativeType: Description_into_inner(this_arg.cOpaqueStruct!));
3333
}
3434

3535

bindings/LDK/structs/ErrorMessage.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ class ErrorMessage {
66
init(channel_id_arg: [UInt8], data_arg: String) {
77

88
let converted_channel_id_arg = Bindings.new_LDKThirtyTwoBytes(array: channel_id_arg)
9-
self.cOpaqueStruct = ErrorMessage_new(converted_channel_id_arg, data_arg)
9+
let converted_data_arg = Bindings.new_LDKStr(string: data_arg)
10+
self.cOpaqueStruct = ErrorMessage_new(converted_channel_id_arg, converted_data_arg)
1011
}
1112
/* DEFAULT_CONSTRUCTOR_END */
1213

@@ -49,7 +50,7 @@ class ErrorMessage {
4950

5051
}
5152

52-
return ErrorMessage_get_data(this_ptrPointer);
53+
return Bindings.LDKStr_to_string(nativeType: ErrorMessage_get_data(this_ptrPointer));
5354
}
5455

5556
func set_data(val: String) -> Void {
@@ -61,7 +62,7 @@ class ErrorMessage {
6162

6263
}
6364

64-
return ErrorMessage_set_data(this_ptrPointer, val);
65+
return ErrorMessage_set_data(this_ptrPointer, Bindings.new_LDKStr(string: val));
6566
}
6667

6768
func clone(orig: ErrorMessage) -> ErrorMessage {

bindings/LDK/structs/FilesystemPersister.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ class FilesystemPersister {
55
/* DEFAULT_CONSTRUCTOR_START */
66
init(path_to_channel_data: String) {
77

8-
self.cOpaqueStruct = FilesystemPersister_new(path_to_channel_data)
8+
let converted_path_to_channel_data = Bindings.new_LDKStr(string: path_to_channel_data)
9+
self.cOpaqueStruct = FilesystemPersister_new(converted_path_to_channel_data)
910
}
1011
/* DEFAULT_CONSTRUCTOR_END */
1112

@@ -24,7 +25,7 @@ class FilesystemPersister {
2425

2526
}
2627

27-
return FilesystemPersister_get_data_dir(this_argPointer);
28+
return Bindings.LDKStr_to_string(nativeType: FilesystemPersister_get_data_dir(this_argPointer));
2829
}
2930

3031
func persist_manager(data_dir: String, manager: ChannelManager) -> Result_NoneErrorZ {
@@ -36,7 +37,7 @@ class FilesystemPersister {
3637

3738
}
3839

39-
return Result_NoneErrorZ(pointer: FilesystemPersister_persist_manager(data_dir, managerPointer));
40+
return Result_NoneErrorZ(pointer: FilesystemPersister_persist_manager(Bindings.new_LDKStr(string: data_dir), managerPointer));
4041
}
4142

4243
func read_channelmonitors(this_arg: FilesystemPersister, keys_manager: KeysInterface) -> Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {

bindings/LDK/structs/Invoice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class Invoice {
178178

179179
func from_str(s: String) -> Result_InvoiceNoneZ {
180180

181-
return Result_InvoiceNoneZ(pointer: Invoice_from_str(s));
181+
return Result_InvoiceNoneZ(pointer: Invoice_from_str(Bindings.new_LDKStr(string: s)));
182182
}
183183

184184
func to_str(o: Invoice) -> String {
@@ -190,7 +190,7 @@ class Invoice {
190190

191191
}
192192

193-
return Invoice_to_str(oPointer);
193+
return Bindings.LDKStr_to_string(nativeType: Invoice_to_str(oPointer));
194194
}
195195

196196

bindings/LDK/structs/KeysManager.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ class KeysManager {
55
/* DEFAULT_CONSTRUCTOR_START */
66
init(seed: [UInt8], starting_time_secs: UInt64, starting_time_nanos: UInt32) {
77

8-
self.cOpaqueStruct = KeysManager_new(seed, starting_time_secs, starting_time_nanos)
8+
9+
let seedPointer = withUnsafePointer(to: Bindings.array_to_tuple32(array: seed)) { (pointer: 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
10+
11+
pointer
12+
13+
}
14+
15+
self.cOpaqueStruct = KeysManager_new(seedPointer, starting_time_secs, starting_time_nanos)
916
}
1017
/* DEFAULT_CONSTRUCTOR_END */
1118

bindings/LDK/structs/LightningError.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ class LightningError {
55
/* DEFAULT_CONSTRUCTOR_START */
66
init(err_arg: String, action_arg: ErrorAction) {
77

8-
self.cOpaqueStruct = LightningError_new(err_arg, action_arg.cOpaqueStruct!)
8+
let converted_err_arg = Bindings.new_LDKStr(string: err_arg)
9+
self.cOpaqueStruct = LightningError_new(converted_err_arg, action_arg.cOpaqueStruct!)
910
}
1011
/* DEFAULT_CONSTRUCTOR_END */
1112

@@ -24,7 +25,7 @@ class LightningError {
2425

2526
}
2627

27-
return LightningError_get_err(this_ptrPointer);
28+
return Bindings.LDKStr_to_string(nativeType: LightningError_get_err(this_ptrPointer));
2829
}
2930

3031
func set_err(val: String) -> Void {
@@ -36,7 +37,7 @@ class LightningError {
3637

3738
}
3839

39-
return LightningError_set_err(this_ptrPointer, val);
40+
return LightningError_set_err(this_ptrPointer, Bindings.new_LDKStr(string: val));
4041
}
4142

4243
func get_action() -> ErrorAction {

bindings/LDK/structs/PeerManager.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ class PeerManager {
66
init(message_handler: MessageHandler, our_node_secret: [UInt8], ephemeral_random_data: [UInt8], logger: Logger) {
77

88
let converted_our_node_secret = Bindings.new_LDKSecretKey(array: our_node_secret)
9-
self.cOpaqueStruct = PeerManager_new(message_handler.cOpaqueStruct!, converted_our_node_secret, ephemeral_random_data, logger.cOpaqueStruct!)
9+
10+
let ephemeral_random_dataPointer = withUnsafePointer(to: Bindings.array_to_tuple32(array: ephemeral_random_data)) { (pointer: 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+
12+
pointer
13+
14+
}
15+
16+
self.cOpaqueStruct = PeerManager_new(message_handler.cOpaqueStruct!, converted_our_node_secret, ephemeral_random_dataPointer, logger.cOpaqueStruct!)
1017
}
1118
/* DEFAULT_CONSTRUCTOR_END */
1219

bindings/LDK/structs/SignedRawInvoice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class SignedRawInvoice {
8989

9090
func from_str(s: String) -> Result_SignedRawInvoiceNoneZ {
9191

92-
return Result_SignedRawInvoiceNoneZ(pointer: SignedRawInvoice_from_str(s));
92+
return Result_SignedRawInvoiceNoneZ(pointer: SignedRawInvoice_from_str(Bindings.new_LDKStr(string: s)));
9393
}
9494

9595
func to_str(o: SignedRawInvoice) -> String {
@@ -101,7 +101,7 @@ class SignedRawInvoice {
101101

102102
}
103103

104-
return SignedRawInvoice_to_str(oPointer);
104+
return Bindings.LDKStr_to_string(nativeType: SignedRawInvoice_to_str(oPointer));
105105
}
106106

107107

0 commit comments

Comments
 (0)