Skip to content

Commit b1a6c33

Browse files
committed
better detect optional initialization arguments
1 parent 31e213d commit b1a6c33

File tree

75 files changed

+1223
-1184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1223
-1184
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
lib*.a
44
.DS_Store
55
__pycache__
6+
7+
/xcode/LDKFramework/Build/
8+
/xcode/LDKFramework/LDKFramework.xcodeproj/project.xcworkspace/
9+
/xcode/LDKFramework/LDKFramework.xcodeproj/xcuserdata/

bindings/LDK/Bindings.swift

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

bindings/LDK/structs/AcceptChannel.swift

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ AcceptChannel_get_temporary_channel_id(this_ptrPointer)
1919

2020
public func set_temporary_channel_id(val: [UInt8]) -> Void {
2121

22-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
23-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
24-
22+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
23+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
24+
2525
return AcceptChannel_set_temporary_channel_id(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
2626
}
2727

@@ -34,9 +34,9 @@ AcceptChannel_get_dust_limit_satoshis(this_ptrPointer)
3434

3535
public func set_dust_limit_satoshis(val: UInt64) -> Void {
3636

37-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
38-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
39-
37+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
38+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
39+
4040
return AcceptChannel_set_dust_limit_satoshis(this_ptrPointer, val);
4141
}
4242

@@ -49,9 +49,9 @@ AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptrPointer)
4949

5050
public func set_max_htlc_value_in_flight_msat(val: UInt64) -> Void {
5151

52-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
53-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
54-
52+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
53+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
54+
5555
return AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptrPointer, val);
5656
}
5757

@@ -64,9 +64,9 @@ AcceptChannel_get_channel_reserve_satoshis(this_ptrPointer)
6464

6565
public func set_channel_reserve_satoshis(val: UInt64) -> Void {
6666

67-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
68-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
69-
67+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
68+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
69+
7070
return AcceptChannel_set_channel_reserve_satoshis(this_ptrPointer, val);
7171
}
7272

@@ -79,9 +79,9 @@ AcceptChannel_get_htlc_minimum_msat(this_ptrPointer)
7979

8080
public func set_htlc_minimum_msat(val: UInt64) -> Void {
8181

82-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
83-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
84-
82+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
83+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
84+
8585
return AcceptChannel_set_htlc_minimum_msat(this_ptrPointer, val);
8686
}
8787

@@ -94,9 +94,9 @@ AcceptChannel_get_minimum_depth(this_ptrPointer)
9494

9595
public func set_minimum_depth(val: UInt32) -> Void {
9696

97-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
98-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
99-
97+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
98+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
99+
100100
return AcceptChannel_set_minimum_depth(this_ptrPointer, val);
101101
}
102102

@@ -109,9 +109,9 @@ AcceptChannel_get_to_self_delay(this_ptrPointer)
109109

110110
public func set_to_self_delay(val: UInt16) -> Void {
111111

112-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
113-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
114-
112+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
113+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
114+
115115
return AcceptChannel_set_to_self_delay(this_ptrPointer, val);
116116
}
117117

@@ -124,9 +124,9 @@ AcceptChannel_get_max_accepted_htlcs(this_ptrPointer)
124124

125125
public func set_max_accepted_htlcs(val: UInt16) -> Void {
126126

127-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
128-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
129-
127+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
128+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
129+
130130
return AcceptChannel_set_max_accepted_htlcs(this_ptrPointer, val);
131131
}
132132

@@ -139,9 +139,9 @@ AcceptChannel_get_funding_pubkey(this_ptrPointer)
139139

140140
public func set_funding_pubkey(val: [UInt8]) -> Void {
141141

142-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
143-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
144-
142+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
143+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
144+
145145
return AcceptChannel_set_funding_pubkey(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
146146
}
147147

@@ -154,9 +154,9 @@ AcceptChannel_get_revocation_basepoint(this_ptrPointer)
154154

155155
public func set_revocation_basepoint(val: [UInt8]) -> Void {
156156

157-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
158-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
159-
157+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
158+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
159+
160160
return AcceptChannel_set_revocation_basepoint(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
161161
}
162162

@@ -169,9 +169,9 @@ AcceptChannel_get_payment_point(this_ptrPointer)
169169

170170
public func set_payment_point(val: [UInt8]) -> Void {
171171

172-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
173-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
174-
172+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
173+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
174+
175175
return AcceptChannel_set_payment_point(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
176176
}
177177

@@ -184,9 +184,9 @@ AcceptChannel_get_delayed_payment_basepoint(this_ptrPointer)
184184

185185
public func set_delayed_payment_basepoint(val: [UInt8]) -> Void {
186186

187-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
188-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
189-
187+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
188+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
189+
190190
return AcceptChannel_set_delayed_payment_basepoint(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
191191
}
192192

@@ -199,9 +199,9 @@ AcceptChannel_get_htlc_basepoint(this_ptrPointer)
199199

200200
public func set_htlc_basepoint(val: [UInt8]) -> Void {
201201

202-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
203-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
204-
202+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
203+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
204+
205205
return AcceptChannel_set_htlc_basepoint(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
206206
}
207207

@@ -214,9 +214,9 @@ AcceptChannel_get_first_per_commitment_point(this_ptrPointer)
214214

215215
public func set_first_per_commitment_point(val: [UInt8]) -> Void {
216216

217-
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
218-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
219-
217+
let this_ptrPointer = UnsafeMutablePointer<LDKAcceptChannel>.allocate(capacity: 1)
218+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
219+
220220
return AcceptChannel_set_first_per_commitment_point(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
221221
}
222222

bindings/LDK/structs/AnnouncementSignatures.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ AnnouncementSignatures_get_channel_id(this_ptrPointer)
2424

2525
public func set_channel_id(val: [UInt8]) -> Void {
2626

27-
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
28-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29-
27+
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
28+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29+
3030
return AnnouncementSignatures_set_channel_id(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
3131
}
3232

@@ -39,9 +39,9 @@ AnnouncementSignatures_get_short_channel_id(this_ptrPointer)
3939

4040
public func set_short_channel_id(val: UInt64) -> Void {
4141

42-
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
43-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44-
42+
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
43+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44+
4545
return AnnouncementSignatures_set_short_channel_id(this_ptrPointer, val);
4646
}
4747

@@ -54,9 +54,9 @@ AnnouncementSignatures_get_node_signature(this_ptrPointer)
5454

5555
public func set_node_signature(val: [UInt8]) -> Void {
5656

57-
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
58-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
59-
57+
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
58+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
59+
6060
return AnnouncementSignatures_set_node_signature(this_ptrPointer, Bindings.new_LDKSignature(array: val));
6161
}
6262

@@ -69,9 +69,9 @@ AnnouncementSignatures_get_bitcoin_signature(this_ptrPointer)
6969

7070
public func set_bitcoin_signature(val: [UInt8]) -> Void {
7171

72-
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
73-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
74-
72+
let this_ptrPointer = UnsafeMutablePointer<LDKAnnouncementSignatures>.allocate(capacity: 1)
73+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
74+
7575
return AnnouncementSignatures_set_bitcoin_signature(this_ptrPointer, Bindings.new_LDKSignature(array: val));
7676
}
7777

bindings/LDK/structs/BuiltCommitmentTransaction.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ BuiltCommitmentTransaction_get_transaction(this_ptrPointer)
2424

2525
public func set_transaction(val: [UInt8]) -> Void {
2626

27-
let this_ptrPointer = UnsafeMutablePointer<LDKBuiltCommitmentTransaction>.allocate(capacity: 1)
28-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29-
27+
let this_ptrPointer = UnsafeMutablePointer<LDKBuiltCommitmentTransaction>.allocate(capacity: 1)
28+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29+
3030
return BuiltCommitmentTransaction_set_transaction(this_ptrPointer, Bindings.new_LDKTransaction(array: val));
3131
}
3232

@@ -39,9 +39,9 @@ BuiltCommitmentTransaction_get_txid(this_ptrPointer)
3939

4040
public func set_txid(val: [UInt8]) -> Void {
4141

42-
let this_ptrPointer = UnsafeMutablePointer<LDKBuiltCommitmentTransaction>.allocate(capacity: 1)
43-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44-
42+
let this_ptrPointer = UnsafeMutablePointer<LDKBuiltCommitmentTransaction>.allocate(capacity: 1)
43+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44+
4545
return BuiltCommitmentTransaction_set_txid(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
4646
}
4747

bindings/LDK/structs/ChainMonitor.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ public class ChainMonitor {
33
var cOpaqueStruct: LDKChainMonitor?;
44

55
/* DEFAULT_CONSTRUCTOR_START */
6-
public init(chain_source: Filter, broadcaster: BroadcasterInterface, logger: Logger, feeest: FeeEstimator, persister: Persist) {
6+
public init(chain_source: Filter?, broadcaster: BroadcasterInterface, logger: Logger, feeest: FeeEstimator, persister: Persist) {
77

8-
let chain_sourcePointer = UnsafeMutablePointer<LDKFilter>.allocate(capacity: 1)
9-
chain_sourcePointer.initialize(to: chain_source.cOpaqueStruct!)
10-
8+
var chain_sourcePointer: UnsafeMutablePointer<LDKFilter>? = nil
9+
if let chain_sourceUnwrapped = chain_source {
10+
chain_sourcePointer = UnsafeMutablePointer<LDKFilter>.allocate(capacity: 1)
11+
chain_sourcePointer!.initialize(to: chain_sourceUnwrapped.cOpaqueStruct!)
12+
}
13+
1114
self.cOpaqueStruct = ChainMonitor_new(chain_sourcePointer, broadcaster.cOpaqueStruct!, logger.cOpaqueStruct!, feeest.cOpaqueStruct!, persister.cOpaqueStruct!)
1215
}
1316
/* DEFAULT_CONSTRUCTOR_END */

bindings/LDK/structs/ChainParameters.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ ChainParameters_get_network(this_ptrPointer)
2424

2525
public func set_network(val: LDKNetwork) -> Void {
2626

27-
let this_ptrPointer = UnsafeMutablePointer<LDKChainParameters>.allocate(capacity: 1)
28-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29-
27+
let this_ptrPointer = UnsafeMutablePointer<LDKChainParameters>.allocate(capacity: 1)
28+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29+
3030
return ChainParameters_set_network(this_ptrPointer, val);
3131
}
3232

@@ -39,9 +39,9 @@ ChainParameters_get_best_block(this_ptrPointer)
3939

4040
public func set_best_block(val: BestBlock) -> Void {
4141

42-
let this_ptrPointer = UnsafeMutablePointer<LDKChainParameters>.allocate(capacity: 1)
43-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44-
42+
let this_ptrPointer = UnsafeMutablePointer<LDKChainParameters>.allocate(capacity: 1)
43+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44+
4545
return ChainParameters_set_best_block(this_ptrPointer, val.cOpaqueStruct!);
4646
}
4747

bindings/LDK/structs/ChannelAnnouncement.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ ChannelAnnouncement_get_node_signature_1(this_ptrPointer)
2424

2525
public func set_node_signature_1(val: [UInt8]) -> Void {
2626

27-
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
28-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29-
27+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
28+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
29+
3030
return ChannelAnnouncement_set_node_signature_1(this_ptrPointer, Bindings.new_LDKSignature(array: val));
3131
}
3232

@@ -39,9 +39,9 @@ ChannelAnnouncement_get_node_signature_2(this_ptrPointer)
3939

4040
public func set_node_signature_2(val: [UInt8]) -> Void {
4141

42-
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
43-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44-
42+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
43+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44+
4545
return ChannelAnnouncement_set_node_signature_2(this_ptrPointer, Bindings.new_LDKSignature(array: val));
4646
}
4747

@@ -54,9 +54,9 @@ ChannelAnnouncement_get_bitcoin_signature_1(this_ptrPointer)
5454

5555
public func set_bitcoin_signature_1(val: [UInt8]) -> Void {
5656

57-
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
58-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
59-
57+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
58+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
59+
6060
return ChannelAnnouncement_set_bitcoin_signature_1(this_ptrPointer, Bindings.new_LDKSignature(array: val));
6161
}
6262

@@ -69,9 +69,9 @@ ChannelAnnouncement_get_bitcoin_signature_2(this_ptrPointer)
6969

7070
public func set_bitcoin_signature_2(val: [UInt8]) -> Void {
7171

72-
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
73-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
74-
72+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
73+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
74+
7575
return ChannelAnnouncement_set_bitcoin_signature_2(this_ptrPointer, Bindings.new_LDKSignature(array: val));
7676
}
7777

@@ -84,9 +84,9 @@ ChannelAnnouncement_get_contents(this_ptrPointer)
8484

8585
public func set_contents(val: UnsignedChannelAnnouncement) -> Void {
8686

87-
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
88-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
89-
87+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelAnnouncement>.allocate(capacity: 1)
88+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
89+
9090
return ChannelAnnouncement_set_contents(this_ptrPointer, val.cOpaqueStruct!);
9191
}
9292

0 commit comments

Comments
 (0)