react-native-nitro-ark 0.0.128 → 0.0.130
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/README.md +31 -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/NitroArk.hpp +148 -0
- package/cpp/WalletStateChangeSubscription.hpp +118 -0
- package/cpp/generated/ark_cxx.h +94 -0
- package/lib/module/index.js +42 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +34 -0
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +34 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroArk+autolinking.cmake +1 -0
- package/nitrogen/generated/shared/c++/DelegatedRoundState.hpp +83 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +5 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +23 -3
- package/nitrogen/generated/shared/c++/HybridWalletStateChangeSubscriptionSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridWalletStateChangeSubscriptionSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/WalletSnapshotExpectation.hpp +92 -0
- package/nitrogen/generated/shared/c++/WalletSnapshotInfo.hpp +112 -0
- package/nitrogen/generated/shared/c++/WalletStateChangeEvent.hpp +87 -0
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +44 -0
- package/src/index.tsx +79 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WalletSnapshotInfo.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
#include <optional>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::nitroark {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (WalletSnapshotInfo).
|
|
40
|
+
*/
|
|
41
|
+
struct WalletSnapshotInfo final {
|
|
42
|
+
public:
|
|
43
|
+
std::string path SWIFT_PRIVATE;
|
|
44
|
+
double sizeBytes SWIFT_PRIVATE;
|
|
45
|
+
std::string sha256 SWIFT_PRIVATE;
|
|
46
|
+
std::string network SWIFT_PRIVATE;
|
|
47
|
+
std::string walletFingerprint SWIFT_PRIVATE;
|
|
48
|
+
std::optional<std::string> serverPubkey SWIFT_PRIVATE;
|
|
49
|
+
std::optional<std::string> mailboxPubkey SWIFT_PRIVATE;
|
|
50
|
+
double schemaVersion SWIFT_PRIVATE;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
WalletSnapshotInfo() = default;
|
|
54
|
+
explicit WalletSnapshotInfo(std::string path, double sizeBytes, std::string sha256, std::string network, std::string walletFingerprint, std::optional<std::string> serverPubkey, std::optional<std::string> mailboxPubkey, double schemaVersion): path(path), sizeBytes(sizeBytes), sha256(sha256), network(network), walletFingerprint(walletFingerprint), serverPubkey(serverPubkey), mailboxPubkey(mailboxPubkey), schemaVersion(schemaVersion) {}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
friend bool operator==(const WalletSnapshotInfo& lhs, const WalletSnapshotInfo& rhs) = default;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
} // namespace margelo::nitro::nitroark
|
|
61
|
+
|
|
62
|
+
namespace margelo::nitro {
|
|
63
|
+
|
|
64
|
+
// C++ WalletSnapshotInfo <> JS WalletSnapshotInfo (object)
|
|
65
|
+
template <>
|
|
66
|
+
struct JSIConverter<margelo::nitro::nitroark::WalletSnapshotInfo> final {
|
|
67
|
+
static inline margelo::nitro::nitroark::WalletSnapshotInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
68
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
69
|
+
return margelo::nitro::nitroark::WalletSnapshotInfo(
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path"))),
|
|
71
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sizeBytes"))),
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sha256"))),
|
|
73
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "network"))),
|
|
74
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "walletFingerprint"))),
|
|
75
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "serverPubkey"))),
|
|
76
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailboxPubkey"))),
|
|
77
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "schemaVersion")))
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::WalletSnapshotInfo& arg) {
|
|
81
|
+
jsi::Object obj(runtime);
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "path"), JSIConverter<std::string>::toJSI(runtime, arg.path));
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sizeBytes"), JSIConverter<double>::toJSI(runtime, arg.sizeBytes));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sha256"), JSIConverter<std::string>::toJSI(runtime, arg.sha256));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "network"), JSIConverter<std::string>::toJSI(runtime, arg.network));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "walletFingerprint"), JSIConverter<std::string>::toJSI(runtime, arg.walletFingerprint));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "serverPubkey"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.serverPubkey));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mailboxPubkey"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.mailboxPubkey));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "schemaVersion"), JSIConverter<double>::toJSI(runtime, arg.schemaVersion));
|
|
90
|
+
return obj;
|
|
91
|
+
}
|
|
92
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
93
|
+
if (!value.isObject()) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
jsi::Object obj = value.getObject(runtime);
|
|
97
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path")))) return false;
|
|
101
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sizeBytes")))) return false;
|
|
102
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sha256")))) return false;
|
|
103
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "network")))) return false;
|
|
104
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "walletFingerprint")))) return false;
|
|
105
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "serverPubkey")))) return false;
|
|
106
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mailboxPubkey")))) return false;
|
|
107
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "schemaVersion")))) return false;
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WalletStateChangeEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitroark {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (WalletStateChangeEvent).
|
|
39
|
+
*/
|
|
40
|
+
struct WalletStateChangeEvent final {
|
|
41
|
+
public:
|
|
42
|
+
double sequence SWIFT_PRIVATE;
|
|
43
|
+
std::string reason SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
WalletStateChangeEvent() = default;
|
|
47
|
+
explicit WalletStateChangeEvent(double sequence, std::string reason): sequence(sequence), reason(reason) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const WalletStateChangeEvent& lhs, const WalletStateChangeEvent& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::nitroark
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ WalletStateChangeEvent <> JS WalletStateChangeEvent (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::nitroark::WalletStateChangeEvent> final {
|
|
60
|
+
static inline margelo::nitro::nitroark::WalletStateChangeEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::nitroark::WalletStateChangeEvent(
|
|
63
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequence"))),
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reason")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::WalletStateChangeEvent& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sequence"), JSIConverter<double>::toJSI(runtime, arg.sequence));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "reason"), JSIConverter<std::string>::toJSI(runtime, arg.reason));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequence")))) return false;
|
|
82
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "reason")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -273,6 +273,10 @@ export interface PendingRoundStatus {
|
|
|
273
273
|
is_success: boolean;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
export interface DelegatedRoundState {
|
|
277
|
+
round_id: number; // u32
|
|
278
|
+
}
|
|
279
|
+
|
|
276
280
|
export interface BarkNotificationEvent {
|
|
277
281
|
kind: string; // 'movementCreated' | 'movementUpdated' | 'channelLagging'
|
|
278
282
|
movement?: BarkMovement;
|
|
@@ -284,6 +288,34 @@ export interface BarkNotificationSubscription
|
|
|
284
288
|
isActive(): boolean;
|
|
285
289
|
}
|
|
286
290
|
|
|
291
|
+
export interface WalletSnapshotInfo {
|
|
292
|
+
path: string;
|
|
293
|
+
sizeBytes: number;
|
|
294
|
+
sha256: string;
|
|
295
|
+
network: string;
|
|
296
|
+
walletFingerprint: string;
|
|
297
|
+
serverPubkey?: string;
|
|
298
|
+
mailboxPubkey?: string;
|
|
299
|
+
schemaVersion: number;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface WalletSnapshotExpectation {
|
|
303
|
+
network?: string;
|
|
304
|
+
walletFingerprint?: string;
|
|
305
|
+
serverPubkey?: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface WalletStateChangeEvent {
|
|
309
|
+
sequence: number;
|
|
310
|
+
reason: string; // 'initial' | 'databaseChanged' | 'resyncRequired'
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export interface WalletStateChangeSubscription
|
|
314
|
+
extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
315
|
+
stop(): void;
|
|
316
|
+
isActive(): boolean;
|
|
317
|
+
}
|
|
318
|
+
|
|
287
319
|
// --- Nitro Module Interface ---
|
|
288
320
|
|
|
289
321
|
export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
@@ -293,6 +325,14 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
293
325
|
loadWallet(datadir: string, config: BarkCreateOpts): Promise<void>;
|
|
294
326
|
isWalletLoaded(): Promise<boolean>;
|
|
295
327
|
closeWallet(): Promise<void>;
|
|
328
|
+
createWalletSnapshot(destinationPath: string): Promise<WalletSnapshotInfo>;
|
|
329
|
+
validateWalletSnapshot(
|
|
330
|
+
path: string,
|
|
331
|
+
expected?: WalletSnapshotExpectation
|
|
332
|
+
): Promise<WalletSnapshotInfo>;
|
|
333
|
+
subscribeWalletStateChanges(
|
|
334
|
+
onEvent: (event: WalletStateChangeEvent) => void
|
|
335
|
+
): WalletStateChangeSubscription;
|
|
296
336
|
refreshServer(): Promise<void>;
|
|
297
337
|
syncPendingBoards(): Promise<void>;
|
|
298
338
|
maintenance(): Promise<void>;
|
|
@@ -370,6 +410,9 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
370
410
|
decodeVtxoHex(vtxoHex: string): Promise<BarkVtxo>;
|
|
371
411
|
importVtxo(vtxoHex: string): Promise<BarkVtxo>;
|
|
372
412
|
dangerousDropVtxo(vtxoId: string): Promise<void>;
|
|
413
|
+
refreshVtxosDelegated(
|
|
414
|
+
vtxoIds: string[]
|
|
415
|
+
): Promise<DelegatedRoundState | undefined>;
|
|
373
416
|
getFirstExpiringVtxoBlockheight(): Promise<number | undefined>;
|
|
374
417
|
getNextRequiredRefreshBlockheight(): Promise<number | undefined>;
|
|
375
418
|
getExpiringVtxos(threshold: number): Promise<BarkVtxo[]>;
|
|
@@ -409,6 +452,7 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
409
452
|
): Promise<ArkoorPaymentResult>;
|
|
410
453
|
estimateArkoorPaymentFee(amountSat: number): Promise<BarkFeeEstimate>;
|
|
411
454
|
estimateBoardOffchainFee(amountSat: number): Promise<BarkFeeEstimate>;
|
|
455
|
+
estimateRefreshFee(vtxoIds: string[]): Promise<BarkFeeEstimate>;
|
|
412
456
|
payLightningInvoice(
|
|
413
457
|
destination: string,
|
|
414
458
|
wait: boolean,
|
package/src/index.tsx
CHANGED
|
@@ -32,6 +32,11 @@ import type {
|
|
|
32
32
|
BarkMovementDestination as NitroBarkMovementDestination,
|
|
33
33
|
BoardResult,
|
|
34
34
|
PendingRoundStatus as NitroPendingRoundStatus,
|
|
35
|
+
DelegatedRoundState,
|
|
36
|
+
WalletSnapshotInfo,
|
|
37
|
+
WalletSnapshotExpectation,
|
|
38
|
+
WalletStateChangeEvent as NitroWalletStateChangeEvent,
|
|
39
|
+
WalletStateChangeSubscription,
|
|
35
40
|
} from './NitroArk.nitro';
|
|
36
41
|
|
|
37
42
|
export type VtxoState = 'Spendable' | 'Spent' | 'Locked' | 'Exited' | 'unknown';
|
|
@@ -129,6 +134,24 @@ export type BarkNotificationEvent = Omit<
|
|
|
129
134
|
movement?: BarkMovement;
|
|
130
135
|
};
|
|
131
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
|
+
|
|
132
155
|
export type LightningPaymentState =
|
|
133
156
|
| 'unknown'
|
|
134
157
|
| 'in_progress'
|
|
@@ -215,6 +238,39 @@ export function closeWallet(): Promise<void> {
|
|
|
215
238
|
return NitroArkHybridObject.closeWallet();
|
|
216
239
|
}
|
|
217
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
|
+
|
|
218
274
|
/**
|
|
219
275
|
* Refreshes the server state.
|
|
220
276
|
* @returns A promise that resolves on success or rejects on error.
|
|
@@ -283,6 +339,17 @@ export function maintenanceRefresh(): Promise<void> {
|
|
|
283
339
|
return NitroArkHybridObject.maintenanceRefresh();
|
|
284
340
|
}
|
|
285
341
|
|
|
342
|
+
/**
|
|
343
|
+
* Refreshes the provided VTXOs in delegated mode.
|
|
344
|
+
* @param vtxoIds Array of VTXO ID strings to refresh.
|
|
345
|
+
* @returns A pending round state reference, or undefined if no VTXOs needed refresh.
|
|
346
|
+
*/
|
|
347
|
+
export function refreshVtxosDelegated(
|
|
348
|
+
vtxoIds: string[]
|
|
349
|
+
): Promise<DelegatedRoundState | undefined> {
|
|
350
|
+
return NitroArkHybridObject.refreshVtxosDelegated(vtxoIds);
|
|
351
|
+
}
|
|
352
|
+
|
|
286
353
|
/**
|
|
287
354
|
* Synchronizes the wallet with the blockchain.
|
|
288
355
|
* @returns A promise that resolves on success.
|
|
@@ -1005,6 +1072,17 @@ export function estimateBoardOffchainFee(
|
|
|
1005
1072
|
return NitroArkHybridObject.estimateBoardOffchainFee(amountSat);
|
|
1006
1073
|
}
|
|
1007
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* Estimates the Ark protocol fee for refreshing the provided VTXOs.
|
|
1077
|
+
* @param vtxoIds Array of VTXO ID strings to refresh.
|
|
1078
|
+
* @returns A promise resolving to the fee estimate.
|
|
1079
|
+
*/
|
|
1080
|
+
export function estimateRefreshFee(
|
|
1081
|
+
vtxoIds: string[]
|
|
1082
|
+
): Promise<BarkFeeEstimate> {
|
|
1083
|
+
return NitroArkHybridObject.estimateRefreshFee(vtxoIds);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1008
1086
|
/**
|
|
1009
1087
|
* Sends an onchain payment via an Ark round.
|
|
1010
1088
|
* @param destination The destination Bitcoin address.
|
|
@@ -1074,6 +1152,7 @@ export type {
|
|
|
1074
1152
|
BarkArkInfo,
|
|
1075
1153
|
Bolt11Invoice,
|
|
1076
1154
|
BoardResult,
|
|
1155
|
+
DelegatedRoundState,
|
|
1077
1156
|
BarkSendManyOutput,
|
|
1078
1157
|
ArkoorPaymentResult,
|
|
1079
1158
|
BarkFeeEstimate,
|