react-native-nitro-ark 0.0.93 → 0.0.95
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/cpp/NitroArkJni.cpp +2 -2
- package/android/src/main/java/com/margelo/nitro/nitroark/NitroArkNative.kt +1 -1
- 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/BarkNotificationSubscription.hpp +179 -0
- package/cpp/NitroArk.hpp +172 -56
- package/cpp/generated/ark_cxx.h +244 -11
- package/lib/module/index.js +51 -5
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +27 -2
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +42 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroArk+autolinking.cmake +1 -0
- package/nitrogen/generated/shared/c++/BarkArkInfo.hpp +14 -2
- package/nitrogen/generated/shared/c++/BarkNotificationEvent.hpp +90 -0
- package/nitrogen/generated/shared/c++/HybridBarkNotificationSubscriptionSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridBarkNotificationSubscriptionSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +7 -2
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +18 -2
- package/nitrogen/generated/shared/c++/MailboxAuthorizationResult.hpp +91 -0
- package/nitrogen/generated/shared/c++/OffchainBalanceResult.hpp +5 -1
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +39 -3
- package/src/index.tsx +89 -7
package/src/index.tsx
CHANGED
|
@@ -12,7 +12,10 @@ import type {
|
|
|
12
12
|
OnchainBalanceResult,
|
|
13
13
|
NewAddressResult,
|
|
14
14
|
KeyPairResult,
|
|
15
|
+
MailboxAuthorizationResult,
|
|
15
16
|
LightningReceive,
|
|
17
|
+
BarkNotificationEvent as NitroBarkNotificationEvent,
|
|
18
|
+
BarkNotificationSubscription,
|
|
16
19
|
BarkMovement as NitroBarkMovement,
|
|
17
20
|
BarkMovementDestination as NitroBarkMovementDestination,
|
|
18
21
|
BoardResult,
|
|
@@ -25,10 +28,10 @@ export type BarkVtxo = {
|
|
|
25
28
|
exit_delta: number; // u16
|
|
26
29
|
anchor_point: string;
|
|
27
30
|
point: string;
|
|
28
|
-
state: 'Spendable' | 'Spent' | 'Locked'
|
|
31
|
+
state: 'Spendable' | 'Spent' | 'Locked';
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
export type MovementStatus = 'pending' | '
|
|
34
|
+
export type MovementStatus = 'pending' | 'successful' | 'failed' | 'cancelled';
|
|
32
35
|
|
|
33
36
|
export type BarkMovementDestination = NitroBarkMovementDestination & {
|
|
34
37
|
payment_method:
|
|
@@ -47,6 +50,19 @@ export type BarkMovement = NitroBarkMovement & {
|
|
|
47
50
|
received_on: BarkMovementDestination[];
|
|
48
51
|
};
|
|
49
52
|
|
|
53
|
+
export type BarkNotificationKind =
|
|
54
|
+
| 'movementCreated'
|
|
55
|
+
| 'movementUpdated'
|
|
56
|
+
| 'channelLagging';
|
|
57
|
+
|
|
58
|
+
export type BarkNotificationEvent = Omit<
|
|
59
|
+
NitroBarkNotificationEvent,
|
|
60
|
+
'kind' | 'movement'
|
|
61
|
+
> & {
|
|
62
|
+
kind: BarkNotificationKind;
|
|
63
|
+
movement?: BarkMovement;
|
|
64
|
+
};
|
|
65
|
+
|
|
50
66
|
// Create the hybrid object instance
|
|
51
67
|
export const NitroArkHybridObject =
|
|
52
68
|
NitroModules.createHybridObject<NitroArk>('NitroArk');
|
|
@@ -215,12 +231,12 @@ export function deriveStoreNextKeypair(): Promise<KeyPairResult> {
|
|
|
215
231
|
}
|
|
216
232
|
|
|
217
233
|
/**
|
|
218
|
-
*
|
|
234
|
+
* Peeks the wallet's VTXO public key (hex string).
|
|
219
235
|
* @param index Index of the VTXO pubkey to retrieve.
|
|
220
236
|
* @returns A promise resolving to the KeyPairResult object.
|
|
221
237
|
*/
|
|
222
|
-
export function
|
|
223
|
-
return NitroArkHybridObject.
|
|
238
|
+
export function peekKeyPair(index: number): Promise<KeyPairResult> {
|
|
239
|
+
return NitroArkHybridObject.peekKeyPair(index);
|
|
224
240
|
}
|
|
225
241
|
|
|
226
242
|
/**
|
|
@@ -228,8 +244,8 @@ export function peakKeyPair(index: number): Promise<KeyPairResult> {
|
|
|
228
244
|
* @param index Index of the address to preview.
|
|
229
245
|
* @returns A promise resolving to the NewAddressResult object.
|
|
230
246
|
*/
|
|
231
|
-
export function
|
|
232
|
-
return NitroArkHybridObject.
|
|
247
|
+
export function peekAddress(index: number): Promise<NewAddressResult> {
|
|
248
|
+
return NitroArkHybridObject.peekAddress(index);
|
|
233
249
|
}
|
|
234
250
|
|
|
235
251
|
/**
|
|
@@ -307,6 +323,72 @@ export function verifyMessage(
|
|
|
307
323
|
return NitroArkHybridObject.verifyMessage(message, signature, publicKey);
|
|
308
324
|
}
|
|
309
325
|
|
|
326
|
+
/**
|
|
327
|
+
* Gets the mailbox keypair for the loaded wallet.
|
|
328
|
+
* @returns A promise resolving to a KeyPairResult object.
|
|
329
|
+
*/
|
|
330
|
+
export function mailboxKeypair(): Promise<KeyPairResult> {
|
|
331
|
+
return NitroArkHybridObject.mailboxKeypair() as Promise<KeyPairResult>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Gets a mailbox authorization for the loaded wallet.
|
|
336
|
+
* @param authorizationExpiry Unix timestamp (seconds) for when the authorization expires.
|
|
337
|
+
* @returns A promise resolving to a MailboxAuthorizationResult object.
|
|
338
|
+
*/
|
|
339
|
+
export function mailboxAuthorization(
|
|
340
|
+
authorizationExpiry: number
|
|
341
|
+
): Promise<MailboxAuthorizationResult> {
|
|
342
|
+
return NitroArkHybridObject.mailboxAuthorization(
|
|
343
|
+
authorizationExpiry
|
|
344
|
+
) as Promise<MailboxAuthorizationResult>;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Subscribes to all Bark wallet notifications.
|
|
349
|
+
* @param onEvent Callback invoked whenever a notification is emitted.
|
|
350
|
+
* @returns A subscription handle that can be stopped.
|
|
351
|
+
*/
|
|
352
|
+
export function subscribeNotifications(
|
|
353
|
+
onEvent: (event: BarkNotificationEvent) => void
|
|
354
|
+
): BarkNotificationSubscription {
|
|
355
|
+
return NitroArkHybridObject.subscribeNotifications(
|
|
356
|
+
onEvent as (event: NitroBarkNotificationEvent) => void
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Subscribes to notifications related to a specific Arkoor address.
|
|
362
|
+
* @param address Arkoor address to filter by.
|
|
363
|
+
* @param onEvent Callback invoked whenever a matching notification is emitted.
|
|
364
|
+
* @returns A subscription handle that can be stopped.
|
|
365
|
+
*/
|
|
366
|
+
export function subscribeArkoorAddressMovements(
|
|
367
|
+
address: string,
|
|
368
|
+
onEvent: (event: BarkNotificationEvent) => void
|
|
369
|
+
): BarkNotificationSubscription {
|
|
370
|
+
return NitroArkHybridObject.subscribeArkoorAddressMovements(
|
|
371
|
+
address,
|
|
372
|
+
onEvent as (event: NitroBarkNotificationEvent) => void
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Subscribes to notifications related to a specific Lightning payment hash.
|
|
378
|
+
* @param paymentHash Lightning payment hash to filter by.
|
|
379
|
+
* @param onEvent Callback invoked whenever a matching notification is emitted.
|
|
380
|
+
* @returns A subscription handle that can be stopped.
|
|
381
|
+
*/
|
|
382
|
+
export function subscribeLightningPaymentMovements(
|
|
383
|
+
paymentHash: string,
|
|
384
|
+
onEvent: (event: BarkNotificationEvent) => void
|
|
385
|
+
): BarkNotificationSubscription {
|
|
386
|
+
return NitroArkHybridObject.subscribeLightningPaymentMovements(
|
|
387
|
+
paymentHash,
|
|
388
|
+
onEvent as (event: NitroBarkNotificationEvent) => void
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
|
|
310
392
|
/**
|
|
311
393
|
* Gets a paginated list of wallet history (balance changes).
|
|
312
394
|
* @returns A promise resolving to an array of BarkMovement objects.
|