react-native-candle 0.1.19 → 0.1.21

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 (54) hide show
  1. package/ReactNativeCandle.podspec +1 -1
  2. package/ios/Sources/CandleActionViewModel.swift +13 -0
  3. package/ios/Sources/CandleTradeExecutionSheetWrapper.swift +31 -0
  4. package/ios/Sources/HostingViewController.swift +7 -0
  5. package/ios/Sources/RNCandle.swift +300 -84
  6. package/lib/commonjs/index.js +140 -15
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/module/index.js +140 -15
  9. package/lib/module/index.js.map +1 -1
  10. package/lib/typescript/commonjs/src/index.d.ts +46 -13
  11. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  12. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +50 -2
  13. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
  14. package/lib/typescript/module/src/index.d.ts +46 -13
  15. package/lib/typescript/module/src/index.d.ts.map +1 -1
  16. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +50 -2
  17. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
  18. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +24 -8
  19. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +271 -113
  20. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +30 -3
  21. package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +106 -57
  22. package/nitrogen/generated/ios/swift/AssetAccountRef.swift +55 -0
  23. package/nitrogen/generated/ios/swift/FiatAssetRef.swift +75 -0
  24. package/nitrogen/generated/ios/swift/Func_void_AssetAccount.swift +44 -0
  25. package/nitrogen/generated/ios/swift/Func_void_LinkedAccount.swift +5 -5
  26. package/nitrogen/generated/ios/swift/Func_void_TradeExecutionResult.swift +46 -0
  27. package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +7 -2
  28. package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +86 -24
  29. package/nitrogen/generated/ios/swift/LinkedAccountRef.swift +33 -0
  30. package/nitrogen/generated/ios/swift/MarketTradeAssetRef.swift +55 -0
  31. package/nitrogen/generated/ios/swift/NothingAssetRef.swift +33 -0
  32. package/nitrogen/generated/ios/swift/OtherAssetRef.swift +33 -0
  33. package/nitrogen/generated/ios/swift/TradeAssetRef.swift +176 -0
  34. package/nitrogen/generated/ios/swift/TradeExecutionResult.swift +82 -0
  35. package/nitrogen/generated/ios/swift/TradeQuote.swift +13 -2
  36. package/nitrogen/generated/ios/swift/TradeRef.swift +44 -0
  37. package/nitrogen/generated/ios/swift/TransportAssetRef.swift +55 -0
  38. package/nitrogen/generated/shared/c++/AssetAccountRef.hpp +77 -0
  39. package/nitrogen/generated/shared/c++/FiatAssetRef.hpp +78 -0
  40. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.cpp +4 -1
  41. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +20 -8
  42. package/nitrogen/generated/shared/c++/{ExecuteTradeRequest.hpp → LinkedAccountRef.hpp} +11 -15
  43. package/nitrogen/generated/shared/c++/MarketTradeAssetRef.hpp +77 -0
  44. package/nitrogen/generated/shared/c++/NothingAssetRef.hpp +69 -0
  45. package/nitrogen/generated/shared/c++/OtherAssetRef.hpp +69 -0
  46. package/nitrogen/generated/shared/c++/TradeAssetRef.hpp +99 -0
  47. package/nitrogen/generated/shared/c++/TradeExecutionResult.hpp +76 -0
  48. package/nitrogen/generated/shared/c++/TradeQuote.hpp +7 -2
  49. package/nitrogen/generated/shared/c++/TradeRef.hpp +74 -0
  50. package/nitrogen/generated/shared/c++/TransportAssetRef.hpp +77 -0
  51. package/package.json +1 -1
  52. package/src/index.ts +199 -33
  53. package/src/specs/RNCandle.nitro.ts +64 -2
  54. package/nitrogen/generated/ios/swift/ExecuteTradeRequest.swift +0 -44
@@ -15,13 +15,16 @@ namespace margelo::nitro::rncandle {
15
15
  // load custom methods/properties
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
17
  prototype.registerHybridMethod("candleLinkSheet", &HybridRNCandleSpec::candleLinkSheet);
18
+ prototype.registerHybridMethod("candleTradeExecutionSheet", &HybridRNCandleSpec::candleTradeExecutionSheet);
18
19
  prototype.registerHybridMethod("initialize", &HybridRNCandleSpec::initialize);
19
20
  prototype.registerHybridMethod("getLinkedAccounts", &HybridRNCandleSpec::getLinkedAccounts);
21
+ prototype.registerHybridMethod("getLinkedAccount", &HybridRNCandleSpec::getLinkedAccount);
20
22
  prototype.registerHybridMethod("unlinkAccount", &HybridRNCandleSpec::unlinkAccount);
21
23
  prototype.registerHybridMethod("getAssetAccounts", &HybridRNCandleSpec::getAssetAccounts);
24
+ prototype.registerHybridMethod("getAssetAccount", &HybridRNCandleSpec::getAssetAccount);
22
25
  prototype.registerHybridMethod("getTrades", &HybridRNCandleSpec::getTrades);
26
+ prototype.registerHybridMethod("getTrade", &HybridRNCandleSpec::getTrade);
23
27
  prototype.registerHybridMethod("getTradeQuotes", &HybridRNCandleSpec::getTradeQuotes);
24
- prototype.registerHybridMethod("executeTrade", &HybridRNCandleSpec::executeTrade);
25
28
  prototype.registerHybridMethod("deleteUser", &HybridRNCandleSpec::deleteUser);
26
29
  prototype.registerHybridMethod("getAvailableTools", &HybridRNCandleSpec::getAvailableTools);
27
30
  prototype.registerHybridMethod("executeTool", &HybridRNCandleSpec::executeTool);
@@ -21,22 +21,28 @@ namespace margelo::nitro::rncandle { enum class PresentationBackground; }
21
21
  namespace margelo::nitro::rncandle { enum class PresentationStyle; }
22
22
  // Forward declaration of `LinkedAccount` to properly resolve imports.
23
23
  namespace margelo::nitro::rncandle { struct LinkedAccount; }
24
+ // Forward declaration of `TradeQuote` to properly resolve imports.
25
+ namespace margelo::nitro::rncandle { struct TradeQuote; }
26
+ // Forward declaration of `TradeExecutionResult` to properly resolve imports.
27
+ namespace margelo::nitro::rncandle { struct TradeExecutionResult; }
24
28
  // Forward declaration of `AppUser` to properly resolve imports.
25
29
  namespace margelo::nitro::rncandle { struct AppUser; }
30
+ // Forward declaration of `LinkedAccountRef` to properly resolve imports.
31
+ namespace margelo::nitro::rncandle { struct LinkedAccountRef; }
26
32
  // Forward declaration of `AssetAccount` to properly resolve imports.
27
33
  namespace margelo::nitro::rncandle { struct AssetAccount; }
28
34
  // Forward declaration of `AssetAccountQuery` to properly resolve imports.
29
35
  namespace margelo::nitro::rncandle { struct AssetAccountQuery; }
36
+ // Forward declaration of `AssetAccountRef` to properly resolve imports.
37
+ namespace margelo::nitro::rncandle { struct AssetAccountRef; }
30
38
  // Forward declaration of `Trade` to properly resolve imports.
31
39
  namespace margelo::nitro::rncandle { struct Trade; }
32
40
  // Forward declaration of `TradeQuery` to properly resolve imports.
33
41
  namespace margelo::nitro::rncandle { struct TradeQuery; }
34
- // Forward declaration of `TradeQuote` to properly resolve imports.
35
- namespace margelo::nitro::rncandle { struct TradeQuote; }
42
+ // Forward declaration of `TradeRef` to properly resolve imports.
43
+ namespace margelo::nitro::rncandle { struct TradeRef; }
36
44
  // Forward declaration of `TradeQuoteRequest` to properly resolve imports.
37
45
  namespace margelo::nitro::rncandle { struct TradeQuoteRequest; }
38
- // Forward declaration of `ExecuteTradeRequest` to properly resolve imports.
39
- namespace margelo::nitro::rncandle { struct ExecuteTradeRequest; }
40
46
  // Forward declaration of `AnyMap` to properly resolve imports.
41
47
  namespace NitroModules { class AnyMap; }
42
48
  // Forward declaration of `ToolCall` to properly resolve imports.
@@ -50,15 +56,18 @@ namespace margelo::nitro::rncandle { struct ToolCall; }
50
56
  #include "PresentationStyle.hpp"
51
57
  #include <functional>
52
58
  #include "LinkedAccount.hpp"
59
+ #include "TradeQuote.hpp"
60
+ #include "TradeExecutionResult.hpp"
53
61
  #include "AppUser.hpp"
54
62
  #include <NitroModules/Promise.hpp>
63
+ #include "LinkedAccountRef.hpp"
55
64
  #include "AssetAccount.hpp"
56
65
  #include "AssetAccountQuery.hpp"
66
+ #include "AssetAccountRef.hpp"
57
67
  #include "Trade.hpp"
58
68
  #include "TradeQuery.hpp"
59
- #include "TradeQuote.hpp"
69
+ #include "TradeRef.hpp"
60
70
  #include "TradeQuoteRequest.hpp"
61
- #include "ExecuteTradeRequest.hpp"
62
71
  #include <NitroModules/AnyMap.hpp>
63
72
  #include "ToolCall.hpp"
64
73
 
@@ -94,13 +103,16 @@ namespace margelo::nitro::rncandle {
94
103
  public:
95
104
  // Methods
96
105
  virtual void candleLinkSheet(bool isPresented, const std::optional<std::vector<Service>>& services, double cornerRadius, const std::optional<std::string>& customerName, bool showDynamicLoading, PresentationBackground presentationBackground, PresentationStyle presentationStyle, const std::function<void(const LinkedAccount& /* account */)>& onSuccess) = 0;
106
+ virtual void candleTradeExecutionSheet(const TradeQuote& tradeQuote, PresentationBackground presentationBackground, const std::function<void(const TradeExecutionResult& /* result */)>& completion) = 0;
97
107
  virtual void initialize(const AppUser& appUser) = 0;
98
108
  virtual std::shared_ptr<Promise<std::vector<LinkedAccount>>> getLinkedAccounts() = 0;
99
- virtual std::shared_ptr<Promise<void>> unlinkAccount(const std::string& linkedAccountID) = 0;
109
+ virtual std::shared_ptr<Promise<LinkedAccount>> getLinkedAccount(const LinkedAccountRef& ref) = 0;
110
+ virtual std::shared_ptr<Promise<void>> unlinkAccount(const LinkedAccountRef& ref) = 0;
100
111
  virtual std::shared_ptr<Promise<std::vector<AssetAccount>>> getAssetAccounts(const AssetAccountQuery& query) = 0;
112
+ virtual std::shared_ptr<Promise<AssetAccount>> getAssetAccount(const AssetAccountRef& ref) = 0;
101
113
  virtual std::shared_ptr<Promise<std::vector<Trade>>> getTrades(const TradeQuery& query) = 0;
114
+ virtual std::shared_ptr<Promise<Trade>> getTrade(const TradeRef& ref) = 0;
102
115
  virtual std::shared_ptr<Promise<std::vector<TradeQuote>>> getTradeQuotes(const TradeQuoteRequest& request) = 0;
103
- virtual std::shared_ptr<Promise<Trade>> executeTrade(const ExecuteTradeRequest& request) = 0;
104
116
  virtual std::shared_ptr<Promise<void>> deleteUser() = 0;
105
117
  virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<AnyMap>>>> getAvailableTools() = 0;
106
118
  virtual std::shared_ptr<Promise<std::string>> executeTool(const ToolCall& tool) = 0;
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// ExecuteTradeRequest.hpp
2
+ /// LinkedAccountRef.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
@@ -25,16 +25,15 @@
25
25
  namespace margelo::nitro::rncandle {
26
26
 
27
27
  /**
28
- * A struct which can be represented as a JavaScript object (ExecuteTradeRequest).
28
+ * A struct which can be represented as a JavaScript object (LinkedAccountRef).
29
29
  */
30
- struct ExecuteTradeRequest {
30
+ struct LinkedAccountRef {
31
31
  public:
32
32
  std::string linkedAccountID SWIFT_PRIVATE;
33
- std::string context SWIFT_PRIVATE;
34
33
 
35
34
  public:
36
- ExecuteTradeRequest() = default;
37
- explicit ExecuteTradeRequest(std::string linkedAccountID, std::string context): linkedAccountID(linkedAccountID), context(context) {}
35
+ LinkedAccountRef() = default;
36
+ explicit LinkedAccountRef(std::string linkedAccountID): linkedAccountID(linkedAccountID) {}
38
37
  };
39
38
 
40
39
  } // namespace margelo::nitro::rncandle
@@ -43,20 +42,18 @@ namespace margelo::nitro {
43
42
 
44
43
  using namespace margelo::nitro::rncandle;
45
44
 
46
- // C++ ExecuteTradeRequest <> JS ExecuteTradeRequest (object)
45
+ // C++ LinkedAccountRef <> JS LinkedAccountRef (object)
47
46
  template <>
48
- struct JSIConverter<ExecuteTradeRequest> final {
49
- static inline ExecuteTradeRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
+ struct JSIConverter<LinkedAccountRef> final {
48
+ static inline LinkedAccountRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
50
49
  jsi::Object obj = arg.asObject(runtime);
51
- return ExecuteTradeRequest(
52
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
53
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "context"))
50
+ return LinkedAccountRef(
51
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID"))
54
52
  );
55
53
  }
56
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const ExecuteTradeRequest& arg) {
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const LinkedAccountRef& arg) {
57
55
  jsi::Object obj(runtime);
58
56
  obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
59
- obj.setProperty(runtime, "context", JSIConverter<std::string>::toJSI(runtime, arg.context));
60
57
  return obj;
61
58
  }
62
59
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -65,7 +62,6 @@ namespace margelo::nitro {
65
62
  }
66
63
  jsi::Object obj = value.getObject(runtime);
67
64
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
68
- if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "context"))) return false;
69
65
  return true;
70
66
  }
71
67
  };
@@ -0,0 +1,77 @@
1
+ ///
2
+ /// MarketTradeAssetRef.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::rncandle {
26
+
27
+ /**
28
+ * A struct which can be represented as a JavaScript object (MarketTradeAssetRef).
29
+ */
30
+ struct MarketTradeAssetRef {
31
+ public:
32
+ std::string assetKind SWIFT_PRIVATE;
33
+ std::string serviceTradeID SWIFT_PRIVATE;
34
+ std::string linkedAccountID SWIFT_PRIVATE;
35
+
36
+ public:
37
+ MarketTradeAssetRef() = default;
38
+ explicit MarketTradeAssetRef(std::string assetKind, std::string serviceTradeID, std::string linkedAccountID): assetKind(assetKind), serviceTradeID(serviceTradeID), linkedAccountID(linkedAccountID) {}
39
+ };
40
+
41
+ } // namespace margelo::nitro::rncandle
42
+
43
+ namespace margelo::nitro {
44
+
45
+ using namespace margelo::nitro::rncandle;
46
+
47
+ // C++ MarketTradeAssetRef <> JS MarketTradeAssetRef (object)
48
+ template <>
49
+ struct JSIConverter<MarketTradeAssetRef> final {
50
+ static inline MarketTradeAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
+ jsi::Object obj = arg.asObject(runtime);
52
+ return MarketTradeAssetRef(
53
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
54
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceTradeID")),
55
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID"))
56
+ );
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const MarketTradeAssetRef& arg) {
59
+ jsi::Object obj(runtime);
60
+ obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
61
+ obj.setProperty(runtime, "serviceTradeID", JSIConverter<std::string>::toJSI(runtime, arg.serviceTradeID));
62
+ obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
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<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
71
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceTradeID"))) return false;
72
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
73
+ return true;
74
+ }
75
+ };
76
+
77
+ } // namespace margelo::nitro
@@ -0,0 +1,69 @@
1
+ ///
2
+ /// NothingAssetRef.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::rncandle {
26
+
27
+ /**
28
+ * A struct which can be represented as a JavaScript object (NothingAssetRef).
29
+ */
30
+ struct NothingAssetRef {
31
+ public:
32
+ std::string assetKind SWIFT_PRIVATE;
33
+
34
+ public:
35
+ NothingAssetRef() = default;
36
+ explicit NothingAssetRef(std::string assetKind): assetKind(assetKind) {}
37
+ };
38
+
39
+ } // namespace margelo::nitro::rncandle
40
+
41
+ namespace margelo::nitro {
42
+
43
+ using namespace margelo::nitro::rncandle;
44
+
45
+ // C++ NothingAssetRef <> JS NothingAssetRef (object)
46
+ template <>
47
+ struct JSIConverter<NothingAssetRef> final {
48
+ static inline NothingAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
49
+ jsi::Object obj = arg.asObject(runtime);
50
+ return NothingAssetRef(
51
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind"))
52
+ );
53
+ }
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const NothingAssetRef& arg) {
55
+ jsi::Object obj(runtime);
56
+ obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
57
+ return obj;
58
+ }
59
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
60
+ if (!value.isObject()) {
61
+ return false;
62
+ }
63
+ jsi::Object obj = value.getObject(runtime);
64
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
65
+ return true;
66
+ }
67
+ };
68
+
69
+ } // namespace margelo::nitro
@@ -0,0 +1,69 @@
1
+ ///
2
+ /// OtherAssetRef.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::rncandle {
26
+
27
+ /**
28
+ * A struct which can be represented as a JavaScript object (OtherAssetRef).
29
+ */
30
+ struct OtherAssetRef {
31
+ public:
32
+ std::string assetKind SWIFT_PRIVATE;
33
+
34
+ public:
35
+ OtherAssetRef() = default;
36
+ explicit OtherAssetRef(std::string assetKind): assetKind(assetKind) {}
37
+ };
38
+
39
+ } // namespace margelo::nitro::rncandle
40
+
41
+ namespace margelo::nitro {
42
+
43
+ using namespace margelo::nitro::rncandle;
44
+
45
+ // C++ OtherAssetRef <> JS OtherAssetRef (object)
46
+ template <>
47
+ struct JSIConverter<OtherAssetRef> final {
48
+ static inline OtherAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
49
+ jsi::Object obj = arg.asObject(runtime);
50
+ return OtherAssetRef(
51
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind"))
52
+ );
53
+ }
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const OtherAssetRef& arg) {
55
+ jsi::Object obj(runtime);
56
+ obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
57
+ return obj;
58
+ }
59
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
60
+ if (!value.isObject()) {
61
+ return false;
62
+ }
63
+ jsi::Object obj = value.getObject(runtime);
64
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
65
+ return true;
66
+ }
67
+ };
68
+
69
+ } // namespace margelo::nitro
@@ -0,0 +1,99 @@
1
+ ///
2
+ /// TradeAssetRef.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 `FiatAssetRef` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { struct FiatAssetRef; }
23
+ // Forward declaration of `MarketTradeAssetRef` to properly resolve imports.
24
+ namespace margelo::nitro::rncandle { struct MarketTradeAssetRef; }
25
+ // Forward declaration of `TransportAssetRef` to properly resolve imports.
26
+ namespace margelo::nitro::rncandle { struct TransportAssetRef; }
27
+ // Forward declaration of `OtherAssetRef` to properly resolve imports.
28
+ namespace margelo::nitro::rncandle { struct OtherAssetRef; }
29
+ // Forward declaration of `NothingAssetRef` to properly resolve imports.
30
+ namespace margelo::nitro::rncandle { struct NothingAssetRef; }
31
+
32
+ #include <optional>
33
+ #include "FiatAssetRef.hpp"
34
+ #include "MarketTradeAssetRef.hpp"
35
+ #include "TransportAssetRef.hpp"
36
+ #include "OtherAssetRef.hpp"
37
+ #include "NothingAssetRef.hpp"
38
+
39
+ namespace margelo::nitro::rncandle {
40
+
41
+ /**
42
+ * A struct which can be represented as a JavaScript object (TradeAssetRef).
43
+ */
44
+ struct TradeAssetRef {
45
+ public:
46
+ std::optional<FiatAssetRef> fiatAssetRef SWIFT_PRIVATE;
47
+ std::optional<MarketTradeAssetRef> marketTradeAssetRef SWIFT_PRIVATE;
48
+ std::optional<TransportAssetRef> transportAssetRef SWIFT_PRIVATE;
49
+ std::optional<OtherAssetRef> otherAssetRef SWIFT_PRIVATE;
50
+ std::optional<NothingAssetRef> nothingAssetRef SWIFT_PRIVATE;
51
+
52
+ public:
53
+ TradeAssetRef() = default;
54
+ explicit TradeAssetRef(std::optional<FiatAssetRef> fiatAssetRef, std::optional<MarketTradeAssetRef> marketTradeAssetRef, std::optional<TransportAssetRef> transportAssetRef, std::optional<OtherAssetRef> otherAssetRef, std::optional<NothingAssetRef> nothingAssetRef): fiatAssetRef(fiatAssetRef), marketTradeAssetRef(marketTradeAssetRef), transportAssetRef(transportAssetRef), otherAssetRef(otherAssetRef), nothingAssetRef(nothingAssetRef) {}
55
+ };
56
+
57
+ } // namespace margelo::nitro::rncandle
58
+
59
+ namespace margelo::nitro {
60
+
61
+ using namespace margelo::nitro::rncandle;
62
+
63
+ // C++ TradeAssetRef <> JS TradeAssetRef (object)
64
+ template <>
65
+ struct JSIConverter<TradeAssetRef> final {
66
+ static inline TradeAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
67
+ 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"))
74
+ );
75
+ }
76
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeAssetRef& arg) {
77
+ 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));
83
+ return obj;
84
+ }
85
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
86
+ if (!value.isObject()) {
87
+ return false;
88
+ }
89
+ 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;
95
+ return true;
96
+ }
97
+ };
98
+
99
+ } // namespace margelo::nitro
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// TradeExecutionResult.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 `Trade` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { struct Trade; }
23
+
24
+ #include <optional>
25
+ #include "Trade.hpp"
26
+ #include <string>
27
+
28
+ namespace margelo::nitro::rncandle {
29
+
30
+ /**
31
+ * A struct which can be represented as a JavaScript object (TradeExecutionResult).
32
+ */
33
+ struct TradeExecutionResult {
34
+ public:
35
+ std::optional<Trade> trade SWIFT_PRIVATE;
36
+ std::optional<std::string> error SWIFT_PRIVATE;
37
+
38
+ public:
39
+ TradeExecutionResult() = default;
40
+ explicit TradeExecutionResult(std::optional<Trade> trade, std::optional<std::string> error): trade(trade), error(error) {}
41
+ };
42
+
43
+ } // namespace margelo::nitro::rncandle
44
+
45
+ namespace margelo::nitro {
46
+
47
+ using namespace margelo::nitro::rncandle;
48
+
49
+ // C++ TradeExecutionResult <> JS TradeExecutionResult (object)
50
+ template <>
51
+ struct JSIConverter<TradeExecutionResult> final {
52
+ static inline TradeExecutionResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
53
+ jsi::Object obj = arg.asObject(runtime);
54
+ return TradeExecutionResult(
55
+ JSIConverter<std::optional<Trade>>::fromJSI(runtime, obj.getProperty(runtime, "trade")),
56
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "error"))
57
+ );
58
+ }
59
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeExecutionResult& arg) {
60
+ jsi::Object obj(runtime);
61
+ obj.setProperty(runtime, "trade", JSIConverter<std::optional<Trade>>::toJSI(runtime, arg.trade));
62
+ obj.setProperty(runtime, "error", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.error));
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<std::optional<Trade>>::canConvert(runtime, obj.getProperty(runtime, "trade"))) return false;
71
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "error"))) return false;
72
+ return true;
73
+ }
74
+ };
75
+
76
+ } // namespace margelo::nitro
@@ -22,6 +22,7 @@
22
22
  namespace margelo::nitro::rncandle { struct TradeAsset; }
23
23
 
24
24
  #include "TradeAsset.hpp"
25
+ #include <string>
25
26
 
26
27
  namespace margelo::nitro::rncandle {
27
28
 
@@ -32,10 +33,11 @@ namespace margelo::nitro::rncandle {
32
33
  public:
33
34
  TradeAsset lost SWIFT_PRIVATE;
34
35
  TradeAsset gained SWIFT_PRIVATE;
36
+ std::string context SWIFT_PRIVATE;
35
37
 
36
38
  public:
37
39
  TradeQuote() = default;
38
- explicit TradeQuote(TradeAsset lost, TradeAsset gained): lost(lost), gained(gained) {}
40
+ explicit TradeQuote(TradeAsset lost, TradeAsset gained, std::string context): lost(lost), gained(gained), context(context) {}
39
41
  };
40
42
 
41
43
  } // namespace margelo::nitro::rncandle
@@ -51,13 +53,15 @@ namespace margelo::nitro {
51
53
  jsi::Object obj = arg.asObject(runtime);
52
54
  return TradeQuote(
53
55
  JSIConverter<TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "lost")),
54
- JSIConverter<TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "gained"))
56
+ JSIConverter<TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "gained")),
57
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "context"))
55
58
  );
56
59
  }
57
60
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeQuote& arg) {
58
61
  jsi::Object obj(runtime);
59
62
  obj.setProperty(runtime, "lost", JSIConverter<TradeAsset>::toJSI(runtime, arg.lost));
60
63
  obj.setProperty(runtime, "gained", JSIConverter<TradeAsset>::toJSI(runtime, arg.gained));
64
+ obj.setProperty(runtime, "context", JSIConverter<std::string>::toJSI(runtime, arg.context));
61
65
  return obj;
62
66
  }
63
67
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -67,6 +71,7 @@ namespace margelo::nitro {
67
71
  jsi::Object obj = value.getObject(runtime);
68
72
  if (!JSIConverter<TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
69
73
  if (!JSIConverter<TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
74
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "context"))) return false;
70
75
  return true;
71
76
  }
72
77
  };
@@ -0,0 +1,74 @@
1
+ ///
2
+ /// TradeRef.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 `TradeAssetRef` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { struct TradeAssetRef; }
23
+
24
+ #include "TradeAssetRef.hpp"
25
+
26
+ namespace margelo::nitro::rncandle {
27
+
28
+ /**
29
+ * A struct which can be represented as a JavaScript object (TradeRef).
30
+ */
31
+ struct TradeRef {
32
+ public:
33
+ TradeAssetRef lost SWIFT_PRIVATE;
34
+ TradeAssetRef gained SWIFT_PRIVATE;
35
+
36
+ public:
37
+ TradeRef() = default;
38
+ explicit TradeRef(TradeAssetRef lost, TradeAssetRef gained): lost(lost), gained(gained) {}
39
+ };
40
+
41
+ } // namespace margelo::nitro::rncandle
42
+
43
+ namespace margelo::nitro {
44
+
45
+ using namespace margelo::nitro::rncandle;
46
+
47
+ // C++ TradeRef <> JS TradeRef (object)
48
+ template <>
49
+ struct JSIConverter<TradeRef> final {
50
+ static inline TradeRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
+ 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"))
55
+ );
56
+ }
57
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeRef& arg) {
58
+ 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));
61
+ return obj;
62
+ }
63
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
64
+ if (!value.isObject()) {
65
+ return false;
66
+ }
67
+ 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;
70
+ return true;
71
+ }
72
+ };
73
+
74
+ } // namespace margelo::nitro