react-native-nitro-ark 0.0.58 → 0.0.60
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/jniLibs/arm64-v8a/libcxxbridge1.a +0 -0
- package/cpp/NitroArk.hpp +186 -44
- package/cpp/generated/ark_cxx.h +69 -5
- package/lib/module/index.js +70 -7
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +33 -6
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +60 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/BarkMovement.hpp +97 -0
- package/nitrogen/generated/shared/c++/BarkMovementRecipient.hpp +71 -0
- package/nitrogen/generated/shared/c++/BarkVtxo.hpp +6 -2
- package/nitrogen/generated/shared/c++/{LightningPaymentResult.hpp → Bolt11PaymentResult.hpp} +10 -10
- package/nitrogen/generated/shared/c++/Bolt12PaymentResult.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +8 -1
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +21 -8
- package/nitrogen/generated/shared/c++/PaymentTypes.hpp +7 -3
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +38 -6
- package/src/index.tsx +108 -13
|
@@ -23,6 +23,8 @@ namespace margelo::nitro::nitroark { struct OffchainBalanceResult; }
|
|
|
23
23
|
namespace margelo::nitro::nitroark { struct KeyPairResult; }
|
|
24
24
|
// Forward declaration of `NewAddressResult` to properly resolve imports.
|
|
25
25
|
namespace margelo::nitro::nitroark { struct NewAddressResult; }
|
|
26
|
+
// Forward declaration of `BarkMovement` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitroark { struct BarkMovement; }
|
|
26
28
|
// Forward declaration of `BarkVtxo` to properly resolve imports.
|
|
27
29
|
namespace margelo::nitro::nitroark { struct BarkVtxo; }
|
|
28
30
|
// Forward declaration of `OnchainBalanceResult` to properly resolve imports.
|
|
@@ -33,8 +35,10 @@ namespace margelo::nitro::nitroark { struct OnchainPaymentResult; }
|
|
|
33
35
|
namespace margelo::nitro::nitroark { struct BarkSendManyOutput; }
|
|
34
36
|
// Forward declaration of `ArkoorPaymentResult` to properly resolve imports.
|
|
35
37
|
namespace margelo::nitro::nitroark { struct ArkoorPaymentResult; }
|
|
36
|
-
// Forward declaration of `
|
|
37
|
-
namespace margelo::nitro::nitroark { struct
|
|
38
|
+
// Forward declaration of `Bolt11PaymentResult` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::nitroark { struct Bolt11PaymentResult; }
|
|
40
|
+
// Forward declaration of `Bolt12PaymentResult` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::nitroark { struct Bolt12PaymentResult; }
|
|
38
42
|
// Forward declaration of `LnurlPaymentResult` to properly resolve imports.
|
|
39
43
|
namespace margelo::nitro::nitroark { struct LnurlPaymentResult; }
|
|
40
44
|
// Forward declaration of `LightningReceive` to properly resolve imports.
|
|
@@ -47,14 +51,16 @@ namespace margelo::nitro::nitroark { struct LightningReceive; }
|
|
|
47
51
|
#include "OffchainBalanceResult.hpp"
|
|
48
52
|
#include "KeyPairResult.hpp"
|
|
49
53
|
#include "NewAddressResult.hpp"
|
|
50
|
-
#include "
|
|
54
|
+
#include "BarkMovement.hpp"
|
|
51
55
|
#include <vector>
|
|
56
|
+
#include "BarkVtxo.hpp"
|
|
57
|
+
#include <optional>
|
|
52
58
|
#include "OnchainBalanceResult.hpp"
|
|
53
59
|
#include "OnchainPaymentResult.hpp"
|
|
54
|
-
#include <optional>
|
|
55
60
|
#include "BarkSendManyOutput.hpp"
|
|
56
61
|
#include "ArkoorPaymentResult.hpp"
|
|
57
|
-
#include "
|
|
62
|
+
#include "Bolt11PaymentResult.hpp"
|
|
63
|
+
#include "Bolt12PaymentResult.hpp"
|
|
58
64
|
#include "LnurlPaymentResult.hpp"
|
|
59
65
|
#include "LightningReceive.hpp"
|
|
60
66
|
|
|
@@ -94,7 +100,9 @@ namespace margelo::nitro::nitroark {
|
|
|
94
100
|
virtual std::shared_ptr<Promise<void>> loadWallet(const std::string& datadir, const BarkCreateOpts& config) = 0;
|
|
95
101
|
virtual std::shared_ptr<Promise<bool>> isWalletLoaded() = 0;
|
|
96
102
|
virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
|
|
103
|
+
virtual std::shared_ptr<Promise<void>> registerAllConfirmedBoards() = 0;
|
|
97
104
|
virtual std::shared_ptr<Promise<void>> maintenance() = 0;
|
|
105
|
+
virtual std::shared_ptr<Promise<void>> maintenanceWithOnchain() = 0;
|
|
98
106
|
virtual std::shared_ptr<Promise<void>> maintenanceRefresh() = 0;
|
|
99
107
|
virtual std::shared_ptr<Promise<void>> sync() = 0;
|
|
100
108
|
virtual std::shared_ptr<Promise<void>> syncExits() = 0;
|
|
@@ -108,7 +116,10 @@ namespace margelo::nitro::nitroark {
|
|
|
108
116
|
virtual std::shared_ptr<Promise<std::string>> signMesssageWithMnemonic(const std::string& message, const std::string& mnemonic, const std::string& network, double index) = 0;
|
|
109
117
|
virtual std::shared_ptr<Promise<KeyPairResult>> deriveKeypairFromMnemonic(const std::string& mnemonic, const std::string& network, double index) = 0;
|
|
110
118
|
virtual std::shared_ptr<Promise<bool>> verifyMessage(const std::string& message, const std::string& signature, const std::string& publicKey) = 0;
|
|
111
|
-
virtual std::shared_ptr<Promise<std::vector<
|
|
119
|
+
virtual std::shared_ptr<Promise<std::vector<BarkMovement>>> movements(double pageIndex, double pageSize) = 0;
|
|
120
|
+
virtual std::shared_ptr<Promise<std::vector<BarkVtxo>>> vtxos() = 0;
|
|
121
|
+
virtual std::shared_ptr<Promise<std::optional<double>>> getFirstExpiringVtxoBlockheight() = 0;
|
|
122
|
+
virtual std::shared_ptr<Promise<std::optional<double>>> getNextRequiredRefreshBlockheight() = 0;
|
|
112
123
|
virtual std::shared_ptr<Promise<std::vector<BarkVtxo>>> getExpiringVtxos(double threshold) = 0;
|
|
113
124
|
virtual std::shared_ptr<Promise<OnchainBalanceResult>> onchainBalance() = 0;
|
|
114
125
|
virtual std::shared_ptr<Promise<void>> onchainSync() = 0;
|
|
@@ -122,11 +133,13 @@ namespace margelo::nitro::nitroark {
|
|
|
122
133
|
virtual std::shared_ptr<Promise<std::string>> boardAll() = 0;
|
|
123
134
|
virtual std::shared_ptr<Promise<void>> validateArkoorAddress(const std::string& address) = 0;
|
|
124
135
|
virtual std::shared_ptr<Promise<ArkoorPaymentResult>> sendArkoorPayment(const std::string& destination, double amountSat) = 0;
|
|
125
|
-
virtual std::shared_ptr<Promise<
|
|
136
|
+
virtual std::shared_ptr<Promise<Bolt11PaymentResult>> sendLightningPayment(const std::string& destination, std::optional<double> amountSat) = 0;
|
|
137
|
+
virtual std::shared_ptr<Promise<Bolt12PaymentResult>> payOffer(const std::string& offer, std::optional<double> amountSat) = 0;
|
|
126
138
|
virtual std::shared_ptr<Promise<LnurlPaymentResult>> sendLnaddr(const std::string& addr, double amountSat, const std::string& comment) = 0;
|
|
127
139
|
virtual std::shared_ptr<Promise<std::string>> sendRoundOnchainPayment(const std::string& destination, double amountSat) = 0;
|
|
128
140
|
virtual std::shared_ptr<Promise<std::string>> bolt11Invoice(double amountMsat) = 0;
|
|
129
|
-
virtual std::shared_ptr<Promise<std::optional<LightningReceive>>> lightningReceiveStatus(const std::string&
|
|
141
|
+
virtual std::shared_ptr<Promise<std::optional<LightningReceive>>> lightningReceiveStatus(const std::string& paymentHash) = 0;
|
|
142
|
+
virtual std::shared_ptr<Promise<std::vector<LightningReceive>>> lightningReceives(double pageSize, double pageIndex) = 0;
|
|
130
143
|
virtual std::shared_ptr<Promise<void>> finishLightningReceive(const std::string& bolt11) = 0;
|
|
131
144
|
virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::vector<std::string>& vtxoIds, const std::string& destinationAddress) = 0;
|
|
132
145
|
virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::string& destinationAddress) = 0;
|
|
@@ -30,9 +30,10 @@ namespace margelo::nitro::nitroark {
|
|
|
30
30
|
*/
|
|
31
31
|
enum class PaymentTypes {
|
|
32
32
|
BOLT11 SWIFT_NAME(bolt11) = 0,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
BOLT12 SWIFT_NAME(bolt12) = 1,
|
|
34
|
+
LNURL SWIFT_NAME(lnurl) = 2,
|
|
35
|
+
ARKOOR SWIFT_NAME(arkoor) = 3,
|
|
36
|
+
ONCHAIN SWIFT_NAME(onchain) = 4,
|
|
36
37
|
} CLOSED_ENUM;
|
|
37
38
|
|
|
38
39
|
} // namespace margelo::nitro::nitroark
|
|
@@ -46,6 +47,7 @@ namespace margelo::nitro {
|
|
|
46
47
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
48
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
49
|
case hashString("Bolt11"): return margelo::nitro::nitroark::PaymentTypes::BOLT11;
|
|
50
|
+
case hashString("Bolt12"): return margelo::nitro::nitroark::PaymentTypes::BOLT12;
|
|
49
51
|
case hashString("Lnurl"): return margelo::nitro::nitroark::PaymentTypes::LNURL;
|
|
50
52
|
case hashString("Arkoor"): return margelo::nitro::nitroark::PaymentTypes::ARKOOR;
|
|
51
53
|
case hashString("Onchain"): return margelo::nitro::nitroark::PaymentTypes::ONCHAIN;
|
|
@@ -56,6 +58,7 @@ namespace margelo::nitro {
|
|
|
56
58
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitroark::PaymentTypes arg) {
|
|
57
59
|
switch (arg) {
|
|
58
60
|
case margelo::nitro::nitroark::PaymentTypes::BOLT11: return JSIConverter<std::string>::toJSI(runtime, "Bolt11");
|
|
61
|
+
case margelo::nitro::nitroark::PaymentTypes::BOLT12: return JSIConverter<std::string>::toJSI(runtime, "Bolt12");
|
|
59
62
|
case margelo::nitro::nitroark::PaymentTypes::LNURL: return JSIConverter<std::string>::toJSI(runtime, "Lnurl");
|
|
60
63
|
case margelo::nitro::nitroark::PaymentTypes::ARKOOR: return JSIConverter<std::string>::toJSI(runtime, "Arkoor");
|
|
61
64
|
case margelo::nitro::nitroark::PaymentTypes::ONCHAIN: return JSIConverter<std::string>::toJSI(runtime, "Onchain");
|
|
@@ -71,6 +74,7 @@ namespace margelo::nitro {
|
|
|
71
74
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
75
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
76
|
case hashString("Bolt11"):
|
|
77
|
+
case hashString("Bolt12"):
|
|
74
78
|
case hashString("Lnurl"):
|
|
75
79
|
case hashString("Arkoor"):
|
|
76
80
|
case hashString("Onchain"):
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -40,16 +40,17 @@ export interface BarkSendManyOutput {
|
|
|
40
40
|
amountSat: number; // uint64_t -> number
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
interface BarkVtxo {
|
|
44
44
|
amount: number; // u64
|
|
45
45
|
expiry_height: number; // u32
|
|
46
46
|
server_pubkey: string;
|
|
47
47
|
exit_delta: number; // u16
|
|
48
48
|
anchor_point: string;
|
|
49
49
|
point: string;
|
|
50
|
+
state: string;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
export type PaymentTypes = 'Bolt11' | 'Lnurl' | 'Arkoor' | 'Onchain';
|
|
53
|
+
export type PaymentTypes = 'Bolt11' | 'Bolt12' | 'Lnurl' | 'Arkoor' | 'Onchain';
|
|
53
54
|
|
|
54
55
|
export interface ArkoorPaymentResult {
|
|
55
56
|
amount_sat: number; // u64
|
|
@@ -58,12 +59,18 @@ export interface ArkoorPaymentResult {
|
|
|
58
59
|
payment_type: PaymentTypes; // 'Arkoor'
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
export interface
|
|
62
|
+
export interface Bolt11PaymentResult {
|
|
62
63
|
bolt11_invoice: string;
|
|
63
64
|
preimage: string;
|
|
64
65
|
payment_type: PaymentTypes; // 'Lightning'
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
export interface Bolt12PaymentResult {
|
|
69
|
+
bolt12_offer: string;
|
|
70
|
+
preimage: string;
|
|
71
|
+
payment_type: PaymentTypes; // 'Bolt12'
|
|
72
|
+
}
|
|
73
|
+
|
|
67
74
|
export interface LnurlPaymentResult {
|
|
68
75
|
lnurl: string;
|
|
69
76
|
bolt11_invoice: string;
|
|
@@ -114,6 +121,21 @@ export interface LightningReceive {
|
|
|
114
121
|
preimage_revealed_at?: number;
|
|
115
122
|
}
|
|
116
123
|
|
|
124
|
+
export interface BarkMovementRecipient {
|
|
125
|
+
recipient: string;
|
|
126
|
+
amount_sat: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface BarkMovement {
|
|
130
|
+
id: number;
|
|
131
|
+
kind: string;
|
|
132
|
+
fees: number;
|
|
133
|
+
spends: BarkVtxo[];
|
|
134
|
+
receives: BarkVtxo[];
|
|
135
|
+
recipients: BarkMovementRecipient[];
|
|
136
|
+
created_at: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
117
139
|
// --- Nitro Module Interface ---
|
|
118
140
|
|
|
119
141
|
export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
@@ -123,7 +145,9 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
123
145
|
loadWallet(datadir: string, config: BarkCreateOpts): Promise<void>;
|
|
124
146
|
isWalletLoaded(): Promise<boolean>;
|
|
125
147
|
closeWallet(): Promise<void>;
|
|
148
|
+
registerAllConfirmedBoards(): Promise<void>;
|
|
126
149
|
maintenance(): Promise<void>;
|
|
150
|
+
maintenanceWithOnchain(): Promise<void>;
|
|
127
151
|
maintenanceRefresh(): Promise<void>;
|
|
128
152
|
sync(): Promise<void>;
|
|
129
153
|
syncExits(): Promise<void>;
|
|
@@ -152,7 +176,10 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
152
176
|
signature: string,
|
|
153
177
|
publicKey: string
|
|
154
178
|
): Promise<boolean>;
|
|
155
|
-
|
|
179
|
+
movements(pageIndex: number, pageSize: number): Promise<BarkMovement[]>;
|
|
180
|
+
vtxos(): Promise<BarkVtxo[]>;
|
|
181
|
+
getFirstExpiringVtxoBlockheight(): Promise<number | undefined>;
|
|
182
|
+
getNextRequiredRefreshBlockheight(): Promise<number | undefined>;
|
|
156
183
|
getExpiringVtxos(threshold: number): Promise<BarkVtxo[]>;
|
|
157
184
|
|
|
158
185
|
// --- Onchain Operations ---
|
|
@@ -189,7 +216,8 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
189
216
|
sendLightningPayment(
|
|
190
217
|
destination: string,
|
|
191
218
|
amountSat?: number
|
|
192
|
-
): Promise<
|
|
219
|
+
): Promise<Bolt11PaymentResult>;
|
|
220
|
+
payOffer(offer: string, amountSat?: number): Promise<Bolt12PaymentResult>;
|
|
193
221
|
sendLnaddr(
|
|
194
222
|
addr: string,
|
|
195
223
|
amountSat: number,
|
|
@@ -203,8 +231,12 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
203
231
|
// --- Lightning Invoicing ---
|
|
204
232
|
bolt11Invoice(amountMsat: number): Promise<string>; // Returns invoice string
|
|
205
233
|
lightningReceiveStatus(
|
|
206
|
-
|
|
234
|
+
paymentHash: string
|
|
207
235
|
): Promise<LightningReceive | undefined>;
|
|
236
|
+
lightningReceives(
|
|
237
|
+
pageSize: number,
|
|
238
|
+
pageIndex: number
|
|
239
|
+
): Promise<LightningReceive[]>;
|
|
208
240
|
finishLightningReceive(bolt11: string): Promise<void>; // Throws on error
|
|
209
241
|
|
|
210
242
|
// --- Offboarding / Exiting ---
|
package/src/index.tsx
CHANGED
|
@@ -5,17 +5,34 @@ import type {
|
|
|
5
5
|
BarkArkInfo,
|
|
6
6
|
BarkSendManyOutput,
|
|
7
7
|
ArkoorPaymentResult,
|
|
8
|
-
|
|
8
|
+
Bolt11PaymentResult,
|
|
9
|
+
Bolt12PaymentResult,
|
|
9
10
|
LnurlPaymentResult,
|
|
10
11
|
OnchainPaymentResult,
|
|
11
|
-
BarkVtxo,
|
|
12
12
|
OffchainBalanceResult,
|
|
13
13
|
OnchainBalanceResult,
|
|
14
14
|
NewAddressResult,
|
|
15
15
|
KeyPairResult,
|
|
16
16
|
LightningReceive,
|
|
17
|
+
BarkMovement,
|
|
17
18
|
} from './NitroArk.nitro';
|
|
18
19
|
|
|
20
|
+
export type BarkVtxo = {
|
|
21
|
+
amount: number; // u64
|
|
22
|
+
expiry_height: number; // u32
|
|
23
|
+
server_pubkey: string;
|
|
24
|
+
exit_delta: number; // u16
|
|
25
|
+
anchor_point: string;
|
|
26
|
+
point: string;
|
|
27
|
+
state:
|
|
28
|
+
| 'Spendable'
|
|
29
|
+
| 'Spent'
|
|
30
|
+
| 'UnregisteredBoard'
|
|
31
|
+
| 'PendingLightningSend'
|
|
32
|
+
| 'PendingLightningRecv'
|
|
33
|
+
| 'Unknown';
|
|
34
|
+
};
|
|
35
|
+
|
|
19
36
|
// Create the hybrid object instance
|
|
20
37
|
export const NitroArkHybridObject =
|
|
21
38
|
NitroModules.createHybridObject<NitroArk>('NitroArk');
|
|
@@ -74,13 +91,31 @@ export function isWalletLoaded(): Promise<boolean> {
|
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
/**
|
|
77
|
-
*
|
|
94
|
+
* Registers all confirmed boards.
|
|
95
|
+
* @returns A promise that resolves on success.
|
|
96
|
+
*/
|
|
97
|
+
export function registerAllConfirmedBoards(): Promise<void> {
|
|
98
|
+
return NitroArkHybridObject.registerAllConfirmedBoards();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Runs wallet maintenance tasks for offchain.
|
|
103
|
+
* This includes refreshing vtxos that need to be refreshed.
|
|
78
104
|
* @returns A promise that resolves on success.
|
|
79
105
|
*/
|
|
80
106
|
export function maintenance(): Promise<void> {
|
|
81
107
|
return NitroArkHybridObject.maintenance();
|
|
82
108
|
}
|
|
83
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Runs wallet maintenance tasks for both offchain and onchain.
|
|
112
|
+
* This includes refreshing vtxos that need to be refreshed.
|
|
113
|
+
* @returns A promise that resolves on success.
|
|
114
|
+
*/
|
|
115
|
+
export function maintenanceWithOnchain(): Promise<void> {
|
|
116
|
+
return NitroArkHybridObject.maintenanceWithOnchain();
|
|
117
|
+
}
|
|
118
|
+
|
|
84
119
|
/**
|
|
85
120
|
* Refreshes vtxos that need to be refreshed.
|
|
86
121
|
* @returns A promise that resolves on success.
|
|
@@ -223,13 +258,44 @@ export function verifyMessage(
|
|
|
223
258
|
return NitroArkHybridObject.verifyMessage(message, signature, publicKey);
|
|
224
259
|
}
|
|
225
260
|
|
|
261
|
+
/**
|
|
262
|
+
* Gets a paginated list of wallet movements (balance changes).
|
|
263
|
+
* @param pageIndex The index of the page to retrieve (0-based).
|
|
264
|
+
* @param pageSize The number of movements per page.
|
|
265
|
+
* @returns A promise resolving to an array of BarkMovement objects.
|
|
266
|
+
*/
|
|
267
|
+
export function movements(
|
|
268
|
+
pageIndex: number,
|
|
269
|
+
pageSize: number
|
|
270
|
+
): Promise<BarkMovement[]> {
|
|
271
|
+
return NitroArkHybridObject.movements(pageIndex, pageSize);
|
|
272
|
+
}
|
|
273
|
+
|
|
226
274
|
/**
|
|
227
275
|
* Gets the list of VTXOs as a JSON string for the loaded wallet.
|
|
228
276
|
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
229
277
|
* @returns A promise resolving BarkVtxo[] array.
|
|
230
278
|
*/
|
|
231
|
-
export function
|
|
232
|
-
return NitroArkHybridObject.
|
|
279
|
+
export function vtxos(): Promise<BarkVtxo[]> {
|
|
280
|
+
return NitroArkHybridObject.vtxos() as Promise<BarkVtxo[]>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Gets the first expiring VTXO blockheight for the loaded wallet.
|
|
285
|
+
* @returns A promise resolving to the first expiring VTXO blockheight.
|
|
286
|
+
*/
|
|
287
|
+
export function getFirstExpiringVtxoBlockheight(): Promise<number | undefined> {
|
|
288
|
+
return NitroArkHybridObject.getFirstExpiringVtxoBlockheight();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Gets the next required refresh blockheight for the loaded wallet for the first expiring VTXO.
|
|
293
|
+
* @returns A promise resolving to the next required refresh blockheight.
|
|
294
|
+
*/
|
|
295
|
+
export function getNextRequiredRefreshBlockheight(): Promise<
|
|
296
|
+
number | undefined
|
|
297
|
+
> {
|
|
298
|
+
return NitroArkHybridObject.getNextRequiredRefreshBlockheight();
|
|
233
299
|
}
|
|
234
300
|
|
|
235
301
|
/**
|
|
@@ -239,7 +305,9 @@ export function getVtxos(): Promise<BarkVtxo[]> {
|
|
|
239
305
|
*/
|
|
240
306
|
|
|
241
307
|
export function getExpiringVtxos(threshold: number): Promise<BarkVtxo[]> {
|
|
242
|
-
return NitroArkHybridObject.getExpiringVtxos(threshold)
|
|
308
|
+
return NitroArkHybridObject.getExpiringVtxos(threshold) as Promise<
|
|
309
|
+
BarkVtxo[]
|
|
310
|
+
>;
|
|
243
311
|
}
|
|
244
312
|
|
|
245
313
|
// --- Onchain Operations ---
|
|
@@ -330,14 +398,26 @@ export function bolt11Invoice(amountMsat: number): Promise<string> {
|
|
|
330
398
|
|
|
331
399
|
/**
|
|
332
400
|
* Gets the status of a Lightning receive.
|
|
333
|
-
* @param
|
|
401
|
+
* @param paymentHash The payment hash of the Lightning receive.
|
|
334
402
|
* @returns A promise resolving to the Lightning receive status.
|
|
335
403
|
*/
|
|
336
|
-
|
|
337
404
|
export function lightningReceiveStatus(
|
|
338
|
-
|
|
405
|
+
paymentHash: string
|
|
339
406
|
): Promise<LightningReceive | undefined> {
|
|
340
|
-
return NitroArkHybridObject.lightningReceiveStatus(
|
|
407
|
+
return NitroArkHybridObject.lightningReceiveStatus(paymentHash);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Gets a page of Lightning receives.
|
|
412
|
+
* @param pageSize The number of items to retrieve.
|
|
413
|
+
* @param pageIndex The index of the page to retrieve.
|
|
414
|
+
* @returns A promise resolving to an array of Lightning receives.
|
|
415
|
+
*/
|
|
416
|
+
export function lightningReceives(
|
|
417
|
+
pageSize: number,
|
|
418
|
+
pageIndex: number
|
|
419
|
+
): Promise<LightningReceive[]> {
|
|
420
|
+
return NitroArkHybridObject.lightningReceives(pageSize, pageIndex);
|
|
341
421
|
}
|
|
342
422
|
|
|
343
423
|
/**
|
|
@@ -353,15 +433,28 @@ export function finishLightningReceive(bolt11: string): Promise<void> {
|
|
|
353
433
|
* Sends a Lightning payment.
|
|
354
434
|
* @param destination The Lightning invoice.
|
|
355
435
|
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
356
|
-
* @returns A promise resolving to a
|
|
436
|
+
* @returns A promise resolving to a Bolt11PaymentResult object
|
|
357
437
|
*/
|
|
358
438
|
export function sendLightningPayment(
|
|
359
439
|
destination: string,
|
|
360
440
|
amountSat?: number
|
|
361
|
-
): Promise<
|
|
441
|
+
): Promise<Bolt11PaymentResult> {
|
|
362
442
|
return NitroArkHybridObject.sendLightningPayment(destination, amountSat);
|
|
363
443
|
}
|
|
364
444
|
|
|
445
|
+
/**
|
|
446
|
+
* Sends a payment to a Bolt12 offer.
|
|
447
|
+
* @param offer The Bolt12 offer.
|
|
448
|
+
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
449
|
+
* @returns A promise resolving to a Bolt12PaymentResult object
|
|
450
|
+
*/
|
|
451
|
+
export function payOffer(
|
|
452
|
+
offer: string,
|
|
453
|
+
amountSat?: number
|
|
454
|
+
): Promise<Bolt12PaymentResult> {
|
|
455
|
+
return NitroArkHybridObject.payOffer(offer, amountSat);
|
|
456
|
+
}
|
|
457
|
+
|
|
365
458
|
/**
|
|
366
459
|
* Sends a payment to a Lightning Address.
|
|
367
460
|
* @param addr The Lightning Address.
|
|
@@ -465,7 +558,7 @@ export type {
|
|
|
465
558
|
BarkArkInfo,
|
|
466
559
|
BarkSendManyOutput,
|
|
467
560
|
ArkoorPaymentResult,
|
|
468
|
-
|
|
561
|
+
Bolt11PaymentResult,
|
|
469
562
|
LnurlPaymentResult,
|
|
470
563
|
OnchainPaymentResult,
|
|
471
564
|
PaymentTypes,
|
|
@@ -474,4 +567,6 @@ export type {
|
|
|
474
567
|
NewAddressResult,
|
|
475
568
|
KeyPairResult,
|
|
476
569
|
LightningReceive,
|
|
570
|
+
BarkMovement,
|
|
571
|
+
BarkMovementRecipient,
|
|
477
572
|
} from './NitroArk.nitro';
|