@synonymdev/blocktank-lsp-http-client
Advanced tools
Comparing version 0.3.1 to 0.3.2
# Changelog | ||
## 0.3.2 - 21.09.2023 | ||
- (enhance) Added `turboChannel` options to `createOrder` method. | ||
## 0.3.1 - 12.09.2023 | ||
@@ -4,0 +8,0 @@ |
@@ -17,2 +17,6 @@ import { IBtInfo, IBtOrder, ICJitEntry } from './shared'; | ||
couponCode: string; | ||
/** | ||
* If the channel opened should be a turbo aka. zeroConf channel. | ||
*/ | ||
turboChannel: boolean; | ||
} | ||
@@ -19,0 +23,0 @@ export declare const defaultCreateOrderOptions: ICreateOrderOptions; |
@@ -11,3 +11,4 @@ "use strict"; | ||
lspNodeId: undefined, | ||
couponCode: '' | ||
couponCode: '', | ||
turboChannel: false | ||
}; | ||
@@ -68,2 +69,4 @@ class BlocktankClientError extends Error { | ||
const opts = Object.assign({}, exports.defaultCreateOrderOptions, options); | ||
opts.zeroConf = opts.turboChannel; | ||
delete opts.turboChannel; | ||
return await this.wrapErrorHandler(`Failed to create order.`, async () => { | ||
@@ -70,0 +73,0 @@ const response = await axios_1.default.post(this.baseUrl + '/channels', { |
{ | ||
"name": "@synonymdev/blocktank-lsp-http-client", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Blocktank Http Api Client", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -14,3 +14,3 @@ import {BlocktankClient} from './BlocktankClient' | ||
test('createOrder', async () => { | ||
test('createOrder regular', async () => { | ||
const client = new BlocktankClient(serviceUrl) | ||
@@ -22,3 +22,4 @@ const info = await client.getInfo() | ||
couponCode: 'test', | ||
lspNodeId: firstNodeId | ||
lspNodeId: firstNodeId, | ||
turboChannel: true | ||
}) | ||
@@ -29,2 +30,3 @@ expect(order.channelExpiryWeeks).toEqual(10) | ||
expect(order.couponCode).toEqual('test') | ||
expect(order.zeroConf).toEqual(true) | ||
expect(order.lspNode.pubkey).toEqual(firstNodeId) | ||
@@ -89,2 +91,30 @@ }) | ||
test('openChannel quick twice', async () => { | ||
const orderId = 'e3f5570e-deb3-415d-9ed8-b6742ff8496c' | ||
const client = new BlocktankClient(serviceUrl) | ||
async function openChannel() { | ||
try { | ||
const openOrder = await client.openChannel( | ||
orderId, | ||
'03a384c1182026376425293e5e5df8516f2130d0c621364cda1e6ca922ce3ade62@172.20.0.4:9735', | ||
true | ||
) | ||
console.log('success', openOrder.channel) | ||
return openOrder | ||
} catch (e) { | ||
console.log('failed', e) | ||
return e | ||
} | ||
} | ||
const results = await Promise.all([ | ||
openChannel(), | ||
openChannel() | ||
]) | ||
console.log(results) | ||
}) | ||
test('Create CJit Entry', async () => { | ||
@@ -91,0 +121,0 @@ const client = new BlocktankClient(serviceUrl) |
@@ -19,2 +19,6 @@ import axios from 'axios'; | ||
couponCode: string, | ||
/** | ||
* If the channel opened should be a turbo aka. zeroConf channel. | ||
*/ | ||
turboChannel: boolean, | ||
} | ||
@@ -25,3 +29,4 @@ | ||
lspNodeId: undefined, | ||
couponCode: '' | ||
couponCode: '', | ||
turboChannel: false | ||
} | ||
@@ -81,3 +86,5 @@ | ||
async createOrder(lspBalanceSat: number, channelExpiryWeeks: number, options: Partial<ICreateOrderOptions> = {}): Promise<IBtOrder> { | ||
const opts = Object.assign({}, defaultCreateOrderOptions, options) | ||
const opts: any = Object.assign({}, defaultCreateOrderOptions, options) | ||
opts.zeroConf = opts.turboChannel | ||
delete opts.turboChannel | ||
return await this.wrapErrorHandler(`Failed to create order.`, async () => { | ||
@@ -84,0 +91,0 @@ const response = await axios.post(this.baseUrl + '/channels', { |
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
50036
933