@@ -170,12 +170,12 @@ extension Bindings {
170
170
}
171
171
172
172
/// 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 {
174
174
// native call variable prep
175
175
176
176
177
177
// native method call
178
- let nativeCallResult = Balance_claimable_on_channel_close ( claimableAmountSatoshis )
178
+ let nativeCallResult = Balance_claimable_on_channel_close ( amountSatoshis )
179
179
180
180
// cleanup
181
181
@@ -189,14 +189,14 @@ extension Bindings {
189
189
}
190
190
191
191
/// 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
+ {
195
195
// native call variable prep
196
196
197
197
198
198
// native method call
199
- let nativeCallResult = Balance_claimable_awaiting_confirmations ( claimableAmountSatoshis , confirmationHeight)
199
+ let nativeCallResult = Balance_claimable_awaiting_confirmations ( amountSatoshis , confirmationHeight)
200
200
201
201
// cleanup
202
202
@@ -210,17 +210,31 @@ extension Bindings {
210
210
}
211
211
212
212
/// 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 {
216
216
// native call variable prep
217
217
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
+
218
224
219
225
// 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!)
221
229
222
230
// cleanup
223
231
232
+ // for elided types, we need this
233
+ paymentHashPrimitiveWrapper. noOpRetain ( )
234
+
235
+ // for elided types, we need this
236
+ paymentPreimagePrimitiveWrapper. noOpRetain ( )
237
+
224
238
225
239
// return value (do some wrapping)
226
240
let returnValue = Balance (
@@ -231,17 +245,24 @@ extension Bindings {
231
245
}
232
246
233
247
/// 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 {
237
251
// native call variable prep
238
252
253
+ let paymentHashPrimitiveWrapper = ThirtyTwoBytes (
254
+ value: paymentHash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " )
255
+
239
256
240
257
// 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!)
242
260
243
261
// cleanup
244
262
263
+ // for elided types, we need this
264
+ paymentHashPrimitiveWrapper. noOpRetain ( )
265
+
245
266
246
267
// return value (do some wrapping)
247
268
let returnValue = Balance (
@@ -252,17 +273,24 @@ extension Bindings {
252
273
}
253
274
254
275
/// 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 {
258
279
// native call variable prep
259
280
281
+ let paymentHashPrimitiveWrapper = ThirtyTwoBytes (
282
+ value: paymentHash, instantiationContext: " Balance.swift:: \( #function) : \( #line) " )
283
+
260
284
261
285
// 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!)
263
288
264
289
// cleanup
265
290
291
+ // for elided types, we need this
292
+ paymentHashPrimitiveWrapper. noOpRetain ( )
293
+
266
294
267
295
// return value (do some wrapping)
268
296
let returnValue = Balance (
@@ -273,12 +301,12 @@ extension Bindings {
273
301
}
274
302
275
303
/// 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 {
277
305
// native call variable prep
278
306
279
307
280
308
// native method call
281
- let nativeCallResult = Balance_counterparty_revoked_output_claimable ( claimableAmountSatoshis )
309
+ let nativeCallResult = Balance_counterparty_revoked_output_claimable ( amountSatoshis )
282
310
283
311
// cleanup
284
312
@@ -318,6 +346,33 @@ extension Bindings {
318
346
return returnValue
319
347
}
320
348
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
+
321
376
322
377
public func getValueAsClaimableOnChannelClose( ) -> ClaimableOnChannelClose ? {
323
378
if self . cType? . tag != LDKBalance_ClaimableOnChannelClose {
@@ -463,9 +518,9 @@ extension Bindings {
463
518
464
519
/// The amount available to claim, in satoshis, excluding the on-chain fees which will be
465
520
/// required to do so.
466
- public func getClaimableAmountSatoshis ( ) -> UInt64 {
521
+ public func getAmountSatoshis ( ) -> UInt64 {
467
522
// return value (do some wrapping)
468
- let returnValue = self . cType!. claimable_amount_satoshis
523
+ let returnValue = self . cType!. amount_satoshis
469
524
470
525
return returnValue
471
526
}
@@ -533,9 +588,9 @@ extension Bindings {
533
588
534
589
/// The amount available to claim, in satoshis, possibly excluding the on-chain fees which
535
590
/// were spent in broadcasting the transaction.
536
- public func getClaimableAmountSatoshis ( ) -> UInt64 {
591
+ public func getAmountSatoshis ( ) -> UInt64 {
537
592
// return value (do some wrapping)
538
- let returnValue = self . cType!. claimable_amount_satoshis
593
+ let returnValue = self . cType!. amount_satoshis
539
594
540
595
return returnValue
541
596
}
@@ -611,9 +666,9 @@ extension Bindings {
611
666
612
667
/// The amount available to claim, in satoshis, excluding the on-chain fees which will be
613
668
/// required to do so.
614
- public func getClaimableAmountSatoshis ( ) -> UInt64 {
669
+ public func getAmountSatoshis ( ) -> UInt64 {
615
670
// return value (do some wrapping)
616
- let returnValue = self . cType!. claimable_amount_satoshis
671
+ let returnValue = self . cType!. amount_satoshis
617
672
618
673
return returnValue
619
674
}
@@ -627,6 +682,30 @@ extension Bindings {
627
682
return returnValue
628
683
}
629
684
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
+
630
709
631
710
}
632
711
@@ -690,9 +769,9 @@ extension Bindings {
690
769
691
770
/// The amount potentially available to claim, in satoshis, excluding the on-chain fees
692
771
/// which will be required to do so.
693
- public func getClaimableAmountSatoshis ( ) -> UInt64 {
772
+ public func getAmountSatoshis ( ) -> UInt64 {
694
773
// return value (do some wrapping)
695
- let returnValue = self . cType!. claimable_amount_satoshis
774
+ let returnValue = self . cType!. amount_satoshis
696
775
697
776
return returnValue
698
777
}
@@ -706,6 +785,18 @@ extension Bindings {
706
785
return returnValue
707
786
}
708
787
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
+
709
800
710
801
}
711
802
@@ -769,9 +860,9 @@ extension Bindings {
769
860
770
861
/// The amount potentially available to claim, in satoshis, excluding the on-chain fees
771
862
/// which will be required to do so.
772
- public func getClaimableAmountSatoshis ( ) -> UInt64 {
863
+ public func getAmountSatoshis ( ) -> UInt64 {
773
864
// return value (do some wrapping)
774
- let returnValue = self . cType!. claimable_amount_satoshis
865
+ let returnValue = self . cType!. amount_satoshis
775
866
776
867
return returnValue
777
868
}
@@ -785,6 +876,18 @@ extension Bindings {
785
876
return returnValue
786
877
}
787
878
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
+
788
891
789
892
}
790
893
@@ -850,9 +953,9 @@ extension Bindings {
850
953
///
851
954
/// Note that for outputs from HTLC balances this may be excluding some on-chain fees that
852
955
/// were already spent.
853
- public func getClaimableAmountSatoshis ( ) -> UInt64 {
956
+ public func getAmountSatoshis ( ) -> UInt64 {
854
957
// return value (do some wrapping)
855
- let returnValue = self . cType!. claimable_amount_satoshis
958
+ let returnValue = self . cType!. amount_satoshis
856
959
857
960
return returnValue
858
961
}
0 commit comments