Blocktank Client Libary
Description
Client side wrapper library for interacting with the Blocktank LSP server. For REST API docs see synonym.readme.io
Blocktank is an LSP that allows businesses, apps, or online platforms to integrate, automate, and monetize services from your Lightning node. This includes channel configuration, channel purchases, channel info and more.
For widget and complete code samples see blocktank-ui
Rest API docs
https://synonym.readme.io/
Getting started
yarn add @synonymdev/blocktank-client
npm i -S @synonymdev/blocktank-client
Usage
import bt from '@synonymdev/blocktank-client';
bt.setNetwork('mainnet');
const info = await bt.getInfo();
const service = info.services[0];
const buyRes = await bt.buyChannel({
product_id: service.product_id,
channel_expiry: 4,
remote_balance: 0,
local_balance: 20000,
});
const {btc_address, ln_invoice} = buyRes;
const order = await bt.getOrder(buy.order_id);
const {zero_conf_satvbyte, zero_conf_satvbyte_expiry} = order;
const {state, stateMessage} = order;
const {lnurl_string} = order;
try {
await bt.finalizeChannel({
order_id: order._id,
node_uri: '0296b2db342fcf87ea94d981757fdf4d3e545bd5cef4919f58b5d38dfdd73bf5c9@34.79.58.84:9735',
private: true
});
} catch (e) {
console.error(e);
}
Development
yarn build
Builds library ready for production use.
yarn test
Integration tests.
yarn format
Code formatting.
yarn lint
Code linting.
yarn prepublish
Prepares code for publishing bu building and bumping package version.