Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@synonymdev/blocktank-lsp-http-client

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synonymdev/blocktank-lsp-http-client - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

dist/shared/IOrder.d.ts

35

dist/BlocktankClient.d.ts

@@ -7,2 +7,3 @@ import { IBtInfo, IBtOrder, ICJitEntry } from './shared';

import { IBtEstimateFeeResponse2 } from './shared/IBtEstimateFeeResponse2';
import { IBtBolt11Invoice } from './shared/IBtBolt11Invoice';
export declare class BlocktankClientError extends Error {

@@ -96,2 +97,36 @@ data: any;

bitkitLog(nodeId: string, message: string): Promise<void>;
/**
* Mines a number of blocks on the regtest network.
* @param count Number of blocks to mine. Default is 1.
* @returns
*/
regtestMine(count?: number): Promise<void>;
/**
* Deposits a number of satoshis to an address on the regtest network.
* @param address Address to deposit to.
* @param amountSat Amount of satoshis to deposit. Default is 100_000.
* @returns onchain transaction id.
*/
regtestDeposit(address: string, amountSat?: number): Promise<string>;
/**
* Pays an invoice on the regtest network.
* @param invoice Invoice to pay.
* @param amountSat Amount of satoshis to pay (only for 0 amt invoices).
* @returns blocktank payment id.
*/
regtestPay(invoice: string, amountSat?: number): Promise<string>;
/**
* Get paid an invoice on the regtest network.
* @param paymentId id of the payment.
* @returns blocktank payment.
*/
regtestGetPayment(paymentId: string): Promise<IBtBolt11Invoice>;
/**
* Closes a channel on the regtest network.
* @param fundingTxId Funding transaction id.
* @param vout Funding transaction output index.
* @param forceCloseAfterS Time in seconds to force close the channel after. Default is 24hrs. For force close set it to 0
* @returns closing transaction id.
*/
regtestCloseChannel(fundingTxId: string, vout: number, forceCloseAfterS?: number): Promise<string>;
}

@@ -230,4 +230,78 @@ "use strict";

}
/**
* Mines a number of blocks on the regtest network.
* @param count Number of blocks to mine. Default is 1.
* @returns
*/
regtestMine(count) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.wrapErrorHandler(`Failed to mine ${count} blocks`, () => __awaiter(this, void 0, void 0, function* () {
return yield axios_1.default.post(this.baseUrl + '/regtest/chain/mine', { count });
}));
});
}
/**
* Deposits a number of satoshis to an address on the regtest network.
* @param address Address to deposit to.
* @param amountSat Amount of satoshis to deposit. Default is 100_000.
* @returns onchain transaction id.
*/
regtestDeposit(address, amountSat) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.wrapErrorHandler(`Failed to deposit ${amountSat}sat to ${address}`, () => __awaiter(this, void 0, void 0, function* () {
return yield axios_1.default.post(this.baseUrl + '/regtest/chain/deposit', {
amountSat,
address,
});
}));
});
}
/**
* Pays an invoice on the regtest network.
* @param invoice Invoice to pay.
* @param amountSat Amount of satoshis to pay (only for 0 amt invoices).
* @returns blocktank payment id.
*/
regtestPay(invoice, amountSat) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.wrapErrorHandler(`Failed to pay invoice`, () => __awaiter(this, void 0, void 0, function* () {
return yield axios_1.default.post(this.baseUrl + '/regtest/channel/pay', {
invoice,
amountSat,
});
}));
});
}
/**
* Get paid an invoice on the regtest network.
* @param paymentId id of the payment.
* @returns blocktank payment.
*/
regtestGetPayment(paymentId) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.wrapErrorHandler(`Failed to get invoice`, () => __awaiter(this, void 0, void 0, function* () {
return yield axios_1.default.get(this.baseUrl + `/regtest/channel/pay/${paymentId}`);
}));
});
}
/**
* Closes a channel on the regtest network.
* @param fundingTxId Funding transaction id.
* @param vout Funding transaction output index.
* @param forceCloseAfterS Time in seconds to force close the channel after. Default is 24hrs. For force close set it to 0
* @returns closing transaction id.
*/
regtestCloseChannel(fundingTxId, vout, forceCloseAfterS) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.wrapErrorHandler(`Failed to${forceCloseAfterS ? ' force' : ''} close the channel ${fundingTxId}:${vout}`, () => __awaiter(this, void 0, void 0, function* () {
return yield axios_1.default.post(this.baseUrl + '/regtest/channel/close', {
fundingTxId,
vout,
forceCloseAfterS,
});
}));
});
}
}
exports.BlocktankClient = BlocktankClient;
//# sourceMappingURL=BlocktankClient.js.map

2

package.json
{
"name": "@synonymdev/blocktank-lsp-http-client",
"version": "2.2.0",
"version": "2.3.0",
"description": "Blocktank Http Api Client",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -8,2 +8,3 @@ import axios from 'axios';

import { IBtEstimateFeeResponse2 } from './shared/IBtEstimateFeeResponse2';
import { IBtBolt11Invoice } from './shared/IBtBolt11Invoice';

@@ -226,3 +227,70 @@

/**
* Mines a number of blocks on the regtest network.
* @param count Number of blocks to mine. Default is 1.
* @returns
*/
async regtestMine(count?: number): Promise<void> {
return await this.wrapErrorHandler(`Failed to mine ${count} blocks`, async () => {
return await axios.post(this.baseUrl + '/regtest/chain/mine', { count })
})
}
/**
* Deposits a number of satoshis to an address on the regtest network.
* @param address Address to deposit to.
* @param amountSat Amount of satoshis to deposit. Default is 100_000.
* @returns onchain transaction id.
*/
async regtestDeposit(address: string, amountSat?: number): Promise<string> {
return await this.wrapErrorHandler(`Failed to deposit ${amountSat}sat to ${address}`, async () => {
return await axios.post(this.baseUrl + '/regtest/chain/deposit', {
amountSat,
address,
})
})
}
/**
* Pays an invoice on the regtest network.
* @param invoice Invoice to pay.
* @param amountSat Amount of satoshis to pay (only for 0 amt invoices).
* @returns blocktank payment id.
*/
async regtestPay(invoice: string, amountSat?: number): Promise<string> {
return await this.wrapErrorHandler(`Failed to pay invoice`, async () => {
return await axios.post(this.baseUrl + '/regtest/channel/pay', {
invoice,
amountSat,
})
})
}
/**
* Get paid an invoice on the regtest network.
* @param paymentId id of the payment.
* @returns blocktank payment.
*/
async regtestGetPayment(paymentId: string): Promise<IBtBolt11Invoice> {
return await this.wrapErrorHandler(`Failed to get invoice`, async () => {
return await axios.get(this.baseUrl + `/regtest/channel/pay/${paymentId}`)
})
}
/**
* Closes a channel on the regtest network.
* @param fundingTxId Funding transaction id.
* @param vout Funding transaction output index.
* @param forceCloseAfterS Time in seconds to force close the channel after. Default is 24hrs. For force close set it to 0
* @returns closing transaction id.
*/
async regtestCloseChannel(fundingTxId: string, vout: number, forceCloseAfterS?: number): Promise<string> {
return await this.wrapErrorHandler(`Failed to${forceCloseAfterS ? ' force' : ''} close the channel ${fundingTxId}:${vout}`, async () => {
return await axios.post(this.baseUrl + '/regtest/channel/close', {
fundingTxId,
vout,
forceCloseAfterS,
})
})
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc