react-native-nitro-ark 0.0.37 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,36 +16,36 @@ namespace margelo::nitro::nitroark {
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
17
  prototype.registerHybridMethod("createMnemonic", &HybridNitroArkSpec::createMnemonic);
18
18
  prototype.registerHybridMethod("loadWallet", &HybridNitroArkSpec::loadWallet);
19
- prototype.registerHybridMethod("closeWallet", &HybridNitroArkSpec::closeWallet);
20
19
  prototype.registerHybridMethod("isWalletLoaded", &HybridNitroArkSpec::isWalletLoaded);
20
+ prototype.registerHybridMethod("closeWallet", &HybridNitroArkSpec::closeWallet);
21
21
  prototype.registerHybridMethod("persistConfig", &HybridNitroArkSpec::persistConfig);
22
22
  prototype.registerHybridMethod("maintenance", &HybridNitroArkSpec::maintenance);
23
23
  prototype.registerHybridMethod("sync", &HybridNitroArkSpec::sync);
24
- prototype.registerHybridMethod("syncArk", &HybridNitroArkSpec::syncArk);
24
+ prototype.registerHybridMethod("syncExits", &HybridNitroArkSpec::syncExits);
25
25
  prototype.registerHybridMethod("syncRounds", &HybridNitroArkSpec::syncRounds);
26
26
  prototype.registerHybridMethod("getArkInfo", &HybridNitroArkSpec::getArkInfo);
27
- prototype.registerHybridMethod("onchainBalance", &HybridNitroArkSpec::onchainBalance);
28
27
  prototype.registerHybridMethod("offchainBalance", &HybridNitroArkSpec::offchainBalance);
29
- prototype.registerHybridMethod("getOnchainAddress", &HybridNitroArkSpec::getOnchainAddress);
30
- prototype.registerHybridMethod("getOnchainUtxos", &HybridNitroArkSpec::getOnchainUtxos);
31
- prototype.registerHybridMethod("getVtxoPubkey", &HybridNitroArkSpec::getVtxoPubkey);
28
+ prototype.registerHybridMethod("deriveStoreNextKeypair", &HybridNitroArkSpec::deriveStoreNextKeypair);
29
+ prototype.registerHybridMethod("peakKeyPair", &HybridNitroArkSpec::peakKeyPair);
32
30
  prototype.registerHybridMethod("getVtxos", &HybridNitroArkSpec::getVtxos);
33
- prototype.registerHybridMethod("sendOnchain", &HybridNitroArkSpec::sendOnchain);
34
- prototype.registerHybridMethod("drainOnchain", &HybridNitroArkSpec::drainOnchain);
35
- prototype.registerHybridMethod("sendManyOnchain", &HybridNitroArkSpec::sendManyOnchain);
31
+ prototype.registerHybridMethod("onchainBalance", &HybridNitroArkSpec::onchainBalance);
32
+ prototype.registerHybridMethod("onchainSync", &HybridNitroArkSpec::onchainSync);
33
+ prototype.registerHybridMethod("onchainListUnspent", &HybridNitroArkSpec::onchainListUnspent);
34
+ prototype.registerHybridMethod("onchainUtxos", &HybridNitroArkSpec::onchainUtxos);
35
+ prototype.registerHybridMethod("onchainAddress", &HybridNitroArkSpec::onchainAddress);
36
+ prototype.registerHybridMethod("onchainSend", &HybridNitroArkSpec::onchainSend);
37
+ prototype.registerHybridMethod("onchainDrain", &HybridNitroArkSpec::onchainDrain);
38
+ prototype.registerHybridMethod("onchainSendMany", &HybridNitroArkSpec::onchainSendMany);
36
39
  prototype.registerHybridMethod("boardAmount", &HybridNitroArkSpec::boardAmount);
37
40
  prototype.registerHybridMethod("boardAll", &HybridNitroArkSpec::boardAll);
38
41
  prototype.registerHybridMethod("sendArkoorPayment", &HybridNitroArkSpec::sendArkoorPayment);
39
- prototype.registerHybridMethod("sendBolt11Payment", &HybridNitroArkSpec::sendBolt11Payment);
42
+ prototype.registerHybridMethod("sendLightningPayment", &HybridNitroArkSpec::sendLightningPayment);
40
43
  prototype.registerHybridMethod("sendLnaddr", &HybridNitroArkSpec::sendLnaddr);
41
- prototype.registerHybridMethod("sendRoundOnchain", &HybridNitroArkSpec::sendRoundOnchain);
44
+ prototype.registerHybridMethod("sendRoundOnchainPayment", &HybridNitroArkSpec::sendRoundOnchainPayment);
42
45
  prototype.registerHybridMethod("bolt11Invoice", &HybridNitroArkSpec::bolt11Invoice);
43
- prototype.registerHybridMethod("claimBolt11Payment", &HybridNitroArkSpec::claimBolt11Payment);
46
+ prototype.registerHybridMethod("finishLightningReceive", &HybridNitroArkSpec::finishLightningReceive);
44
47
  prototype.registerHybridMethod("offboardSpecific", &HybridNitroArkSpec::offboardSpecific);
45
48
  prototype.registerHybridMethod("offboardAll", &HybridNitroArkSpec::offboardAll);
46
- prototype.registerHybridMethod("exitStartSpecific", &HybridNitroArkSpec::exitStartSpecific);
47
- prototype.registerHybridMethod("exitStartAll", &HybridNitroArkSpec::exitStartAll);
48
- prototype.registerHybridMethod("exitProgressOnce", &HybridNitroArkSpec::exitProgressOnce);
49
49
  });
50
50
  }
51
51
 
@@ -19,14 +19,20 @@ namespace margelo::nitro::nitroark { struct BarkCreateOpts; }
19
19
  namespace margelo::nitro::nitroark { struct BarkConfigOpts; }
20
20
  // Forward declaration of `BarkArkInfo` to properly resolve imports.
21
21
  namespace margelo::nitro::nitroark { struct BarkArkInfo; }
22
+ // Forward declaration of `OffchainBalanceResult` to properly resolve imports.
23
+ namespace margelo::nitro::nitroark { struct OffchainBalanceResult; }
24
+ // Forward declaration of `BarkVtxo` to properly resolve imports.
25
+ namespace margelo::nitro::nitroark { struct BarkVtxo; }
26
+ // Forward declaration of `OnchainBalanceResult` to properly resolve imports.
27
+ namespace margelo::nitro::nitroark { struct OnchainBalanceResult; }
22
28
  // Forward declaration of `OnchainPaymentResult` to properly resolve imports.
23
29
  namespace margelo::nitro::nitroark { struct OnchainPaymentResult; }
24
30
  // Forward declaration of `BarkSendManyOutput` to properly resolve imports.
25
31
  namespace margelo::nitro::nitroark { struct BarkSendManyOutput; }
26
32
  // Forward declaration of `ArkoorPaymentResult` to properly resolve imports.
27
33
  namespace margelo::nitro::nitroark { struct ArkoorPaymentResult; }
28
- // Forward declaration of `Bolt11PaymentResult` to properly resolve imports.
29
- namespace margelo::nitro::nitroark { struct Bolt11PaymentResult; }
34
+ // Forward declaration of `LightningPaymentResult` to properly resolve imports.
35
+ namespace margelo::nitro::nitroark { struct LightningPaymentResult; }
30
36
  // Forward declaration of `LnurlPaymentResult` to properly resolve imports.
31
37
  namespace margelo::nitro::nitroark { struct LnurlPaymentResult; }
32
38
 
@@ -35,12 +41,15 @@ namespace margelo::nitro::nitroark { struct LnurlPaymentResult; }
35
41
  #include "BarkCreateOpts.hpp"
36
42
  #include "BarkConfigOpts.hpp"
37
43
  #include "BarkArkInfo.hpp"
38
- #include <optional>
39
- #include "OnchainPaymentResult.hpp"
44
+ #include "OffchainBalanceResult.hpp"
40
45
  #include <vector>
46
+ #include "BarkVtxo.hpp"
47
+ #include "OnchainBalanceResult.hpp"
48
+ #include "OnchainPaymentResult.hpp"
49
+ #include <optional>
41
50
  #include "BarkSendManyOutput.hpp"
42
51
  #include "ArkoorPaymentResult.hpp"
43
- #include "Bolt11PaymentResult.hpp"
52
+ #include "LightningPaymentResult.hpp"
44
53
  #include "LnurlPaymentResult.hpp"
45
54
 
46
55
  namespace margelo::nitro::nitroark {
@@ -76,36 +85,36 @@ namespace margelo::nitro::nitroark {
76
85
  // Methods
77
86
  virtual std::shared_ptr<Promise<std::string>> createMnemonic() = 0;
78
87
  virtual std::shared_ptr<Promise<void>> loadWallet(const std::string& datadir, const BarkCreateOpts& opts) = 0;
79
- virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
80
88
  virtual std::shared_ptr<Promise<bool>> isWalletLoaded() = 0;
89
+ virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
81
90
  virtual std::shared_ptr<Promise<void>> persistConfig(const BarkConfigOpts& opts) = 0;
82
91
  virtual std::shared_ptr<Promise<void>> maintenance() = 0;
83
92
  virtual std::shared_ptr<Promise<void>> sync() = 0;
84
- virtual std::shared_ptr<Promise<void>> syncArk() = 0;
93
+ virtual std::shared_ptr<Promise<void>> syncExits() = 0;
85
94
  virtual std::shared_ptr<Promise<void>> syncRounds() = 0;
86
95
  virtual std::shared_ptr<Promise<BarkArkInfo>> getArkInfo() = 0;
87
- virtual std::shared_ptr<Promise<double>> onchainBalance() = 0;
88
- virtual std::shared_ptr<Promise<double>> offchainBalance() = 0;
89
- virtual std::shared_ptr<Promise<std::string>> getOnchainAddress() = 0;
90
- virtual std::shared_ptr<Promise<std::string>> getOnchainUtxos(bool no_sync) = 0;
91
- virtual std::shared_ptr<Promise<std::string>> getVtxoPubkey(std::optional<double> index) = 0;
92
- virtual std::shared_ptr<Promise<std::string>> getVtxos(bool no_sync) = 0;
93
- virtual std::shared_ptr<Promise<OnchainPaymentResult>> sendOnchain(const std::string& destination, double amountSat) = 0;
94
- virtual std::shared_ptr<Promise<std::string>> drainOnchain(const std::string& destination, bool no_sync) = 0;
95
- virtual std::shared_ptr<Promise<std::string>> sendManyOnchain(const std::vector<BarkSendManyOutput>& outputs, bool no_sync) = 0;
96
+ virtual std::shared_ptr<Promise<OffchainBalanceResult>> offchainBalance() = 0;
97
+ virtual std::shared_ptr<Promise<std::string>> deriveStoreNextKeypair() = 0;
98
+ virtual std::shared_ptr<Promise<std::string>> peakKeyPair(double index) = 0;
99
+ virtual std::shared_ptr<Promise<std::vector<BarkVtxo>>> getVtxos() = 0;
100
+ virtual std::shared_ptr<Promise<OnchainBalanceResult>> onchainBalance() = 0;
101
+ virtual std::shared_ptr<Promise<void>> onchainSync() = 0;
102
+ virtual std::shared_ptr<Promise<std::string>> onchainListUnspent() = 0;
103
+ virtual std::shared_ptr<Promise<std::string>> onchainUtxos() = 0;
104
+ virtual std::shared_ptr<Promise<std::string>> onchainAddress() = 0;
105
+ virtual std::shared_ptr<Promise<OnchainPaymentResult>> onchainSend(const std::string& destination, double amountSat, std::optional<double> feeRate) = 0;
106
+ virtual std::shared_ptr<Promise<std::string>> onchainDrain(const std::string& destination, std::optional<double> feeRate) = 0;
107
+ virtual std::shared_ptr<Promise<std::string>> onchainSendMany(const std::vector<BarkSendManyOutput>& outputs, std::optional<double> feeRate) = 0;
96
108
  virtual std::shared_ptr<Promise<std::string>> boardAmount(double amountSat) = 0;
97
109
  virtual std::shared_ptr<Promise<std::string>> boardAll() = 0;
98
110
  virtual std::shared_ptr<Promise<ArkoorPaymentResult>> sendArkoorPayment(const std::string& destination, double amountSat) = 0;
99
- virtual std::shared_ptr<Promise<Bolt11PaymentResult>> sendBolt11Payment(const std::string& destination, std::optional<double> amountSat) = 0;
111
+ virtual std::shared_ptr<Promise<LightningPaymentResult>> sendLightningPayment(const std::string& destination, std::optional<double> amountSat) = 0;
100
112
  virtual std::shared_ptr<Promise<LnurlPaymentResult>> sendLnaddr(const std::string& addr, double amountSat, const std::string& comment) = 0;
101
- virtual std::shared_ptr<Promise<std::string>> sendRoundOnchain(const std::string& destination, double amountSat, bool no_sync) = 0;
113
+ virtual std::shared_ptr<Promise<std::string>> sendRoundOnchainPayment(const std::string& destination, double amountSat) = 0;
102
114
  virtual std::shared_ptr<Promise<std::string>> bolt11Invoice(double amountMsat) = 0;
103
- virtual std::shared_ptr<Promise<void>> claimBolt11Payment(const std::string& bolt11) = 0;
115
+ virtual std::shared_ptr<Promise<void>> finishLightningReceive(const std::string& bolt11) = 0;
104
116
  virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::vector<std::string>& vtxoIds, const std::string& destinationAddress) = 0;
105
117
  virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::string& destinationAddress) = 0;
106
- virtual std::shared_ptr<Promise<std::string>> exitStartSpecific(const std::vector<std::string>& vtxoIds) = 0;
107
- virtual std::shared_ptr<Promise<std::string>> exitStartAll() = 0;
108
- virtual std::shared_ptr<Promise<std::string>> exitProgressOnce() = 0;
109
118
 
110
119
  protected:
111
120
  // Hybrid Setup
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// Bolt11PaymentResult.hpp
2
+ /// LightningPaymentResult.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © 2025 Marc Rousavy @ Margelo
@@ -27,17 +27,17 @@ namespace margelo::nitro::nitroark { enum class PaymentTypes; }
27
27
  namespace margelo::nitro::nitroark {
28
28
 
29
29
  /**
30
- * A struct which can be represented as a JavaScript object (Bolt11PaymentResult).
30
+ * A struct which can be represented as a JavaScript object (LightningPaymentResult).
31
31
  */
32
- struct Bolt11PaymentResult {
32
+ struct LightningPaymentResult {
33
33
  public:
34
34
  std::string bolt11_invoice SWIFT_PRIVATE;
35
35
  std::string preimage SWIFT_PRIVATE;
36
36
  PaymentTypes payment_type SWIFT_PRIVATE;
37
37
 
38
38
  public:
39
- Bolt11PaymentResult() = default;
40
- explicit Bolt11PaymentResult(std::string bolt11_invoice, std::string preimage, PaymentTypes payment_type): bolt11_invoice(bolt11_invoice), preimage(preimage), payment_type(payment_type) {}
39
+ LightningPaymentResult() = default;
40
+ explicit LightningPaymentResult(std::string bolt11_invoice, std::string preimage, PaymentTypes payment_type): bolt11_invoice(bolt11_invoice), preimage(preimage), payment_type(payment_type) {}
41
41
  };
42
42
 
43
43
  } // namespace margelo::nitro::nitroark
@@ -46,18 +46,18 @@ namespace margelo::nitro {
46
46
 
47
47
  using namespace margelo::nitro::nitroark;
48
48
 
49
- // C++ Bolt11PaymentResult <> JS Bolt11PaymentResult (object)
49
+ // C++ LightningPaymentResult <> JS LightningPaymentResult (object)
50
50
  template <>
51
- struct JSIConverter<Bolt11PaymentResult> final {
52
- static inline Bolt11PaymentResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
+ struct JSIConverter<LightningPaymentResult> final {
52
+ static inline LightningPaymentResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
53
53
  jsi::Object obj = arg.asObject(runtime);
54
- return Bolt11PaymentResult(
54
+ return LightningPaymentResult(
55
55
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "bolt11_invoice")),
56
56
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "preimage")),
57
57
  JSIConverter<PaymentTypes>::fromJSI(runtime, obj.getProperty(runtime, "payment_type"))
58
58
  );
59
59
  }
60
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const Bolt11PaymentResult& arg) {
60
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const LightningPaymentResult& arg) {
61
61
  jsi::Object obj(runtime);
62
62
  obj.setProperty(runtime, "bolt11_invoice", JSIConverter<std::string>::toJSI(runtime, arg.bolt11_invoice));
63
63
  obj.setProperty(runtime, "preimage", JSIConverter<std::string>::toJSI(runtime, arg.preimage));
@@ -0,0 +1,77 @@
1
+ ///
2
+ /// OffchainBalanceResult.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+
21
+
22
+
23
+
24
+
25
+ namespace margelo::nitro::nitroark {
26
+
27
+ /**
28
+ * A struct which can be represented as a JavaScript object (OffchainBalanceResult).
29
+ */
30
+ struct OffchainBalanceResult {
31
+ public:
32
+ double spendable SWIFT_PRIVATE;
33
+ double pending_lightning_send SWIFT_PRIVATE;
34
+ double pending_exit SWIFT_PRIVATE;
35
+
36
+ public:
37
+ OffchainBalanceResult() = default;
38
+ explicit OffchainBalanceResult(double spendable, double pending_lightning_send, double pending_exit): spendable(spendable), pending_lightning_send(pending_lightning_send), pending_exit(pending_exit) {}
39
+ };
40
+
41
+ } // namespace margelo::nitro::nitroark
42
+
43
+ namespace margelo::nitro {
44
+
45
+ using namespace margelo::nitro::nitroark;
46
+
47
+ // C++ OffchainBalanceResult <> JS OffchainBalanceResult (object)
48
+ template <>
49
+ struct JSIConverter<OffchainBalanceResult> final {
50
+ static inline OffchainBalanceResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
+ jsi::Object obj = arg.asObject(runtime);
52
+ return OffchainBalanceResult(
53
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "spendable")),
54
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_lightning_send")),
55
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_exit"))
56
+ );
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const OffchainBalanceResult& arg) {
59
+ jsi::Object obj(runtime);
60
+ obj.setProperty(runtime, "spendable", JSIConverter<double>::toJSI(runtime, arg.spendable));
61
+ obj.setProperty(runtime, "pending_lightning_send", JSIConverter<double>::toJSI(runtime, arg.pending_lightning_send));
62
+ obj.setProperty(runtime, "pending_exit", JSIConverter<double>::toJSI(runtime, arg.pending_exit));
63
+ return obj;
64
+ }
65
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
66
+ if (!value.isObject()) {
67
+ return false;
68
+ }
69
+ jsi::Object obj = value.getObject(runtime);
70
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "spendable"))) return false;
71
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_lightning_send"))) return false;
72
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_exit"))) return false;
73
+ return true;
74
+ }
75
+ };
76
+
77
+ } // namespace margelo::nitro
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// OnchainBalanceResult.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+
21
+
22
+
23
+
24
+
25
+ namespace margelo::nitro::nitroark {
26
+
27
+ /**
28
+ * A struct which can be represented as a JavaScript object (OnchainBalanceResult).
29
+ */
30
+ struct OnchainBalanceResult {
31
+ public:
32
+ double immature SWIFT_PRIVATE;
33
+ double trusted_pending SWIFT_PRIVATE;
34
+ double untrusted_pending SWIFT_PRIVATE;
35
+ double confirmed SWIFT_PRIVATE;
36
+
37
+ public:
38
+ OnchainBalanceResult() = default;
39
+ explicit OnchainBalanceResult(double immature, double trusted_pending, double untrusted_pending, double confirmed): immature(immature), trusted_pending(trusted_pending), untrusted_pending(untrusted_pending), confirmed(confirmed) {}
40
+ };
41
+
42
+ } // namespace margelo::nitro::nitroark
43
+
44
+ namespace margelo::nitro {
45
+
46
+ using namespace margelo::nitro::nitroark;
47
+
48
+ // C++ OnchainBalanceResult <> JS OnchainBalanceResult (object)
49
+ template <>
50
+ struct JSIConverter<OnchainBalanceResult> final {
51
+ static inline OnchainBalanceResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
52
+ jsi::Object obj = arg.asObject(runtime);
53
+ return OnchainBalanceResult(
54
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "immature")),
55
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "trusted_pending")),
56
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "untrusted_pending")),
57
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "confirmed"))
58
+ );
59
+ }
60
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const OnchainBalanceResult& arg) {
61
+ jsi::Object obj(runtime);
62
+ obj.setProperty(runtime, "immature", JSIConverter<double>::toJSI(runtime, arg.immature));
63
+ obj.setProperty(runtime, "trusted_pending", JSIConverter<double>::toJSI(runtime, arg.trusted_pending));
64
+ obj.setProperty(runtime, "untrusted_pending", JSIConverter<double>::toJSI(runtime, arg.untrusted_pending));
65
+ obj.setProperty(runtime, "confirmed", JSIConverter<double>::toJSI(runtime, arg.confirmed));
66
+ return obj;
67
+ }
68
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
69
+ if (!value.isObject()) {
70
+ return false;
71
+ }
72
+ jsi::Object obj = value.getObject(runtime);
73
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "immature"))) return false;
74
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "trusted_pending"))) return false;
75
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "untrusted_pending"))) return false;
76
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "confirmed"))) return false;
77
+ return true;
78
+ }
79
+ };
80
+
81
+ } // namespace margelo::nitro
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "react-native-nitro-ark",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "description": "Pure C++ Nitro Modules for Ark client",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
7
7
  "module": "./lib/module/index.js",
8
8
  "exports": {
9
9
  ".": {
10
+ "source": "./src/index.tsx",
10
11
  "types": "./lib/typescript/src/index.d.ts",
11
12
  "default": "./lib/module/index.js"
12
13
  },
@@ -45,18 +46,23 @@
45
46
  "keywords": [
46
47
  "react-native",
47
48
  "ios",
48
- "android"
49
+ "android",
50
+ "nitro-modules",
51
+ "ark",
52
+ "bitcoin",
53
+ "arkoor",
54
+ "bitcoin-layer2"
49
55
  ],
50
56
  "repository": {
51
57
  "type": "git",
52
- "url": "git+https://github.com/niteshbalusu11/react-native-nitro-ark.git"
58
+ "url": "git+https://github.com/BlixtWallet/react-native-nitro-ark.git"
53
59
  },
54
60
  "author": "Nitesh Balusu <niteshbalusu@icloud.com> (https://github.com/niteshbalusu11)",
55
61
  "license": "MIT",
56
62
  "bugs": {
57
- "url": "https://github.com/niteshbalusu11/react-native-nitro-ark/issues"
63
+ "url": "https://github.com/BlixtWallet/react-native-nitro-ark/issues"
58
64
  },
59
- "homepage": "https://github.com/niteshbalusu11/react-native-nitro-ark#readme",
65
+ "homepage": "https://github.com/BlixtWallet/react-native-nitro-ark#readme",
60
66
  "publishConfig": {
61
67
  "registry": "https://registry.npmjs.org/"
62
68
  },
@@ -76,12 +82,12 @@
76
82
  "eslint-config-prettier": "^10.1.1",
77
83
  "eslint-plugin-prettier": "^5.2.3",
78
84
  "jest": "^29.7.0",
79
- "nitro-codegen": "^0.26.2",
85
+ "nitro-codegen": "^0.26.4",
80
86
  "prettier": "^3.0.3",
81
87
  "react": "19.0.0",
82
- "react-native": "0.79.3",
83
- "react-native-builder-bob": "^0.40.12",
84
- "react-native-nitro-modules": "^0.26.2",
88
+ "react-native": "0.79.5",
89
+ "react-native-builder-bob": "^0.40.13",
90
+ "react-native-nitro-modules": "^0.26.4",
85
91
  "release-it": "^17.10.0",
86
92
  "turbo": "^1.10.7",
87
93
  "typescript": "^5.2.2"
@@ -89,7 +95,7 @@
89
95
  "peerDependencies": {
90
96
  "react": "*",
91
97
  "react-native": "*",
92
- "react-native-nitro-modules": "^0.26.2"
98
+ "react-native-nitro-modules": "^0.26.4"
93
99
  },
94
100
  "workspaces": [
95
101
  "example"
@@ -168,6 +174,6 @@
168
174
  "create-react-native-library": {
169
175
  "languages": "kotlin-swift",
170
176
  "type": "nitro-module",
171
- "version": "0.49.0"
177
+ "version": "0.52.0"
172
178
  }
173
179
  }
@@ -56,10 +56,10 @@ export interface ArkoorPaymentResult {
56
56
  payment_type: PaymentTypes; // 'Arkoor'
57
57
  }
58
58
 
59
- export interface Bolt11PaymentResult {
59
+ export interface LightningPaymentResult {
60
60
  bolt11_invoice: string;
61
61
  preimage: string;
62
- payment_type: PaymentTypes; // 'Bolt11'
62
+ payment_type: PaymentTypes; // 'Lightning'
63
63
  }
64
64
 
65
65
  export interface LnurlPaymentResult {
@@ -76,39 +76,66 @@ export interface OnchainPaymentResult {
76
76
  payment_type: PaymentTypes; // 'Onchain'
77
77
  }
78
78
 
79
+ export interface OffchainBalanceResult {
80
+ spendable: number; // u64
81
+ pending_lightning_send: number; // u64
82
+ pending_exit: number; // u64
83
+ }
84
+
85
+ export interface OnchainBalanceResult {
86
+ // All coinbase outputs not yet matured
87
+ immature: number,
88
+ // Unconfirmed UTXOs generated by a wallet tx
89
+ trusted_pending: number,
90
+ // Unconfirmed UTXOs received from an external wallet
91
+ untrusted_pending: number,
92
+ // Confirmed and immediately spendable balance
93
+ confirmed: number,
94
+ }
95
+
79
96
  // --- Nitro Module Interface ---
80
97
 
81
98
  export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
82
99
  // --- Management ---
83
100
  createMnemonic(): Promise<string>;
84
101
  loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
85
- closeWallet(): Promise<void>;
86
102
  isWalletLoaded(): Promise<boolean>;
103
+ closeWallet(): Promise<void>;
87
104
  persistConfig(opts: BarkConfigOpts): Promise<void>;
88
105
  maintenance(): Promise<void>;
89
106
  sync(): Promise<void>;
90
- syncArk(): Promise<void>;
107
+ syncExits(): Promise<void>;
91
108
  syncRounds(): Promise<void>;
92
109
 
93
110
  // --- Wallet Info ---
94
111
  getArkInfo(): Promise<BarkArkInfo>;
95
- onchainBalance(): Promise<number>;
96
- offchainBalance(): Promise<number>;
97
- getOnchainAddress(): Promise<string>;
98
- getOnchainUtxos(no_sync: boolean): Promise<string>; // Returns JSON string
99
- getVtxoPubkey(index?: number): Promise<string>;
100
- getVtxos(no_sync: boolean): Promise<string>; // Returns JSON string
112
+ offchainBalance(): Promise<OffchainBalanceResult>;
113
+ deriveStoreNextKeypair(): Promise<string>;
114
+ peakKeyPair(index: number): Promise<string>;
115
+ getVtxos(): Promise<BarkVtxo[]>; // Returns JSON string
101
116
 
102
117
  // --- Onchain Operations ---
103
- sendOnchain(
118
+ onchainBalance(): Promise<OnchainBalanceResult>;
119
+ onchainSync(): Promise<void>;
120
+ onchainListUnspent(): Promise<string>; // Returns JSON string
121
+ onchainUtxos(): Promise<string>; // Returns JSON string
122
+ onchainAddress(): Promise<string>; // Returns address string
123
+ onchainSend(
104
124
  destination: string,
105
- amountSat: number
106
- ): Promise<OnchainPaymentResult>; // Returns txid
107
- drainOnchain(destination: string, no_sync: boolean): Promise<string>; // Returns txid
108
- sendManyOnchain(
125
+ amountSat: number,
126
+ feeRate?: number // Optional fee rate in sat/vB
127
+ ): Promise<OnchainPaymentResult>; // Returns txid and details
128
+ // Note: feeRate is optional, if not provided, default fee rate will be used
129
+ onchainDrain(
130
+ destination: string,
131
+ feeRate?: number // Optional fee rate in sat/vB
132
+ ): Promise<string>; // Returns txid
133
+ // Note: feeRate is optional, if not provided, default fee rate will be used
134
+ onchainSendMany(
109
135
  outputs: BarkSendManyOutput[],
110
- no_sync: boolean
136
+ feeRate?: number // Optional fee rate in sat/vB
111
137
  ): Promise<string>; // Returns txid
138
+ // Note: feeRate is optional, if not provided, default fee rate will be used
112
139
 
113
140
  // --- Ark & Lightning Payments ---
114
141
  boardAmount(amountSat: number): Promise<string>; // Returns JSON status
@@ -117,24 +144,23 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
117
144
  destination: string,
118
145
  amountSat: number
119
146
  ): Promise<ArkoorPaymentResult>;
120
- sendBolt11Payment(
147
+ sendLightningPayment(
121
148
  destination: string,
122
149
  amountSat?: number
123
- ): Promise<Bolt11PaymentResult>;
150
+ ): Promise<LightningPaymentResult>;
124
151
  sendLnaddr(
125
152
  addr: string,
126
153
  amountSat: number,
127
154
  comment: string
128
155
  ): Promise<LnurlPaymentResult>;
129
- sendRoundOnchain(
156
+ sendRoundOnchainPayment(
130
157
  destination: string,
131
158
  amountSat: number,
132
- no_sync: boolean
133
159
  ): Promise<string>; // Returns JSON status
134
160
 
135
161
  // --- Lightning Invoicing ---
136
162
  bolt11Invoice(amountMsat: number): Promise<string>; // Returns invoice string
137
- claimBolt11Payment(bolt11: string): Promise<void>; // Throws on error
163
+ finishLightningReceive(bolt11: string): Promise<void>; // Throws on error
138
164
 
139
165
  // --- Offboarding / Exiting ---
140
166
  offboardSpecific(
@@ -142,7 +168,4 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
142
168
  destinationAddress: string
143
169
  ): Promise<string>; // Returns JSON result
144
170
  offboardAll(destinationAddress: string): Promise<string>; // Returns JSON result
145
- exitStartSpecific(vtxoIds: string[]): Promise<string>;
146
- exitStartAll(): Promise<string>;
147
- exitProgressOnce(): Promise<string>;
148
171
  }