Skip to content

Commit 2500c1e

Browse files
committed
Add unary byte container parameter and handling support for LDKWitnessVersion for 108 compatibility.
1 parent 0641db7 commit 2500c1e

Some content is hidden

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

46 files changed

+1125
-1266
lines changed

bindings/LDK/Bindings.swift

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

bindings/LDK/options/Event.swift

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

bindings/LDK/options/MessageSendEvent.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class MessageSendEvent: NativeTypeWrapper {
2626
/* OPTION_METHODS_START */
2727

2828
public enum MessageSendEventValueType {
29-
case SendAcceptChannel, SendOpenChannel, SendFundingCreated, SendFundingSigned, SendFundingLocked, SendAnnouncementSignatures, UpdateHTLCs, SendRevokeAndACK, SendClosingSigned, SendShutdown, SendChannelReestablish, BroadcastChannelAnnouncement, BroadcastNodeAnnouncement, BroadcastChannelUpdate, SendChannelUpdate, HandleError, SendChannelRangeQuery, SendShortIdsQuery, SendReplyChannelRange, SendGossipTimestampFilter
29+
case SendAcceptChannel, SendOpenChannel, SendFundingCreated, SendFundingSigned, SendChannelReady, SendAnnouncementSignatures, UpdateHTLCs, SendRevokeAndACK, SendClosingSigned, SendShutdown, SendChannelReestablish, BroadcastChannelAnnouncement, BroadcastNodeAnnouncement, BroadcastChannelUpdate, SendChannelUpdate, HandleError, SendChannelRangeQuery, SendShortIdsQuery, SendReplyChannelRange, SendGossipTimestampFilter
3030
}
3131

3232
public func getValueType() -> MessageSendEventValueType? {
@@ -40,8 +40,8 @@ public class MessageSendEvent: NativeTypeWrapper {
4040
return .SendFundingCreated
4141
case LDKMessageSendEvent_SendFundingSigned:
4242
return .SendFundingSigned
43-
case LDKMessageSendEvent_SendFundingLocked:
44-
return .SendFundingLocked
43+
case LDKMessageSendEvent_SendChannelReady:
44+
return .SendChannelReady
4545
case LDKMessageSendEvent_SendAnnouncementSignatures:
4646
return .SendAnnouncementSignatures
4747
case LDKMessageSendEvent_UpdateHTLCs:
@@ -106,11 +106,11 @@ public class MessageSendEvent: NativeTypeWrapper {
106106
return SendFundingSigned(pointer: self.cOpaqueStruct!.send_funding_signed, anchor: self)
107107
}
108108

109-
public func getValueAsSendFundingLocked() -> SendFundingLocked? {
110-
if self.cOpaqueStruct?.tag != LDKMessageSendEvent_SendFundingLocked {
109+
public func getValueAsSendChannelReady() -> SendChannelReady? {
110+
if self.cOpaqueStruct?.tag != LDKMessageSendEvent_SendChannelReady {
111111
return nil
112112
}
113-
return SendFundingLocked(pointer: self.cOpaqueStruct!.send_funding_locked, anchor: self)
113+
return SendChannelReady(pointer: self.cOpaqueStruct!.send_channel_ready, anchor: self)
114114
}
115115

116116
public func getValueAsSendAnnouncementSignatures() -> SendAnnouncementSignatures? {
@@ -273,9 +273,9 @@ MessageSendEvent_clone(origPointer)
273273
return MessageSendEvent(pointer: MessageSendEvent_send_funding_signed(Bindings.new_LDKPublicKey(array: node_id), msg.danglingClone().cOpaqueStruct!));
274274
}
275275

276-
public class func send_funding_locked(node_id: [UInt8], msg: FundingLocked) -> MessageSendEvent {
276+
public class func send_channel_ready(node_id: [UInt8], msg: ChannelReady) -> MessageSendEvent {
277277

278-
return MessageSendEvent(pointer: MessageSendEvent_send_funding_locked(Bindings.new_LDKPublicKey(array: node_id), msg.danglingClone().cOpaqueStruct!));
278+
return MessageSendEvent(pointer: MessageSendEvent_send_channel_ready(Bindings.new_LDKPublicKey(array: node_id), msg.danglingClone().cOpaqueStruct!));
279279
}
280280

281281
public class func send_announcement_signatures(node_id: [UInt8], msg: AnnouncementSignatures) -> MessageSendEvent {
@@ -473,15 +473,15 @@ MessageSendEvent_clone(origPointer)
473473
}
474474

475475

476-
public class SendFundingLocked: NativeTypeWrapper {
476+
public class SendChannelReady: NativeTypeWrapper {
477477

478478

479-
var cOpaqueStruct: LDKMessageSendEvent_LDKSendFundingLocked_Body?;
480-
fileprivate init(pointer: LDKMessageSendEvent_LDKSendFundingLocked_Body) {
479+
var cOpaqueStruct: LDKMessageSendEvent_LDKSendChannelReady_Body?;
480+
fileprivate init(pointer: LDKMessageSendEvent_LDKSendChannelReady_Body) {
481481
self.cOpaqueStruct = pointer
482482
super.init(conflictAvoidingVariableName: 0)
483483
}
484-
fileprivate init(pointer: LDKMessageSendEvent_LDKSendFundingLocked_Body, anchor: NativeTypeWrapper) {
484+
fileprivate init(pointer: LDKMessageSendEvent_LDKSendChannelReady_Body, anchor: NativeTypeWrapper) {
485485
self.cOpaqueStruct = pointer
486486
super.init(conflictAvoidingVariableName: 0)
487487
self.dangling = true
@@ -494,8 +494,8 @@ MessageSendEvent_clone(origPointer)
494494
return Bindings.LDKPublicKey_to_array(nativeType: self.cOpaqueStruct!.node_id)
495495
}
496496

497-
public func getMsg() -> FundingLocked {
498-
return FundingLocked(pointer: self.cOpaqueStruct!.msg, anchor: self)
497+
public func getMsg() -> ChannelReady {
498+
return ChannelReady(pointer: self.cOpaqueStruct!.msg, anchor: self)
499499
}
500500

501501

bindings/LDK/options/NetworkUpdate.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ public class NetworkUpdate: NativeTypeWrapper {
2626
/* OPTION_METHODS_START */
2727

2828
public enum NetworkUpdateValueType {
29-
case ChannelUpdateMessage, ChannelClosed, NodeFailure
29+
case ChannelUpdateMessage, ChannelFailure, NodeFailure
3030
}
3131

3232
public func getValueType() -> NetworkUpdateValueType? {
3333
switch self.cOpaqueStruct?.tag {
3434

3535
case LDKNetworkUpdate_ChannelUpdateMessage:
3636
return .ChannelUpdateMessage
37-
case LDKNetworkUpdate_ChannelClosed:
38-
return .ChannelClosed
37+
case LDKNetworkUpdate_ChannelFailure:
38+
return .ChannelFailure
3939
case LDKNetworkUpdate_NodeFailure:
4040
return .NodeFailure
4141
default:
@@ -51,11 +51,11 @@ public class NetworkUpdate: NativeTypeWrapper {
5151
return ChannelUpdateMessage(pointer: self.cOpaqueStruct!.channel_update_message, anchor: self)
5252
}
5353

54-
public func getValueAsChannelClosed() -> ChannelClosed? {
55-
if self.cOpaqueStruct?.tag != LDKNetworkUpdate_ChannelClosed {
54+
public func getValueAsChannelFailure() -> ChannelFailure? {
55+
if self.cOpaqueStruct?.tag != LDKNetworkUpdate_ChannelFailure {
5656
return nil
5757
}
58-
return ChannelClosed(pointer: self.cOpaqueStruct!.channel_closed, anchor: self)
58+
return ChannelFailure(pointer: self.cOpaqueStruct!.channel_failure, anchor: self)
5959
}
6060

6161
public func getValueAsNodeFailure() -> NodeFailure? {
@@ -105,9 +105,9 @@ NetworkUpdate_clone(origPointer)
105105
return NetworkUpdate(pointer: NetworkUpdate_channel_update_message(msg.danglingClone().cOpaqueStruct!));
106106
}
107107

108-
public class func channel_closed(short_channel_id: UInt64, is_permanent: Bool) -> NetworkUpdate {
108+
public class func channel_failure(short_channel_id: UInt64, is_permanent: Bool) -> NetworkUpdate {
109109

110-
return NetworkUpdate(pointer: NetworkUpdate_channel_closed(short_channel_id, is_permanent));
110+
return NetworkUpdate(pointer: NetworkUpdate_channel_failure(short_channel_id, is_permanent));
111111
}
112112

113113
public class func node_failure(node_id: [UInt8], is_permanent: Bool) -> NetworkUpdate {
@@ -161,15 +161,15 @@ NetworkUpdate_write(objPointer)
161161
}
162162

163163

164-
public class ChannelClosed: NativeTypeWrapper {
164+
public class ChannelFailure: NativeTypeWrapper {
165165

166166

167-
var cOpaqueStruct: LDKNetworkUpdate_LDKChannelClosed_Body?;
168-
fileprivate init(pointer: LDKNetworkUpdate_LDKChannelClosed_Body) {
167+
var cOpaqueStruct: LDKNetworkUpdate_LDKChannelFailure_Body?;
168+
fileprivate init(pointer: LDKNetworkUpdate_LDKChannelFailure_Body) {
169169
self.cOpaqueStruct = pointer
170170
super.init(conflictAvoidingVariableName: 0)
171171
}
172-
fileprivate init(pointer: LDKNetworkUpdate_LDKChannelClosed_Body, anchor: NativeTypeWrapper) {
172+
fileprivate init(pointer: LDKNetworkUpdate_LDKChannelFailure_Body, anchor: NativeTypeWrapper) {
173173
self.cOpaqueStruct = pointer
174174
super.init(conflictAvoidingVariableName: 0)
175175
self.dangling = true

bindings/LDK/options/PaymentPurpose.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,23 @@ PaymentPurpose_clone(origPointer)
101101
return PaymentPurpose(pointer: PaymentPurpose_spontaneous_payment(Bindings.new_LDKThirtyTwoBytes(array: a)));
102102
}
103103

104+
public func write() -> [UInt8] {
105+
106+
return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKPaymentPurpose>) in
107+
PaymentPurpose_write(objPointer)
108+
});
109+
}
110+
111+
public class func read(ser: [UInt8]) -> Result_PaymentPurposeDecodeErrorZ {
112+
113+
let serWrapper = Bindings.new_LDKu8sliceWrapper(array: ser)
114+
defer {
115+
serWrapper.noOpRetain()
116+
}
117+
118+
return Result_PaymentPurposeDecodeErrorZ(pointer: PaymentPurpose_read(serWrapper.cOpaqueStruct!));
119+
}
120+
104121
/* OPTION_METHODS_END */
105122

106123

bindings/LDK/results/Result_ChannelFeaturesDecodeErrorZ.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ public class Result_ChannelFeaturesDecodeErrorZ: NativeTypeWrapper {
8282
}
8383

8484

85+
public func clone() -> Result_ChannelFeaturesDecodeErrorZ {
86+
87+
return Result_ChannelFeaturesDecodeErrorZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKCResult_ChannelFeaturesDecodeErrorZ>) in
88+
CResult_ChannelFeaturesDecodeErrorZ_clone(origPointer)
89+
});
90+
}
91+
92+
internal func danglingClone() -> Result_ChannelFeaturesDecodeErrorZ {
93+
let dangledClone = self.clone()
94+
dangledClone.dangling = true
95+
return dangledClone
96+
}
97+
98+
8599
/* RESULT_METHODS_END */
86100

87101
}

bindings/LDK/results/Result_ChannelTypeFeaturesDecodeErrorZ.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ public class Result_ChannelTypeFeaturesDecodeErrorZ: NativeTypeWrapper {
8282
}
8383

8484

85+
public func clone() -> Result_ChannelTypeFeaturesDecodeErrorZ {
86+
87+
return Result_ChannelTypeFeaturesDecodeErrorZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKCResult_ChannelTypeFeaturesDecodeErrorZ>) in
88+
CResult_ChannelTypeFeaturesDecodeErrorZ_clone(origPointer)
89+
});
90+
}
91+
92+
internal func danglingClone() -> Result_ChannelTypeFeaturesDecodeErrorZ {
93+
let dangledClone = self.clone()
94+
dangledClone.dangling = true
95+
return dangledClone
96+
}
97+
98+
8599
/* RESULT_METHODS_END */
86100

87101
}

bindings/LDK/results/Result_FundingLockedDecodeErrorZ.swift

Lines changed: 0 additions & 101 deletions
This file was deleted.

bindings/LDK/results/Result_InitFeaturesDecodeErrorZ.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ public class Result_InitFeaturesDecodeErrorZ: NativeTypeWrapper {
8282
}
8383

8484

85+
public func clone() -> Result_InitFeaturesDecodeErrorZ {
86+
87+
return Result_InitFeaturesDecodeErrorZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKCResult_InitFeaturesDecodeErrorZ>) in
88+
CResult_InitFeaturesDecodeErrorZ_clone(origPointer)
89+
});
90+
}
91+
92+
internal func danglingClone() -> Result_InitFeaturesDecodeErrorZ {
93+
let dangledClone = self.clone()
94+
dangledClone.dangling = true
95+
return dangledClone
96+
}
97+
98+
8599
/* RESULT_METHODS_END */
86100

87101
}

bindings/LDK/results/Result_InvoiceFeaturesDecodeErrorZ.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ public class Result_InvoiceFeaturesDecodeErrorZ: NativeTypeWrapper {
8282
}
8383

8484

85+
public func clone() -> Result_InvoiceFeaturesDecodeErrorZ {
86+
87+
return Result_InvoiceFeaturesDecodeErrorZ(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKCResult_InvoiceFeaturesDecodeErrorZ>) in
88+
CResult_InvoiceFeaturesDecodeErrorZ_clone(origPointer)
89+
});
90+
}
91+
92+
internal func danglingClone() -> Result_InvoiceFeaturesDecodeErrorZ {
93+
let dangledClone = self.clone()
94+
dangledClone.dangling = true
95+
return dangledClone
96+
}
97+
98+
8599
/* RESULT_METHODS_END */
86100

87101
}

0 commit comments

Comments
 (0)