react-native-nitro-ark 0.0.103 → 0.0.105

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.
@@ -76,6 +76,13 @@ export interface ArkoorPaymentResult {
76
76
  vtxos: BarkVtxo[];
77
77
  }
78
78
 
79
+ export interface BarkFeeEstimate {
80
+ gross_amount_sat: number; // u64
81
+ fee_sat: number; // u64
82
+ net_amount_sat: number; // u64
83
+ vtxos_spent: string[];
84
+ }
85
+
79
86
  export interface ExitProgressStatusResult {
80
87
  vtxo_id: string;
81
88
  state: string;
@@ -92,6 +99,22 @@ export interface ExitVtxoResult {
92
99
  is_initialized: boolean;
93
100
  }
94
101
 
102
+ export interface ExitTransactionPackageResult {
103
+ exit_txid: string;
104
+ exit_tx_hex: string;
105
+ child_txid: string;
106
+ child_tx_hex: string;
107
+ child_origin: string;
108
+ has_child: boolean;
109
+ }
110
+
111
+ export interface ExitStatusResult {
112
+ vtxo_id: string;
113
+ state: string;
114
+ history: string[];
115
+ transactions: ExitTransactionPackageResult[];
116
+ }
117
+
95
118
  export interface LightningSendResult {
96
119
  invoice: string;
97
120
  payment_hash: string;
@@ -210,9 +233,17 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
210
233
  maintenanceRefresh(): Promise<void>;
211
234
  sync(): Promise<void>;
212
235
  startExitForEntireWallet(): Promise<void>;
236
+ startExitForVtxos(vtxoIds: string[]): Promise<void>;
213
237
  syncExit(): Promise<void>;
238
+ syncNoProgress(): Promise<void>;
214
239
  progressExits(feeRateSatPerKvb?: number): Promise<ExitProgressStatusResult[]>;
215
240
  getExitVtxos(): Promise<ExitVtxoResult[]>;
241
+ listClaimable(): Promise<ExitVtxoResult[]>;
242
+ getExitStatus(
243
+ vtxoId: string,
244
+ includeHistory?: boolean,
245
+ includeTransactions?: boolean
246
+ ): Promise<ExitStatusResult | undefined>;
216
247
  hasPendingExits(): Promise<boolean>;
217
248
  pendingExitTotal(): Promise<number>;
218
249
  allClaimableAtHeight(): Promise<number | undefined>;
@@ -300,6 +331,7 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
300
331
  destination: string,
301
332
  amountSat: number
302
333
  ): Promise<ArkoorPaymentResult>;
334
+ estimateArkoorPaymentFee(amountSat: number): Promise<BarkFeeEstimate>;
303
335
  payLightningInvoice(
304
336
  destination: string,
305
337
  amountSat?: number
@@ -313,7 +345,12 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
313
345
  amountSat: number,
314
346
  comment: string
315
347
  ): Promise<LightningSendResult>;
348
+ estimateLightningSendFee(amountSat: number): Promise<BarkFeeEstimate>;
316
349
  sendOnchain(destination: string, amountSat: number): Promise<string>;
350
+ estimateSendOnchain(
351
+ destination: string,
352
+ amountSat: number
353
+ ): Promise<BarkFeeEstimate>;
317
354
 
318
355
  // --- Lightning Invoicing ---
319
356
  bolt11Invoice(
@@ -340,4 +377,5 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
340
377
  destinationAddress: string
341
378
  ): Promise<string>;
342
379
  offboardAll(destinationAddress: string): Promise<string>;
380
+ estimateOffboardAll(destinationAddress: string): Promise<BarkFeeEstimate>;
343
381
  }
package/src/index.tsx CHANGED
@@ -6,8 +6,11 @@ import type {
6
6
  Bolt11Invoice,
7
7
  BarkSendManyOutput,
8
8
  ArkoorPaymentResult,
9
+ BarkFeeEstimate,
9
10
  ExitProgressStatusResult as NitroExitProgressStatusResult,
10
11
  ExitVtxoResult as NitroExitVtxoResult,
12
+ ExitStatusResult as NitroExitStatusResult,
13
+ ExitTransactionPackageResult as NitroExitTransactionPackageResult,
11
14
  LightningSendResult,
12
15
  OnchainPaymentResult,
13
16
  OffchainBalanceResult,
@@ -57,6 +60,17 @@ export type ExitVtxoResult = Omit<NitroExitVtxoResult, 'state' | 'history'> & {
57
60
  history: ExitProgressState[];
58
61
  };
59
62
 
63
+ export type ExitTransactionPackageResult = NitroExitTransactionPackageResult;
64
+
65
+ export type ExitStatusResult = Omit<
66
+ NitroExitStatusResult,
67
+ 'state' | 'history'
68
+ > & {
69
+ state: ExitProgressState;
70
+ history: ExitProgressState[];
71
+ transactions: ExitTransactionPackageResult[];
72
+ };
73
+
60
74
  export type BarkMovementDestination = NitroBarkMovementDestination & {
61
75
  payment_method:
62
76
  | 'ark'
@@ -220,6 +234,15 @@ export function startExitForEntireWallet(): Promise<void> {
220
234
  return NitroArkHybridObject.startExitForEntireWallet();
221
235
  }
222
236
 
237
+ /**
238
+ * Starts unilateral exits for selected wallet VTXOs.
239
+ * @param vtxoIds VTXO IDs to exit.
240
+ * @returns A promise that resolves on success.
241
+ */
242
+ export function startExitForVtxos(vtxoIds: string[]): Promise<void> {
243
+ return NitroArkHybridObject.startExitForVtxos(vtxoIds);
244
+ }
245
+
223
246
  /**
224
247
  * Synchronizes the exit coordinator state.
225
248
  * @returns A promise that resolves on success.
@@ -228,6 +251,14 @@ export function syncExit(): Promise<void> {
228
251
  return NitroArkHybridObject.syncExit();
229
252
  }
230
253
 
254
+ /**
255
+ * Synchronizes tracked exits without advancing their state.
256
+ * @returns A promise that resolves on success.
257
+ */
258
+ export function syncNoProgress(): Promise<void> {
259
+ return NitroArkHybridObject.syncNoProgress();
260
+ }
261
+
231
262
  /**
232
263
  * Progresses tracked exits by one step.
233
264
  * @param feeRateSatPerKvb Optional fee rate override in sat/kvB.
@@ -249,6 +280,33 @@ export function getExitVtxos(): Promise<ExitVtxoResult[]> {
249
280
  return NitroArkHybridObject.getExitVtxos() as Promise<ExitVtxoResult[]>;
250
281
  }
251
282
 
283
+ /**
284
+ * Lists tracked unilateral exits that are claimable.
285
+ * @returns A promise resolving to claimable exit entries.
286
+ */
287
+ export function listClaimable(): Promise<ExitVtxoResult[]> {
288
+ return NitroArkHybridObject.listClaimable() as Promise<ExitVtxoResult[]>;
289
+ }
290
+
291
+ /**
292
+ * Gets the detailed unilateral exit status for a tracked VTXO.
293
+ * @param vtxoId Exit VTXO ID to inspect.
294
+ * @param includeHistory Whether to include the state transition history.
295
+ * @param includeTransactions Whether to include exit transaction packages as hex.
296
+ * @returns A promise resolving to the exit status, or undefined when the VTXO is not tracked as an exit.
297
+ */
298
+ export function getExitStatus(
299
+ vtxoId: string,
300
+ includeHistory?: boolean,
301
+ includeTransactions?: boolean
302
+ ): Promise<ExitStatusResult | undefined> {
303
+ return NitroArkHybridObject.getExitStatus(
304
+ vtxoId,
305
+ includeHistory,
306
+ includeTransactions
307
+ ) as Promise<ExitStatusResult | undefined>;
308
+ }
309
+
252
310
  /**
253
311
  * Checks whether the wallet has exits that are still pending.
254
312
  * @returns A promise resolving to true when any tracked exit is not yet claimable.
@@ -723,6 +781,17 @@ export function payLightningAddress(
723
781
  return NitroArkHybridObject.payLightningAddress(addr, amountSat, comment);
724
782
  }
725
783
 
784
+ /**
785
+ * Estimates the fee for a Lightning send.
786
+ * @param amountSat The amount in satoshis to send.
787
+ * @returns A promise resolving to the fee estimate.
788
+ */
789
+ export function estimateLightningSendFee(
790
+ amountSat: number
791
+ ): Promise<BarkFeeEstimate> {
792
+ return NitroArkHybridObject.estimateLightningSendFee(amountSat);
793
+ }
794
+
726
795
  // --- Ark Operations ---
727
796
 
728
797
  /**
@@ -764,6 +833,17 @@ export function sendArkoorPayment(
764
833
  return NitroArkHybridObject.sendArkoorPayment(destination, amountSat);
765
834
  }
766
835
 
836
+ /**
837
+ * Estimates the fee for an Arkoor payment.
838
+ * @param amountSat The amount in satoshis to send.
839
+ * @returns A promise resolving to the fee estimate.
840
+ */
841
+ export function estimateArkoorPaymentFee(
842
+ amountSat: number
843
+ ): Promise<BarkFeeEstimate> {
844
+ return NitroArkHybridObject.estimateArkoorPaymentFee(amountSat);
845
+ }
846
+
767
847
  /**
768
848
  * Sends an onchain payment via an Ark round.
769
849
  * @param destination The destination Bitcoin address.
@@ -777,6 +857,19 @@ export function sendOnchain(
777
857
  return NitroArkHybridObject.sendOnchain(destination, amountSat);
778
858
  }
779
859
 
860
+ /**
861
+ * Estimates the fee for sending an onchain payment via an Ark round.
862
+ * @param destination The destination Bitcoin address.
863
+ * @param amountSat The amount in satoshis to send.
864
+ * @returns A promise resolving to the fee estimate.
865
+ */
866
+ export function estimateSendOnchain(
867
+ destination: string,
868
+ amountSat: number
869
+ ): Promise<BarkFeeEstimate> {
870
+ return NitroArkHybridObject.estimateSendOnchain(destination, amountSat);
871
+ }
872
+
780
873
  // --- Offboarding / Exiting ---
781
874
 
782
875
  /**
@@ -801,6 +894,17 @@ export function offboardAll(destinationAddress: string): Promise<string> {
801
894
  return NitroArkHybridObject.offboardAll(destinationAddress);
802
895
  }
803
896
 
897
+ /**
898
+ * Estimates the fee for offboarding all Ark funds to an onchain address.
899
+ * @param destinationAddress The destination Bitcoin address.
900
+ * @returns A promise resolving to the fee estimate.
901
+ */
902
+ export function estimateOffboardAll(
903
+ destinationAddress: string
904
+ ): Promise<BarkFeeEstimate> {
905
+ return NitroArkHybridObject.estimateOffboardAll(destinationAddress);
906
+ }
907
+
804
908
  // --- Re-export types and enums ---
805
909
  export type {
806
910
  NitroArk,
@@ -811,6 +915,7 @@ export type {
811
915
  BoardResult,
812
916
  BarkSendManyOutput,
813
917
  ArkoorPaymentResult,
918
+ BarkFeeEstimate,
814
919
  LightningSendResult,
815
920
  OnchainPaymentResult,
816
921
  OffchainBalanceResult,