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 lsp-ui
yarn add @synonymdev/lsp-client
#or
npm i -S @synonymdev/lsp-client
import bt from '@synonymdev/lsp-client';
// Choose network
bt.setNetwork('mainnet'); // Options are 'mainnet' and 'regtest'
// Get all node info
const info = await bt.getInfo();
// 1. Create channel order
const buyRes = await bt.createOrder({
lspBalanceSat: 100000,
channelExpiryWeeks: 6,
clientBalanceSat: 0
});
// 2. Make payment using one of the provided methods
const {onchain, bolt11Invoice} = buyRes.payment;
// 3. Get status and details for the current channel order
const order = await bt.getOrder(buyRes.id);
const {state, payment} = order;
// 4. Open channel once order.payment.state === 'paid'
await bt.openChannel({
connectionStringOrPubkey: '0296b2db342fcf87ea94d981757fdf4d3e545bd5cef4919f58b5d38dfdd73bf5c9@34.79.58.84:9735',
announceChannel: false // For mobile nodes that won't be routing transactions
});
Builds library ready for production use.
Integration tests.
Code formatting.
Code linting.
Prepares code for publishing bu building and bumping package version.