react-native-candle 0.1.43 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +10 -14
- 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
|
@@ -23,8 +23,8 @@ namespace margelo::nitro::rncandle { struct LinkedAccountStatusRef; }
|
|
|
23
23
|
// Forward declaration of `Trade` to properly resolve imports.
|
|
24
24
|
namespace margelo::nitro::rncandle { struct Trade; }
|
|
25
25
|
|
|
26
|
-
#include <vector>
|
|
27
26
|
#include "LinkedAccountStatusRef.hpp"
|
|
27
|
+
#include <vector>
|
|
28
28
|
#include "Trade.hpp"
|
|
29
29
|
|
|
30
30
|
namespace margelo::nitro::rncandle {
|
|
@@ -46,22 +46,20 @@ namespace margelo::nitro::rncandle {
|
|
|
46
46
|
|
|
47
47
|
namespace margelo::nitro {
|
|
48
48
|
|
|
49
|
-
using namespace margelo::nitro::rncandle;
|
|
50
|
-
|
|
51
49
|
// C++ TradesResponse <> JS TradesResponse (object)
|
|
52
50
|
template <>
|
|
53
|
-
struct JSIConverter<TradesResponse> final {
|
|
54
|
-
static inline TradesResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
51
|
+
struct JSIConverter<margelo::nitro::rncandle::TradesResponse> final {
|
|
52
|
+
static inline margelo::nitro::rncandle::TradesResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
53
|
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"))
|
|
54
|
+
return margelo::nitro::rncandle::TradesResponse(
|
|
55
|
+
JSIConverter<std::vector<margelo::nitro::rncandle::LinkedAccountStatusRef>>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccounts")),
|
|
56
|
+
JSIConverter<std::vector<margelo::nitro::rncandle::Trade>>::fromJSI(runtime, obj.getProperty(runtime, "trades"))
|
|
59
57
|
);
|
|
60
58
|
}
|
|
61
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const TradesResponse& arg) {
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TradesResponse& arg) {
|
|
62
60
|
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));
|
|
61
|
+
obj.setProperty(runtime, "linkedAccounts", JSIConverter<std::vector<margelo::nitro::rncandle::LinkedAccountStatusRef>>::toJSI(runtime, arg.linkedAccounts));
|
|
62
|
+
obj.setProperty(runtime, "trades", JSIConverter<std::vector<margelo::nitro::rncandle::Trade>>::toJSI(runtime, arg.trades));
|
|
65
63
|
return obj;
|
|
66
64
|
}
|
|
67
65
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -69,8 +67,8 @@ namespace margelo::nitro {
|
|
|
69
67
|
return false;
|
|
70
68
|
}
|
|
71
69
|
jsi::Object obj = value.getObject(runtime);
|
|
72
|
-
if (!JSIConverter<std::vector<LinkedAccountStatusRef>>::canConvert(runtime, obj.getProperty(runtime, "linkedAccounts"))) return false;
|
|
73
|
-
if (!JSIConverter<std::vector<Trade>>::canConvert(runtime, obj.getProperty(runtime, "trades"))) return false;
|
|
70
|
+
if (!JSIConverter<std::vector<margelo::nitro::rncandle::LinkedAccountStatusRef>>::canConvert(runtime, obj.getProperty(runtime, "linkedAccounts"))) return false;
|
|
71
|
+
if (!JSIConverter<std::vector<margelo::nitro::rncandle::Trade>>::canConvert(runtime, obj.getProperty(runtime, "trades"))) return false;
|
|
74
72
|
return true;
|
|
75
73
|
}
|
|
76
74
|
};
|
|
@@ -50,30 +50,28 @@ namespace margelo::nitro::rncandle {
|
|
|
50
50
|
|
|
51
51
|
namespace margelo::nitro {
|
|
52
52
|
|
|
53
|
-
using namespace margelo::nitro::rncandle;
|
|
54
|
-
|
|
55
53
|
// C++ TransportAccount <> JS TransportAccount (object)
|
|
56
54
|
template <>
|
|
57
|
-
struct JSIConverter<TransportAccount> final {
|
|
58
|
-
static inline TransportAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
struct JSIConverter<margelo::nitro::rncandle::TransportAccount> final {
|
|
56
|
+
static inline margelo::nitro::rncandle::TransportAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
59
57
|
jsi::Object obj = arg.asObject(runtime);
|
|
60
|
-
return TransportAccount(
|
|
58
|
+
return margelo::nitro::rncandle::TransportAccount(
|
|
61
59
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
|
|
62
60
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceAccountID")),
|
|
63
|
-
JSIConverter<TransportAccountKind>::fromJSI(runtime, obj.getProperty(runtime, "accountKind")),
|
|
61
|
+
JSIConverter<margelo::nitro::rncandle::TransportAccountKind>::fromJSI(runtime, obj.getProperty(runtime, "accountKind")),
|
|
64
62
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "nickname")),
|
|
65
63
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
|
|
66
|
-
JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
64
|
+
JSIConverter<margelo::nitro::rncandle::Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
67
65
|
);
|
|
68
66
|
}
|
|
69
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const TransportAccount& arg) {
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TransportAccount& arg) {
|
|
70
68
|
jsi::Object obj(runtime);
|
|
71
69
|
obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
|
|
72
70
|
obj.setProperty(runtime, "serviceAccountID", JSIConverter<std::string>::toJSI(runtime, arg.serviceAccountID));
|
|
73
|
-
obj.setProperty(runtime, "accountKind", JSIConverter<TransportAccountKind>::toJSI(runtime, arg.accountKind));
|
|
71
|
+
obj.setProperty(runtime, "accountKind", JSIConverter<margelo::nitro::rncandle::TransportAccountKind>::toJSI(runtime, arg.accountKind));
|
|
74
72
|
obj.setProperty(runtime, "nickname", JSIConverter<std::string>::toJSI(runtime, arg.nickname));
|
|
75
73
|
obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
|
|
76
|
-
obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
|
|
74
|
+
obj.setProperty(runtime, "service", JSIConverter<margelo::nitro::rncandle::Service>::toJSI(runtime, arg.service));
|
|
77
75
|
return obj;
|
|
78
76
|
}
|
|
79
77
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -83,10 +81,10 @@ namespace margelo::nitro {
|
|
|
83
81
|
jsi::Object obj = value.getObject(runtime);
|
|
84
82
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
|
|
85
83
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceAccountID"))) return false;
|
|
86
|
-
if (!JSIConverter<TransportAccountKind>::canConvert(runtime, obj.getProperty(runtime, "accountKind"))) return false;
|
|
84
|
+
if (!JSIConverter<margelo::nitro::rncandle::TransportAccountKind>::canConvert(runtime, obj.getProperty(runtime, "accountKind"))) return false;
|
|
87
85
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "nickname"))) return false;
|
|
88
86
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
|
|
89
|
-
if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
87
|
+
if (!JSIConverter<margelo::nitro::rncandle::Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
90
88
|
return true;
|
|
91
89
|
}
|
|
92
90
|
};
|
|
@@ -38,26 +38,24 @@ namespace margelo::nitro::rncandle {
|
|
|
38
38
|
|
|
39
39
|
namespace margelo::nitro {
|
|
40
40
|
|
|
41
|
-
using namespace margelo::nitro::rncandle;
|
|
42
|
-
|
|
43
41
|
// C++ TransportAccountKind <> JS TransportAccountKind (union)
|
|
44
42
|
template <>
|
|
45
|
-
struct JSIConverter<TransportAccountKind> final {
|
|
46
|
-
static inline TransportAccountKind fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
43
|
+
struct JSIConverter<margelo::nitro::rncandle::TransportAccountKind> final {
|
|
44
|
+
static inline margelo::nitro::rncandle::TransportAccountKind 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("individual"): return TransportAccountKind::INDIVIDUAL;
|
|
50
|
-
case hashString("joint"): return TransportAccountKind::JOINT;
|
|
51
|
-
case hashString("business"): return TransportAccountKind::BUSINESS;
|
|
47
|
+
case hashString("individual"): return margelo::nitro::rncandle::TransportAccountKind::INDIVIDUAL;
|
|
48
|
+
case hashString("joint"): return margelo::nitro::rncandle::TransportAccountKind::JOINT;
|
|
49
|
+
case hashString("business"): return margelo::nitro::rncandle::TransportAccountKind::BUSINESS;
|
|
52
50
|
default: [[unlikely]]
|
|
53
51
|
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum TransportAccountKind - invalid value!");
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, TransportAccountKind arg) {
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rncandle::TransportAccountKind arg) {
|
|
57
55
|
switch (arg) {
|
|
58
|
-
case TransportAccountKind::INDIVIDUAL: return JSIConverter<std::string>::toJSI(runtime, "individual");
|
|
59
|
-
case TransportAccountKind::JOINT: return JSIConverter<std::string>::toJSI(runtime, "joint");
|
|
60
|
-
case TransportAccountKind::BUSINESS: return JSIConverter<std::string>::toJSI(runtime, "business");
|
|
56
|
+
case margelo::nitro::rncandle::TransportAccountKind::INDIVIDUAL: return JSIConverter<std::string>::toJSI(runtime, "individual");
|
|
57
|
+
case margelo::nitro::rncandle::TransportAccountKind::JOINT: return JSIConverter<std::string>::toJSI(runtime, "joint");
|
|
58
|
+
case margelo::nitro::rncandle::TransportAccountKind::BUSINESS: return JSIConverter<std::string>::toJSI(runtime, "business");
|
|
61
59
|
default: [[unlikely]]
|
|
62
60
|
throw std::invalid_argument("Cannot convert TransportAccountKind to JS - invalid value: "
|
|
63
61
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
@@ -63,14 +63,12 @@ namespace margelo::nitro::rncandle {
|
|
|
63
63
|
|
|
64
64
|
namespace margelo::nitro {
|
|
65
65
|
|
|
66
|
-
using namespace margelo::nitro::rncandle;
|
|
67
|
-
|
|
68
66
|
// C++ TransportAsset <> JS TransportAsset (object)
|
|
69
67
|
template <>
|
|
70
|
-
struct JSIConverter<TransportAsset> final {
|
|
71
|
-
static inline TransportAsset fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
68
|
+
struct JSIConverter<margelo::nitro::rncandle::TransportAsset> final {
|
|
69
|
+
static inline margelo::nitro::rncandle::TransportAsset fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
72
70
|
jsi::Object obj = arg.asObject(runtime);
|
|
73
|
-
return TransportAsset(
|
|
71
|
+
return margelo::nitro::rncandle::TransportAsset(
|
|
74
72
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
|
|
75
73
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceTradeID")),
|
|
76
74
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceAssetID")),
|
|
@@ -78,18 +76,18 @@ namespace margelo::nitro {
|
|
|
78
76
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "name")),
|
|
79
77
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "description")),
|
|
80
78
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "imageURL")),
|
|
81
|
-
JSIConverter<Coordinates>::fromJSI(runtime, obj.getProperty(runtime, "originCoordinates")),
|
|
82
|
-
JSIConverter<Address>::fromJSI(runtime, obj.getProperty(runtime, "originAddress")),
|
|
83
|
-
JSIConverter<Coordinates>::fromJSI(runtime, obj.getProperty(runtime, "destinationCoordinates")),
|
|
84
|
-
JSIConverter<Address>::fromJSI(runtime, obj.getProperty(runtime, "destinationAddress")),
|
|
79
|
+
JSIConverter<margelo::nitro::rncandle::Coordinates>::fromJSI(runtime, obj.getProperty(runtime, "originCoordinates")),
|
|
80
|
+
JSIConverter<margelo::nitro::rncandle::Address>::fromJSI(runtime, obj.getProperty(runtime, "originAddress")),
|
|
81
|
+
JSIConverter<margelo::nitro::rncandle::Coordinates>::fromJSI(runtime, obj.getProperty(runtime, "destinationCoordinates")),
|
|
82
|
+
JSIConverter<margelo::nitro::rncandle::Address>::fromJSI(runtime, obj.getProperty(runtime, "destinationAddress")),
|
|
85
83
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "seats")),
|
|
86
84
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "departureDateTime")),
|
|
87
85
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "arrivalDateTime")),
|
|
88
86
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
|
|
89
|
-
JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
87
|
+
JSIConverter<margelo::nitro::rncandle::Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
90
88
|
);
|
|
91
89
|
}
|
|
92
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const TransportAsset& arg) {
|
|
90
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TransportAsset& arg) {
|
|
93
91
|
jsi::Object obj(runtime);
|
|
94
92
|
obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
|
|
95
93
|
obj.setProperty(runtime, "serviceTradeID", JSIConverter<std::string>::toJSI(runtime, arg.serviceTradeID));
|
|
@@ -98,15 +96,15 @@ namespace margelo::nitro {
|
|
|
98
96
|
obj.setProperty(runtime, "name", JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
99
97
|
obj.setProperty(runtime, "description", JSIConverter<std::string>::toJSI(runtime, arg.description));
|
|
100
98
|
obj.setProperty(runtime, "imageURL", JSIConverter<std::string>::toJSI(runtime, arg.imageURL));
|
|
101
|
-
obj.setProperty(runtime, "originCoordinates", JSIConverter<Coordinates>::toJSI(runtime, arg.originCoordinates));
|
|
102
|
-
obj.setProperty(runtime, "originAddress", JSIConverter<Address>::toJSI(runtime, arg.originAddress));
|
|
103
|
-
obj.setProperty(runtime, "destinationCoordinates", JSIConverter<Coordinates>::toJSI(runtime, arg.destinationCoordinates));
|
|
104
|
-
obj.setProperty(runtime, "destinationAddress", JSIConverter<Address>::toJSI(runtime, arg.destinationAddress));
|
|
99
|
+
obj.setProperty(runtime, "originCoordinates", JSIConverter<margelo::nitro::rncandle::Coordinates>::toJSI(runtime, arg.originCoordinates));
|
|
100
|
+
obj.setProperty(runtime, "originAddress", JSIConverter<margelo::nitro::rncandle::Address>::toJSI(runtime, arg.originAddress));
|
|
101
|
+
obj.setProperty(runtime, "destinationCoordinates", JSIConverter<margelo::nitro::rncandle::Coordinates>::toJSI(runtime, arg.destinationCoordinates));
|
|
102
|
+
obj.setProperty(runtime, "destinationAddress", JSIConverter<margelo::nitro::rncandle::Address>::toJSI(runtime, arg.destinationAddress));
|
|
105
103
|
obj.setProperty(runtime, "seats", JSIConverter<double>::toJSI(runtime, arg.seats));
|
|
106
104
|
obj.setProperty(runtime, "departureDateTime", JSIConverter<std::string>::toJSI(runtime, arg.departureDateTime));
|
|
107
105
|
obj.setProperty(runtime, "arrivalDateTime", JSIConverter<std::string>::toJSI(runtime, arg.arrivalDateTime));
|
|
108
106
|
obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
|
|
109
|
-
obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
|
|
107
|
+
obj.setProperty(runtime, "service", JSIConverter<margelo::nitro::rncandle::Service>::toJSI(runtime, arg.service));
|
|
110
108
|
return obj;
|
|
111
109
|
}
|
|
112
110
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -121,15 +119,15 @@ namespace margelo::nitro {
|
|
|
121
119
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "name"))) return false;
|
|
122
120
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "description"))) return false;
|
|
123
121
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "imageURL"))) return false;
|
|
124
|
-
if (!JSIConverter<Coordinates>::canConvert(runtime, obj.getProperty(runtime, "originCoordinates"))) return false;
|
|
125
|
-
if (!JSIConverter<Address>::canConvert(runtime, obj.getProperty(runtime, "originAddress"))) return false;
|
|
126
|
-
if (!JSIConverter<Coordinates>::canConvert(runtime, obj.getProperty(runtime, "destinationCoordinates"))) return false;
|
|
127
|
-
if (!JSIConverter<Address>::canConvert(runtime, obj.getProperty(runtime, "destinationAddress"))) return false;
|
|
122
|
+
if (!JSIConverter<margelo::nitro::rncandle::Coordinates>::canConvert(runtime, obj.getProperty(runtime, "originCoordinates"))) return false;
|
|
123
|
+
if (!JSIConverter<margelo::nitro::rncandle::Address>::canConvert(runtime, obj.getProperty(runtime, "originAddress"))) return false;
|
|
124
|
+
if (!JSIConverter<margelo::nitro::rncandle::Coordinates>::canConvert(runtime, obj.getProperty(runtime, "destinationCoordinates"))) return false;
|
|
125
|
+
if (!JSIConverter<margelo::nitro::rncandle::Address>::canConvert(runtime, obj.getProperty(runtime, "destinationAddress"))) return false;
|
|
128
126
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "seats"))) return false;
|
|
129
127
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "departureDateTime"))) return false;
|
|
130
128
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "arrivalDateTime"))) return false;
|
|
131
129
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
|
|
132
|
-
if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
130
|
+
if (!JSIConverter<margelo::nitro::rncandle::Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
133
131
|
return true;
|
|
134
132
|
}
|
|
135
133
|
};
|
|
@@ -53,32 +53,30 @@ namespace margelo::nitro::rncandle {
|
|
|
53
53
|
|
|
54
54
|
namespace margelo::nitro {
|
|
55
55
|
|
|
56
|
-
using namespace margelo::nitro::rncandle;
|
|
57
|
-
|
|
58
56
|
// C++ TransportAssetQuoteRequest <> JS TransportAssetQuoteRequest (object)
|
|
59
57
|
template <>
|
|
60
|
-
struct JSIConverter<TransportAssetQuoteRequest> final {
|
|
61
|
-
static inline TransportAssetQuoteRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
|
+
struct JSIConverter<margelo::nitro::rncandle::TransportAssetQuoteRequest> final {
|
|
59
|
+
static inline margelo::nitro::rncandle::TransportAssetQuoteRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
60
|
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
-
return TransportAssetQuoteRequest(
|
|
61
|
+
return margelo::nitro::rncandle::TransportAssetQuoteRequest(
|
|
64
62
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
|
|
65
63
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "serviceAssetID")),
|
|
66
|
-
JSIConverter<std::optional<Coordinates>>::fromJSI(runtime, obj.getProperty(runtime, "originCoordinates")),
|
|
67
|
-
JSIConverter<std::optional<Address>>::fromJSI(runtime, obj.getProperty(runtime, "originAddress")),
|
|
68
|
-
JSIConverter<std::optional<Coordinates>>::fromJSI(runtime, obj.getProperty(runtime, "destinationCoordinates")),
|
|
69
|
-
JSIConverter<std::optional<Address>>::fromJSI(runtime, obj.getProperty(runtime, "destinationAddress")),
|
|
64
|
+
JSIConverter<std::optional<margelo::nitro::rncandle::Coordinates>>::fromJSI(runtime, obj.getProperty(runtime, "originCoordinates")),
|
|
65
|
+
JSIConverter<std::optional<margelo::nitro::rncandle::Address>>::fromJSI(runtime, obj.getProperty(runtime, "originAddress")),
|
|
66
|
+
JSIConverter<std::optional<margelo::nitro::rncandle::Coordinates>>::fromJSI(runtime, obj.getProperty(runtime, "destinationCoordinates")),
|
|
67
|
+
JSIConverter<std::optional<margelo::nitro::rncandle::Address>>::fromJSI(runtime, obj.getProperty(runtime, "destinationAddress")),
|
|
70
68
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "seats")),
|
|
71
69
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "serviceAccountID"))
|
|
72
70
|
);
|
|
73
71
|
}
|
|
74
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const TransportAssetQuoteRequest& arg) {
|
|
72
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TransportAssetQuoteRequest& arg) {
|
|
75
73
|
jsi::Object obj(runtime);
|
|
76
74
|
obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
|
|
77
75
|
obj.setProperty(runtime, "serviceAssetID", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.serviceAssetID));
|
|
78
|
-
obj.setProperty(runtime, "originCoordinates", JSIConverter<std::optional<Coordinates>>::toJSI(runtime, arg.originCoordinates));
|
|
79
|
-
obj.setProperty(runtime, "originAddress", JSIConverter<std::optional<Address>>::toJSI(runtime, arg.originAddress));
|
|
80
|
-
obj.setProperty(runtime, "destinationCoordinates", JSIConverter<std::optional<Coordinates>>::toJSI(runtime, arg.destinationCoordinates));
|
|
81
|
-
obj.setProperty(runtime, "destinationAddress", JSIConverter<std::optional<Address>>::toJSI(runtime, arg.destinationAddress));
|
|
76
|
+
obj.setProperty(runtime, "originCoordinates", JSIConverter<std::optional<margelo::nitro::rncandle::Coordinates>>::toJSI(runtime, arg.originCoordinates));
|
|
77
|
+
obj.setProperty(runtime, "originAddress", JSIConverter<std::optional<margelo::nitro::rncandle::Address>>::toJSI(runtime, arg.originAddress));
|
|
78
|
+
obj.setProperty(runtime, "destinationCoordinates", JSIConverter<std::optional<margelo::nitro::rncandle::Coordinates>>::toJSI(runtime, arg.destinationCoordinates));
|
|
79
|
+
obj.setProperty(runtime, "destinationAddress", JSIConverter<std::optional<margelo::nitro::rncandle::Address>>::toJSI(runtime, arg.destinationAddress));
|
|
82
80
|
obj.setProperty(runtime, "seats", JSIConverter<std::optional<double>>::toJSI(runtime, arg.seats));
|
|
83
81
|
obj.setProperty(runtime, "serviceAccountID", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.serviceAccountID));
|
|
84
82
|
return obj;
|
|
@@ -90,10 +88,10 @@ namespace margelo::nitro {
|
|
|
90
88
|
jsi::Object obj = value.getObject(runtime);
|
|
91
89
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
|
|
92
90
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "serviceAssetID"))) return false;
|
|
93
|
-
if (!JSIConverter<std::optional<Coordinates>>::canConvert(runtime, obj.getProperty(runtime, "originCoordinates"))) return false;
|
|
94
|
-
if (!JSIConverter<std::optional<Address>>::canConvert(runtime, obj.getProperty(runtime, "originAddress"))) return false;
|
|
95
|
-
if (!JSIConverter<std::optional<Coordinates>>::canConvert(runtime, obj.getProperty(runtime, "destinationCoordinates"))) return false;
|
|
96
|
-
if (!JSIConverter<std::optional<Address>>::canConvert(runtime, obj.getProperty(runtime, "destinationAddress"))) return false;
|
|
91
|
+
if (!JSIConverter<std::optional<margelo::nitro::rncandle::Coordinates>>::canConvert(runtime, obj.getProperty(runtime, "originCoordinates"))) return false;
|
|
92
|
+
if (!JSIConverter<std::optional<margelo::nitro::rncandle::Address>>::canConvert(runtime, obj.getProperty(runtime, "originAddress"))) return false;
|
|
93
|
+
if (!JSIConverter<std::optional<margelo::nitro::rncandle::Coordinates>>::canConvert(runtime, obj.getProperty(runtime, "destinationCoordinates"))) return false;
|
|
94
|
+
if (!JSIConverter<std::optional<margelo::nitro::rncandle::Address>>::canConvert(runtime, obj.getProperty(runtime, "destinationAddress"))) return false;
|
|
97
95
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "seats"))) return false;
|
|
98
96
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "serviceAccountID"))) return false;
|
|
99
97
|
return true;
|
|
@@ -42,20 +42,18 @@ namespace margelo::nitro::rncandle {
|
|
|
42
42
|
|
|
43
43
|
namespace margelo::nitro {
|
|
44
44
|
|
|
45
|
-
using namespace margelo::nitro::rncandle;
|
|
46
|
-
|
|
47
45
|
// C++ TransportAssetRef <> JS TransportAssetRef (object)
|
|
48
46
|
template <>
|
|
49
|
-
struct JSIConverter<TransportAssetRef> final {
|
|
50
|
-
static inline TransportAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
47
|
+
struct JSIConverter<margelo::nitro::rncandle::TransportAssetRef> final {
|
|
48
|
+
static inline margelo::nitro::rncandle::TransportAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
51
49
|
jsi::Object obj = arg.asObject(runtime);
|
|
52
|
-
return TransportAssetRef(
|
|
50
|
+
return margelo::nitro::rncandle::TransportAssetRef(
|
|
53
51
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
|
|
54
52
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceTradeID")),
|
|
55
53
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID"))
|
|
56
54
|
);
|
|
57
55
|
}
|
|
58
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const TransportAssetRef& arg) {
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::TransportAssetRef& arg) {
|
|
59
57
|
jsi::Object obj(runtime);
|
|
60
58
|
obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
|
|
61
59
|
obj.setProperty(runtime, "serviceTradeID", JSIConverter<std::string>::toJSI(runtime, arg.serviceTradeID));
|
|
@@ -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++ UnavailableLinkedAccountDetails <> JS UnavailableLinkedAccountDetails (object)
|
|
46
44
|
template <>
|
|
47
|
-
struct JSIConverter<UnavailableLinkedAccountDetails> final {
|
|
48
|
-
static inline UnavailableLinkedAccountDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
struct JSIConverter<margelo::nitro::rncandle::UnavailableLinkedAccountDetails> final {
|
|
46
|
+
static inline margelo::nitro::rncandle::UnavailableLinkedAccountDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
47
|
jsi::Object obj = arg.asObject(runtime);
|
|
50
|
-
return UnavailableLinkedAccountDetails(
|
|
48
|
+
return margelo::nitro::rncandle::UnavailableLinkedAccountDetails(
|
|
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 UnavailableLinkedAccountDetails& arg) {
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::UnavailableLinkedAccountDetails& arg) {
|
|
55
53
|
jsi::Object obj(runtime);
|
|
56
54
|
obj.setProperty(runtime, "state", JSIConverter<std::string>::toJSI(runtime, arg.state));
|
|
57
55
|
return obj;
|
|
@@ -43,21 +43,19 @@ namespace margelo::nitro::rncandle {
|
|
|
43
43
|
|
|
44
44
|
namespace margelo::nitro {
|
|
45
45
|
|
|
46
|
-
using namespace margelo::nitro::rncandle;
|
|
47
|
-
|
|
48
46
|
// C++ UserCounterparty <> JS UserCounterparty (object)
|
|
49
47
|
template <>
|
|
50
|
-
struct JSIConverter<UserCounterparty> final {
|
|
51
|
-
static inline UserCounterparty fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
48
|
+
struct JSIConverter<margelo::nitro::rncandle::UserCounterparty> final {
|
|
49
|
+
static inline margelo::nitro::rncandle::UserCounterparty fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
50
|
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
-
return UserCounterparty(
|
|
51
|
+
return margelo::nitro::rncandle::UserCounterparty(
|
|
54
52
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "kind")),
|
|
55
53
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "legalName")),
|
|
56
54
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "avatarURL")),
|
|
57
55
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "username"))
|
|
58
56
|
);
|
|
59
57
|
}
|
|
60
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const UserCounterparty& arg) {
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::UserCounterparty& arg) {
|
|
61
59
|
jsi::Object obj(runtime);
|
|
62
60
|
obj.setProperty(runtime, "kind", JSIConverter<std::string>::toJSI(runtime, arg.kind));
|
|
63
61
|
obj.setProperty(runtime, "legalName", JSIConverter<std::string>::toJSI(runtime, arg.legalName));
|
|
@@ -41,19 +41,17 @@ namespace margelo::nitro::rncandle {
|
|
|
41
41
|
|
|
42
42
|
namespace margelo::nitro {
|
|
43
43
|
|
|
44
|
-
using namespace margelo::nitro::rncandle;
|
|
45
|
-
|
|
46
44
|
// C++ WireDetails <> JS WireDetails (object)
|
|
47
45
|
template <>
|
|
48
|
-
struct JSIConverter<WireDetails> final {
|
|
49
|
-
static inline WireDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
struct JSIConverter<margelo::nitro::rncandle::WireDetails> final {
|
|
47
|
+
static inline margelo::nitro::rncandle::WireDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
50
48
|
jsi::Object obj = arg.asObject(runtime);
|
|
51
|
-
return WireDetails(
|
|
49
|
+
return margelo::nitro::rncandle::WireDetails(
|
|
52
50
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "accountNumber")),
|
|
53
51
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "routingNumber"))
|
|
54
52
|
);
|
|
55
53
|
}
|
|
56
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const WireDetails& arg) {
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::WireDetails& arg) {
|
|
57
55
|
jsi::Object obj(runtime);
|
|
58
56
|
obj.setProperty(runtime, "accountNumber", JSIConverter<std::string>::toJSI(runtime, arg.accountNumber));
|
|
59
57
|
obj.setProperty(runtime, "routingNumber", JSIConverter<std::string>::toJSI(runtime, arg.routingNumber));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-candle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"description": "Candle SDK for React Native",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"typecheck": "tsc --noEmit",
|
|
13
13
|
"clean": "rm -rf android/build node_modules/**/android/build lib android/.cxx node_modules/**/android/.cxx",
|
|
14
14
|
"release": "release-it",
|
|
15
|
-
"specs": "bun typecheck &&
|
|
15
|
+
"specs": "bun typecheck && nitrogen --logLevel=\\\"debug\\\" && bun run build",
|
|
16
16
|
"specs:pod": "bun specs && bun --cwd ../example pod"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
@@ -52,20 +52,18 @@
|
|
|
52
52
|
"registry": "https://registry.npmjs.org/"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@expo/config-plugins": "^
|
|
56
|
-
"react": "
|
|
57
|
-
"react-native": "^0.
|
|
58
|
-
"
|
|
59
|
-
"react-native-nitro-modules": "^0.
|
|
60
|
-
"react-native-builder-bob": "^0.
|
|
55
|
+
"@expo/config-plugins": "^54.0.1",
|
|
56
|
+
"react": "19.1.0",
|
|
57
|
+
"react-native": "^0.81.4",
|
|
58
|
+
"nitrogen": "^0.29.6",
|
|
59
|
+
"react-native-nitro-modules": "^0.29.6",
|
|
60
|
+
"react-native-builder-bob": "^0.40.13",
|
|
61
61
|
"release-it": "^19.0.4",
|
|
62
62
|
"@release-it/bumper": "^7.0.5",
|
|
63
63
|
"@release-it/conventional-changelog": "^10.0.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"react": "
|
|
67
|
-
"react-native": "*",
|
|
68
|
-
"react-native-nitro-modules": "*"
|
|
66
|
+
"react-native-nitro-modules": "^0.29.6"
|
|
69
67
|
},
|
|
70
68
|
"release-it": {
|
|
71
69
|
"npm": {
|
|
@@ -98,9 +96,7 @@
|
|
|
98
96
|
],
|
|
99
97
|
[
|
|
100
98
|
"typescript",
|
|
101
|
-
{
|
|
102
|
-
"esm": true
|
|
103
|
-
}
|
|
99
|
+
{}
|
|
104
100
|
]
|
|
105
101
|
]
|
|
106
102
|
},
|
package/src/context.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import type {
|
|
3
|
+
AssetAccount,
|
|
4
|
+
AssetAccountsQuery,
|
|
5
|
+
AssetAccountRef,
|
|
6
|
+
TradeQuoteAssetKind,
|
|
7
|
+
LinkedAccount,
|
|
8
|
+
LinkedAccountRef,
|
|
9
|
+
LinkedAccountStatusRef,
|
|
10
|
+
PresentationBackground,
|
|
11
|
+
PresentationStyle,
|
|
12
|
+
Service,
|
|
13
|
+
Trade,
|
|
14
|
+
TradeRef,
|
|
15
|
+
TradesQuery,
|
|
16
|
+
TradeQuote,
|
|
17
|
+
TradeQuotesRequest,
|
|
18
|
+
TradeAssetKind,
|
|
19
|
+
} from "./types";
|
|
20
|
+
|
|
21
|
+
export type CandleContextValue = {
|
|
22
|
+
presentCandleTradeExecutionSheet: <
|
|
23
|
+
GainedAssetKind extends TradeQuoteAssetKind,
|
|
24
|
+
LostAssetKind extends TradeQuoteAssetKind
|
|
25
|
+
>(input: {
|
|
26
|
+
tradeQuote: TradeQuote<GainedAssetKind, LostAssetKind>;
|
|
27
|
+
presentationBackground?: PresentationBackground;
|
|
28
|
+
completion?: (
|
|
29
|
+
result:
|
|
30
|
+
| ({ kind: "success" } & Trade<GainedAssetKind, LostAssetKind>)
|
|
31
|
+
| { kind: "failure"; error: Error }
|
|
32
|
+
) => void;
|
|
33
|
+
}) => void;
|
|
34
|
+
|
|
35
|
+
presentCandleLinkSheet: (input: {
|
|
36
|
+
services?: Service[];
|
|
37
|
+
cornerRadius?: number;
|
|
38
|
+
customerName?: string;
|
|
39
|
+
showSandbox?: boolean;
|
|
40
|
+
showDynamicLoading?: boolean;
|
|
41
|
+
presentationBackground?: PresentationBackground;
|
|
42
|
+
presentationStyle?: PresentationStyle;
|
|
43
|
+
onSuccess: (account: LinkedAccount) => void;
|
|
44
|
+
}) => void;
|
|
45
|
+
|
|
46
|
+
getLinkedAccounts: () => Promise<LinkedAccount[]>;
|
|
47
|
+
getLinkedAccount: (ref: LinkedAccountRef) => Promise<LinkedAccount>;
|
|
48
|
+
unlinkAccount: (ref: LinkedAccountRef) => Promise<void>;
|
|
49
|
+
|
|
50
|
+
createUser: (input: { appUserID: string }) => Promise<void>;
|
|
51
|
+
deleteUser: () => Promise<void>;
|
|
52
|
+
|
|
53
|
+
getAssetAccounts: (query?: AssetAccountsQuery) => Promise<{
|
|
54
|
+
assetAccounts: AssetAccount[];
|
|
55
|
+
linkedAccounts: LinkedAccountStatusRef[];
|
|
56
|
+
}>;
|
|
57
|
+
getAssetAccount: (ref: AssetAccountRef) => Promise<AssetAccount>;
|
|
58
|
+
|
|
59
|
+
getTrades: (query?: TradesQuery) => Promise<{
|
|
60
|
+
trades: Trade<TradeAssetKind, TradeAssetKind>[];
|
|
61
|
+
linkedAccounts: LinkedAccountStatusRef[];
|
|
62
|
+
}>;
|
|
63
|
+
getTrade: (input: TradeRef) => Promise<Trade<TradeAssetKind, TradeAssetKind>>;
|
|
64
|
+
|
|
65
|
+
getTradeQuotes: <
|
|
66
|
+
GainedAssetKind extends TradeQuoteAssetKind,
|
|
67
|
+
LostAssetKind extends TradeQuoteAssetKind
|
|
68
|
+
>(
|
|
69
|
+
request: TradeQuotesRequest<GainedAssetKind, LostAssetKind>
|
|
70
|
+
) => Promise<{
|
|
71
|
+
tradeQuotes: TradeQuote<GainedAssetKind, LostAssetKind>[];
|
|
72
|
+
linkedAccounts: LinkedAccountStatusRef[];
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const CandleContext = createContext<CandleContextValue | null>(null);
|
|
77
|
+
|
|
78
|
+
export const useCandle = () => {
|
|
79
|
+
const ctx = useContext(CandleContext);
|
|
80
|
+
if (ctx === null) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
"`useCandle` must be used within a <CandleProvider>. Wrap your app's root with <CandleProvider appKey={...} appSecret={...}>."
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return ctx;
|
|
86
|
+
};
|