@synonymdev/blocktank-lsp-http-client
Advanced tools
Comparing version 0.1.0 to 0.2.0
# Changelog | ||
## 0.2.0 - 28.07.2023 | ||
- (feat) Added `getMin0ConfTxFee` method. | ||
## 0.1.0 - 13.07.2023 | ||
- (enhance) Initial release |
@@ -56,3 +56,15 @@ import { IBtInfo, IBtOrder } from './shared'; | ||
getOrders(orderIds: string[]): Promise<IBtOrder[]>; | ||
/** | ||
* Open channel to a specific node. | ||
* @param orderId | ||
* @param connectionStringOrPubkey | ||
* @param announceChannel | ||
* @returns | ||
*/ | ||
openChannel(orderId: string, connectionStringOrPubkey: string, announceChannel: boolean): Promise<IBtOrder>; | ||
getMin0ConfTxFee(orderId: string): Promise<{ | ||
id: string; | ||
validityEndsAt: string; | ||
satPerVByte: number; | ||
}>; | ||
} |
@@ -99,2 +99,9 @@ "use strict"; | ||
} | ||
/** | ||
* Open channel to a specific node. | ||
* @param orderId | ||
* @param connectionStringOrPubkey | ||
* @param announceChannel | ||
* @returns | ||
*/ | ||
async openChannel(orderId, connectionStringOrPubkey, announceChannel) { | ||
@@ -109,4 +116,11 @@ return await this.wrapErrorHandler(`Failed to open the channel for order ${orderId}.`, async () => { | ||
} | ||
async getMin0ConfTxFee(orderId) { | ||
const window = await this.wrapErrorHandler(`Failed to fetch order ${orderId}.`, async () => { | ||
const response = await axios_1.default.get(this.baseUrl + '/channels/' + orderId + '/min-0conf-tx-fee'); | ||
return response.data; | ||
}); | ||
return window; | ||
} | ||
} | ||
exports.BlocktankClient = BlocktankClient; | ||
//# sourceMappingURL=BlocktankClient.js.map |
@@ -10,2 +10,3 @@ import { IBtChannel } from "./IBtChannel"; | ||
clientBalanceSat: number; | ||
zeroConf: boolean; | ||
channelExpiryWeeks: number; | ||
@@ -12,0 +13,0 @@ channelExpiresAt: Date; |
{ | ||
"name": "@synonymdev/blocktank-lsp-http-client", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Blocktank Http Api Client", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -24,2 +24,5 @@ # blocktank-lsp-http-client | ||
const expected0ConfFee = await client.getMin0ConfTxFee(order.id) | ||
console.log(`Onchain payments that should be accepted as 0conf need to have a minimal fee of ${expected0ConfFee.satVByte}sat/vbyte.`) | ||
// Check order status | ||
@@ -26,0 +29,0 @@ const updatedOrder = await client.getOrder(order.id) |
@@ -114,2 +114,9 @@ import axios from 'axios'; | ||
/** | ||
* Open channel to a specific node. | ||
* @param orderId | ||
* @param connectionStringOrPubkey | ||
* @param announceChannel | ||
* @returns | ||
*/ | ||
async openChannel(orderId: string, connectionStringOrPubkey: string, announceChannel: boolean): Promise<IBtOrder> { | ||
@@ -125,5 +132,11 @@ return await this.wrapErrorHandler(`Failed to open the channel for order ${orderId}.`, async () => { | ||
async getMin0ConfTxFee(orderId: string): Promise<{id: string, validityEndsAt: string, satPerVByte: number}> { | ||
const window = await this.wrapErrorHandler(`Failed to fetch order ${orderId}.`, async () => { | ||
const response = await axios.get(this.baseUrl + '/channels/' + orderId + '/min-0conf-tx-fee') | ||
return response.data; | ||
}) | ||
return window | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38560
689
126