react-native-nitro-ark 0.0.78 → 0.0.80
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/android/src/main/jniLibs/arm64-v8a/libcxxbridge1.a +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libcxxbridge1.a +0 -0
- package/android/src/main/jniLibs/x86_64/libcxxbridge1.a +0 -0
- package/cpp/NitroArk.hpp +82 -35
- package/cpp/generated/ark_cxx.h +20 -41
- package/lib/module/index.js +31 -8
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +15 -23
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +32 -11
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/BarkArkInfo.hpp +1 -5
- package/nitrogen/generated/shared/c++/BarkMovementDestination.hpp +5 -1
- package/nitrogen/generated/shared/c++/BoardResult.hpp +6 -8
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +4 -2
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +12 -14
- package/nitrogen/generated/shared/c++/LightningSendResult.hpp +97 -0
- package/nitrogen/generated/shared/c++/OffchainBalanceResult.hpp +3 -8
- package/package.json +4 -4
- package/src/NitroArk.nitro.ts +18 -25
- package/src/index.tsx +52 -16
- package/nitrogen/generated/shared/c++/Bolt11PaymentResult.hpp +0 -85
- package/nitrogen/generated/shared/c++/Bolt12PaymentResult.hpp +0 -85
- package/nitrogen/generated/shared/c++/LightningReceiveBalance.hpp +0 -79
- package/nitrogen/generated/shared/c++/LnurlPaymentResult.hpp +0 -89
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NitroArk, BarkCreateOpts, BarkArkInfo, Bolt11Invoice, BarkSendManyOutput, ArkoorPaymentResult,
|
|
1
|
+
import type { NitroArk, BarkCreateOpts, BarkArkInfo, Bolt11Invoice, BarkSendManyOutput, ArkoorPaymentResult, LightningSendResult, OnchainPaymentResult, OffchainBalanceResult, OnchainBalanceResult, NewAddressResult, KeyPairResult, LightningReceive, BarkMovement as NitroBarkMovement, BarkMovementDestination as NitroBarkMovementDestination, BoardResult, RoundStatus } from './NitroArk.nitro';
|
|
2
2
|
export type BarkVtxo = {
|
|
3
3
|
amount: number;
|
|
4
4
|
expiry_height: number;
|
|
@@ -9,8 +9,13 @@ export type BarkVtxo = {
|
|
|
9
9
|
state: 'Spendable' | 'Spent' | 'Locked' | 'unknown';
|
|
10
10
|
};
|
|
11
11
|
export type MovementStatus = 'pending' | 'finished' | 'failed' | 'cancelled';
|
|
12
|
+
export type BarkMovementDestination = NitroBarkMovementDestination & {
|
|
13
|
+
payment_method: 'ark' | 'bitcoin' | 'output-script' | 'invoice' | 'offer' | 'lightning-address' | 'custom';
|
|
14
|
+
};
|
|
12
15
|
export type BarkMovement = NitroBarkMovement & {
|
|
13
16
|
status: MovementStatus;
|
|
17
|
+
sent_to: BarkMovementDestination[];
|
|
18
|
+
received_on: BarkMovementDestination[];
|
|
14
19
|
};
|
|
15
20
|
export declare const NitroArkHybridObject: NitroArk;
|
|
16
21
|
/**
|
|
@@ -38,7 +43,11 @@ export declare function loadWallet(datadir: string, config: BarkCreateOpts): Pro
|
|
|
38
43
|
* @returns A promise that resolves on success or rejects on error.
|
|
39
44
|
*/
|
|
40
45
|
export declare function closeWallet(): Promise<void>;
|
|
41
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Refreshes the server state.
|
|
48
|
+
* @returns A promise that resolves on success or rejects on error.
|
|
49
|
+
*/
|
|
50
|
+
export declare function refreshServer(): Promise<void>;
|
|
42
51
|
/**
|
|
43
52
|
* Checks if a wallet is currently loaded.
|
|
44
53
|
* @returns A promise resolving to true if a wallet is loaded, false otherwise.
|
|
@@ -76,6 +85,11 @@ export declare function sync(): Promise<void>;
|
|
|
76
85
|
* @returns A promise that resolves on success.
|
|
77
86
|
*/
|
|
78
87
|
export declare function syncExits(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Synchronizes pending rounds.
|
|
90
|
+
* @returns A promise that resolves on success.
|
|
91
|
+
*/
|
|
92
|
+
export declare function syncPendingRounds(): Promise<void>;
|
|
79
93
|
/**
|
|
80
94
|
* Gets the Ark-specific information.
|
|
81
95
|
* @returns A promise resolving to the BarkArkInfo object.
|
|
@@ -141,10 +155,10 @@ export declare function deriveKeypairFromMnemonic(mnemonic: string, network: str
|
|
|
141
155
|
*/
|
|
142
156
|
export declare function verifyMessage(message: string, signature: string, publicKey: string): Promise<boolean>;
|
|
143
157
|
/**
|
|
144
|
-
* Gets a paginated list of wallet
|
|
158
|
+
* Gets a paginated list of wallet history (balance changes).
|
|
145
159
|
* @returns A promise resolving to an array of BarkMovement objects.
|
|
146
160
|
*/
|
|
147
|
-
export declare function
|
|
161
|
+
export declare function history(): Promise<BarkMovement[]>;
|
|
148
162
|
/**
|
|
149
163
|
* Gets the list of VTXOs as a JSON string for the loaded wallet.
|
|
150
164
|
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
@@ -223,6 +237,13 @@ export declare function bolt11Invoice(amountMsat: number): Promise<Bolt11Invoice
|
|
|
223
237
|
* @returns A promise resolving to the Lightning receive status.
|
|
224
238
|
*/
|
|
225
239
|
export declare function lightningReceiveStatus(paymentHash: string): Promise<LightningReceive | undefined>;
|
|
240
|
+
/**
|
|
241
|
+
* Checks if a Lightning payment has been received and returns the preimage if available.
|
|
242
|
+
* @param paymentHash The payment hash of the Lightning payment.
|
|
243
|
+
* @param wait Whether to wait for the payment to be received.
|
|
244
|
+
* @returns A promise resolving to the preimage string if payment received, or null if not.
|
|
245
|
+
*/
|
|
246
|
+
export declare function checkLightningPayment(paymentHash: string, wait: boolean): Promise<string | null>;
|
|
226
247
|
/**
|
|
227
248
|
* Attempts to claim a Lightning payment, optionally using a claim token.
|
|
228
249
|
* @param paymentHash The payment hash of the Lightning payment.
|
|
@@ -241,24 +262,24 @@ export declare function tryClaimAllLightningReceives(wait: boolean): Promise<voi
|
|
|
241
262
|
* Pays a Bolt11 Lightning invoice.
|
|
242
263
|
* @param destination The Lightning invoice.
|
|
243
264
|
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
244
|
-
* @returns A promise resolving to a
|
|
265
|
+
* @returns A promise resolving to a LightningSendResult object
|
|
245
266
|
*/
|
|
246
|
-
export declare function payLightningInvoice(destination: string, amountSat?: number): Promise<
|
|
267
|
+
export declare function payLightningInvoice(destination: string, amountSat?: number): Promise<LightningSendResult>;
|
|
247
268
|
/**
|
|
248
269
|
* Sends a payment to a Bolt12 offer.
|
|
249
270
|
* @param offer The Bolt12 offer.
|
|
250
271
|
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
251
|
-
* @returns A promise resolving to a
|
|
272
|
+
* @returns A promise resolving to a LightningSendResult object
|
|
252
273
|
*/
|
|
253
|
-
export declare function payLightningOffer(offer: string, amountSat?: number): Promise<
|
|
274
|
+
export declare function payLightningOffer(offer: string, amountSat?: number): Promise<LightningSendResult>;
|
|
254
275
|
/**
|
|
255
276
|
* Sends a payment to a Lightning Address.
|
|
256
277
|
* @param addr The Lightning Address.
|
|
257
278
|
* @param amountSat The amount in satoshis to send.
|
|
258
279
|
* @param comment An optional comment.
|
|
259
|
-
* @returns A promise resolving to a
|
|
280
|
+
* @returns A promise resolving to a LightningSendResult object
|
|
260
281
|
*/
|
|
261
|
-
export declare function payLightningAddress(addr: string, amountSat: number, comment: string): Promise<
|
|
282
|
+
export declare function payLightningAddress(addr: string, amountSat: number, comment: string): Promise<LightningSendResult>;
|
|
262
283
|
/**
|
|
263
284
|
* Boards a specific amount from the onchain wallet into Ark.
|
|
264
285
|
* @param amountSat The amount in satoshis to board.
|
|
@@ -303,5 +324,5 @@ export declare function offboardSpecific(vtxoIds: string[], destinationAddress:
|
|
|
303
324
|
* @returns A promise resolving to the round status.
|
|
304
325
|
*/
|
|
305
326
|
export declare function offboardAll(destinationAddress: string): Promise<RoundStatus>;
|
|
306
|
-
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, Bolt11Invoice, BoardResult, BarkSendManyOutput, ArkoorPaymentResult,
|
|
327
|
+
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, Bolt11Invoice, BoardResult, BarkSendManyOutput, ArkoorPaymentResult, LightningSendResult, OnchainPaymentResult, PaymentTypes, OffchainBalanceResult, OnchainBalanceResult, NewAddressResult, KeyPairResult, LightningReceive, LightningReceiveBalance, RoundStatus, } from './NitroArk.nitro';
|
|
307
328
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,YAAY,IAAI,iBAAiB,EACjC,uBAAuB,IAAI,4BAA4B,EACvD,WAAW,EACX,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC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B,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EAAE,EACjB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAE5E;AAGD,YAAY,EACV,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,GACZ,MAAM,kBAAkB,CAAC"}
|
|
@@ -42,12 +42,11 @@ namespace margelo::nitro::nitroark {
|
|
|
42
42
|
double vtxo_expiry_delta SWIFT_PRIVATE;
|
|
43
43
|
double htlc_send_expiry_delta SWIFT_PRIVATE;
|
|
44
44
|
double max_vtxo_amount SWIFT_PRIVATE;
|
|
45
|
-
double max_arkoor_depth SWIFT_PRIVATE;
|
|
46
45
|
double required_board_confirmations SWIFT_PRIVATE;
|
|
47
46
|
|
|
48
47
|
public:
|
|
49
48
|
BarkArkInfo() = default;
|
|
50
|
-
explicit BarkArkInfo(std::string network, std::string server_pubkey, double round_interval, double nb_round_nonces, double vtxo_exit_delta, double vtxo_expiry_delta, double htlc_send_expiry_delta, double max_vtxo_amount, double
|
|
49
|
+
explicit BarkArkInfo(std::string network, std::string server_pubkey, double round_interval, double nb_round_nonces, double vtxo_exit_delta, double vtxo_expiry_delta, double htlc_send_expiry_delta, double max_vtxo_amount, double required_board_confirmations): network(network), server_pubkey(server_pubkey), round_interval(round_interval), nb_round_nonces(nb_round_nonces), vtxo_exit_delta(vtxo_exit_delta), vtxo_expiry_delta(vtxo_expiry_delta), htlc_send_expiry_delta(htlc_send_expiry_delta), max_vtxo_amount(max_vtxo_amount), required_board_confirmations(required_board_confirmations) {}
|
|
51
50
|
};
|
|
52
51
|
|
|
53
52
|
} // namespace margelo::nitro::nitroark
|
|
@@ -68,7 +67,6 @@ namespace margelo::nitro {
|
|
|
68
67
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "vtxo_expiry_delta")),
|
|
69
68
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "htlc_send_expiry_delta")),
|
|
70
69
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "max_vtxo_amount")),
|
|
71
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "max_arkoor_depth")),
|
|
72
70
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "required_board_confirmations"))
|
|
73
71
|
);
|
|
74
72
|
}
|
|
@@ -82,7 +80,6 @@ namespace margelo::nitro {
|
|
|
82
80
|
obj.setProperty(runtime, "vtxo_expiry_delta", JSIConverter<double>::toJSI(runtime, arg.vtxo_expiry_delta));
|
|
83
81
|
obj.setProperty(runtime, "htlc_send_expiry_delta", JSIConverter<double>::toJSI(runtime, arg.htlc_send_expiry_delta));
|
|
84
82
|
obj.setProperty(runtime, "max_vtxo_amount", JSIConverter<double>::toJSI(runtime, arg.max_vtxo_amount));
|
|
85
|
-
obj.setProperty(runtime, "max_arkoor_depth", JSIConverter<double>::toJSI(runtime, arg.max_arkoor_depth));
|
|
86
83
|
obj.setProperty(runtime, "required_board_confirmations", JSIConverter<double>::toJSI(runtime, arg.required_board_confirmations));
|
|
87
84
|
return obj;
|
|
88
85
|
}
|
|
@@ -102,7 +99,6 @@ namespace margelo::nitro {
|
|
|
102
99
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "vtxo_expiry_delta"))) return false;
|
|
103
100
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "htlc_send_expiry_delta"))) return false;
|
|
104
101
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "max_vtxo_amount"))) return false;
|
|
105
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "max_arkoor_depth"))) return false;
|
|
106
102
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "required_board_confirmations"))) return false;
|
|
107
103
|
return true;
|
|
108
104
|
}
|
|
@@ -35,11 +35,12 @@ namespace margelo::nitro::nitroark {
|
|
|
35
35
|
struct BarkMovementDestination {
|
|
36
36
|
public:
|
|
37
37
|
std::string destination SWIFT_PRIVATE;
|
|
38
|
+
std::string payment_method SWIFT_PRIVATE;
|
|
38
39
|
double amount_sat SWIFT_PRIVATE;
|
|
39
40
|
|
|
40
41
|
public:
|
|
41
42
|
BarkMovementDestination() = default;
|
|
42
|
-
explicit BarkMovementDestination(std::string destination, double amount_sat): destination(destination), amount_sat(amount_sat) {}
|
|
43
|
+
explicit BarkMovementDestination(std::string destination, std::string payment_method, double amount_sat): destination(destination), payment_method(payment_method), amount_sat(amount_sat) {}
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
} // namespace margelo::nitro::nitroark
|
|
@@ -53,12 +54,14 @@ namespace margelo::nitro {
|
|
|
53
54
|
jsi::Object obj = arg.asObject(runtime);
|
|
54
55
|
return margelo::nitro::nitroark::BarkMovementDestination(
|
|
55
56
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "destination")),
|
|
57
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "payment_method")),
|
|
56
58
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "amount_sat"))
|
|
57
59
|
);
|
|
58
60
|
}
|
|
59
61
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::BarkMovementDestination& arg) {
|
|
60
62
|
jsi::Object obj(runtime);
|
|
61
63
|
obj.setProperty(runtime, "destination", JSIConverter<std::string>::toJSI(runtime, arg.destination));
|
|
64
|
+
obj.setProperty(runtime, "payment_method", JSIConverter<std::string>::toJSI(runtime, arg.payment_method));
|
|
62
65
|
obj.setProperty(runtime, "amount_sat", JSIConverter<double>::toJSI(runtime, arg.amount_sat));
|
|
63
66
|
return obj;
|
|
64
67
|
}
|
|
@@ -71,6 +74,7 @@ namespace margelo::nitro {
|
|
|
71
74
|
return false;
|
|
72
75
|
}
|
|
73
76
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "destination"))) return false;
|
|
77
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "payment_method"))) return false;
|
|
74
78
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "amount_sat"))) return false;
|
|
75
79
|
return true;
|
|
76
80
|
}
|
|
@@ -23,11 +23,9 @@
|
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
namespace margelo::nitro::nitroark { struct BarkVtxo; }
|
|
26
|
+
|
|
28
27
|
|
|
29
28
|
#include <string>
|
|
30
|
-
#include "BarkVtxo.hpp"
|
|
31
29
|
#include <vector>
|
|
32
30
|
|
|
33
31
|
namespace margelo::nitro::nitroark {
|
|
@@ -38,11 +36,11 @@ namespace margelo::nitro::nitroark {
|
|
|
38
36
|
struct BoardResult {
|
|
39
37
|
public:
|
|
40
38
|
std::string funding_txid SWIFT_PRIVATE;
|
|
41
|
-
std::vector<
|
|
39
|
+
std::vector<std::string> vtxos SWIFT_PRIVATE;
|
|
42
40
|
|
|
43
41
|
public:
|
|
44
42
|
BoardResult() = default;
|
|
45
|
-
explicit BoardResult(std::string funding_txid, std::vector<
|
|
43
|
+
explicit BoardResult(std::string funding_txid, std::vector<std::string> vtxos): funding_txid(funding_txid), vtxos(vtxos) {}
|
|
46
44
|
};
|
|
47
45
|
|
|
48
46
|
} // namespace margelo::nitro::nitroark
|
|
@@ -56,13 +54,13 @@ namespace margelo::nitro {
|
|
|
56
54
|
jsi::Object obj = arg.asObject(runtime);
|
|
57
55
|
return margelo::nitro::nitroark::BoardResult(
|
|
58
56
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "funding_txid")),
|
|
59
|
-
JSIConverter<std::vector<
|
|
57
|
+
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "vtxos"))
|
|
60
58
|
);
|
|
61
59
|
}
|
|
62
60
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::BoardResult& arg) {
|
|
63
61
|
jsi::Object obj(runtime);
|
|
64
62
|
obj.setProperty(runtime, "funding_txid", JSIConverter<std::string>::toJSI(runtime, arg.funding_txid));
|
|
65
|
-
obj.setProperty(runtime, "vtxos", JSIConverter<std::vector<
|
|
63
|
+
obj.setProperty(runtime, "vtxos", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.vtxos));
|
|
66
64
|
return obj;
|
|
67
65
|
}
|
|
68
66
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -74,7 +72,7 @@ namespace margelo::nitro {
|
|
|
74
72
|
return false;
|
|
75
73
|
}
|
|
76
74
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "funding_txid"))) return false;
|
|
77
|
-
if (!JSIConverter<std::vector<
|
|
75
|
+
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "vtxos"))) return false;
|
|
78
76
|
return true;
|
|
79
77
|
}
|
|
80
78
|
};
|
|
@@ -19,13 +19,14 @@ namespace margelo::nitro::nitroark {
|
|
|
19
19
|
prototype.registerHybridMethod("loadWallet", &HybridNitroArkSpec::loadWallet);
|
|
20
20
|
prototype.registerHybridMethod("isWalletLoaded", &HybridNitroArkSpec::isWalletLoaded);
|
|
21
21
|
prototype.registerHybridMethod("closeWallet", &HybridNitroArkSpec::closeWallet);
|
|
22
|
-
prototype.registerHybridMethod("
|
|
22
|
+
prototype.registerHybridMethod("refreshServer", &HybridNitroArkSpec::refreshServer);
|
|
23
23
|
prototype.registerHybridMethod("syncPendingBoards", &HybridNitroArkSpec::syncPendingBoards);
|
|
24
24
|
prototype.registerHybridMethod("maintenance", &HybridNitroArkSpec::maintenance);
|
|
25
25
|
prototype.registerHybridMethod("maintenanceWithOnchain", &HybridNitroArkSpec::maintenanceWithOnchain);
|
|
26
26
|
prototype.registerHybridMethod("maintenanceRefresh", &HybridNitroArkSpec::maintenanceRefresh);
|
|
27
27
|
prototype.registerHybridMethod("sync", &HybridNitroArkSpec::sync);
|
|
28
28
|
prototype.registerHybridMethod("syncExits", &HybridNitroArkSpec::syncExits);
|
|
29
|
+
prototype.registerHybridMethod("syncPendingRounds", &HybridNitroArkSpec::syncPendingRounds);
|
|
29
30
|
prototype.registerHybridMethod("getArkInfo", &HybridNitroArkSpec::getArkInfo);
|
|
30
31
|
prototype.registerHybridMethod("offchainBalance", &HybridNitroArkSpec::offchainBalance);
|
|
31
32
|
prototype.registerHybridMethod("deriveStoreNextKeypair", &HybridNitroArkSpec::deriveStoreNextKeypair);
|
|
@@ -36,7 +37,7 @@ namespace margelo::nitro::nitroark {
|
|
|
36
37
|
prototype.registerHybridMethod("signMesssageWithMnemonic", &HybridNitroArkSpec::signMesssageWithMnemonic);
|
|
37
38
|
prototype.registerHybridMethod("deriveKeypairFromMnemonic", &HybridNitroArkSpec::deriveKeypairFromMnemonic);
|
|
38
39
|
prototype.registerHybridMethod("verifyMessage", &HybridNitroArkSpec::verifyMessage);
|
|
39
|
-
prototype.registerHybridMethod("
|
|
40
|
+
prototype.registerHybridMethod("history", &HybridNitroArkSpec::history);
|
|
40
41
|
prototype.registerHybridMethod("vtxos", &HybridNitroArkSpec::vtxos);
|
|
41
42
|
prototype.registerHybridMethod("getFirstExpiringVtxoBlockheight", &HybridNitroArkSpec::getFirstExpiringVtxoBlockheight);
|
|
42
43
|
prototype.registerHybridMethod("getNextRequiredRefreshBlockheight", &HybridNitroArkSpec::getNextRequiredRefreshBlockheight);
|
|
@@ -59,6 +60,7 @@ namespace margelo::nitro::nitroark {
|
|
|
59
60
|
prototype.registerHybridMethod("sendRoundOnchainPayment", &HybridNitroArkSpec::sendRoundOnchainPayment);
|
|
60
61
|
prototype.registerHybridMethod("bolt11Invoice", &HybridNitroArkSpec::bolt11Invoice);
|
|
61
62
|
prototype.registerHybridMethod("lightningReceiveStatus", &HybridNitroArkSpec::lightningReceiveStatus);
|
|
63
|
+
prototype.registerHybridMethod("checkLightningPayment", &HybridNitroArkSpec::checkLightningPayment);
|
|
62
64
|
prototype.registerHybridMethod("tryClaimLightningReceive", &HybridNitroArkSpec::tryClaimLightningReceive);
|
|
63
65
|
prototype.registerHybridMethod("tryClaimAllLightningReceives", &HybridNitroArkSpec::tryClaimAllLightningReceives);
|
|
64
66
|
prototype.registerHybridMethod("offboardSpecific", &HybridNitroArkSpec::offboardSpecific);
|
|
@@ -37,12 +37,8 @@ namespace margelo::nitro::nitroark { struct BarkSendManyOutput; }
|
|
|
37
37
|
namespace margelo::nitro::nitroark { struct BoardResult; }
|
|
38
38
|
// Forward declaration of `ArkoorPaymentResult` to properly resolve imports.
|
|
39
39
|
namespace margelo::nitro::nitroark { struct ArkoorPaymentResult; }
|
|
40
|
-
// Forward declaration of `
|
|
41
|
-
namespace margelo::nitro::nitroark { struct
|
|
42
|
-
// Forward declaration of `Bolt12PaymentResult` to properly resolve imports.
|
|
43
|
-
namespace margelo::nitro::nitroark { struct Bolt12PaymentResult; }
|
|
44
|
-
// Forward declaration of `LnurlPaymentResult` to properly resolve imports.
|
|
45
|
-
namespace margelo::nitro::nitroark { struct LnurlPaymentResult; }
|
|
40
|
+
// Forward declaration of `LightningSendResult` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::nitroark { struct LightningSendResult; }
|
|
46
42
|
// Forward declaration of `RoundStatus` to properly resolve imports.
|
|
47
43
|
namespace margelo::nitro::nitroark { struct RoundStatus; }
|
|
48
44
|
// Forward declaration of `Bolt11Invoice` to properly resolve imports.
|
|
@@ -66,12 +62,12 @@ namespace margelo::nitro::nitroark { struct LightningReceive; }
|
|
|
66
62
|
#include "BarkSendManyOutput.hpp"
|
|
67
63
|
#include "BoardResult.hpp"
|
|
68
64
|
#include "ArkoorPaymentResult.hpp"
|
|
69
|
-
#include "
|
|
70
|
-
#include "Bolt12PaymentResult.hpp"
|
|
71
|
-
#include "LnurlPaymentResult.hpp"
|
|
65
|
+
#include "LightningSendResult.hpp"
|
|
72
66
|
#include "RoundStatus.hpp"
|
|
73
67
|
#include "Bolt11Invoice.hpp"
|
|
74
68
|
#include "LightningReceive.hpp"
|
|
69
|
+
#include <NitroModules/Null.hpp>
|
|
70
|
+
#include <variant>
|
|
75
71
|
|
|
76
72
|
namespace margelo::nitro::nitroark {
|
|
77
73
|
|
|
@@ -109,13 +105,14 @@ namespace margelo::nitro::nitroark {
|
|
|
109
105
|
virtual std::shared_ptr<Promise<void>> loadWallet(const std::string& datadir, const BarkCreateOpts& config) = 0;
|
|
110
106
|
virtual std::shared_ptr<Promise<bool>> isWalletLoaded() = 0;
|
|
111
107
|
virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
|
|
112
|
-
virtual std::shared_ptr<Promise<void>>
|
|
108
|
+
virtual std::shared_ptr<Promise<void>> refreshServer() = 0;
|
|
113
109
|
virtual std::shared_ptr<Promise<void>> syncPendingBoards() = 0;
|
|
114
110
|
virtual std::shared_ptr<Promise<void>> maintenance() = 0;
|
|
115
111
|
virtual std::shared_ptr<Promise<void>> maintenanceWithOnchain() = 0;
|
|
116
112
|
virtual std::shared_ptr<Promise<void>> maintenanceRefresh() = 0;
|
|
117
113
|
virtual std::shared_ptr<Promise<void>> sync() = 0;
|
|
118
114
|
virtual std::shared_ptr<Promise<void>> syncExits() = 0;
|
|
115
|
+
virtual std::shared_ptr<Promise<void>> syncPendingRounds() = 0;
|
|
119
116
|
virtual std::shared_ptr<Promise<BarkArkInfo>> getArkInfo() = 0;
|
|
120
117
|
virtual std::shared_ptr<Promise<OffchainBalanceResult>> offchainBalance() = 0;
|
|
121
118
|
virtual std::shared_ptr<Promise<KeyPairResult>> deriveStoreNextKeypair() = 0;
|
|
@@ -126,7 +123,7 @@ namespace margelo::nitro::nitroark {
|
|
|
126
123
|
virtual std::shared_ptr<Promise<std::string>> signMesssageWithMnemonic(const std::string& message, const std::string& mnemonic, const std::string& network, double index) = 0;
|
|
127
124
|
virtual std::shared_ptr<Promise<KeyPairResult>> deriveKeypairFromMnemonic(const std::string& mnemonic, const std::string& network, double index) = 0;
|
|
128
125
|
virtual std::shared_ptr<Promise<bool>> verifyMessage(const std::string& message, const std::string& signature, const std::string& publicKey) = 0;
|
|
129
|
-
virtual std::shared_ptr<Promise<std::vector<BarkMovement>>>
|
|
126
|
+
virtual std::shared_ptr<Promise<std::vector<BarkMovement>>> history() = 0;
|
|
130
127
|
virtual std::shared_ptr<Promise<std::vector<BarkVtxo>>> vtxos() = 0;
|
|
131
128
|
virtual std::shared_ptr<Promise<std::optional<double>>> getFirstExpiringVtxoBlockheight() = 0;
|
|
132
129
|
virtual std::shared_ptr<Promise<std::optional<double>>> getNextRequiredRefreshBlockheight() = 0;
|
|
@@ -143,12 +140,13 @@ namespace margelo::nitro::nitroark {
|
|
|
143
140
|
virtual std::shared_ptr<Promise<BoardResult>> boardAll() = 0;
|
|
144
141
|
virtual std::shared_ptr<Promise<void>> validateArkoorAddress(const std::string& address) = 0;
|
|
145
142
|
virtual std::shared_ptr<Promise<ArkoorPaymentResult>> sendArkoorPayment(const std::string& destination, double amountSat) = 0;
|
|
146
|
-
virtual std::shared_ptr<Promise<
|
|
147
|
-
virtual std::shared_ptr<Promise<
|
|
148
|
-
virtual std::shared_ptr<Promise<
|
|
143
|
+
virtual std::shared_ptr<Promise<LightningSendResult>> payLightningInvoice(const std::string& destination, std::optional<double> amountSat) = 0;
|
|
144
|
+
virtual std::shared_ptr<Promise<LightningSendResult>> payLightningOffer(const std::string& offer, std::optional<double> amountSat) = 0;
|
|
145
|
+
virtual std::shared_ptr<Promise<LightningSendResult>> payLightningAddress(const std::string& addr, double amountSat, const std::string& comment) = 0;
|
|
149
146
|
virtual std::shared_ptr<Promise<RoundStatus>> sendRoundOnchainPayment(const std::string& destination, double amountSat) = 0;
|
|
150
147
|
virtual std::shared_ptr<Promise<Bolt11Invoice>> bolt11Invoice(double amountMsat) = 0;
|
|
151
148
|
virtual std::shared_ptr<Promise<std::optional<LightningReceive>>> lightningReceiveStatus(const std::string& paymentHash) = 0;
|
|
149
|
+
virtual std::shared_ptr<Promise<std::variant<nitro::NullType, std::string>>> checkLightningPayment(const std::string& paymentHash, bool wait) = 0;
|
|
152
150
|
virtual std::shared_ptr<Promise<void>> tryClaimLightningReceive(const std::string& paymentHash, bool wait, const std::optional<std::string>& token) = 0;
|
|
153
151
|
virtual std::shared_ptr<Promise<void>> tryClaimAllLightningReceives(bool wait) = 0;
|
|
154
152
|
virtual std::shared_ptr<Promise<RoundStatus>> offboardSpecific(const std::vector<std::string>& vtxoIds, const std::string& destinationAddress) = 0;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// LightningSendResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `BarkVtxo` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitroark { struct BarkVtxo; }
|
|
28
|
+
|
|
29
|
+
#include <string>
|
|
30
|
+
#include "BarkVtxo.hpp"
|
|
31
|
+
#include <vector>
|
|
32
|
+
#include <NitroModules/Null.hpp>
|
|
33
|
+
#include <variant>
|
|
34
|
+
#include <optional>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::nitroark {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (LightningSendResult).
|
|
40
|
+
*/
|
|
41
|
+
struct LightningSendResult {
|
|
42
|
+
public:
|
|
43
|
+
std::string invoice SWIFT_PRIVATE;
|
|
44
|
+
double amount SWIFT_PRIVATE;
|
|
45
|
+
std::vector<BarkVtxo> htlc_vtxos SWIFT_PRIVATE;
|
|
46
|
+
double movement_id SWIFT_PRIVATE;
|
|
47
|
+
std::optional<std::variant<nitro::NullType, std::string>> preimage SWIFT_PRIVATE;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
LightningSendResult() = default;
|
|
51
|
+
explicit LightningSendResult(std::string invoice, double amount, std::vector<BarkVtxo> htlc_vtxos, double movement_id, std::optional<std::variant<nitro::NullType, std::string>> preimage): invoice(invoice), amount(amount), htlc_vtxos(htlc_vtxos), movement_id(movement_id), preimage(preimage) {}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::nitroark
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ LightningSendResult <> JS LightningSendResult (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::nitroark::LightningSendResult> final {
|
|
61
|
+
static inline margelo::nitro::nitroark::LightningSendResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::nitroark::LightningSendResult(
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "invoice")),
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "amount")),
|
|
66
|
+
JSIConverter<std::vector<margelo::nitro::nitroark::BarkVtxo>>::fromJSI(runtime, obj.getProperty(runtime, "htlc_vtxos")),
|
|
67
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "movement_id")),
|
|
68
|
+
JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "preimage"))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::LightningSendResult& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, "invoice", JSIConverter<std::string>::toJSI(runtime, arg.invoice));
|
|
74
|
+
obj.setProperty(runtime, "amount", JSIConverter<double>::toJSI(runtime, arg.amount));
|
|
75
|
+
obj.setProperty(runtime, "htlc_vtxos", JSIConverter<std::vector<margelo::nitro::nitroark::BarkVtxo>>::toJSI(runtime, arg.htlc_vtxos));
|
|
76
|
+
obj.setProperty(runtime, "movement_id", JSIConverter<double>::toJSI(runtime, arg.movement_id));
|
|
77
|
+
obj.setProperty(runtime, "preimage", JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.preimage));
|
|
78
|
+
return obj;
|
|
79
|
+
}
|
|
80
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
81
|
+
if (!value.isObject()) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
jsi::Object obj = value.getObject(runtime);
|
|
85
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "invoice"))) return false;
|
|
89
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "amount"))) return false;
|
|
90
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitroark::BarkVtxo>>::canConvert(runtime, obj.getProperty(runtime, "htlc_vtxos"))) return false;
|
|
91
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "movement_id"))) return false;
|
|
92
|
+
if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, "preimage"))) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro
|
|
@@ -23,10 +23,9 @@
|
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
|
-
// Forward declaration of `LightningReceiveBalance` to properly resolve imports.
|
|
27
|
-
namespace margelo::nitro::nitroark { struct LightningReceiveBalance; }
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
|
|
30
29
|
|
|
31
30
|
namespace margelo::nitro::nitroark {
|
|
32
31
|
|
|
@@ -37,14 +36,13 @@ namespace margelo::nitro::nitroark {
|
|
|
37
36
|
public:
|
|
38
37
|
double spendable SWIFT_PRIVATE;
|
|
39
38
|
double pending_lightning_send SWIFT_PRIVATE;
|
|
40
|
-
LightningReceiveBalance pending_lightning_receive SWIFT_PRIVATE;
|
|
41
39
|
double pending_in_round SWIFT_PRIVATE;
|
|
42
40
|
double pending_exit SWIFT_PRIVATE;
|
|
43
41
|
double pending_board SWIFT_PRIVATE;
|
|
44
42
|
|
|
45
43
|
public:
|
|
46
44
|
OffchainBalanceResult() = default;
|
|
47
|
-
explicit OffchainBalanceResult(double spendable, double pending_lightning_send,
|
|
45
|
+
explicit OffchainBalanceResult(double spendable, double pending_lightning_send, double pending_in_round, double pending_exit, double pending_board): spendable(spendable), pending_lightning_send(pending_lightning_send), pending_in_round(pending_in_round), pending_exit(pending_exit), pending_board(pending_board) {}
|
|
48
46
|
};
|
|
49
47
|
|
|
50
48
|
} // namespace margelo::nitro::nitroark
|
|
@@ -59,7 +57,6 @@ namespace margelo::nitro {
|
|
|
59
57
|
return margelo::nitro::nitroark::OffchainBalanceResult(
|
|
60
58
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "spendable")),
|
|
61
59
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_lightning_send")),
|
|
62
|
-
JSIConverter<margelo::nitro::nitroark::LightningReceiveBalance>::fromJSI(runtime, obj.getProperty(runtime, "pending_lightning_receive")),
|
|
63
60
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_in_round")),
|
|
64
61
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_exit")),
|
|
65
62
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_board"))
|
|
@@ -69,7 +66,6 @@ namespace margelo::nitro {
|
|
|
69
66
|
jsi::Object obj(runtime);
|
|
70
67
|
obj.setProperty(runtime, "spendable", JSIConverter<double>::toJSI(runtime, arg.spendable));
|
|
71
68
|
obj.setProperty(runtime, "pending_lightning_send", JSIConverter<double>::toJSI(runtime, arg.pending_lightning_send));
|
|
72
|
-
obj.setProperty(runtime, "pending_lightning_receive", JSIConverter<margelo::nitro::nitroark::LightningReceiveBalance>::toJSI(runtime, arg.pending_lightning_receive));
|
|
73
69
|
obj.setProperty(runtime, "pending_in_round", JSIConverter<double>::toJSI(runtime, arg.pending_in_round));
|
|
74
70
|
obj.setProperty(runtime, "pending_exit", JSIConverter<double>::toJSI(runtime, arg.pending_exit));
|
|
75
71
|
obj.setProperty(runtime, "pending_board", JSIConverter<double>::toJSI(runtime, arg.pending_board));
|
|
@@ -85,7 +81,6 @@ namespace margelo::nitro {
|
|
|
85
81
|
}
|
|
86
82
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "spendable"))) return false;
|
|
87
83
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_lightning_send"))) return false;
|
|
88
|
-
if (!JSIConverter<margelo::nitro::nitroark::LightningReceiveBalance>::canConvert(runtime, obj.getProperty(runtime, "pending_lightning_receive"))) return false;
|
|
89
84
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_in_round"))) return false;
|
|
90
85
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_exit"))) return false;
|
|
91
86
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_board"))) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-ark",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.80",
|
|
4
4
|
"description": "Pure C++ Nitro Modules for Ark client",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"eslint-config-prettier": "^10.1.1",
|
|
85
85
|
"eslint-plugin-prettier": "^5.2.3",
|
|
86
86
|
"jest": "^29.7.0",
|
|
87
|
-
"nitrogen": "^0.31.
|
|
87
|
+
"nitrogen": "^0.31.10",
|
|
88
88
|
"prettier": "^3.0.3",
|
|
89
89
|
"react": "19.1.0",
|
|
90
90
|
"react-native": "0.81.4",
|
|
91
91
|
"react-native-builder-bob": "^0.40.13",
|
|
92
|
-
"react-native-nitro-modules": "^0.31.
|
|
92
|
+
"react-native-nitro-modules": "^0.31.10",
|
|
93
93
|
"release-it": "^17.10.0",
|
|
94
94
|
"turbo": "^1.10.7",
|
|
95
95
|
"typescript": "^5.2.2"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"react": "*",
|
|
99
99
|
"react-native": "*",
|
|
100
|
-
"react-native-nitro-modules": "^0.31.
|
|
100
|
+
"react-native-nitro-modules": "^0.31.10"
|
|
101
101
|
},
|
|
102
102
|
"workspaces": [
|
|
103
103
|
"example"
|