@synonymdev/blocktank-lsp-http-client
Advanced tools
Comparing version 0.9.0 to 0.10.0
import { IBtInfo, IBtOrder, ICJitEntry } from './shared'; | ||
import { IBtEstimateFeeResponse } from './shared/IBtEstimateFeeResponse'; | ||
import { IBt0ConfMinTxFeeWindow } from './shared/IBt0ConfMinTxFeeWindow'; | ||
export interface ICreateOrderOptions { | ||
@@ -52,5 +54,3 @@ /** | ||
*/ | ||
estimateOrderFee(lspBalanceSat: number, channelExpiryWeeks: number, options?: Partial<ICreateOrderOptions>): Promise<{ | ||
feeSat: number; | ||
}>; | ||
estimateOrderFee(lspBalanceSat: number, channelExpiryWeeks: number, options?: Partial<ICreateOrderOptions>): Promise<IBtEstimateFeeResponse>; | ||
/** | ||
@@ -84,7 +84,3 @@ * Create a new channel order. | ||
openChannel(orderId: string, connectionStringOrPubkey: string, announceChannel: boolean): Promise<IBtOrder>; | ||
getMin0ConfTxFee(orderId: string): Promise<{ | ||
id: string; | ||
validityEndsAt: string; | ||
satPerVByte: number; | ||
}>; | ||
getMin0ConfTxFee(orderId: string): Promise<IBt0ConfMinTxFeeWindow>; | ||
/** | ||
@@ -91,0 +87,0 @@ * Create a new CJIT entry for Just-In-Time channel open. |
{ | ||
"name": "@synonymdev/blocktank-lsp-http-client", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Blocktank Http Api Client", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -19,3 +19,3 @@ import {BlocktankClient} from './BlocktankClient' | ||
const firstNodeId = info.nodes[0].pubkey; | ||
const {feeSat} = await client.estimateOrderFee(100*1000, 10, { | ||
const estimate = await client.estimateOrderFee(100*1000, 10, { | ||
clientBalanceSat: 20*1000, | ||
@@ -26,3 +26,4 @@ couponCode: 'test', | ||
}) | ||
expect(feeSat).toBeGreaterThan(0) | ||
expect(estimate.feeSat).toBeGreaterThan(0) | ||
expect(estimate.min0ConfTxFee.satPerVByte).toBeGreaterThan(0) | ||
}) | ||
@@ -29,0 +30,0 @@ |
import axios from 'axios'; | ||
import { IBtInfo, IBtOrder, ICJitEntry } from './shared'; | ||
import { IBtEstimateFeeResponse } from './shared/IBtEstimateFeeResponse'; | ||
import { IBt0ConfMinTxFeeWindow } from './shared/IBt0ConfMinTxFeeWindow'; | ||
@@ -88,6 +90,7 @@ export interface ICreateOrderOptions { | ||
*/ | ||
async estimateOrderFee(lspBalanceSat: number, channelExpiryWeeks: number, options: Partial<ICreateOrderOptions> = {}): Promise<{feeSat: number}> { | ||
async estimateOrderFee(lspBalanceSat: number, channelExpiryWeeks: number, options: Partial<ICreateOrderOptions> = {}): Promise<IBtEstimateFeeResponse> { | ||
const opts: any = Object.assign({}, defaultCreateOrderOptions, options) | ||
opts.zeroConf = opts.turboChannel | ||
delete opts.turboChannel | ||
return await this.wrapErrorHandler(`Failed to estimate channel order fee.`, async () => { | ||
@@ -169,3 +172,3 @@ const response = await axios.post(this.baseUrl + '/channels/estimate-fee', { | ||
async getMin0ConfTxFee(orderId: string): Promise<{ id: string, validityEndsAt: string, satPerVByte: number }> { | ||
async getMin0ConfTxFee(orderId: string): Promise<IBt0ConfMinTxFeeWindow> { | ||
const window = await this.wrapErrorHandler(`Failed to fetch order ${orderId}.`, async () => { | ||
@@ -172,0 +175,0 @@ const response = await axios.get(this.baseUrl + '/channels/' + orderId + '/min-0conf-tx-fee') |
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
58779
71
1125