react-native-nitro-ark 0.0.32 → 0.0.33
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 +12 -7
- package/cpp/generated/ark_cxx.h +13 -1
- package/lib/module/index.js +6 -6
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +6 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +7 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +4 -1
- package/nitrogen/generated/shared/c++/OnchainPaymentResult.hpp +77 -0
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +8 -3
- package/src/index.tsx +9 -8
package/cpp/NitroArk.hpp
CHANGED
|
@@ -258,15 +258,20 @@ namespace margelo::nitro::nitroark
|
|
|
258
258
|
|
|
259
259
|
// --- Onchain Operations ---
|
|
260
260
|
|
|
261
|
-
std::shared_ptr<Promise<
|
|
262
|
-
sendOnchain(const std::string &destination, double amountSat
|
|
263
|
-
bool no_sync) override
|
|
261
|
+
std::shared_ptr<Promise<OnchainPaymentResult>>
|
|
262
|
+
sendOnchain(const std::string &destination, double amountSat) override
|
|
264
263
|
{
|
|
265
|
-
return Promise<
|
|
266
|
-
|
|
264
|
+
return Promise<OnchainPaymentResult>::async([destination, amountSat]()
|
|
265
|
+
{
|
|
267
266
|
try {
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
bark_cxx::OnchainPaymentResult rust_result = bark_cxx::send_onchain(destination, static_cast<uint64_t>(amountSat));
|
|
268
|
+
|
|
269
|
+
OnchainPaymentResult result;
|
|
270
|
+
result.txid = std::string(rust_result.txid.data(), rust_result.txid.length());
|
|
271
|
+
result.amount_sat = static_cast<double>(rust_result.amount_sat);
|
|
272
|
+
result.destination_address = std::string(rust_result.destination_address.data(), rust_result.destination_address.length());
|
|
273
|
+
|
|
274
|
+
return result;
|
|
270
275
|
} catch (const rust::Error &e) {
|
|
271
276
|
throw std::runtime_error(e.what());
|
|
272
277
|
} });
|
package/cpp/generated/ark_cxx.h
CHANGED
|
@@ -801,6 +801,7 @@ namespace bark_cxx {
|
|
|
801
801
|
struct Bolt11PaymentResult;
|
|
802
802
|
struct LnurlPaymentResult;
|
|
803
803
|
struct ArkoorPaymentResult;
|
|
804
|
+
struct OnchainPaymentResult;
|
|
804
805
|
struct CxxArkInfo;
|
|
805
806
|
struct ConfigOpts;
|
|
806
807
|
struct CreateOpts;
|
|
@@ -853,6 +854,17 @@ struct ArkoorPaymentResult final {
|
|
|
853
854
|
};
|
|
854
855
|
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ArkoorPaymentResult
|
|
855
856
|
|
|
857
|
+
#ifndef CXXBRIDGE1_STRUCT_bark_cxx$OnchainPaymentResult
|
|
858
|
+
#define CXXBRIDGE1_STRUCT_bark_cxx$OnchainPaymentResult
|
|
859
|
+
struct OnchainPaymentResult final {
|
|
860
|
+
::rust::String txid;
|
|
861
|
+
::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);
|
|
862
|
+
::rust::String destination_address;
|
|
863
|
+
|
|
864
|
+
using IsRelocatable = ::std::true_type;
|
|
865
|
+
};
|
|
866
|
+
#endif // CXXBRIDGE1_STRUCT_bark_cxx$OnchainPaymentResult
|
|
867
|
+
|
|
856
868
|
#ifndef CXXBRIDGE1_STRUCT_bark_cxx$CxxArkInfo
|
|
857
869
|
#define CXXBRIDGE1_STRUCT_bark_cxx$CxxArkInfo
|
|
858
870
|
struct CxxArkInfo final {
|
|
@@ -958,7 +970,7 @@ void sync_rounds();
|
|
|
958
970
|
|
|
959
971
|
void load_wallet(::rust::Str datadir, ::bark_cxx::CreateOpts opts);
|
|
960
972
|
|
|
961
|
-
::
|
|
973
|
+
::bark_cxx::OnchainPaymentResult send_onchain(::rust::Str destination, ::std::uint64_t amount_sat);
|
|
962
974
|
|
|
963
975
|
::rust::String drain_onchain(::rust::Str destination, bool no_sync);
|
|
964
976
|
|
package/lib/module/index.js
CHANGED
|
@@ -150,10 +150,10 @@ export function getVtxos(no_sync = false) {
|
|
|
150
150
|
* @param destination The destination Bitcoin address.
|
|
151
151
|
* @param amountSat The amount to send in satoshis.
|
|
152
152
|
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
153
|
-
* @returns A promise resolving to the
|
|
153
|
+
* @returns A promise resolving to the OnchainPaymentResult object
|
|
154
154
|
*/
|
|
155
|
-
export function sendOnchain(destination, amountSat
|
|
156
|
-
return NitroArkHybridObject.sendOnchain(destination, amountSat
|
|
155
|
+
export function sendOnchain(destination, amountSat) {
|
|
156
|
+
return NitroArkHybridObject.sendOnchain(destination, amountSat);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/**
|
|
@@ -219,7 +219,7 @@ export function boardAll() {
|
|
|
219
219
|
* Sends an Arkoor payment.
|
|
220
220
|
* @param destination The destination Arkoor address.
|
|
221
221
|
* @param amountSat The amount in satoshis to send.
|
|
222
|
-
* @returns A promise resolving to
|
|
222
|
+
* @returns A promise resolving to the ArkoorPaymentResult object
|
|
223
223
|
*/
|
|
224
224
|
export function sendArkoorPayment(destination, amountSat) {
|
|
225
225
|
return NitroArkHybridObject.sendArkoorPayment(destination, amountSat);
|
|
@@ -229,7 +229,7 @@ export function sendArkoorPayment(destination, amountSat) {
|
|
|
229
229
|
* Sends a Bolt11 payment.
|
|
230
230
|
* @param destination The Bolt11 invoice.
|
|
231
231
|
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
232
|
-
* @returns A promise resolving to a
|
|
232
|
+
* @returns A promise resolving to a Bolt11PaymentResult object
|
|
233
233
|
*/
|
|
234
234
|
export function sendBolt11Payment(destination, amountSat) {
|
|
235
235
|
return NitroArkHybridObject.sendBolt11Payment(destination, amountSat);
|
|
@@ -240,7 +240,7 @@ export function sendBolt11Payment(destination, amountSat) {
|
|
|
240
240
|
* @param addr The Lightning Address.
|
|
241
241
|
* @param amountSat The amount in satoshis to send.
|
|
242
242
|
* @param comment An optional comment.
|
|
243
|
-
* @returns A promise resolving to a
|
|
243
|
+
* @returns A promise resolving to a LnurlPaymentResult object
|
|
244
244
|
*/
|
|
245
245
|
export function sendLnaddr(addr, amountSat, comment) {
|
|
246
246
|
return NitroArkHybridObject.sendLnaddr(addr, amountSat, comment);
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NitroModules","NitroArkHybridObject","createHybridObject","createMnemonic","loadWallet","datadir","opts","closeWallet","isWalletLoaded","persistConfig","maintenance","sync","syncArk","syncRounds","getArkInfo","onchainBalance","offchainBalance","getOnchainAddress","getOnchainUtxos","no_sync","getVtxoPubkey","index","getVtxos","sendOnchain","destination","amountSat","drainOnchain","sendManyOnchain","outputs","bolt11Invoice","amountMsat","claimBolt11Payment","bolt11","boardAmount","boardAll","sendArkoorPayment","sendBolt11Payment","sendLnaddr","addr","comment","sendRoundOnchain","offboardSpecific","vtxoIds","destinationAddress","offboardAll","startExitForVtxos","exitStartSpecific","startExitForEntireWallet","exitStartAll","exitProgressOnce"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"names":["NitroModules","NitroArkHybridObject","createHybridObject","createMnemonic","loadWallet","datadir","opts","closeWallet","isWalletLoaded","persistConfig","maintenance","sync","syncArk","syncRounds","getArkInfo","onchainBalance","offchainBalance","getOnchainAddress","getOnchainUtxos","no_sync","getVtxoPubkey","index","getVtxos","sendOnchain","destination","amountSat","drainOnchain","sendManyOnchain","outputs","bolt11Invoice","amountMsat","claimBolt11Payment","bolt11","boardAmount","boardAll","sendArkoorPayment","sendBolt11Payment","sendLnaddr","addr","comment","sendRoundOnchain","offboardSpecific","vtxoIds","destinationAddress","offboardAll","startExitForVtxos","exitStartSpecific","startExitForEntireWallet","exitStartAll","exitProgressOnce"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAazD;AACA,OAAO,MAAMC,oBAAoB,GAC/BD,YAAY,CAACE,kBAAkB,CAAW,UAAU,CAAC;;AAEvD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAoB;EAChD,OAAOF,oBAAoB,CAACE,cAAc,CAAC,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CACxBC,OAAe,EACfC,IAAoB,EACL;EACf,OAAOL,oBAAoB,CAACG,UAAU,CAACC,OAAO,EAAEC,IAAI,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAA,EAAkB;EAC3C,OAAON,oBAAoB,CAACM,WAAW,CAAC,CAAC;AAC3C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAqB;EACjD,OAAOP,oBAAoB,CAACO,cAAc,CAAC,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACH,IAAoB,EAAiB;EACjE,OAAOL,oBAAoB,CAACQ,aAAa,CAACH,IAAI,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASI,WAAWA,CAAA,EAAkB;EAC3C,OAAOT,oBAAoB,CAACS,WAAW,CAAC,CAAC;AAC3C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAAA,EAAkB;EACpC,OAAOV,oBAAoB,CAACU,IAAI,CAAC,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAA,EAAkB;EACvC,OAAOX,oBAAoB,CAACW,OAAO,CAAC,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAA,EAAkB;EAC1C,OAAOZ,oBAAoB,CAACY,UAAU,CAAC,CAAC;AAC1C;;AAEA;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AClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BhB,WAAmB,EACnBC,SAAiB,EACjBN,OAAgB,GAAG,KAAK,EACP;EACjB,OAAOlB,oBAAoB,CAACuC,gBAAgB,CAAChB,WAAW,EAAEC,SAAS,EAAEN,OAAO,CAAC;AAC/E;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASsB,gBAAgBA,CAC9BC,OAAiB,EACjBC,kBAA0B,EACT;EACjB,OAAO1C,oBAAoB,CAACwC,gBAAgB,CAACC,OAAO,EAAEC,kBAAkB,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACD,kBAA0B,EAAmB;EACvE,OAAO1C,oBAAoB,CAAC2C,WAAW,CAACD,kBAAkB,CAAC;AAC7D;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,iBAAiBA,CAACH,OAAiB,EAAmB;EACpE,OAAOzC,oBAAoB,CAAC6C,iBAAiB,CAACJ,OAAO,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,wBAAwBA,CAAA,EAAoB;EAC1D,OAAO9C,oBAAoB,CAAC+C,YAAY,CAAC,CAAC;AAC5C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAA,EAAoB;EAClD,OAAOhD,oBAAoB,CAACgD,gBAAgB,CAAC,CAAC;AAChD;;AAEA","ignoreList":[]}
|
|
@@ -50,6 +50,11 @@ export interface LnurlPaymentResult {
|
|
|
50
50
|
bolt11_invoice: string;
|
|
51
51
|
preimage: string;
|
|
52
52
|
}
|
|
53
|
+
export interface OnchainPaymentResult {
|
|
54
|
+
txid: string;
|
|
55
|
+
amount_sat: number;
|
|
56
|
+
destination_address: string;
|
|
57
|
+
}
|
|
53
58
|
export interface NitroArk extends HybridObject<{
|
|
54
59
|
ios: 'c++';
|
|
55
60
|
android: 'c++';
|
|
@@ -70,7 +75,7 @@ export interface NitroArk extends HybridObject<{
|
|
|
70
75
|
getOnchainUtxos(no_sync: boolean): Promise<string>;
|
|
71
76
|
getVtxoPubkey(index?: number): Promise<string>;
|
|
72
77
|
getVtxos(no_sync: boolean): Promise<string>;
|
|
73
|
-
sendOnchain(destination: string, amountSat: number
|
|
78
|
+
sendOnchain(destination: string, amountSat: number): Promise<OnchainPaymentResult>;
|
|
74
79
|
drainOnchain(destination: string, no_sync: boolean): Promise<string>;
|
|
75
80
|
sendManyOnchain(outputs: BarkSendManyOutput[], no_sync: boolean): Promise<string>;
|
|
76
81
|
boardAmount(amountSat: number): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NitroArk.nitro.d.ts","sourceRoot":"","sources":["../../../src/NitroArk.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM/D,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM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AAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,iBAAiB,CACf,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,iBAAiB,CACf,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC/B,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,CAAC;IAGnB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGlD,gBAAgB,CACd,OAAO,EAAE,MAAM,EAAE,EACjB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,WAAW,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACrC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, Bolt11PaymentResult, LnurlPaymentResult } from './NitroArk.nitro';
|
|
1
|
+
import type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, Bolt11PaymentResult, LnurlPaymentResult, OnchainPaymentResult } from './NitroArk.nitro';
|
|
2
2
|
export declare const NitroArkHybridObject: NitroArk;
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new BIP39 mnemonic phrase.
|
|
@@ -92,9 +92,9 @@ export declare function getVtxos(no_sync?: boolean): Promise<string>;
|
|
|
92
92
|
* @param destination The destination Bitcoin address.
|
|
93
93
|
* @param amountSat The amount to send in satoshis.
|
|
94
94
|
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
95
|
-
* @returns A promise resolving to the
|
|
95
|
+
* @returns A promise resolving to the OnchainPaymentResult object
|
|
96
96
|
*/
|
|
97
|
-
export declare function sendOnchain(destination: string, amountSat: number
|
|
97
|
+
export declare function sendOnchain(destination: string, amountSat: number): Promise<OnchainPaymentResult>;
|
|
98
98
|
/**
|
|
99
99
|
* Sends all funds from the onchain wallet to a destination address.
|
|
100
100
|
* @param destination The destination Bitcoin address.
|
|
@@ -136,14 +136,14 @@ export declare function boardAll(): Promise<string>;
|
|
|
136
136
|
* Sends an Arkoor payment.
|
|
137
137
|
* @param destination The destination Arkoor address.
|
|
138
138
|
* @param amountSat The amount in satoshis to send.
|
|
139
|
-
* @returns A promise resolving to
|
|
139
|
+
* @returns A promise resolving to the ArkoorPaymentResult object
|
|
140
140
|
*/
|
|
141
141
|
export declare function sendArkoorPayment(destination: string, amountSat: number): Promise<ArkoorPaymentResult>;
|
|
142
142
|
/**
|
|
143
143
|
* Sends a Bolt11 payment.
|
|
144
144
|
* @param destination The Bolt11 invoice.
|
|
145
145
|
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
146
|
-
* @returns A promise resolving to a
|
|
146
|
+
* @returns A promise resolving to a Bolt11PaymentResult object
|
|
147
147
|
*/
|
|
148
148
|
export declare function sendBolt11Payment(destination: string, amountSat?: number): Promise<Bolt11PaymentResult>;
|
|
149
149
|
/**
|
|
@@ -151,7 +151,7 @@ export declare function sendBolt11Payment(destination: string, amountSat?: numbe
|
|
|
151
151
|
* @param addr The Lightning Address.
|
|
152
152
|
* @param amountSat The amount in satoshis to send.
|
|
153
153
|
* @param comment An optional comment.
|
|
154
|
-
* @returns A promise resolving to a
|
|
154
|
+
* @returns A promise resolving to a LnurlPaymentResult object
|
|
155
155
|
*/
|
|
156
156
|
export declare function sendLnaddr(addr: string, amountSat: number, comment: string): Promise<LnurlPaymentResult>;
|
|
157
157
|
/**
|
|
@@ -193,5 +193,5 @@ export declare function startExitForEntireWallet(): Promise<string>;
|
|
|
193
193
|
* @returns A promise resolving to a JSON status string.
|
|
194
194
|
*/
|
|
195
195
|
export declare function exitProgressOnce(): Promise<string>;
|
|
196
|
-
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, Bolt11PaymentResult, LnurlPaymentResult, } from './NitroArk.nitro';
|
|
196
|
+
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, Bolt11PaymentResult, LnurlPaymentResult, OnchainPaymentResult, } from './NitroArk.nitro';
|
|
197
197
|
//# 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,mBAAmB,EACnB,kBAAkB,
|
|
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,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,k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CAE7B;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,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CAE1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAElD;AAGD,YAAY,EACV,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC"}
|
|
@@ -19,6 +19,8 @@ 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 `OnchainPaymentResult` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::nitroark { struct OnchainPaymentResult; }
|
|
22
24
|
// Forward declaration of `BarkSendManyOutput` to properly resolve imports.
|
|
23
25
|
namespace margelo::nitro::nitroark { struct BarkSendManyOutput; }
|
|
24
26
|
// Forward declaration of `ArkoorPaymentResult` to properly resolve imports.
|
|
@@ -34,6 +36,7 @@ namespace margelo::nitro::nitroark { struct LnurlPaymentResult; }
|
|
|
34
36
|
#include "BarkConfigOpts.hpp"
|
|
35
37
|
#include "BarkArkInfo.hpp"
|
|
36
38
|
#include <optional>
|
|
39
|
+
#include "OnchainPaymentResult.hpp"
|
|
37
40
|
#include <vector>
|
|
38
41
|
#include "BarkSendManyOutput.hpp"
|
|
39
42
|
#include "ArkoorPaymentResult.hpp"
|
|
@@ -87,7 +90,7 @@ namespace margelo::nitro::nitroark {
|
|
|
87
90
|
virtual std::shared_ptr<Promise<std::string>> getOnchainUtxos(bool no_sync) = 0;
|
|
88
91
|
virtual std::shared_ptr<Promise<std::string>> getVtxoPubkey(std::optional<double> index) = 0;
|
|
89
92
|
virtual std::shared_ptr<Promise<std::string>> getVtxos(bool no_sync) = 0;
|
|
90
|
-
virtual std::shared_ptr<Promise<
|
|
93
|
+
virtual std::shared_ptr<Promise<OnchainPaymentResult>> sendOnchain(const std::string& destination, double amountSat) = 0;
|
|
91
94
|
virtual std::shared_ptr<Promise<std::string>> drainOnchain(const std::string& destination, bool no_sync) = 0;
|
|
92
95
|
virtual std::shared_ptr<Promise<std::string>> sendManyOnchain(const std::vector<BarkSendManyOutput>& outputs, bool no_sync) = 0;
|
|
93
96
|
virtual std::shared_ptr<Promise<std::string>> boardAmount(double amountSat) = 0;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// OnchainPaymentResult.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 (OnchainPaymentResult).
|
|
29
|
+
*/
|
|
30
|
+
struct OnchainPaymentResult {
|
|
31
|
+
public:
|
|
32
|
+
std::string txid SWIFT_PRIVATE;
|
|
33
|
+
double amount_sat SWIFT_PRIVATE;
|
|
34
|
+
std::string destination_address SWIFT_PRIVATE;
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
OnchainPaymentResult() = default;
|
|
38
|
+
explicit OnchainPaymentResult(std::string txid, double amount_sat, std::string destination_address): txid(txid), amount_sat(amount_sat), destination_address(destination_address) {}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace margelo::nitro::nitroark
|
|
42
|
+
|
|
43
|
+
namespace margelo::nitro {
|
|
44
|
+
|
|
45
|
+
using namespace margelo::nitro::nitroark;
|
|
46
|
+
|
|
47
|
+
// C++ OnchainPaymentResult <> JS OnchainPaymentResult (object)
|
|
48
|
+
template <>
|
|
49
|
+
struct JSIConverter<OnchainPaymentResult> final {
|
|
50
|
+
static inline OnchainPaymentResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
51
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
52
|
+
return OnchainPaymentResult(
|
|
53
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "txid")),
|
|
54
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "amount_sat")),
|
|
55
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "destination_address"))
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const OnchainPaymentResult& arg) {
|
|
59
|
+
jsi::Object obj(runtime);
|
|
60
|
+
obj.setProperty(runtime, "txid", JSIConverter<std::string>::toJSI(runtime, arg.txid));
|
|
61
|
+
obj.setProperty(runtime, "amount_sat", JSIConverter<double>::toJSI(runtime, arg.amount_sat));
|
|
62
|
+
obj.setProperty(runtime, "destination_address", JSIConverter<std::string>::toJSI(runtime, arg.destination_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, "txid"))) return false;
|
|
71
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "amount_sat"))) return false;
|
|
72
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "destination_address"))) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -64,6 +64,12 @@ export interface LnurlPaymentResult {
|
|
|
64
64
|
preimage: string;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
export interface OnchainPaymentResult {
|
|
68
|
+
txid: string; // Transaction ID
|
|
69
|
+
amount_sat: number; // Amount in satoshis
|
|
70
|
+
destination_address: string; // Destination address
|
|
71
|
+
}
|
|
72
|
+
|
|
67
73
|
// --- Nitro Module Interface ---
|
|
68
74
|
|
|
69
75
|
export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
@@ -90,9 +96,8 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
90
96
|
// --- Onchain Operations ---
|
|
91
97
|
sendOnchain(
|
|
92
98
|
destination: string,
|
|
93
|
-
amountSat: number
|
|
94
|
-
|
|
95
|
-
): Promise<string>; // Returns txid
|
|
99
|
+
amountSat: number
|
|
100
|
+
): Promise<OnchainPaymentResult>; // Returns txid
|
|
96
101
|
drainOnchain(destination: string, no_sync: boolean): Promise<string>; // Returns txid
|
|
97
102
|
sendManyOnchain(
|
|
98
103
|
outputs: BarkSendManyOutput[],
|
package/src/index.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
ArkoorPaymentResult,
|
|
9
9
|
Bolt11PaymentResult,
|
|
10
10
|
LnurlPaymentResult,
|
|
11
|
+
OnchainPaymentResult,
|
|
11
12
|
} from './NitroArk.nitro';
|
|
12
13
|
|
|
13
14
|
// Create the hybrid object instance
|
|
@@ -163,14 +164,13 @@ export function getVtxos(no_sync: boolean = false): Promise<string> {
|
|
|
163
164
|
* @param destination The destination Bitcoin address.
|
|
164
165
|
* @param amountSat The amount to send in satoshis.
|
|
165
166
|
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
166
|
-
* @returns A promise resolving to the
|
|
167
|
+
* @returns A promise resolving to the OnchainPaymentResult object
|
|
167
168
|
*/
|
|
168
169
|
export function sendOnchain(
|
|
169
170
|
destination: string,
|
|
170
|
-
amountSat: number
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return NitroArkHybridObject.sendOnchain(destination, amountSat, no_sync);
|
|
171
|
+
amountSat: number
|
|
172
|
+
): Promise<OnchainPaymentResult> {
|
|
173
|
+
return NitroArkHybridObject.sendOnchain(destination, amountSat);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
|
@@ -242,7 +242,7 @@ export function boardAll(): Promise<string> {
|
|
|
242
242
|
* Sends an Arkoor payment.
|
|
243
243
|
* @param destination The destination Arkoor address.
|
|
244
244
|
* @param amountSat The amount in satoshis to send.
|
|
245
|
-
* @returns A promise resolving to
|
|
245
|
+
* @returns A promise resolving to the ArkoorPaymentResult object
|
|
246
246
|
*/
|
|
247
247
|
export function sendArkoorPayment(
|
|
248
248
|
destination: string,
|
|
@@ -255,7 +255,7 @@ export function sendArkoorPayment(
|
|
|
255
255
|
* Sends a Bolt11 payment.
|
|
256
256
|
* @param destination The Bolt11 invoice.
|
|
257
257
|
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
|
|
258
|
-
* @returns A promise resolving to a
|
|
258
|
+
* @returns A promise resolving to a Bolt11PaymentResult object
|
|
259
259
|
*/
|
|
260
260
|
export function sendBolt11Payment(
|
|
261
261
|
destination: string,
|
|
@@ -269,7 +269,7 @@ export function sendBolt11Payment(
|
|
|
269
269
|
* @param addr The Lightning Address.
|
|
270
270
|
* @param amountSat The amount in satoshis to send.
|
|
271
271
|
* @param comment An optional comment.
|
|
272
|
-
* @returns A promise resolving to a
|
|
272
|
+
* @returns A promise resolving to a LnurlPaymentResult object
|
|
273
273
|
*/
|
|
274
274
|
export function sendLnaddr(
|
|
275
275
|
addr: string,
|
|
@@ -355,4 +355,5 @@ export type {
|
|
|
355
355
|
ArkoorPaymentResult,
|
|
356
356
|
Bolt11PaymentResult,
|
|
357
357
|
LnurlPaymentResult,
|
|
358
|
+
OnchainPaymentResult,
|
|
358
359
|
} from './NitroArk.nitro';
|