react-native-candle 0.1.43 → 0.1.44
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.
- package/ReactNativeCandle.podspec +1 -1
- package/ios/Sources/CandleActionViewModel.swift +4 -7
- package/ios/Sources/CandleLinkSheetWrapperView.swift +40 -59
- package/ios/Sources/CandleLinkViewModel.swift +21 -31
- package/ios/Sources/CandleTradeExecutionSheetWrapper.swift +14 -23
- package/ios/Sources/HostingViewController.swift +26 -26
- package/ios/Sources/RNCandle.swift +159 -1307
- package/ios/Sources/Types.swift +847 -0
- package/ios/Sources/UIApplication++.swift +5 -9
- package/lib/commonjs/context.js +17 -0
- package/lib/commonjs/context.js.map +1 -0
- package/lib/commonjs/index.js +17 -407
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/provider.js +117 -0
- package/lib/commonjs/provider.js.map +1 -0
- package/lib/commonjs/types.js +271 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/context.js +12 -0
- package/lib/module/context.js.map +1 -0
- package/lib/module/index.js +2 -408
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/provider.js +111 -0
- package/lib/module/provider.js.map +1 -0
- package/lib/module/types.js +256 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/src/context.d.ts +47 -0
- package/lib/typescript/commonjs/src/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -166
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/provider.d.ts +8 -0
- package/lib/typescript/commonjs/src/provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +22 -24
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types.d.ts +125 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/context.d.ts +47 -0
- package/lib/typescript/module/src/context.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -166
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/provider.d.ts +8 -0
- package/lib/typescript/module/src/provider.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +22 -24
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/types.d.ts +125 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/nitrogen/generated/.gitattributes +1 -1
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +15 -31
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +379 -242
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +23 -22
- package/nitrogen/generated/ios/ReactNativeCandleAutolinking.mm +1 -1
- package/nitrogen/generated/ios/ReactNativeCandleAutolinking.swift +2 -4
- package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +36 -42
- package/nitrogen/generated/ios/swift/ActiveLinkedAccountDetails.swift +6 -3
- package/nitrogen/generated/ios/swift/AssetAccount.swift +6 -3
- package/nitrogen/generated/ios/swift/AssetAccountKind.swift +4 -4
- package/nitrogen/generated/ios/swift/AssetAccountRef.swift +5 -5
- package/nitrogen/generated/ios/swift/{AssetAccountQuery.swift → AssetAccountsQuery.swift} +7 -6
- package/nitrogen/generated/ios/swift/Counterparty.swift +8 -3
- package/nitrogen/generated/ios/swift/CounterpartyKind.swift +42 -0
- package/nitrogen/generated/ios/swift/FiatAccount.swift +4 -2
- package/nitrogen/generated/ios/swift/FiatAsset.swift +2 -1
- package/nitrogen/generated/ios/swift/FiatAssetQuoteRequest.swift +4 -2
- package/nitrogen/generated/ios/swift/FiatAssetRef.swift +2 -1
- package/nitrogen/generated/ios/swift/Func_void_LinkedAccount.swift +5 -5
- package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +7 -7
- package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +40 -65
- package/nitrogen/generated/ios/swift/LinkedAccountDetails.swift +15 -3
- package/nitrogen/generated/ios/swift/{StatePayload.swift → LinkedAccountState.swift} +6 -6
- package/nitrogen/generated/ios/swift/LinkedAccountStatusRef.swift +4 -3
- package/nitrogen/generated/ios/swift/MarketAccount.swift +5 -5
- package/nitrogen/generated/ios/swift/MarketAssetKind.swift +38 -0
- package/nitrogen/generated/ios/swift/MarketAssetQuoteRequest.swift +11 -8
- package/nitrogen/generated/ios/swift/MarketTradeAsset.swift +7 -7
- package/nitrogen/generated/ios/swift/MarketTradeAssetRef.swift +5 -5
- package/nitrogen/generated/ios/swift/MerchantCounterparty.swift +2 -1
- package/nitrogen/generated/ios/swift/TradeAsset.swift +10 -5
- package/nitrogen/generated/ios/swift/TradeAssetKind.swift +54 -0
- package/nitrogen/generated/ios/swift/TradeAssetQuoteRequest.swift +15 -4
- package/nitrogen/generated/ios/swift/TradeAssetRef.swift +11 -5
- package/nitrogen/generated/ios/swift/TradeExecutionResult.swift +4 -2
- package/nitrogen/generated/ios/swift/{TradeQuoteRequest.swift → TradeQuotesRequest.swift} +7 -6
- package/nitrogen/generated/ios/swift/{TradeQuery.swift → TradesQuery.swift} +29 -45
- package/nitrogen/generated/ios/swift/TransportAssetQuoteRequest.swift +12 -6
- package/nitrogen/generated/shared/c++/ACHAccountKind.hpp +7 -9
- package/nitrogen/generated/shared/c++/ACHDetails.hpp +7 -9
- package/nitrogen/generated/shared/c++/ActiveLinkedAccountDetails.hpp +4 -6
- package/nitrogen/generated/shared/c++/Address.hpp +4 -6
- package/nitrogen/generated/shared/c++/AssetAccount.hpp +14 -16
- package/nitrogen/generated/shared/c++/AssetAccountKind.hpp +15 -17
- package/nitrogen/generated/shared/c++/AssetAccountRef.hpp +12 -12
- package/nitrogen/generated/shared/c++/{AssetAccountQuery.hpp → AssetAccountsQuery.hpp} +14 -16
- package/nitrogen/generated/shared/c++/AssetAccountsResponse.hpp +11 -13
- package/nitrogen/generated/shared/c++/Coordinates.hpp +4 -6
- package/nitrogen/generated/shared/c++/Counterparty.hpp +14 -16
- package/nitrogen/generated/shared/c++/CounterpartyKind.hpp +80 -0
- package/nitrogen/generated/shared/c++/FiatAccount.hpp +16 -18
- package/nitrogen/generated/shared/c++/FiatAsset.hpp +7 -9
- package/nitrogen/generated/shared/c++/FiatAssetQuoteRequest.hpp +4 -6
- package/nitrogen/generated/shared/c++/FiatAssetRef.hpp +4 -6
- package/nitrogen/generated/shared/c++/FiatMarketAccountKind.hpp +13 -15
- package/nitrogen/generated/shared/c++/HybridRNCandleSpec.cpp +1 -2
- package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +17 -27
- package/nitrogen/generated/shared/c++/InactiveLinkedAccountDetails.hpp +4 -6
- package/nitrogen/generated/shared/c++/LinkedAccount.hpp +10 -12
- package/nitrogen/generated/shared/c++/LinkedAccountDetails.hpp +14 -16
- package/nitrogen/generated/shared/c++/LinkedAccountRef.hpp +4 -6
- package/nitrogen/generated/shared/c++/{StatePayload.hpp → LinkedAccountState.hpp} +15 -17
- package/nitrogen/generated/shared/c++/LinkedAccountStatusRef.hpp +15 -17
- package/nitrogen/generated/shared/c++/MarketAccount.hpp +18 -17
- package/nitrogen/generated/shared/c++/MarketAssetKind.hpp +76 -0
- package/nitrogen/generated/shared/c++/MarketAssetQuoteRequest.hpp +12 -12
- package/nitrogen/generated/shared/c++/MarketTradeAsset.hpp +15 -14
- package/nitrogen/generated/shared/c++/MarketTradeAssetRef.hpp +12 -12
- package/nitrogen/generated/shared/c++/MerchantCounterparty.hpp +8 -10
- package/nitrogen/generated/shared/c++/MerchantLocation.hpp +4 -6
- package/nitrogen/generated/shared/c++/NothingAsset.hpp +4 -6
- package/nitrogen/generated/shared/c++/NothingAssetQuoteRequest.hpp +4 -6
- package/nitrogen/generated/shared/c++/NothingAssetRef.hpp +4 -6
- package/nitrogen/generated/shared/c++/OtherAsset.hpp +4 -6
- package/nitrogen/generated/shared/c++/OtherAssetRef.hpp +4 -6
- package/nitrogen/generated/shared/c++/PresentationBackground.hpp +7 -9
- package/nitrogen/generated/shared/c++/PresentationStyle.hpp +7 -9
- package/nitrogen/generated/shared/c++/Service.hpp +163 -165
- package/nitrogen/generated/shared/c++/ServiceCounterparty.hpp +7 -9
- package/nitrogen/generated/shared/c++/Trade.hpp +16 -18
- package/nitrogen/generated/shared/c++/TradeAsset.hpp +20 -22
- package/nitrogen/generated/shared/c++/TradeAssetKind.hpp +92 -0
- package/nitrogen/generated/shared/c++/TradeAssetQuoteRequest.hpp +17 -19
- package/nitrogen/generated/shared/c++/TradeAssetRef.hpp +20 -22
- package/nitrogen/generated/shared/c++/TradeExecutionResult.hpp +8 -10
- package/nitrogen/generated/shared/c++/TradeQuote.hpp +10 -12
- package/nitrogen/generated/shared/c++/{TradeQuoteRequest.hpp → TradeQuotesRequest.hpp} +17 -19
- package/nitrogen/generated/shared/c++/TradeQuotesResponse.hpp +11 -13
- package/nitrogen/generated/shared/c++/TradeRef.hpp +10 -12
- package/nitrogen/generated/shared/c++/TradeState.hpp +9 -11
- package/nitrogen/generated/shared/c++/TradesQuery.hpp +89 -0
- package/nitrogen/generated/shared/c++/TradesResponse.hpp +11 -13
- package/nitrogen/generated/shared/c++/TransportAccount.hpp +10 -12
- package/nitrogen/generated/shared/c++/TransportAccountKind.hpp +9 -11
- package/nitrogen/generated/shared/c++/TransportAsset.hpp +19 -21
- package/nitrogen/generated/shared/c++/TransportAssetQuoteRequest.hpp +16 -18
- package/nitrogen/generated/shared/c++/TransportAssetRef.hpp +4 -6
- package/nitrogen/generated/shared/c++/UnavailableLinkedAccountDetails.hpp +4 -6
- package/nitrogen/generated/shared/c++/UserCounterparty.hpp +4 -6
- package/nitrogen/generated/shared/c++/WireDetails.hpp +4 -6
- package/package.json +9 -11
- package/src/context.ts +86 -0
- package/src/index.ts +4 -634
- package/src/provider.tsx +152 -0
- package/src/specs/RNCandle.nitro.ts +38 -29
- package/src/types.ts +462 -0
- package/nitrogen/generated/ios/swift/AppUser.swift +0 -75
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +0 -44
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_AnyMap__.swift +0 -47
- package/nitrogen/generated/ios/swift/ToolCall.swift +0 -44
- package/nitrogen/generated/shared/c++/AppUser.hpp +0 -78
- package/nitrogen/generated/shared/c++/ToolCall.hpp +0 -73
- package/nitrogen/generated/shared/c++/TradeQuery.hpp +0 -86
|
@@ -40,30 +40,28 @@ namespace margelo::nitro::rncandle {
|
|
|
40
40
|
|
|
41
41
|
namespace margelo::nitro {
|
|
42
42
|
|
|
43
|
-
using namespace margelo::nitro::rncandle;
|
|
44
|
-
|
|
45
43
|
// C++ FiatMarketAccountKind <> JS FiatMarketAccountKind (union)
|
|
46
44
|
template <>
|
|
47
|
-
struct JSIConverter<FiatMarketAccountKind> final {
|
|
48
|
-
static inline FiatMarketAccountKind fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
struct JSIConverter<margelo::nitro::rncandle::FiatMarketAccountKind> final {
|
|
46
|
+
static inline margelo::nitro::rncandle::FiatMarketAccountKind fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
47
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
50
48
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
51
|
-
case hashString("individual"): return FiatMarketAccountKind::INDIVIDUAL;
|
|
52
|
-
case hashString("joint"): return FiatMarketAccountKind::JOINT;
|
|
53
|
-
case hashString("traditionalIRA"): return FiatMarketAccountKind::TRADITIONALIRA;
|
|
54
|
-
case hashString("rothIRA"): return FiatMarketAccountKind::ROTHIRA;
|
|
55
|
-
case hashString("business"): return FiatMarketAccountKind::BUSINESS;
|
|
49
|
+
case hashString("individual"): return margelo::nitro::rncandle::FiatMarketAccountKind::INDIVIDUAL;
|
|
50
|
+
case hashString("joint"): return margelo::nitro::rncandle::FiatMarketAccountKind::JOINT;
|
|
51
|
+
case hashString("traditionalIRA"): return margelo::nitro::rncandle::FiatMarketAccountKind::TRADITIONALIRA;
|
|
52
|
+
case hashString("rothIRA"): return margelo::nitro::rncandle::FiatMarketAccountKind::ROTHIRA;
|
|
53
|
+
case hashString("business"): return margelo::nitro::rncandle::FiatMarketAccountKind::BUSINESS;
|
|
56
54
|
default: [[unlikely]]
|
|
57
55
|
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum FiatMarketAccountKind - invalid value!");
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, FiatMarketAccountKind arg) {
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rncandle::FiatMarketAccountKind arg) {
|
|
61
59
|
switch (arg) {
|
|
62
|
-
case FiatMarketAccountKind::INDIVIDUAL: return JSIConverter<std::string>::toJSI(runtime, "individual");
|
|
63
|
-
case FiatMarketAccountKind::JOINT: return JSIConverter<std::string>::toJSI(runtime, "joint");
|
|
64
|
-
case FiatMarketAccountKind::TRADITIONALIRA: return JSIConverter<std::string>::toJSI(runtime, "traditionalIRA");
|
|
65
|
-
case FiatMarketAccountKind::ROTHIRA: return JSIConverter<std::string>::toJSI(runtime, "rothIRA");
|
|
66
|
-
case FiatMarketAccountKind::BUSINESS: return JSIConverter<std::string>::toJSI(runtime, "business");
|
|
60
|
+
case margelo::nitro::rncandle::FiatMarketAccountKind::INDIVIDUAL: return JSIConverter<std::string>::toJSI(runtime, "individual");
|
|
61
|
+
case margelo::nitro::rncandle::FiatMarketAccountKind::JOINT: return JSIConverter<std::string>::toJSI(runtime, "joint");
|
|
62
|
+
case margelo::nitro::rncandle::FiatMarketAccountKind::TRADITIONALIRA: return JSIConverter<std::string>::toJSI(runtime, "traditionalIRA");
|
|
63
|
+
case margelo::nitro::rncandle::FiatMarketAccountKind::ROTHIRA: return JSIConverter<std::string>::toJSI(runtime, "rothIRA");
|
|
64
|
+
case margelo::nitro::rncandle::FiatMarketAccountKind::BUSINESS: return JSIConverter<std::string>::toJSI(runtime, "business");
|
|
67
65
|
default: [[unlikely]]
|
|
68
66
|
throw std::invalid_argument("Cannot convert FiatMarketAccountKind to JS - invalid value: "
|
|
69
67
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
@@ -25,9 +25,8 @@ namespace margelo::nitro::rncandle {
|
|
|
25
25
|
prototype.registerHybridMethod("getTrades", &HybridRNCandleSpec::getTrades);
|
|
26
26
|
prototype.registerHybridMethod("getTrade", &HybridRNCandleSpec::getTrade);
|
|
27
27
|
prototype.registerHybridMethod("getTradeQuotes", &HybridRNCandleSpec::getTradeQuotes);
|
|
28
|
+
prototype.registerHybridMethod("createUser", &HybridRNCandleSpec::createUser);
|
|
28
29
|
prototype.registerHybridMethod("deleteUser", &HybridRNCandleSpec::deleteUser);
|
|
29
|
-
prototype.registerHybridMethod("getAvailableTools", &HybridRNCandleSpec::getAvailableTools);
|
|
30
|
-
prototype.registerHybridMethod("executeTool", &HybridRNCandleSpec::executeTool);
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -25,60 +25,51 @@ namespace margelo::nitro::rncandle { struct LinkedAccount; }
|
|
|
25
25
|
namespace margelo::nitro::rncandle { struct TradeQuote; }
|
|
26
26
|
// Forward declaration of `TradeExecutionResult` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::rncandle { struct TradeExecutionResult; }
|
|
28
|
-
// Forward declaration of `AppUser` to properly resolve imports.
|
|
29
|
-
namespace margelo::nitro::rncandle { struct AppUser; }
|
|
30
28
|
// Forward declaration of `LinkedAccountRef` to properly resolve imports.
|
|
31
29
|
namespace margelo::nitro::rncandle { struct LinkedAccountRef; }
|
|
32
30
|
// Forward declaration of `AssetAccountsResponse` to properly resolve imports.
|
|
33
31
|
namespace margelo::nitro::rncandle { struct AssetAccountsResponse; }
|
|
34
|
-
// Forward declaration of `
|
|
35
|
-
namespace margelo::nitro::rncandle { struct
|
|
32
|
+
// Forward declaration of `AssetAccountsQuery` to properly resolve imports.
|
|
33
|
+
namespace margelo::nitro::rncandle { struct AssetAccountsQuery; }
|
|
36
34
|
// Forward declaration of `AssetAccount` to properly resolve imports.
|
|
37
35
|
namespace margelo::nitro::rncandle { struct AssetAccount; }
|
|
38
36
|
// Forward declaration of `AssetAccountRef` to properly resolve imports.
|
|
39
37
|
namespace margelo::nitro::rncandle { struct AssetAccountRef; }
|
|
40
38
|
// Forward declaration of `TradesResponse` to properly resolve imports.
|
|
41
39
|
namespace margelo::nitro::rncandle { struct TradesResponse; }
|
|
42
|
-
// Forward declaration of `
|
|
43
|
-
namespace margelo::nitro::rncandle { struct
|
|
40
|
+
// Forward declaration of `TradesQuery` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::rncandle { struct TradesQuery; }
|
|
44
42
|
// Forward declaration of `Trade` to properly resolve imports.
|
|
45
43
|
namespace margelo::nitro::rncandle { struct Trade; }
|
|
46
44
|
// Forward declaration of `TradeRef` to properly resolve imports.
|
|
47
45
|
namespace margelo::nitro::rncandle { struct TradeRef; }
|
|
48
46
|
// Forward declaration of `TradeQuotesResponse` to properly resolve imports.
|
|
49
47
|
namespace margelo::nitro::rncandle { struct TradeQuotesResponse; }
|
|
50
|
-
// Forward declaration of `
|
|
51
|
-
namespace margelo::nitro::rncandle { struct
|
|
52
|
-
// Forward declaration of `AnyMap` to properly resolve imports.
|
|
53
|
-
namespace NitroModules { class AnyMap; }
|
|
54
|
-
// Forward declaration of `ToolCall` to properly resolve imports.
|
|
55
|
-
namespace margelo::nitro::rncandle { struct ToolCall; }
|
|
48
|
+
// Forward declaration of `TradeQuotesRequest` to properly resolve imports.
|
|
49
|
+
namespace margelo::nitro::rncandle { struct TradeQuotesRequest; }
|
|
56
50
|
|
|
57
|
-
#include <optional>
|
|
58
|
-
#include <vector>
|
|
59
51
|
#include "Service.hpp"
|
|
52
|
+
#include <vector>
|
|
53
|
+
#include <optional>
|
|
60
54
|
#include <string>
|
|
61
55
|
#include "PresentationBackground.hpp"
|
|
62
56
|
#include "PresentationStyle.hpp"
|
|
63
|
-
#include <functional>
|
|
64
57
|
#include "LinkedAccount.hpp"
|
|
58
|
+
#include <functional>
|
|
65
59
|
#include "TradeQuote.hpp"
|
|
66
60
|
#include "TradeExecutionResult.hpp"
|
|
67
|
-
#include "AppUser.hpp"
|
|
68
61
|
#include <NitroModules/Promise.hpp>
|
|
69
62
|
#include "LinkedAccountRef.hpp"
|
|
70
63
|
#include "AssetAccountsResponse.hpp"
|
|
71
|
-
#include "
|
|
64
|
+
#include "AssetAccountsQuery.hpp"
|
|
72
65
|
#include "AssetAccount.hpp"
|
|
73
66
|
#include "AssetAccountRef.hpp"
|
|
74
67
|
#include "TradesResponse.hpp"
|
|
75
|
-
#include "
|
|
68
|
+
#include "TradesQuery.hpp"
|
|
76
69
|
#include "Trade.hpp"
|
|
77
70
|
#include "TradeRef.hpp"
|
|
78
71
|
#include "TradeQuotesResponse.hpp"
|
|
79
|
-
#include "
|
|
80
|
-
#include <NitroModules/AnyMap.hpp>
|
|
81
|
-
#include "ToolCall.hpp"
|
|
72
|
+
#include "TradeQuotesRequest.hpp"
|
|
82
73
|
|
|
83
74
|
namespace margelo::nitro::rncandle {
|
|
84
75
|
|
|
@@ -113,18 +104,17 @@ namespace margelo::nitro::rncandle {
|
|
|
113
104
|
// Methods
|
|
114
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;
|
|
115
106
|
virtual void candleTradeExecutionSheet(const TradeQuote& tradeQuote, PresentationBackground presentationBackground, const std::function<void(const TradeExecutionResult& /* result */)>& completion) = 0;
|
|
116
|
-
virtual void initialize(const
|
|
107
|
+
virtual void initialize(const std::string& appKey, const std::string& appSecret, const std::optional<std::string>& accessGroup) = 0;
|
|
117
108
|
virtual std::shared_ptr<Promise<std::vector<LinkedAccount>>> getLinkedAccounts() = 0;
|
|
118
109
|
virtual std::shared_ptr<Promise<LinkedAccount>> getLinkedAccount(const LinkedAccountRef& ref) = 0;
|
|
119
110
|
virtual std::shared_ptr<Promise<void>> unlinkAccount(const LinkedAccountRef& ref) = 0;
|
|
120
|
-
virtual std::shared_ptr<Promise<AssetAccountsResponse>> getAssetAccounts(const
|
|
111
|
+
virtual std::shared_ptr<Promise<AssetAccountsResponse>> getAssetAccounts(const AssetAccountsQuery& query) = 0;
|
|
121
112
|
virtual std::shared_ptr<Promise<AssetAccount>> getAssetAccount(const AssetAccountRef& ref) = 0;
|
|
122
|
-
virtual std::shared_ptr<Promise<TradesResponse>> getTrades(const
|
|
113
|
+
virtual std::shared_ptr<Promise<TradesResponse>> getTrades(const TradesQuery& query) = 0;
|
|
123
114
|
virtual std::shared_ptr<Promise<Trade>> getTrade(const TradeRef& ref) = 0;
|
|
124
|
-
virtual std::shared_ptr<Promise<TradeQuotesResponse>> getTradeQuotes(const
|
|
115
|
+
virtual std::shared_ptr<Promise<TradeQuotesResponse>> getTradeQuotes(const TradeQuotesRequest& request) = 0;
|
|
116
|
+
virtual std::shared_ptr<Promise<void>> createUser(const std::string& appUserID) = 0;
|
|
125
117
|
virtual std::shared_ptr<Promise<void>> deleteUser() = 0;
|
|
126
|
-
virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<AnyMap>>>> getAvailableTools() = 0;
|
|
127
|
-
virtual std::shared_ptr<Promise<std::string>> executeTool(const ToolCall& tool) = 0;
|
|
128
118
|
|
|
129
119
|
protected:
|
|
130
120
|
// Hybrid Setup
|
|
@@ -40,18 +40,16 @@ namespace margelo::nitro::rncandle {
|
|
|
40
40
|
|
|
41
41
|
namespace margelo::nitro {
|
|
42
42
|
|
|
43
|
-
using namespace margelo::nitro::rncandle;
|
|
44
|
-
|
|
45
43
|
// C++ InactiveLinkedAccountDetails <> JS InactiveLinkedAccountDetails (object)
|
|
46
44
|
template <>
|
|
47
|
-
struct JSIConverter<InactiveLinkedAccountDetails> final {
|
|
48
|
-
static inline InactiveLinkedAccountDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
struct JSIConverter<margelo::nitro::rncandle::InactiveLinkedAccountDetails> final {
|
|
46
|
+
static inline margelo::nitro::rncandle::InactiveLinkedAccountDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
47
|
jsi::Object obj = arg.asObject(runtime);
|
|
50
|
-
return InactiveLinkedAccountDetails(
|
|
48
|
+
return margelo::nitro::rncandle::InactiveLinkedAccountDetails(
|
|
51
49
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "state"))
|
|
52
50
|
);
|
|
53
51
|
}
|
|
54
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const InactiveLinkedAccountDetails& arg) {
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::InactiveLinkedAccountDetails& arg) {
|
|
55
53
|
jsi::Object obj(runtime);
|
|
56
54
|
obj.setProperty(runtime, "state", JSIConverter<std::string>::toJSI(runtime, arg.state));
|
|
57
55
|
return obj;
|
|
@@ -48,26 +48,24 @@ namespace margelo::nitro::rncandle {
|
|
|
48
48
|
|
|
49
49
|
namespace margelo::nitro {
|
|
50
50
|
|
|
51
|
-
using namespace margelo::nitro::rncandle;
|
|
52
|
-
|
|
53
51
|
// C++ LinkedAccount <> JS LinkedAccount (object)
|
|
54
52
|
template <>
|
|
55
|
-
struct JSIConverter<LinkedAccount> final {
|
|
56
|
-
static inline LinkedAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
struct JSIConverter<margelo::nitro::rncandle::LinkedAccount> final {
|
|
54
|
+
static inline margelo::nitro::rncandle::LinkedAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
57
55
|
jsi::Object obj = arg.asObject(runtime);
|
|
58
|
-
return LinkedAccount(
|
|
56
|
+
return margelo::nitro::rncandle::LinkedAccount(
|
|
59
57
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
|
|
60
|
-
JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service")),
|
|
58
|
+
JSIConverter<margelo::nitro::rncandle::Service>::fromJSI(runtime, obj.getProperty(runtime, "service")),
|
|
61
59
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceUserID")),
|
|
62
|
-
JSIConverter<LinkedAccountDetails>::fromJSI(runtime, obj.getProperty(runtime, "details"))
|
|
60
|
+
JSIConverter<margelo::nitro::rncandle::LinkedAccountDetails>::fromJSI(runtime, obj.getProperty(runtime, "details"))
|
|
63
61
|
);
|
|
64
62
|
}
|
|
65
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const LinkedAccount& arg) {
|
|
63
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::LinkedAccount& arg) {
|
|
66
64
|
jsi::Object obj(runtime);
|
|
67
65
|
obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
|
|
68
|
-
obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
|
|
66
|
+
obj.setProperty(runtime, "service", JSIConverter<margelo::nitro::rncandle::Service>::toJSI(runtime, arg.service));
|
|
69
67
|
obj.setProperty(runtime, "serviceUserID", JSIConverter<std::string>::toJSI(runtime, arg.serviceUserID));
|
|
70
|
-
obj.setProperty(runtime, "details", JSIConverter<LinkedAccountDetails>::toJSI(runtime, arg.details));
|
|
68
|
+
obj.setProperty(runtime, "details", JSIConverter<margelo::nitro::rncandle::LinkedAccountDetails>::toJSI(runtime, arg.details));
|
|
71
69
|
return obj;
|
|
72
70
|
}
|
|
73
71
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -76,9 +74,9 @@ namespace margelo::nitro {
|
|
|
76
74
|
}
|
|
77
75
|
jsi::Object obj = value.getObject(runtime);
|
|
78
76
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
|
|
79
|
-
if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
77
|
+
if (!JSIConverter<margelo::nitro::rncandle::Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
80
78
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceUserID"))) return false;
|
|
81
|
-
if (!JSIConverter<LinkedAccountDetails>::canConvert(runtime, obj.getProperty(runtime, "details"))) return false;
|
|
79
|
+
if (!JSIConverter<margelo::nitro::rncandle::LinkedAccountDetails>::canConvert(runtime, obj.getProperty(runtime, "details"))) return false;
|
|
82
80
|
return true;
|
|
83
81
|
}
|
|
84
82
|
};
|
|
@@ -25,8 +25,8 @@ namespace margelo::nitro::rncandle { struct InactiveLinkedAccountDetails; }
|
|
|
25
25
|
// Forward declaration of `UnavailableLinkedAccountDetails` to properly resolve imports.
|
|
26
26
|
namespace margelo::nitro::rncandle { struct UnavailableLinkedAccountDetails; }
|
|
27
27
|
|
|
28
|
-
#include <optional>
|
|
29
28
|
#include "ActiveLinkedAccountDetails.hpp"
|
|
29
|
+
#include <optional>
|
|
30
30
|
#include "InactiveLinkedAccountDetails.hpp"
|
|
31
31
|
#include "UnavailableLinkedAccountDetails.hpp"
|
|
32
32
|
|
|
@@ -50,24 +50,22 @@ namespace margelo::nitro::rncandle {
|
|
|
50
50
|
|
|
51
51
|
namespace margelo::nitro {
|
|
52
52
|
|
|
53
|
-
using namespace margelo::nitro::rncandle;
|
|
54
|
-
|
|
55
53
|
// C++ LinkedAccountDetails <> JS LinkedAccountDetails (object)
|
|
56
54
|
template <>
|
|
57
|
-
struct JSIConverter<LinkedAccountDetails> final {
|
|
58
|
-
static inline LinkedAccountDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
struct JSIConverter<margelo::nitro::rncandle::LinkedAccountDetails> final {
|
|
56
|
+
static inline margelo::nitro::rncandle::LinkedAccountDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
59
57
|
jsi::Object obj = arg.asObject(runtime);
|
|
60
|
-
return LinkedAccountDetails(
|
|
61
|
-
JSIConverter<std::optional<ActiveLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "activeLinkedAccountDetails")),
|
|
62
|
-
JSIConverter<std::optional<InactiveLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "inactiveLinkedAccountDetails")),
|
|
63
|
-
JSIConverter<std::optional<UnavailableLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "unavailableLinkedAccountDetails"))
|
|
58
|
+
return margelo::nitro::rncandle::LinkedAccountDetails(
|
|
59
|
+
JSIConverter<std::optional<margelo::nitro::rncandle::ActiveLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "activeLinkedAccountDetails")),
|
|
60
|
+
JSIConverter<std::optional<margelo::nitro::rncandle::InactiveLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "inactiveLinkedAccountDetails")),
|
|
61
|
+
JSIConverter<std::optional<margelo::nitro::rncandle::UnavailableLinkedAccountDetails>>::fromJSI(runtime, obj.getProperty(runtime, "unavailableLinkedAccountDetails"))
|
|
64
62
|
);
|
|
65
63
|
}
|
|
66
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const LinkedAccountDetails& arg) {
|
|
64
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::LinkedAccountDetails& arg) {
|
|
67
65
|
jsi::Object obj(runtime);
|
|
68
|
-
obj.setProperty(runtime, "activeLinkedAccountDetails", JSIConverter<std::optional<ActiveLinkedAccountDetails>>::toJSI(runtime, arg.activeLinkedAccountDetails));
|
|
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));
|
|
66
|
+
obj.setProperty(runtime, "activeLinkedAccountDetails", JSIConverter<std::optional<margelo::nitro::rncandle::ActiveLinkedAccountDetails>>::toJSI(runtime, arg.activeLinkedAccountDetails));
|
|
67
|
+
obj.setProperty(runtime, "inactiveLinkedAccountDetails", JSIConverter<std::optional<margelo::nitro::rncandle::InactiveLinkedAccountDetails>>::toJSI(runtime, arg.inactiveLinkedAccountDetails));
|
|
68
|
+
obj.setProperty(runtime, "unavailableLinkedAccountDetails", JSIConverter<std::optional<margelo::nitro::rncandle::UnavailableLinkedAccountDetails>>::toJSI(runtime, arg.unavailableLinkedAccountDetails));
|
|
71
69
|
return obj;
|
|
72
70
|
}
|
|
73
71
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -75,9 +73,9 @@ namespace margelo::nitro {
|
|
|
75
73
|
return false;
|
|
76
74
|
}
|
|
77
75
|
jsi::Object obj = value.getObject(runtime);
|
|
78
|
-
if (!JSIConverter<std::optional<ActiveLinkedAccountDetails>>::canConvert(runtime, obj.getProperty(runtime, "activeLinkedAccountDetails"))) return false;
|
|
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;
|
|
76
|
+
if (!JSIConverter<std::optional<margelo::nitro::rncandle::ActiveLinkedAccountDetails>>::canConvert(runtime, obj.getProperty(runtime, "activeLinkedAccountDetails"))) return false;
|
|
77
|
+
if (!JSIConverter<std::optional<margelo::nitro::rncandle::InactiveLinkedAccountDetails>>::canConvert(runtime, obj.getProperty(runtime, "inactiveLinkedAccountDetails"))) return false;
|
|
78
|
+
if (!JSIConverter<std::optional<margelo::nitro::rncandle::UnavailableLinkedAccountDetails>>::canConvert(runtime, obj.getProperty(runtime, "unavailableLinkedAccountDetails"))) return false;
|
|
81
79
|
return true;
|
|
82
80
|
}
|
|
83
81
|
};
|
|
@@ -40,18 +40,16 @@ namespace margelo::nitro::rncandle {
|
|
|
40
40
|
|
|
41
41
|
namespace margelo::nitro {
|
|
42
42
|
|
|
43
|
-
using namespace margelo::nitro::rncandle;
|
|
44
|
-
|
|
45
43
|
// C++ LinkedAccountRef <> JS LinkedAccountRef (object)
|
|
46
44
|
template <>
|
|
47
|
-
struct JSIConverter<LinkedAccountRef> final {
|
|
48
|
-
static inline LinkedAccountRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
struct JSIConverter<margelo::nitro::rncandle::LinkedAccountRef> final {
|
|
46
|
+
static inline margelo::nitro::rncandle::LinkedAccountRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
47
|
jsi::Object obj = arg.asObject(runtime);
|
|
50
|
-
return LinkedAccountRef(
|
|
48
|
+
return margelo::nitro::rncandle::LinkedAccountRef(
|
|
51
49
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID"))
|
|
52
50
|
);
|
|
53
51
|
}
|
|
54
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const LinkedAccountRef& arg) {
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::LinkedAccountRef& arg) {
|
|
55
53
|
jsi::Object obj(runtime);
|
|
56
54
|
obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
|
|
57
55
|
return obj;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// LinkedAccountState.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
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
namespace margelo::nitro::rncandle {
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* An enum which can be represented as a JavaScript union (
|
|
29
|
+
* An enum which can be represented as a JavaScript union (LinkedAccountState).
|
|
30
30
|
*/
|
|
31
|
-
enum class
|
|
31
|
+
enum class LinkedAccountState {
|
|
32
32
|
ACTIVE SWIFT_NAME(active) = 0,
|
|
33
33
|
INACTIVE SWIFT_NAME(inactive) = 1,
|
|
34
34
|
UNAVAILABLE SWIFT_NAME(unavailable) = 2,
|
|
@@ -38,28 +38,26 @@ namespace margelo::nitro::rncandle {
|
|
|
38
38
|
|
|
39
39
|
namespace margelo::nitro {
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// C++ StatePayload <> JS StatePayload (union)
|
|
41
|
+
// C++ LinkedAccountState <> JS LinkedAccountState (union)
|
|
44
42
|
template <>
|
|
45
|
-
struct JSIConverter<
|
|
46
|
-
static inline
|
|
43
|
+
struct JSIConverter<margelo::nitro::rncandle::LinkedAccountState> final {
|
|
44
|
+
static inline margelo::nitro::rncandle::LinkedAccountState 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("active"): return
|
|
50
|
-
case hashString("inactive"): return
|
|
51
|
-
case hashString("unavailable"): return
|
|
47
|
+
case hashString("active"): return margelo::nitro::rncandle::LinkedAccountState::ACTIVE;
|
|
48
|
+
case hashString("inactive"): return margelo::nitro::rncandle::LinkedAccountState::INACTIVE;
|
|
49
|
+
case hashString("unavailable"): return margelo::nitro::rncandle::LinkedAccountState::UNAVAILABLE;
|
|
52
50
|
default: [[unlikely]]
|
|
53
|
-
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum LinkedAccountState - invalid value!");
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime,
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rncandle::LinkedAccountState arg) {
|
|
57
55
|
switch (arg) {
|
|
58
|
-
case
|
|
59
|
-
case
|
|
60
|
-
case
|
|
56
|
+
case margelo::nitro::rncandle::LinkedAccountState::ACTIVE: return JSIConverter<std::string>::toJSI(runtime, "active");
|
|
57
|
+
case margelo::nitro::rncandle::LinkedAccountState::INACTIVE: return JSIConverter<std::string>::toJSI(runtime, "inactive");
|
|
58
|
+
case margelo::nitro::rncandle::LinkedAccountState::UNAVAILABLE: return JSIConverter<std::string>::toJSI(runtime, "unavailable");
|
|
61
59
|
default: [[unlikely]]
|
|
62
|
-
throw std::invalid_argument("Cannot convert
|
|
60
|
+
throw std::invalid_argument("Cannot convert LinkedAccountState to JS - invalid value: "
|
|
63
61
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
64
62
|
}
|
|
65
63
|
}
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
|
|
21
21
|
// Forward declaration of `Service` to properly resolve imports.
|
|
22
22
|
namespace margelo::nitro::rncandle { enum class Service; }
|
|
23
|
-
// Forward declaration of `
|
|
24
|
-
namespace margelo::nitro::rncandle { enum class
|
|
23
|
+
// Forward declaration of `LinkedAccountState` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::rncandle { enum class LinkedAccountState; }
|
|
25
25
|
|
|
26
26
|
#include <string>
|
|
27
27
|
#include "Service.hpp"
|
|
28
|
-
#include "
|
|
28
|
+
#include "LinkedAccountState.hpp"
|
|
29
29
|
|
|
30
30
|
namespace margelo::nitro::rncandle {
|
|
31
31
|
|
|
@@ -37,37 +37,35 @@ namespace margelo::nitro::rncandle {
|
|
|
37
37
|
std::string linkedAccountID SWIFT_PRIVATE;
|
|
38
38
|
Service service SWIFT_PRIVATE;
|
|
39
39
|
std::string serviceUserID SWIFT_PRIVATE;
|
|
40
|
-
|
|
40
|
+
LinkedAccountState state SWIFT_PRIVATE;
|
|
41
41
|
|
|
42
42
|
public:
|
|
43
43
|
LinkedAccountStatusRef() = default;
|
|
44
|
-
explicit LinkedAccountStatusRef(std::string linkedAccountID, Service service, std::string serviceUserID,
|
|
44
|
+
explicit LinkedAccountStatusRef(std::string linkedAccountID, Service service, std::string serviceUserID, LinkedAccountState state): linkedAccountID(linkedAccountID), service(service), serviceUserID(serviceUserID), state(state) {}
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
} // namespace margelo::nitro::rncandle
|
|
48
48
|
|
|
49
49
|
namespace margelo::nitro {
|
|
50
50
|
|
|
51
|
-
using namespace margelo::nitro::rncandle;
|
|
52
|
-
|
|
53
51
|
// C++ LinkedAccountStatusRef <> JS LinkedAccountStatusRef (object)
|
|
54
52
|
template <>
|
|
55
|
-
struct JSIConverter<LinkedAccountStatusRef> final {
|
|
56
|
-
static inline LinkedAccountStatusRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
+
struct JSIConverter<margelo::nitro::rncandle::LinkedAccountStatusRef> final {
|
|
54
|
+
static inline margelo::nitro::rncandle::LinkedAccountStatusRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
57
55
|
jsi::Object obj = arg.asObject(runtime);
|
|
58
|
-
return LinkedAccountStatusRef(
|
|
56
|
+
return margelo::nitro::rncandle::LinkedAccountStatusRef(
|
|
59
57
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
|
|
60
|
-
JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service")),
|
|
58
|
+
JSIConverter<margelo::nitro::rncandle::Service>::fromJSI(runtime, obj.getProperty(runtime, "service")),
|
|
61
59
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceUserID")),
|
|
62
|
-
JSIConverter<
|
|
60
|
+
JSIConverter<margelo::nitro::rncandle::LinkedAccountState>::fromJSI(runtime, obj.getProperty(runtime, "state"))
|
|
63
61
|
);
|
|
64
62
|
}
|
|
65
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const LinkedAccountStatusRef& arg) {
|
|
63
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::LinkedAccountStatusRef& arg) {
|
|
66
64
|
jsi::Object obj(runtime);
|
|
67
65
|
obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
|
|
68
|
-
obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
|
|
66
|
+
obj.setProperty(runtime, "service", JSIConverter<margelo::nitro::rncandle::Service>::toJSI(runtime, arg.service));
|
|
69
67
|
obj.setProperty(runtime, "serviceUserID", JSIConverter<std::string>::toJSI(runtime, arg.serviceUserID));
|
|
70
|
-
obj.setProperty(runtime, "state", JSIConverter<
|
|
68
|
+
obj.setProperty(runtime, "state", JSIConverter<margelo::nitro::rncandle::LinkedAccountState>::toJSI(runtime, arg.state));
|
|
71
69
|
return obj;
|
|
72
70
|
}
|
|
73
71
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -76,9 +74,9 @@ namespace margelo::nitro {
|
|
|
76
74
|
}
|
|
77
75
|
jsi::Object obj = value.getObject(runtime);
|
|
78
76
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
|
|
79
|
-
if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
77
|
+
if (!JSIConverter<margelo::nitro::rncandle::Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
80
78
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceUserID"))) return false;
|
|
81
|
-
if (!JSIConverter<
|
|
79
|
+
if (!JSIConverter<margelo::nitro::rncandle::LinkedAccountState>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
|
|
82
80
|
return true;
|
|
83
81
|
}
|
|
84
82
|
};
|
|
@@ -18,11 +18,14 @@
|
|
|
18
18
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
|
+
// Forward declaration of `MarketAssetKind` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::rncandle { enum class MarketAssetKind; }
|
|
21
23
|
// Forward declaration of `FiatMarketAccountKind` to properly resolve imports.
|
|
22
24
|
namespace margelo::nitro::rncandle { enum class FiatMarketAccountKind; }
|
|
23
25
|
// Forward declaration of `Service` to properly resolve imports.
|
|
24
26
|
namespace margelo::nitro::rncandle { enum class Service; }
|
|
25
27
|
|
|
28
|
+
#include "MarketAssetKind.hpp"
|
|
26
29
|
#include <string>
|
|
27
30
|
#include "FiatMarketAccountKind.hpp"
|
|
28
31
|
#include "Service.hpp"
|
|
@@ -34,7 +37,7 @@ namespace margelo::nitro::rncandle {
|
|
|
34
37
|
*/
|
|
35
38
|
struct MarketAccount {
|
|
36
39
|
public:
|
|
37
|
-
|
|
40
|
+
MarketAssetKind assetKind SWIFT_PRIVATE;
|
|
38
41
|
std::string serviceAccountID SWIFT_PRIVATE;
|
|
39
42
|
FiatMarketAccountKind accountKind SWIFT_PRIVATE;
|
|
40
43
|
std::string nickname SWIFT_PRIVATE;
|
|
@@ -43,37 +46,35 @@ namespace margelo::nitro::rncandle {
|
|
|
43
46
|
|
|
44
47
|
public:
|
|
45
48
|
MarketAccount() = default;
|
|
46
|
-
explicit MarketAccount(
|
|
49
|
+
explicit MarketAccount(MarketAssetKind assetKind, std::string serviceAccountID, FiatMarketAccountKind accountKind, std::string nickname, std::string linkedAccountID, Service service): assetKind(assetKind), serviceAccountID(serviceAccountID), accountKind(accountKind), nickname(nickname), linkedAccountID(linkedAccountID), service(service) {}
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
} // namespace margelo::nitro::rncandle
|
|
50
53
|
|
|
51
54
|
namespace margelo::nitro {
|
|
52
55
|
|
|
53
|
-
using namespace margelo::nitro::rncandle;
|
|
54
|
-
|
|
55
56
|
// C++ MarketAccount <> JS MarketAccount (object)
|
|
56
57
|
template <>
|
|
57
|
-
struct JSIConverter<MarketAccount> final {
|
|
58
|
-
static inline MarketAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
|
+
struct JSIConverter<margelo::nitro::rncandle::MarketAccount> final {
|
|
59
|
+
static inline margelo::nitro::rncandle::MarketAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
59
60
|
jsi::Object obj = arg.asObject(runtime);
|
|
60
|
-
return MarketAccount(
|
|
61
|
-
JSIConverter<
|
|
61
|
+
return margelo::nitro::rncandle::MarketAccount(
|
|
62
|
+
JSIConverter<margelo::nitro::rncandle::MarketAssetKind>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
|
|
62
63
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceAccountID")),
|
|
63
|
-
JSIConverter<FiatMarketAccountKind>::fromJSI(runtime, obj.getProperty(runtime, "accountKind")),
|
|
64
|
+
JSIConverter<margelo::nitro::rncandle::FiatMarketAccountKind>::fromJSI(runtime, obj.getProperty(runtime, "accountKind")),
|
|
64
65
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "nickname")),
|
|
65
66
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
|
|
66
|
-
JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
67
|
+
JSIConverter<margelo::nitro::rncandle::Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
67
68
|
);
|
|
68
69
|
}
|
|
69
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const MarketAccount& arg) {
|
|
70
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::MarketAccount& arg) {
|
|
70
71
|
jsi::Object obj(runtime);
|
|
71
|
-
obj.setProperty(runtime, "assetKind", JSIConverter<
|
|
72
|
+
obj.setProperty(runtime, "assetKind", JSIConverter<margelo::nitro::rncandle::MarketAssetKind>::toJSI(runtime, arg.assetKind));
|
|
72
73
|
obj.setProperty(runtime, "serviceAccountID", JSIConverter<std::string>::toJSI(runtime, arg.serviceAccountID));
|
|
73
|
-
obj.setProperty(runtime, "accountKind", JSIConverter<FiatMarketAccountKind>::toJSI(runtime, arg.accountKind));
|
|
74
|
+
obj.setProperty(runtime, "accountKind", JSIConverter<margelo::nitro::rncandle::FiatMarketAccountKind>::toJSI(runtime, arg.accountKind));
|
|
74
75
|
obj.setProperty(runtime, "nickname", JSIConverter<std::string>::toJSI(runtime, arg.nickname));
|
|
75
76
|
obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
|
|
76
|
-
obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
|
|
77
|
+
obj.setProperty(runtime, "service", JSIConverter<margelo::nitro::rncandle::Service>::toJSI(runtime, arg.service));
|
|
77
78
|
return obj;
|
|
78
79
|
}
|
|
79
80
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -81,12 +82,12 @@ namespace margelo::nitro {
|
|
|
81
82
|
return false;
|
|
82
83
|
}
|
|
83
84
|
jsi::Object obj = value.getObject(runtime);
|
|
84
|
-
if (!JSIConverter<
|
|
85
|
+
if (!JSIConverter<margelo::nitro::rncandle::MarketAssetKind>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
|
|
85
86
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceAccountID"))) return false;
|
|
86
|
-
if (!JSIConverter<FiatMarketAccountKind>::canConvert(runtime, obj.getProperty(runtime, "accountKind"))) return false;
|
|
87
|
+
if (!JSIConverter<margelo::nitro::rncandle::FiatMarketAccountKind>::canConvert(runtime, obj.getProperty(runtime, "accountKind"))) return false;
|
|
87
88
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "nickname"))) return false;
|
|
88
89
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
|
|
89
|
-
if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
90
|
+
if (!JSIConverter<margelo::nitro::rncandle::Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
90
91
|
return true;
|
|
91
92
|
}
|
|
92
93
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MarketAssetKind.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 (MarketAssetKind).
|
|
30
|
+
*/
|
|
31
|
+
enum class MarketAssetKind {
|
|
32
|
+
STOCK SWIFT_NAME(stock) = 0,
|
|
33
|
+
CRYPTO SWIFT_NAME(crypto) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::rncandle
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ MarketAssetKind <> JS MarketAssetKind (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::rncandle::MarketAssetKind> final {
|
|
43
|
+
static inline margelo::nitro::rncandle::MarketAssetKind fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
+
case hashString("stock"): return margelo::nitro::rncandle::MarketAssetKind::STOCK;
|
|
47
|
+
case hashString("crypto"): return margelo::nitro::rncandle::MarketAssetKind::CRYPTO;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum MarketAssetKind - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rncandle::MarketAssetKind arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::rncandle::MarketAssetKind::STOCK: return JSIConverter<std::string>::toJSI(runtime, "stock");
|
|
55
|
+
case margelo::nitro::rncandle::MarketAssetKind::CRYPTO: return JSIConverter<std::string>::toJSI(runtime, "crypto");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert MarketAssetKind to JS - invalid value: "
|
|
58
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isString()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
67
|
+
case hashString("stock"):
|
|
68
|
+
case hashString("crypto"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|