react-native-nitro-ark 0.0.108 → 0.0.109
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/cpp/NitroArk.hpp +110 -0
- package/cpp/generated/ark_cxx.h +82 -0
- package/lib/module/index.js +38 -5
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +40 -0
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/ExitBlockRefResult.hpp +87 -0
- package/nitrogen/generated/shared/c++/ExitProgressStatusResult.hpp +8 -2
- package/nitrogen/generated/shared/c++/ExitStateDetailsResult.hpp +126 -0
- package/nitrogen/generated/shared/c++/ExitStatusResult.hpp +12 -1
- package/nitrogen/generated/shared/c++/ExitTxOriginResult.hpp +98 -0
- package/nitrogen/generated/shared/c++/ExitTxResult.hpp +89 -0
- package/nitrogen/generated/shared/c++/ExitTxStatusResult.hpp +114 -0
- package/nitrogen/generated/shared/c++/ExitVtxoResult.hpp +12 -2
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +45 -0
- package/src/index.tsx +49 -7
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
29
|
#endif
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
// Forward declaration of `ExitStateDetailsResult` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitroark { struct ExitStateDetailsResult; }
|
|
32
33
|
|
|
33
34
|
#include <string>
|
|
35
|
+
#include "ExitStateDetailsResult.hpp"
|
|
34
36
|
#include <vector>
|
|
35
37
|
|
|
36
38
|
namespace margelo::nitro::nitroark {
|
|
@@ -43,14 +45,16 @@ namespace margelo::nitro::nitroark {
|
|
|
43
45
|
std::string vtxo_id SWIFT_PRIVATE;
|
|
44
46
|
double amount_sat SWIFT_PRIVATE;
|
|
45
47
|
std::string state SWIFT_PRIVATE;
|
|
48
|
+
ExitStateDetailsResult state_details SWIFT_PRIVATE;
|
|
46
49
|
std::vector<std::string> history SWIFT_PRIVATE;
|
|
50
|
+
std::vector<ExitStateDetailsResult> history_details SWIFT_PRIVATE;
|
|
47
51
|
std::vector<std::string> txids SWIFT_PRIVATE;
|
|
48
52
|
bool is_claimable SWIFT_PRIVATE;
|
|
49
53
|
bool is_initialized SWIFT_PRIVATE;
|
|
50
54
|
|
|
51
55
|
public:
|
|
52
56
|
ExitVtxoResult() = default;
|
|
53
|
-
explicit ExitVtxoResult(std::string vtxo_id, double amount_sat, std::string state, std::vector<std::string> history, std::vector<std::string> txids, bool is_claimable, bool is_initialized): vtxo_id(vtxo_id), amount_sat(amount_sat), state(state), history(history), txids(txids), is_claimable(is_claimable), is_initialized(is_initialized) {}
|
|
57
|
+
explicit ExitVtxoResult(std::string vtxo_id, double amount_sat, std::string state, ExitStateDetailsResult state_details, std::vector<std::string> history, std::vector<ExitStateDetailsResult> history_details, std::vector<std::string> txids, bool is_claimable, bool is_initialized): vtxo_id(vtxo_id), amount_sat(amount_sat), state(state), state_details(state_details), history(history), history_details(history_details), txids(txids), is_claimable(is_claimable), is_initialized(is_initialized) {}
|
|
54
58
|
|
|
55
59
|
public:
|
|
56
60
|
friend bool operator==(const ExitVtxoResult& lhs, const ExitVtxoResult& rhs) = default;
|
|
@@ -69,7 +73,9 @@ namespace margelo::nitro {
|
|
|
69
73
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_id"))),
|
|
70
74
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount_sat"))),
|
|
71
75
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state"))),
|
|
76
|
+
JSIConverter<margelo::nitro::nitroark::ExitStateDetailsResult>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state_details"))),
|
|
72
77
|
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history"))),
|
|
78
|
+
JSIConverter<std::vector<margelo::nitro::nitroark::ExitStateDetailsResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history_details"))),
|
|
73
79
|
JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txids"))),
|
|
74
80
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_claimable"))),
|
|
75
81
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_initialized")))
|
|
@@ -80,7 +86,9 @@ namespace margelo::nitro {
|
|
|
80
86
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "vtxo_id"), JSIConverter<std::string>::toJSI(runtime, arg.vtxo_id));
|
|
81
87
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "amount_sat"), JSIConverter<double>::toJSI(runtime, arg.amount_sat));
|
|
82
88
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "state"), JSIConverter<std::string>::toJSI(runtime, arg.state));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "state_details"), JSIConverter<margelo::nitro::nitroark::ExitStateDetailsResult>::toJSI(runtime, arg.state_details));
|
|
83
90
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "history"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.history));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "history_details"), JSIConverter<std::vector<margelo::nitro::nitroark::ExitStateDetailsResult>>::toJSI(runtime, arg.history_details));
|
|
84
92
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "txids"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.txids));
|
|
85
93
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "is_claimable"), JSIConverter<bool>::toJSI(runtime, arg.is_claimable));
|
|
86
94
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "is_initialized"), JSIConverter<bool>::toJSI(runtime, arg.is_initialized));
|
|
@@ -97,7 +105,9 @@ namespace margelo::nitro {
|
|
|
97
105
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_id")))) return false;
|
|
98
106
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount_sat")))) return false;
|
|
99
107
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state")))) return false;
|
|
108
|
+
if (!JSIConverter<margelo::nitro::nitroark::ExitStateDetailsResult>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state_details")))) return false;
|
|
100
109
|
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history")))) return false;
|
|
110
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitroark::ExitStateDetailsResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history_details")))) return false;
|
|
101
111
|
if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txids")))) return false;
|
|
102
112
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_claimable")))) return false;
|
|
103
113
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_initialized")))) return false;
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -83,9 +83,50 @@ export interface BarkFeeEstimate {
|
|
|
83
83
|
vtxos_spent: string[];
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
export interface ExitBlockRefResult {
|
|
87
|
+
height: number;
|
|
88
|
+
hash: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ExitTxOriginResult {
|
|
92
|
+
kind: string;
|
|
93
|
+
confirmed_in?: ExitBlockRefResult;
|
|
94
|
+
fee_rate_sat_per_kvb?: number;
|
|
95
|
+
total_fee_sat?: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface ExitTxStatusResult {
|
|
99
|
+
kind: string;
|
|
100
|
+
txids?: string[];
|
|
101
|
+
min_fee_rate_sat_per_kvb?: number;
|
|
102
|
+
min_fee_sat?: number;
|
|
103
|
+
child_txid?: string;
|
|
104
|
+
origin?: ExitTxOriginResult;
|
|
105
|
+
block?: ExitBlockRefResult;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ExitTxResult {
|
|
109
|
+
txid: string;
|
|
110
|
+
status: ExitTxStatusResult;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface ExitStateDetailsResult {
|
|
114
|
+
kind: string;
|
|
115
|
+
tip_height: number;
|
|
116
|
+
transactions?: ExitTxResult[];
|
|
117
|
+
confirmed_block?: ExitBlockRefResult;
|
|
118
|
+
claimable_height?: number;
|
|
119
|
+
claimable_since?: ExitBlockRefResult;
|
|
120
|
+
last_scanned_block?: ExitBlockRefResult;
|
|
121
|
+
claim_txid?: string;
|
|
122
|
+
txid?: string;
|
|
123
|
+
block?: ExitBlockRefResult;
|
|
124
|
+
}
|
|
125
|
+
|
|
86
126
|
export interface ExitProgressStatusResult {
|
|
87
127
|
vtxo_id: string;
|
|
88
128
|
state: string;
|
|
129
|
+
state_details: ExitStateDetailsResult;
|
|
89
130
|
error?: string;
|
|
90
131
|
}
|
|
91
132
|
|
|
@@ -93,7 +134,9 @@ export interface ExitVtxoResult {
|
|
|
93
134
|
vtxo_id: string;
|
|
94
135
|
amount_sat: number;
|
|
95
136
|
state: string;
|
|
137
|
+
state_details: ExitStateDetailsResult;
|
|
96
138
|
history: string[];
|
|
139
|
+
history_details: ExitStateDetailsResult[];
|
|
97
140
|
txids: string[];
|
|
98
141
|
is_claimable: boolean;
|
|
99
142
|
is_initialized: boolean;
|
|
@@ -111,7 +154,9 @@ export interface ExitTransactionPackageResult {
|
|
|
111
154
|
export interface ExitStatusResult {
|
|
112
155
|
vtxo_id: string;
|
|
113
156
|
state: string;
|
|
157
|
+
state_details: ExitStateDetailsResult;
|
|
114
158
|
history: string[];
|
|
159
|
+
history_details: ExitStateDetailsResult[];
|
|
115
160
|
transactions: ExitTransactionPackageResult[];
|
|
116
161
|
}
|
|
117
162
|
|
package/src/index.tsx
CHANGED
|
@@ -10,6 +10,11 @@ import type {
|
|
|
10
10
|
ExitProgressStatusResult as NitroExitProgressStatusResult,
|
|
11
11
|
ExitVtxoResult as NitroExitVtxoResult,
|
|
12
12
|
ExitStatusResult as NitroExitStatusResult,
|
|
13
|
+
ExitBlockRefResult as NitroExitBlockRefResult,
|
|
14
|
+
ExitTxOriginResult as NitroExitTxOriginResult,
|
|
15
|
+
ExitTxStatusResult as NitroExitTxStatusResult,
|
|
16
|
+
ExitTxResult as NitroExitTxResult,
|
|
17
|
+
ExitStateDetailsResult as NitroExitStateDetailsResult,
|
|
13
18
|
ExitTransactionPackageResult as NitroExitTransactionPackageResult,
|
|
14
19
|
LightningSendResult,
|
|
15
20
|
OnchainPaymentResult,
|
|
@@ -48,6 +53,12 @@ export type ExitProgressState =
|
|
|
48
53
|
| 'ClaimInProgress'
|
|
49
54
|
| 'Claimed';
|
|
50
55
|
|
|
56
|
+
export type BlockRef = NitroExitBlockRefResult;
|
|
57
|
+
export type ExitTxOrigin = NitroExitTxOriginResult;
|
|
58
|
+
export type ExitTxStatus = NitroExitTxStatusResult;
|
|
59
|
+
export type ExitTx = NitroExitTxResult;
|
|
60
|
+
export type ExitStateDetails = NitroExitStateDetailsResult;
|
|
61
|
+
|
|
51
62
|
export type ExitProgressStatusResult = Omit<
|
|
52
63
|
NitroExitProgressStatusResult,
|
|
53
64
|
'state'
|
|
@@ -101,10 +112,37 @@ export type BarkNotificationEvent = Omit<
|
|
|
101
112
|
movement?: BarkMovement;
|
|
102
113
|
};
|
|
103
114
|
|
|
104
|
-
// Create the hybrid object instance
|
|
105
115
|
export const NitroArkHybridObject =
|
|
106
116
|
NitroModules.createHybridObject<NitroArk>('NitroArk');
|
|
107
117
|
|
|
118
|
+
function enrichExitProgressStatus(
|
|
119
|
+
result: NitroExitProgressStatusResult
|
|
120
|
+
): ExitProgressStatusResult {
|
|
121
|
+
const { state, ...rest } = result;
|
|
122
|
+
return {
|
|
123
|
+
...rest,
|
|
124
|
+
state: state as ExitProgressState,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function enrichExitVtxo(result: NitroExitVtxoResult): ExitVtxoResult {
|
|
129
|
+
const { state, history: stateHistory, ...rest } = result;
|
|
130
|
+
return {
|
|
131
|
+
...rest,
|
|
132
|
+
state: state as ExitProgressState,
|
|
133
|
+
history: stateHistory as ExitProgressState[],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function enrichExitStatus(result: NitroExitStatusResult): ExitStatusResult {
|
|
138
|
+
const { state, history: stateHistory, ...rest } = result;
|
|
139
|
+
return {
|
|
140
|
+
...rest,
|
|
141
|
+
state: state as ExitProgressState,
|
|
142
|
+
history: stateHistory as ExitProgressState[],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
108
146
|
// --- Management ---
|
|
109
147
|
|
|
110
148
|
/**
|
|
@@ -267,9 +305,9 @@ export function syncNoProgress(): Promise<void> {
|
|
|
267
305
|
export function progressExits(
|
|
268
306
|
feeRateSatPerKvb?: number
|
|
269
307
|
): Promise<ExitProgressStatusResult[]> {
|
|
270
|
-
return NitroArkHybridObject.progressExits(feeRateSatPerKvb)
|
|
271
|
-
|
|
272
|
-
|
|
308
|
+
return NitroArkHybridObject.progressExits(feeRateSatPerKvb).then((results) =>
|
|
309
|
+
results.map(enrichExitProgressStatus)
|
|
310
|
+
);
|
|
273
311
|
}
|
|
274
312
|
|
|
275
313
|
/**
|
|
@@ -277,7 +315,9 @@ export function progressExits(
|
|
|
277
315
|
* @returns A promise resolving to simplified exit entries.
|
|
278
316
|
*/
|
|
279
317
|
export function getExitVtxos(): Promise<ExitVtxoResult[]> {
|
|
280
|
-
return NitroArkHybridObject.getExitVtxos()
|
|
318
|
+
return NitroArkHybridObject.getExitVtxos().then((results) =>
|
|
319
|
+
results.map(enrichExitVtxo)
|
|
320
|
+
);
|
|
281
321
|
}
|
|
282
322
|
|
|
283
323
|
/**
|
|
@@ -285,7 +325,9 @@ export function getExitVtxos(): Promise<ExitVtxoResult[]> {
|
|
|
285
325
|
* @returns A promise resolving to claimable exit entries.
|
|
286
326
|
*/
|
|
287
327
|
export function listClaimable(): Promise<ExitVtxoResult[]> {
|
|
288
|
-
return NitroArkHybridObject.listClaimable()
|
|
328
|
+
return NitroArkHybridObject.listClaimable().then((results) =>
|
|
329
|
+
results.map(enrichExitVtxo)
|
|
330
|
+
);
|
|
289
331
|
}
|
|
290
332
|
|
|
291
333
|
/**
|
|
@@ -304,7 +346,7 @@ export function getExitStatus(
|
|
|
304
346
|
vtxoId,
|
|
305
347
|
includeHistory,
|
|
306
348
|
includeTransactions
|
|
307
|
-
)
|
|
349
|
+
).then((result) => (result ? enrichExitStatus(result) : undefined));
|
|
308
350
|
}
|
|
309
351
|
|
|
310
352
|
/**
|