react-native-nitro-ark 0.0.29 → 0.0.31
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 +151 -70
- package/cpp/generated/ark_cxx.h +35 -27
- package/lib/module/index.js +101 -47
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NitroArk.nitro.d.ts +23 -17
- package/lib/typescript/src/NitroArk.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +71 -32
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/BarkArkInfo.hpp +93 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +11 -3
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +21 -13
- package/package.json +1 -1
- package/src/NitroArk.nitro.ts +29 -39
- package/src/index.tsx +113 -80
- package/nitrogen/generated/shared/c++/BarkBalance.hpp +0 -77
- package/nitrogen/generated/shared/c++/BarkRefreshModeType.hpp +0 -94
- package/nitrogen/generated/shared/c++/BarkRefreshOpts.hpp +0 -81
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NitroModules","NitroArkHybridObject","createHybridObject","createMnemonic","loadWallet","datadir","opts","closeWallet","isWalletLoaded","
|
|
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;AASzD;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,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,oBAAoB,CAACoC,UAAU,CAACC,IAAI,EAAEb,SAAS,EAAEc,OAAO,CAAC;AAClE;;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,EAC1BxB,OAAgB,GAAG,KAAK,EACP;EACjB,OAAOlB,oBAAoB,CAACwC,gBAAgB,CAC1CC,OAAO,EACPC,kBAAkB,EAClBxB,OACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyB,WAAWA,CACzBD,kBAA0B,EAC1BxB,OAAgB,GAAG,KAAK,EACP;EACjB,OAAOlB,oBAAoB,CAAC2C,WAAW,CAACD,kBAAkB,EAAExB,OAAO,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS0B,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":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
-
export type BarkRefreshModeType = 'DefaultThreshold' | 'ThresholdBlocks' | 'ThresholdHours' | 'Counterparty' | 'All' | 'Specific';
|
|
3
2
|
export interface BarkConfigOpts {
|
|
4
3
|
asp?: string;
|
|
5
4
|
esplora?: string;
|
|
@@ -18,15 +17,14 @@ export interface BarkCreateOpts {
|
|
|
18
17
|
birthday_height?: number;
|
|
19
18
|
config?: BarkConfigOpts;
|
|
20
19
|
}
|
|
21
|
-
export interface
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
specific_vtxo_ids?: string[];
|
|
20
|
+
export interface BarkArkInfo {
|
|
21
|
+
network: string;
|
|
22
|
+
asp_pubkey: string;
|
|
23
|
+
round_interval_secs: number;
|
|
24
|
+
vtxo_exit_delta: number;
|
|
25
|
+
vtxo_expiry_delta: number;
|
|
26
|
+
htlc_expiry_delta: number;
|
|
27
|
+
max_vtxo_amount_sat: number;
|
|
30
28
|
}
|
|
31
29
|
export interface BarkSendManyOutput {
|
|
32
30
|
destination: string;
|
|
@@ -40,7 +38,14 @@ export interface NitroArk extends HybridObject<{
|
|
|
40
38
|
loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
|
|
41
39
|
closeWallet(): Promise<void>;
|
|
42
40
|
isWalletLoaded(): Promise<boolean>;
|
|
43
|
-
|
|
41
|
+
persistConfig(opts: BarkConfigOpts): Promise<void>;
|
|
42
|
+
maintenance(): Promise<void>;
|
|
43
|
+
sync(): Promise<void>;
|
|
44
|
+
syncArk(): Promise<void>;
|
|
45
|
+
syncRounds(): Promise<void>;
|
|
46
|
+
getArkInfo(): Promise<BarkArkInfo>;
|
|
47
|
+
onchainBalance(): Promise<number>;
|
|
48
|
+
offchainBalance(): Promise<number>;
|
|
44
49
|
getOnchainAddress(): Promise<string>;
|
|
45
50
|
getOnchainUtxos(no_sync: boolean): Promise<string>;
|
|
46
51
|
getVtxoPubkey(index?: number): Promise<string>;
|
|
@@ -48,15 +53,16 @@ export interface NitroArk extends HybridObject<{
|
|
|
48
53
|
sendOnchain(destination: string, amountSat: number, no_sync: boolean): Promise<string>;
|
|
49
54
|
drainOnchain(destination: string, no_sync: boolean): Promise<string>;
|
|
50
55
|
sendManyOnchain(outputs: BarkSendManyOutput[], no_sync: boolean): Promise<string>;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
boardAmount(amountSat: number): Promise<string>;
|
|
57
|
+
boardAll(): Promise<string>;
|
|
58
|
+
sendArkoorPayment(destination: string, amountSat: number): Promise<string>;
|
|
59
|
+
sendBolt11Payment(destination: string, amountSat?: number): Promise<string>;
|
|
60
|
+
sendLnaddr(addr: string, amountSat: number, comment: string): Promise<string>;
|
|
55
61
|
sendRoundOnchain(destination: string, amountSat: number, no_sync: boolean): Promise<string>;
|
|
56
62
|
bolt11Invoice(amountMsat: number): Promise<string>;
|
|
57
63
|
claimBolt11Payment(bolt11: string): Promise<void>;
|
|
58
|
-
offboardSpecific(vtxoIds: string[],
|
|
59
|
-
offboardAll(
|
|
64
|
+
offboardSpecific(vtxoIds: string[], destinationAddress: string, no_sync: boolean): Promise<string>;
|
|
65
|
+
offboardAll(destinationAddress: string, no_sync: boolean): Promise<string>;
|
|
60
66
|
exitStartSpecific(vtxoIds: string[]): Promise<string>;
|
|
61
67
|
exitStartAll(): Promise<string>;
|
|
62
68
|
exitProgressOnce(): 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;
|
|
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,CAA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WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9E,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,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,WAAW,CAAC,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3E,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,
|
|
1
|
+
import type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput } from './NitroArk.nitro';
|
|
2
2
|
export declare const NitroArkHybridObject: NitroArk;
|
|
3
3
|
/**
|
|
4
4
|
* Creates a new BIP39 mnemonic phrase.
|
|
@@ -24,11 +24,46 @@ export declare function closeWallet(): Promise<void>;
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function isWalletLoaded(): Promise<boolean>;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param
|
|
29
|
-
* @returns A promise
|
|
27
|
+
* Persists wallet configuration.
|
|
28
|
+
* @param opts The configuration options to persist.
|
|
29
|
+
* @returns A promise that resolves on success or rejects on error.
|
|
30
|
+
*/
|
|
31
|
+
export declare function persistConfig(opts: BarkConfigOpts): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Runs wallet maintenance tasks.
|
|
34
|
+
* @returns A promise that resolves on success.
|
|
35
|
+
*/
|
|
36
|
+
export declare function maintenance(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Synchronizes the wallet with the blockchain.
|
|
39
|
+
* @returns A promise that resolves on success.
|
|
40
|
+
*/
|
|
41
|
+
export declare function sync(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Synchronizes the Ark-specific parts of the wallet.
|
|
44
|
+
* @returns A promise that resolves on success.
|
|
45
|
+
*/
|
|
46
|
+
export declare function syncArk(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Synchronizes the rounds of the wallet.
|
|
49
|
+
* @returns A promise that resolves on success.
|
|
50
|
+
*/
|
|
51
|
+
export declare function syncRounds(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the Ark-specific information.
|
|
54
|
+
* @returns A promise resolving to the BarkArkInfo object.
|
|
55
|
+
*/
|
|
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.
|
|
30
60
|
*/
|
|
31
|
-
export declare function
|
|
61
|
+
export declare function onchainBalance(): Promise<number>;
|
|
62
|
+
/**
|
|
63
|
+
* Gets the offchain balance for the loaded wallet.
|
|
64
|
+
* @returns A promise resolving to the offchain balance in satoshis.
|
|
65
|
+
*/
|
|
66
|
+
export declare function offchainBalance(): Promise<number>;
|
|
32
67
|
/**
|
|
33
68
|
* Gets a fresh onchain address for the loaded wallet.
|
|
34
69
|
* @returns A promise resolving to the Bitcoin address string.
|
|
@@ -42,7 +77,7 @@ export declare function getOnchainAddress(): Promise<string>;
|
|
|
42
77
|
export declare function getOnchainUtxos(no_sync?: boolean): Promise<string>;
|
|
43
78
|
/**
|
|
44
79
|
* Gets the wallet's VTXO public key (hex string).
|
|
45
|
-
* @param index
|
|
80
|
+
* @param index Index of the VTXO pubkey to retrieve. Use u32::MAX for a new one.
|
|
46
81
|
* @returns A promise resolving to the hex-encoded public key string.
|
|
47
82
|
*/
|
|
48
83
|
export declare function getVtxoPubkey(index?: number): Promise<string>;
|
|
@@ -86,35 +121,39 @@ export declare function bolt11Invoice(amountMsat: number): Promise<string>;
|
|
|
86
121
|
* @returns A promise that resolves on success or rejects on error.
|
|
87
122
|
*/
|
|
88
123
|
export declare function claimBolt11Payment(bolt11: string): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* Refreshes VTXOs based on specified criteria for the loaded wallet.
|
|
91
|
-
* @param refreshOpts Options specifying which VTXOs to refresh.
|
|
92
|
-
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
|
|
93
|
-
* @returns A promise resolving to a JSON status string.
|
|
94
|
-
*/
|
|
95
|
-
export declare function refreshVtxos(refreshOpts: BarkRefreshOpts, no_sync?: boolean): Promise<string>;
|
|
96
124
|
/**
|
|
97
125
|
* Boards a specific amount from the onchain wallet into Ark.
|
|
98
126
|
* @param amountSat The amount in satoshis to board.
|
|
99
|
-
* @param no_sync If true, skips synchronization with the onchain wallet. Defaults to false.
|
|
100
127
|
* @returns A promise resolving to a JSON status string.
|
|
101
128
|
*/
|
|
102
|
-
export declare function boardAmount(amountSat: number
|
|
129
|
+
export declare function boardAmount(amountSat: number): Promise<string>;
|
|
103
130
|
/**
|
|
104
131
|
* Boards all available funds from the onchain wallet into Ark.
|
|
105
|
-
* @param no_sync If true, skips synchronization with the onchain wallet. Defaults to false.
|
|
106
132
|
* @returns A promise resolving to a JSON status string.
|
|
107
133
|
*/
|
|
108
|
-
export declare function boardAll(
|
|
134
|
+
export declare function boardAll(): Promise<string>;
|
|
109
135
|
/**
|
|
110
|
-
* Sends
|
|
111
|
-
* @param destination
|
|
136
|
+
* Sends an Arkoor payment.
|
|
137
|
+
* @param destination The destination Arkoor address.
|
|
112
138
|
* @param amountSat The amount in satoshis to send.
|
|
113
|
-
* @
|
|
114
|
-
|
|
115
|
-
|
|
139
|
+
* @returns A promise resolving to a result string.
|
|
140
|
+
*/
|
|
141
|
+
export declare function sendArkoorPayment(destination: string, amountSat: number): Promise<string>;
|
|
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 result string.
|
|
147
|
+
*/
|
|
148
|
+
export declare function sendBolt11Payment(destination: string, amountSat?: number): Promise<string>;
|
|
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 result string.
|
|
116
155
|
*/
|
|
117
|
-
export declare function
|
|
156
|
+
export declare function sendLnaddr(addr: string, amountSat: number, comment: string): Promise<string>;
|
|
118
157
|
/**
|
|
119
158
|
* Sends an onchain payment via an Ark round.
|
|
120
159
|
* @param destination The destination Bitcoin address.
|
|
@@ -124,35 +163,35 @@ export declare function send(destination: string, amountSat: number | null, comm
|
|
|
124
163
|
*/
|
|
125
164
|
export declare function sendRoundOnchain(destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
|
|
126
165
|
/**
|
|
127
|
-
* Offboards specific VTXOs to
|
|
166
|
+
* Offboards specific VTXOs to a destination address.
|
|
128
167
|
* @param vtxoIds Array of VtxoId strings to offboard.
|
|
129
|
-
* @param
|
|
168
|
+
* @param destinationAddress Destination Bitcoin address (if empty, sends to internal wallet).
|
|
130
169
|
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
131
170
|
* @returns A promise resolving to a JSON result string.
|
|
132
171
|
*/
|
|
133
|
-
export declare function offboardSpecific(vtxoIds: string[],
|
|
172
|
+
export declare function offboardSpecific(vtxoIds: string[], destinationAddress: string, no_sync?: boolean): Promise<string>;
|
|
134
173
|
/**
|
|
135
|
-
* Offboards all VTXOs to
|
|
136
|
-
* @param
|
|
174
|
+
* Offboards all VTXOs to a destination address.
|
|
175
|
+
* @param destinationAddress Destination Bitcoin address (if empty, sends to internal wallet).
|
|
137
176
|
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
|
|
138
177
|
* @returns A promise resolving to a JSON result string.
|
|
139
178
|
*/
|
|
140
|
-
export declare function offboardAll(
|
|
179
|
+
export declare function offboardAll(destinationAddress: string, no_sync?: boolean): Promise<string>;
|
|
141
180
|
/**
|
|
142
181
|
* Starts the exit process for specific VTXOs.
|
|
143
182
|
* @param vtxoIds Array of VtxoId strings to start exiting.
|
|
144
183
|
* @returns A promise resolving to a JSON status string.
|
|
145
184
|
*/
|
|
146
|
-
export declare function
|
|
185
|
+
export declare function startExitForVtxos(vtxoIds: string[]): Promise<string>;
|
|
147
186
|
/**
|
|
148
187
|
* Starts the exit process for all VTXOs in the wallet.
|
|
149
188
|
* @returns A promise resolving to a JSON status string.
|
|
150
189
|
*/
|
|
151
|
-
export declare function
|
|
190
|
+
export declare function startExitForEntireWallet(): Promise<string>;
|
|
152
191
|
/**
|
|
153
192
|
* Progresses the exit process once and returns the current status.
|
|
154
193
|
* @returns A promise resolving to a JSON status string.
|
|
155
194
|
*/
|
|
156
195
|
export declare function exitProgressOnce(): Promise<string>;
|
|
157
|
-
export type { BarkCreateOpts, BarkConfigOpts,
|
|
196
|
+
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, } from './NitroArk.nitro';
|
|
158
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,WAAW,EACX,
|
|
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,EACnB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,oBAAoB,UACsB,CAAC;AAIxD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3C;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3C;AAED;;;GAGG;AACH,wBAAgB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvC;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1C;AAID;;;GAGG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,CAEjD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAEhD;A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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 (BarkArkInfo).
|
|
29
|
+
*/
|
|
30
|
+
struct BarkArkInfo {
|
|
31
|
+
public:
|
|
32
|
+
std::string network SWIFT_PRIVATE;
|
|
33
|
+
std::string asp_pubkey SWIFT_PRIVATE;
|
|
34
|
+
double round_interval_secs SWIFT_PRIVATE;
|
|
35
|
+
double vtxo_exit_delta SWIFT_PRIVATE;
|
|
36
|
+
double vtxo_expiry_delta SWIFT_PRIVATE;
|
|
37
|
+
double htlc_expiry_delta SWIFT_PRIVATE;
|
|
38
|
+
double max_vtxo_amount_sat SWIFT_PRIVATE;
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
BarkArkInfo() = default;
|
|
42
|
+
explicit BarkArkInfo(std::string network, std::string asp_pubkey, double round_interval_secs, double vtxo_exit_delta, double vtxo_expiry_delta, double htlc_expiry_delta, double max_vtxo_amount_sat): network(network), asp_pubkey(asp_pubkey), round_interval_secs(round_interval_secs), vtxo_exit_delta(vtxo_exit_delta), vtxo_expiry_delta(vtxo_expiry_delta), htlc_expiry_delta(htlc_expiry_delta), max_vtxo_amount_sat(max_vtxo_amount_sat) {}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace margelo::nitro::nitroark
|
|
46
|
+
|
|
47
|
+
namespace margelo::nitro {
|
|
48
|
+
|
|
49
|
+
using namespace margelo::nitro::nitroark;
|
|
50
|
+
|
|
51
|
+
// C++ BarkArkInfo <> JS BarkArkInfo (object)
|
|
52
|
+
template <>
|
|
53
|
+
struct JSIConverter<BarkArkInfo> final {
|
|
54
|
+
static inline BarkArkInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
55
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
56
|
+
return BarkArkInfo(
|
|
57
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "network")),
|
|
58
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "asp_pubkey")),
|
|
59
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "round_interval_secs")),
|
|
60
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "vtxo_exit_delta")),
|
|
61
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "vtxo_expiry_delta")),
|
|
62
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "htlc_expiry_delta")),
|
|
63
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "max_vtxo_amount_sat"))
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const BarkArkInfo& arg) {
|
|
67
|
+
jsi::Object obj(runtime);
|
|
68
|
+
obj.setProperty(runtime, "network", JSIConverter<std::string>::toJSI(runtime, arg.network));
|
|
69
|
+
obj.setProperty(runtime, "asp_pubkey", JSIConverter<std::string>::toJSI(runtime, arg.asp_pubkey));
|
|
70
|
+
obj.setProperty(runtime, "round_interval_secs", JSIConverter<double>::toJSI(runtime, arg.round_interval_secs));
|
|
71
|
+
obj.setProperty(runtime, "vtxo_exit_delta", JSIConverter<double>::toJSI(runtime, arg.vtxo_exit_delta));
|
|
72
|
+
obj.setProperty(runtime, "vtxo_expiry_delta", JSIConverter<double>::toJSI(runtime, arg.vtxo_expiry_delta));
|
|
73
|
+
obj.setProperty(runtime, "htlc_expiry_delta", JSIConverter<double>::toJSI(runtime, arg.htlc_expiry_delta));
|
|
74
|
+
obj.setProperty(runtime, "max_vtxo_amount_sat", JSIConverter<double>::toJSI(runtime, arg.max_vtxo_amount_sat));
|
|
75
|
+
return obj;
|
|
76
|
+
}
|
|
77
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
78
|
+
if (!value.isObject()) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
jsi::Object obj = value.getObject(runtime);
|
|
82
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "network"))) return false;
|
|
83
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "asp_pubkey"))) return false;
|
|
84
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "round_interval_secs"))) return false;
|
|
85
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "vtxo_exit_delta"))) return false;
|
|
86
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "vtxo_expiry_delta"))) return false;
|
|
87
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "htlc_expiry_delta"))) return false;
|
|
88
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "max_vtxo_amount_sat"))) return false;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
} // namespace margelo::nitro
|
|
@@ -18,7 +18,14 @@ namespace margelo::nitro::nitroark {
|
|
|
18
18
|
prototype.registerHybridMethod("loadWallet", &HybridNitroArkSpec::loadWallet);
|
|
19
19
|
prototype.registerHybridMethod("closeWallet", &HybridNitroArkSpec::closeWallet);
|
|
20
20
|
prototype.registerHybridMethod("isWalletLoaded", &HybridNitroArkSpec::isWalletLoaded);
|
|
21
|
-
prototype.registerHybridMethod("
|
|
21
|
+
prototype.registerHybridMethod("persistConfig", &HybridNitroArkSpec::persistConfig);
|
|
22
|
+
prototype.registerHybridMethod("maintenance", &HybridNitroArkSpec::maintenance);
|
|
23
|
+
prototype.registerHybridMethod("sync", &HybridNitroArkSpec::sync);
|
|
24
|
+
prototype.registerHybridMethod("syncArk", &HybridNitroArkSpec::syncArk);
|
|
25
|
+
prototype.registerHybridMethod("syncRounds", &HybridNitroArkSpec::syncRounds);
|
|
26
|
+
prototype.registerHybridMethod("getArkInfo", &HybridNitroArkSpec::getArkInfo);
|
|
27
|
+
prototype.registerHybridMethod("onchainBalance", &HybridNitroArkSpec::onchainBalance);
|
|
28
|
+
prototype.registerHybridMethod("offchainBalance", &HybridNitroArkSpec::offchainBalance);
|
|
22
29
|
prototype.registerHybridMethod("getOnchainAddress", &HybridNitroArkSpec::getOnchainAddress);
|
|
23
30
|
prototype.registerHybridMethod("getOnchainUtxos", &HybridNitroArkSpec::getOnchainUtxos);
|
|
24
31
|
prototype.registerHybridMethod("getVtxoPubkey", &HybridNitroArkSpec::getVtxoPubkey);
|
|
@@ -26,10 +33,11 @@ namespace margelo::nitro::nitroark {
|
|
|
26
33
|
prototype.registerHybridMethod("sendOnchain", &HybridNitroArkSpec::sendOnchain);
|
|
27
34
|
prototype.registerHybridMethod("drainOnchain", &HybridNitroArkSpec::drainOnchain);
|
|
28
35
|
prototype.registerHybridMethod("sendManyOnchain", &HybridNitroArkSpec::sendManyOnchain);
|
|
29
|
-
prototype.registerHybridMethod("refreshVtxos", &HybridNitroArkSpec::refreshVtxos);
|
|
30
36
|
prototype.registerHybridMethod("boardAmount", &HybridNitroArkSpec::boardAmount);
|
|
31
37
|
prototype.registerHybridMethod("boardAll", &HybridNitroArkSpec::boardAll);
|
|
32
|
-
prototype.registerHybridMethod("
|
|
38
|
+
prototype.registerHybridMethod("sendArkoorPayment", &HybridNitroArkSpec::sendArkoorPayment);
|
|
39
|
+
prototype.registerHybridMethod("sendBolt11Payment", &HybridNitroArkSpec::sendBolt11Payment);
|
|
40
|
+
prototype.registerHybridMethod("sendLnaddr", &HybridNitroArkSpec::sendLnaddr);
|
|
33
41
|
prototype.registerHybridMethod("sendRoundOnchain", &HybridNitroArkSpec::sendRoundOnchain);
|
|
34
42
|
prototype.registerHybridMethod("bolt11Invoice", &HybridNitroArkSpec::bolt11Invoice);
|
|
35
43
|
prototype.registerHybridMethod("claimBolt11Payment", &HybridNitroArkSpec::claimBolt11Payment);
|
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
|
|
16
16
|
// Forward declaration of `BarkCreateOpts` to properly resolve imports.
|
|
17
17
|
namespace margelo::nitro::nitroark { struct BarkCreateOpts; }
|
|
18
|
-
// Forward declaration of `
|
|
19
|
-
namespace margelo::nitro::nitroark { struct
|
|
18
|
+
// Forward declaration of `BarkConfigOpts` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitroark { struct BarkConfigOpts; }
|
|
20
|
+
// Forward declaration of `BarkArkInfo` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::nitroark { struct BarkArkInfo; }
|
|
20
22
|
// Forward declaration of `BarkSendManyOutput` to properly resolve imports.
|
|
21
23
|
namespace margelo::nitro::nitroark { struct BarkSendManyOutput; }
|
|
22
|
-
// Forward declaration of `BarkRefreshOpts` to properly resolve imports.
|
|
23
|
-
namespace margelo::nitro::nitroark { struct BarkRefreshOpts; }
|
|
24
24
|
|
|
25
25
|
#include <NitroModules/Promise.hpp>
|
|
26
26
|
#include <string>
|
|
27
27
|
#include "BarkCreateOpts.hpp"
|
|
28
|
-
#include "
|
|
28
|
+
#include "BarkConfigOpts.hpp"
|
|
29
|
+
#include "BarkArkInfo.hpp"
|
|
29
30
|
#include <optional>
|
|
30
31
|
#include <vector>
|
|
31
32
|
#include "BarkSendManyOutput.hpp"
|
|
32
|
-
#include "BarkRefreshOpts.hpp"
|
|
33
33
|
|
|
34
34
|
namespace margelo::nitro::nitroark {
|
|
35
35
|
|
|
@@ -66,7 +66,14 @@ namespace margelo::nitro::nitroark {
|
|
|
66
66
|
virtual std::shared_ptr<Promise<void>> loadWallet(const std::string& datadir, const BarkCreateOpts& opts) = 0;
|
|
67
67
|
virtual std::shared_ptr<Promise<void>> closeWallet() = 0;
|
|
68
68
|
virtual std::shared_ptr<Promise<bool>> isWalletLoaded() = 0;
|
|
69
|
-
virtual std::shared_ptr<Promise<
|
|
69
|
+
virtual std::shared_ptr<Promise<void>> persistConfig(const BarkConfigOpts& opts) = 0;
|
|
70
|
+
virtual std::shared_ptr<Promise<void>> maintenance() = 0;
|
|
71
|
+
virtual std::shared_ptr<Promise<void>> sync() = 0;
|
|
72
|
+
virtual std::shared_ptr<Promise<void>> syncArk() = 0;
|
|
73
|
+
virtual std::shared_ptr<Promise<void>> syncRounds() = 0;
|
|
74
|
+
virtual std::shared_ptr<Promise<BarkArkInfo>> getArkInfo() = 0;
|
|
75
|
+
virtual std::shared_ptr<Promise<double>> onchainBalance() = 0;
|
|
76
|
+
virtual std::shared_ptr<Promise<double>> offchainBalance() = 0;
|
|
70
77
|
virtual std::shared_ptr<Promise<std::string>> getOnchainAddress() = 0;
|
|
71
78
|
virtual std::shared_ptr<Promise<std::string>> getOnchainUtxos(bool no_sync) = 0;
|
|
72
79
|
virtual std::shared_ptr<Promise<std::string>> getVtxoPubkey(std::optional<double> index) = 0;
|
|
@@ -74,15 +81,16 @@ namespace margelo::nitro::nitroark {
|
|
|
74
81
|
virtual std::shared_ptr<Promise<std::string>> sendOnchain(const std::string& destination, double amountSat, bool no_sync) = 0;
|
|
75
82
|
virtual std::shared_ptr<Promise<std::string>> drainOnchain(const std::string& destination, bool no_sync) = 0;
|
|
76
83
|
virtual std::shared_ptr<Promise<std::string>> sendManyOnchain(const std::vector<BarkSendManyOutput>& outputs, bool no_sync) = 0;
|
|
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>>
|
|
84
|
+
virtual std::shared_ptr<Promise<std::string>> boardAmount(double amountSat) = 0;
|
|
85
|
+
virtual std::shared_ptr<Promise<std::string>> boardAll() = 0;
|
|
86
|
+
virtual std::shared_ptr<Promise<std::string>> sendArkoorPayment(const std::string& destination, double amountSat) = 0;
|
|
87
|
+
virtual std::shared_ptr<Promise<std::string>> sendBolt11Payment(const std::string& destination, std::optional<double> amountSat) = 0;
|
|
88
|
+
virtual std::shared_ptr<Promise<std::string>> sendLnaddr(const std::string& addr, double amountSat, const std::string& comment) = 0;
|
|
81
89
|
virtual std::shared_ptr<Promise<std::string>> sendRoundOnchain(const std::string& destination, double amountSat, bool no_sync) = 0;
|
|
82
90
|
virtual std::shared_ptr<Promise<std::string>> bolt11Invoice(double amountMsat) = 0;
|
|
83
91
|
virtual std::shared_ptr<Promise<void>> claimBolt11Payment(const std::string& bolt11) = 0;
|
|
84
|
-
virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::vector<std::string>& vtxoIds, const std::
|
|
85
|
-
virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::
|
|
92
|
+
virtual std::shared_ptr<Promise<std::string>> offboardSpecific(const std::vector<std::string>& vtxoIds, const std::string& destinationAddress, bool no_sync) = 0;
|
|
93
|
+
virtual std::shared_ptr<Promise<std::string>> offboardAll(const std::string& destinationAddress, bool no_sync) = 0;
|
|
86
94
|
virtual std::shared_ptr<Promise<std::string>> exitStartSpecific(const std::vector<std::string>& vtxoIds) = 0;
|
|
87
95
|
virtual std::shared_ptr<Promise<std::string>> exitStartAll() = 0;
|
|
88
96
|
virtual std::shared_ptr<Promise<std::string>> exitProgressOnce() = 0;
|
package/package.json
CHANGED
package/src/NitroArk.nitro.ts
CHANGED
|
@@ -2,14 +2,6 @@ import type { HybridObject } from 'react-native-nitro-modules';
|
|
|
2
2
|
|
|
3
3
|
// --- Interfaces matching C structs ---
|
|
4
4
|
|
|
5
|
-
export type BarkRefreshModeType =
|
|
6
|
-
| 'DefaultThreshold'
|
|
7
|
-
| 'ThresholdBlocks'
|
|
8
|
-
| 'ThresholdHours'
|
|
9
|
-
| 'Counterparty'
|
|
10
|
-
| 'All'
|
|
11
|
-
| 'Specific';
|
|
12
|
-
|
|
13
5
|
// Note: BarkError is handled via Promise rejection, not exposed directly.
|
|
14
6
|
|
|
15
7
|
export interface BarkConfigOpts {
|
|
@@ -28,20 +20,18 @@ export interface BarkCreateOpts {
|
|
|
28
20
|
signet?: boolean;
|
|
29
21
|
bitcoin?: boolean;
|
|
30
22
|
mnemonic: string;
|
|
31
|
-
birthday_height?: number;
|
|
23
|
+
birthday_height?: number;
|
|
32
24
|
config?: BarkConfigOpts;
|
|
33
25
|
}
|
|
34
26
|
|
|
35
|
-
export interface
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
threshold_value?: number; // uint32_t -> number (Only relevant for Threshold modes)
|
|
44
|
-
specific_vtxo_ids?: string[]; // const char *const * -> string[] (Only relevant for Specific mode)
|
|
27
|
+
export interface BarkArkInfo {
|
|
28
|
+
network: string;
|
|
29
|
+
asp_pubkey: string;
|
|
30
|
+
round_interval_secs: number; // u64
|
|
31
|
+
vtxo_exit_delta: number; // u16
|
|
32
|
+
vtxo_expiry_delta: number; // u16
|
|
33
|
+
htlc_expiry_delta: number; // u16
|
|
34
|
+
max_vtxo_amount_sat: number; // u64
|
|
45
35
|
}
|
|
46
36
|
|
|
47
37
|
// Helper interface for sendManyOnchain
|
|
@@ -58,9 +48,16 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
58
48
|
loadWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
|
|
59
49
|
closeWallet(): Promise<void>;
|
|
60
50
|
isWalletLoaded(): Promise<boolean>;
|
|
51
|
+
persistConfig(opts: BarkConfigOpts): Promise<void>;
|
|
52
|
+
maintenance(): Promise<void>;
|
|
53
|
+
sync(): Promise<void>;
|
|
54
|
+
syncArk(): Promise<void>;
|
|
55
|
+
syncRounds(): Promise<void>;
|
|
61
56
|
|
|
62
57
|
// --- Wallet Info ---
|
|
63
|
-
|
|
58
|
+
getArkInfo(): Promise<BarkArkInfo>;
|
|
59
|
+
onchainBalance(): Promise<number>;
|
|
60
|
+
offchainBalance(): Promise<number>;
|
|
64
61
|
getOnchainAddress(): Promise<string>;
|
|
65
62
|
getOnchainUtxos(no_sync: boolean): Promise<string>; // Returns JSON string
|
|
66
63
|
getVtxoPubkey(index?: number): Promise<string>;
|
|
@@ -78,37 +75,30 @@ export interface NitroArk extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|
|
|
78
75
|
no_sync: boolean
|
|
79
76
|
): Promise<string>; // Returns txid
|
|
80
77
|
|
|
81
|
-
// --- Ark
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
amountSat: number | null,
|
|
88
|
-
comment: string | null,
|
|
89
|
-
no_sync: boolean
|
|
90
|
-
): Promise<string>; // Returns JSON status
|
|
78
|
+
// --- Ark & Lightning Payments ---
|
|
79
|
+
boardAmount(amountSat: number): Promise<string>; // Returns JSON status
|
|
80
|
+
boardAll(): Promise<string>; // Returns JSON status
|
|
81
|
+
sendArkoorPayment(destination: string, amountSat: number): Promise<string>;
|
|
82
|
+
sendBolt11Payment(destination: string, amountSat?: number): Promise<string>;
|
|
83
|
+
sendLnaddr(addr: string, amountSat: number, comment: string): Promise<string>;
|
|
91
84
|
sendRoundOnchain(
|
|
92
85
|
destination: string,
|
|
93
86
|
amountSat: number,
|
|
94
87
|
no_sync: boolean
|
|
95
88
|
): Promise<string>; // Returns JSON status
|
|
96
89
|
|
|
97
|
-
// --- Lightning
|
|
90
|
+
// --- Lightning Invoicing ---
|
|
98
91
|
bolt11Invoice(amountMsat: number): Promise<string>; // Returns invoice string
|
|
99
92
|
claimBolt11Payment(bolt11: string): Promise<void>; // Throws on error
|
|
100
93
|
|
|
101
94
|
// --- Offboarding / Exiting ---
|
|
102
95
|
offboardSpecific(
|
|
103
96
|
vtxoIds: string[],
|
|
104
|
-
|
|
105
|
-
no_sync: boolean
|
|
106
|
-
): Promise<string>; // Returns JSON result
|
|
107
|
-
offboardAll(
|
|
108
|
-
optionalAddress: string | null,
|
|
97
|
+
destinationAddress: string,
|
|
109
98
|
no_sync: boolean
|
|
110
99
|
): Promise<string>; // Returns JSON result
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
offboardAll(destinationAddress: string, no_sync: boolean): Promise<string>; // Returns JSON result
|
|
101
|
+
exitStartSpecific(vtxoIds: string[]): Promise<string>;
|
|
102
|
+
exitStartAll(): Promise<string>;
|
|
103
|
+
exitProgressOnce(): Promise<string>;
|
|
114
104
|
}
|