Skip to content

Commit 568c1ed

Browse files
committed
Update against upstream 0.0.99
1 parent fda2ca7 commit 568c1ed

14 files changed

+2919
-2012
lines changed

bindings/LDK/Bindings.swift

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

bindings/LDK/options/MessageSendEvent.swift

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class MessageSendEvent {
1111
/* OPTION_METHODS_START */
1212

1313
public enum MessageSendEventValueType {
14-
case SendAcceptChannel, SendOpenChannel, SendFundingCreated, SendFundingSigned, SendFundingLocked, SendAnnouncementSignatures, UpdateHTLCs, SendRevokeAndACK, SendClosingSigned, SendShutdown, SendChannelReestablish, BroadcastChannelAnnouncement, BroadcastNodeAnnouncement, BroadcastChannelUpdate, HandleError, PaymentFailureNetworkUpdate, SendChannelRangeQuery, SendShortIdsQuery, SendReplyChannelRange
14+
case SendAcceptChannel, SendOpenChannel, SendFundingCreated, SendFundingSigned, SendFundingLocked, SendAnnouncementSignatures, UpdateHTLCs, SendRevokeAndACK, SendClosingSigned, SendShutdown, SendChannelReestablish, BroadcastChannelAnnouncement, BroadcastNodeAnnouncement, BroadcastChannelUpdate, SendChannelUpdate, HandleError, PaymentFailureNetworkUpdate, SendChannelRangeQuery, SendShortIdsQuery, SendReplyChannelRange
1515
}
1616

1717
public func getValueType() -> MessageSendEventValueType? {
@@ -45,6 +45,8 @@ public class MessageSendEvent {
4545
return .BroadcastNodeAnnouncement
4646
case LDKMessageSendEvent_BroadcastChannelUpdate:
4747
return .BroadcastChannelUpdate
48+
case LDKMessageSendEvent_SendChannelUpdate:
49+
return .SendChannelUpdate
4850
case LDKMessageSendEvent_HandleError:
4951
return .HandleError
5052
case LDKMessageSendEvent_PaymentFailureNetworkUpdate:
@@ -159,6 +161,13 @@ public class MessageSendEvent {
159161
return BroadcastChannelUpdate(pointer: self.cOpaqueStruct!.broadcast_channel_update)
160162
}
161163

164+
public func getValueAsSendChannelUpdate() -> SendChannelUpdate? {
165+
if self.cOpaqueStruct?.tag != LDKMessageSendEvent_SendChannelUpdate {
166+
return nil
167+
}
168+
return SendChannelUpdate(pointer: self.cOpaqueStruct!.send_channel_update)
169+
}
170+
162171
public func getValueAsHandleError() -> HandleError? {
163172
if self.cOpaqueStruct?.tag != LDKMessageSendEvent_HandleError {
164173
return nil
@@ -499,6 +508,28 @@ public class MessageSendEvent {
499508
}
500509

501510

511+
public class SendChannelUpdate {
512+
513+
514+
var cOpaqueStruct: LDKMessageSendEvent_LDKSendChannelUpdate_Body?;
515+
fileprivate init(pointer: LDKMessageSendEvent_LDKSendChannelUpdate_Body) {
516+
self.cOpaqueStruct = pointer
517+
}
518+
519+
520+
521+
public func getNode_id() -> [UInt8] {
522+
return Bindings.LDKPublicKey_to_array(nativeType: self.cOpaqueStruct!.node_id)
523+
}
524+
525+
public func getMsg() -> ChannelUpdate {
526+
return ChannelUpdate(pointer: self.cOpaqueStruct!.msg)
527+
}
528+
529+
530+
}
531+
532+
502533
public class HandleError {
503534

504535

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
public class Option_u16Z {
2+
3+
public internal(set) var cOpaqueStruct: LDKCOption_u16Z?;
4+
5+
/* DEFAULT_CONSTRUCTOR_START */
6+
public init(value: UInt16?) {
7+
8+
self.cOpaqueStruct = LDKCOption_u16Z()
9+
if let value = value {
10+
self.cOpaqueStruct!.tag = LDKCOption_u16Z_Some
11+
self.cOpaqueStruct!.some = value
12+
} else {
13+
self.cOpaqueStruct!.tag = LDKCOption_u16Z_None
14+
}
15+
16+
17+
}
18+
/* DEFAULT_CONSTRUCTOR_END */
19+
20+
public init(pointer: LDKCOption_u16Z){
21+
self.cOpaqueStruct = pointer
22+
}
23+
24+
/* OPTION_METHODS_START */
25+
26+
public func getValue() -> UInt16? {
27+
28+
29+
if self.cOpaqueStruct!.tag == LDKCOption_u16Z_None {
30+
return nil
31+
}
32+
if self.cOpaqueStruct!.tag == LDKCOption_u16Z_Some {
33+
return self.cOpaqueStruct!.some
34+
}
35+
assert(false, "invalid option enum value")
36+
return nil
37+
38+
39+
}
40+
41+
/* OPTION_METHODS_END */
42+
43+
/* TYPE_CLASSES */
44+
}

bindings/LDK/structs/ChannelConfig.swift

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,34 @@ public class ChannelConfig {
1515

1616
/* STRUCT_METHODS_START */
1717

18-
public func get_fee_proportional_millionths() -> UInt32 {
18+
public func get_forwarding_fee_proportional_millionths() -> UInt32 {
1919

2020
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
21-
ChannelConfig_get_fee_proportional_millionths(this_ptrPointer)
21+
ChannelConfig_get_forwarding_fee_proportional_millionths(this_ptrPointer)
2222
};
2323
}
2424

25-
public func set_fee_proportional_millionths(val: UInt32) -> Void {
25+
public func set_forwarding_fee_proportional_millionths(val: UInt32) -> Void {
2626

2727
let this_ptrPointer = UnsafeMutablePointer<LDKChannelConfig>.allocate(capacity: 1)
2828
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
2929

30-
return ChannelConfig_set_fee_proportional_millionths(this_ptrPointer, val);
30+
return ChannelConfig_set_forwarding_fee_proportional_millionths(this_ptrPointer, val);
31+
}
32+
33+
public func get_forwarding_fee_base_msat() -> UInt32 {
34+
35+
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
36+
ChannelConfig_get_forwarding_fee_base_msat(this_ptrPointer)
37+
};
38+
}
39+
40+
public func set_forwarding_fee_base_msat(val: UInt32) -> Void {
41+
42+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelConfig>.allocate(capacity: 1)
43+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44+
45+
return ChannelConfig_set_forwarding_fee_base_msat(this_ptrPointer, val);
3146
}
3247

3348
public func get_cltv_expiry_delta() -> UInt16 {
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
public class ChannelCounterparty {
2+
3+
public internal(set) var cOpaqueStruct: LDKChannelCounterparty?;
4+
5+
6+
7+
public init(pointer: LDKChannelCounterparty){
8+
self.cOpaqueStruct = pointer
9+
}
10+
11+
/* STRUCT_METHODS_START */
12+
13+
public func get_node_id() -> [UInt8] {
14+
15+
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelCounterparty>) in
16+
ChannelCounterparty_get_node_id(this_ptrPointer)
17+
});
18+
}
19+
20+
public func set_node_id(val: [UInt8]) -> Void {
21+
22+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelCounterparty>.allocate(capacity: 1)
23+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
24+
25+
return ChannelCounterparty_set_node_id(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
26+
}
27+
28+
public func get_features() -> InitFeatures {
29+
30+
return InitFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelCounterparty>) in
31+
ChannelCounterparty_get_features(this_ptrPointer)
32+
});
33+
}
34+
35+
public func set_features(val: InitFeatures) -> Void {
36+
37+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelCounterparty>.allocate(capacity: 1)
38+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
39+
40+
return ChannelCounterparty_set_features(this_ptrPointer, val.cOpaqueStruct!);
41+
}
42+
43+
public func get_unspendable_punishment_reserve() -> UInt64 {
44+
45+
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelCounterparty>) in
46+
ChannelCounterparty_get_unspendable_punishment_reserve(this_ptrPointer)
47+
};
48+
}
49+
50+
public func set_unspendable_punishment_reserve(val: UInt64) -> Void {
51+
52+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelCounterparty>.allocate(capacity: 1)
53+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
54+
55+
return ChannelCounterparty_set_unspendable_punishment_reserve(this_ptrPointer, val);
56+
}
57+
58+
public func clone(orig: ChannelCounterparty) -> ChannelCounterparty {
59+
60+
return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKChannelCounterparty>) in
61+
ChannelCounterparty(pointer: ChannelCounterparty_clone(origPointer))
62+
};
63+
}
64+
65+
66+
deinit {
67+
if self.cOpaqueStruct?.is_owned == false {
68+
69+
70+
71+
ChannelCounterparty_free(self.cOpaqueStruct!)
72+
73+
}
74+
75+
}
76+
77+
/* STRUCT_METHODS_END */
78+
79+
}

bindings/LDK/structs/ChannelDetails.swift

Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ public class ChannelDetails {
22

33
public internal(set) var cOpaqueStruct: LDKChannelDetails?;
44

5-
5+
/* DEFAULT_CONSTRUCTOR_START */
6+
public init(channel_id_arg: [UInt8], counterparty_arg: ChannelCounterparty, funding_txo_arg: OutPoint, short_channel_id_arg: Option_u64Z, channel_value_satoshis_arg: UInt64, unspendable_punishment_reserve_arg: Option_u64Z, user_id_arg: UInt64, outbound_capacity_msat_arg: UInt64, inbound_capacity_msat_arg: UInt64, confirmations_required_arg: Option_u32Z, force_close_spend_delay_arg: Option_u16Z, is_outbound_arg: Bool, is_funding_locked_arg: Bool, is_usable_arg: Bool, is_public_arg: Bool) {
7+
8+
self.cOpaqueStruct = ChannelDetails_new(Bindings.new_LDKThirtyTwoBytes(array: channel_id_arg), counterparty_arg.cOpaqueStruct!, funding_txo_arg.cOpaqueStruct!, short_channel_id_arg.cOpaqueStruct!, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.cOpaqueStruct!, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.cOpaqueStruct!, force_close_spend_delay_arg.cOpaqueStruct!, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg)
9+
}
10+
/* DEFAULT_CONSTRUCTOR_END */
611

712
public init(pointer: LDKChannelDetails){
813
self.cOpaqueStruct = pointer
@@ -25,6 +30,21 @@ ChannelDetails_get_channel_id(this_ptrPointer)
2530
return ChannelDetails_set_channel_id(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
2631
}
2732

33+
public func get_counterparty() -> ChannelCounterparty {
34+
35+
return ChannelCounterparty(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
36+
ChannelDetails_get_counterparty(this_ptrPointer)
37+
});
38+
}
39+
40+
public func set_counterparty(val: ChannelCounterparty) -> Void {
41+
42+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelDetails>.allocate(capacity: 1)
43+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
44+
45+
return ChannelDetails_set_counterparty(this_ptrPointer, val.cOpaqueStruct!);
46+
}
47+
2848
public func get_funding_txo() -> OutPoint {
2949

3050
return OutPoint(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
@@ -55,49 +75,34 @@ ChannelDetails_get_short_channel_id(this_ptrPointer)
5575
return ChannelDetails_set_short_channel_id(this_ptrPointer, val.cOpaqueStruct!);
5676
}
5777

58-
public func get_remote_network_id() -> [UInt8] {
78+
public func get_channel_value_satoshis() -> UInt64 {
5979

60-
return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
61-
ChannelDetails_get_remote_network_id(this_ptrPointer)
62-
});
80+
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
81+
ChannelDetails_get_channel_value_satoshis(this_ptrPointer)
82+
};
6383
}
6484

65-
public func set_remote_network_id(val: [UInt8]) -> Void {
85+
public func set_channel_value_satoshis(val: UInt64) -> Void {
6686

6787
let this_ptrPointer = UnsafeMutablePointer<LDKChannelDetails>.allocate(capacity: 1)
6888
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
6989

70-
return ChannelDetails_set_remote_network_id(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
90+
return ChannelDetails_set_channel_value_satoshis(this_ptrPointer, val);
7191
}
7292

73-
public func get_counterparty_features() -> InitFeatures {
93+
public func get_unspendable_punishment_reserve() -> Option_u64Z {
7494

75-
return InitFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
76-
ChannelDetails_get_counterparty_features(this_ptrPointer)
95+
return Option_u64Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
96+
ChannelDetails_get_unspendable_punishment_reserve(this_ptrPointer)
7797
});
7898
}
7999

80-
public func set_counterparty_features(val: InitFeatures) -> Void {
100+
public func set_unspendable_punishment_reserve(val: Option_u64Z) -> Void {
81101

82102
let this_ptrPointer = UnsafeMutablePointer<LDKChannelDetails>.allocate(capacity: 1)
83103
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
84104

85-
return ChannelDetails_set_counterparty_features(this_ptrPointer, val.cOpaqueStruct!);
86-
}
87-
88-
public func get_channel_value_satoshis() -> UInt64 {
89-
90-
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
91-
ChannelDetails_get_channel_value_satoshis(this_ptrPointer)
92-
};
93-
}
94-
95-
public func set_channel_value_satoshis(val: UInt64) -> Void {
96-
97-
let this_ptrPointer = UnsafeMutablePointer<LDKChannelDetails>.allocate(capacity: 1)
98-
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
99-
100-
return ChannelDetails_set_channel_value_satoshis(this_ptrPointer, val);
105+
return ChannelDetails_set_unspendable_punishment_reserve(this_ptrPointer, val.cOpaqueStruct!);
101106
}
102107

103108
public func get_user_id() -> UInt64 {
@@ -145,6 +150,36 @@ ChannelDetails_get_inbound_capacity_msat(this_ptrPointer)
145150
return ChannelDetails_set_inbound_capacity_msat(this_ptrPointer, val);
146151
}
147152

153+
public func get_confirmations_required() -> Option_u32Z {
154+
155+
return Option_u32Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
156+
ChannelDetails_get_confirmations_required(this_ptrPointer)
157+
});
158+
}
159+
160+
public func set_confirmations_required(val: Option_u32Z) -> Void {
161+
162+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelDetails>.allocate(capacity: 1)
163+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
164+
165+
return ChannelDetails_set_confirmations_required(this_ptrPointer, val.cOpaqueStruct!);
166+
}
167+
168+
public func get_force_close_spend_delay() -> Option_u16Z {
169+
170+
return Option_u16Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
171+
ChannelDetails_get_force_close_spend_delay(this_ptrPointer)
172+
});
173+
}
174+
175+
public func set_force_close_spend_delay(val: Option_u16Z) -> Void {
176+
177+
let this_ptrPointer = UnsafeMutablePointer<LDKChannelDetails>.allocate(capacity: 1)
178+
this_ptrPointer.initialize(to: self.cOpaqueStruct!)
179+
180+
return ChannelDetails_set_force_close_spend_delay(this_ptrPointer, val.cOpaqueStruct!);
181+
}
182+
148183
public func get_is_outbound() -> Bool {
149184

150185
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in

bindings/LDK/structs/ChannelManager.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ ChannelManager_await_persistable_update(this_argPointer)
195195
};
196196
}
197197

198+
public func current_best_block() -> BestBlock {
199+
200+
return BestBlock(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
201+
ChannelManager_current_best_block(this_argPointer)
202+
});
203+
}
204+
198205
public func as_ChannelMessageHandler() -> ChannelMessageHandler {
199206

200207
return NativelyImplementedChannelMessageHandler(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in

bindings/LDK/structs/ChannelMonitor.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ ChannelMonitor_get_relevant_txids(this_argPointer)
144144
});
145145
}
146146

147+
public func current_best_block() -> BestBlock {
148+
149+
return BestBlock(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
150+
ChannelMonitor_current_best_block(this_argPointer)
151+
});
152+
}
153+
147154

148155
deinit {
149156
if self.cOpaqueStruct?.is_owned == false {

0 commit comments

Comments
 (0)