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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult,
|
|
1
|
+
import type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, LightningPaymentResult, LnurlPaymentResult, OnchainPaymentResult, BarkVtxo, OffchainBalanceResult, OnchainBalanceResult, NewAddressResult } from './NitroArk.nitro';
|
|
2
2
|
export declare const NitroArkHybridObject: NitroArk;
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new BIP39 mnemonic phrase.
|
|
@@ -40,10 +40,10 @@ export declare function maintenance(): Promise<void>;
|
|
|
40
40
|
*/
|
|
41
41
|
export declare function sync(): Promise<void>;
|
|
42
42
|
/**
|
|
43
|
-
* Synchronizes the Ark-specific
|
|
43
|
+
* Synchronizes the Ark-specific exits.
|
|
44
44
|
* @returns A promise that resolves on success.
|
|
45
45
|
*/
|
|
46
|
-
export declare function
|
|
46
|
+
export declare function syncExits(): Promise<void>;
|
|
47
47
|
/**
|
|
48
48
|
* Synchronizes the rounds of the wallet.
|
|
49
49
|
* @returns A promise that resolves on success.
|
|
@@ -54,61 +54,77 @@ export declare function syncRounds(): Promise<void>;
|
|
|
54
54
|
* @returns A promise resolving to the BarkArkInfo object.
|
|
55
55
|
*/
|
|
56
56
|
export declare function getArkInfo(): Promise<BarkArkInfo>;
|
|
57
|
-
/**
|
|
58
|
-
* Gets the onchain balance for the loaded wallet.
|
|
59
|
-
* @returns A promise resolving to the onchain balance in satoshis.
|
|
60
|
-
*/
|
|
61
|
-
export declare function onchainBalance(): Promise<number>;
|
|
62
57
|
/**
|
|
63
58
|
* Gets the offchain balance for the loaded wallet.
|
|
64
|
-
* @returns A promise resolving to the
|
|
65
|
-
*/
|
|
66
|
-
export declare function offchainBalance(): Promise<number>;
|
|
67
|
-
/**
|
|
68
|
-
* Gets a fresh onchain address for the loaded wallet.
|
|
69
|
-
* @returns A promise resolving to the Bitcoin address string.
|
|
59
|
+
* @returns A promise resolving to the OffchainBalanceResult object.
|
|
70
60
|
*/
|
|
71
|
-
export declare function
|
|
61
|
+
export declare function offchainBalance(): Promise<OffchainBalanceResult>;
|
|
72
62
|
/**
|
|
73
|
-
*
|
|
74
|
-
* @
|
|
75
|
-
* @returns A promise resolving to the JSON string of UTXOs.
|
|
63
|
+
* Derives the next keypair for the store.
|
|
64
|
+
* @returns A promise resolving to the hex-encoded public key string.
|
|
76
65
|
*/
|
|
77
|
-
export declare function
|
|
66
|
+
export declare function deriveStoreNextKeypair(): Promise<string>;
|
|
78
67
|
/**
|
|
79
68
|
* Gets the wallet's VTXO public key (hex string).
|
|
80
|
-
* @param index Index of the VTXO pubkey to retrieve.
|
|
69
|
+
* @param index Index of the VTXO pubkey to retrieve.
|
|
81
70
|
* @returns A promise resolving to the hex-encoded public key string.
|
|
82
71
|
*/
|
|
83
|
-
export declare function
|
|
72
|
+
export declare function peakKeyPair(index: number): Promise<string>;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the wallet's Address.
|
|
75
|
+
* @returns A promise resolving to NewAddressResult object.
|
|
76
|
+
*/
|
|
77
|
+
export declare function newAddress(): Promise<NewAddressResult>;
|
|
84
78
|
/**
|
|
85
79
|
* Gets the list of VTXOs as a JSON string for the loaded wallet.
|
|
86
80
|
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
87
|
-
* @returns A promise resolving
|
|
81
|
+
* @returns A promise resolving BarkVtxo[] array.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getVtxos(): Promise<BarkVtxo[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Gets the onchain balance for the loaded wallet.
|
|
86
|
+
* @returns A promise resolving to the OnchainBalanceResult object.
|
|
88
87
|
*/
|
|
89
|
-
export declare function
|
|
88
|
+
export declare function onchainBalance(): Promise<OnchainBalanceResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Synchronizes the onchain state of the wallet.
|
|
91
|
+
* @returns A promise that resolves on success.
|
|
92
|
+
*/
|
|
93
|
+
export declare function onchainSync(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Gets the list of unspent onchain outputs as a JSON string for the loaded wallet.
|
|
96
|
+
* @returns A promise resolving to the JSON string of unspent outputs.
|
|
97
|
+
*/
|
|
98
|
+
export declare function onchainListUnspent(): Promise<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the list of onchain UTXOs as a JSON string for the loaded wallet.
|
|
101
|
+
* @returns A promise resolving to the JSON string of UTXOs.
|
|
102
|
+
*/
|
|
103
|
+
export declare function onchainUtxos(): Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* Gets a fresh onchain address for the loaded wallet.
|
|
106
|
+
* @returns A promise resolving to the Bitcoin address string.
|
|
107
|
+
*/
|
|
108
|
+
export declare function onchainAddress(): Promise<string>;
|
|
90
109
|
/**
|
|
91
110
|
* Sends funds using the onchain wallet.
|
|
92
111
|
* @param destination The destination Bitcoin address.
|
|
93
112
|
* @param amountSat The amount to send in satoshis.
|
|
94
|
-
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
95
113
|
* @returns A promise resolving to the OnchainPaymentResult object
|
|
96
114
|
*/
|
|
97
|
-
export declare function
|
|
115
|
+
export declare function onchainSend(destination: string, amountSat: number): Promise<OnchainPaymentResult>;
|
|
98
116
|
/**
|
|
99
117
|
* Sends all funds from the onchain wallet to a destination address.
|
|
100
118
|
* @param destination The destination Bitcoin address.
|
|
101
|
-
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
102
119
|
* @returns A promise resolving to the transaction ID string.
|
|
103
120
|
*/
|
|
104
|
-
export declare function
|
|
121
|
+
export declare function onchainDrain(destination: string): Promise<string>;
|
|
105
122
|
/**
|
|
106
123
|
* Sends funds to multiple recipients using the onchain wallet.
|
|
107
124
|
* @param outputs An array of objects containing destination address and amountSat.
|
|
108
|
-
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
109
125
|
* @returns A promise resolving to the transaction ID string.
|
|
110
126
|
*/
|
|
111
|
-
export declare function
|
|
127
|
+
export declare function onchainSendMany(outputs: BarkSendManyOutput[]): Promise<string>;
|
|
112
128
|
/**
|
|
113
129
|
* Creates a Bolt 11 invoice.
|
|
114
130
|
* @param amountMsat The amount in millisatoshis for the invoice.
|
|
@@ -116,11 +132,26 @@ export declare function sendManyOnchain(outputs: BarkSendManyOutput[], no_sync?:
|
|
|
116
132
|
*/
|
|
117
133
|
export declare function bolt11Invoice(amountMsat: number): Promise<string>;
|
|
118
134
|
/**
|
|
119
|
-
* Claims a
|
|
120
|
-
* @param bolt11 The
|
|
135
|
+
* Claims a Lightning payment.
|
|
136
|
+
* @param bolt11 The Lightning invoice string to claim.
|
|
121
137
|
* @returns A promise that resolves on success or rejects on error.
|
|
122
138
|
*/
|
|
123
|
-
export declare function
|
|
139
|
+
export declare function finishLightningReceive(bolt11: string): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Sends a Lightning payment.
|
|
142
|
+
* @param destination The Lightning invoice.
|
|
143
|
+
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
144
|
+
* @returns A promise resolving to a LightningPaymentResult object
|
|
145
|
+
*/
|
|
146
|
+
export declare function sendLightningPayment(destination: string, amountSat?: number): Promise<LightningPaymentResult>;
|
|
147
|
+
/**
|
|
148
|
+
* Sends a payment to a Lightning Address.
|
|
149
|
+
* @param addr The Lightning Address.
|
|
150
|
+
* @param amountSat The amount in satoshis to send.
|
|
151
|
+
* @param comment An optional comment.
|
|
152
|
+
* @returns A promise resolving to a LnurlPaymentResult object
|
|
153
|
+
*/
|
|
154
|
+
export declare function sendLnaddr(addr: string, amountSat: number, comment: string): Promise<LnurlPaymentResult>;
|
|
124
155
|
/**
|
|
125
156
|
* Boards a specific amount from the onchain wallet into Ark.
|
|
126
157
|
* @param amountSat The amount in satoshis to board.
|
|
@@ -139,29 +170,13 @@ export declare function boardAll(): Promise<string>;
|
|
|
139
170
|
* @returns A promise resolving to the ArkoorPaymentResult object
|
|
140
171
|
*/
|
|
141
172
|
export declare function sendArkoorPayment(destination: string, amountSat: number): Promise<ArkoorPaymentResult>;
|
|
142
|
-
/**
|
|
143
|
-
* Sends a Bolt11 payment.
|
|
144
|
-
* @param destination The Bolt11 invoice.
|
|
145
|
-
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
146
|
-
* @returns A promise resolving to a Bolt11PaymentResult object
|
|
147
|
-
*/
|
|
148
|
-
export declare function sendBolt11Payment(destination: string, amountSat?: number): Promise<Bolt11PaymentResult>;
|
|
149
|
-
/**
|
|
150
|
-
* Sends a payment to a Lightning Address.
|
|
151
|
-
* @param addr The Lightning Address.
|
|
152
|
-
* @param amountSat The amount in satoshis to send.
|
|
153
|
-
* @param comment An optional comment.
|
|
154
|
-
* @returns A promise resolving to a LnurlPaymentResult object
|
|
155
|
-
*/
|
|
156
|
-
export declare function sendLnaddr(addr: string, amountSat: number, comment: string): Promise<LnurlPaymentResult>;
|
|
157
173
|
/**
|
|
158
174
|
* Sends an onchain payment via an Ark round.
|
|
159
175
|
* @param destination The destination Bitcoin address.
|
|
160
176
|
* @param amountSat The amount in satoshis to send.
|
|
161
|
-
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
162
177
|
* @returns A promise resolving to a JSON status string.
|
|
163
178
|
*/
|
|
164
|
-
export declare function
|
|
179
|
+
export declare function sendRoundOnchainPayment(destination: string, amountSat: number): Promise<string>;
|
|
165
180
|
/**
|
|
166
181
|
* Offboards specific VTXOs to a destination address.
|
|
167
182
|
* @param vtxoIds Array of VtxoId strings to offboard.
|
|
@@ -177,21 +192,5 @@ export declare function offboardSpecific(vtxoIds: string[], destinationAddress:
|
|
|
177
192
|
* @returns A promise resolving to a JSON result string.
|
|
178
193
|
*/
|
|
179
194
|
export declare function offboardAll(destinationAddress: string): Promise<string>;
|
|
180
|
-
|
|
181
|
-
* Starts the exit process for specific VTXOs.
|
|
182
|
-
* @param vtxoIds Array of VtxoId strings to start exiting.
|
|
183
|
-
* @returns A promise resolving to a JSON status string.
|
|
184
|
-
*/
|
|
185
|
-
export declare function startExitForVtxos(vtxoIds: string[]): Promise<string>;
|
|
186
|
-
/**
|
|
187
|
-
* Starts the exit process for all VTXOs in the wallet.
|
|
188
|
-
* @returns A promise that resolves or rejects.
|
|
189
|
-
*/
|
|
190
|
-
export declare function startExitForEntireWallet(): Promise<void>;
|
|
191
|
-
/**
|
|
192
|
-
* Progresses the exit process once and returns the current status.
|
|
193
|
-
* @returns A promise resolving to a JSON status string.
|
|
194
|
-
*/
|
|
195
|
-
export declare function exitProgressOnce(): Promise<string>;
|
|
196
|
-
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, Bolt11PaymentResult, LnurlPaymentResult, OnchainPaymentResult, PaymentTypes, } from './NitroArk.nitro';
|
|
195
|
+
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, LightningPaymentResult, LnurlPaymentResult, OnchainPaymentResult, PaymentTypes, OffchainBalanceResult, OnchainBalanceResult, NewAddressResult, } from './NitroArk.nitro';
|
|
197
196
|
//# 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,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"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"}
|
|
@@ -16,36 +16,37 @@ namespace margelo::nitro::nitroark {
|
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
17
|
prototype.registerHybridMethod("createMnemonic", &HybridNitroArkSpec::createMnemonic);
|
|
18
18
|
prototype.registerHybridMethod("loadWallet", &HybridNitroArkSpec::loadWallet);
|
|
19
|
-
prototype.registerHybridMethod("closeWallet", &HybridNitroArkSpec::closeWallet);
|
|
20
19
|
prototype.registerHybridMethod("isWalletLoaded", &HybridNitroArkSpec::isWalletLoaded);
|
|
20
|
+
prototype.registerHybridMethod("closeWallet", &HybridNitroArkSpec::closeWallet);
|
|
21
21
|
prototype.registerHybridMethod("persistConfig", &HybridNitroArkSpec::persistConfig);
|
|
22
22
|
prototype.registerHybridMethod("maintenance", &HybridNitroArkSpec::maintenance);
|
|
23
23
|
prototype.registerHybridMethod("sync", &HybridNitroArkSpec::sync);
|
|
24
|
-
prototype.registerHybridMethod("
|
|
24
|
+
prototype.registerHybridMethod("syncExits", &HybridNitroArkSpec::syncExits);
|
|
25
25
|
prototype.registerHybridMethod("syncRounds", &HybridNitroArkSpec::syncRounds);
|
|
26
26
|
prototype.registerHybridMethod("getArkInfo", &HybridNitroArkSpec::getArkInfo);
|
|
27
|
-
prototype.registerHybridMethod("onchainBalance", &HybridNitroArkSpec::onchainBalance);
|
|
28
27
|
prototype.registerHybridMethod("offchainBalance", &HybridNitroArkSpec::offchainBalance);
|
|
29
|
-
prototype.registerHybridMethod("
|
|
30
|
-
prototype.registerHybridMethod("
|
|
31
|
-
prototype.registerHybridMethod("
|
|
28
|
+
prototype.registerHybridMethod("deriveStoreNextKeypair", &HybridNitroArkSpec::deriveStoreNextKeypair);
|
|
29
|
+
prototype.registerHybridMethod("peakKeyPair", &HybridNitroArkSpec::peakKeyPair);
|
|
30
|
+
prototype.registerHybridMethod("newAddress", &HybridNitroArkSpec::newAddress);
|
|
32
31
|
prototype.registerHybridMethod("getVtxos", &HybridNitroArkSpec::getVtxos);
|
|
33
|
-
prototype.registerHybridMethod("
|
|
34
|
-
prototype.registerHybridMethod("
|
|
35
|
-
prototype.registerHybridMethod("
|
|
32
|
+
prototype.registerHybridMethod("onchainBalance", &HybridNitroArkSpec::onchainBalance);
|
|
33
|
+
prototype.registerHybridMethod("onchainSync", &HybridNitroArkSpec::onchainSync);
|
|
34
|
+
prototype.registerHybridMethod("onchainListUnspent", &HybridNitroArkSpec::onchainListUnspent);
|
|
35
|
+
prototype.registerHybridMethod("onchainUtxos", &HybridNitroArkSpec::onchainUtxos);
|
|
36
|
+
prototype.registerHybridMethod("onchainAddress", &HybridNitroArkSpec::onchainAddress);
|
|
37
|
+
prototype.registerHybridMethod("onchainSend", &HybridNitroArkSpec::onchainSend);
|
|
38
|
+
prototype.registerHybridMethod("onchainDrain", &HybridNitroArkSpec::onchainDrain);
|
|
39
|
+
prototype.registerHybridMethod("onchainSendMany", &HybridNitroArkSpec::onchainSendMany);
|
|
36
40
|
prototype.registerHybridMethod("boardAmount", &HybridNitroArkSpec::boardAmount);
|
|
37
41
|
prototype.registerHybridMethod("boardAll", &HybridNitroArkSpec::boardAll);
|
|
38
42
|
prototype.registerHybridMethod("sendArkoorPayment", &HybridNitroArkSpec::sendArkoorPayment);
|
|
39
|
-
prototype.registerHybridMethod("
|
|
43
|
+
prototype.registerHybridMethod("sendLightningPayment", &HybridNitroArkSpec::sendLightningPayment);
|
|
40
44
|
prototype.registerHybridMethod("sendLnaddr", &HybridNitroArkSpec::sendLnaddr);
|
|
41
|
-
prototype.registerHybridMethod("
|
|
45
|
+
prototype.registerHybridMethod("sendRoundOnchainPayment", &HybridNitroArkSpec::sendRoundOnchainPayment);
|
|
42
46
|
prototype.registerHybridMethod("bolt11Invoice", &HybridNitroArkSpec::bolt11Invoice);
|
|
43
|
-
prototype.registerHybridMethod("
|
|
47
|
+
prototype.registerHybridMethod("finishLightningReceive", &HybridNitroArkSpec::finishLightningReceive);
|
|
44
48
|
prototype.registerHybridMethod("offboardSpecific", &HybridNitroArkSpec::offboardSpecific);
|
|
45
49
|
prototype.registerHybridMethod("offboardAll", &HybridNitroArkSpec::offboardAll);
|
|
46
|
-
prototype.registerHybridMethod("exitStartSpecific", &HybridNitroArkSpec::exitStartSpecific);
|
|
47
|
-
prototype.registerHybridMethod("startExitForEntireWallet", &HybridNitroArkSpec::startExitForEntireWallet);
|
|
48
|
-
prototype.registerHybridMethod("exitProgressOnce", &HybridNitroArkSpec::exitProgressOnce);
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -19,14 +19,22 @@ namespace margelo::nitro::nitroark { struct BarkCreateOpts; }
|
|
|
19
19
|
namespace margelo::nitro::nitroark { struct BarkConfigOpts; }
|
|
20
20
|
// Forward declaration of `BarkArkInfo` to properly resolve imports.
|
|
21
21
|
namespace margelo::nitro::nitroark { struct BarkArkInfo; }
|
|
22
|
+
// Forward declaration of `OffchainBalanceResult` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::nitroark { struct OffchainBalanceResult; }
|
|
24
|
+
// Forward declaration of `NewAddressResult` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::nitroark { struct NewAddressResult; }
|
|
26
|
+
// Forward declaration of `BarkVtxo` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitroark { struct BarkVtxo; }
|
|
28
|
+
// Forward declaration of `OnchainBalanceResult` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::nitroark { struct OnchainBalanceResult; }
|
|
22
30
|
// Forward declaration of `OnchainPaymentResult` to properly resolve imports.
|
|
23
31
|
namespace margelo::nitro::nitroark { struct OnchainPaymentResult; }
|
|
24
32
|
// Forward declaration of `BarkSendManyOutput` to properly resolve imports.
|
|
25
33
|
namespace margelo::nitro::nitroark { struct BarkSendManyOutput; }
|
|
26
34
|
// Forward declaration of `ArkoorPaymentResult` to properly resolve imports.
|
|
27
35
|
namespace margelo::nitro::nitroark { struct ArkoorPaymentResult; }
|
|
28
|
-
// Forward declaration of `
|
|
29
|
-
namespace margelo::nitro::nitroark { struct
|
|
36
|
+
// Forward declaration of `LightningPaymentResult` to properly resolve imports.
|
|
37
|
+
namespace margelo::nitro::nitroark { struct LightningPaymentResult; }
|
|
30
38
|
// Forward declaration of `LnurlPaymentResult` to properly resolve imports.
|
|
31
39
|
namespace margelo::nitro::nitroark { struct LnurlPaymentResult; }
|
|
32
40
|
|
|
@@ -35,12 +43,16 @@ namespace margelo::nitro::nitroark { struct LnurlPaymentResult; }
|
|
|
35
43
|
#include "BarkCreateOpts.hpp"
|
|
36
44
|
#include "BarkConfigOpts.hpp"
|
|
37
45
|
#include "BarkArkInfo.hpp"
|
|
38
|
-
#include
|
|
39
|
-
#include "
|
|
46
|
+
#include "OffchainBalanceResult.hpp"
|
|
47
|
+
#include "NewAddressResult.hpp"
|
|
40
48
|
#include <vector>
|
|
49
|
+
#include "BarkVtxo.hpp"
|
|
50
|
+
#include "OnchainBalanceResult.hpp"
|
|
51
|
+
#include "OnchainPaymentResult.hpp"
|
|
52
|
+
#include <optional>
|
|
41
53
|
#include "BarkSendManyOutput.hpp"
|
|
42
54
|
#include "ArkoorPaymentResult.hpp"
|
|
43
|
-
#include "
|
|
55
|
+
#include "LightningPaymentResult.hpp"
|
|
44
56
|
#include "LnurlPaymentResult.hpp"
|
|
45
57
|
|
|
46
58
|
namespace margelo::nitro::nitroark {
|
|
@@ -76,36 +88,37 @@ namespace margelo::nitro::nitroark {
|
|
|
76
88
|
// Methods
|
|
77
89
|
virtual std::shared_ptr<Promise<std::string>> createMnemonic() = 0;
|
|
78
90
|
virtual std::shared_ptr<Promise<void>> loadWallet(const std::string& datadir, const BarkCreateOpts& opts) = 0;
|
|
79
|
-
virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
|
|
80
91
|
virtual std::shared_ptr<Promise<bool>> isWalletLoaded() = 0;
|
|
92
|
+
virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
|
|
81
93
|
virtual std::shared_ptr<Promise<void>> persistConfig(const BarkConfigOpts& opts) = 0;
|
|
82
94
|
virtual std::shared_ptr<Promise<void>> maintenance() = 0;
|
|
83
95
|
virtual std::shared_ptr<Promise<void>> sync() = 0;
|
|
84
|
-
virtual std::shared_ptr<Promise<void>>
|
|
96
|
+
virtual std::shared_ptr<Promise<void>> syncExits() = 0;
|
|
85
97
|
virtual std::shared_ptr<Promise<void>> syncRounds() = 0;
|
|
86
98
|
virtual std::shared_ptr<Promise<BarkArkInfo>> getArkInfo() = 0;
|
|
87
|
-
virtual std::shared_ptr<Promise<
|
|
88
|
-
virtual std::shared_ptr<Promise<
|
|
89
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
90
|
-
virtual std::shared_ptr<Promise<
|
|
91
|
-
virtual std::shared_ptr<Promise<std::
|
|
92
|
-
virtual std::shared_ptr<Promise<
|
|
93
|
-
virtual std::shared_ptr<Promise<
|
|
94
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
95
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
99
|
+
virtual std::shared_ptr<Promise<OffchainBalanceResult>> offchainBalance() = 0;
|
|
100
|
+
virtual std::shared_ptr<Promise<std::string>> deriveStoreNextKeypair() = 0;
|
|
101
|
+
virtual std::shared_ptr<Promise<std::string>> peakKeyPair(double index) = 0;
|
|
102
|
+
virtual std::shared_ptr<Promise<NewAddressResult>> newAddress() = 0;
|
|
103
|
+
virtual std::shared_ptr<Promise<std::vector<BarkVtxo>>> getVtxos() = 0;
|
|
104
|
+
virtual std::shared_ptr<Promise<OnchainBalanceResult>> onchainBalance() = 0;
|
|
105
|
+
virtual std::shared_ptr<Promise<void>> onchainSync() = 0;
|
|
106
|
+
virtual std::shared_ptr<Promise<std::string>> onchainListUnspent() = 0;
|
|
107
|
+
virtual std::shared_ptr<Promise<std::string>> onchainUtxos() = 0;
|
|
108
|
+
virtual std::shared_ptr<Promise<std::string>> onchainAddress() = 0;
|
|
109
|
+
virtual std::shared_ptr<Promise<OnchainPaymentResult>> onchainSend(const std::string& destination, double amountSat, std::optional<double> feeRate) = 0;
|
|
110
|
+
virtual std::shared_ptr<Promise<std::string>> onchainDrain(const std::string& destination, std::optional<double> feeRate) = 0;
|
|
111
|
+
virtual std::shared_ptr<Promise<std::string>> onchainSendMany(const std::vector<BarkSendManyOutput>& outputs, std::optional<double> feeRate) = 0;
|
|
96
112
|
virtual std::shared_ptr<Promise<std::string>> boardAmount(double amountSat) = 0;
|
|
97
113
|
virtual std::shared_ptr<Promise<std::string>> boardAll() = 0;
|
|
98
114
|
virtual std::shared_ptr<Promise<ArkoorPaymentResult>> sendArkoorPayment(const std::string& destination, double amountSat) = 0;
|
|
99
|
-
virtual std::shared_ptr<Promise<
|
|
115
|
+
virtual std::shared_ptr<Promise<LightningPaymentResult>> sendLightningPayment(const std::string& destination, std::optional<double> amountSat) = 0;
|
|
100
116
|
virtual std::shared_ptr<Promise<LnurlPaymentResult>> sendLnaddr(const std::string& addr, double amountSat, const std::string& comment) = 0;
|
|
101
|
-
virtual std::shared_ptr<Promise<std::string>>
|
|
117
|
+
virtual std::shared_ptr<Promise<std::string>> sendRoundOnchainPayment(const std::string& destination, double amountSat) = 0;
|
|
102
118
|
virtual std::shared_ptr<Promise<std::string>> bolt11Invoice(double amountMsat) = 0;
|
|
103
|
-
virtual std::shared_ptr<Promise<void>>
|
|
119
|
+
virtual std::shared_ptr<Promise<void>> finishLightningReceive(const std::string& bolt11) = 0;
|
|
104
120
|
virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::vector<std::string>& vtxoIds, const std::string& destinationAddress) = 0;
|
|
105
121
|
virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::string& destinationAddress) = 0;
|
|
106
|
-
virtual std::shared_ptr<Promise<std::string>> exitStartSpecific(const std::vector<std::string>& vtxoIds) = 0;
|
|
107
|
-
virtual std::shared_ptr<Promise<void>> startExitForEntireWallet() = 0;
|
|
108
|
-
virtual std::shared_ptr<Promise<std::string>> exitProgressOnce() = 0;
|
|
109
122
|
|
|
110
123
|
protected:
|
|
111
124
|
// Hybrid Setup
|
package/nitrogen/generated/shared/c++/{Bolt11PaymentResult.hpp → LightningPaymentResult.hpp}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// LightningPaymentResult.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
@@ -27,17 +27,17 @@ namespace margelo::nitro::nitroark { enum class PaymentTypes; }
|
|
|
27
27
|
namespace margelo::nitro::nitroark {
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* A struct which can be represented as a JavaScript object (
|
|
30
|
+
* A struct which can be represented as a JavaScript object (LightningPaymentResult).
|
|
31
31
|
*/
|
|
32
|
-
struct
|
|
32
|
+
struct LightningPaymentResult {
|
|
33
33
|
public:
|
|
34
34
|
std::string bolt11_invoice SWIFT_PRIVATE;
|
|
35
35
|
std::string preimage SWIFT_PRIVATE;
|
|
36
36
|
PaymentTypes payment_type SWIFT_PRIVATE;
|
|
37
37
|
|
|
38
38
|
public:
|
|
39
|
-
|
|
40
|
-
explicit
|
|
39
|
+
LightningPaymentResult() = default;
|
|
40
|
+
explicit LightningPaymentResult(std::string bolt11_invoice, std::string preimage, PaymentTypes payment_type): bolt11_invoice(bolt11_invoice), preimage(preimage), payment_type(payment_type) {}
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
} // namespace margelo::nitro::nitroark
|
|
@@ -46,18 +46,18 @@ namespace margelo::nitro {
|
|
|
46
46
|
|
|
47
47
|
using namespace margelo::nitro::nitroark;
|
|
48
48
|
|
|
49
|
-
// C++
|
|
49
|
+
// C++ LightningPaymentResult <> JS LightningPaymentResult (object)
|
|
50
50
|
template <>
|
|
51
|
-
struct JSIConverter<
|
|
52
|
-
static inline
|
|
51
|
+
struct JSIConverter<LightningPaymentResult> final {
|
|
52
|
+
static inline LightningPaymentResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
53
|
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
-
return
|
|
54
|
+
return LightningPaymentResult(
|
|
55
55
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "bolt11_invoice")),
|
|
56
56
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "preimage")),
|
|
57
57
|
JSIConverter<PaymentTypes>::fromJSI(runtime, obj.getProperty(runtime, "payment_type"))
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const
|
|
60
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const LightningPaymentResult& arg) {
|
|
61
61
|
jsi::Object obj(runtime);
|
|
62
62
|
obj.setProperty(runtime, "bolt11_invoice", JSIConverter<std::string>::toJSI(runtime, arg.bolt11_invoice));
|
|
63
63
|
obj.setProperty(runtime, "preimage", JSIConverter<std::string>::toJSI(runtime, arg.preimage));
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NewAddressResult.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
|
+
#include <string>
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::nitroark {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A struct which can be represented as a JavaScript object (NewAddressResult).
|
|
29
|
+
*/
|
|
30
|
+
struct NewAddressResult {
|
|
31
|
+
public:
|
|
32
|
+
std::string user_pubkey SWIFT_PRIVATE;
|
|
33
|
+
std::string ark_id SWIFT_PRIVATE;
|
|
34
|
+
std::string address SWIFT_PRIVATE;
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
NewAddressResult() = default;
|
|
38
|
+
explicit NewAddressResult(std::string user_pubkey, std::string ark_id, std::string address): user_pubkey(user_pubkey), ark_id(ark_id), address(address) {}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace margelo::nitro::nitroark
|
|
42
|
+
|
|
43
|
+
namespace margelo::nitro {
|
|
44
|
+
|
|
45
|
+
using namespace margelo::nitro::nitroark;
|
|
46
|
+
|
|
47
|
+
// C++ NewAddressResult <> JS NewAddressResult (object)
|
|
48
|
+
template <>
|
|
49
|
+
struct JSIConverter<NewAddressResult> final {
|
|
50
|
+
static inline NewAddressResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
51
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
52
|
+
return NewAddressResult(
|
|
53
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "user_pubkey")),
|
|
54
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "ark_id")),
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "address"))
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const NewAddressResult& arg) {
|
|
59
|
+
jsi::Object obj(runtime);
|
|
60
|
+
obj.setProperty(runtime, "user_pubkey", JSIConverter<std::string>::toJSI(runtime, arg.user_pubkey));
|
|
61
|
+
obj.setProperty(runtime, "ark_id", JSIConverter<std::string>::toJSI(runtime, arg.ark_id));
|
|
62
|
+
obj.setProperty(runtime, "address", JSIConverter<std::string>::toJSI(runtime, arg.address));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "user_pubkey"))) return false;
|
|
71
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "ark_id"))) return false;
|
|
72
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "address"))) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// OffchainBalanceResult.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 (OffchainBalanceResult).
|
|
29
|
+
*/
|
|
30
|
+
struct OffchainBalanceResult {
|
|
31
|
+
public:
|
|
32
|
+
double spendable SWIFT_PRIVATE;
|
|
33
|
+
double pending_lightning_send SWIFT_PRIVATE;
|
|
34
|
+
double pending_exit SWIFT_PRIVATE;
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
OffchainBalanceResult() = default;
|
|
38
|
+
explicit OffchainBalanceResult(double spendable, double pending_lightning_send, double pending_exit): spendable(spendable), pending_lightning_send(pending_lightning_send), pending_exit(pending_exit) {}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace margelo::nitro::nitroark
|
|
42
|
+
|
|
43
|
+
namespace margelo::nitro {
|
|
44
|
+
|
|
45
|
+
using namespace margelo::nitro::nitroark;
|
|
46
|
+
|
|
47
|
+
// C++ OffchainBalanceResult <> JS OffchainBalanceResult (object)
|
|
48
|
+
template <>
|
|
49
|
+
struct JSIConverter<OffchainBalanceResult> final {
|
|
50
|
+
static inline OffchainBalanceResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
51
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
52
|
+
return OffchainBalanceResult(
|
|
53
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "spendable")),
|
|
54
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_lightning_send")),
|
|
55
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_exit"))
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const OffchainBalanceResult& arg) {
|
|
59
|
+
jsi::Object obj(runtime);
|
|
60
|
+
obj.setProperty(runtime, "spendable", JSIConverter<double>::toJSI(runtime, arg.spendable));
|
|
61
|
+
obj.setProperty(runtime, "pending_lightning_send", JSIConverter<double>::toJSI(runtime, arg.pending_lightning_send));
|
|
62
|
+
obj.setProperty(runtime, "pending_exit", JSIConverter<double>::toJSI(runtime, arg.pending_exit));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "spendable"))) return false;
|
|
71
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_lightning_send"))) return false;
|
|
72
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_exit"))) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro
|