Skip to content

Commit

Permalink
Update against upstream 0.0.99
Browse files Browse the repository at this point in the history
  • Loading branch information
arik-so committed Jul 10, 2021
1 parent fda2ca7 commit 568c1ed
Show file tree
Hide file tree
Showing 14 changed files with 2,919 additions and 2,012 deletions.
710 changes: 355 additions & 355 deletions bindings/LDK/Bindings.swift

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion bindings/LDK/options/MessageSendEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MessageSendEvent {
/* OPTION_METHODS_START */

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

public func getValueType() -> MessageSendEventValueType? {
Expand Down Expand Up @@ -45,6 +45,8 @@ public class MessageSendEvent {
return .BroadcastNodeAnnouncement
case LDKMessageSendEvent_BroadcastChannelUpdate:
return .BroadcastChannelUpdate
case LDKMessageSendEvent_SendChannelUpdate:
return .SendChannelUpdate
case LDKMessageSendEvent_HandleError:
return .HandleError
case LDKMessageSendEvent_PaymentFailureNetworkUpdate:
Expand Down Expand Up @@ -159,6 +161,13 @@ public class MessageSendEvent {
return BroadcastChannelUpdate(pointer: self.cOpaqueStruct!.broadcast_channel_update)
}

public func getValueAsSendChannelUpdate() -> SendChannelUpdate? {
if self.cOpaqueStruct?.tag != LDKMessageSendEvent_SendChannelUpdate {
return nil
}
return SendChannelUpdate(pointer: self.cOpaqueStruct!.send_channel_update)
}

public func getValueAsHandleError() -> HandleError? {
if self.cOpaqueStruct?.tag != LDKMessageSendEvent_HandleError {
return nil
Expand Down Expand Up @@ -499,6 +508,28 @@ public class MessageSendEvent {
}


public class SendChannelUpdate {


var cOpaqueStruct: LDKMessageSendEvent_LDKSendChannelUpdate_Body?;
fileprivate init(pointer: LDKMessageSendEvent_LDKSendChannelUpdate_Body) {
self.cOpaqueStruct = pointer
}



public func getNode_id() -> [UInt8] {
return Bindings.LDKPublicKey_to_array(nativeType: self.cOpaqueStruct!.node_id)
}

public func getMsg() -> ChannelUpdate {
return ChannelUpdate(pointer: self.cOpaqueStruct!.msg)
}


}


public class HandleError {


Expand Down
44 changes: 44 additions & 0 deletions bindings/LDK/options/Option_u16Z.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
public class Option_u16Z {

public internal(set) var cOpaqueStruct: LDKCOption_u16Z?;

/* DEFAULT_CONSTRUCTOR_START */
public init(value: UInt16?) {

self.cOpaqueStruct = LDKCOption_u16Z()
if let value = value {
self.cOpaqueStruct!.tag = LDKCOption_u16Z_Some
self.cOpaqueStruct!.some = value
} else {
self.cOpaqueStruct!.tag = LDKCOption_u16Z_None
}


}
/* DEFAULT_CONSTRUCTOR_END */

public init(pointer: LDKCOption_u16Z){
self.cOpaqueStruct = pointer
}

/* OPTION_METHODS_START */

public func getValue() -> UInt16? {


if self.cOpaqueStruct!.tag == LDKCOption_u16Z_None {
return nil
}
if self.cOpaqueStruct!.tag == LDKCOption_u16Z_Some {
return self.cOpaqueStruct!.some
}
assert(false, "invalid option enum value")
return nil


}

/* OPTION_METHODS_END */

/* TYPE_CLASSES */
}
23 changes: 19 additions & 4 deletions bindings/LDK/structs/ChannelConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,34 @@ public class ChannelConfig {

/* STRUCT_METHODS_START */

public func get_fee_proportional_millionths() -> UInt32 {
public func get_forwarding_fee_proportional_millionths() -> UInt32 {

return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
ChannelConfig_get_fee_proportional_millionths(this_ptrPointer)
ChannelConfig_get_forwarding_fee_proportional_millionths(this_ptrPointer)
};
}

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

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

return ChannelConfig_set_fee_proportional_millionths(this_ptrPointer, val);
return ChannelConfig_set_forwarding_fee_proportional_millionths(this_ptrPointer, val);
}

public func get_forwarding_fee_base_msat() -> UInt32 {

return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelConfig>) in
ChannelConfig_get_forwarding_fee_base_msat(this_ptrPointer)
};
}

public func set_forwarding_fee_base_msat(val: UInt32) -> Void {

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

return ChannelConfig_set_forwarding_fee_base_msat(this_ptrPointer, val);
}

public func get_cltv_expiry_delta() -> UInt16 {
Expand Down
79 changes: 79 additions & 0 deletions bindings/LDK/structs/ChannelCounterparty.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
public class ChannelCounterparty {

public internal(set) var cOpaqueStruct: LDKChannelCounterparty?;



public init(pointer: LDKChannelCounterparty){
self.cOpaqueStruct = pointer
}

/* STRUCT_METHODS_START */

public func get_node_id() -> [UInt8] {

return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelCounterparty>) in
ChannelCounterparty_get_node_id(this_ptrPointer)
});
}

public func set_node_id(val: [UInt8]) -> Void {

let this_ptrPointer = UnsafeMutablePointer<LDKChannelCounterparty>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)

return ChannelCounterparty_set_node_id(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
}

public func get_features() -> InitFeatures {

return InitFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelCounterparty>) in
ChannelCounterparty_get_features(this_ptrPointer)
});
}

public func set_features(val: InitFeatures) -> Void {

let this_ptrPointer = UnsafeMutablePointer<LDKChannelCounterparty>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)

return ChannelCounterparty_set_features(this_ptrPointer, val.cOpaqueStruct!);
}

public func get_unspendable_punishment_reserve() -> UInt64 {

return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelCounterparty>) in
ChannelCounterparty_get_unspendable_punishment_reserve(this_ptrPointer)
};
}

public func set_unspendable_punishment_reserve(val: UInt64) -> Void {

let this_ptrPointer = UnsafeMutablePointer<LDKChannelCounterparty>.allocate(capacity: 1)
this_ptrPointer.initialize(to: self.cOpaqueStruct!)

return ChannelCounterparty_set_unspendable_punishment_reserve(this_ptrPointer, val);
}

public func clone(orig: ChannelCounterparty) -> ChannelCounterparty {

return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKChannelCounterparty>) in
ChannelCounterparty(pointer: ChannelCounterparty_clone(origPointer))
};
}


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



ChannelCounterparty_free(self.cOpaqueStruct!)

}

}

/* STRUCT_METHODS_END */

}
89 changes: 62 additions & 27 deletions bindings/LDK/structs/ChannelDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ public class ChannelDetails {

public internal(set) var cOpaqueStruct: LDKChannelDetails?;


/* DEFAULT_CONSTRUCTOR_START */
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) {

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)
}
/* DEFAULT_CONSTRUCTOR_END */

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

public func get_counterparty() -> ChannelCounterparty {

return ChannelCounterparty(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
ChannelDetails_get_counterparty(this_ptrPointer)
});
}

public func set_counterparty(val: ChannelCounterparty) -> Void {

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

return ChannelDetails_set_counterparty(this_ptrPointer, val.cOpaqueStruct!);
}

public func get_funding_txo() -> OutPoint {

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

public func get_remote_network_id() -> [UInt8] {
public func get_channel_value_satoshis() -> UInt64 {

return Bindings.LDKPublicKey_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
ChannelDetails_get_remote_network_id(this_ptrPointer)
});
return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
ChannelDetails_get_channel_value_satoshis(this_ptrPointer)
};
}

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

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

return ChannelDetails_set_remote_network_id(this_ptrPointer, Bindings.new_LDKPublicKey(array: val));
return ChannelDetails_set_channel_value_satoshis(this_ptrPointer, val);
}

public func get_counterparty_features() -> InitFeatures {
public func get_unspendable_punishment_reserve() -> Option_u64Z {

return InitFeatures(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
ChannelDetails_get_counterparty_features(this_ptrPointer)
return Option_u64Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
ChannelDetails_get_unspendable_punishment_reserve(this_ptrPointer)
});
}

public func set_counterparty_features(val: InitFeatures) -> Void {
public func set_unspendable_punishment_reserve(val: Option_u64Z) -> Void {

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

return ChannelDetails_set_counterparty_features(this_ptrPointer, val.cOpaqueStruct!);
}

public func get_channel_value_satoshis() -> UInt64 {

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

public func set_channel_value_satoshis(val: UInt64) -> Void {

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

return ChannelDetails_set_channel_value_satoshis(this_ptrPointer, val);
return ChannelDetails_set_unspendable_punishment_reserve(this_ptrPointer, val.cOpaqueStruct!);
}

public func get_user_id() -> UInt64 {
Expand Down Expand Up @@ -145,6 +150,36 @@ ChannelDetails_get_inbound_capacity_msat(this_ptrPointer)
return ChannelDetails_set_inbound_capacity_msat(this_ptrPointer, val);
}

public func get_confirmations_required() -> Option_u32Z {

return Option_u32Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
ChannelDetails_get_confirmations_required(this_ptrPointer)
});
}

public func set_confirmations_required(val: Option_u32Z) -> Void {

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

return ChannelDetails_set_confirmations_required(this_ptrPointer, val.cOpaqueStruct!);
}

public func get_force_close_spend_delay() -> Option_u16Z {

return Option_u16Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
ChannelDetails_get_force_close_spend_delay(this_ptrPointer)
});
}

public func set_force_close_spend_delay(val: Option_u16Z) -> Void {

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

return ChannelDetails_set_force_close_spend_delay(this_ptrPointer, val.cOpaqueStruct!);
}

public func get_is_outbound() -> Bool {

return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
Expand Down
7 changes: 7 additions & 0 deletions bindings/LDK/structs/ChannelManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ ChannelManager_await_persistable_update(this_argPointer)
};
}

public func current_best_block() -> BestBlock {

return BestBlock(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
ChannelManager_current_best_block(this_argPointer)
});
}

public func as_ChannelMessageHandler() -> ChannelMessageHandler {

return NativelyImplementedChannelMessageHandler(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
Expand Down
7 changes: 7 additions & 0 deletions bindings/LDK/structs/ChannelMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ ChannelMonitor_get_relevant_txids(this_argPointer)
});
}

public func current_best_block() -> BestBlock {

return BestBlock(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
ChannelMonitor_current_best_block(this_argPointer)
});
}


deinit {
if self.cOpaqueStruct?.is_owned == false {
Expand Down
Loading

0 comments on commit 568c1ed

Please sign in to comment.