react-native-nitro-ark 0.0.38 → 0.0.39

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/src/index.tsx CHANGED
@@ -6,9 +6,12 @@ import type {
6
6
  BarkArkInfo,
7
7
  BarkSendManyOutput,
8
8
  ArkoorPaymentResult,
9
- Bolt11PaymentResult,
9
+ LightningPaymentResult,
10
10
  LnurlPaymentResult,
11
11
  OnchainPaymentResult,
12
+ BarkVtxo,
13
+ OffchainBalanceResult,
14
+ OnchainBalanceResult,
12
15
  } from './NitroArk.nitro';
13
16
 
14
17
  // Create the hybrid object instance
@@ -81,11 +84,11 @@ export function sync(): Promise<void> {
81
84
  }
82
85
 
83
86
  /**
84
- * Synchronizes the Ark-specific parts of the wallet.
87
+ * Synchronizes the Ark-specific exits.
85
88
  * @returns A promise that resolves on success.
86
89
  */
87
- export function syncArk(): Promise<void> {
88
- return NitroArkHybridObject.syncArk();
90
+ export function syncExits(): Promise<void> {
91
+ return NitroArkHybridObject.syncExits();
89
92
  }
90
93
 
91
94
  /**
@@ -107,96 +110,114 @@ export function getArkInfo(): Promise<BarkArkInfo> {
107
110
  }
108
111
 
109
112
  /**
110
- * Gets the onchain balance for the loaded wallet.
111
- * @returns A promise resolving to the onchain balance in satoshis.
113
+ * Gets the offchain balance for the loaded wallet.
114
+ * @returns A promise resolving to the OffchainBalanceResult object.
112
115
  */
113
- export function onchainBalance(): Promise<number> {
114
- return NitroArkHybridObject.onchainBalance();
116
+ export function offchainBalance(): Promise<OffchainBalanceResult> {
117
+ return NitroArkHybridObject.offchainBalance();
115
118
  }
116
119
 
117
120
  /**
118
- * Gets the offchain balance for the loaded wallet.
119
- * @returns A promise resolving to the offchain balance in satoshis.
121
+ * Derives the next keypair for the store.
122
+ * @returns A promise resolving to the hex-encoded public key string.
120
123
  */
121
- export function offchainBalance(): Promise<number> {
122
- return NitroArkHybridObject.offchainBalance();
124
+ export function deriveStoreNextKeypair(): Promise<string> {
125
+ return NitroArkHybridObject.deriveStoreNextKeypair();
123
126
  }
124
127
 
125
128
  /**
126
- * Gets a fresh onchain address for the loaded wallet.
127
- * @returns A promise resolving to the Bitcoin address string.
129
+ * Gets the wallet's VTXO public key (hex string).
130
+ * @param index Index of the VTXO pubkey to retrieve.
131
+ * @returns A promise resolving to the hex-encoded public key string.
128
132
  */
129
- export function getOnchainAddress(): Promise<string> {
130
- return NitroArkHybridObject.getOnchainAddress();
133
+ export function peakKeyPair(index: number): Promise<string> {
134
+ return NitroArkHybridObject.peakKeyPair(index);
131
135
  }
132
136
 
133
137
  /**
134
- * Gets the list of onchain UTXOs as a JSON string for the loaded wallet.
138
+ * Gets the list of VTXOs as a JSON string for the loaded wallet.
135
139
  * @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
136
- * @returns A promise resolving to the JSON string of UTXOs.
140
+ * @returns A promise resolving BarkVtxo[] array.
137
141
  */
138
- export function getOnchainUtxos(no_sync: boolean = false): Promise<string> {
139
- return NitroArkHybridObject.getOnchainUtxos(no_sync);
142
+ export function getVtxos(): Promise<BarkVtxo[]> {
143
+ return NitroArkHybridObject.getVtxos();
140
144
  }
141
145
 
146
+ // --- Onchain Operations ---
147
+
142
148
  /**
143
- * Gets the wallet's VTXO public key (hex string).
144
- * @param index Index of the VTXO pubkey to retrieve. Use u32::MAX for a new one.
145
- * @returns A promise resolving to the hex-encoded public key string.
149
+ * Gets the onchain balance for the loaded wallet.
150
+ * @returns A promise resolving to the OnchainBalanceResult object.
146
151
  */
147
- export function getVtxoPubkey(index?: number): Promise<string> {
148
- return NitroArkHybridObject.getVtxoPubkey(index);
152
+ export function onchainBalance(): Promise<OnchainBalanceResult> {
153
+ return NitroArkHybridObject.onchainBalance();
149
154
  }
150
155
 
151
156
  /**
152
- * Gets the list of VTXOs as a JSON string for the loaded wallet.
153
- * @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
154
- * @returns A promise resolving to the JSON string of VTXOs.
157
+ * Synchronizes the onchain state of the wallet.
158
+ * @returns A promise that resolves on success.
155
159
  */
156
- export function getVtxos(no_sync: boolean = false): Promise<string> {
157
- return NitroArkHybridObject.getVtxos(no_sync);
160
+ export function onchainSync(): Promise<void> {
161
+ return NitroArkHybridObject.onchainSync();
158
162
  }
159
163
 
160
- // --- Onchain Operations ---
164
+ /**
165
+ * Gets the list of unspent onchain outputs as a JSON string for the loaded wallet.
166
+ * @returns A promise resolving to the JSON string of unspent outputs.
167
+ */
168
+ export function onchainListUnspent(): Promise<string> {
169
+ return NitroArkHybridObject.onchainListUnspent();
170
+ }
171
+
172
+ /**
173
+ * Gets the list of onchain UTXOs as a JSON string for the loaded wallet.
174
+ * @returns A promise resolving to the JSON string of UTXOs.
175
+ */
176
+ export function onchainUtxos(): Promise<string> {
177
+ return NitroArkHybridObject.onchainUtxos();
178
+ }
179
+
180
+ /**
181
+ * Gets a fresh onchain address for the loaded wallet.
182
+ * @returns A promise resolving to the Bitcoin address string.
183
+ */
184
+ export function onchainAddress(): Promise<string> {
185
+ return NitroArkHybridObject.onchainAddress();
186
+ }
161
187
 
162
188
  /**
163
189
  * Sends funds using the onchain wallet.
164
190
  * @param destination The destination Bitcoin address.
165
191
  * @param amountSat The amount to send in satoshis.
166
- * @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
167
192
  * @returns A promise resolving to the OnchainPaymentResult object
168
193
  */
169
- export function sendOnchain(
194
+ export function onchainSend(
170
195
  destination: string,
171
196
  amountSat: number
172
197
  ): Promise<OnchainPaymentResult> {
173
- return NitroArkHybridObject.sendOnchain(destination, amountSat);
198
+ return NitroArkHybridObject.onchainSend(destination, amountSat);
174
199
  }
175
200
 
176
201
  /**
177
202
  * Sends all funds from the onchain wallet to a destination address.
178
203
  * @param destination The destination Bitcoin address.
179
- * @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
180
204
  * @returns A promise resolving to the transaction ID string.
181
205
  */
182
- export function drainOnchain(
183
- destination: string,
184
- no_sync: boolean = false
206
+ export function onchainDrain(
207
+ destination: string
185
208
  ): Promise<string> {
186
- return NitroArkHybridObject.drainOnchain(destination, no_sync);
209
+ return NitroArkHybridObject.onchainDrain(destination);
187
210
  }
188
211
 
189
212
  /**
190
213
  * Sends funds to multiple recipients using the onchain wallet.
191
214
  * @param outputs An array of objects containing destination address and amountSat.
192
- * @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
193
215
  * @returns A promise resolving to the transaction ID string.
194
216
  */
195
- export function sendManyOnchain(
217
+ export function onchainSendMany(
196
218
  outputs: BarkSendManyOutput[],
197
- no_sync: boolean = false
198
219
  ): Promise<string> {
199
- return NitroArkHybridObject.sendManyOnchain(outputs, no_sync);
220
+ return NitroArkHybridObject.onchainSendMany(outputs);
200
221
  }
201
222
 
202
223
  // --- Lightning Operations ---
@@ -211,12 +232,40 @@ export function bolt11Invoice(amountMsat: number): Promise<string> {
211
232
  }
212
233
 
213
234
  /**
214
- * Claims a Bolt 11 payment.
215
- * @param bolt11 The Bolt 11 invoice string to claim.
235
+ * Claims a Lightning payment.
236
+ * @param bolt11 The Lightning invoice string to claim.
216
237
  * @returns A promise that resolves on success or rejects on error.
217
238
  */
218
- export function claimBolt11Payment(bolt11: string): Promise<void> {
219
- return NitroArkHybridObject.claimBolt11Payment(bolt11);
239
+ export function finishLightningReceive(bolt11: string): Promise<void> {
240
+ return NitroArkHybridObject.finishLightningReceive(bolt11);
241
+ }
242
+
243
+ /**
244
+ * Sends a Lightning payment.
245
+ * @param destination The Lightning invoice.
246
+ * @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
247
+ * @returns A promise resolving to a LightningPaymentResult object
248
+ */
249
+ export function sendLightningPayment(
250
+ destination: string,
251
+ amountSat?: number
252
+ ): Promise<LightningPaymentResult> {
253
+ return NitroArkHybridObject.sendLightningPayment(destination, amountSat);
254
+ }
255
+
256
+ /**
257
+ * Sends a payment to a Lightning Address.
258
+ * @param addr The Lightning Address.
259
+ * @param amountSat The amount in satoshis to send.
260
+ * @param comment An optional comment.
261
+ * @returns A promise resolving to a LnurlPaymentResult object
262
+ */
263
+ export function sendLnaddr(
264
+ addr: string,
265
+ amountSat: number,
266
+ comment: string
267
+ ): Promise<LnurlPaymentResult> {
268
+ return NitroArkHybridObject.sendLnaddr(addr, amountSat, comment);
220
269
  }
221
270
 
222
271
  // --- Ark Operations ---
@@ -251,47 +300,17 @@ export function sendArkoorPayment(
251
300
  return NitroArkHybridObject.sendArkoorPayment(destination, amountSat);
252
301
  }
253
302
 
254
- /**
255
- * Sends a Bolt11 payment.
256
- * @param destination The Bolt11 invoice.
257
- * @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
258
- * @returns A promise resolving to a Bolt11PaymentResult object
259
- */
260
- export function sendBolt11Payment(
261
- destination: string,
262
- amountSat?: number
263
- ): Promise<Bolt11PaymentResult> {
264
- return NitroArkHybridObject.sendBolt11Payment(destination, amountSat);
265
- }
266
-
267
- /**
268
- * Sends a payment to a Lightning Address.
269
- * @param addr The Lightning Address.
270
- * @param amountSat The amount in satoshis to send.
271
- * @param comment An optional comment.
272
- * @returns A promise resolving to a LnurlPaymentResult object
273
- */
274
- export function sendLnaddr(
275
- addr: string,
276
- amountSat: number,
277
- comment: string
278
- ): Promise<LnurlPaymentResult> {
279
- return NitroArkHybridObject.sendLnaddr(addr, amountSat, comment);
280
- }
281
-
282
303
  /**
283
304
  * Sends an onchain payment via an Ark round.
284
305
  * @param destination The destination Bitcoin address.
285
306
  * @param amountSat The amount in satoshis to send.
286
- * @param no_sync If true, skips synchronization with the wallet. Defaults to false.
287
307
  * @returns A promise resolving to a JSON status string.
288
308
  */
289
- export function sendRoundOnchain(
309
+ export function sendRoundOnchainPayment(
290
310
  destination: string,
291
311
  amountSat: number,
292
- no_sync: boolean = false
293
312
  ): Promise<string> {
294
- return NitroArkHybridObject.sendRoundOnchain(destination, amountSat, no_sync);
313
+ return NitroArkHybridObject.sendRoundOnchainPayment(destination, amountSat);
295
314
  }
296
315
 
297
316
  // --- Offboarding / Exiting ---
@@ -320,31 +339,6 @@ export function offboardAll(destinationAddress: string): Promise<string> {
320
339
  return NitroArkHybridObject.offboardAll(destinationAddress);
321
340
  }
322
341
 
323
- /**
324
- * Starts the exit process for specific VTXOs.
325
- * @param vtxoIds Array of VtxoId strings to start exiting.
326
- * @returns A promise resolving to a JSON status string.
327
- */
328
- export function startExitForVtxos(vtxoIds: string[]): Promise<string> {
329
- return NitroArkHybridObject.exitStartSpecific(vtxoIds);
330
- }
331
-
332
- /**
333
- * Starts the exit process for all VTXOs in the wallet.
334
- * @returns A promise that resolves or rejects.
335
- */
336
- export function startExitForEntireWallet(): Promise<void> {
337
- return NitroArkHybridObject.startExitForEntireWallet();
338
- }
339
-
340
- /**
341
- * Progresses the exit process once and returns the current status.
342
- * @returns A promise resolving to a JSON status string.
343
- */
344
- export function exitProgressOnce(): Promise<string> {
345
- return NitroArkHybridObject.exitProgressOnce();
346
- }
347
-
348
342
  // --- Re-export types and enums ---
349
343
  export type {
350
344
  NitroArk,
@@ -353,8 +347,10 @@ export type {
353
347
  BarkArkInfo,
354
348
  BarkSendManyOutput,
355
349
  ArkoorPaymentResult,
356
- Bolt11PaymentResult,
350
+ LightningPaymentResult,
357
351
  LnurlPaymentResult,
358
352
  OnchainPaymentResult,
359
353
  PaymentTypes,
354
+ OffchainBalanceResult,
355
+ OnchainBalanceResult
360
356
  } from './NitroArk.nitro';