react-native-candle 0.1.43 → 0.1.45

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 (160) hide show
  1. package/ReactNativeCandle.podspec +1 -1
  2. package/ios/Sources/CandleActionViewModel.swift +4 -7
  3. package/ios/Sources/CandleLinkSheetWrapperView.swift +40 -59
  4. package/ios/Sources/CandleLinkViewModel.swift +21 -31
  5. package/ios/Sources/CandleTradeExecutionSheetWrapper.swift +14 -23
  6. package/ios/Sources/HostingViewController.swift +26 -26
  7. package/ios/Sources/RNCandle.swift +159 -1307
  8. package/ios/Sources/Types.swift +847 -0
  9. package/ios/Sources/UIApplication++.swift +5 -9
  10. package/lib/commonjs/context.js +17 -0
  11. package/lib/commonjs/context.js.map +1 -0
  12. package/lib/commonjs/index.js +17 -407
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/package.json +1 -0
  15. package/lib/commonjs/provider.js +117 -0
  16. package/lib/commonjs/provider.js.map +1 -0
  17. package/lib/commonjs/types.js +271 -0
  18. package/lib/commonjs/types.js.map +1 -0
  19. package/lib/module/context.js +12 -0
  20. package/lib/module/context.js.map +1 -0
  21. package/lib/module/index.js +2 -408
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/module/package.json +1 -0
  24. package/lib/module/provider.js +111 -0
  25. package/lib/module/provider.js.map +1 -0
  26. package/lib/module/types.js +256 -0
  27. package/lib/module/types.js.map +1 -0
  28. package/lib/typescript/commonjs/src/context.d.ts +47 -0
  29. package/lib/typescript/commonjs/src/context.d.ts.map +1 -0
  30. package/lib/typescript/commonjs/src/index.d.ts +4 -166
  31. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/src/provider.d.ts +8 -0
  33. package/lib/typescript/commonjs/src/provider.d.ts.map +1 -0
  34. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +22 -24
  35. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/src/types.d.ts +125 -0
  37. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  38. package/lib/typescript/module/src/context.d.ts +47 -0
  39. package/lib/typescript/module/src/context.d.ts.map +1 -0
  40. package/lib/typescript/module/src/index.d.ts +4 -166
  41. package/lib/typescript/module/src/index.d.ts.map +1 -1
  42. package/lib/typescript/module/src/provider.d.ts +8 -0
  43. package/lib/typescript/module/src/provider.d.ts.map +1 -0
  44. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +22 -24
  45. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
  46. package/lib/typescript/module/src/types.d.ts +125 -0
  47. package/lib/typescript/module/src/types.d.ts.map +1 -0
  48. package/nitrogen/generated/.gitattributes +1 -1
  49. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +15 -31
  50. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +379 -242
  51. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +23 -22
  52. package/nitrogen/generated/ios/ReactNativeCandleAutolinking.mm +1 -1
  53. package/nitrogen/generated/ios/ReactNativeCandleAutolinking.swift +2 -4
  54. package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +36 -42
  55. package/nitrogen/generated/ios/swift/ActiveLinkedAccountDetails.swift +6 -3
  56. package/nitrogen/generated/ios/swift/AssetAccount.swift +6 -3
  57. package/nitrogen/generated/ios/swift/AssetAccountKind.swift +4 -4
  58. package/nitrogen/generated/ios/swift/AssetAccountRef.swift +5 -5
  59. package/nitrogen/generated/ios/swift/{AssetAccountQuery.swift → AssetAccountsQuery.swift} +7 -6
  60. package/nitrogen/generated/ios/swift/Counterparty.swift +8 -3
  61. package/nitrogen/generated/ios/swift/CounterpartyKind.swift +42 -0
  62. package/nitrogen/generated/ios/swift/FiatAccount.swift +4 -2
  63. package/nitrogen/generated/ios/swift/FiatAsset.swift +2 -1
  64. package/nitrogen/generated/ios/swift/FiatAssetQuoteRequest.swift +4 -2
  65. package/nitrogen/generated/ios/swift/FiatAssetRef.swift +2 -1
  66. package/nitrogen/generated/ios/swift/Func_void_LinkedAccount.swift +5 -5
  67. package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +7 -7
  68. package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +40 -65
  69. package/nitrogen/generated/ios/swift/LinkedAccountDetails.swift +15 -3
  70. package/nitrogen/generated/ios/swift/{StatePayload.swift → LinkedAccountState.swift} +6 -6
  71. package/nitrogen/generated/ios/swift/LinkedAccountStatusRef.swift +4 -3
  72. package/nitrogen/generated/ios/swift/MarketAccount.swift +5 -5
  73. package/nitrogen/generated/ios/swift/MarketAssetKind.swift +38 -0
  74. package/nitrogen/generated/ios/swift/MarketAssetQuoteRequest.swift +11 -8
  75. package/nitrogen/generated/ios/swift/MarketTradeAsset.swift +7 -7
  76. package/nitrogen/generated/ios/swift/MarketTradeAssetRef.swift +5 -5
  77. package/nitrogen/generated/ios/swift/MerchantCounterparty.swift +2 -1
  78. package/nitrogen/generated/ios/swift/TradeAsset.swift +10 -5
  79. package/nitrogen/generated/ios/swift/TradeAssetKind.swift +54 -0
  80. package/nitrogen/generated/ios/swift/TradeAssetQuoteRequest.swift +15 -4
  81. package/nitrogen/generated/ios/swift/TradeAssetRef.swift +11 -5
  82. package/nitrogen/generated/ios/swift/TradeExecutionResult.swift +4 -2
  83. package/nitrogen/generated/ios/swift/{TradeQuoteRequest.swift → TradeQuotesRequest.swift} +7 -6
  84. package/nitrogen/generated/ios/swift/{TradeQuery.swift → TradesQuery.swift} +29 -45
  85. package/nitrogen/generated/ios/swift/TransportAssetQuoteRequest.swift +12 -6
  86. package/nitrogen/generated/shared/c++/ACHAccountKind.hpp +7 -9
  87. package/nitrogen/generated/shared/c++/ACHDetails.hpp +7 -9
  88. package/nitrogen/generated/shared/c++/ActiveLinkedAccountDetails.hpp +4 -6
  89. package/nitrogen/generated/shared/c++/Address.hpp +4 -6
  90. package/nitrogen/generated/shared/c++/AssetAccount.hpp +14 -16
  91. package/nitrogen/generated/shared/c++/AssetAccountKind.hpp +15 -17
  92. package/nitrogen/generated/shared/c++/AssetAccountRef.hpp +12 -12
  93. package/nitrogen/generated/shared/c++/{AssetAccountQuery.hpp → AssetAccountsQuery.hpp} +14 -16
  94. package/nitrogen/generated/shared/c++/AssetAccountsResponse.hpp +11 -13
  95. package/nitrogen/generated/shared/c++/Coordinates.hpp +4 -6
  96. package/nitrogen/generated/shared/c++/Counterparty.hpp +14 -16
  97. package/nitrogen/generated/shared/c++/CounterpartyKind.hpp +80 -0
  98. package/nitrogen/generated/shared/c++/FiatAccount.hpp +16 -18
  99. package/nitrogen/generated/shared/c++/FiatAsset.hpp +7 -9
  100. package/nitrogen/generated/shared/c++/FiatAssetQuoteRequest.hpp +4 -6
  101. package/nitrogen/generated/shared/c++/FiatAssetRef.hpp +4 -6
  102. package/nitrogen/generated/shared/c++/FiatMarketAccountKind.hpp +13 -15
  103. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.cpp +1 -2
  104. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +17 -27
  105. package/nitrogen/generated/shared/c++/InactiveLinkedAccountDetails.hpp +4 -6
  106. package/nitrogen/generated/shared/c++/LinkedAccount.hpp +10 -12
  107. package/nitrogen/generated/shared/c++/LinkedAccountDetails.hpp +14 -16
  108. package/nitrogen/generated/shared/c++/LinkedAccountRef.hpp +4 -6
  109. package/nitrogen/generated/shared/c++/{StatePayload.hpp → LinkedAccountState.hpp} +15 -17
  110. package/nitrogen/generated/shared/c++/LinkedAccountStatusRef.hpp +15 -17
  111. package/nitrogen/generated/shared/c++/MarketAccount.hpp +18 -17
  112. package/nitrogen/generated/shared/c++/MarketAssetKind.hpp +76 -0
  113. package/nitrogen/generated/shared/c++/MarketAssetQuoteRequest.hpp +12 -12
  114. package/nitrogen/generated/shared/c++/MarketTradeAsset.hpp +15 -14
  115. package/nitrogen/generated/shared/c++/MarketTradeAssetRef.hpp +12 -12
  116. package/nitrogen/generated/shared/c++/MerchantCounterparty.hpp +8 -10
  117. package/nitrogen/generated/shared/c++/MerchantLocation.hpp +4 -6
  118. package/nitrogen/generated/shared/c++/NothingAsset.hpp +4 -6
  119. package/nitrogen/generated/shared/c++/NothingAssetQuoteRequest.hpp +4 -6
  120. package/nitrogen/generated/shared/c++/NothingAssetRef.hpp +4 -6
  121. package/nitrogen/generated/shared/c++/OtherAsset.hpp +4 -6
  122. package/nitrogen/generated/shared/c++/OtherAssetRef.hpp +4 -6
  123. package/nitrogen/generated/shared/c++/PresentationBackground.hpp +7 -9
  124. package/nitrogen/generated/shared/c++/PresentationStyle.hpp +7 -9
  125. package/nitrogen/generated/shared/c++/Service.hpp +163 -165
  126. package/nitrogen/generated/shared/c++/ServiceCounterparty.hpp +7 -9
  127. package/nitrogen/generated/shared/c++/Trade.hpp +16 -18
  128. package/nitrogen/generated/shared/c++/TradeAsset.hpp +20 -22
  129. package/nitrogen/generated/shared/c++/TradeAssetKind.hpp +92 -0
  130. package/nitrogen/generated/shared/c++/TradeAssetQuoteRequest.hpp +17 -19
  131. package/nitrogen/generated/shared/c++/TradeAssetRef.hpp +20 -22
  132. package/nitrogen/generated/shared/c++/TradeExecutionResult.hpp +8 -10
  133. package/nitrogen/generated/shared/c++/TradeQuote.hpp +10 -12
  134. package/nitrogen/generated/shared/c++/{TradeQuoteRequest.hpp → TradeQuotesRequest.hpp} +17 -19
  135. package/nitrogen/generated/shared/c++/TradeQuotesResponse.hpp +11 -13
  136. package/nitrogen/generated/shared/c++/TradeRef.hpp +10 -12
  137. package/nitrogen/generated/shared/c++/TradeState.hpp +9 -11
  138. package/nitrogen/generated/shared/c++/TradesQuery.hpp +89 -0
  139. package/nitrogen/generated/shared/c++/TradesResponse.hpp +11 -13
  140. package/nitrogen/generated/shared/c++/TransportAccount.hpp +10 -12
  141. package/nitrogen/generated/shared/c++/TransportAccountKind.hpp +9 -11
  142. package/nitrogen/generated/shared/c++/TransportAsset.hpp +19 -21
  143. package/nitrogen/generated/shared/c++/TransportAssetQuoteRequest.hpp +16 -18
  144. package/nitrogen/generated/shared/c++/TransportAssetRef.hpp +4 -6
  145. package/nitrogen/generated/shared/c++/UnavailableLinkedAccountDetails.hpp +4 -6
  146. package/nitrogen/generated/shared/c++/UserCounterparty.hpp +4 -6
  147. package/nitrogen/generated/shared/c++/WireDetails.hpp +4 -6
  148. package/package.json +10 -14
  149. package/src/context.ts +86 -0
  150. package/src/index.ts +4 -634
  151. package/src/provider.tsx +152 -0
  152. package/src/specs/RNCandle.nitro.ts +38 -29
  153. package/src/types.ts +462 -0
  154. package/nitrogen/generated/ios/swift/AppUser.swift +0 -75
  155. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +0 -44
  156. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_AnyMap__.swift +0 -47
  157. package/nitrogen/generated/ios/swift/ToolCall.swift +0 -44
  158. package/nitrogen/generated/shared/c++/AppUser.hpp +0 -78
  159. package/nitrogen/generated/shared/c++/ToolCall.hpp +0 -73
  160. package/nitrogen/generated/shared/c++/TradeQuery.hpp +0 -86
@@ -0,0 +1,92 @@
1
+ ///
2
+ /// TradeAssetKind.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::rncandle {
27
+
28
+ /**
29
+ * An enum which can be represented as a JavaScript union (TradeAssetKind).
30
+ */
31
+ enum class TradeAssetKind {
32
+ STOCK SWIFT_NAME(stock) = 0,
33
+ CRYPTO SWIFT_NAME(crypto) = 1,
34
+ FIAT SWIFT_NAME(fiat) = 2,
35
+ TRANSPORT SWIFT_NAME(transport) = 3,
36
+ OTHER SWIFT_NAME(other) = 4,
37
+ NOTHING SWIFT_NAME(nothing) = 5,
38
+ } CLOSED_ENUM;
39
+
40
+ } // namespace margelo::nitro::rncandle
41
+
42
+ namespace margelo::nitro {
43
+
44
+ // C++ TradeAssetKind <> JS TradeAssetKind (union)
45
+ template <>
46
+ struct JSIConverter<margelo::nitro::rncandle::TradeAssetKind> final {
47
+ static inline margelo::nitro::rncandle::TradeAssetKind fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
48
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
49
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
50
+ case hashString("stock"): return margelo::nitro::rncandle::TradeAssetKind::STOCK;
51
+ case hashString("crypto"): return margelo::nitro::rncandle::TradeAssetKind::CRYPTO;
52
+ case hashString("fiat"): return margelo::nitro::rncandle::TradeAssetKind::FIAT;
53
+ case hashString("transport"): return margelo::nitro::rncandle::TradeAssetKind::TRANSPORT;
54
+ case hashString("other"): return margelo::nitro::rncandle::TradeAssetKind::OTHER;
55
+ case hashString("nothing"): return margelo::nitro::rncandle::TradeAssetKind::NOTHING;
56
+ default: [[unlikely]]
57
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum TradeAssetKind - invalid value!");
58
+ }
59
+ }
60
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rncandle::TradeAssetKind arg) {
61
+ switch (arg) {
62
+ case margelo::nitro::rncandle::TradeAssetKind::STOCK: return JSIConverter<std::string>::toJSI(runtime, "stock");
63
+ case margelo::nitro::rncandle::TradeAssetKind::CRYPTO: return JSIConverter<std::string>::toJSI(runtime, "crypto");
64
+ case margelo::nitro::rncandle::TradeAssetKind::FIAT: return JSIConverter<std::string>::toJSI(runtime, "fiat");
65
+ case margelo::nitro::rncandle::TradeAssetKind::TRANSPORT: return JSIConverter<std::string>::toJSI(runtime, "transport");
66
+ case margelo::nitro::rncandle::TradeAssetKind::OTHER: return JSIConverter<std::string>::toJSI(runtime, "other");
67
+ case margelo::nitro::rncandle::TradeAssetKind::NOTHING: return JSIConverter<std::string>::toJSI(runtime, "nothing");
68
+ default: [[unlikely]]
69
+ throw std::invalid_argument("Cannot convert TradeAssetKind to JS - invalid value: "
70
+ + std::to_string(static_cast<int>(arg)) + "!");
71
+ }
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isString()) {
75
+ return false;
76
+ }
77
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
78
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
79
+ case hashString("stock"):
80
+ case hashString("crypto"):
81
+ case hashString("fiat"):
82
+ case hashString("transport"):
83
+ case hashString("other"):
84
+ case hashString("nothing"):
85
+ return true;
86
+ default:
87
+ return false;
88
+ }
89
+ }
90
+ };
91
+
92
+ } // namespace margelo::nitro
@@ -27,8 +27,8 @@ namespace margelo::nitro::rncandle { struct TransportAssetQuoteRequest; }
27
27
  // Forward declaration of `NothingAssetQuoteRequest` to properly resolve imports.
28
28
  namespace margelo::nitro::rncandle { struct NothingAssetQuoteRequest; }
29
29
 
30
- #include <optional>
31
30
  #include "FiatAssetQuoteRequest.hpp"
31
+ #include <optional>
32
32
  #include "MarketAssetQuoteRequest.hpp"
33
33
  #include "TransportAssetQuoteRequest.hpp"
34
34
  #include "NothingAssetQuoteRequest.hpp"
@@ -54,26 +54,24 @@ namespace margelo::nitro::rncandle {
54
54
 
55
55
  namespace margelo::nitro {
56
56
 
57
- using namespace margelo::nitro::rncandle;
58
-
59
57
  // C++ TradeAssetQuoteRequest <> JS TradeAssetQuoteRequest (object)
60
58
  template <>
61
- struct JSIConverter<TradeAssetQuoteRequest> final {
62
- static inline TradeAssetQuoteRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
59
+ struct JSIConverter<margelo::nitro::rncandle::TradeAssetQuoteRequest> final {
60
+ static inline margelo::nitro::rncandle::TradeAssetQuoteRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
61
  jsi::Object obj = arg.asObject(runtime);
64
- return TradeAssetQuoteRequest(
65
- JSIConverter<std::optional<FiatAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "fiatAssetQuoteRequest")),
66
- JSIConverter<std::optional<MarketAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "marketAssetQuoteRequest")),
67
- JSIConverter<std::optional<TransportAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "transportAssetQuoteRequest")),
68
- JSIConverter<std::optional<NothingAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "nothingAssetQuoteRequest"))
62
+ return margelo::nitro::rncandle::TradeAssetQuoteRequest(
63
+ JSIConverter<std::optional<margelo::nitro::rncandle::FiatAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "fiatAssetQuoteRequest")),
64
+ JSIConverter<std::optional<margelo::nitro::rncandle::MarketAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "marketAssetQuoteRequest")),
65
+ JSIConverter<std::optional<margelo::nitro::rncandle::TransportAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "transportAssetQuoteRequest")),
66
+ JSIConverter<std::optional<margelo::nitro::rncandle::NothingAssetQuoteRequest>>::fromJSI(runtime, obj.getProperty(runtime, "nothingAssetQuoteRequest"))
69
67
  );
70
68
  }
71
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeAssetQuoteRequest& arg) {
69
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradeAssetQuoteRequest& arg) {
72
70
  jsi::Object obj(runtime);
73
- obj.setProperty(runtime, "fiatAssetQuoteRequest", JSIConverter<std::optional<FiatAssetQuoteRequest>>::toJSI(runtime, arg.fiatAssetQuoteRequest));
74
- obj.setProperty(runtime, "marketAssetQuoteRequest", JSIConverter<std::optional<MarketAssetQuoteRequest>>::toJSI(runtime, arg.marketAssetQuoteRequest));
75
- obj.setProperty(runtime, "transportAssetQuoteRequest", JSIConverter<std::optional<TransportAssetQuoteRequest>>::toJSI(runtime, arg.transportAssetQuoteRequest));
76
- obj.setProperty(runtime, "nothingAssetQuoteRequest", JSIConverter<std::optional<NothingAssetQuoteRequest>>::toJSI(runtime, arg.nothingAssetQuoteRequest));
71
+ obj.setProperty(runtime, "fiatAssetQuoteRequest", JSIConverter<std::optional<margelo::nitro::rncandle::FiatAssetQuoteRequest>>::toJSI(runtime, arg.fiatAssetQuoteRequest));
72
+ obj.setProperty(runtime, "marketAssetQuoteRequest", JSIConverter<std::optional<margelo::nitro::rncandle::MarketAssetQuoteRequest>>::toJSI(runtime, arg.marketAssetQuoteRequest));
73
+ obj.setProperty(runtime, "transportAssetQuoteRequest", JSIConverter<std::optional<margelo::nitro::rncandle::TransportAssetQuoteRequest>>::toJSI(runtime, arg.transportAssetQuoteRequest));
74
+ obj.setProperty(runtime, "nothingAssetQuoteRequest", JSIConverter<std::optional<margelo::nitro::rncandle::NothingAssetQuoteRequest>>::toJSI(runtime, arg.nothingAssetQuoteRequest));
77
75
  return obj;
78
76
  }
79
77
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -81,10 +79,10 @@ namespace margelo::nitro {
81
79
  return false;
82
80
  }
83
81
  jsi::Object obj = value.getObject(runtime);
84
- if (!JSIConverter<std::optional<FiatAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "fiatAssetQuoteRequest"))) return false;
85
- if (!JSIConverter<std::optional<MarketAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "marketAssetQuoteRequest"))) return false;
86
- if (!JSIConverter<std::optional<TransportAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "transportAssetQuoteRequest"))) return false;
87
- if (!JSIConverter<std::optional<NothingAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "nothingAssetQuoteRequest"))) return false;
82
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::FiatAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "fiatAssetQuoteRequest"))) return false;
83
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::MarketAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "marketAssetQuoteRequest"))) return false;
84
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::TransportAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "transportAssetQuoteRequest"))) return false;
85
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::NothingAssetQuoteRequest>>::canConvert(runtime, obj.getProperty(runtime, "nothingAssetQuoteRequest"))) return false;
88
86
  return true;
89
87
  }
90
88
  };
@@ -29,8 +29,8 @@ namespace margelo::nitro::rncandle { struct OtherAssetRef; }
29
29
  // Forward declaration of `NothingAssetRef` to properly resolve imports.
30
30
  namespace margelo::nitro::rncandle { struct NothingAssetRef; }
31
31
 
32
- #include <optional>
33
32
  #include "FiatAssetRef.hpp"
33
+ #include <optional>
34
34
  #include "MarketTradeAssetRef.hpp"
35
35
  #include "TransportAssetRef.hpp"
36
36
  #include "OtherAssetRef.hpp"
@@ -58,28 +58,26 @@ namespace margelo::nitro::rncandle {
58
58
 
59
59
  namespace margelo::nitro {
60
60
 
61
- using namespace margelo::nitro::rncandle;
62
-
63
61
  // C++ TradeAssetRef <> JS TradeAssetRef (object)
64
62
  template <>
65
- struct JSIConverter<TradeAssetRef> final {
66
- static inline TradeAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
63
+ struct JSIConverter<margelo::nitro::rncandle::TradeAssetRef> final {
64
+ static inline margelo::nitro::rncandle::TradeAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
67
65
  jsi::Object obj = arg.asObject(runtime);
68
- return TradeAssetRef(
69
- JSIConverter<std::optional<FiatAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "fiatAssetRef")),
70
- JSIConverter<std::optional<MarketTradeAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "marketTradeAssetRef")),
71
- JSIConverter<std::optional<TransportAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "transportAssetRef")),
72
- JSIConverter<std::optional<OtherAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "otherAssetRef")),
73
- JSIConverter<std::optional<NothingAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "nothingAssetRef"))
66
+ return margelo::nitro::rncandle::TradeAssetRef(
67
+ JSIConverter<std::optional<margelo::nitro::rncandle::FiatAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "fiatAssetRef")),
68
+ JSIConverter<std::optional<margelo::nitro::rncandle::MarketTradeAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "marketTradeAssetRef")),
69
+ JSIConverter<std::optional<margelo::nitro::rncandle::TransportAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "transportAssetRef")),
70
+ JSIConverter<std::optional<margelo::nitro::rncandle::OtherAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "otherAssetRef")),
71
+ JSIConverter<std::optional<margelo::nitro::rncandle::NothingAssetRef>>::fromJSI(runtime, obj.getProperty(runtime, "nothingAssetRef"))
74
72
  );
75
73
  }
76
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeAssetRef& arg) {
74
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradeAssetRef& arg) {
77
75
  jsi::Object obj(runtime);
78
- obj.setProperty(runtime, "fiatAssetRef", JSIConverter<std::optional<FiatAssetRef>>::toJSI(runtime, arg.fiatAssetRef));
79
- obj.setProperty(runtime, "marketTradeAssetRef", JSIConverter<std::optional<MarketTradeAssetRef>>::toJSI(runtime, arg.marketTradeAssetRef));
80
- obj.setProperty(runtime, "transportAssetRef", JSIConverter<std::optional<TransportAssetRef>>::toJSI(runtime, arg.transportAssetRef));
81
- obj.setProperty(runtime, "otherAssetRef", JSIConverter<std::optional<OtherAssetRef>>::toJSI(runtime, arg.otherAssetRef));
82
- obj.setProperty(runtime, "nothingAssetRef", JSIConverter<std::optional<NothingAssetRef>>::toJSI(runtime, arg.nothingAssetRef));
76
+ obj.setProperty(runtime, "fiatAssetRef", JSIConverter<std::optional<margelo::nitro::rncandle::FiatAssetRef>>::toJSI(runtime, arg.fiatAssetRef));
77
+ obj.setProperty(runtime, "marketTradeAssetRef", JSIConverter<std::optional<margelo::nitro::rncandle::MarketTradeAssetRef>>::toJSI(runtime, arg.marketTradeAssetRef));
78
+ obj.setProperty(runtime, "transportAssetRef", JSIConverter<std::optional<margelo::nitro::rncandle::TransportAssetRef>>::toJSI(runtime, arg.transportAssetRef));
79
+ obj.setProperty(runtime, "otherAssetRef", JSIConverter<std::optional<margelo::nitro::rncandle::OtherAssetRef>>::toJSI(runtime, arg.otherAssetRef));
80
+ obj.setProperty(runtime, "nothingAssetRef", JSIConverter<std::optional<margelo::nitro::rncandle::NothingAssetRef>>::toJSI(runtime, arg.nothingAssetRef));
83
81
  return obj;
84
82
  }
85
83
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -87,11 +85,11 @@ namespace margelo::nitro {
87
85
  return false;
88
86
  }
89
87
  jsi::Object obj = value.getObject(runtime);
90
- if (!JSIConverter<std::optional<FiatAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "fiatAssetRef"))) return false;
91
- if (!JSIConverter<std::optional<MarketTradeAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "marketTradeAssetRef"))) return false;
92
- if (!JSIConverter<std::optional<TransportAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "transportAssetRef"))) return false;
93
- if (!JSIConverter<std::optional<OtherAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "otherAssetRef"))) return false;
94
- if (!JSIConverter<std::optional<NothingAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "nothingAssetRef"))) return false;
88
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::FiatAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "fiatAssetRef"))) return false;
89
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::MarketTradeAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "marketTradeAssetRef"))) return false;
90
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::TransportAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "transportAssetRef"))) return false;
91
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::OtherAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "otherAssetRef"))) return false;
92
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::NothingAssetRef>>::canConvert(runtime, obj.getProperty(runtime, "nothingAssetRef"))) return false;
95
93
  return true;
96
94
  }
97
95
  };
@@ -21,8 +21,8 @@
21
21
  // Forward declaration of `Trade` to properly resolve imports.
22
22
  namespace margelo::nitro::rncandle { struct Trade; }
23
23
 
24
- #include <optional>
25
24
  #include "Trade.hpp"
25
+ #include <optional>
26
26
  #include <string>
27
27
 
28
28
  namespace margelo::nitro::rncandle {
@@ -44,21 +44,19 @@ namespace margelo::nitro::rncandle {
44
44
 
45
45
  namespace margelo::nitro {
46
46
 
47
- using namespace margelo::nitro::rncandle;
48
-
49
47
  // C++ TradeExecutionResult <> JS TradeExecutionResult (object)
50
48
  template <>
51
- struct JSIConverter<TradeExecutionResult> final {
52
- static inline TradeExecutionResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
49
+ struct JSIConverter<margelo::nitro::rncandle::TradeExecutionResult> final {
50
+ static inline margelo::nitro::rncandle::TradeExecutionResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
53
51
  jsi::Object obj = arg.asObject(runtime);
54
- return TradeExecutionResult(
55
- JSIConverter<std::optional<Trade>>::fromJSI(runtime, obj.getProperty(runtime, "trade")),
52
+ return margelo::nitro::rncandle::TradeExecutionResult(
53
+ JSIConverter<std::optional<margelo::nitro::rncandle::Trade>>::fromJSI(runtime, obj.getProperty(runtime, "trade")),
56
54
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "error"))
57
55
  );
58
56
  }
59
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeExecutionResult& arg) {
57
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradeExecutionResult& arg) {
60
58
  jsi::Object obj(runtime);
61
- obj.setProperty(runtime, "trade", JSIConverter<std::optional<Trade>>::toJSI(runtime, arg.trade));
59
+ obj.setProperty(runtime, "trade", JSIConverter<std::optional<margelo::nitro::rncandle::Trade>>::toJSI(runtime, arg.trade));
62
60
  obj.setProperty(runtime, "error", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.error));
63
61
  return obj;
64
62
  }
@@ -67,7 +65,7 @@ namespace margelo::nitro {
67
65
  return false;
68
66
  }
69
67
  jsi::Object obj = value.getObject(runtime);
70
- if (!JSIConverter<std::optional<Trade>>::canConvert(runtime, obj.getProperty(runtime, "trade"))) return false;
68
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::Trade>>::canConvert(runtime, obj.getProperty(runtime, "trade"))) return false;
71
69
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "error"))) return false;
72
70
  return true;
73
71
  }
@@ -45,24 +45,22 @@ namespace margelo::nitro::rncandle {
45
45
 
46
46
  namespace margelo::nitro {
47
47
 
48
- using namespace margelo::nitro::rncandle;
49
-
50
48
  // C++ TradeQuote <> JS TradeQuote (object)
51
49
  template <>
52
- struct JSIConverter<TradeQuote> final {
53
- static inline TradeQuote fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
50
+ struct JSIConverter<margelo::nitro::rncandle::TradeQuote> final {
51
+ static inline margelo::nitro::rncandle::TradeQuote fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
54
52
  jsi::Object obj = arg.asObject(runtime);
55
- return TradeQuote(
56
- JSIConverter<TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "lost")),
57
- JSIConverter<TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "gained")),
53
+ return margelo::nitro::rncandle::TradeQuote(
54
+ JSIConverter<margelo::nitro::rncandle::TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "lost")),
55
+ JSIConverter<margelo::nitro::rncandle::TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "gained")),
58
56
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "context")),
59
57
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "expirationDateTime"))
60
58
  );
61
59
  }
62
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeQuote& arg) {
60
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradeQuote& arg) {
63
61
  jsi::Object obj(runtime);
64
- obj.setProperty(runtime, "lost", JSIConverter<TradeAsset>::toJSI(runtime, arg.lost));
65
- obj.setProperty(runtime, "gained", JSIConverter<TradeAsset>::toJSI(runtime, arg.gained));
62
+ obj.setProperty(runtime, "lost", JSIConverter<margelo::nitro::rncandle::TradeAsset>::toJSI(runtime, arg.lost));
63
+ obj.setProperty(runtime, "gained", JSIConverter<margelo::nitro::rncandle::TradeAsset>::toJSI(runtime, arg.gained));
66
64
  obj.setProperty(runtime, "context", JSIConverter<std::string>::toJSI(runtime, arg.context));
67
65
  obj.setProperty(runtime, "expirationDateTime", JSIConverter<std::string>::toJSI(runtime, arg.expirationDateTime));
68
66
  return obj;
@@ -72,8 +70,8 @@ namespace margelo::nitro {
72
70
  return false;
73
71
  }
74
72
  jsi::Object obj = value.getObject(runtime);
75
- if (!JSIConverter<TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
76
- if (!JSIConverter<TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
73
+ if (!JSIConverter<margelo::nitro::rncandle::TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
74
+ if (!JSIConverter<margelo::nitro::rncandle::TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
77
75
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "context"))) return false;
78
76
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "expirationDateTime"))) return false;
79
77
  return true;
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// TradeQuoteRequest.hpp
2
+ /// TradeQuotesRequest.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
@@ -21,48 +21,46 @@
21
21
  // Forward declaration of `TradeAssetQuoteRequest` to properly resolve imports.
22
22
  namespace margelo::nitro::rncandle { struct TradeAssetQuoteRequest; }
23
23
 
24
- #include <optional>
25
24
  #include <string>
25
+ #include <optional>
26
26
  #include "TradeAssetQuoteRequest.hpp"
27
27
 
28
28
  namespace margelo::nitro::rncandle {
29
29
 
30
30
  /**
31
- * A struct which can be represented as a JavaScript object (TradeQuoteRequest).
31
+ * A struct which can be represented as a JavaScript object (TradeQuotesRequest).
32
32
  */
33
- struct TradeQuoteRequest {
33
+ struct TradeQuotesRequest {
34
34
  public:
35
35
  std::optional<std::string> linkedAccountIDs SWIFT_PRIVATE;
36
36
  TradeAssetQuoteRequest gained SWIFT_PRIVATE;
37
37
  TradeAssetQuoteRequest lost SWIFT_PRIVATE;
38
38
 
39
39
  public:
40
- TradeQuoteRequest() = default;
41
- explicit TradeQuoteRequest(std::optional<std::string> linkedAccountIDs, TradeAssetQuoteRequest gained, TradeAssetQuoteRequest lost): linkedAccountIDs(linkedAccountIDs), gained(gained), lost(lost) {}
40
+ TradeQuotesRequest() = default;
41
+ explicit TradeQuotesRequest(std::optional<std::string> linkedAccountIDs, TradeAssetQuoteRequest gained, TradeAssetQuoteRequest lost): linkedAccountIDs(linkedAccountIDs), gained(gained), lost(lost) {}
42
42
  };
43
43
 
44
44
  } // namespace margelo::nitro::rncandle
45
45
 
46
46
  namespace margelo::nitro {
47
47
 
48
- using namespace margelo::nitro::rncandle;
49
-
50
- // C++ TradeQuoteRequest <> JS TradeQuoteRequest (object)
48
+ // C++ TradeQuotesRequest <> JS TradeQuotesRequest (object)
51
49
  template <>
52
- struct JSIConverter<TradeQuoteRequest> final {
53
- static inline TradeQuoteRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
50
+ struct JSIConverter<margelo::nitro::rncandle::TradeQuotesRequest> final {
51
+ static inline margelo::nitro::rncandle::TradeQuotesRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
54
52
  jsi::Object obj = arg.asObject(runtime);
55
- return TradeQuoteRequest(
53
+ return margelo::nitro::rncandle::TradeQuotesRequest(
56
54
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountIDs")),
57
- JSIConverter<TradeAssetQuoteRequest>::fromJSI(runtime, obj.getProperty(runtime, "gained")),
58
- JSIConverter<TradeAssetQuoteRequest>::fromJSI(runtime, obj.getProperty(runtime, "lost"))
55
+ JSIConverter<margelo::nitro::rncandle::TradeAssetQuoteRequest>::fromJSI(runtime, obj.getProperty(runtime, "gained")),
56
+ JSIConverter<margelo::nitro::rncandle::TradeAssetQuoteRequest>::fromJSI(runtime, obj.getProperty(runtime, "lost"))
59
57
  );
60
58
  }
61
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeQuoteRequest& arg) {
59
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradeQuotesRequest& arg) {
62
60
  jsi::Object obj(runtime);
63
61
  obj.setProperty(runtime, "linkedAccountIDs", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.linkedAccountIDs));
64
- obj.setProperty(runtime, "gained", JSIConverter<TradeAssetQuoteRequest>::toJSI(runtime, arg.gained));
65
- obj.setProperty(runtime, "lost", JSIConverter<TradeAssetQuoteRequest>::toJSI(runtime, arg.lost));
62
+ obj.setProperty(runtime, "gained", JSIConverter<margelo::nitro::rncandle::TradeAssetQuoteRequest>::toJSI(runtime, arg.gained));
63
+ obj.setProperty(runtime, "lost", JSIConverter<margelo::nitro::rncandle::TradeAssetQuoteRequest>::toJSI(runtime, arg.lost));
66
64
  return obj;
67
65
  }
68
66
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -71,8 +69,8 @@ namespace margelo::nitro {
71
69
  }
72
70
  jsi::Object obj = value.getObject(runtime);
73
71
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountIDs"))) return false;
74
- if (!JSIConverter<TradeAssetQuoteRequest>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
75
- if (!JSIConverter<TradeAssetQuoteRequest>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
72
+ if (!JSIConverter<margelo::nitro::rncandle::TradeAssetQuoteRequest>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
73
+ if (!JSIConverter<margelo::nitro::rncandle::TradeAssetQuoteRequest>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
76
74
  return true;
77
75
  }
78
76
  };
@@ -23,8 +23,8 @@ namespace margelo::nitro::rncandle { struct LinkedAccountStatusRef; }
23
23
  // Forward declaration of `TradeQuote` to properly resolve imports.
24
24
  namespace margelo::nitro::rncandle { struct TradeQuote; }
25
25
 
26
- #include <vector>
27
26
  #include "LinkedAccountStatusRef.hpp"
27
+ #include <vector>
28
28
  #include "TradeQuote.hpp"
29
29
 
30
30
  namespace margelo::nitro::rncandle {
@@ -46,22 +46,20 @@ namespace margelo::nitro::rncandle {
46
46
 
47
47
  namespace margelo::nitro {
48
48
 
49
- using namespace margelo::nitro::rncandle;
50
-
51
49
  // C++ TradeQuotesResponse <> JS TradeQuotesResponse (object)
52
50
  template <>
53
- struct JSIConverter<TradeQuotesResponse> final {
54
- static inline TradeQuotesResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
+ struct JSIConverter<margelo::nitro::rncandle::TradeQuotesResponse> final {
52
+ static inline margelo::nitro::rncandle::TradeQuotesResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
53
  jsi::Object obj = arg.asObject(runtime);
56
- return TradeQuotesResponse(
57
- JSIConverter<std::vector<LinkedAccountStatusRef>>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccounts")),
58
- JSIConverter<std::vector<TradeQuote>>::fromJSI(runtime, obj.getProperty(runtime, "tradeQuotes"))
54
+ return margelo::nitro::rncandle::TradeQuotesResponse(
55
+ JSIConverter<std::vector<margelo::nitro::rncandle::LinkedAccountStatusRef>>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccounts")),
56
+ JSIConverter<std::vector<margelo::nitro::rncandle::TradeQuote>>::fromJSI(runtime, obj.getProperty(runtime, "tradeQuotes"))
59
57
  );
60
58
  }
61
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeQuotesResponse& arg) {
59
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradeQuotesResponse& arg) {
62
60
  jsi::Object obj(runtime);
63
- obj.setProperty(runtime, "linkedAccounts", JSIConverter<std::vector<LinkedAccountStatusRef>>::toJSI(runtime, arg.linkedAccounts));
64
- obj.setProperty(runtime, "tradeQuotes", JSIConverter<std::vector<TradeQuote>>::toJSI(runtime, arg.tradeQuotes));
61
+ obj.setProperty(runtime, "linkedAccounts", JSIConverter<std::vector<margelo::nitro::rncandle::LinkedAccountStatusRef>>::toJSI(runtime, arg.linkedAccounts));
62
+ obj.setProperty(runtime, "tradeQuotes", JSIConverter<std::vector<margelo::nitro::rncandle::TradeQuote>>::toJSI(runtime, arg.tradeQuotes));
65
63
  return obj;
66
64
  }
67
65
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -69,8 +67,8 @@ namespace margelo::nitro {
69
67
  return false;
70
68
  }
71
69
  jsi::Object obj = value.getObject(runtime);
72
- if (!JSIConverter<std::vector<LinkedAccountStatusRef>>::canConvert(runtime, obj.getProperty(runtime, "linkedAccounts"))) return false;
73
- if (!JSIConverter<std::vector<TradeQuote>>::canConvert(runtime, obj.getProperty(runtime, "tradeQuotes"))) return false;
70
+ if (!JSIConverter<std::vector<margelo::nitro::rncandle::LinkedAccountStatusRef>>::canConvert(runtime, obj.getProperty(runtime, "linkedAccounts"))) return false;
71
+ if (!JSIConverter<std::vector<margelo::nitro::rncandle::TradeQuote>>::canConvert(runtime, obj.getProperty(runtime, "tradeQuotes"))) return false;
74
72
  return true;
75
73
  }
76
74
  };
@@ -42,22 +42,20 @@ namespace margelo::nitro::rncandle {
42
42
 
43
43
  namespace margelo::nitro {
44
44
 
45
- using namespace margelo::nitro::rncandle;
46
-
47
45
  // C++ TradeRef <> JS TradeRef (object)
48
46
  template <>
49
- struct JSIConverter<TradeRef> final {
50
- static inline TradeRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
+ struct JSIConverter<margelo::nitro::rncandle::TradeRef> final {
48
+ static inline margelo::nitro::rncandle::TradeRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
49
  jsi::Object obj = arg.asObject(runtime);
52
- return TradeRef(
53
- JSIConverter<TradeAssetRef>::fromJSI(runtime, obj.getProperty(runtime, "lost")),
54
- JSIConverter<TradeAssetRef>::fromJSI(runtime, obj.getProperty(runtime, "gained"))
50
+ return margelo::nitro::rncandle::TradeRef(
51
+ JSIConverter<margelo::nitro::rncandle::TradeAssetRef>::fromJSI(runtime, obj.getProperty(runtime, "lost")),
52
+ JSIConverter<margelo::nitro::rncandle::TradeAssetRef>::fromJSI(runtime, obj.getProperty(runtime, "gained"))
55
53
  );
56
54
  }
57
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeRef& arg) {
55
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradeRef& arg) {
58
56
  jsi::Object obj(runtime);
59
- obj.setProperty(runtime, "lost", JSIConverter<TradeAssetRef>::toJSI(runtime, arg.lost));
60
- obj.setProperty(runtime, "gained", JSIConverter<TradeAssetRef>::toJSI(runtime, arg.gained));
57
+ obj.setProperty(runtime, "lost", JSIConverter<margelo::nitro::rncandle::TradeAssetRef>::toJSI(runtime, arg.lost));
58
+ obj.setProperty(runtime, "gained", JSIConverter<margelo::nitro::rncandle::TradeAssetRef>::toJSI(runtime, arg.gained));
61
59
  return obj;
62
60
  }
63
61
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -65,8 +63,8 @@ namespace margelo::nitro {
65
63
  return false;
66
64
  }
67
65
  jsi::Object obj = value.getObject(runtime);
68
- if (!JSIConverter<TradeAssetRef>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
69
- if (!JSIConverter<TradeAssetRef>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
66
+ if (!JSIConverter<margelo::nitro::rncandle::TradeAssetRef>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
67
+ if (!JSIConverter<margelo::nitro::rncandle::TradeAssetRef>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
70
68
  return true;
71
69
  }
72
70
  };
@@ -38,26 +38,24 @@ namespace margelo::nitro::rncandle {
38
38
 
39
39
  namespace margelo::nitro {
40
40
 
41
- using namespace margelo::nitro::rncandle;
42
-
43
41
  // C++ TradeState <> JS TradeState (union)
44
42
  template <>
45
- struct JSIConverter<TradeState> final {
46
- static inline TradeState fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
43
+ struct JSIConverter<margelo::nitro::rncandle::TradeState> final {
44
+ static inline margelo::nitro::rncandle::TradeState fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
45
  std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
48
46
  switch (hashString(unionValue.c_str(), unionValue.size())) {
49
- case hashString("success"): return TradeState::SUCCESS;
50
- case hashString("inProgress"): return TradeState::INPROGRESS;
51
- case hashString("failure"): return TradeState::FAILURE;
47
+ case hashString("success"): return margelo::nitro::rncandle::TradeState::SUCCESS;
48
+ case hashString("inProgress"): return margelo::nitro::rncandle::TradeState::INPROGRESS;
49
+ case hashString("failure"): return margelo::nitro::rncandle::TradeState::FAILURE;
52
50
  default: [[unlikely]]
53
51
  throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum TradeState - invalid value!");
54
52
  }
55
53
  }
56
- static inline jsi::Value toJSI(jsi::Runtime& runtime, TradeState arg) {
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rncandle::TradeState arg) {
57
55
  switch (arg) {
58
- case TradeState::SUCCESS: return JSIConverter<std::string>::toJSI(runtime, "success");
59
- case TradeState::INPROGRESS: return JSIConverter<std::string>::toJSI(runtime, "inProgress");
60
- case TradeState::FAILURE: return JSIConverter<std::string>::toJSI(runtime, "failure");
56
+ case margelo::nitro::rncandle::TradeState::SUCCESS: return JSIConverter<std::string>::toJSI(runtime, "success");
57
+ case margelo::nitro::rncandle::TradeState::INPROGRESS: return JSIConverter<std::string>::toJSI(runtime, "inProgress");
58
+ case margelo::nitro::rncandle::TradeState::FAILURE: return JSIConverter<std::string>::toJSI(runtime, "failure");
61
59
  default: [[unlikely]]
62
60
  throw std::invalid_argument("Cannot convert TradeState to JS - invalid value: "
63
61
  + std::to_string(static_cast<int>(arg)) + "!");
@@ -0,0 +1,89 @@
1
+ ///
2
+ /// TradesQuery.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 `TradeAssetKind` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { enum class TradeAssetKind; }
23
+ // Forward declaration of `CounterpartyKind` to properly resolve imports.
24
+ namespace margelo::nitro::rncandle { enum class CounterpartyKind; }
25
+
26
+ #include <string>
27
+ #include <optional>
28
+ #include "TradeAssetKind.hpp"
29
+ #include "CounterpartyKind.hpp"
30
+
31
+ namespace margelo::nitro::rncandle {
32
+
33
+ /**
34
+ * A struct which can be represented as a JavaScript object (TradesQuery).
35
+ */
36
+ struct TradesQuery {
37
+ public:
38
+ std::optional<std::string> linkedAccountIDs SWIFT_PRIVATE;
39
+ std::optional<std::string> dateTimeSpan SWIFT_PRIVATE;
40
+ std::optional<TradeAssetKind> gainedAssetKind SWIFT_PRIVATE;
41
+ std::optional<TradeAssetKind> lostAssetKind SWIFT_PRIVATE;
42
+ std::optional<CounterpartyKind> counterpartyKind SWIFT_PRIVATE;
43
+
44
+ public:
45
+ TradesQuery() = default;
46
+ explicit TradesQuery(std::optional<std::string> linkedAccountIDs, std::optional<std::string> dateTimeSpan, std::optional<TradeAssetKind> gainedAssetKind, std::optional<TradeAssetKind> lostAssetKind, std::optional<CounterpartyKind> counterpartyKind): linkedAccountIDs(linkedAccountIDs), dateTimeSpan(dateTimeSpan), gainedAssetKind(gainedAssetKind), lostAssetKind(lostAssetKind), counterpartyKind(counterpartyKind) {}
47
+ };
48
+
49
+ } // namespace margelo::nitro::rncandle
50
+
51
+ namespace margelo::nitro {
52
+
53
+ // C++ TradesQuery <> JS TradesQuery (object)
54
+ template <>
55
+ struct JSIConverter<margelo::nitro::rncandle::TradesQuery> final {
56
+ static inline margelo::nitro::rncandle::TradesQuery fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
57
+ jsi::Object obj = arg.asObject(runtime);
58
+ return margelo::nitro::rncandle::TradesQuery(
59
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountIDs")),
60
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "dateTimeSpan")),
61
+ JSIConverter<std::optional<margelo::nitro::rncandle::TradeAssetKind>>::fromJSI(runtime, obj.getProperty(runtime, "gainedAssetKind")),
62
+ JSIConverter<std::optional<margelo::nitro::rncandle::TradeAssetKind>>::fromJSI(runtime, obj.getProperty(runtime, "lostAssetKind")),
63
+ JSIConverter<std::optional<margelo::nitro::rncandle::CounterpartyKind>>::fromJSI(runtime, obj.getProperty(runtime, "counterpartyKind"))
64
+ );
65
+ }
66
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradesQuery& arg) {
67
+ jsi::Object obj(runtime);
68
+ obj.setProperty(runtime, "linkedAccountIDs", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.linkedAccountIDs));
69
+ obj.setProperty(runtime, "dateTimeSpan", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.dateTimeSpan));
70
+ obj.setProperty(runtime, "gainedAssetKind", JSIConverter<std::optional<margelo::nitro::rncandle::TradeAssetKind>>::toJSI(runtime, arg.gainedAssetKind));
71
+ obj.setProperty(runtime, "lostAssetKind", JSIConverter<std::optional<margelo::nitro::rncandle::TradeAssetKind>>::toJSI(runtime, arg.lostAssetKind));
72
+ obj.setProperty(runtime, "counterpartyKind", JSIConverter<std::optional<margelo::nitro::rncandle::CounterpartyKind>>::toJSI(runtime, arg.counterpartyKind));
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, "linkedAccountIDs"))) return false;
81
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "dateTimeSpan"))) return false;
82
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::TradeAssetKind>>::canConvert(runtime, obj.getProperty(runtime, "gainedAssetKind"))) return false;
83
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::TradeAssetKind>>::canConvert(runtime, obj.getProperty(runtime, "lostAssetKind"))) return false;
84
+ if (!JSIConverter<std::optional<margelo::nitro::rncandle::CounterpartyKind>>::canConvert(runtime, obj.getProperty(runtime, "counterpartyKind"))) return false;
85
+ return true;
86
+ }
87
+ };
88
+
89
+ } // namespace margelo::nitro