react-native-candle 0.1.26 → 0.1.28

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 (46) hide show
  1. package/ReactNativeCandle.podspec +1 -1
  2. package/ios/Sources/CandleLinkSheetWrapperView.swift +2 -2
  3. package/ios/Sources/RNCandle.swift +101 -44
  4. package/lib/commonjs/index.js +53 -25
  5. package/lib/commonjs/index.js.map +1 -1
  6. package/lib/module/index.js +53 -25
  7. package/lib/module/index.js.map +1 -1
  8. package/lib/typescript/commonjs/src/index.d.ts +15 -5
  9. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  10. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +29 -3
  11. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
  12. package/lib/typescript/module/src/index.d.ts +15 -5
  13. package/lib/typescript/module/src/index.d.ts.map +1 -1
  14. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +29 -3
  15. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
  16. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +12 -12
  17. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +110 -72
  18. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +18 -0
  19. package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +21 -3
  20. package/nitrogen/generated/ios/swift/AssetAccountsResponse.swift +70 -0
  21. package/nitrogen/generated/ios/swift/{Func_void_std__vector_TradeQuote_.swift → Func_void_AssetAccountsResponse.swift} +11 -11
  22. package/nitrogen/generated/ios/swift/{Func_void_std__vector_AssetAccount_.swift → Func_void_TradeQuotesResponse.swift} +11 -12
  23. package/nitrogen/generated/ios/swift/{Func_void_std__vector_Trade_.swift → Func_void_TradesResponse.swift} +11 -12
  24. package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +3 -3
  25. package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +21 -51
  26. package/nitrogen/generated/ios/swift/LinkedAccountDetails.swift +33 -1
  27. package/nitrogen/generated/ios/swift/LinkedAccountStatusRef.swift +67 -0
  28. package/nitrogen/generated/ios/swift/StatePayload.swift +42 -0
  29. package/nitrogen/generated/ios/swift/TradeQuote.swift +13 -2
  30. package/nitrogen/generated/ios/swift/TradeQuotesResponse.swift +70 -0
  31. package/nitrogen/generated/ios/swift/TradesResponse.swift +70 -0
  32. package/nitrogen/generated/ios/swift/TransportAsset.swift +25 -2
  33. package/nitrogen/generated/ios/swift/UnavailableLinkedAccountDetails.swift +34 -0
  34. package/nitrogen/generated/shared/c++/AssetAccountsResponse.hpp +78 -0
  35. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +18 -9
  36. package/nitrogen/generated/shared/c++/LinkedAccountDetails.hpp +9 -2
  37. package/nitrogen/generated/shared/c++/LinkedAccountStatusRef.hpp +86 -0
  38. package/nitrogen/generated/shared/c++/StatePayload.hpp +82 -0
  39. package/nitrogen/generated/shared/c++/TradeQuote.hpp +6 -2
  40. package/nitrogen/generated/shared/c++/TradeQuotesResponse.hpp +78 -0
  41. package/nitrogen/generated/shared/c++/TradesResponse.hpp +78 -0
  42. package/nitrogen/generated/shared/c++/TransportAsset.hpp +9 -1
  43. package/nitrogen/generated/shared/c++/UnavailableLinkedAccountDetails.hpp +69 -0
  44. package/package.json +1 -1
  45. package/src/index.ts +57 -24
  46. package/src/specs/RNCandle.nitro.ts +35 -3
@@ -0,0 +1,34 @@
1
+ ///
2
+ /// UnavailableLinkedAccountDetails.swift
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
+ import NitroModules
9
+
10
+ /// Represents an instance of `UnavailableLinkedAccountDetails`, backed by a C++ struct.
11
+ public typealias UnavailableLinkedAccountDetails = margelo.nitro.rncandle
12
+ .UnavailableLinkedAccountDetails
13
+
14
+ extension UnavailableLinkedAccountDetails {
15
+ private typealias bridge = margelo.nitro.rncandle.bridge.swift
16
+
17
+ /**
18
+ * Create a new instance of `UnavailableLinkedAccountDetails`.
19
+ */
20
+ public init(state: String) {
21
+ self.init(std.string(state))
22
+ }
23
+
24
+ public var state: String {
25
+ @inline(__always)
26
+ get {
27
+ return String(self.__state)
28
+ }
29
+ @inline(__always)
30
+ set {
31
+ self.__state = std.string(newValue)
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,78 @@
1
+ ///
2
+ /// AssetAccountsResponse.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 `LinkedAccountStatusRef` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { struct LinkedAccountStatusRef; }
23
+ // Forward declaration of `AssetAccount` to properly resolve imports.
24
+ namespace margelo::nitro::rncandle { struct AssetAccount; }
25
+
26
+ #include <vector>
27
+ #include "LinkedAccountStatusRef.hpp"
28
+ #include "AssetAccount.hpp"
29
+
30
+ namespace margelo::nitro::rncandle {
31
+
32
+ /**
33
+ * A struct which can be represented as a JavaScript object (AssetAccountsResponse).
34
+ */
35
+ struct AssetAccountsResponse {
36
+ public:
37
+ std::vector<LinkedAccountStatusRef> linkedAccounts SWIFT_PRIVATE;
38
+ std::vector<AssetAccount> assetAccounts SWIFT_PRIVATE;
39
+
40
+ public:
41
+ AssetAccountsResponse() = default;
42
+ explicit AssetAccountsResponse(std::vector<LinkedAccountStatusRef> linkedAccounts, std::vector<AssetAccount> assetAccounts): linkedAccounts(linkedAccounts), assetAccounts(assetAccounts) {}
43
+ };
44
+
45
+ } // namespace margelo::nitro::rncandle
46
+
47
+ namespace margelo::nitro {
48
+
49
+ using namespace margelo::nitro::rncandle;
50
+
51
+ // C++ AssetAccountsResponse <> JS AssetAccountsResponse (object)
52
+ template <>
53
+ struct JSIConverter<AssetAccountsResponse> final {
54
+ static inline AssetAccountsResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
+ jsi::Object obj = arg.asObject(runtime);
56
+ return AssetAccountsResponse(
57
+ JSIConverter<std::vector<LinkedAccountStatusRef>>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccounts")),
58
+ JSIConverter<std::vector<AssetAccount>>::fromJSI(runtime, obj.getProperty(runtime, "assetAccounts"))
59
+ );
60
+ }
61
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const AssetAccountsResponse& arg) {
62
+ jsi::Object obj(runtime);
63
+ obj.setProperty(runtime, "linkedAccounts", JSIConverter<std::vector<LinkedAccountStatusRef>>::toJSI(runtime, arg.linkedAccounts));
64
+ obj.setProperty(runtime, "assetAccounts", JSIConverter<std::vector<AssetAccount>>::toJSI(runtime, arg.assetAccounts));
65
+ return obj;
66
+ }
67
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
+ if (!value.isObject()) {
69
+ return false;
70
+ }
71
+ 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<AssetAccount>>::canConvert(runtime, obj.getProperty(runtime, "assetAccounts"))) return false;
74
+ return true;
75
+ }
76
+ };
77
+
78
+ } // namespace margelo::nitro
@@ -29,18 +29,24 @@ namespace margelo::nitro::rncandle { struct TradeExecutionResult; }
29
29
  namespace margelo::nitro::rncandle { struct AppUser; }
30
30
  // Forward declaration of `LinkedAccountRef` to properly resolve imports.
31
31
  namespace margelo::nitro::rncandle { struct LinkedAccountRef; }
32
- // Forward declaration of `AssetAccount` to properly resolve imports.
33
- namespace margelo::nitro::rncandle { struct AssetAccount; }
32
+ // Forward declaration of `AssetAccountsResponse` to properly resolve imports.
33
+ namespace margelo::nitro::rncandle { struct AssetAccountsResponse; }
34
34
  // Forward declaration of `AssetAccountQuery` to properly resolve imports.
35
35
  namespace margelo::nitro::rncandle { struct AssetAccountQuery; }
36
+ // Forward declaration of `AssetAccount` to properly resolve imports.
37
+ namespace margelo::nitro::rncandle { struct AssetAccount; }
36
38
  // Forward declaration of `AssetAccountRef` to properly resolve imports.
37
39
  namespace margelo::nitro::rncandle { struct AssetAccountRef; }
38
- // Forward declaration of `Trade` to properly resolve imports.
39
- namespace margelo::nitro::rncandle { struct Trade; }
40
+ // Forward declaration of `TradesResponse` to properly resolve imports.
41
+ namespace margelo::nitro::rncandle { struct TradesResponse; }
40
42
  // Forward declaration of `TradeQuery` to properly resolve imports.
41
43
  namespace margelo::nitro::rncandle { struct TradeQuery; }
44
+ // Forward declaration of `Trade` to properly resolve imports.
45
+ namespace margelo::nitro::rncandle { struct Trade; }
42
46
  // Forward declaration of `TradeRef` to properly resolve imports.
43
47
  namespace margelo::nitro::rncandle { struct TradeRef; }
48
+ // Forward declaration of `TradeQuotesResponse` to properly resolve imports.
49
+ namespace margelo::nitro::rncandle { struct TradeQuotesResponse; }
44
50
  // Forward declaration of `TradeQuoteRequest` to properly resolve imports.
45
51
  namespace margelo::nitro::rncandle { struct TradeQuoteRequest; }
46
52
  // Forward declaration of `AnyMap` to properly resolve imports.
@@ -61,12 +67,15 @@ namespace margelo::nitro::rncandle { struct ToolCall; }
61
67
  #include "AppUser.hpp"
62
68
  #include <NitroModules/Promise.hpp>
63
69
  #include "LinkedAccountRef.hpp"
64
- #include "AssetAccount.hpp"
70
+ #include "AssetAccountsResponse.hpp"
65
71
  #include "AssetAccountQuery.hpp"
72
+ #include "AssetAccount.hpp"
66
73
  #include "AssetAccountRef.hpp"
67
- #include "Trade.hpp"
74
+ #include "TradesResponse.hpp"
68
75
  #include "TradeQuery.hpp"
76
+ #include "Trade.hpp"
69
77
  #include "TradeRef.hpp"
78
+ #include "TradeQuotesResponse.hpp"
70
79
  #include "TradeQuoteRequest.hpp"
71
80
  #include <NitroModules/AnyMap.hpp>
72
81
  #include "ToolCall.hpp"
@@ -108,11 +117,11 @@ namespace margelo::nitro::rncandle {
108
117
  virtual std::shared_ptr<Promise<std::vector<LinkedAccount>>> getLinkedAccounts() = 0;
109
118
  virtual std::shared_ptr<Promise<LinkedAccount>> getLinkedAccount(const LinkedAccountRef& ref) = 0;
110
119
  virtual std::shared_ptr<Promise<void>> unlinkAccount(const LinkedAccountRef& ref) = 0;
111
- virtual std::shared_ptr<Promise<std::vector<AssetAccount>>> getAssetAccounts(const AssetAccountQuery& query) = 0;
120
+ virtual std::shared_ptr<Promise<AssetAccountsResponse>> getAssetAccounts(const AssetAccountQuery& query) = 0;
112
121
  virtual std::shared_ptr<Promise<AssetAccount>> getAssetAccount(const AssetAccountRef& ref) = 0;
113
- virtual std::shared_ptr<Promise<std::vector<Trade>>> getTrades(const TradeQuery& query) = 0;
122
+ virtual std::shared_ptr<Promise<TradesResponse>> getTrades(const TradeQuery& query) = 0;
114
123
  virtual std::shared_ptr<Promise<Trade>> getTrade(const TradeRef& ref) = 0;
115
- virtual std::shared_ptr<Promise<std::vector<TradeQuote>>> getTradeQuotes(const TradeQuoteRequest& request) = 0;
124
+ virtual std::shared_ptr<Promise<TradeQuotesResponse>> getTradeQuotes(const TradeQuoteRequest& request) = 0;
116
125
  virtual std::shared_ptr<Promise<void>> deleteUser() = 0;
117
126
  virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<AnyMap>>>> getAvailableTools() = 0;
118
127
  virtual std::shared_ptr<Promise<std::string>> executeTool(const ToolCall& tool) = 0;
@@ -22,10 +22,13 @@
22
22
  namespace margelo::nitro::rncandle { struct ActiveLinkedAccountDetails; }
23
23
  // Forward declaration of `InactiveLinkedAccountDetails` to properly resolve imports.
24
24
  namespace margelo::nitro::rncandle { struct InactiveLinkedAccountDetails; }
25
+ // Forward declaration of `UnavailableLinkedAccountDetails` to properly resolve imports.
26
+ namespace margelo::nitro::rncandle { struct UnavailableLinkedAccountDetails; }
25
27
 
26
28
  #include <optional>
27
29
  #include "ActiveLinkedAccountDetails.hpp"
28
30
  #include "InactiveLinkedAccountDetails.hpp"
31
+ #include "UnavailableLinkedAccountDetails.hpp"
29
32
 
30
33
  namespace margelo::nitro::rncandle {
31
34
 
@@ -36,10 +39,11 @@ namespace margelo::nitro::rncandle {
36
39
  public:
37
40
  std::optional<ActiveLinkedAccountDetails> activeLinkedAccountDetails SWIFT_PRIVATE;
38
41
  std::optional<InactiveLinkedAccountDetails> inactiveLinkedAccountDetails SWIFT_PRIVATE;
42
+ std::optional<UnavailableLinkedAccountDetails> unavailableLinkedAccountDetails SWIFT_PRIVATE;
39
43
 
40
44
  public:
41
45
  LinkedAccountDetails() = default;
42
- explicit LinkedAccountDetails(std::optional<ActiveLinkedAccountDetails> activeLinkedAccountDetails, std::optional<InactiveLinkedAccountDetails> inactiveLinkedAccountDetails): activeLinkedAccountDetails(activeLinkedAccountDetails), inactiveLinkedAccountDetails(inactiveLinkedAccountDetails) {}
46
+ explicit LinkedAccountDetails(std::optional<ActiveLinkedAccountDetails> activeLinkedAccountDetails, std::optional<InactiveLinkedAccountDetails> inactiveLinkedAccountDetails, std::optional<UnavailableLinkedAccountDetails> unavailableLinkedAccountDetails): activeLinkedAccountDetails(activeLinkedAccountDetails), inactiveLinkedAccountDetails(inactiveLinkedAccountDetails), unavailableLinkedAccountDetails(unavailableLinkedAccountDetails) {}
43
47
  };
44
48
 
45
49
  } // namespace margelo::nitro::rncandle
@@ -55,13 +59,15 @@ namespace margelo::nitro {
55
59
  jsi::Object obj = arg.asObject(runtime);
56
60
  return LinkedAccountDetails(
57
61
  JSIConverter<std::optional<ActiveLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "activeLinkedAccountDetails")),
58
- JSIConverter<std::optional<InactiveLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "inactiveLinkedAccountDetails"))
62
+ JSIConverter<std::optional<InactiveLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "inactiveLinkedAccountDetails")),
63
+ JSIConverter<std::optional<UnavailableLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "unavailableLinkedAccountDetails"))
59
64
  );
60
65
  }
61
66
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const LinkedAccountDetails& arg) {
62
67
  jsi::Object obj(runtime);
63
68
  obj.setProperty(runtime, "activeLinkedAccountDetails", JSIConverter<std::optional<ActiveLinkedAccountDetails>>::toJSI(runtime, arg.activeLinkedAccountDetails));
64
69
  obj.setProperty(runtime, "inactiveLinkedAccountDetails", JSIConverter<std::optional<InactiveLinkedAccountDetails>>::toJSI(runtime, arg.inactiveLinkedAccountDetails));
70
+ obj.setProperty(runtime, "unavailableLinkedAccountDetails", JSIConverter<std::optional<UnavailableLinkedAccountDetails>>::toJSI(runtime, arg.unavailableLinkedAccountDetails));
65
71
  return obj;
66
72
  }
67
73
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -71,6 +77,7 @@ namespace margelo::nitro {
71
77
  jsi::Object obj = value.getObject(runtime);
72
78
  if (!JSIConverter<std::optional<ActiveLinkedAccountDetails>>::canConvert(runtime, obj.getProperty(runtime, "activeLinkedAccountDetails"))) return false;
73
79
  if (!JSIConverter<std::optional<InactiveLinkedAccountDetails>>::canConvert(runtime, obj.getProperty(runtime, "inactiveLinkedAccountDetails"))) return false;
80
+ if (!JSIConverter<std::optional<UnavailableLinkedAccountDetails>>::canConvert(runtime, obj.getProperty(runtime, "unavailableLinkedAccountDetails"))) return false;
74
81
  return true;
75
82
  }
76
83
  };
@@ -0,0 +1,86 @@
1
+ ///
2
+ /// LinkedAccountStatusRef.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 `Service` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { enum class Service; }
23
+ // Forward declaration of `StatePayload` to properly resolve imports.
24
+ namespace margelo::nitro::rncandle { enum class StatePayload; }
25
+
26
+ #include <string>
27
+ #include "Service.hpp"
28
+ #include "StatePayload.hpp"
29
+
30
+ namespace margelo::nitro::rncandle {
31
+
32
+ /**
33
+ * A struct which can be represented as a JavaScript object (LinkedAccountStatusRef).
34
+ */
35
+ struct LinkedAccountStatusRef {
36
+ public:
37
+ std::string linkedAccountID SWIFT_PRIVATE;
38
+ Service service SWIFT_PRIVATE;
39
+ std::string serviceUserID SWIFT_PRIVATE;
40
+ StatePayload state SWIFT_PRIVATE;
41
+
42
+ public:
43
+ LinkedAccountStatusRef() = default;
44
+ explicit LinkedAccountStatusRef(std::string linkedAccountID, Service service, std::string serviceUserID, StatePayload state): linkedAccountID(linkedAccountID), service(service), serviceUserID(serviceUserID), state(state) {}
45
+ };
46
+
47
+ } // namespace margelo::nitro::rncandle
48
+
49
+ namespace margelo::nitro {
50
+
51
+ using namespace margelo::nitro::rncandle;
52
+
53
+ // C++ LinkedAccountStatusRef <> JS LinkedAccountStatusRef (object)
54
+ template <>
55
+ struct JSIConverter<LinkedAccountStatusRef> final {
56
+ static inline LinkedAccountStatusRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
57
+ jsi::Object obj = arg.asObject(runtime);
58
+ return LinkedAccountStatusRef(
59
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
60
+ JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service")),
61
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceUserID")),
62
+ JSIConverter<StatePayload>::fromJSI(runtime, obj.getProperty(runtime, "state"))
63
+ );
64
+ }
65
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const LinkedAccountStatusRef& arg) {
66
+ jsi::Object obj(runtime);
67
+ obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
68
+ obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
69
+ obj.setProperty(runtime, "serviceUserID", JSIConverter<std::string>::toJSI(runtime, arg.serviceUserID));
70
+ obj.setProperty(runtime, "state", JSIConverter<StatePayload>::toJSI(runtime, arg.state));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
79
+ if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
80
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceUserID"))) return false;
81
+ if (!JSIConverter<StatePayload>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
82
+ return true;
83
+ }
84
+ };
85
+
86
+ } // namespace margelo::nitro
@@ -0,0 +1,82 @@
1
+ ///
2
+ /// StatePayload.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 (StatePayload).
30
+ */
31
+ enum class StatePayload {
32
+ ACTIVE SWIFT_NAME(active) = 0,
33
+ INACTIVE SWIFT_NAME(inactive) = 1,
34
+ UNAVAILABLE SWIFT_NAME(unavailable) = 2,
35
+ } CLOSED_ENUM;
36
+
37
+ } // namespace margelo::nitro::rncandle
38
+
39
+ namespace margelo::nitro {
40
+
41
+ using namespace margelo::nitro::rncandle;
42
+
43
+ // C++ StatePayload <> JS StatePayload (union)
44
+ template <>
45
+ struct JSIConverter<StatePayload> final {
46
+ static inline StatePayload fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
47
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
48
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
49
+ case hashString("active"): return StatePayload::ACTIVE;
50
+ case hashString("inactive"): return StatePayload::INACTIVE;
51
+ case hashString("unavailable"): return StatePayload::UNAVAILABLE;
52
+ default: [[unlikely]]
53
+ throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum StatePayload - invalid value!");
54
+ }
55
+ }
56
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, StatePayload arg) {
57
+ switch (arg) {
58
+ case StatePayload::ACTIVE: return JSIConverter<std::string>::toJSI(runtime, "active");
59
+ case StatePayload::INACTIVE: return JSIConverter<std::string>::toJSI(runtime, "inactive");
60
+ case StatePayload::UNAVAILABLE: return JSIConverter<std::string>::toJSI(runtime, "unavailable");
61
+ default: [[unlikely]]
62
+ throw std::invalid_argument("Cannot convert StatePayload to JS - invalid value: "
63
+ + std::to_string(static_cast<int>(arg)) + "!");
64
+ }
65
+ }
66
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
67
+ if (!value.isString()) {
68
+ return false;
69
+ }
70
+ std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
71
+ switch (hashString(unionValue.c_str(), unionValue.size())) {
72
+ case hashString("active"):
73
+ case hashString("inactive"):
74
+ case hashString("unavailable"):
75
+ return true;
76
+ default:
77
+ return false;
78
+ }
79
+ }
80
+ };
81
+
82
+ } // namespace margelo::nitro
@@ -34,10 +34,11 @@ namespace margelo::nitro::rncandle {
34
34
  TradeAsset lost SWIFT_PRIVATE;
35
35
  TradeAsset gained SWIFT_PRIVATE;
36
36
  std::string context SWIFT_PRIVATE;
37
+ std::string expirationDateTime SWIFT_PRIVATE;
37
38
 
38
39
  public:
39
40
  TradeQuote() = default;
40
- explicit TradeQuote(TradeAsset lost, TradeAsset gained, std::string context): lost(lost), gained(gained), context(context) {}
41
+ explicit TradeQuote(TradeAsset lost, TradeAsset gained, std::string context, std::string expirationDateTime): lost(lost), gained(gained), context(context), expirationDateTime(expirationDateTime) {}
41
42
  };
42
43
 
43
44
  } // namespace margelo::nitro::rncandle
@@ -54,7 +55,8 @@ namespace margelo::nitro {
54
55
  return TradeQuote(
55
56
  JSIConverter<TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "lost")),
56
57
  JSIConverter<TradeAsset>::fromJSI(runtime, obj.getProperty(runtime, "gained")),
57
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "context"))
58
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "context")),
59
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "expirationDateTime"))
58
60
  );
59
61
  }
60
62
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeQuote& arg) {
@@ -62,6 +64,7 @@ namespace margelo::nitro {
62
64
  obj.setProperty(runtime, "lost", JSIConverter<TradeAsset>::toJSI(runtime, arg.lost));
63
65
  obj.setProperty(runtime, "gained", JSIConverter<TradeAsset>::toJSI(runtime, arg.gained));
64
66
  obj.setProperty(runtime, "context", JSIConverter<std::string>::toJSI(runtime, arg.context));
67
+ obj.setProperty(runtime, "expirationDateTime", JSIConverter<std::string>::toJSI(runtime, arg.expirationDateTime));
65
68
  return obj;
66
69
  }
67
70
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -72,6 +75,7 @@ namespace margelo::nitro {
72
75
  if (!JSIConverter<TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "lost"))) return false;
73
76
  if (!JSIConverter<TradeAsset>::canConvert(runtime, obj.getProperty(runtime, "gained"))) return false;
74
77
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "context"))) return false;
78
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "expirationDateTime"))) return false;
75
79
  return true;
76
80
  }
77
81
  };
@@ -0,0 +1,78 @@
1
+ ///
2
+ /// TradeQuotesResponse.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 `LinkedAccountStatusRef` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { struct LinkedAccountStatusRef; }
23
+ // Forward declaration of `TradeQuote` to properly resolve imports.
24
+ namespace margelo::nitro::rncandle { struct TradeQuote; }
25
+
26
+ #include <vector>
27
+ #include "LinkedAccountStatusRef.hpp"
28
+ #include "TradeQuote.hpp"
29
+
30
+ namespace margelo::nitro::rncandle {
31
+
32
+ /**
33
+ * A struct which can be represented as a JavaScript object (TradeQuotesResponse).
34
+ */
35
+ struct TradeQuotesResponse {
36
+ public:
37
+ std::vector<LinkedAccountStatusRef> linkedAccounts SWIFT_PRIVATE;
38
+ std::vector<TradeQuote> tradeQuotes SWIFT_PRIVATE;
39
+
40
+ public:
41
+ TradeQuotesResponse() = default;
42
+ explicit TradeQuotesResponse(std::vector<LinkedAccountStatusRef> linkedAccounts, std::vector<TradeQuote> tradeQuotes): linkedAccounts(linkedAccounts), tradeQuotes(tradeQuotes) {}
43
+ };
44
+
45
+ } // namespace margelo::nitro::rncandle
46
+
47
+ namespace margelo::nitro {
48
+
49
+ using namespace margelo::nitro::rncandle;
50
+
51
+ // C++ TradeQuotesResponse <> JS TradeQuotesResponse (object)
52
+ template <>
53
+ struct JSIConverter<TradeQuotesResponse> final {
54
+ static inline TradeQuotesResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
+ 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"))
59
+ );
60
+ }
61
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradeQuotesResponse& arg) {
62
+ 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));
65
+ return obj;
66
+ }
67
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
+ if (!value.isObject()) {
69
+ return false;
70
+ }
71
+ 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;
74
+ return true;
75
+ }
76
+ };
77
+
78
+ } // namespace margelo::nitro
@@ -0,0 +1,78 @@
1
+ ///
2
+ /// TradesResponse.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 `LinkedAccountStatusRef` to properly resolve imports.
22
+ namespace margelo::nitro::rncandle { struct LinkedAccountStatusRef; }
23
+ // Forward declaration of `Trade` to properly resolve imports.
24
+ namespace margelo::nitro::rncandle { struct Trade; }
25
+
26
+ #include <vector>
27
+ #include "LinkedAccountStatusRef.hpp"
28
+ #include "Trade.hpp"
29
+
30
+ namespace margelo::nitro::rncandle {
31
+
32
+ /**
33
+ * A struct which can be represented as a JavaScript object (TradesResponse).
34
+ */
35
+ struct TradesResponse {
36
+ public:
37
+ std::vector<LinkedAccountStatusRef> linkedAccounts SWIFT_PRIVATE;
38
+ std::vector<Trade> trades SWIFT_PRIVATE;
39
+
40
+ public:
41
+ TradesResponse() = default;
42
+ explicit TradesResponse(std::vector<LinkedAccountStatusRef> linkedAccounts, std::vector<Trade> trades): linkedAccounts(linkedAccounts), trades(trades) {}
43
+ };
44
+
45
+ } // namespace margelo::nitro::rncandle
46
+
47
+ namespace margelo::nitro {
48
+
49
+ using namespace margelo::nitro::rncandle;
50
+
51
+ // C++ TradesResponse <> JS TradesResponse (object)
52
+ template <>
53
+ struct JSIConverter<TradesResponse> final {
54
+ static inline TradesResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
+ jsi::Object obj = arg.asObject(runtime);
56
+ return TradesResponse(
57
+ JSIConverter<std::vector<LinkedAccountStatusRef>>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccounts")),
58
+ JSIConverter<std::vector<Trade>>::fromJSI(runtime, obj.getProperty(runtime, "trades"))
59
+ );
60
+ }
61
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradesResponse& arg) {
62
+ jsi::Object obj(runtime);
63
+ obj.setProperty(runtime, "linkedAccounts", JSIConverter<std::vector<LinkedAccountStatusRef>>::toJSI(runtime, arg.linkedAccounts));
64
+ obj.setProperty(runtime, "trades", JSIConverter<std::vector<Trade>>::toJSI(runtime, arg.trades));
65
+ return obj;
66
+ }
67
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
68
+ if (!value.isObject()) {
69
+ return false;
70
+ }
71
+ 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<Trade>>::canConvert(runtime, obj.getProperty(runtime, "trades"))) return false;
74
+ return true;
75
+ }
76
+ };
77
+
78
+ } // namespace margelo::nitro
@@ -48,12 +48,14 @@ namespace margelo::nitro::rncandle {
48
48
  Coordinates destinationCoordinates SWIFT_PRIVATE;
49
49
  Address destinationAddress SWIFT_PRIVATE;
50
50
  double seats SWIFT_PRIVATE;
51
+ std::string departureDateTime SWIFT_PRIVATE;
52
+ std::string arrivalDateTime SWIFT_PRIVATE;
51
53
  std::string linkedAccountID SWIFT_PRIVATE;
52
54
  Service service SWIFT_PRIVATE;
53
55
 
54
56
  public:
55
57
  TransportAsset() = default;
56
- explicit TransportAsset(std::string assetKind, std::string serviceTradeID, std::string serviceAssetID, std::string name, std::string description, std::string imageURL, Coordinates originCoordinates, Address originAddress, Coordinates destinationCoordinates, Address destinationAddress, double seats, std::string linkedAccountID, Service service): assetKind(assetKind), serviceTradeID(serviceTradeID), serviceAssetID(serviceAssetID), name(name), description(description), imageURL(imageURL), originCoordinates(originCoordinates), originAddress(originAddress), destinationCoordinates(destinationCoordinates), destinationAddress(destinationAddress), seats(seats), linkedAccountID(linkedAccountID), service(service) {}
58
+ explicit TransportAsset(std::string assetKind, std::string serviceTradeID, std::string serviceAssetID, std::string name, std::string description, std::string imageURL, Coordinates originCoordinates, Address originAddress, Coordinates destinationCoordinates, Address destinationAddress, double seats, std::string departureDateTime, std::string arrivalDateTime, std::string linkedAccountID, Service service): assetKind(assetKind), serviceTradeID(serviceTradeID), serviceAssetID(serviceAssetID), name(name), description(description), imageURL(imageURL), originCoordinates(originCoordinates), originAddress(originAddress), destinationCoordinates(destinationCoordinates), destinationAddress(destinationAddress), seats(seats), departureDateTime(departureDateTime), arrivalDateTime(arrivalDateTime), linkedAccountID(linkedAccountID), service(service) {}
57
59
  };
58
60
 
59
61
  } // namespace margelo::nitro::rncandle
@@ -79,6 +81,8 @@ namespace margelo::nitro {
79
81
  JSIConverter<Coordinates>::fromJSI(runtime, obj.getProperty(runtime, "destinationCoordinates")),
80
82
  JSIConverter<Address>::fromJSI(runtime, obj.getProperty(runtime, "destinationAddress")),
81
83
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "seats")),
84
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "departureDateTime")),
85
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "arrivalDateTime")),
82
86
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
83
87
  JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
84
88
  );
@@ -96,6 +100,8 @@ namespace margelo::nitro {
96
100
  obj.setProperty(runtime, "destinationCoordinates", JSIConverter<Coordinates>::toJSI(runtime, arg.destinationCoordinates));
97
101
  obj.setProperty(runtime, "destinationAddress", JSIConverter<Address>::toJSI(runtime, arg.destinationAddress));
98
102
  obj.setProperty(runtime, "seats", JSIConverter<double>::toJSI(runtime, arg.seats));
103
+ obj.setProperty(runtime, "departureDateTime", JSIConverter<std::string>::toJSI(runtime, arg.departureDateTime));
104
+ obj.setProperty(runtime, "arrivalDateTime", JSIConverter<std::string>::toJSI(runtime, arg.arrivalDateTime));
99
105
  obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
100
106
  obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
101
107
  return obj;
@@ -116,6 +122,8 @@ namespace margelo::nitro {
116
122
  if (!JSIConverter<Coordinates>::canConvert(runtime, obj.getProperty(runtime, "destinationCoordinates"))) return false;
117
123
  if (!JSIConverter<Address>::canConvert(runtime, obj.getProperty(runtime, "destinationAddress"))) return false;
118
124
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "seats"))) return false;
125
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "departureDateTime"))) return false;
126
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "arrivalDateTime"))) return false;
119
127
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
120
128
  if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
121
129
  return true;