react-native-nitro-ark
Version:
Pure C++ Nitro Modules for Ark client
218 lines • 9.72 kB
TypeScript
import type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, LightningPaymentResult, LnurlPaymentResult, OnchainPaymentResult, BarkVtxo, OffchainBalanceResult, OnchainBalanceResult, NewAddressResult, KeyPairResult } from './NitroArk.nitro';
export declare const NitroArkHybridObject: NitroArk;
/**
* Creates a new BIP39 mnemonic phrase.
* @returns A promise resolving to the mnemonic string.
*/
export declare function createMnemonic(): Promise<string>;
/**
* Creates a new wallet at the specified directory.
* @param datadir Path to the data directory.
* @param opts The options for wallet creation.
* @returns A promise that resolves on success or rejects on error.
*/
export declare function createWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
/**
* Loads an existing wallet or creates a new one at the specified directory.
* Once loaded, the wallet state is managed internally.
* @param datadir Path to the data directory.
* @param mnemonic The BIP39 mnemonic phrase for the wallet.
* @returns A promise that resolves on success or rejects on error.
*/
export declare function loadWallet(datadir: string, mnemonic: string): Promise<void>;
/**
* Closes the currently loaded wallet, clearing its state from memory.
* @returns A promise that resolves on success or rejects on error.
*/
export declare function closeWallet(): Promise<void>;
/**
* Checks if a wallet is currently loaded.
* @returns A promise resolving to true if a wallet is loaded, false otherwise.
*/
export declare function isWalletLoaded(): Promise<boolean>;
/**
* Persists wallet configuration.
* @param opts The configuration options to persist.
* @returns A promise that resolves on success or rejects on error.
*/
export declare function persistConfig(opts: BarkConfigOpts): Promise<void>;
/**
* Runs wallet maintenance tasks.
* @returns A promise that resolves on success.
*/
export declare function maintenance(): Promise<void>;
/**
* Synchronizes the wallet with the blockchain.
* @returns A promise that resolves on success.
*/
export declare function sync(): Promise<void>;
/**
* Synchronizes the Ark-specific exits.
* @returns A promise that resolves on success.
*/
export declare function syncExits(): Promise<void>;
/**
* Synchronizes the rounds of the wallet.
* @returns A promise that resolves on success.
*/
export declare function syncRounds(): Promise<void>;
/**
* Gets the Ark-specific information.
* @returns A promise resolving to the BarkArkInfo object.
*/
export declare function getArkInfo(): Promise<BarkArkInfo>;
/**
* Gets the offchain balance for the loaded wallet.
* @returns A promise resolving to the OffchainBalanceResult object.
*/
export declare function offchainBalance(): Promise<OffchainBalanceResult>;
/**
* Derives the next keypair for the store.
* @returns A promise resolving to the KeyPairResult object.
*/
export declare function deriveStoreNextKeypair(): Promise<KeyPairResult>;
/**
* Gets the wallet's VTXO public key (hex string).
* @param index Index of the VTXO pubkey to retrieve.
* @returns A promise resolving to the KeyPairResult object.
*/
export declare function peakKeyPair(index: number): Promise<KeyPairResult>;
/**
* Gets the wallet's Address.
* @returns A promise resolving to NewAddressResult object.
*/
export declare function newAddress(): Promise<NewAddressResult>;
/**
* Signs a message with the private key at the specified index.
* @param message The message to sign.
* @param index The index of the keypair to use for signing.
* @returns A promise resolving to the signature string.
*/
export declare function signMessage(message: string, index: number): Promise<string>;
/**
* Verifies a signed message.
* @param message The original message.
* @param signature The signature to verify.
* @param publicKey The public key corresponding to the private key used for signing.
* @returns A promise resolving to true if the signature is valid, false otherwise.
*/
export declare function verifyMessage(message: string, signature: string, publicKey: string): Promise<boolean>;
/**
* Gets the list of VTXOs as a JSON string for the loaded wallet.
* @param no_sync If true, skips synchronization with the blockchain. Defaults to false.
* @returns A promise resolving BarkVtxo[] array.
*/
export declare function getVtxos(): Promise<BarkVtxo[]>;
/**
* Gets the onchain balance for the loaded wallet.
* @returns A promise resolving to the OnchainBalanceResult object.
*/
export declare function onchainBalance(): Promise<OnchainBalanceResult>;
/**
* Synchronizes the onchain state of the wallet.
* @returns A promise that resolves on success.
*/
export declare function onchainSync(): Promise<void>;
/**
* Gets the list of unspent onchain outputs as a JSON string for the loaded wallet.
* @returns A promise resolving to the JSON string of unspent outputs.
*/
export declare function onchainListUnspent(): Promise<string>;
/**
* Gets the list of onchain UTXOs as a JSON string for the loaded wallet.
* @returns A promise resolving to the JSON string of UTXOs.
*/
export declare function onchainUtxos(): Promise<string>;
/**
* Gets a fresh onchain address for the loaded wallet.
* @returns A promise resolving to the Bitcoin address string.
*/
export declare function onchainAddress(): Promise<string>;
/**
* Sends funds using the onchain wallet.
* @param destination The destination Bitcoin address.
* @param amountSat The amount to send in satoshis.
* @returns A promise resolving to the OnchainPaymentResult object
*/
export declare function onchainSend(destination: string, amountSat: number): Promise<OnchainPaymentResult>;
/**
* Sends all funds from the onchain wallet to a destination address.
* @param destination The destination Bitcoin address.
* @returns A promise resolving to the transaction ID string.
*/
export declare function onchainDrain(destination: string): Promise<string>;
/**
* Sends funds to multiple recipients using the onchain wallet.
* @param outputs An array of objects containing destination address and amountSat.
* @returns A promise resolving to the transaction ID string.
*/
export declare function onchainSendMany(outputs: BarkSendManyOutput[]): Promise<string>;
/**
* Creates a Bolt 11 invoice.
* @param amountMsat The amount in millisatoshis for the invoice.
* @returns A promise resolving to the Bolt 11 invoice string.
*/
export declare function bolt11Invoice(amountMsat: number): Promise<string>;
/**
* Claims a Lightning payment.
* @param bolt11 The Lightning invoice string to claim.
* @returns A promise that resolves on success or rejects on error.
*/
export declare function finishLightningReceive(bolt11: string): Promise<void>;
/**
* Sends a Lightning payment.
* @param destination The Lightning invoice.
* @param amountSat The amount in satoshis to send. Use 0 for invoice amount.
* @returns A promise resolving to a LightningPaymentResult object
*/
export declare function sendLightningPayment(destination: string, amountSat?: number): Promise<LightningPaymentResult>;
/**
* Sends a payment to a Lightning Address.
* @param addr The Lightning Address.
* @param amountSat The amount in satoshis to send.
* @param comment An optional comment.
* @returns A promise resolving to a LnurlPaymentResult object
*/
export declare function sendLnaddr(addr: string, amountSat: number, comment: string): Promise<LnurlPaymentResult>;
/**
* Boards a specific amount from the onchain wallet into Ark.
* @param amountSat The amount in satoshis to board.
* @returns A promise resolving to a JSON status string.
*/
export declare function boardAmount(amountSat: number): Promise<string>;
/**
* Boards all available funds from the onchain wallet into Ark.
* @returns A promise resolving to a JSON status string.
*/
export declare function boardAll(): Promise<string>;
/**
* Sends an Arkoor payment.
* @param destination The destination Arkoor address.
* @param amountSat The amount in satoshis to send.
* @returns A promise resolving to the ArkoorPaymentResult object
*/
export declare function sendArkoorPayment(destination: string, amountSat: number): Promise<ArkoorPaymentResult>;
/**
* Sends an onchain payment via an Ark round.
* @param destination The destination Bitcoin address.
* @param amountSat The amount in satoshis to send.
* @returns A promise resolving to a JSON status string.
*/
export declare function sendRoundOnchainPayment(destination: string, amountSat: number): Promise<string>;
/**
* Offboards specific VTXOs to a destination address.
* @param vtxoIds Array of VtxoId strings to offboard.
* @param destinationAddress Destination Bitcoin address (if empty, sends to internal wallet).
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
* @returns A promise resolving to a JSON result string.
*/
export declare function offboardSpecific(vtxoIds: string[], destinationAddress: string): Promise<string>;
/**
* Offboards all VTXOs to a destination address.
* @param destinationAddress Destination Bitcoin address (if empty, sends to internal wallet).
* @param no_sync If true, skips synchronization with the wallet. Defaults to false.
* @returns A promise resolving to a JSON result string.
*/
export declare function offboardAll(destinationAddress: string): Promise<string>;
export type { NitroArk, BarkCreateOpts, BarkConfigOpts, BarkArkInfo, BarkSendManyOutput, ArkoorPaymentResult, LightningPaymentResult, LnurlPaymentResult, OnchainPaymentResult, PaymentTypes, OffchainBalanceResult, OnchainBalanceResult, NewAddressResult, KeyPairResult, } from './NitroArk.nitro';
//# sourceMappingURL=index.d.ts.map