react-native-candle 0.1.32 → 0.1.35
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/RNCandle.swift +131 -60
- package/lib/commonjs/index.js +58 -43
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +58 -43
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +45 -37
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +20 -10
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +45 -37
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +20 -10
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +34 -22
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +15 -12
- package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +15 -12
- package/nitrogen/generated/ios/swift/AssetAccount.swift +70 -11
- package/nitrogen/generated/ios/swift/AssetAccountKind.swift +4 -0
- package/nitrogen/generated/ios/swift/{FiatAccountDetails.swift → FiatAccount.swift} +32 -8
- package/nitrogen/generated/ios/swift/{LegalAccountKind.swift → FiatMarketAccountKind.swift} +14 -10
- package/nitrogen/generated/ios/swift/{MarketAccountDetails.swift → MarketAccount.swift} +31 -7
- package/nitrogen/generated/ios/swift/TransportAccount.swift +93 -0
- package/nitrogen/generated/ios/swift/TransportAccountKind.swift +42 -0
- package/nitrogen/generated/ios/swift/TransportAsset.swift +18 -6
- package/nitrogen/generated/shared/c++/AssetAccount.hpp +23 -20
- package/nitrogen/generated/shared/c++/AssetAccountKind.hpp +4 -0
- package/nitrogen/generated/shared/c++/{FiatAccountDetails.hpp → FiatAccount.hpp} +21 -10
- package/nitrogen/generated/shared/c++/FiatMarketAccountKind.hpp +90 -0
- package/nitrogen/generated/shared/c++/{MarketAccountDetails.hpp → MarketAccount.hpp} +21 -10
- package/nitrogen/generated/shared/c++/TransportAccount.hpp +94 -0
- package/nitrogen/generated/shared/c++/{LegalAccountKind.hpp → TransportAccountKind.hpp} +17 -21
- package/nitrogen/generated/shared/c++/TransportAsset.hpp +5 -1
- package/package.json +4 -4
- package/src/index.ts +105 -82
- package/src/specs/RNCandle.nitro.ts +27 -15
- package/nitrogen/generated/ios/swift/AssetAccountDetails.swift +0 -83
- package/nitrogen/generated/shared/c++/AssetAccountDetails.hpp +0 -78
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// MarketAccount.swift
|
|
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
|
|
@@ -7,20 +7,22 @@
|
|
|
7
7
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
|
-
/// Represents an instance of `
|
|
11
|
-
public typealias
|
|
10
|
+
/// Represents an instance of `MarketAccount`, backed by a C++ struct.
|
|
11
|
+
public typealias MarketAccount = margelo.nitro.rncandle.MarketAccount
|
|
12
12
|
|
|
13
|
-
extension
|
|
13
|
+
extension MarketAccount {
|
|
14
14
|
private typealias bridge = margelo.nitro.rncandle.bridge.swift
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Create a new instance of `
|
|
17
|
+
* Create a new instance of `MarketAccount`.
|
|
18
18
|
*/
|
|
19
19
|
public init(
|
|
20
|
-
assetKind: String, serviceAccountID: String,
|
|
20
|
+
assetKind: String, serviceAccountID: String, accountKind: FiatMarketAccountKind,
|
|
21
|
+
nickname: String, linkedAccountID: String, service: Service
|
|
21
22
|
) {
|
|
22
23
|
self.init(
|
|
23
|
-
std.string(assetKind), std.string(serviceAccountID), std.string(
|
|
24
|
+
std.string(assetKind), std.string(serviceAccountID), accountKind, std.string(nickname),
|
|
25
|
+
std.string(linkedAccountID), service)
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
public var assetKind: String {
|
|
@@ -45,6 +47,28 @@ extension MarketAccountDetails {
|
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
public var accountKind: FiatMarketAccountKind {
|
|
51
|
+
@inline(__always)
|
|
52
|
+
get {
|
|
53
|
+
return self.__accountKind
|
|
54
|
+
}
|
|
55
|
+
@inline(__always)
|
|
56
|
+
set {
|
|
57
|
+
self.__accountKind = newValue
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public var nickname: String {
|
|
62
|
+
@inline(__always)
|
|
63
|
+
get {
|
|
64
|
+
return String(self.__nickname)
|
|
65
|
+
}
|
|
66
|
+
@inline(__always)
|
|
67
|
+
set {
|
|
68
|
+
self.__nickname = std.string(newValue)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
48
72
|
public var linkedAccountID: String {
|
|
49
73
|
@inline(__always)
|
|
50
74
|
get {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TransportAccount.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// Represents an instance of `TransportAccount`, backed by a C++ struct.
|
|
11
|
+
public typealias TransportAccount = margelo.nitro.rncandle.TransportAccount
|
|
12
|
+
|
|
13
|
+
extension TransportAccount {
|
|
14
|
+
private typealias bridge = margelo.nitro.rncandle.bridge.swift
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create a new instance of `TransportAccount`.
|
|
18
|
+
*/
|
|
19
|
+
public init(
|
|
20
|
+
assetKind: String, serviceAccountID: String, accountKind: TransportAccountKind,
|
|
21
|
+
nickname: String, linkedAccountID: String, service: Service
|
|
22
|
+
) {
|
|
23
|
+
self.init(
|
|
24
|
+
std.string(assetKind), std.string(serviceAccountID), accountKind, std.string(nickname),
|
|
25
|
+
std.string(linkedAccountID), service)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public var assetKind: String {
|
|
29
|
+
@inline(__always)
|
|
30
|
+
get {
|
|
31
|
+
return String(self.__assetKind)
|
|
32
|
+
}
|
|
33
|
+
@inline(__always)
|
|
34
|
+
set {
|
|
35
|
+
self.__assetKind = std.string(newValue)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public var serviceAccountID: String {
|
|
40
|
+
@inline(__always)
|
|
41
|
+
get {
|
|
42
|
+
return String(self.__serviceAccountID)
|
|
43
|
+
}
|
|
44
|
+
@inline(__always)
|
|
45
|
+
set {
|
|
46
|
+
self.__serviceAccountID = std.string(newValue)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public var accountKind: TransportAccountKind {
|
|
51
|
+
@inline(__always)
|
|
52
|
+
get {
|
|
53
|
+
return self.__accountKind
|
|
54
|
+
}
|
|
55
|
+
@inline(__always)
|
|
56
|
+
set {
|
|
57
|
+
self.__accountKind = newValue
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public var nickname: String {
|
|
62
|
+
@inline(__always)
|
|
63
|
+
get {
|
|
64
|
+
return String(self.__nickname)
|
|
65
|
+
}
|
|
66
|
+
@inline(__always)
|
|
67
|
+
set {
|
|
68
|
+
self.__nickname = std.string(newValue)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public var linkedAccountID: String {
|
|
73
|
+
@inline(__always)
|
|
74
|
+
get {
|
|
75
|
+
return String(self.__linkedAccountID)
|
|
76
|
+
}
|
|
77
|
+
@inline(__always)
|
|
78
|
+
set {
|
|
79
|
+
self.__linkedAccountID = std.string(newValue)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public var service: Service {
|
|
84
|
+
@inline(__always)
|
|
85
|
+
get {
|
|
86
|
+
return self.__service
|
|
87
|
+
}
|
|
88
|
+
@inline(__always)
|
|
89
|
+
set {
|
|
90
|
+
self.__service = newValue
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TransportAccountKind.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// Represents the JS union `TransportAccountKind`, backed by a C++ enum.
|
|
9
|
+
public typealias TransportAccountKind = margelo.nitro.rncandle.TransportAccountKind
|
|
10
|
+
|
|
11
|
+
extension TransportAccountKind {
|
|
12
|
+
/**
|
|
13
|
+
* Get a TransportAccountKind for the given String value, or
|
|
14
|
+
* return `nil` if the given value was invalid/unknown.
|
|
15
|
+
*/
|
|
16
|
+
public init?(fromString string: String) {
|
|
17
|
+
switch string {
|
|
18
|
+
case "individual":
|
|
19
|
+
self = .individual
|
|
20
|
+
case "joint":
|
|
21
|
+
self = .joint
|
|
22
|
+
case "business":
|
|
23
|
+
self = .business
|
|
24
|
+
default:
|
|
25
|
+
return nil
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the String value this TransportAccountKind represents.
|
|
31
|
+
*/
|
|
32
|
+
public var stringValue: String {
|
|
33
|
+
switch self {
|
|
34
|
+
case .individual:
|
|
35
|
+
return "individual"
|
|
36
|
+
case .joint:
|
|
37
|
+
return "joint"
|
|
38
|
+
case .business:
|
|
39
|
+
return "business"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -17,15 +17,16 @@ extension TransportAsset {
|
|
|
17
17
|
* Create a new instance of `TransportAsset`.
|
|
18
18
|
*/
|
|
19
19
|
public init(
|
|
20
|
-
assetKind: String, serviceTradeID: String, serviceAssetID: String,
|
|
21
|
-
description: String, imageURL: String, originCoordinates: Coordinates,
|
|
22
|
-
destinationCoordinates: Coordinates, destinationAddress: Address,
|
|
23
|
-
departureDateTime: String, arrivalDateTime: String, linkedAccountID: String,
|
|
20
|
+
assetKind: String, serviceTradeID: String, serviceAssetID: String, serviceAccountID: String,
|
|
21
|
+
name: String, description: String, imageURL: String, originCoordinates: Coordinates,
|
|
22
|
+
originAddress: Address, destinationCoordinates: Coordinates, destinationAddress: Address,
|
|
23
|
+
seats: Double, departureDateTime: String, arrivalDateTime: String, linkedAccountID: String,
|
|
24
|
+
service: Service
|
|
24
25
|
) {
|
|
25
26
|
self.init(
|
|
26
27
|
std.string(assetKind), std.string(serviceTradeID), std.string(serviceAssetID),
|
|
27
|
-
std.string(name), std.string(description), std.string(imageURL),
|
|
28
|
-
originAddress, destinationCoordinates, destinationAddress, seats,
|
|
28
|
+
std.string(serviceAccountID), std.string(name), std.string(description), std.string(imageURL),
|
|
29
|
+
originCoordinates, originAddress, destinationCoordinates, destinationAddress, seats,
|
|
29
30
|
std.string(departureDateTime), std.string(arrivalDateTime), std.string(linkedAccountID),
|
|
30
31
|
service)
|
|
31
32
|
}
|
|
@@ -63,6 +64,17 @@ extension TransportAsset {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
public var serviceAccountID: String {
|
|
68
|
+
@inline(__always)
|
|
69
|
+
get {
|
|
70
|
+
return String(self.__serviceAccountID)
|
|
71
|
+
}
|
|
72
|
+
@inline(__always)
|
|
73
|
+
set {
|
|
74
|
+
self.__serviceAccountID = std.string(newValue)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
66
78
|
public var name: String {
|
|
67
79
|
@inline(__always)
|
|
68
80
|
get {
|
|
@@ -18,14 +18,17 @@
|
|
|
18
18
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
|
-
// Forward declaration of `
|
|
22
|
-
namespace margelo::nitro::rncandle {
|
|
23
|
-
// Forward declaration of `
|
|
24
|
-
namespace margelo::nitro::rncandle { struct
|
|
21
|
+
// Forward declaration of `FiatAccount` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::rncandle { struct FiatAccount; }
|
|
23
|
+
// Forward declaration of `MarketAccount` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::rncandle { struct MarketAccount; }
|
|
25
|
+
// Forward declaration of `TransportAccount` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::rncandle { struct TransportAccount; }
|
|
25
27
|
|
|
26
|
-
#include
|
|
27
|
-
#include
|
|
28
|
-
#include "
|
|
28
|
+
#include <optional>
|
|
29
|
+
#include "FiatAccount.hpp"
|
|
30
|
+
#include "MarketAccount.hpp"
|
|
31
|
+
#include "TransportAccount.hpp"
|
|
29
32
|
|
|
30
33
|
namespace margelo::nitro::rncandle {
|
|
31
34
|
|
|
@@ -34,13 +37,13 @@ namespace margelo::nitro::rncandle {
|
|
|
34
37
|
*/
|
|
35
38
|
struct AssetAccount {
|
|
36
39
|
public:
|
|
37
|
-
|
|
38
|
-
std::
|
|
39
|
-
|
|
40
|
+
std::optional<FiatAccount> fiatAccount SWIFT_PRIVATE;
|
|
41
|
+
std::optional<MarketAccount> marketAccount SWIFT_PRIVATE;
|
|
42
|
+
std::optional<TransportAccount> transportAccount SWIFT_PRIVATE;
|
|
40
43
|
|
|
41
44
|
public:
|
|
42
45
|
AssetAccount() = default;
|
|
43
|
-
explicit AssetAccount(
|
|
46
|
+
explicit AssetAccount(std::optional<FiatAccount> fiatAccount, std::optional<MarketAccount> marketAccount, std::optional<TransportAccount> transportAccount): fiatAccount(fiatAccount), marketAccount(marketAccount), transportAccount(transportAccount) {}
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
} // namespace margelo::nitro::rncandle
|
|
@@ -55,16 +58,16 @@ namespace margelo::nitro {
|
|
|
55
58
|
static inline AssetAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
56
59
|
jsi::Object obj = arg.asObject(runtime);
|
|
57
60
|
return AssetAccount(
|
|
58
|
-
JSIConverter<
|
|
59
|
-
JSIConverter<std::
|
|
60
|
-
JSIConverter<
|
|
61
|
+
JSIConverter<std::optional<FiatAccount>>::fromJSI(runtime, obj.getProperty(runtime, "fiatAccount")),
|
|
62
|
+
JSIConverter<std::optional<MarketAccount>>::fromJSI(runtime, obj.getProperty(runtime, "marketAccount")),
|
|
63
|
+
JSIConverter<std::optional<TransportAccount>>::fromJSI(runtime, obj.getProperty(runtime, "transportAccount"))
|
|
61
64
|
);
|
|
62
65
|
}
|
|
63
66
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const AssetAccount& arg) {
|
|
64
67
|
jsi::Object obj(runtime);
|
|
65
|
-
obj.setProperty(runtime, "
|
|
66
|
-
obj.setProperty(runtime, "
|
|
67
|
-
obj.setProperty(runtime, "
|
|
68
|
+
obj.setProperty(runtime, "fiatAccount", JSIConverter<std::optional<FiatAccount>>::toJSI(runtime, arg.fiatAccount));
|
|
69
|
+
obj.setProperty(runtime, "marketAccount", JSIConverter<std::optional<MarketAccount>>::toJSI(runtime, arg.marketAccount));
|
|
70
|
+
obj.setProperty(runtime, "transportAccount", JSIConverter<std::optional<TransportAccount>>::toJSI(runtime, arg.transportAccount));
|
|
68
71
|
return obj;
|
|
69
72
|
}
|
|
70
73
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -72,9 +75,9 @@ namespace margelo::nitro {
|
|
|
72
75
|
return false;
|
|
73
76
|
}
|
|
74
77
|
jsi::Object obj = value.getObject(runtime);
|
|
75
|
-
if (!JSIConverter<
|
|
76
|
-
if (!JSIConverter<std::
|
|
77
|
-
if (!JSIConverter<
|
|
78
|
+
if (!JSIConverter<std::optional<FiatAccount>>::canConvert(runtime, obj.getProperty(runtime, "fiatAccount"))) return false;
|
|
79
|
+
if (!JSIConverter<std::optional<MarketAccount>>::canConvert(runtime, obj.getProperty(runtime, "marketAccount"))) return false;
|
|
80
|
+
if (!JSIConverter<std::optional<TransportAccount>>::canConvert(runtime, obj.getProperty(runtime, "transportAccount"))) return false;
|
|
78
81
|
return true;
|
|
79
82
|
}
|
|
80
83
|
};
|
|
@@ -32,6 +32,7 @@ namespace margelo::nitro::rncandle {
|
|
|
32
32
|
FIAT SWIFT_NAME(fiat) = 0,
|
|
33
33
|
STOCK SWIFT_NAME(stock) = 1,
|
|
34
34
|
CRYPTO SWIFT_NAME(crypto) = 2,
|
|
35
|
+
TRANSPORT SWIFT_NAME(transport) = 3,
|
|
35
36
|
} CLOSED_ENUM;
|
|
36
37
|
|
|
37
38
|
} // namespace margelo::nitro::rncandle
|
|
@@ -49,6 +50,7 @@ namespace margelo::nitro {
|
|
|
49
50
|
case hashString("fiat"): return AssetAccountKind::FIAT;
|
|
50
51
|
case hashString("stock"): return AssetAccountKind::STOCK;
|
|
51
52
|
case hashString("crypto"): return AssetAccountKind::CRYPTO;
|
|
53
|
+
case hashString("transport"): return AssetAccountKind::TRANSPORT;
|
|
52
54
|
default: [[unlikely]]
|
|
53
55
|
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum AssetAccountKind - invalid value!");
|
|
54
56
|
}
|
|
@@ -58,6 +60,7 @@ namespace margelo::nitro {
|
|
|
58
60
|
case AssetAccountKind::FIAT: return JSIConverter<std::string>::toJSI(runtime, "fiat");
|
|
59
61
|
case AssetAccountKind::STOCK: return JSIConverter<std::string>::toJSI(runtime, "stock");
|
|
60
62
|
case AssetAccountKind::CRYPTO: return JSIConverter<std::string>::toJSI(runtime, "crypto");
|
|
63
|
+
case AssetAccountKind::TRANSPORT: return JSIConverter<std::string>::toJSI(runtime, "transport");
|
|
61
64
|
default: [[unlikely]]
|
|
62
65
|
throw std::invalid_argument("Cannot convert AssetAccountKind to JS - invalid value: "
|
|
63
66
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
@@ -72,6 +75,7 @@ namespace margelo::nitro {
|
|
|
72
75
|
case hashString("fiat"):
|
|
73
76
|
case hashString("stock"):
|
|
74
77
|
case hashString("crypto"):
|
|
78
|
+
case hashString("transport"):
|
|
75
79
|
return true;
|
|
76
80
|
default:
|
|
77
81
|
return false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// FiatAccount.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
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
|
+
// Forward declaration of `FiatMarketAccountKind` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::rncandle { enum class FiatMarketAccountKind; }
|
|
21
23
|
// Forward declaration of `ACHDetails` to properly resolve imports.
|
|
22
24
|
namespace margelo::nitro::rncandle { struct ACHDetails; }
|
|
23
25
|
// Forward declaration of `WireDetails` to properly resolve imports.
|
|
@@ -26,6 +28,7 @@ namespace margelo::nitro::rncandle { struct WireDetails; }
|
|
|
26
28
|
namespace margelo::nitro::rncandle { enum class Service; }
|
|
27
29
|
|
|
28
30
|
#include <string>
|
|
31
|
+
#include "FiatMarketAccountKind.hpp"
|
|
29
32
|
#include <optional>
|
|
30
33
|
#include "ACHDetails.hpp"
|
|
31
34
|
#include "WireDetails.hpp"
|
|
@@ -34,12 +37,14 @@ namespace margelo::nitro::rncandle { enum class Service; }
|
|
|
34
37
|
namespace margelo::nitro::rncandle {
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
|
-
* A struct which can be represented as a JavaScript object (
|
|
40
|
+
* A struct which can be represented as a JavaScript object (FiatAccount).
|
|
38
41
|
*/
|
|
39
|
-
struct
|
|
42
|
+
struct FiatAccount {
|
|
40
43
|
public:
|
|
41
44
|
std::string assetKind SWIFT_PRIVATE;
|
|
42
45
|
std::string serviceAccountID SWIFT_PRIVATE;
|
|
46
|
+
FiatMarketAccountKind accountKind SWIFT_PRIVATE;
|
|
47
|
+
std::string nickname SWIFT_PRIVATE;
|
|
43
48
|
std::string currencyCode SWIFT_PRIVATE;
|
|
44
49
|
std::optional<double> balance SWIFT_PRIVATE;
|
|
45
50
|
std::optional<ACHDetails> ach SWIFT_PRIVATE;
|
|
@@ -48,8 +53,8 @@ namespace margelo::nitro::rncandle {
|
|
|
48
53
|
Service service SWIFT_PRIVATE;
|
|
49
54
|
|
|
50
55
|
public:
|
|
51
|
-
|
|
52
|
-
explicit
|
|
56
|
+
FiatAccount() = default;
|
|
57
|
+
explicit FiatAccount(std::string assetKind, std::string serviceAccountID, FiatMarketAccountKind accountKind, std::string nickname, std::string currencyCode, std::optional<double> balance, std::optional<ACHDetails> ach, std::optional<WireDetails> wire, std::string linkedAccountID, Service service): assetKind(assetKind), serviceAccountID(serviceAccountID), accountKind(accountKind), nickname(nickname), currencyCode(currencyCode), balance(balance), ach(ach), wire(wire), linkedAccountID(linkedAccountID), service(service) {}
|
|
53
58
|
};
|
|
54
59
|
|
|
55
60
|
} // namespace margelo::nitro::rncandle
|
|
@@ -58,14 +63,16 @@ namespace margelo::nitro {
|
|
|
58
63
|
|
|
59
64
|
using namespace margelo::nitro::rncandle;
|
|
60
65
|
|
|
61
|
-
// C++
|
|
66
|
+
// C++ FiatAccount <> JS FiatAccount (object)
|
|
62
67
|
template <>
|
|
63
|
-
struct JSIConverter<
|
|
64
|
-
static inline
|
|
68
|
+
struct JSIConverter<FiatAccount> final {
|
|
69
|
+
static inline FiatAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
70
|
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
-
return
|
|
71
|
+
return FiatAccount(
|
|
67
72
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
|
|
68
73
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceAccountID")),
|
|
74
|
+
JSIConverter<FiatMarketAccountKind>::fromJSI(runtime, obj.getProperty(runtime, "accountKind")),
|
|
75
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "nickname")),
|
|
69
76
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "currencyCode")),
|
|
70
77
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "balance")),
|
|
71
78
|
JSIConverter<std::optional<ACHDetails>>::fromJSI(runtime, obj.getProperty(runtime, "ach")),
|
|
@@ -74,10 +81,12 @@ namespace margelo::nitro {
|
|
|
74
81
|
JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
75
82
|
);
|
|
76
83
|
}
|
|
77
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const
|
|
84
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const FiatAccount& arg) {
|
|
78
85
|
jsi::Object obj(runtime);
|
|
79
86
|
obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
|
|
80
87
|
obj.setProperty(runtime, "serviceAccountID", JSIConverter<std::string>::toJSI(runtime, arg.serviceAccountID));
|
|
88
|
+
obj.setProperty(runtime, "accountKind", JSIConverter<FiatMarketAccountKind>::toJSI(runtime, arg.accountKind));
|
|
89
|
+
obj.setProperty(runtime, "nickname", JSIConverter<std::string>::toJSI(runtime, arg.nickname));
|
|
81
90
|
obj.setProperty(runtime, "currencyCode", JSIConverter<std::string>::toJSI(runtime, arg.currencyCode));
|
|
82
91
|
obj.setProperty(runtime, "balance", JSIConverter<std::optional<double>>::toJSI(runtime, arg.balance));
|
|
83
92
|
obj.setProperty(runtime, "ach", JSIConverter<std::optional<ACHDetails>>::toJSI(runtime, arg.ach));
|
|
@@ -93,6 +102,8 @@ namespace margelo::nitro {
|
|
|
93
102
|
jsi::Object obj = value.getObject(runtime);
|
|
94
103
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
|
|
95
104
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceAccountID"))) return false;
|
|
105
|
+
if (!JSIConverter<FiatMarketAccountKind>::canConvert(runtime, obj.getProperty(runtime, "accountKind"))) return false;
|
|
106
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "nickname"))) return false;
|
|
96
107
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "currencyCode"))) return false;
|
|
97
108
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "balance"))) return false;
|
|
98
109
|
if (!JSIConverter<std::optional<ACHDetails>>::canConvert(runtime, obj.getProperty(runtime, "ach"))) return false;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FiatMarketAccountKind.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 (FiatMarketAccountKind).
|
|
30
|
+
*/
|
|
31
|
+
enum class FiatMarketAccountKind {
|
|
32
|
+
INDIVIDUAL SWIFT_NAME(individual) = 0,
|
|
33
|
+
JOINT SWIFT_NAME(joint) = 1,
|
|
34
|
+
TRADITIONALIRA SWIFT_NAME(traditionalira) = 2,
|
|
35
|
+
ROTHIRA SWIFT_NAME(rothira) = 3,
|
|
36
|
+
BUSINESS SWIFT_NAME(business) = 4,
|
|
37
|
+
} CLOSED_ENUM;
|
|
38
|
+
|
|
39
|
+
} // namespace margelo::nitro::rncandle
|
|
40
|
+
|
|
41
|
+
namespace margelo::nitro {
|
|
42
|
+
|
|
43
|
+
using namespace margelo::nitro::rncandle;
|
|
44
|
+
|
|
45
|
+
// C++ FiatMarketAccountKind <> JS FiatMarketAccountKind (union)
|
|
46
|
+
template <>
|
|
47
|
+
struct JSIConverter<FiatMarketAccountKind> final {
|
|
48
|
+
static inline FiatMarketAccountKind fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
50
|
+
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;
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum FiatMarketAccountKind - invalid value!");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, FiatMarketAccountKind arg) {
|
|
61
|
+
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");
|
|
67
|
+
default: [[unlikely]]
|
|
68
|
+
throw std::invalid_argument("Cannot convert FiatMarketAccountKind to JS - invalid value: "
|
|
69
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
73
|
+
if (!value.isString()) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
77
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
78
|
+
case hashString("individual"):
|
|
79
|
+
case hashString("joint"):
|
|
80
|
+
case hashString("traditionalIRA"):
|
|
81
|
+
case hashString("rothIRA"):
|
|
82
|
+
case hashString("business"):
|
|
83
|
+
return true;
|
|
84
|
+
default:
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
} // namespace margelo::nitro
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// MarketAccount.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
|
|
@@ -18,27 +18,32 @@
|
|
|
18
18
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
|
+
// Forward declaration of `FiatMarketAccountKind` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::rncandle { enum class FiatMarketAccountKind; }
|
|
21
23
|
// Forward declaration of `Service` to properly resolve imports.
|
|
22
24
|
namespace margelo::nitro::rncandle { enum class Service; }
|
|
23
25
|
|
|
24
26
|
#include <string>
|
|
27
|
+
#include "FiatMarketAccountKind.hpp"
|
|
25
28
|
#include "Service.hpp"
|
|
26
29
|
|
|
27
30
|
namespace margelo::nitro::rncandle {
|
|
28
31
|
|
|
29
32
|
/**
|
|
30
|
-
* A struct which can be represented as a JavaScript object (
|
|
33
|
+
* A struct which can be represented as a JavaScript object (MarketAccount).
|
|
31
34
|
*/
|
|
32
|
-
struct
|
|
35
|
+
struct MarketAccount {
|
|
33
36
|
public:
|
|
34
37
|
std::string assetKind SWIFT_PRIVATE;
|
|
35
38
|
std::string serviceAccountID SWIFT_PRIVATE;
|
|
39
|
+
FiatMarketAccountKind accountKind SWIFT_PRIVATE;
|
|
40
|
+
std::string nickname SWIFT_PRIVATE;
|
|
36
41
|
std::string linkedAccountID SWIFT_PRIVATE;
|
|
37
42
|
Service service SWIFT_PRIVATE;
|
|
38
43
|
|
|
39
44
|
public:
|
|
40
|
-
|
|
41
|
-
explicit
|
|
45
|
+
MarketAccount() = default;
|
|
46
|
+
explicit MarketAccount(std::string 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) {}
|
|
42
47
|
};
|
|
43
48
|
|
|
44
49
|
} // namespace margelo::nitro::rncandle
|
|
@@ -47,22 +52,26 @@ namespace margelo::nitro {
|
|
|
47
52
|
|
|
48
53
|
using namespace margelo::nitro::rncandle;
|
|
49
54
|
|
|
50
|
-
// C++
|
|
55
|
+
// C++ MarketAccount <> JS MarketAccount (object)
|
|
51
56
|
template <>
|
|
52
|
-
struct JSIConverter<
|
|
53
|
-
static inline
|
|
57
|
+
struct JSIConverter<MarketAccount> final {
|
|
58
|
+
static inline MarketAccount fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
59
|
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
-
return
|
|
60
|
+
return MarketAccount(
|
|
56
61
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
|
|
57
62
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceAccountID")),
|
|
63
|
+
JSIConverter<FiatMarketAccountKind>::fromJSI(runtime, obj.getProperty(runtime, "accountKind")),
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "nickname")),
|
|
58
65
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID")),
|
|
59
66
|
JSIConverter<Service>::fromJSI(runtime, obj.getProperty(runtime, "service"))
|
|
60
67
|
);
|
|
61
68
|
}
|
|
62
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const MarketAccount& arg) {
|
|
63
70
|
jsi::Object obj(runtime);
|
|
64
71
|
obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
|
|
65
72
|
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, "nickname", JSIConverter<std::string>::toJSI(runtime, arg.nickname));
|
|
66
75
|
obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
|
|
67
76
|
obj.setProperty(runtime, "service", JSIConverter<Service>::toJSI(runtime, arg.service));
|
|
68
77
|
return obj;
|
|
@@ -74,6 +83,8 @@ namespace margelo::nitro {
|
|
|
74
83
|
jsi::Object obj = value.getObject(runtime);
|
|
75
84
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
|
|
76
85
|
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<std::string>::canConvert(runtime, obj.getProperty(runtime, "nickname"))) return false;
|
|
77
88
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
|
|
78
89
|
if (!JSIConverter<Service>::canConvert(runtime, obj.getProperty(runtime, "service"))) return false;
|
|
79
90
|
return true;
|