@@ -2,8 +2,8 @@ package com.reactnativeldk
22import com.facebook.react.bridge.Arguments
33import com.facebook.react.bridge.Promise
44import com.facebook.react.bridge.WritableMap
5+ import org.ldk.structs.Invoice
56import org.ldk.structs.Option_u64Z
6- import org.ldk.structs.Result_InvoiceParseOrSemanticErrorZ.Result_InvoiceParseOrSemanticErrorZ_OK
77
88fun handleResolve (promise : Promise , res : LdkCallbackResponses ) {
99 LdkEventEmitter .send(EventTypes .swift_log, " Success: ${res} " )
@@ -30,27 +30,26 @@ fun String.hexa(): ByteArray {
3030 .map { it.toInt(16 ).toByte() }
3131 .toByteArray()
3232}
33- fun Result_InvoiceParseOrSemanticErrorZ_OK .json (): WritableMap {
33+ fun Invoice .json (): WritableMap {
3434 val result = Arguments .createMap()
35- val inv = this .res
36- val signedInv = inv .into_signed_raw()
35+ val signedInv = this .into_signed_raw()
3736 val rawInvoice = signedInv.raw_invoice()
3837
39- result.putDouble(" amount_milli_satoshis" , (this .res. amount_milli_satoshis() as Option_u64Z .Some ).some.toDouble())
38+ result.putDouble(" amount_milli_satoshis" , (this .amount_milli_satoshis() as Option_u64Z .Some ).some.toDouble())
4039 result.putString(" description" , rawInvoice.description()?.into_inner())
4140 result.putBoolean(" check_signature" , signedInv.check_signature())
42- result.putBoolean(" is_expired" , inv .is_expired)
43- result.putInt(" duration_since_epoch" , inv .duration_since_epoch().toInt())
44- result.putInt(" expiry_time" , inv .expiry_time().toInt())
45- result.putInt(" min_final_cltv_expiry" , inv .min_final_cltv_expiry().toInt())
41+ result.putBoolean(" is_expired" , this .is_expired)
42+ result.putInt(" duration_since_epoch" , this .duration_since_epoch().toInt())
43+ result.putInt(" expiry_time" , this .expiry_time().toInt())
44+ result.putInt(" min_final_cltv_expiry" , this .min_final_cltv_expiry().toInt())
4645 result.putString(" payee_pub_key" , rawInvoice.payee_pub_key()?._a ?.hexEncodedString())
47- result.putString(" recover_payee_pub_key" , inv .recover_payee_pub_key().hexEncodedString())
48- result.putString(" payment_hash" , inv .payment_hash().hexEncodedString())
49- result.putString(" payment_secret" , inv .payment_secret().hexEncodedString())
50- result.putInt(" timestamp" , inv .timestamp().toInt())
51- result.putString(" features" , inv .features()?.write()?.hexEncodedString())
52- result.putInt(" currency" , inv .currency().ordinal)
53- result.putString(" features " , signedInv.to_str())
46+ result.putString(" recover_payee_pub_key" , this .recover_payee_pub_key().hexEncodedString())
47+ result.putString(" payment_hash" , this .payment_hash().hexEncodedString())
48+ result.putString(" payment_secret" , this .payment_secret().hexEncodedString())
49+ result.putInt(" timestamp" , this .timestamp().toInt())
50+ result.putString(" features" , this .features()?.write()?.hexEncodedString())
51+ result.putInt(" currency" , this .currency().ordinal)
52+ result.putString(" to_str " , signedInv.to_str())
5453
5554 return result
5655}
0 commit comments