0.13.1-11 • Published 3 years ago

@lightningsale/lnd-rest-client v0.13.1-11

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

@lightningsale/lnd-rest-client

lnd - JavaScript client for @lightningsale/lnd-rest-client No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) This SDK is automatically generated by the OpenAPI Generator project:

openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/rpc.swagger.json \
    -g typescript-fetch \
    -o ./src/rpc \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/walletunlocker.swagger.json \
    -g typescript-fetch \
    -o ./src/walletunlocker \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/walletunlocker.swagger.json \
    -g typescript-fetch \
    -o ./src/walletunlocker \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/autopilotrpc/autopilot.swagger.json \
    -g typescript-fetch \
    -o ./src/autopilot \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/chainrpc/chainnotifier.swagger.json \
    -g typescript-fetch \
    -o ./src/chainnotifier \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/invoicesrpc/invoices.swagger.json \
    -g typescript-fetch \
    -o ./src/invoices \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/routerrcp/router.swagger.json \
    -g typescript-fetch \
    -o ./src/router \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/signrpc/signer.swagger.json \
    -g typescript-fetch \
    -o ./src/signer \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/verrpc/verrpc.swagger.json \
    -g typescript-fetch \
    -o ./src/verrpc \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/walletrpc/walletkit.swagger.json \
    -g typescript-fetch \
    -o ./src/walletkit \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
    
openapi-generator generate \
    -i https://raw.githubusercontent.com/lightningnetwork/lnd/0-13-1-branch/lnrpc/watchtowerrpc/watchtower.swagger.json \
    -g typescript-fetch \
    -o ./src/watchtower \
    --additional-properties=npmName=lnd-rest-client \
    --additional-properties=npmRepository=@lightningsale \
    --additional-properties=npmVersion=0.13.1 \
    --additional-properties=supportsES6=true \
    --additional-properties=paramNaming=original
    
   

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install @lightningsale/lnd-rest-client --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your @lightningsale/lnd-rest-client from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var lnd = require('@lightningsale/lnd-rest-client');


var api = new lnd.LightningApi()
var channelPointFundingTxidStr = "channelPointFundingTxidStr_example"; // {String} Hex-encoded string representing the byte-reversed hash of the funding transaction.
var channelPointOutputIndex = 789; // {Number} The index of the output of the funding transaction
var opts = {
  'channelPointFundingTxidBytes': null, // {Blob} Txid of the funding transaction. When using REST, this field must be encoded as base64.
  'pendingFundingShimOnly': true, // {Boolean} 
  'iKnowWhatIAmDoing': true // {Boolean} Override the requirement for being in dev mode by setting this to true and confirming the user knows what they are doing and this is a potential foot gun to lose funds if used on active channels.
};
api.abandonChannel(channelPointFundingTxidStr, channelPointOutputIndex, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
lnd.LightningApiabandonChannelDELETE /v1/channels/abandon/{channel_point.funding_txid_str}/{channel_point.output_index}lncli: `abandonchannel` AbandonChannel removes all channel state from the database except for a close summary. This method can be used to get rid of permanently unusable channels due to bugs fixed in newer versions of lnd. This method can also be used to remove externally funded channels where the funding transaction was never broadcast. Only available for non-externally funded channels in dev build.
lnd.LightningApiaddInvoicePOST /v1/invoiceslncli: `addinvoice` AddInvoice attempts to add a new invoice to the invoice database. Any duplicated invoices are rejected, therefore all invoices must have a unique payment preimage.
lnd.LightningApibakeMacaroonPOST /v1/macaroonlncli: `bakemacaroon` BakeMacaroon allows the creation of a new macaroon with custom read and write permissions. No first-party caveats are added since this can be done offline.
lnd.LightningApichannelAcceptorPOST /v1/channels/acceptorChannelAcceptor dispatches a bi-directional streaming RPC in which OpenChannel requests are sent to the client and the client responds with a boolean that tells LND whether or not to accept the channel. This allows node operators to specify their own criteria for accepting inbound channels through a single persistent connection.
lnd.LightningApichannelBalanceGET /v1/balance/channelslncli: `channelbalance` ChannelBalance returns a report on the total funds across all open channels, categorized in local/remote, pending local/remote and unsettled local/remote balances.
lnd.LightningApicloseChannelDELETE /v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}lncli: `closechannel` CloseChannel attempts to close an active channel identified by its channel outpoint (ChannelPoint). The actions of this method can additionally be augmented to attempt a force close after a timeout period in the case of an inactive peer. If a non-force close (cooperative closure) is requested, then the user can specify either a target number of blocks until the closure transaction is confirmed, or a manual fee rate. If neither are specified, then a default lax, block confirmation target is used.
lnd.LightningApiclosedChannelsGET /v1/channels/closedlncli: `closedchannels` ClosedChannels returns a description of all the closed channels that this node was a participant in.
lnd.LightningApiconnectPeerPOST /v1/peerslncli: `connect` ConnectPeer attempts to establish a connection to a remote peer. This is at the networking level, and is used for communication between nodes. This is distinct from establishing a channel with a peer.
lnd.LightningApidebugLevelPOST /v1/debuglevellncli: `debuglevel` DebugLevel allows a caller to programmatically set the logging verbosity of lnd. The logging can be targeted according to a coarse daemon-wide logging level, or in a granular fashion to specify the logging for a target sub-system.
lnd.LightningApidecodePayReqGET /v1/payreq/{pay_req}lncli: `decodepayreq` DecodePayReq takes an encoded payment request string and attempts to decode it, returning a full description of the conditions encoded within the payment request.
lnd.LightningApideleteAllPaymentsDELETE /v1/paymentsDeleteAllPayments deletes all outgoing payments from DB.
lnd.LightningApideleteMacaroonIDDELETE /v1/macaroon/{root_key_id}lncli: `deletemacaroonid` DeleteMacaroonID deletes the specified macaroon ID and invalidates all macaroons derived from that ID.
lnd.LightningApidescribeGraphGET /v1/graphlncli: `describegraph` DescribeGraph returns a description of the latest graph state from the point of view of the node. The graph information is partitioned into two components: all the nodes/vertexes, and all the edges that connect the vertexes themselves. As this is a directed graph, the edges also contain the node directional specific routing policy which includes: the time lock delta, fee information, etc.
lnd.LightningApidisconnectPeerDELETE /v1/peers/{pub_key}lncli: `disconnect` DisconnectPeer attempts to disconnect one peer from another identified by a given pubKey. In the case that we currently have a pending or active channel with the target peer, then this action will be not be allowed.
lnd.LightningApiestimateFeeGET /v1/transactions/feelncli: `estimatefee` EstimateFee asks the chain backend to estimate the fee rate and total fees for a transaction that pays to multiple specified outputs.
lnd.LightningApiexportAllChannelBackupsGET /v1/channels/backupExportAllChannelBackups returns static channel backups for all existing channels known to lnd. A set of regular singular static channel backups for each channel are returned. Additionally, a multi-channel backup is returned as well, which contains a single encrypted blob containing the backups of each channel.
lnd.LightningApiexportChannelBackupGET /v1/channels/backup/{chan_point.funding_txid_str}/{chan_point.output_index}lncli: `exportchanbackup` ExportChannelBackup attempts to return an encrypted static channel backup for the target channel identified by it channel point. The backup is encrypted with a key generated from the aezeed seed of the user. The returned backup can either be restored using the RestoreChannelBackup method once lnd is running, or via the InitWallet and UnlockWallet methods from the WalletUnlocker service.
lnd.LightningApifeeReportGET /v1/feeslncli: `feereport` FeeReport allows the caller to obtain a report detailing the current fee schedule enforced by the node globally for each channel.
lnd.LightningApiforwardingHistoryPOST /v1/switchlncli: `fwdinghistory` ForwardingHistory allows the caller to query the htlcswitch for a record of all HTLCs forwarded within the target time range, and integer offset within that time range, for a maximum number of events. If no maximum number of events is specified, up to 100 events will be returned. If no time-range is specified, then events will be returned in the order that they occured.
lnd.LightningApifundingStateStepPOST /v1/funding/stepFundingStateStep is an advanced funding related call that allows the caller to either execute some preparatory steps for a funding workflow, or manually progress a funding workflow. The primary way a funding flow is identified is via its pending channel ID. As an example, this method can be used to specify that we're expecting a funding flow for a particular pending channel ID, for which we need to use specific parameters. Alternatively, this can be used to interactively drive PSBT signing for funding for partially complete funding transactions.
lnd.LightningApigetChanInfoGET /v1/graph/edge/{chan_id}lncli: `getchaninfo` GetChanInfo returns the latest authenticated network announcement for the given channel identified by its channel ID: an 8-byte integer which uniquely identifies the location of transaction's funding output within the blockchain.
lnd.LightningApigetInfoGET /v1/getinfolncli: `getinfo` GetInfo returns general information concerning the lightning node including it's identity pubkey, alias, the chains it is connected to, and information concerning the number of open+pending channels.
lnd.LightningApigetNetworkInfoGET /v1/graph/infolncli: `getnetworkinfo` GetNetworkInfo returns some basic stats about the known channel graph from the point of view of the node.
lnd.LightningApigetNodeInfoGET /v1/graph/node/{pub_key}lncli: `getnodeinfo` GetNodeInfo returns the latest advertised, aggregated, and authenticated channel information for the specified node identified by its public key.
lnd.LightningApigetNodeMetricsGET /v1/graph/nodemetricslncli: `getnodemetrics` GetNodeMetrics returns node metrics calculated from the graph. Currently the only supported metric is betweenness centrality of individual nodes.
lnd.LightningApigetRecoveryInfoGET /v1/getrecoveryinfo* lncli: `getrecoveryinfo` GetRecoveryInfo returns information concerning the recovery mode including whether it's in a recovery mode, whether the recovery is finished, and the progress made so far.
lnd.LightningApigetTransactionsGET /v1/transactionslncli: `listchaintxns` GetTransactions returns a list describing all the known transactions relevant to the wallet.
lnd.LightningApilistChannelsGET /v1/channelslncli: `listchannels` ListChannels returns a description of all the open channels that this node is a participant in.
lnd.LightningApilistInvoicesGET /v1/invoiceslncli: `listinvoices` ListInvoices returns a list of all the invoices currently stored within the database. Any active debug invoices are ignored. It has full support for paginated responses, allowing users to query for specific invoices through their add_index. This can be done by using either the first_index_offset or last_index_offset fields included in the response as the index_offset of the next request. By default, the first 100 invoices created will be returned. Backwards pagination is also supported through the Reversed flag.
lnd.LightningApilistMacaroonIDsGET /v1/macaroon/idslncli: `listmacaroonids` ListMacaroonIDs returns all root key IDs that are in use.
lnd.LightningApilistPaymentsGET /v1/paymentslncli: `listpayments` ListPayments returns a list of all outgoing payments.
lnd.LightningApilistPeersGET /v1/peerslncli: `listpeers` ListPeers returns a verbose listing of all currently active peers.
lnd.LightningApilistPermissionsGET /v1/macaroon/permissionslncli: `listpermissions` ListPermissions lists all RPC method URIs and their required macaroon permissions to access them.
lnd.LightningApilistUnspentGET /v1/utxoslncli: `listunspent` Deprecated, use walletrpc.ListUnspent instead.
lnd.LightningApilookupInvoiceGET /v1/invoice/{r_hash_str}lncli: `lookupinvoice` LookupInvoice attempts to look up an invoice according to its payment hash. The passed payment hash must be exactly 32 bytes, if not, an error is returned.
lnd.LightningApinewAddressGET /v1/newaddresslncli: `newaddress` NewAddress creates a new address under control of the local wallet.
lnd.LightningApiopenChannelPOST /v1/channels/streamlncli: `openchannel` OpenChannel attempts to open a singly funded channel specified in the request to a remote peer. Users are able to specify a target number of blocks that the funding transaction should be confirmed in, or a manual fee rate to us for the funding transaction. If neither are specified, then a lax block confirmation target is used. Each OpenStatusUpdate will return the pending channel ID of the in-progress channel. Depending on the arguments specified in the OpenChannelRequest, this pending channel ID can then be used to manually progress the channel funding flow.
lnd.LightningApiopenChannelSyncPOST /v1/channelsOpenChannelSync is a synchronous version of the OpenChannel RPC call. This call is meant to be consumed by clients to the REST proxy. As with all other sync calls, all byte slices are intended to be populated as hex encoded strings.
lnd.LightningApipendingChannelsGET /v1/channels/pendinglncli: `pendingchannels` PendingChannels returns a list of all the channels that are currently considered \"pending\". A channel is pending if it has finished the funding workflow and is waiting for confirmations for the funding txn, or is in the process of closure, either initiated cooperatively or non-cooperatively.
lnd.LightningApiqueryRoutesGET /v1/graph/routes/{pub_key}/{amt}lncli: `queryroutes` QueryRoutes attempts to query the daemon's Channel Router for a possible route to a target destination capable of carrying a specific amount of satoshis. The returned route contains the full details required to craft and send an HTLC, also including the necessary information that should be present within the Sphinx packet encapsulated within the HTLC.
lnd.LightningApirestoreChannelBackupsPOST /v1/channels/backup/restorelncli: `restorechanbackup` RestoreChannelBackups accepts a set of singular channel backups, or a single encrypted multi-chan backup and attempts to recover any funds remaining within the channel. If we are able to unpack the backup, then the new channel will be shown under listchannels, as well as pending channels.
lnd.LightningApisendCoinsPOST /v1/transactionslncli: `sendcoins` SendCoins executes a request to send coins to a particular address. Unlike SendMany, this RPC call only allows creating a single output at a time. If neither target_conf, or sat_per_vbyte are set, then the internal wallet will consult its fee model to determine a fee for the default confirmation target.
lnd.LightningApisendManyPOST /v1/transactions/manylncli: `sendmany` SendMany handles a request for a transaction that creates multiple specified outputs in parallel. If neither target_conf, or sat_per_vbyte are set, then the internal wallet will consult its fee model to determine a fee for the default confirmation target.
lnd.LightningApisendPaymentPOST /v1/channels/transaction-streamlncli: `sendpayment` Deprecated, use routerrpc.SendPaymentV2. SendPayment dispatches a bi-directional streaming RPC for sending payments through the Lightning Network. A single RPC invocation creates a persistent bi-directional stream allowing clients to rapidly send payments through the Lightning Network with a single persistent connection.
lnd.LightningApisendPaymentSyncPOST /v1/channels/transactionsSendPaymentSync is the synchronous non-streaming version of SendPayment. This RPC is intended to be consumed by clients of the REST proxy. Additionally, this RPC expects the destination's public key and the payment hash (if any) to be encoded as hex strings.
lnd.LightningApisendToRouteSyncPOST /v1/channels/transactions/routeSendToRouteSync is a synchronous version of SendToRoute. It Will block until the payment either fails or succeeds.
lnd.LightningApisignMessagePOST /v1/signmessagelncli: `signmessage` SignMessage signs a message with this node's private key. The returned signature string is `zbase32` encoded and pubkey recoverable, meaning that only the message digest and signature are needed for verification.
lnd.LightningApistopDaemonPOST /v1/stoplncli: `stop` StopDaemon will send a shutdown request to the interrupt handler, triggering a graceful shutdown of the daemon.
lnd.LightningApisubscribeChannelBackupsGET /v1/channels/backup/subscribeSubscribeChannelBackups allows a client to sub-subscribe to the most up to date information concerning the state of all channel backups. Each time a new channel is added, we return the new set of channels, along with a multi-chan backup containing the backup info for all channels. Each time a channel is closed, we send a new update, which contains new new chan back ups, but the updated set of encrypted multi-chan backups with the closed channel(s) removed.
lnd.LightningApisubscribeChannelEventsGET /v1/channels/subscribeSubscribeChannelEvents creates a uni-directional stream from the server to the client in which any updates relevant to the state of the channels are sent over. Events include new active channels, inactive channels, and closed channels.
lnd.LightningApisubscribeChannelGraphGET /v1/graph/subscribeSubscribeChannelGraph launches a streaming RPC that allows the caller to receive notifications upon any changes to the channel graph topology from the point of view of the responding node. Events notified include: new nodes coming online, nodes updating their authenticated attributes, new channels being advertised, updates in the routing policy for a directional channel edge, and when channels are closed on-chain.
lnd.LightningApisubscribeInvoicesGET /v1/invoices/subscribeSubscribeInvoices returns a uni-directional stream (server -> client) for notifying the client of newly added/settled invoices. The caller can optionally specify the add_index and/or the settle_index. If the add_index is specified, then we'll first start by sending add invoice events for all invoices with an add_index greater than the specified value. If the settle_index is specified, the next, we'll send out all settle events for invoices with a settle_index greater than the specified value. One or both of these fields can be set. If no fields are set, then we'll only send out the latest add/settle events.
lnd.LightningApisubscribePeerEventsGET /v1/peers/subscribeSubscribePeerEvents creates a uni-directional stream from the server to the client in which any events relevant to the state of peers are sent over. Events include peers going online and offline.
lnd.LightningApisubscribeTransactionsGET /v1/transactions/subscribeSubscribeTransactions creates a uni-directional stream from the server to the client in which any newly discovered transactions relevant to the wallet are sent over.
lnd.LightningApiupdateChannelPolicyPOST /v1/chanpolicylncli: `updatechanpolicy` UpdateChannelPolicy allows the caller to update the fee schedule and channel policies for all channels globally, or a particular channel.
lnd.LightningApiverifyChanBackupPOST /v1/channels/backup/verifyVerifyChanBackup allows a caller to verify the integrity of a channel backup snapshot. This method will accept either a packed Single or a packed Multi. Specifying both will result in an error.
lnd.LightningApiverifyMessagePOST /v1/verifymessagelncli: `verifymessage` VerifyMessage verifies a signature over a msg. The signature must be zbase32 encoded and signed by an active node in the resident node's channel database. In addition to returning the validity of the signature, VerifyMessage also returns the recovered pubkey from the signature.
lnd.LightningApiwalletBalanceGET /v1/balance/blockchainlncli: `walletbalance` WalletBalance returns total unspent outputs(confirmed and unconfirmed), all confirmed unspent outputs and all unconfirmed unspent outputs under control of the wallet.

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.

0.13.1-11

3 years ago

0.13.1-10

3 years ago

0.13.1-9

3 years ago

0.13.1-8

3 years ago

0.13.1-7

3 years ago

0.13.1-6

3 years ago

0.13.1-5

3 years ago

0.13.1-3

3 years ago

0.13.1-2

3 years ago

0.13.1

3 years ago