import { Address, ChannelDetails, ChannelId, NetAddress, PaymentDetails, PaymentHash, PeerDetails, PublicKey, Txid, Bolt11Payment } from './Bindings'; import { NativeLoader } from './NativeLoader'; import { ChannelConfig } from './ChannelConfig'; export declare class Node extends NativeLoader { id: string; /** * Create node id */ constructor(id: string); /** * Starts the necessary background tasks, such as handling events coming from user input, LDK/BDK, and the peer-to-peer network. * * After this returns, the [Node] instance can be controlled via the provided API methods in a thread-safe manner. * * @returns {Promise} */ start(): Promise; /** * Disconnects all peers, stops all running background tasks, and shuts down [Node]. * * After this returns most API methods will throw NotRunning Exception. * @returns {Promise} */ stop(): Promise; /** * Sync the LDK and BDK wallets with the current chain state. * @returns {Promise} */ syncWallets(): Promise; /** * Returns our own node id * @returns {Promise} */ nodeId(): Promise; /** * Returns listening Addresses * @returns {Promise>} */ bolt11Payment(): Promise; /** * Returns bolt11 Payment * @returns {Promise} */ listeningAddresses(): Promise | null>; /** * Retrieve a new on-chain/funding address. * @returns {Promise
} */ newOnchainAddress(): Promise
; /** * Send an on-chain payment to the given address. * @requires [address] address of Node * @requires [amountMsat] amount in milli sats * @returns {Promise} */ sendToOnchainAddress(address: Address, amountMsat: number): Promise; /** * Send an on-chain payment to the given address, draining all the available funds. * @requires [address] address of Node * @returns {Promise} */ sendAllToOnchainAddress(address: Address): Promise; /** * Get spendableOnchainBalanceSats * @returns {Promise} */ spendableOnchainBalanceSats(): Promise; /** * Get totalOnchainBalanceSats * @returns {Promise} */ totalOnchainBalanceSats(): Promise; /** * Connect to a node on the peer-to-peer network. * * If `permanently` is set to `true`, we'll remember the peer and reconnect to it on restart. * * @requires [nodeId] publicKey of Node * @requires [address] NetAddress * @requires [persist] open node permanently or not * @returns {Promise} */ connect(nodeId: string, address: NetAddress, persist: boolean): Promise; /** * Disconnects the peer with the given node id. * * Will also remove the peer from the peer store, i.e., after this has been called we won't try to reconnect on restart. * * @requires [nodeId] publicKey of Node * @returns {Promise} */ disconnect(nodeId: string): Promise; /** * Connect to a node and open a new channel. Disconnects and re-connects are handled automatically * @requires [nodeId] publicKey of Node * @requires [address] NetAddress * @requires [channelAmountSats] number * @requires [pushToCounterpartyMsat] number * @requires [announceChannel] announceChannel or not * @returns {Promise} */ connectOpenChannel(nodeId: string, address: NetAddress, channelAmountSats: number, pushToCounterpartyMsat: number, channelConfig: ChannelConfig | null | undefined, announceChannel: boolean): Promise; /** * Close a previously opened channel. * @requires [channelId] * @requires [counterpartyNodeId] publicKey of counterparty Node * @returns {Promise} */ closeChannel(channelId: ChannelId, counterpartyNodeId: PublicKey): Promise; /** * Send a payement given an invoice. * @requires [invoice] * @returns {Promise} */ sendPayment(invoice: string): Promise; bolt11Payment(): Promise; /** * Send a payment given an invoice and an amount in millisatoshi. * This will fail if the amount given is less than the value required by the given invoice. * * This can be used to pay a so - called "zero-amount" invoice, i.e., an invoice that leaves the * amount paid to be determined by the user. * * @requires [invoice] * @requires [amountMsat] * @returns {Promise} */ sendPaymentUsingAmount(invoice: string, amountMsat: number): Promise; /** * Send a spontaneous, aka. "keysend", payment * @requires [invoice] * @requires [amountMsat] * @returns {Promise} */ sendSpontaneousPayment(amountMsat: number, nodeId: PublicKey): Promise; /** * Returns a payable invoice that can be used to request and receive a payment of the amount given. * @requires [amountMsat] amount in sats * @requires [description] * @requires [expirySecs] number * @returns {Promise} */ receiveViaJitChannel(amountMsat: number, description: string, expirySecs: number): Promise; /** * Returns a payable invoice that can be used to request and receive a payment for which the amount is to be determined by the user, also known as a "zero-amount" invoice. * @requires [amountMsat] amount in sats * @requires [description] * @requires [expirySecs] number * @returns {Promise} */ receivePayment(amountMsat: number, description: string, expirySecs: number): Promise; /** * Returns a payable invoice that can be used to request and receive a payment for which the amount is to be determined by the user, also known as a "zero-amount" invoice. * @requires [description] * @requires [expirySecs] number * @returns {Promise} */ receiveVariableAmountPayment(description: string, expirySecs: number): Promise; /** * Returns a payable invoice that can be used to request and receive a payment for which the amount is to be determined by the user, also known as a "zero-amount" invoice. * @requires [description] * @requires [expirySecs] number * @returns {Promise} */ receiveViaJitChannel(amountMsat: number, description: string, expirySecs: number): Promise; /** * Get list of payments * @returns {Promise>} */ listPayments(): Promise>; /** * Get list of connected peers * @returns {Promise>} */ listPeers(): Promise>; /** * Get list of opened channels * @returns {Promise>} */ listChannels(): Promise>; /** * Retrieve the details of a specific payment with the given hash. * Returns `PaymentDetails` if the payment was known and `null` otherwise. * * @requires [paymentHash] * @returns {Promise} */ payment(paymetHash: PaymentHash): Promise; /** * Remove the payment with the given hash from the store. * Returns `true` if the payment was present and `false` otherwise. * * @requires [paymentHash] * @returns {Promise} */ removePayment(paymetHash: PaymentHash): Promise; /** * Creates a digital ECDSA signature of a message with the node's secret key. * * A receiver knowing the corresponding `PublicKey` (e.g. the node’s id) and the message can be sure that the signature was generated by the caller. * * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. * @requires [msg] * @returns {Promise} */ signMessage(msg: Array): Promise; /** * Verifies that the given ECDSA signature was created for the given message with the secret key corresponding to the given public key. * * @requires [msg] * @requires [sig] returned string from signMessage() * @requires [pkey] public key of node * @returns {Promise} */ verifySignature(msg: Array, sig: string, pkey: PublicKey): Promise; /** * Update the config for a previously opened channel. * * @requires [channelId] * @requires [counterpartyNodeId] * @requires [channelConfig] * @returns {Promise} */ updateChannelConfig(channelId: ChannelId, counterpartyNodeId: PublicKey, channelConfig: ChannelConfig): Promise; /** * Returns whether the [`Node`] is running. * * @returns {Promise} */ isRunning(): Promise; /** * Sends payment probes over all paths of a route that would be used to pay the given invoice. * * This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting * the actual payment. Note this is only useful if there likely is sufficient time for the * probe to settle before sending out the actual payment, e.g., when waiting for user * confirmation in a wallet UI. * * * Otherwise, there is a chance the probe could take up some liquidity needed to complete the * actual payment. Users should therefore be cautious and might avoid sending probes if * liquidity is scarce and/or they don't expect the probe to return before they send the * payment. To mitigate this issue, channels with available liquidity less than the required * amount times [`Config::probing_liquidity_limit_multiplier`] won't be used to send * pre-flight probes. * * @requires [invoice] * @returns {Promise} */ sendPaymentProbes(invoice: string): Promise; /** * Sends payment probes over all paths of a route that would be used to pay the given * zero-value invoice using the given amount. * * This can be used to send pre-flight probes for a so-called "zero-amount" invoice, i.e., an * invoice that leaves the amount paid to be determined by the user. * * @requires [invoice] * @requires [amountMsat] * @returns {Promise} */ sendPaymentProbesUsingAmount(invoice: string, amountMsat: number): Promise; /** * Sends payment probes over all paths of a route that would be used to pay the given amount to the given `node_id`. * @requires [invoice] * @requires [amountMsat] * @returns {Promise} */ sendSpontaneousPaymentProbes(amountMsat: number, nodeId: PublicKey): Promise; }