react-native-nitro-ark 0.0.16 → 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.
@@ -6,191 +6,148 @@ export declare const NitroArkHybridObject: NitroArk;
6
6
  */
7
7
  export declare function createMnemonic(): Promise<string>;
8
8
  /**
9
- * Creates a new wallet at the specified directory.
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 createWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
15
+ export declare function loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
15
16
  /**
16
- * Gets the offchain and onchain balances.
17
- * @param datadir Path to the data directory.
18
- * @param no_sync Whether to skip syncing the wallet. Defaults to false.
19
- * @param mnemonic The wallet mnemonic phrase.
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(datadir: string, mnemonic: string, no_sync?: boolean): Promise<BarkBalance>;
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(datadir: string, mnemonic: string): Promise<string>;
31
+ export declare function getOnchainAddress(): Promise<string>;
30
32
  /**
31
- * Gets the list of onchain UTXOs as a JSON string.
32
- * @param datadir Path to the data directory.
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(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
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 datadir Path to the data directory.
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(datadir: string, mnemonic: string): Promise<string>;
43
+ export declare function getVtxoPubkey(index?: number): Promise<string>;
45
44
  /**
46
- * Gets the list of VTXOs as a JSON string.
47
- * @param datadir Path to the data directory.
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(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
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 Whether to skip syncing the wallet. Defaults to false.
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(datadir: string, mnemonic: string, destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
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 Whether to skip syncing the wallet. Defaults to false.
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(datadir: string, mnemonic: string, destination: string, no_sync?: boolean): Promise<string>;
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 Whether to skip syncing the wallet. Defaults to false.
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(datadir: string, mnemonic: string, outputs: BarkSendManyOutput[], no_sync?: boolean): Promise<string>;
71
+ export declare function sendManyOnchain(outputs: BarkSendManyOutput[], no_sync?: boolean): Promise<string>;
81
72
  /**
82
73
  * Creates a Bolt 11 invoice.
83
- * @param datadir Path to the data directory.
84
- * @param mnemonic The wallet mnemonic phrase.
85
- * @param amountSat The amount in satoshis for the invoice.
74
+ * @param amountMsat The amount in millisatoshis for the invoice.
86
75
  * @returns A promise resolving to the Bolt 11 invoice string.
87
76
  */
88
- export declare function bolt11Invoice(datadir: string, mnemonic: string, amountSat: number): Promise<string>;
77
+ export declare function bolt11Invoice(amountMsat: number): Promise<string>;
89
78
  /**
90
79
  * Claims a Bolt 11 payment.
91
- * @param datadir Path to the data directory.
92
- * @param mnemonic The wallet mnemonic phrase.
93
80
  * @param bolt11 The Bolt 11 invoice string to claim.
94
81
  * @returns A promise that resolves on success or rejects on error.
95
82
  */
96
- export declare function claimBolt11Payment(datadir: string, mnemonic: string, bolt11: string): Promise<void>;
83
+ export declare function claimBolt11Payment(bolt11: string): Promise<void>;
97
84
  /**
98
- * Refreshes VTXOs based on specified criteria.
99
- * @param datadir Path to the data directory.
100
- * @param mnemonic The wallet mnemonic phrase.
85
+ * Refreshes VTXOs based on specified criteria for the loaded wallet.
101
86
  * @param refreshOpts Options specifying which VTXOs to refresh.
102
- * `mode_type` should be one of: 'DefaultThreshold', 'ThresholdBlocks', 'ThresholdHours', 'Counterparty', 'All', 'Specific'.
103
- * @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.
104
88
  * @returns A promise resolving to a JSON status string.
105
- * @example
106
- * // Refresh using default threshold
107
- * refreshVtxos(datadir, mnemonic, { mode_type: 'DefaultThreshold' });
108
- * // Refresh specific VTXOs
109
- * refreshVtxos(datadir, mnemonic, { mode_type: 'Specific', specific_vtxo_ids: ['vtxo_id_1', 'vtxo_id_2'] });
110
- * // Refresh if older than 10 blocks
111
- * refreshVtxos(datadir, mnemonic, { mode_type: 'ThresholdBlocks', threshold_value: 10 });
112
89
  */
113
- export declare function refreshVtxos(datadir: string, mnemonic: string, refreshOpts: BarkRefreshOpts, no_sync?: boolean): Promise<string>;
90
+ export declare function refreshVtxos(refreshOpts: BarkRefreshOpts, no_sync?: boolean): Promise<string>;
114
91
  /**
115
92
  * Boards a specific amount from the onchain wallet into Ark.
116
- * @param datadir Path to the data directory.
117
- * @param mnemonic The wallet mnemonic phrase.
118
93
  * @param amountSat The amount in satoshis to board.
119
- * @param no_sync Whether to skip syncing the onchain wallet. Defaults to false.
94
+ * @param no_sync If true, skips synchronization with the onchain wallet. Defaults to false.
120
95
  * @returns A promise resolving to a JSON status string.
121
96
  */
122
- export declare function boardAmount(datadir: string, mnemonic: string, amountSat: number, no_sync?: boolean): Promise<string>;
97
+ export declare function boardAmount(amountSat: number, no_sync?: boolean): Promise<string>;
123
98
  /**
124
99
  * Boards all available funds from the onchain wallet into Ark.
125
- * @param datadir Path to the data directory.
126
- * @param mnemonic The wallet mnemonic phrase.
127
- * @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.
128
101
  * @returns A promise resolving to a JSON status string.
129
102
  */
130
- export declare function boardAll(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
103
+ export declare function boardAll(no_sync?: boolean): Promise<string>;
131
104
  /**
132
105
  * Sends funds offchain using Ark VTXOs.
133
- * @param datadir Path to the data directory.
134
- * @param mnemonic The wallet mnemonic phrase.
135
106
  * @param destination Ark address (VTXO pubkey) or onchain Bitcoin address.
136
107
  * @param amountSat The amount in satoshis to send.
137
- * @param comment Optional comment (can be null).
138
- * @param no_sync Whether to skip syncing the wallet. Defaults to false.
108
+ * @param comment Optional comment.
109
+ * @param no_sync If true, skips synchronization with the wallet. Defaults to false.
139
110
  * @returns A promise resolving to a JSON status string.
140
111
  */
141
- export declare function send(datadir: string, mnemonic: string, destination: string, amountSat: number, comment?: string | null, no_sync?: boolean): Promise<string>;
112
+ export declare function send(destination: string, amountSat: number, comment?: string | null, no_sync?: boolean): Promise<string>;
142
113
  /**
143
114
  * Sends an onchain payment via an Ark round.
144
- * @param datadir Path to the data directory.
145
- * @param mnemonic The wallet mnemonic phrase.
146
115
  * @param destination The destination Bitcoin address.
147
116
  * @param amountSat The amount in satoshis to send.
148
- * @param no_sync Whether to skip syncing the wallet. Defaults to false.
117
+ * @param no_sync If true, skips synchronization with the wallet. Defaults to false.
149
118
  * @returns A promise resolving to a JSON status string.
150
119
  */
151
- export declare function sendRoundOnchain(datadir: string, mnemonic: string, destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
120
+ export declare function sendRoundOnchain(destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
152
121
  /**
153
122
  * Offboards specific VTXOs to an optional onchain address.
154
- * @param datadir Path to the data directory.
155
- * @param mnemonic The wallet mnemonic phrase.
156
123
  * @param vtxoIds Array of VtxoId strings to offboard.
157
124
  * @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
158
- * @param no_sync Whether to skip syncing the wallet. Defaults to false.
125
+ * @param no_sync If true, skips synchronization with the wallet. Defaults to false.
159
126
  * @returns A promise resolving to a JSON result string.
160
127
  */
161
- export declare function offboardSpecific(datadir: string, mnemonic: string, vtxoIds: string[], optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
128
+ export declare function offboardSpecific(vtxoIds: string[], optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
162
129
  /**
163
130
  * Offboards all VTXOs to an optional onchain address.
164
- * @param datadir Path to the data directory.
165
- * @param mnemonic The wallet mnemonic phrase.
166
131
  * @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
167
- * @param no_sync Whether to skip syncing the wallet. Defaults to false.
132
+ * @param no_sync If true, skips synchronization with the wallet. Defaults to false.
168
133
  * @returns A promise resolving to a JSON result string.
169
134
  */
170
- export declare function offboardAll(datadir: string, mnemonic: string, optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
135
+ export declare function offboardAll(optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
171
136
  /**
172
137
  * Starts the exit process for specific VTXOs.
173
- * @param datadir Path to the data directory.
174
- * @param mnemonic The wallet mnemonic phrase.
175
138
  * @param vtxoIds Array of VtxoId strings to start exiting.
176
- * @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
177
139
  * @returns A promise resolving to a JSON status string.
178
140
  */
179
- export declare function exitStartSpecific(datadir: string, mnemonic: string, vtxoIds: string[], no_sync?: boolean): Promise<string>;
141
+ export declare function exitStartSpecific(vtxoIds: string[]): Promise<string>;
180
142
  /**
181
143
  * Starts the exit process for all VTXOs in the wallet.
182
- * @param datadir Path to the data directory.
183
- * @param mnemonic The wallet mnemonic phrase.
184
- * @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
185
144
  * @returns A promise resolving to a JSON status string.
186
145
  */
187
- export declare function exitStartAll(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
146
+ export declare function exitStartAll(): Promise<string>;
188
147
  /**
189
148
  * Progresses the exit process once and returns the current status.
190
- * @param datadir Path to the data directory.
191
- * @param mnemonic The wallet mnemonic phrase.
192
149
  * @returns A promise resolving to a JSON status string.
193
150
  */
194
- export declare function exitProgressOnce(datadir: string, mnemonic: string): Promise<string>;
151
+ export declare function exitProgressOnce(): Promise<string>;
195
152
  export type { BarkCreateOpts, BarkConfigOpts, BarkBalance, BarkRefreshOpts, BarkRefreshModeType, BarkSendManyOutput, } from './NitroArk.nitro';
196
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,OAAO,CAAC,MAAM,CAAC,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CAEf;AAID;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,WAAW,CAAC,CAGtB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,O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,wBAAgB,IAAI,CAClB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EAAE,EACjB,eAAe,GAAE,MAAM,GAAG,IAAW,EACrC,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,eAAe,GAAE,MAAM,GAAG,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("createWallet", &HybridNitroArkSpec::createWallet);
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);
@@ -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,27 +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>> createWallet(const std::string& datadir, const BarkCreateOpts& opts) = 0;
67
- virtual std::shared_ptr<Promise<BarkBalance>> getBalance(const std::string& datadir, bool no_sync, const std::string& mnemonic) = 0;
68
- virtual std::shared_ptr<Promise<std::string>> getOnchainAddress(const std::string& datadir, const std::string& mnemonic) = 0;
69
- virtual std::shared_ptr<Promise<std::string>> getOnchainUtxos(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
70
- virtual std::shared_ptr<Promise<std::string>> getVtxoPubkey(const std::string& datadir, const std::string& mnemonic) = 0;
71
- virtual std::shared_ptr<Promise<std::string>> getVtxos(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
72
- virtual std::shared_ptr<Promise<std::string>> sendOnchain(const std::string& datadir, const std::string& mnemonic, const std::string& destination, double amountSat, bool no_sync) = 0;
73
- virtual std::shared_ptr<Promise<std::string>> drainOnchain(const std::string& datadir, const std::string& mnemonic, const std::string& destination, bool no_sync) = 0;
74
- virtual std::shared_ptr<Promise<std::string>> sendManyOnchain(const std::string& datadir, const std::string& mnemonic, const std::vector<BarkSendManyOutput>& outputs, bool no_sync) = 0;
75
- virtual std::shared_ptr<Promise<std::string>> refreshVtxos(const std::string& datadir, const std::string& mnemonic, const BarkRefreshOpts& refreshOpts, bool no_sync) = 0;
76
- virtual std::shared_ptr<Promise<std::string>> boardAmount(const std::string& datadir, const std::string& mnemonic, double amountSat, bool no_sync) = 0;
77
- virtual std::shared_ptr<Promise<std::string>> boardAll(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
78
- virtual std::shared_ptr<Promise<std::string>> send(const std::string& datadir, const std::string& mnemonic, const std::string& destination, double amountSat, const std::optional<std::string>& comment, bool no_sync) = 0;
79
- virtual std::shared_ptr<Promise<std::string>> sendRoundOnchain(const std::string& datadir, const std::string& mnemonic, const std::string& destination, double amountSat, bool no_sync) = 0;
80
- virtual std::shared_ptr<Promise<std::string>> bolt11Invoice(const std::string& datadir, const std::string& mnemonic, double amountSat) = 0;
81
- virtual std::shared_ptr<Promise<void>> claimBolt11Payment(const std::string& datadir, const std::string& mnemonic, const std::string& bolt11) = 0;
82
- virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::string& datadir, const std::string& mnemonic, const std::vector<std::string>& vtxoIds, const std::optional<std::string>& optionalAddress, bool no_sync) = 0;
83
- virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::string& datadir, const std::string& mnemonic, const std::optional<std::string>& optionalAddress, bool no_sync) = 0;
84
- virtual std::shared_ptr<Promise<std::string>> exitStartSpecific(const std::string& datadir, const std::string& mnemonic, const std::vector<std::string>& vtxoIds, bool no_sync) = 0;
85
- virtual std::shared_ptr<Promise<std::string>> exitStartAll(const std::string& datadir, const std::string& mnemonic, bool no_sync) = 0;
86
- virtual std::shared_ptr<Promise<std::string>> exitProgressOnce(const std::string& datadir, const std::string& mnemonic) = 0;
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;
87
88
 
88
89
  protected:
89
90
  // Hybrid Setup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-ark",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Pure C++ Nitro Modules for Ark client",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -56,118 +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
- createWallet(datadir: string, opts: BarkCreateOpts): Promise<void>; // Returns void on success, throws on error
59
+ loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
60
+ closeWallet(): Promise<void>;
60
61
 
61
62
  // --- Wallet Info ---
62
- getBalance(
63
- datadir: string,
64
- no_sync: boolean,
65
- mnemonic: string
66
- ): Promise<BarkBalance>;
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
- datadir: string,
104
- mnemonic: string,
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
 
135
97
  // --- Lightning Operations ---
136
- bolt11Invoice(
137
- datadir: string,
138
- mnemonic: string,
139
- amountSat: number
140
- ): Promise<string>; // Returns invoice string
141
- claimBolt11Payment(
142
- datadir: string,
143
- mnemonic: string,
144
- bolt11: string
145
- ): Promise<void>; // Throws on error
98
+ bolt11Invoice(amountMsat: number): Promise<string>; // Returns invoice string
99
+ claimBolt11Payment(bolt11: string): Promise<void>; // Throws on error
146
100
 
147
101
  // --- Offboarding / Exiting ---
148
102
  offboardSpecific(
149
- datadir: string,
150
- mnemonic: string,
151
103
  vtxoIds: string[],
152
104
  optionalAddress: string | null,
153
105
  no_sync: boolean
154
106
  ): Promise<string>; // Returns JSON result
155
107
  offboardAll(
156
- datadir: string,
157
- mnemonic: string,
158
108
  optionalAddress: string | null,
159
109
  no_sync: boolean
160
110
  ): Promise<string>; // Returns JSON result
161
- exitStartSpecific(
162
- datadir: string,
163
- mnemonic: string,
164
- vtxoIds: string[],
165
- no_sync: boolean
166
- ): Promise<string>; // Returns JSON status
167
- exitStartAll(
168
- datadir: string,
169
- mnemonic: string,
170
- no_sync: boolean
171
- ): Promise<string>; // Returns JSON status
172
- 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
173
114
  }