react-native-nitro-ark 0.0.15 → 0.0.17
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 +105 -105
- package/cpp/bark-cpp.h +30 -227
- package/lib/module/index.js +89 -110
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +22 -19
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +59 -86
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +4 -1
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +23 -20
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +18 -65
- package/src/index.tsx +79 -203
|
@@ -6,175 +6,148 @@ export declare const NitroArkHybridObject: NitroArk;
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function createMnemonic(): Promise<string>;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Loads an existing wallet or creates a new one at the specified directory.
|
|
10
|
+
* Once loaded, the wallet state is managed internally.
|
|
10
11
|
* @param datadir Path to the data directory.
|
|
11
|
-
* @param opts Creation options.
|
|
12
|
+
* @param opts Creation and configuration options.
|
|
12
13
|
* @returns A promise that resolves on success or rejects on error.
|
|
13
14
|
*/
|
|
14
|
-
export declare function
|
|
15
|
+
export declare function loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
* Closes the currently loaded wallet, clearing its state from memory.
|
|
18
|
+
* @returns A promise that resolves on success or rejects on error.
|
|
19
|
+
*/
|
|
20
|
+
export declare function closeWallet(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the onchain and offchain balances for the loaded wallet.
|
|
23
|
+
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
20
24
|
* @returns A promise resolving to the BarkBalance object.
|
|
21
25
|
*/
|
|
22
|
-
export declare function getBalance(
|
|
26
|
+
export declare function getBalance(no_sync?: boolean): Promise<BarkBalance>;
|
|
23
27
|
/**
|
|
24
|
-
* Gets a fresh onchain address.
|
|
25
|
-
* @param datadir Path to the data directory.
|
|
26
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
28
|
+
* Gets a fresh onchain address for the loaded wallet.
|
|
27
29
|
* @returns A promise resolving to the Bitcoin address string.
|
|
28
30
|
*/
|
|
29
|
-
export declare function getOnchainAddress(
|
|
31
|
+
export declare function getOnchainAddress(): Promise<string>;
|
|
30
32
|
/**
|
|
31
|
-
* Gets the list of onchain UTXOs as a JSON string.
|
|
32
|
-
* @param
|
|
33
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
34
|
-
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
33
|
+
* Gets the list of onchain UTXOs as a JSON string for the loaded wallet.
|
|
34
|
+
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
35
35
|
* @returns A promise resolving to the JSON string of UTXOs.
|
|
36
36
|
*/
|
|
37
|
-
export declare function getOnchainUtxos(
|
|
37
|
+
export declare function getOnchainUtxos(no_sync?: boolean): Promise<string>;
|
|
38
38
|
/**
|
|
39
39
|
* Gets the wallet's VTXO public key (hex string).
|
|
40
|
-
* @param
|
|
41
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
40
|
+
* @param index Optional index of the VTXO pubkey to retrieve.
|
|
42
41
|
* @returns A promise resolving to the hex-encoded public key string.
|
|
43
42
|
*/
|
|
44
|
-
export declare function getVtxoPubkey(
|
|
43
|
+
export declare function getVtxoPubkey(index?: number): Promise<string>;
|
|
45
44
|
/**
|
|
46
|
-
* Gets the list of VTXOs as a JSON string.
|
|
47
|
-
* @param
|
|
48
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
49
|
-
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
45
|
+
* Gets the list of VTXOs as a JSON string for the loaded wallet.
|
|
46
|
+
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
50
47
|
* @returns A promise resolving to the JSON string of VTXOs.
|
|
51
48
|
*/
|
|
52
|
-
export declare function getVtxos(
|
|
49
|
+
export declare function getVtxos(no_sync?: boolean): Promise<string>;
|
|
53
50
|
/**
|
|
54
51
|
* Sends funds using the onchain wallet.
|
|
55
|
-
* @param datadir Path to the data directory.
|
|
56
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
57
52
|
* @param destination The destination Bitcoin address.
|
|
58
53
|
* @param amountSat The amount to send in satoshis.
|
|
59
|
-
* @param no_sync
|
|
54
|
+
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
60
55
|
* @returns A promise resolving to the transaction ID string.
|
|
61
56
|
*/
|
|
62
|
-
export declare function sendOnchain(
|
|
57
|
+
export declare function sendOnchain(destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
|
|
63
58
|
/**
|
|
64
59
|
* Sends all funds from the onchain wallet to a destination address.
|
|
65
|
-
* @param datadir Path to the data directory.
|
|
66
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
67
60
|
* @param destination The destination Bitcoin address.
|
|
68
|
-
* @param no_sync
|
|
61
|
+
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
69
62
|
* @returns A promise resolving to the transaction ID string.
|
|
70
63
|
*/
|
|
71
|
-
export declare function drainOnchain(
|
|
64
|
+
export declare function drainOnchain(destination: string, no_sync?: boolean): Promise<string>;
|
|
72
65
|
/**
|
|
73
66
|
* Sends funds to multiple recipients using the onchain wallet.
|
|
74
|
-
* @param datadir Path to the data directory.
|
|
75
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
76
67
|
* @param outputs An array of objects containing destination address and amountSat.
|
|
77
|
-
* @param no_sync
|
|
68
|
+
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
78
69
|
* @returns A promise resolving to the transaction ID string.
|
|
79
70
|
*/
|
|
80
|
-
export declare function sendManyOnchain(
|
|
71
|
+
export declare function sendManyOnchain(outputs: BarkSendManyOutput[], no_sync?: boolean): Promise<string>;
|
|
81
72
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @param
|
|
84
|
-
* @
|
|
73
|
+
* Creates a Bolt 11 invoice.
|
|
74
|
+
* @param amountMsat The amount in millisatoshis for the invoice.
|
|
75
|
+
* @returns A promise resolving to the Bolt 11 invoice string.
|
|
76
|
+
*/
|
|
77
|
+
export declare function bolt11Invoice(amountMsat: number): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Claims a Bolt 11 payment.
|
|
80
|
+
* @param bolt11 The Bolt 11 invoice string to claim.
|
|
81
|
+
* @returns A promise that resolves on success or rejects on error.
|
|
82
|
+
*/
|
|
83
|
+
export declare function claimBolt11Payment(bolt11: string): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Refreshes VTXOs based on specified criteria for the loaded wallet.
|
|
85
86
|
* @param refreshOpts Options specifying which VTXOs to refresh.
|
|
86
|
-
*
|
|
87
|
-
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
87
|
+
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
88
88
|
* @returns A promise resolving to a JSON status string.
|
|
89
|
-
* @example
|
|
90
|
-
* // Refresh using default threshold
|
|
91
|
-
* refreshVtxos(datadir, mnemonic, { mode_type: 'DefaultThreshold' });
|
|
92
|
-
* // Refresh specific VTXOs
|
|
93
|
-
* refreshVtxos(datadir, mnemonic, { mode_type: 'Specific', specific_vtxo_ids: ['vtxo_id_1', 'vtxo_id_2'] });
|
|
94
|
-
* // Refresh if older than 10 blocks
|
|
95
|
-
* refreshVtxos(datadir, mnemonic, { mode_type: 'ThresholdBlocks', threshold_value: 10 });
|
|
96
89
|
*/
|
|
97
|
-
export declare function refreshVtxos(
|
|
90
|
+
export declare function refreshVtxos(refreshOpts: BarkRefreshOpts, no_sync?: boolean): Promise<string>;
|
|
98
91
|
/**
|
|
99
92
|
* Boards a specific amount from the onchain wallet into Ark.
|
|
100
|
-
* @param datadir Path to the data directory.
|
|
101
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
102
93
|
* @param amountSat The amount in satoshis to board.
|
|
103
|
-
* @param no_sync
|
|
94
|
+
* @param no_sync If true, skips synchronization with the onchain wallet. Defaults to false.
|
|
104
95
|
* @returns A promise resolving to a JSON status string.
|
|
105
96
|
*/
|
|
106
|
-
export declare function boardAmount(
|
|
97
|
+
export declare function boardAmount(amountSat: number, no_sync?: boolean): Promise<string>;
|
|
107
98
|
/**
|
|
108
99
|
* Boards all available funds from the onchain wallet into Ark.
|
|
109
|
-
* @param
|
|
110
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
111
|
-
* @param no_sync Whether to skip syncing the onchain wallet. Defaults to false.
|
|
100
|
+
* @param no_sync If true, skips synchronization with the onchain wallet. Defaults to false.
|
|
112
101
|
* @returns A promise resolving to a JSON status string.
|
|
113
102
|
*/
|
|
114
|
-
export declare function boardAll(
|
|
103
|
+
export declare function boardAll(no_sync?: boolean): Promise<string>;
|
|
115
104
|
/**
|
|
116
105
|
* Sends funds offchain using Ark VTXOs.
|
|
117
|
-
* @param datadir Path to the data directory.
|
|
118
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
119
106
|
* @param destination Ark address (VTXO pubkey) or onchain Bitcoin address.
|
|
120
107
|
* @param amountSat The amount in satoshis to send.
|
|
121
|
-
* @param comment Optional comment
|
|
122
|
-
* @param no_sync
|
|
108
|
+
* @param comment Optional comment.
|
|
109
|
+
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
123
110
|
* @returns A promise resolving to a JSON status string.
|
|
124
111
|
*/
|
|
125
|
-
export declare function send(
|
|
112
|
+
export declare function send(destination: string, amountSat: number, comment?: string | null, no_sync?: boolean): Promise<string>;
|
|
126
113
|
/**
|
|
127
114
|
* Sends an onchain payment via an Ark round.
|
|
128
|
-
* @param datadir Path to the data directory.
|
|
129
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
130
115
|
* @param destination The destination Bitcoin address.
|
|
131
116
|
* @param amountSat The amount in satoshis to send.
|
|
132
|
-
* @param no_sync
|
|
117
|
+
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
133
118
|
* @returns A promise resolving to a JSON status string.
|
|
134
119
|
*/
|
|
135
|
-
export declare function sendRoundOnchain(
|
|
120
|
+
export declare function sendRoundOnchain(destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
|
|
136
121
|
/**
|
|
137
122
|
* Offboards specific VTXOs to an optional onchain address.
|
|
138
|
-
* @param datadir Path to the data directory.
|
|
139
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
140
123
|
* @param vtxoIds Array of VtxoId strings to offboard.
|
|
141
124
|
* @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
|
|
142
|
-
* @param no_sync
|
|
125
|
+
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
143
126
|
* @returns A promise resolving to a JSON result string.
|
|
144
127
|
*/
|
|
145
|
-
export declare function offboardSpecific(
|
|
128
|
+
export declare function offboardSpecific(vtxoIds: string[], optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
|
|
146
129
|
/**
|
|
147
130
|
* Offboards all VTXOs to an optional onchain address.
|
|
148
|
-
* @param datadir Path to the data directory.
|
|
149
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
150
131
|
* @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
|
|
151
|
-
* @param no_sync
|
|
132
|
+
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
152
133
|
* @returns A promise resolving to a JSON result string.
|
|
153
134
|
*/
|
|
154
|
-
export declare function offboardAll(
|
|
135
|
+
export declare function offboardAll(optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
|
|
155
136
|
/**
|
|
156
137
|
* Starts the exit process for specific VTXOs.
|
|
157
|
-
* @param datadir Path to the data directory.
|
|
158
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
159
138
|
* @param vtxoIds Array of VtxoId strings to start exiting.
|
|
160
|
-
* @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
|
|
161
139
|
* @returns A promise resolving to a JSON status string.
|
|
162
140
|
*/
|
|
163
|
-
export declare function exitStartSpecific(
|
|
141
|
+
export declare function exitStartSpecific(vtxoIds: string[]): Promise<string>;
|
|
164
142
|
/**
|
|
165
143
|
* Starts the exit process for all VTXOs in the wallet.
|
|
166
|
-
* @param datadir Path to the data directory.
|
|
167
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
168
|
-
* @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
|
|
169
144
|
* @returns A promise resolving to a JSON status string.
|
|
170
145
|
*/
|
|
171
|
-
export declare function exitStartAll(
|
|
146
|
+
export declare function exitStartAll(): Promise<string>;
|
|
172
147
|
/**
|
|
173
148
|
* Progresses the exit process once and returns the current status.
|
|
174
|
-
* @param datadir Path to the data directory.
|
|
175
|
-
* @param mnemonic The wallet mnemonic phrase.
|
|
176
149
|
* @returns A promise resolving to a JSON status string.
|
|
177
150
|
*/
|
|
178
|
-
export declare function exitProgressOnce(
|
|
151
|
+
export declare function exitProgressOnce(): Promise<string>;
|
|
179
152
|
export type { BarkCreateOpts, BarkConfigOpts, BarkBalance, BarkRefreshOpts, BarkRefreshModeType, BarkSendManyOutput, } from './NitroArk.nitro';
|
|
180
153
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,eAAe,EACf,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,oBAAoB,UACsB,CAAC;AAIxD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OA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,IAAW,EACrC,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAE9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAElD;AAGD,YAAY,EACV,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC"}
|
|
@@ -15,7 +15,8 @@ namespace margelo::nitro::nitroark {
|
|
|
15
15
|
// load custom methods/properties
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
17
|
prototype.registerHybridMethod("createMnemonic", &HybridNitroArkSpec::createMnemonic);
|
|
18
|
-
prototype.registerHybridMethod("
|
|
18
|
+
prototype.registerHybridMethod("loadWallet", &HybridNitroArkSpec::loadWallet);
|
|
19
|
+
prototype.registerHybridMethod("closeWallet", &HybridNitroArkSpec::closeWallet);
|
|
19
20
|
prototype.registerHybridMethod("getBalance", &HybridNitroArkSpec::getBalance);
|
|
20
21
|
prototype.registerHybridMethod("getOnchainAddress", &HybridNitroArkSpec::getOnchainAddress);
|
|
21
22
|
prototype.registerHybridMethod("getOnchainUtxos", &HybridNitroArkSpec::getOnchainUtxos);
|
|
@@ -29,6 +30,8 @@ namespace margelo::nitro::nitroark {
|
|
|
29
30
|
prototype.registerHybridMethod("boardAll", &HybridNitroArkSpec::boardAll);
|
|
30
31
|
prototype.registerHybridMethod("send", &HybridNitroArkSpec::send);
|
|
31
32
|
prototype.registerHybridMethod("sendRoundOnchain", &HybridNitroArkSpec::sendRoundOnchain);
|
|
33
|
+
prototype.registerHybridMethod("bolt11Invoice", &HybridNitroArkSpec::bolt11Invoice);
|
|
34
|
+
prototype.registerHybridMethod("claimBolt11Payment", &HybridNitroArkSpec::claimBolt11Payment);
|
|
32
35
|
prototype.registerHybridMethod("offboardSpecific", &HybridNitroArkSpec::offboardSpecific);
|
|
33
36
|
prototype.registerHybridMethod("offboardAll", &HybridNitroArkSpec::offboardAll);
|
|
34
37
|
prototype.registerHybridMethod("exitStartSpecific", &HybridNitroArkSpec::exitStartSpecific);
|
|
@@ -26,10 +26,10 @@ namespace margelo::nitro::nitroark { struct BarkRefreshOpts; }
|
|
|
26
26
|
#include <string>
|
|
27
27
|
#include "BarkCreateOpts.hpp"
|
|
28
28
|
#include "BarkBalance.hpp"
|
|
29
|
+
#include <optional>
|
|
29
30
|
#include <vector>
|
|
30
31
|
#include "BarkSendManyOutput.hpp"
|
|
31
32
|
#include "BarkRefreshOpts.hpp"
|
|
32
|
-
#include <optional>
|
|
33
33
|
|
|
34
34
|
namespace margelo::nitro::nitroark {
|
|
35
35
|
|
|
@@ -63,25 +63,28 @@ namespace margelo::nitro::nitroark {
|
|
|
63
63
|
public:
|
|
64
64
|
// Methods
|
|
65
65
|
virtual std::shared_ptr<Promise<std::string>> createMnemonic() = 0;
|
|
66
|
-
virtual std::shared_ptr<Promise<void>>
|
|
67
|
-
virtual std::shared_ptr<Promise<
|
|
68
|
-
virtual std::shared_ptr<Promise<
|
|
69
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
70
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
71
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
72
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
73
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
74
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
75
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
76
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
77
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
78
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
79
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
80
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
81
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
82
|
-
virtual std::shared_ptr<Promise<
|
|
83
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
84
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
66
|
+
virtual std::shared_ptr<Promise<void>> loadWallet(const std::string& datadir, const BarkCreateOpts& opts) = 0;
|
|
67
|
+
virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
|
|
68
|
+
virtual std::shared_ptr<Promise<BarkBalance>> getBalance(bool no_sync) = 0;
|
|
69
|
+
virtual std::shared_ptr<Promise<std::string>> getOnchainAddress() = 0;
|
|
70
|
+
virtual std::shared_ptr<Promise<std::string>> getOnchainUtxos(bool no_sync) = 0;
|
|
71
|
+
virtual std::shared_ptr<Promise<std::string>> getVtxoPubkey(std::optional<double> index) = 0;
|
|
72
|
+
virtual std::shared_ptr<Promise<std::string>> getVtxos(bool no_sync) = 0;
|
|
73
|
+
virtual std::shared_ptr<Promise<std::string>> sendOnchain(const std::string& destination, double amountSat, bool no_sync) = 0;
|
|
74
|
+
virtual std::shared_ptr<Promise<std::string>> drainOnchain(const std::string& destination, bool no_sync) = 0;
|
|
75
|
+
virtual std::shared_ptr<Promise<std::string>> sendManyOnchain(const std::vector<BarkSendManyOutput>& outputs, bool no_sync) = 0;
|
|
76
|
+
virtual std::shared_ptr<Promise<std::string>> refreshVtxos(const BarkRefreshOpts& refreshOpts, bool no_sync) = 0;
|
|
77
|
+
virtual std::shared_ptr<Promise<std::string>> boardAmount(double amountSat, bool no_sync) = 0;
|
|
78
|
+
virtual std::shared_ptr<Promise<std::string>> boardAll(bool no_sync) = 0;
|
|
79
|
+
virtual std::shared_ptr<Promise<std::string>> send(const std::string& destination, double amountSat, const std::optional<std::string>& comment, bool no_sync) = 0;
|
|
80
|
+
virtual std::shared_ptr<Promise<std::string>> sendRoundOnchain(const std::string& destination, double amountSat, bool no_sync) = 0;
|
|
81
|
+
virtual std::shared_ptr<Promise<std::string>> bolt11Invoice(double amountMsat) = 0;
|
|
82
|
+
virtual std::shared_ptr<Promise<void>> claimBolt11Payment(const std::string& bolt11) = 0;
|
|
83
|
+
virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::vector<std::string>& vtxoIds, const std::optional<std::string>& optionalAddress, bool no_sync) = 0;
|
|
84
|
+
virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::optional<std::string>& optionalAddress, bool no_sync) = 0;
|
|
85
|
+
virtual std::shared_ptr<Promise<std::string>> exitStartSpecific(const std::vector<std::string>& vtxoIds) = 0;
|
|
86
|
+
virtual std::shared_ptr<Promise<std::string>> exitStartAll() = 0;
|
|
87
|
+
virtual std::shared_ptr<Promise<std::string>> exitProgressOnce() = 0;
|
|
85
88
|
|
|
86
89
|
protected:
|
|
87
90
|
// Hybrid Setup
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -56,106 +56,59 @@ export interface BarkSendManyOutput {
|
|
|
56
56
|
export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
57
57
|
// --- Management ---
|
|
58
58
|
createMnemonic(): Promise<string>;
|
|
59
|
-
|
|
59
|
+
loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
|
|
60
|
+
closeWallet(): Promise<void>;
|
|
60
61
|
|
|
61
62
|
// --- Wallet Info ---
|
|
62
|
-
getBalance(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
): Promise<
|
|
67
|
-
getOnchainAddress(datadir: string, mnemonic: string): Promise<string>;
|
|
68
|
-
getOnchainUtxos(
|
|
69
|
-
datadir: string,
|
|
70
|
-
mnemonic: string,
|
|
71
|
-
no_sync: boolean
|
|
72
|
-
): Promise<string>; // Returns JSON string
|
|
73
|
-
getVtxoPubkey(datadir: string, mnemonic: string): Promise<string>;
|
|
74
|
-
getVtxos(
|
|
75
|
-
datadir: string,
|
|
76
|
-
mnemonic: string,
|
|
77
|
-
no_sync: boolean
|
|
78
|
-
): Promise<string>; // Returns JSON string
|
|
63
|
+
getBalance(no_sync: boolean): Promise<BarkBalance>;
|
|
64
|
+
getOnchainAddress(): Promise<string>;
|
|
65
|
+
getOnchainUtxos(no_sync: boolean): Promise<string>; // Returns JSON string
|
|
66
|
+
getVtxoPubkey(index?: number): Promise<string>;
|
|
67
|
+
getVtxos(no_sync: boolean): Promise<string>; // Returns JSON string
|
|
79
68
|
|
|
80
69
|
// --- Onchain Operations ---
|
|
81
70
|
sendOnchain(
|
|
82
|
-
datadir: string,
|
|
83
|
-
mnemonic: string,
|
|
84
71
|
destination: string,
|
|
85
72
|
amountSat: number,
|
|
86
73
|
no_sync: boolean
|
|
87
74
|
): Promise<string>; // Returns txid
|
|
88
|
-
drainOnchain(
|
|
89
|
-
datadir: string,
|
|
90
|
-
mnemonic: string,
|
|
91
|
-
destination: string,
|
|
92
|
-
no_sync: boolean
|
|
93
|
-
): Promise<string>; // Returns txid
|
|
75
|
+
drainOnchain(destination: string, no_sync: boolean): Promise<string>; // Returns txid
|
|
94
76
|
sendManyOnchain(
|
|
95
|
-
datadir: string,
|
|
96
|
-
mnemonic: string,
|
|
97
77
|
outputs: BarkSendManyOutput[],
|
|
98
78
|
no_sync: boolean
|
|
99
79
|
): Promise<string>; // Returns txid
|
|
100
80
|
|
|
101
81
|
// --- Ark Operations ---
|
|
102
|
-
refreshVtxos(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
refreshOpts: BarkRefreshOpts,
|
|
106
|
-
no_sync: boolean
|
|
107
|
-
): Promise<string>; // Returns JSON status
|
|
108
|
-
boardAmount(
|
|
109
|
-
datadir: string,
|
|
110
|
-
mnemonic: string,
|
|
111
|
-
amountSat: number,
|
|
112
|
-
no_sync: boolean
|
|
113
|
-
): Promise<string>; // Returns JSON status
|
|
114
|
-
boardAll(
|
|
115
|
-
datadir: string,
|
|
116
|
-
mnemonic: string,
|
|
117
|
-
no_sync: boolean
|
|
118
|
-
): Promise<string>; // Returns JSON status
|
|
82
|
+
refreshVtxos(refreshOpts: BarkRefreshOpts, no_sync: boolean): Promise<string>; // Returns JSON status
|
|
83
|
+
boardAmount(amountSat: number, no_sync: boolean): Promise<string>; // Returns JSON status
|
|
84
|
+
boardAll(no_sync: boolean): Promise<string>; // Returns JSON status
|
|
119
85
|
send(
|
|
120
|
-
datadir: string,
|
|
121
|
-
mnemonic: string,
|
|
122
86
|
destination: string,
|
|
123
87
|
amountSat: number,
|
|
124
88
|
comment: string | null,
|
|
125
89
|
no_sync: boolean
|
|
126
90
|
): Promise<string>; // Returns JSON status
|
|
127
91
|
sendRoundOnchain(
|
|
128
|
-
datadir: string,
|
|
129
|
-
mnemonic: string,
|
|
130
92
|
destination: string,
|
|
131
93
|
amountSat: number,
|
|
132
94
|
no_sync: boolean
|
|
133
95
|
): Promise<string>; // Returns JSON status
|
|
134
96
|
|
|
97
|
+
// --- Lightning Operations ---
|
|
98
|
+
bolt11Invoice(amountMsat: number): Promise<string>; // Returns invoice string
|
|
99
|
+
claimBolt11Payment(bolt11: string): Promise<void>; // Throws on error
|
|
100
|
+
|
|
135
101
|
// --- Offboarding / Exiting ---
|
|
136
102
|
offboardSpecific(
|
|
137
|
-
datadir: string,
|
|
138
|
-
mnemonic: string,
|
|
139
103
|
vtxoIds: string[],
|
|
140
104
|
optionalAddress: string | null,
|
|
141
105
|
no_sync: boolean
|
|
142
106
|
): Promise<string>; // Returns JSON result
|
|
143
107
|
offboardAll(
|
|
144
|
-
datadir: string,
|
|
145
|
-
mnemonic: string,
|
|
146
108
|
optionalAddress: string | null,
|
|
147
109
|
no_sync: boolean
|
|
148
110
|
): Promise<string>; // Returns JSON result
|
|
149
|
-
exitStartSpecific(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
vtxoIds: string[],
|
|
153
|
-
no_sync: boolean
|
|
154
|
-
): Promise<string>; // Returns JSON status
|
|
155
|
-
exitStartAll(
|
|
156
|
-
datadir: string,
|
|
157
|
-
mnemonic: string,
|
|
158
|
-
no_sync: boolean
|
|
159
|
-
): Promise<string>; // Returns JSON status
|
|
160
|
-
exitProgressOnce(datadir: string, mnemonic: string): Promise<string>; // Returns JSON status
|
|
111
|
+
exitStartSpecific(vtxoIds: string[]): Promise<string>; // Returns JSON status
|
|
112
|
+
exitStartAll(): Promise<string>; // Returns JSON status
|
|
113
|
+
exitProgressOnce(): Promise<string>; // Returns JSON status
|
|
161
114
|
}
|