From f8be09aec376fd75325649eb98a58c4cf076bedf Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 13 Aug 2024 11:30:19 +0200 Subject: [PATCH] feat: expose funding_output_index --- example/ios/Podfile.lock | 4 ++-- lib/android/src/main/java/com/reactnativeldk/Helpers.kt | 1 + lib/ios/Helpers.swift | 1 + lib/package.json | 2 +- lib/src/utils/types.ts | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f88f30a9..eb5623e8 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -316,7 +316,7 @@ PODS: - React-jsinspector (0.72.4) - React-logger (0.72.4): - glog - - react-native-ldk (0.0.145): + - react-native-ldk (0.0.148): - React - react-native-randombytes (3.6.1): - React-Core @@ -621,7 +621,7 @@ SPEC CHECKSUMS: React-jsiexecutor: c7f826e40fa9cab5d37cab6130b1af237332b594 React-jsinspector: aaed4cf551c4a1c98092436518c2d267b13a673f React-logger: da1ebe05ae06eb6db4b162202faeafac4b435e77 - react-native-ldk: 496216796eafbd77c43cd5228342460a242cf7ed + react-native-ldk: fda4d4381d40401bdc5c3a9965937d19b232ed08 react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846 react-native-tcp-socket: c1b7297619616b4c9caae6889bcb0aba78086989 React-NativeModulesApple: edb5ace14f73f4969df6e7b1f3e41bef0012740f diff --git a/lib/android/src/main/java/com/reactnativeldk/Helpers.kt b/lib/android/src/main/java/com/reactnativeldk/Helpers.kt index 992683bb..d4452427 100644 --- a/lib/android/src/main/java/com/reactnativeldk/Helpers.kt +++ b/lib/android/src/main/java/com/reactnativeldk/Helpers.kt @@ -123,6 +123,7 @@ val ChannelDetails.asJson: WritableMap result.putInt("balance_sat", (_balance_msat / 1000).toInt()) result.putHexString("counterparty_node_id", _counterparty._node_id) result.putHexString("funding_txid", _funding_txo?._txid?.reversed()?.toByteArray()) + _funding_txo?._index?.toInt()?.let { result.putInt("funding_output_index", it) } result.putHexString("channel_type", _channel_type?.write()) result.putString("user_channel_id", _user_channel_id.leBytes.hexEncodedString()) result.putInt("confirmations_required", (_confirmations_required as Option_u32Z.Some).some) diff --git a/lib/ios/Helpers.swift b/lib/ios/Helpers.swift index 328210fd..e9170bd7 100644 --- a/lib/ios/Helpers.swift +++ b/lib/ios/Helpers.swift @@ -122,6 +122,7 @@ extension ChannelDetails { "balance_sat": getBalanceMsat() / 1000, "counterparty_node_id": Data(getCounterparty().getNodeId()).hexEncodedString(), "funding_txid": Data(getFundingTxo()?.getTxid()?.reversed() ?? []).hexEncodedString(), + "funding_output_index": getFundingTxo()?.getIndex() as Any, // Optional number "channel_type": Data(getChannelType()?.write() ?? []).hexEncodedString(), "user_channel_id": Data(getUserChannelId()).hexEncodedString(), //String "confirmations_required": getConfirmationsRequired() as Any, // Optional number diff --git a/lib/package.json b/lib/package.json index f5babd76..0aa9006d 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,7 +1,7 @@ { "name": "@synonymdev/react-native-ldk", "title": "React Native LDK", - "version": "0.0.146", + "version": "0.0.148", "description": "React Native wrapper for LDK", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/lib/src/utils/types.ts b/lib/src/utils/types.ts index 7c86f9e1..d9be84aa 100644 --- a/lib/src/utils/types.ts +++ b/lib/src/utils/types.ts @@ -150,6 +150,7 @@ export type TChannel = { balance_sat: number; counterparty_node_id: string; funding_txid?: string; + funding_output_index? : number; channel_type?: string; user_channel_id: string; confirmations_required?: number;