react-native-nitro-ark 0.0.129 → 0.0.131

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
@@ -33,6 +33,10 @@ import type {
33
33
  BoardResult,
34
34
  PendingRoundStatus as NitroPendingRoundStatus,
35
35
  DelegatedRoundState,
36
+ WalletSnapshotInfo,
37
+ WalletSnapshotExpectation,
38
+ WalletStateChangeEvent as NitroWalletStateChangeEvent,
39
+ WalletStateChangeSubscription,
36
40
  } from './NitroArk.nitro';
37
41
 
38
42
  export type VtxoState = 'Spendable' | 'Spent' | 'Locked' | 'Exited' | 'unknown';
@@ -130,6 +134,24 @@ export type BarkNotificationEvent = Omit<
130
134
  movement?: BarkMovement;
131
135
  };
132
136
 
137
+ export type WalletStateChangeReason =
138
+ | 'initial'
139
+ | 'databaseChanged'
140
+ | 'resyncRequired';
141
+
142
+ export type WalletStateChangeEvent = Omit<
143
+ NitroWalletStateChangeEvent,
144
+ 'reason'
145
+ > & {
146
+ reason: WalletStateChangeReason;
147
+ };
148
+
149
+ export type {
150
+ WalletSnapshotInfo,
151
+ WalletSnapshotExpectation,
152
+ WalletStateChangeSubscription,
153
+ };
154
+
133
155
  export type LightningPaymentState =
134
156
  | 'unknown'
135
157
  | 'in_progress'
@@ -216,6 +238,39 @@ export function closeWallet(): Promise<void> {
216
238
  return NitroArkHybridObject.closeWallet();
217
239
  }
218
240
 
241
+ /**
242
+ * Creates a transactionally consistent SQLite snapshot of the loaded wallet.
243
+ * The destination must not already exist.
244
+ */
245
+ export function createWalletSnapshot(
246
+ destinationPath: string
247
+ ): Promise<WalletSnapshotInfo> {
248
+ return NitroArkHybridObject.createWalletSnapshot(destinationPath);
249
+ }
250
+
251
+ /**
252
+ * Validates a wallet snapshot without modifying it. When expected identity
253
+ * fields are omitted, the loaded wallet identity is used when available.
254
+ */
255
+ export function validateWalletSnapshot(
256
+ path: string,
257
+ expected?: WalletSnapshotExpectation
258
+ ): Promise<WalletSnapshotInfo> {
259
+ return NitroArkHybridObject.validateWalletSnapshot(path, expected);
260
+ }
261
+
262
+ /**
263
+ * Observes committed native SQLite changes. Sequence values are local to this
264
+ * subscription and reset when a new subscription is created.
265
+ */
266
+ export function subscribeWalletStateChanges(
267
+ onEvent: (event: WalletStateChangeEvent) => void
268
+ ): WalletStateChangeSubscription {
269
+ return NitroArkHybridObject.subscribeWalletStateChanges(
270
+ onEvent as (event: NitroWalletStateChangeEvent) => void
271
+ );
272
+ }
273
+
219
274
  /**
220
275
  * Refreshes the server state.
221
276
  * @returns A promise that resolves on success or rejects on error.
@@ -770,6 +825,10 @@ export function onchainAddress(): Promise<string> {
770
825
  return NitroArkHybridObject.onchainAddress();
771
826
  }
772
827
 
828
+ export function onchainIsMine(address: string): Promise<boolean> {
829
+ return NitroArkHybridObject.onchainIsMine(address);
830
+ }
831
+
773
832
  /**
774
833
  * Sends funds using the onchain wallet.
775
834
  * @param destination The destination Bitcoin address.