react-native-nitro-ark 0.0.2

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.
Files changed (55) hide show
  1. package/LICENSE +20 -0
  2. package/NitroArk.podspec +30 -0
  3. package/README.md +22 -0
  4. package/android/CMakeLists.txt +64 -0
  5. package/android/build.gradle +145 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +3 -0
  8. package/android/src/main/AndroidManifestNew.xml +2 -0
  9. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  10. package/android/src/main/java/com/nitroark/NitroArkPackage.kt +22 -0
  11. package/cpp/HybridArk.cpp +8 -0
  12. package/cpp/NitroArk.hpp +558 -0
  13. package/cpp/bark-cpp.h +382 -0
  14. package/lib/commonjs/NitroArk.nitro.js +6 -0
  15. package/lib/commonjs/NitroArk.nitro.js.map +1 -0
  16. package/lib/commonjs/index.js +292 -0
  17. package/lib/commonjs/index.js.map +1 -0
  18. package/lib/commonjs/package.json +1 -0
  19. package/lib/module/NitroArk.nitro.js +4 -0
  20. package/lib/module/NitroArk.nitro.js.map +1 -0
  21. package/lib/module/index.js +268 -0
  22. package/lib/module/index.js.map +1 -0
  23. package/lib/module/package.json +1 -0
  24. package/lib/typescript/commonjs/package.json +1 -0
  25. package/lib/typescript/commonjs/src/NitroArk.nitro.d.ts +59 -0
  26. package/lib/typescript/commonjs/src/NitroArk.nitro.d.ts.map +1 -0
  27. package/lib/typescript/commonjs/src/index.d.ts +180 -0
  28. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  29. package/lib/typescript/module/package.json +1 -0
  30. package/lib/typescript/module/src/NitroArk.nitro.d.ts +59 -0
  31. package/lib/typescript/module/src/NitroArk.nitro.d.ts.map +1 -0
  32. package/lib/typescript/module/src/index.d.ts +180 -0
  33. package/lib/typescript/module/src/index.d.ts.map +1 -0
  34. package/nitrogen/generated/android/NitroArk+autolinking.cmake +78 -0
  35. package/nitrogen/generated/android/NitroArk+autolinking.gradle +27 -0
  36. package/nitrogen/generated/android/NitroArkOnLoad.cpp +44 -0
  37. package/nitrogen/generated/android/NitroArkOnLoad.hpp +25 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroark/NitroArkOnLoad.kt +35 -0
  39. package/nitrogen/generated/ios/NitroArk+autolinking.rb +60 -0
  40. package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Bridge.cpp +17 -0
  41. package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Bridge.hpp +27 -0
  42. package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Umbrella.hpp +38 -0
  43. package/nitrogen/generated/ios/NitroArkAutolinking.mm +35 -0
  44. package/nitrogen/generated/ios/NitroArkAutolinking.swift +12 -0
  45. package/nitrogen/generated/shared/c++/BarkBalance.hpp +77 -0
  46. package/nitrogen/generated/shared/c++/BarkConfigOpts.hpp +90 -0
  47. package/nitrogen/generated/shared/c++/BarkCreateOpts.hpp +96 -0
  48. package/nitrogen/generated/shared/c++/BarkRefreshModeType.hpp +94 -0
  49. package/nitrogen/generated/shared/c++/BarkRefreshOpts.hpp +81 -0
  50. package/nitrogen/generated/shared/c++/BarkSendManyOutput.hpp +73 -0
  51. package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +40 -0
  52. package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +95 -0
  53. package/package.json +178 -0
  54. package/src/NitroArk.nitro.ts +159 -0
  55. package/src/index.tsx +443 -0
@@ -0,0 +1,90 @@
1
+ ///
2
+ /// BarkConfigOpts.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
+ #include <optional>
24
+ #include <string>
25
+
26
+ namespace margelo::nitro::nitroark {
27
+
28
+ /**
29
+ * A struct which can be represented as a JavaScript object (BarkConfigOpts).
30
+ */
31
+ struct BarkConfigOpts {
32
+ public:
33
+ std::optional<std::string> asp SWIFT_PRIVATE;
34
+ std::optional<std::string> esplora SWIFT_PRIVATE;
35
+ std::optional<std::string> bitcoind SWIFT_PRIVATE;
36
+ std::optional<std::string> bitcoind_cookie SWIFT_PRIVATE;
37
+ std::optional<std::string> bitcoind_user SWIFT_PRIVATE;
38
+ std::optional<std::string> bitcoind_pass SWIFT_PRIVATE;
39
+
40
+ public:
41
+ BarkConfigOpts() = default;
42
+ explicit BarkConfigOpts(std::optional<std::string> asp, std::optional<std::string> esplora, std::optional<std::string> bitcoind, std::optional<std::string> bitcoind_cookie, std::optional<std::string> bitcoind_user, std::optional<std::string> bitcoind_pass): asp(asp), esplora(esplora), bitcoind(bitcoind), bitcoind_cookie(bitcoind_cookie), bitcoind_user(bitcoind_user), bitcoind_pass(bitcoind_pass) {}
43
+ };
44
+
45
+ } // namespace margelo::nitro::nitroark
46
+
47
+ namespace margelo::nitro {
48
+
49
+ using namespace margelo::nitro::nitroark;
50
+
51
+ // C++ BarkConfigOpts <> JS BarkConfigOpts (object)
52
+ template <>
53
+ struct JSIConverter<BarkConfigOpts> final {
54
+ static inline BarkConfigOpts fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
+ jsi::Object obj = arg.asObject(runtime);
56
+ return BarkConfigOpts(
57
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "asp")),
58
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "esplora")),
59
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "bitcoind")),
60
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "bitcoind_cookie")),
61
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "bitcoind_user")),
62
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "bitcoind_pass"))
63
+ );
64
+ }
65
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const BarkConfigOpts& arg) {
66
+ jsi::Object obj(runtime);
67
+ obj.setProperty(runtime, "asp", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.asp));
68
+ obj.setProperty(runtime, "esplora", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.esplora));
69
+ obj.setProperty(runtime, "bitcoind", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind));
70
+ obj.setProperty(runtime, "bitcoind_cookie", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind_cookie));
71
+ obj.setProperty(runtime, "bitcoind_user", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind_user));
72
+ obj.setProperty(runtime, "bitcoind_pass", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind_pass));
73
+ return obj;
74
+ }
75
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
76
+ if (!value.isObject()) {
77
+ return false;
78
+ }
79
+ jsi::Object obj = value.getObject(runtime);
80
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "asp"))) return false;
81
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "esplora"))) return false;
82
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "bitcoind"))) return false;
83
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "bitcoind_cookie"))) return false;
84
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "bitcoind_user"))) return false;
85
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "bitcoind_pass"))) return false;
86
+ return true;
87
+ }
88
+ };
89
+
90
+ } // namespace margelo::nitro
@@ -0,0 +1,96 @@
1
+ ///
2
+ /// BarkCreateOpts.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
+ // Forward declaration of `BarkConfigOpts` to properly resolve imports.
22
+ namespace margelo::nitro::nitroark { struct BarkConfigOpts; }
23
+
24
+ #include <optional>
25
+ #include <string>
26
+ #include "BarkConfigOpts.hpp"
27
+
28
+ namespace margelo::nitro::nitroark {
29
+
30
+ /**
31
+ * A struct which can be represented as a JavaScript object (BarkCreateOpts).
32
+ */
33
+ struct BarkCreateOpts {
34
+ public:
35
+ std::optional<bool> force SWIFT_PRIVATE;
36
+ std::optional<bool> regtest SWIFT_PRIVATE;
37
+ std::optional<bool> signet SWIFT_PRIVATE;
38
+ std::optional<bool> bitcoin SWIFT_PRIVATE;
39
+ std::string mnemonic SWIFT_PRIVATE;
40
+ std::optional<double> birthday_height SWIFT_PRIVATE;
41
+ std::optional<BarkConfigOpts> config SWIFT_PRIVATE;
42
+
43
+ public:
44
+ BarkCreateOpts() = default;
45
+ explicit BarkCreateOpts(std::optional<bool> force, std::optional<bool> regtest, std::optional<bool> signet, std::optional<bool> bitcoin, std::string mnemonic, std::optional<double> birthday_height, std::optional<BarkConfigOpts> config): force(force), regtest(regtest), signet(signet), bitcoin(bitcoin), mnemonic(mnemonic), birthday_height(birthday_height), config(config) {}
46
+ };
47
+
48
+ } // namespace margelo::nitro::nitroark
49
+
50
+ namespace margelo::nitro {
51
+
52
+ using namespace margelo::nitro::nitroark;
53
+
54
+ // C++ BarkCreateOpts <> JS BarkCreateOpts (object)
55
+ template <>
56
+ struct JSIConverter<BarkCreateOpts> final {
57
+ static inline BarkCreateOpts fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
58
+ jsi::Object obj = arg.asObject(runtime);
59
+ return BarkCreateOpts(
60
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "force")),
61
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "regtest")),
62
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "signet")),
63
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "bitcoin")),
64
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "mnemonic")),
65
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "birthday_height")),
66
+ JSIConverter<std::optional<BarkConfigOpts>>::fromJSI(runtime, obj.getProperty(runtime, "config"))
67
+ );
68
+ }
69
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const BarkCreateOpts& arg) {
70
+ jsi::Object obj(runtime);
71
+ obj.setProperty(runtime, "force", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.force));
72
+ obj.setProperty(runtime, "regtest", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.regtest));
73
+ obj.setProperty(runtime, "signet", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.signet));
74
+ obj.setProperty(runtime, "bitcoin", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.bitcoin));
75
+ obj.setProperty(runtime, "mnemonic", JSIConverter<std::string>::toJSI(runtime, arg.mnemonic));
76
+ obj.setProperty(runtime, "birthday_height", JSIConverter<std::optional<double>>::toJSI(runtime, arg.birthday_height));
77
+ obj.setProperty(runtime, "config", JSIConverter<std::optional<BarkConfigOpts>>::toJSI(runtime, arg.config));
78
+ return obj;
79
+ }
80
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
81
+ if (!value.isObject()) {
82
+ return false;
83
+ }
84
+ jsi::Object obj = value.getObject(runtime);
85
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "force"))) return false;
86
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "regtest"))) return false;
87
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "signet"))) return false;
88
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "bitcoin"))) return false;
89
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "mnemonic"))) return false;
90
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "birthday_height"))) return false;
91
+ if (!JSIConverter<std::optional<BarkConfigOpts>>::canConvert(runtime, obj.getProperty(runtime, "config"))) return false;
92
+ return true;
93
+ }
94
+ };
95
+
96
+ } // namespace margelo::nitro
@@ -0,0 +1,94 @@
1
+ ///
2
+ /// BarkRefreshModeType.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/NitroHash.hpp>)
11
+ #include <NitroModules/NitroHash.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
16
+ #include <NitroModules/JSIConverter.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
21
+ #include <NitroModules/NitroDefines.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+ namespace margelo::nitro::nitroark {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (BarkRefreshModeType).
30
+ */
31
+ enum class BarkRefreshModeType {
32
+ DEFAULTTHRESHOLD SWIFT_NAME(defaultthreshold) = 0,
33
+ THRESHOLDBLOCKS SWIFT_NAME(thresholdblocks) = 1,
34
+ THRESHOLDHOURS SWIFT_NAME(thresholdhours) = 2,
35
+ COUNTERPARTY SWIFT_NAME(counterparty) = 3,
36
+ ALL SWIFT_NAME(all) = 4,
37
+ SPECIFIC SWIFT_NAME(specific) = 5,
38
+ } CLOSED_ENUM;
39
+
40
+ } // namespace margelo::nitro::nitroark
41
+
42
+ namespace margelo::nitro {
43
+
44
+ using namespace margelo::nitro::nitroark;
45
+
46
+ // C++ BarkRefreshModeType <> JS BarkRefreshModeType (union)
47
+ template <>
48
+ struct JSIConverter<BarkRefreshModeType> final {
49
+ static inline BarkRefreshModeType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
50
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
51
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
52
+ case hashString("DefaultThreshold"): return BarkRefreshModeType::DEFAULTTHRESHOLD;
53
+ case hashString("ThresholdBlocks"): return BarkRefreshModeType::THRESHOLDBLOCKS;
54
+ case hashString("ThresholdHours"): return BarkRefreshModeType::THRESHOLDHOURS;
55
+ case hashString("Counterparty"): return BarkRefreshModeType::COUNTERPARTY;
56
+ case hashString("All"): return BarkRefreshModeType::ALL;
57
+ case hashString("Specific"): return BarkRefreshModeType::SPECIFIC;
58
+ default: [[unlikely]]
59
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum BarkRefreshModeType - invalid value!");
60
+ }
61
+ }
62
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, BarkRefreshModeType arg) {
63
+ switch (arg) {
64
+ case BarkRefreshModeType::DEFAULTTHRESHOLD: return JSIConverter<std::string>::toJSI(runtime, "DefaultThreshold");
65
+ case BarkRefreshModeType::THRESHOLDBLOCKS: return JSIConverter<std::string>::toJSI(runtime, "ThresholdBlocks");
66
+ case BarkRefreshModeType::THRESHOLDHOURS: return JSIConverter<std::string>::toJSI(runtime, "ThresholdHours");
67
+ case BarkRefreshModeType::COUNTERPARTY: return JSIConverter<std::string>::toJSI(runtime, "Counterparty");
68
+ case BarkRefreshModeType::ALL: return JSIConverter<std::string>::toJSI(runtime, "All");
69
+ case BarkRefreshModeType::SPECIFIC: return JSIConverter<std::string>::toJSI(runtime, "Specific");
70
+ default: [[unlikely]]
71
+ throw std::invalid_argument("Cannot convert BarkRefreshModeType to JS - invalid value: "
72
+ + std::to_string(static_cast<int>(arg)) + "!");
73
+ }
74
+ }
75
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
76
+ if (!value.isString()) {
77
+ return false;
78
+ }
79
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
80
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
81
+ case hashString("DefaultThreshold"):
82
+ case hashString("ThresholdBlocks"):
83
+ case hashString("ThresholdHours"):
84
+ case hashString("Counterparty"):
85
+ case hashString("All"):
86
+ case hashString("Specific"):
87
+ return true;
88
+ default:
89
+ return false;
90
+ }
91
+ }
92
+ };
93
+
94
+ } // namespace margelo::nitro
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// BarkRefreshOpts.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
+ // Forward declaration of `BarkRefreshModeType` to properly resolve imports.
22
+ namespace margelo::nitro::nitroark { enum class BarkRefreshModeType; }
23
+
24
+ #include "BarkRefreshModeType.hpp"
25
+ #include <optional>
26
+ #include <vector>
27
+ #include <string>
28
+
29
+ namespace margelo::nitro::nitroark {
30
+
31
+ /**
32
+ * A struct which can be represented as a JavaScript object (BarkRefreshOpts).
33
+ */
34
+ struct BarkRefreshOpts {
35
+ public:
36
+ BarkRefreshModeType mode_type SWIFT_PRIVATE;
37
+ std::optional<double> threshold_value SWIFT_PRIVATE;
38
+ std::optional<std::vector<std::string>> specific_vtxo_ids SWIFT_PRIVATE;
39
+
40
+ public:
41
+ BarkRefreshOpts() = default;
42
+ explicit BarkRefreshOpts(BarkRefreshModeType mode_type, std::optional<double> threshold_value, std::optional<std::vector<std::string>> specific_vtxo_ids): mode_type(mode_type), threshold_value(threshold_value), specific_vtxo_ids(specific_vtxo_ids) {}
43
+ };
44
+
45
+ } // namespace margelo::nitro::nitroark
46
+
47
+ namespace margelo::nitro {
48
+
49
+ using namespace margelo::nitro::nitroark;
50
+
51
+ // C++ BarkRefreshOpts <> JS BarkRefreshOpts (object)
52
+ template <>
53
+ struct JSIConverter<BarkRefreshOpts> final {
54
+ static inline BarkRefreshOpts fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
+ jsi::Object obj = arg.asObject(runtime);
56
+ return BarkRefreshOpts(
57
+ JSIConverter<BarkRefreshModeType>::fromJSI(runtime, obj.getProperty(runtime, "mode_type")),
58
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "threshold_value")),
59
+ JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "specific_vtxo_ids"))
60
+ );
61
+ }
62
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const BarkRefreshOpts& arg) {
63
+ jsi::Object obj(runtime);
64
+ obj.setProperty(runtime, "mode_type", JSIConverter<BarkRefreshModeType>::toJSI(runtime, arg.mode_type));
65
+ obj.setProperty(runtime, "threshold_value", JSIConverter<std::optional<double>>::toJSI(runtime, arg.threshold_value));
66
+ obj.setProperty(runtime, "specific_vtxo_ids", JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.specific_vtxo_ids));
67
+ return obj;
68
+ }
69
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
70
+ if (!value.isObject()) {
71
+ return false;
72
+ }
73
+ jsi::Object obj = value.getObject(runtime);
74
+ if (!JSIConverter<BarkRefreshModeType>::canConvert(runtime, obj.getProperty(runtime, "mode_type"))) return false;
75
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "threshold_value"))) return false;
76
+ if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, "specific_vtxo_ids"))) return false;
77
+ return true;
78
+ }
79
+ };
80
+
81
+ } // namespace margelo::nitro
@@ -0,0 +1,73 @@
1
+ ///
2
+ /// BarkSendManyOutput.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
+ #include <string>
24
+
25
+ namespace margelo::nitro::nitroark {
26
+
27
+ /**
28
+ * A struct which can be represented as a JavaScript object (BarkSendManyOutput).
29
+ */
30
+ struct BarkSendManyOutput {
31
+ public:
32
+ std::string destination SWIFT_PRIVATE;
33
+ double amountSat SWIFT_PRIVATE;
34
+
35
+ public:
36
+ BarkSendManyOutput() = default;
37
+ explicit BarkSendManyOutput(std::string destination, double amountSat): destination(destination), amountSat(amountSat) {}
38
+ };
39
+
40
+ } // namespace margelo::nitro::nitroark
41
+
42
+ namespace margelo::nitro {
43
+
44
+ using namespace margelo::nitro::nitroark;
45
+
46
+ // C++ BarkSendManyOutput <> JS BarkSendManyOutput (object)
47
+ template <>
48
+ struct JSIConverter<BarkSendManyOutput> final {
49
+ static inline BarkSendManyOutput fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
50
+ jsi::Object obj = arg.asObject(runtime);
51
+ return BarkSendManyOutput(
52
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "destination")),
53
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "amountSat"))
54
+ );
55
+ }
56
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const BarkSendManyOutput& arg) {
57
+ jsi::Object obj(runtime);
58
+ obj.setProperty(runtime, "destination", JSIConverter<std::string>::toJSI(runtime, arg.destination));
59
+ obj.setProperty(runtime, "amountSat", JSIConverter<double>::toJSI(runtime, arg.amountSat));
60
+ return obj;
61
+ }
62
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
63
+ if (!value.isObject()) {
64
+ return false;
65
+ }
66
+ jsi::Object obj = value.getObject(runtime);
67
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "destination"))) return false;
68
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "amountSat"))) return false;
69
+ return true;
70
+ }
71
+ };
72
+
73
+ } // namespace margelo::nitro
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// HybridNitroArkSpec.cpp
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
+ #include "HybridNitroArkSpec.hpp"
9
+
10
+ namespace margelo::nitro::nitroark {
11
+
12
+ void HybridNitroArkSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("createMnemonic", &HybridNitroArkSpec::createMnemonic);
18
+ prototype.registerHybridMethod("createWallet", &HybridNitroArkSpec::createWallet);
19
+ prototype.registerHybridMethod("getBalance", &HybridNitroArkSpec::getBalance);
20
+ prototype.registerHybridMethod("getOnchainAddress", &HybridNitroArkSpec::getOnchainAddress);
21
+ prototype.registerHybridMethod("getOnchainUtxos", &HybridNitroArkSpec::getOnchainUtxos);
22
+ prototype.registerHybridMethod("getVtxoPubkey", &HybridNitroArkSpec::getVtxoPubkey);
23
+ prototype.registerHybridMethod("getVtxos", &HybridNitroArkSpec::getVtxos);
24
+ prototype.registerHybridMethod("sendOnchain", &HybridNitroArkSpec::sendOnchain);
25
+ prototype.registerHybridMethod("drainOnchain", &HybridNitroArkSpec::drainOnchain);
26
+ prototype.registerHybridMethod("sendManyOnchain", &HybridNitroArkSpec::sendManyOnchain);
27
+ prototype.registerHybridMethod("refreshVtxos", &HybridNitroArkSpec::refreshVtxos);
28
+ prototype.registerHybridMethod("boardAmount", &HybridNitroArkSpec::boardAmount);
29
+ prototype.registerHybridMethod("boardAll", &HybridNitroArkSpec::boardAll);
30
+ prototype.registerHybridMethod("send", &HybridNitroArkSpec::send);
31
+ prototype.registerHybridMethod("sendRoundOnchain", &HybridNitroArkSpec::sendRoundOnchain);
32
+ prototype.registerHybridMethod("offboardSpecific", &HybridNitroArkSpec::offboardSpecific);
33
+ prototype.registerHybridMethod("offboardAll", &HybridNitroArkSpec::offboardAll);
34
+ prototype.registerHybridMethod("exitStartSpecific", &HybridNitroArkSpec::exitStartSpecific);
35
+ prototype.registerHybridMethod("exitStartAll", &HybridNitroArkSpec::exitStartAll);
36
+ prototype.registerHybridMethod("exitProgressOnce", &HybridNitroArkSpec::exitProgressOnce);
37
+ });
38
+ }
39
+
40
+ } // namespace margelo::nitro::nitroark
@@ -0,0 +1,95 @@
1
+ ///
2
+ /// HybridNitroArkSpec.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/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `BarkCreateOpts` to properly resolve imports.
17
+ namespace margelo::nitro::nitroark { struct BarkCreateOpts; }
18
+ // Forward declaration of `BarkBalance` to properly resolve imports.
19
+ namespace margelo::nitro::nitroark { struct BarkBalance; }
20
+ // Forward declaration of `BarkSendManyOutput` to properly resolve imports.
21
+ namespace margelo::nitro::nitroark { struct BarkSendManyOutput; }
22
+ // Forward declaration of `BarkRefreshOpts` to properly resolve imports.
23
+ namespace margelo::nitro::nitroark { struct BarkRefreshOpts; }
24
+
25
+ #include <NitroModules/Promise.hpp>
26
+ #include <string>
27
+ #include "BarkCreateOpts.hpp"
28
+ #include "BarkBalance.hpp"
29
+ #include <vector>
30
+ #include "BarkSendManyOutput.hpp"
31
+ #include "BarkRefreshOpts.hpp"
32
+ #include <optional>
33
+
34
+ namespace margelo::nitro::nitroark {
35
+
36
+ using namespace margelo::nitro;
37
+
38
+ /**
39
+ * An abstract base class for `NitroArk`
40
+ * Inherit this class to create instances of `HybridNitroArkSpec` in C++.
41
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
42
+ * @example
43
+ * ```cpp
44
+ * class HybridNitroArk: public HybridNitroArkSpec {
45
+ * public:
46
+ * HybridNitroArk(...): HybridObject(TAG) { ... }
47
+ * // ...
48
+ * };
49
+ * ```
50
+ */
51
+ class HybridNitroArkSpec: public virtual HybridObject {
52
+ public:
53
+ // Constructor
54
+ explicit HybridNitroArkSpec(): HybridObject(TAG) { }
55
+
56
+ // Destructor
57
+ ~HybridNitroArkSpec() override = default;
58
+
59
+ public:
60
+ // Properties
61
+
62
+
63
+ public:
64
+ // Methods
65
+ virtual std::shared_ptr<Promise<std::string>> createMnemonic() = 0;
66
+ virtual std::shared_ptr<Promise<void>> createWallet(const std::string& datadir, const BarkCreateOpts& opts) = 0;
67
+ virtual std::shared_ptr<Promise<BarkBalance>> getBalance(const std::string& datadir, bool no_sync, const std::string& mnemonic) = 0;
68
+ virtual std::shared_ptr<Promise<std::string>> getOnchainAddress(const std::string& datadir, const std::string& mnemonic) = 0;
69
+ virtual std::shared_ptr<Promise<std::string>> getOnchainUtxos(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
70
+ virtual std::shared_ptr<Promise<std::string>> getVtxoPubkey(const std::string& datadir, const std::string& mnemonic) = 0;
71
+ virtual std::shared_ptr<Promise<std::string>> getVtxos(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
72
+ virtual std::shared_ptr<Promise<std::string>> sendOnchain(const std::string& datadir, const std::string& mnemonic, const std::string& destination, double amountSat, bool no_sync) = 0;
73
+ virtual std::shared_ptr<Promise<std::string>> drainOnchain(const std::string& datadir, const std::string& mnemonic, const std::string& destination, bool no_sync) = 0;
74
+ virtual std::shared_ptr<Promise<std::string>> sendManyOnchain(const std::string& datadir, const std::string& mnemonic, const std::vector<BarkSendManyOutput>& outputs, bool no_sync) = 0;
75
+ virtual std::shared_ptr<Promise<std::string>> refreshVtxos(const std::string& datadir, const std::string& mnemonic, const BarkRefreshOpts& refreshOpts, bool no_sync) = 0;
76
+ virtual std::shared_ptr<Promise<std::string>> boardAmount(const std::string& datadir, const std::string& mnemonic, double amountSat, bool no_sync) = 0;
77
+ virtual std::shared_ptr<Promise<std::string>> boardAll(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
78
+ virtual std::shared_ptr<Promise<std::string>> send(const std::string& datadir, const std::string& mnemonic, const std::string& destination, double amountSat, const std::optional<std::string>& comment, bool no_sync) = 0;
79
+ virtual std::shared_ptr<Promise<std::string>> sendRoundOnchain(const std::string& datadir, const std::string& mnemonic, const std::string& destination, double amountSat, bool no_sync) = 0;
80
+ virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::string& datadir, const std::string& mnemonic, const std::vector<std::string>& vtxoIds, const std::optional<std::string>& optionalAddress, bool no_sync) = 0;
81
+ virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::string& datadir, const std::string& mnemonic, const std::optional<std::string>& optionalAddress, bool no_sync) = 0;
82
+ virtual std::shared_ptr<Promise<std::string>> exitStartSpecific(const std::string& datadir, const std::string& mnemonic, const std::vector<std::string>& vtxoIds, bool no_sync) = 0;
83
+ virtual std::shared_ptr<Promise<std::string>> exitStartAll(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
84
+ virtual std::shared_ptr<Promise<std::string>> exitProgressOnce(const std::string& datadir, const std::string& mnemonic) = 0;
85
+
86
+ protected:
87
+ // Hybrid Setup
88
+ void loadHybridMethods() override;
89
+
90
+ protected:
91
+ // Tag for logging
92
+ static constexpr auto TAG = "NitroArk";
93
+ };
94
+
95
+ } // namespace margelo::nitro::nitroark