3 public class HTLCOutputInCommitment {
5 public internal(set) var cOpaqueStruct: LDKHTLCOutputInCommitment?;
7 /* DEFAULT_CONSTRUCTOR_START */
8 public init(offered_arg: Bool, amount_msat_arg: UInt64, cltv_expiry_arg: UInt32, payment_hash_arg: [UInt8], transaction_output_index_arg: Option_u32Z) {
10 self.cOpaqueStruct = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, Bindings.new_LDKThirtyTwoBytes(array: payment_hash_arg), transaction_output_index_arg.cOpaqueStruct!)
12 /* DEFAULT_CONSTRUCTOR_END */
14 public init(pointer: LDKHTLCOutputInCommitment){
15 self.cOpaqueStruct = pointer
18 /* STRUCT_METHODS_START */
20 public func get_offered() -> Bool {
22 return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
23 HTLCOutputInCommitment_get_offered(this_ptrPointer)
27 public func set_offered(val: Bool) -> Void {
29 let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
30 this_ptrPointer.initialize(to: self.cOpaqueStruct!)
32 return HTLCOutputInCommitment_set_offered(this_ptrPointer, val);
35 public func get_amount_msat() -> UInt64 {
37 return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
38 HTLCOutputInCommitment_get_amount_msat(this_ptrPointer)
42 public func set_amount_msat(val: UInt64) -> Void {
44 let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
45 this_ptrPointer.initialize(to: self.cOpaqueStruct!)
47 return HTLCOutputInCommitment_set_amount_msat(this_ptrPointer, val);
50 public func get_cltv_expiry() -> UInt32 {
52 return withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
53 HTLCOutputInCommitment_get_cltv_expiry(this_ptrPointer)
57 public func set_cltv_expiry(val: UInt32) -> Void {
59 let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
60 this_ptrPointer.initialize(to: self.cOpaqueStruct!)
62 return HTLCOutputInCommitment_set_cltv_expiry(this_ptrPointer, val);
65 public func get_payment_hash() -> [UInt8] {
67 return Bindings.tuple32_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
68 HTLCOutputInCommitment_get_payment_hash(this_ptrPointer)
72 public func set_payment_hash(val: [UInt8]) -> Void {
74 let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
75 this_ptrPointer.initialize(to: self.cOpaqueStruct!)
77 return HTLCOutputInCommitment_set_payment_hash(this_ptrPointer, Bindings.new_LDKThirtyTwoBytes(array: val));
80 public func get_transaction_output_index() -> Option_u32Z {
82 return Option_u32Z(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
83 HTLCOutputInCommitment_get_transaction_output_index(this_ptrPointer)
87 public func set_transaction_output_index(val: Option_u32Z) -> Void {
89 let this_ptrPointer = UnsafeMutablePointer<LDKHTLCOutputInCommitment>.allocate(capacity: 1)
90 this_ptrPointer.initialize(to: self.cOpaqueStruct!)
92 return HTLCOutputInCommitment_set_transaction_output_index(this_ptrPointer, val.cOpaqueStruct!);
95 public func clone(orig: HTLCOutputInCommitment) -> HTLCOutputInCommitment {
97 return withUnsafePointer(to: orig.cOpaqueStruct!) { (origPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
98 HTLCOutputInCommitment(pointer: HTLCOutputInCommitment_clone(origPointer))
102 public func write(obj: HTLCOutputInCommitment) -> [UInt8] {
104 return Bindings.LDKCVec_u8Z_to_array(nativeType: withUnsafePointer(to: obj.cOpaqueStruct!) { (objPointer: UnsafePointer<LDKHTLCOutputInCommitment>) in
105 HTLCOutputInCommitment_write(objPointer)
109 public func read(ser: [UInt8]) -> Result_HTLCOutputInCommitmentDecodeErrorZ {
111 return Result_HTLCOutputInCommitmentDecodeErrorZ(pointer: HTLCOutputInCommitment_read(Bindings.new_LDKu8slice(array: ser)));
116 if self.cOpaqueStruct?.is_owned == false {
120 HTLCOutputInCommitment_free(self.cOpaqueStruct!)
126 /* STRUCT_METHODS_END */