react-native-nitro-ark 0.0.38 → 0.0.40
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/cpp/NitroArk.hpp +594 -558
- package/cpp/generated/ark_cxx.h +68 -22
- package/lib/module/index.js +93 -91
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +35 -18
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +65 -66
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +16 -15
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +35 -22
- package/nitrogen/generated/shared/c++/{Bolt11PaymentResult.hpp → LightningPaymentResult.hpp} +10 -10
- package/nitrogen/generated/shared/c++/NewAddressResult.hpp +77 -0
- package/nitrogen/generated/shared/c++/OffchainBalanceResult.hpp +77 -0
- package/nitrogen/generated/shared/c++/OnchainBalanceResult.hpp +81 -0
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +55 -25
- package/src/index.tsx +112 -108
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// OnchainBalanceResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 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
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::nitroark {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A struct which can be represented as a JavaScript object (OnchainBalanceResult).
|
|
29
|
+
*/
|
|
30
|
+
struct OnchainBalanceResult {
|
|
31
|
+
public:
|
|
32
|
+
double immature SWIFT_PRIVATE;
|
|
33
|
+
double trusted_pending SWIFT_PRIVATE;
|
|
34
|
+
double untrusted_pending SWIFT_PRIVATE;
|
|
35
|
+
double confirmed SWIFT_PRIVATE;
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
OnchainBalanceResult() = default;
|
|
39
|
+
explicit OnchainBalanceResult(double immature, double trusted_pending, double untrusted_pending, double confirmed): immature(immature), trusted_pending(trusted_pending), untrusted_pending(untrusted_pending), confirmed(confirmed) {}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
} // namespace margelo::nitro::nitroark
|
|
43
|
+
|
|
44
|
+
namespace margelo::nitro {
|
|
45
|
+
|
|
46
|
+
using namespace margelo::nitro::nitroark;
|
|
47
|
+
|
|
48
|
+
// C++ OnchainBalanceResult <> JS OnchainBalanceResult (object)
|
|
49
|
+
template <>
|
|
50
|
+
struct JSIConverter<OnchainBalanceResult> final {
|
|
51
|
+
static inline OnchainBalanceResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
+
return OnchainBalanceResult(
|
|
54
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "immature")),
|
|
55
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "trusted_pending")),
|
|
56
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "untrusted_pending")),
|
|
57
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "confirmed"))
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const OnchainBalanceResult& arg) {
|
|
61
|
+
jsi::Object obj(runtime);
|
|
62
|
+
obj.setProperty(runtime, "immature", JSIConverter<double>::toJSI(runtime, arg.immature));
|
|
63
|
+
obj.setProperty(runtime, "trusted_pending", JSIConverter<double>::toJSI(runtime, arg.trusted_pending));
|
|
64
|
+
obj.setProperty(runtime, "untrusted_pending", JSIConverter<double>::toJSI(runtime, arg.untrusted_pending));
|
|
65
|
+
obj.setProperty(runtime, "confirmed", JSIConverter<double>::toJSI(runtime, arg.confirmed));
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
69
|
+
if (!value.isObject()) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
jsi::Object obj = value.getObject(runtime);
|
|
73
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "immature"))) return false;
|
|
74
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "trusted_pending"))) return false;
|
|
75
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "untrusted_pending"))) return false;
|
|
76
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "confirmed"))) return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -56,10 +56,10 @@ export interface ArkoorPaymentResult {
|
|
|
56
56
|
payment_type: PaymentTypes; // 'Arkoor'
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export interface
|
|
59
|
+
export interface LightningPaymentResult {
|
|
60
60
|
bolt11_invoice: string;
|
|
61
61
|
preimage: string;
|
|
62
|
-
payment_type: PaymentTypes; // '
|
|
62
|
+
payment_type: PaymentTypes; // 'Lightning'
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export interface LnurlPaymentResult {
|
|
@@ -76,39 +76,73 @@ export interface OnchainPaymentResult {
|
|
|
76
76
|
payment_type: PaymentTypes; // 'Onchain'
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
export interface OffchainBalanceResult {
|
|
80
|
+
spendable: number; // u64
|
|
81
|
+
pending_lightning_send: number; // u64
|
|
82
|
+
pending_exit: number; // u64
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface OnchainBalanceResult {
|
|
86
|
+
// All coinbase outputs not yet matured
|
|
87
|
+
immature: number;
|
|
88
|
+
// Unconfirmed UTXOs generated by a wallet tx
|
|
89
|
+
trusted_pending: number;
|
|
90
|
+
// Unconfirmed UTXOs received from an external wallet
|
|
91
|
+
untrusted_pending: number;
|
|
92
|
+
// Confirmed and immediately spendable balance
|
|
93
|
+
confirmed: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface NewAddressResult {
|
|
97
|
+
user_pubkey: string;
|
|
98
|
+
ark_id: string;
|
|
99
|
+
address: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
79
102
|
// --- Nitro Module Interface ---
|
|
80
103
|
|
|
81
104
|
export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
82
105
|
// --- Management ---
|
|
83
106
|
createMnemonic(): Promise<string>;
|
|
84
107
|
loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
|
|
85
|
-
closeWallet(): Promise<void>;
|
|
86
108
|
isWalletLoaded(): Promise<boolean>;
|
|
109
|
+
closeWallet(): Promise<void>;
|
|
87
110
|
persistConfig(opts: BarkConfigOpts): Promise<void>;
|
|
88
111
|
maintenance(): Promise<void>;
|
|
89
112
|
sync(): Promise<void>;
|
|
90
|
-
|
|
113
|
+
syncExits(): Promise<void>;
|
|
91
114
|
syncRounds(): Promise<void>;
|
|
92
115
|
|
|
93
116
|
// --- Wallet Info ---
|
|
94
117
|
getArkInfo(): Promise<BarkArkInfo>;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
getVtxos(no_sync: boolean): Promise<string>; // Returns JSON string
|
|
118
|
+
offchainBalance(): Promise<OffchainBalanceResult>;
|
|
119
|
+
deriveStoreNextKeypair(): Promise<string>;
|
|
120
|
+
peakKeyPair(index: number): Promise<string>;
|
|
121
|
+
newAddress(): Promise<NewAddressResult>;
|
|
122
|
+
getVtxos(): Promise<BarkVtxo[]>; // Returns JSON string
|
|
101
123
|
|
|
102
124
|
// --- Onchain Operations ---
|
|
103
|
-
|
|
125
|
+
onchainBalance(): Promise<OnchainBalanceResult>;
|
|
126
|
+
onchainSync(): Promise<void>;
|
|
127
|
+
onchainListUnspent(): Promise<string>; // Returns JSON string
|
|
128
|
+
onchainUtxos(): Promise<string>; // Returns JSON string
|
|
129
|
+
onchainAddress(): Promise<string>; // Returns address string
|
|
130
|
+
onchainSend(
|
|
104
131
|
destination: string,
|
|
105
|
-
amountSat: number
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
132
|
+
amountSat: number,
|
|
133
|
+
feeRate?: number // Optional fee rate in sat/vB
|
|
134
|
+
): Promise<OnchainPaymentResult>; // Returns txid and details
|
|
135
|
+
// Note: feeRate is optional, if not provided, default fee rate will be used
|
|
136
|
+
onchainDrain(
|
|
137
|
+
destination: string,
|
|
138
|
+
feeRate?: number // Optional fee rate in sat/vB
|
|
139
|
+
): Promise<string>; // Returns txid
|
|
140
|
+
// Note: feeRate is optional, if not provided, default fee rate will be used
|
|
141
|
+
onchainSendMany(
|
|
109
142
|
outputs: BarkSendManyOutput[],
|
|
110
|
-
|
|
143
|
+
feeRate?: number // Optional fee rate in sat/vB
|
|
111
144
|
): Promise<string>; // Returns txid
|
|
145
|
+
// Note: feeRate is optional, if not provided, default fee rate will be used
|
|
112
146
|
|
|
113
147
|
// --- Ark & Lightning Payments ---
|
|
114
148
|
boardAmount(amountSat: number): Promise<string>; // Returns JSON status
|
|
@@ -117,24 +151,23 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
117
151
|
destination: string,
|
|
118
152
|
amountSat: number
|
|
119
153
|
): Promise<ArkoorPaymentResult>;
|
|
120
|
-
|
|
154
|
+
sendLightningPayment(
|
|
121
155
|
destination: string,
|
|
122
156
|
amountSat?: number
|
|
123
|
-
): Promise<
|
|
157
|
+
): Promise<LightningPaymentResult>;
|
|
124
158
|
sendLnaddr(
|
|
125
159
|
addr: string,
|
|
126
160
|
amountSat: number,
|
|
127
161
|
comment: string
|
|
128
162
|
): Promise<LnurlPaymentResult>;
|
|
129
|
-
|
|
163
|
+
sendRoundOnchainPayment(
|
|
130
164
|
destination: string,
|
|
131
|
-
amountSat: number
|
|
132
|
-
no_sync: boolean
|
|
165
|
+
amountSat: number
|
|
133
166
|
): Promise<string>; // Returns JSON status
|
|
134
167
|
|
|
135
168
|
// --- Lightning Invoicing ---
|
|
136
169
|
bolt11Invoice(amountMsat: number): Promise<string>; // Returns invoice string
|
|
137
|
-
|
|
170
|
+
finishLightningReceive(bolt11: string): Promise<void>; // Throws on error
|
|
138
171
|
|
|
139
172
|
// --- Offboarding / Exiting ---
|
|
140
173
|
offboardSpecific(
|
|
@@ -142,7 +175,4 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
142
175
|
destinationAddress: string
|
|
143
176
|
): Promise<string>; // Returns JSON result
|
|
144
177
|
offboardAll(destinationAddress: string): Promise<string>; // Returns JSON result
|
|
145
|
-
exitStartSpecific(vtxoIds: string[]): Promise<string>;
|
|
146
|
-
startExitForEntireWallet(): Promise<void>;
|
|
147
|
-
exitProgressOnce(): Promise<string>;
|
|
148
178
|
}
|
package/src/index.tsx
CHANGED
|
@@ -6,9 +6,13 @@ import type {
|
|
|
6
6
|
BarkArkInfo,
|
|
7
7
|
BarkSendManyOutput,
|
|
8
8
|
ArkoorPaymentResult,
|
|
9
|
-
|
|
9
|
+
LightningPaymentResult,
|
|
10
10
|
LnurlPaymentResult,
|
|
11
11
|
OnchainPaymentResult,
|
|
12
|
+
BarkVtxo,
|
|
13
|
+
OffchainBalanceResult,
|
|
14
|
+
OnchainBalanceResult,
|
|
15
|
+
NewAddressResult,
|
|
12
16
|
} from './NitroArk.nitro';
|
|
13
17
|
|
|
14
18
|
// Create the hybrid object instance
|
|
@@ -81,11 +85,11 @@ export function sync(): Promise<void> {
|
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
/**
|
|
84
|
-
* Synchronizes the Ark-specific
|
|
88
|
+
* Synchronizes the Ark-specific exits.
|
|
85
89
|
* @returns A promise that resolves on success.
|
|
86
90
|
*/
|
|
87
|
-
export function
|
|
88
|
-
return NitroArkHybridObject.
|
|
91
|
+
export function syncExits(): Promise<void> {
|
|
92
|
+
return NitroArkHybridObject.syncExits();
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
/**
|
|
@@ -106,97 +110,121 @@ export function getArkInfo(): Promise<BarkArkInfo> {
|
|
|
106
110
|
return NitroArkHybridObject.getArkInfo();
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
/**
|
|
110
|
-
* Gets the onchain balance for the loaded wallet.
|
|
111
|
-
* @returns A promise resolving to the onchain balance in satoshis.
|
|
112
|
-
*/
|
|
113
|
-
export function onchainBalance(): Promise<number> {
|
|
114
|
-
return NitroArkHybridObject.onchainBalance();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
113
|
/**
|
|
118
114
|
* Gets the offchain balance for the loaded wallet.
|
|
119
|
-
* @returns A promise resolving to the
|
|
115
|
+
* @returns A promise resolving to the OffchainBalanceResult object.
|
|
120
116
|
*/
|
|
121
|
-
export function offchainBalance(): Promise<
|
|
117
|
+
export function offchainBalance(): Promise<OffchainBalanceResult> {
|
|
122
118
|
return NitroArkHybridObject.offchainBalance();
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
/**
|
|
126
|
-
*
|
|
127
|
-
* @returns A promise resolving to the
|
|
122
|
+
* Derives the next keypair for the store.
|
|
123
|
+
* @returns A promise resolving to the hex-encoded public key string.
|
|
128
124
|
*/
|
|
129
|
-
export function
|
|
130
|
-
return NitroArkHybridObject.
|
|
125
|
+
export function deriveStoreNextKeypair(): Promise<string> {
|
|
126
|
+
return NitroArkHybridObject.deriveStoreNextKeypair();
|
|
131
127
|
}
|
|
132
128
|
|
|
133
129
|
/**
|
|
134
|
-
* Gets the
|
|
135
|
-
* @param
|
|
136
|
-
* @returns A promise resolving to the
|
|
130
|
+
* Gets the wallet's VTXO public key (hex string).
|
|
131
|
+
* @param index Index of the VTXO pubkey to retrieve.
|
|
132
|
+
* @returns A promise resolving to the hex-encoded public key string.
|
|
137
133
|
*/
|
|
138
|
-
export function
|
|
139
|
-
return NitroArkHybridObject.
|
|
134
|
+
export function peakKeyPair(index: number): Promise<string> {
|
|
135
|
+
return NitroArkHybridObject.peakKeyPair(index);
|
|
140
136
|
}
|
|
141
137
|
|
|
142
138
|
/**
|
|
143
|
-
* Gets the wallet's
|
|
144
|
-
* @
|
|
145
|
-
* @returns A promise resolving to the hex-encoded public key string.
|
|
139
|
+
* Gets the wallet's Address.
|
|
140
|
+
* @returns A promise resolving to NewAddressResult object.
|
|
146
141
|
*/
|
|
147
|
-
export function
|
|
148
|
-
return NitroArkHybridObject.
|
|
142
|
+
export function newAddress(): Promise<NewAddressResult> {
|
|
143
|
+
return NitroArkHybridObject.newAddress();
|
|
149
144
|
}
|
|
150
145
|
|
|
151
146
|
/**
|
|
152
147
|
* Gets the list of VTXOs as a JSON string for the loaded wallet.
|
|
153
148
|
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
154
|
-
* @returns A promise resolving
|
|
149
|
+
* @returns A promise resolving BarkVtxo[] array.
|
|
155
150
|
*/
|
|
156
|
-
export function getVtxos(
|
|
157
|
-
return NitroArkHybridObject.getVtxos(
|
|
151
|
+
export function getVtxos(): Promise<BarkVtxo[]> {
|
|
152
|
+
return NitroArkHybridObject.getVtxos();
|
|
158
153
|
}
|
|
159
154
|
|
|
160
155
|
// --- Onchain Operations ---
|
|
161
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Gets the onchain balance for the loaded wallet.
|
|
159
|
+
* @returns A promise resolving to the OnchainBalanceResult object.
|
|
160
|
+
*/
|
|
161
|
+
export function onchainBalance(): Promise<OnchainBalanceResult> {
|
|
162
|
+
return NitroArkHybridObject.onchainBalance();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Synchronizes the onchain state of the wallet.
|
|
167
|
+
* @returns A promise that resolves on success.
|
|
168
|
+
*/
|
|
169
|
+
export function onchainSync(): Promise<void> {
|
|
170
|
+
return NitroArkHybridObject.onchainSync();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Gets the list of unspent onchain outputs as a JSON string for the loaded wallet.
|
|
175
|
+
* @returns A promise resolving to the JSON string of unspent outputs.
|
|
176
|
+
*/
|
|
177
|
+
export function onchainListUnspent(): Promise<string> {
|
|
178
|
+
return NitroArkHybridObject.onchainListUnspent();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Gets the list of onchain UTXOs as a JSON string for the loaded wallet.
|
|
183
|
+
* @returns A promise resolving to the JSON string of UTXOs.
|
|
184
|
+
*/
|
|
185
|
+
export function onchainUtxos(): Promise<string> {
|
|
186
|
+
return NitroArkHybridObject.onchainUtxos();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Gets a fresh onchain address for the loaded wallet.
|
|
191
|
+
* @returns A promise resolving to the Bitcoin address string.
|
|
192
|
+
*/
|
|
193
|
+
export function onchainAddress(): Promise<string> {
|
|
194
|
+
return NitroArkHybridObject.onchainAddress();
|
|
195
|
+
}
|
|
196
|
+
|
|
162
197
|
/**
|
|
163
198
|
* Sends funds using the onchain wallet.
|
|
164
199
|
* @param destination The destination Bitcoin address.
|
|
165
200
|
* @param amountSat The amount to send in satoshis.
|
|
166
|
-
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
167
201
|
* @returns A promise resolving to the OnchainPaymentResult object
|
|
168
202
|
*/
|
|
169
|
-
export function
|
|
203
|
+
export function onchainSend(
|
|
170
204
|
destination: string,
|
|
171
205
|
amountSat: number
|
|
172
206
|
): Promise<OnchainPaymentResult> {
|
|
173
|
-
return NitroArkHybridObject.
|
|
207
|
+
return NitroArkHybridObject.onchainSend(destination, amountSat);
|
|
174
208
|
}
|
|
175
209
|
|
|
176
210
|
/**
|
|
177
211
|
* Sends all funds from the onchain wallet to a destination address.
|
|
178
212
|
* @param destination The destination Bitcoin address.
|
|
179
|
-
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
180
213
|
* @returns A promise resolving to the transaction ID string.
|
|
181
214
|
*/
|
|
182
|
-
export function
|
|
183
|
-
destination
|
|
184
|
-
no_sync: boolean = false
|
|
185
|
-
): Promise<string> {
|
|
186
|
-
return NitroArkHybridObject.drainOnchain(destination, no_sync);
|
|
215
|
+
export function onchainDrain(destination: string): Promise<string> {
|
|
216
|
+
return NitroArkHybridObject.onchainDrain(destination);
|
|
187
217
|
}
|
|
188
218
|
|
|
189
219
|
/**
|
|
190
220
|
* Sends funds to multiple recipients using the onchain wallet.
|
|
191
221
|
* @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
222
|
* @returns A promise resolving to the transaction ID string.
|
|
194
223
|
*/
|
|
195
|
-
export function
|
|
196
|
-
outputs: BarkSendManyOutput[]
|
|
197
|
-
no_sync: boolean = false
|
|
224
|
+
export function onchainSendMany(
|
|
225
|
+
outputs: BarkSendManyOutput[]
|
|
198
226
|
): Promise<string> {
|
|
199
|
-
return NitroArkHybridObject.
|
|
227
|
+
return NitroArkHybridObject.onchainSendMany(outputs);
|
|
200
228
|
}
|
|
201
229
|
|
|
202
230
|
// --- Lightning Operations ---
|
|
@@ -211,12 +239,40 @@ export function bolt11Invoice(amountMsat: number): Promise<string> {
|
|
|
211
239
|
}
|
|
212
240
|
|
|
213
241
|
/**
|
|
214
|
-
* Claims a
|
|
215
|
-
* @param bolt11 The
|
|
242
|
+
* Claims a Lightning payment.
|
|
243
|
+
* @param bolt11 The Lightning invoice string to claim.
|
|
216
244
|
* @returns A promise that resolves on success or rejects on error.
|
|
217
245
|
*/
|
|
218
|
-
export function
|
|
219
|
-
return NitroArkHybridObject.
|
|
246
|
+
export function finishLightningReceive(bolt11: string): Promise<void> {
|
|
247
|
+
return NitroArkHybridObject.finishLightningReceive(bolt11);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Sends a Lightning payment.
|
|
252
|
+
* @param destination The Lightning invoice.
|
|
253
|
+
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
254
|
+
* @returns A promise resolving to a LightningPaymentResult object
|
|
255
|
+
*/
|
|
256
|
+
export function sendLightningPayment(
|
|
257
|
+
destination: string,
|
|
258
|
+
amountSat?: number
|
|
259
|
+
): Promise<LightningPaymentResult> {
|
|
260
|
+
return NitroArkHybridObject.sendLightningPayment(destination, amountSat);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Sends a payment to a Lightning Address.
|
|
265
|
+
* @param addr The Lightning Address.
|
|
266
|
+
* @param amountSat The amount in satoshis to send.
|
|
267
|
+
* @param comment An optional comment.
|
|
268
|
+
* @returns A promise resolving to a LnurlPaymentResult object
|
|
269
|
+
*/
|
|
270
|
+
export function sendLnaddr(
|
|
271
|
+
addr: string,
|
|
272
|
+
amountSat: number,
|
|
273
|
+
comment: string
|
|
274
|
+
): Promise<LnurlPaymentResult> {
|
|
275
|
+
return NitroArkHybridObject.sendLnaddr(addr, amountSat, comment);
|
|
220
276
|
}
|
|
221
277
|
|
|
222
278
|
// --- Ark Operations ---
|
|
@@ -251,47 +307,17 @@ export function sendArkoorPayment(
|
|
|
251
307
|
return NitroArkHybridObject.sendArkoorPayment(destination, amountSat);
|
|
252
308
|
}
|
|
253
309
|
|
|
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
310
|
/**
|
|
283
311
|
* Sends an onchain payment via an Ark round.
|
|
284
312
|
* @param destination The destination Bitcoin address.
|
|
285
313
|
* @param amountSat The amount in satoshis to send.
|
|
286
|
-
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
287
314
|
* @returns A promise resolving to a JSON status string.
|
|
288
315
|
*/
|
|
289
|
-
export function
|
|
316
|
+
export function sendRoundOnchainPayment(
|
|
290
317
|
destination: string,
|
|
291
|
-
amountSat: number
|
|
292
|
-
no_sync: boolean = false
|
|
318
|
+
amountSat: number
|
|
293
319
|
): Promise<string> {
|
|
294
|
-
return NitroArkHybridObject.
|
|
320
|
+
return NitroArkHybridObject.sendRoundOnchainPayment(destination, amountSat);
|
|
295
321
|
}
|
|
296
322
|
|
|
297
323
|
// --- Offboarding / Exiting ---
|
|
@@ -320,31 +346,6 @@ export function offboardAll(destinationAddress: string): Promise<string> {
|
|
|
320
346
|
return NitroArkHybridObject.offboardAll(destinationAddress);
|
|
321
347
|
}
|
|
322
348
|
|
|
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
349
|
// --- Re-export types and enums ---
|
|
349
350
|
export type {
|
|
350
351
|
NitroArk,
|
|
@@ -353,8 +354,11 @@ export type {
|
|
|
353
354
|
BarkArkInfo,
|
|
354
355
|
BarkSendManyOutput,
|
|
355
356
|
ArkoorPaymentResult,
|
|
356
|
-
|
|
357
|
+
LightningPaymentResult,
|
|
357
358
|
LnurlPaymentResult,
|
|
358
359
|
OnchainPaymentResult,
|
|
359
360
|
PaymentTypes,
|
|
361
|
+
OffchainBalanceResult,
|
|
362
|
+
OnchainBalanceResult,
|
|
363
|
+
NewAddressResult,
|
|
360
364
|
} from './NitroArk.nitro';
|