@@ -170,12 +170,12 @@ extension Bindings {
170170 }
171171
172172 /// Utility method to constructs a new ClaimableOnChannelClose-variant Balance
173- public class func initWithClaimableOnChannelClose( claimableAmountSatoshis : UInt64 ) -> Balance {
173+ public class func initWithClaimableOnChannelClose( amountSatoshis : UInt64 ) -> Balance {
174174 // native call variable prep
175175
176176
177177 // native method call
178- let nativeCallResult = Balance_claimable_on_channel_close ( claimableAmountSatoshis )
178+ let nativeCallResult = Balance_claimable_on_channel_close ( amountSatoshis )
179179
180180 // cleanup
181181
@@ -189,14 +189,14 @@ extension Bindings {
189189 }
190190
191191 /// Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
192- public class func initWithClaimableAwaitingConfirmations(
193- claimableAmountSatoshis : UInt64 , confirmationHeight : UInt32
194- ) -> Balance {
192+ public class func initWithClaimableAwaitingConfirmations( amountSatoshis : UInt64 , confirmationHeight : UInt32 )
193+ -> Balance
194+ {
195195 // native call variable prep
196196
197197
198198 // native method call
199- let nativeCallResult = Balance_claimable_awaiting_confirmations ( claimableAmountSatoshis , confirmationHeight)
199+ let nativeCallResult = Balance_claimable_awaiting_confirmations ( amountSatoshis , confirmationHeight)
200200
201201 // cleanup
202202
@@ -210,17 +210,31 @@ extension Bindings {
210210 }
211211
212212 /// Utility method to constructs a new ContentiousClaimable-variant Balance
213- public class func initWithContentiousClaimable( claimableAmountSatoshis : UInt64 , timeoutHeight : UInt32 )
214- -> Balance
215- {
213+ public class func initWithContentiousClaimable(
214+ amountSatoshis : UInt64 , timeoutHeight : UInt32 , paymentHash : [ UInt8 ] , paymentPreimage : [ UInt8 ]
215+ ) -> Balance {
216216 // native call variable prep
217217
218+ let paymentHashPrimitiveWrapper = ThirtyTwoBytes (
219+ value: paymentHash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " )
220+
221+ let paymentPreimagePrimitiveWrapper = ThirtyTwoBytes (
222+ value: paymentPreimage, instantiationContext: " Balance.swift:: \( #function) : \( #line) " )
223+
218224
219225 // native method call
220- let nativeCallResult = Balance_contentious_claimable ( claimableAmountSatoshis, timeoutHeight)
226+ let nativeCallResult = Balance_contentious_claimable (
227+ amountSatoshis, timeoutHeight, paymentHashPrimitiveWrapper. cType!,
228+ paymentPreimagePrimitiveWrapper. cType!)
221229
222230 // cleanup
223231
232+ // for elided types, we need this
233+ paymentHashPrimitiveWrapper. noOpRetain ( )
234+
235+ // for elided types, we need this
236+ paymentPreimagePrimitiveWrapper. noOpRetain ( )
237+
224238
225239 // return value (do some wrapping)
226240 let returnValue = Balance (
@@ -231,17 +245,24 @@ extension Bindings {
231245 }
232246
233247 /// Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
234- public class func initWithMaybeTimeoutClaimableHtlc( claimableAmountSatoshis : UInt64 , claimableHeight : UInt32 )
235- -> Balance
236- {
248+ public class func initWithMaybeTimeoutClaimableHtlc(
249+ amountSatoshis : UInt64 , claimableHeight : UInt32 , paymentHash : [ UInt8 ]
250+ ) -> Balance {
237251 // native call variable prep
238252
253+ let paymentHashPrimitiveWrapper = ThirtyTwoBytes (
254+ value: paymentHash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " )
255+
239256
240257 // native method call
241- let nativeCallResult = Balance_maybe_timeout_claimable_htlc ( claimableAmountSatoshis, claimableHeight)
258+ let nativeCallResult = Balance_maybe_timeout_claimable_htlc (
259+ amountSatoshis, claimableHeight, paymentHashPrimitiveWrapper. cType!)
242260
243261 // cleanup
244262
263+ // for elided types, we need this
264+ paymentHashPrimitiveWrapper. noOpRetain ( )
265+
245266
246267 // return value (do some wrapping)
247268 let returnValue = Balance (
@@ -252,17 +273,24 @@ extension Bindings {
252273 }
253274
254275 /// Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
255- public class func initWithMaybePreimageClaimableHtlc( claimableAmountSatoshis : UInt64 , expiryHeight : UInt32 )
256- -> Balance
257- {
276+ public class func initWithMaybePreimageClaimableHtlc(
277+ amountSatoshis : UInt64 , expiryHeight : UInt32 , paymentHash : [ UInt8 ]
278+ ) -> Balance {
258279 // native call variable prep
259280
281+ let paymentHashPrimitiveWrapper = ThirtyTwoBytes (
282+ value: paymentHash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " )
283+
260284
261285 // native method call
262- let nativeCallResult = Balance_maybe_preimage_claimable_htlc ( claimableAmountSatoshis, expiryHeight)
286+ let nativeCallResult = Balance_maybe_preimage_claimable_htlc (
287+ amountSatoshis, expiryHeight, paymentHashPrimitiveWrapper. cType!)
263288
264289 // cleanup
265290
291+ // for elided types, we need this
292+ paymentHashPrimitiveWrapper. noOpRetain ( )
293+
266294
267295 // return value (do some wrapping)
268296 let returnValue = Balance (
@@ -273,12 +301,12 @@ extension Bindings {
273301 }
274302
275303 /// Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
276- public class func initWithCounterpartyRevokedOutputClaimable( claimableAmountSatoshis : UInt64 ) -> Balance {
304+ public class func initWithCounterpartyRevokedOutputClaimable( amountSatoshis : UInt64 ) -> Balance {
277305 // native call variable prep
278306
279307
280308 // native method call
281- let nativeCallResult = Balance_counterparty_revoked_output_claimable ( claimableAmountSatoshis )
309+ let nativeCallResult = Balance_counterparty_revoked_output_claimable ( amountSatoshis )
282310
283311 // cleanup
284312
@@ -318,6 +346,33 @@ extension Bindings {
318346 return returnValue
319347 }
320348
349+ /// The amount claimable, in satoshis. This excludes balances that we are unsure if we are able
350+ /// to claim, this is because we are waiting for a preimage or for a timeout to expire. For more
351+ /// information on these balances see [`Balance::MaybeTimeoutClaimableHTLC`] and
352+ /// [`Balance::MaybePreimageClaimableHTLC`].
353+ ///
354+ /// On-chain fees required to claim the balance are not included in this amount.
355+ public func claimableAmountSatoshis( ) -> UInt64 {
356+ // native call variable prep
357+
358+
359+ // native method call
360+ let nativeCallResult =
361+ withUnsafePointer ( to: self . cType!) { ( thisArgPointer: UnsafePointer < LDKBalance > ) in
362+ Balance_claimable_amount_satoshis ( thisArgPointer)
363+ }
364+
365+
366+ // cleanup
367+
368+
369+ // return value (do some wrapping)
370+ let returnValue = nativeCallResult
371+
372+
373+ return returnValue
374+ }
375+
321376
322377 public func getValueAsClaimableOnChannelClose( ) -> ClaimableOnChannelClose ? {
323378 if self . cType? . tag != LDKBalance_ClaimableOnChannelClose {
@@ -463,9 +518,9 @@ extension Bindings {
463518
464519 /// The amount available to claim, in satoshis, excluding the on-chain fees which will be
465520 /// required to do so.
466- public func getClaimableAmountSatoshis ( ) -> UInt64 {
521+ public func getAmountSatoshis ( ) -> UInt64 {
467522 // return value (do some wrapping)
468- let returnValue = self . cType!. claimable_amount_satoshis
523+ let returnValue = self . cType!. amount_satoshis
469524
470525 return returnValue
471526 }
@@ -533,9 +588,9 @@ extension Bindings {
533588
534589 /// The amount available to claim, in satoshis, possibly excluding the on-chain fees which
535590 /// were spent in broadcasting the transaction.
536- public func getClaimableAmountSatoshis ( ) -> UInt64 {
591+ public func getAmountSatoshis ( ) -> UInt64 {
537592 // return value (do some wrapping)
538- let returnValue = self . cType!. claimable_amount_satoshis
593+ let returnValue = self . cType!. amount_satoshis
539594
540595 return returnValue
541596 }
@@ -611,9 +666,9 @@ extension Bindings {
611666
612667 /// The amount available to claim, in satoshis, excluding the on-chain fees which will be
613668 /// required to do so.
614- public func getClaimableAmountSatoshis ( ) -> UInt64 {
669+ public func getAmountSatoshis ( ) -> UInt64 {
615670 // return value (do some wrapping)
616- let returnValue = self . cType!. claimable_amount_satoshis
671+ let returnValue = self . cType!. amount_satoshis
617672
618673 return returnValue
619674 }
@@ -627,6 +682,30 @@ extension Bindings {
627682 return returnValue
628683 }
629684
685+ /// The payment hash that locks this HTLC.
686+ public func getPaymentHash( ) -> [ UInt8 ] {
687+ // return value (do some wrapping)
688+ let returnValue = ThirtyTwoBytes (
689+ cType: self . cType!. payment_hash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " ,
690+ anchor: self
691+ )
692+ . getValue ( )
693+
694+ return returnValue
695+ }
696+
697+ /// The preimage that can be used to claim this HTLC.
698+ public func getPaymentPreimage( ) -> [ UInt8 ] {
699+ // return value (do some wrapping)
700+ let returnValue = ThirtyTwoBytes (
701+ cType: self . cType!. payment_preimage, instantiationContext: " Balance.swift:: \( #function) : \( #line) " ,
702+ anchor: self
703+ )
704+ . getValue ( )
705+
706+ return returnValue
707+ }
708+
630709
631710 }
632711
@@ -690,9 +769,9 @@ extension Bindings {
690769
691770 /// The amount potentially available to claim, in satoshis, excluding the on-chain fees
692771 /// which will be required to do so.
693- public func getClaimableAmountSatoshis ( ) -> UInt64 {
772+ public func getAmountSatoshis ( ) -> UInt64 {
694773 // return value (do some wrapping)
695- let returnValue = self . cType!. claimable_amount_satoshis
774+ let returnValue = self . cType!. amount_satoshis
696775
697776 return returnValue
698777 }
@@ -706,6 +785,18 @@ extension Bindings {
706785 return returnValue
707786 }
708787
788+ /// The payment hash whose preimage our counterparty needs to claim this HTLC.
789+ public func getPaymentHash( ) -> [ UInt8 ] {
790+ // return value (do some wrapping)
791+ let returnValue = ThirtyTwoBytes (
792+ cType: self . cType!. payment_hash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " ,
793+ anchor: self
794+ )
795+ . getValue ( )
796+
797+ return returnValue
798+ }
799+
709800
710801 }
711802
@@ -769,9 +860,9 @@ extension Bindings {
769860
770861 /// The amount potentially available to claim, in satoshis, excluding the on-chain fees
771862 /// which will be required to do so.
772- public func getClaimableAmountSatoshis ( ) -> UInt64 {
863+ public func getAmountSatoshis ( ) -> UInt64 {
773864 // return value (do some wrapping)
774- let returnValue = self . cType!. claimable_amount_satoshis
865+ let returnValue = self . cType!. amount_satoshis
775866
776867 return returnValue
777868 }
@@ -785,6 +876,18 @@ extension Bindings {
785876 return returnValue
786877 }
787878
879+ /// The payment hash whose preimage we need to claim this HTLC.
880+ public func getPaymentHash( ) -> [ UInt8 ] {
881+ // return value (do some wrapping)
882+ let returnValue = ThirtyTwoBytes (
883+ cType: self . cType!. payment_hash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " ,
884+ anchor: self
885+ )
886+ . getValue ( )
887+
888+ return returnValue
889+ }
890+
788891
789892 }
790893
@@ -850,9 +953,9 @@ extension Bindings {
850953 ///
851954 /// Note that for outputs from HTLC balances this may be excluding some on-chain fees that
852955 /// were already spent.
853- public func getClaimableAmountSatoshis ( ) -> UInt64 {
956+ public func getAmountSatoshis ( ) -> UInt64 {
854957 // return value (do some wrapping)
855- let returnValue = self . cType!. claimable_amount_satoshis
958+ let returnValue = self . cType!. amount_satoshis
856959
857960 return returnValue
858961 }
0 commit comments