Skip to content

Commit 39a6143

Browse files
committed
fix: linting
1 parent 3ea51d3 commit 39a6143

File tree

4 files changed

+44
-20
lines changed

4 files changed

+44
-20
lines changed

example/Dev.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ const Dev = (): ReactElement => {
628628
`bitcoin-cli createrawtransaction '[{"txid":"<tx-id>","vout":<index>}]' '{"${address}":${btc}}'`,
629629
);
630630
console.log(
631-
`bitcoin-cli signrawtransactionwithwallet "<raw-transaction-hex>"`,
631+
'bitcoin-cli signrawtransactionwithwallet "<raw-transaction-hex>"',
632632
);
633633
console.log('********');
634634

example/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,4 @@ export const ldkNetwork = (network: TAvailableNetworks): ENetworks => {
239239
case 'bitcoinSignet':
240240
return ENetworks.signet;
241241
}
242-
};
242+
};

lib/src/ldk.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,17 @@ class LDK {
490490
* @param pushSats
491491
* @returns {Promise<Err<unknown> | Ok<Ok<string> | Err<string>>>}
492492
*/
493-
async createChannel({counterPartyNodeId, channelValueSats, pushSats}: TCreateChannelReq): Promise<Result<string>> {
493+
async createChannel({
494+
counterPartyNodeId,
495+
channelValueSats,
496+
pushSats,
497+
}: TCreateChannelReq): Promise<Result<string>> {
494498
try {
495-
const res = await NativeLDK.createChannel(counterPartyNodeId, channelValueSats, pushSats);
499+
const res = await NativeLDK.createChannel(
500+
counterPartyNodeId,
501+
channelValueSats,
502+
pushSats,
503+
);
496504
this.writeDebugToLog('createChannel');
497505
return ok(res);
498506
} catch (e) {
@@ -509,9 +517,17 @@ class LDK {
509517
* @param fundingTransaction
510518
* @returns {Promise<Err<unknown> | Ok<Ok<string> | Err<string>>>}
511519
*/
512-
async fundChannel({temporaryChannelId, counterPartyNodeId, fundingTransaction}: TFundChannelReq): Promise<Result<string>> {
520+
async fundChannel({
521+
temporaryChannelId,
522+
counterPartyNodeId,
523+
fundingTransaction,
524+
}: TFundChannelReq): Promise<Result<string>> {
513525
try {
514-
const res = await NativeLDK.fundChannel(temporaryChannelId, counterPartyNodeId, fundingTransaction);
526+
const res = await NativeLDK.fundChannel(
527+
temporaryChannelId,
528+
counterPartyNodeId,
529+
fundingTransaction,
530+
);
515531
this.writeDebugToLog('fundChannel');
516532
return ok(res);
517533
} catch (e) {

lib/src/lightning-manager.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,30 +2438,38 @@ class LightningManager {
24382438
* Creates a new channel with the provided peer and then listens for the channel manager funding generation ready event.
24392439
* Once event is triggered, those details can be used to create the funding transaction.
24402440
*/
2441-
async createChannel(req: TCreateChannelReq): Promise<Result<TChannelManagerFundingGenerationReady>> {
2441+
async createChannel(
2442+
req: TCreateChannelReq,
2443+
): Promise<Result<TChannelManagerFundingGenerationReady>> {
24422444
const res = await ldk.createChannel(req);
24432445
if (res.isErr()) {
24442446
return err(res.error);
24452447
}
2446-
2448+
24472449
return new Promise((resolve, reject) => {
24482450
// Channel funding ready event should be instant but if it fails and we don't get the event, we should reject.
24492451
const timeout = setTimeout(() => {
2450-
reject(err(new Error("Event not triggered within 5 seconds")));
2452+
reject(err(new Error('Event not triggered within 5 seconds')));
24512453
}, 5000);
2452-
2453-
// Listen for the event for the channel funding details
2454-
ldk.onEvent(EEventTypes.channel_manager_funding_generation_ready, (eventRes: TChannelManagerFundingGenerationReady) => {
2455-
clearTimeout(timeout);
2456-
resolve(ok(eventRes));
2457-
});
24582454

2459-
ldk.onEvent(EEventTypes.channel_manager_channel_closed, (eventRes: TChannelManagerChannelClosed) => {
2460-
if (eventRes.channel_id === res.value) {
2455+
// Listen for the event for the channel funding details
2456+
ldk.onEvent(
2457+
EEventTypes.channel_manager_funding_generation_ready,
2458+
(eventRes: TChannelManagerFundingGenerationReady) => {
24612459
clearTimeout(timeout);
2462-
reject(err("Channel closed before funding"));
2463-
}
2464-
});
2460+
resolve(ok(eventRes));
2461+
},
2462+
);
2463+
2464+
ldk.onEvent(
2465+
EEventTypes.channel_manager_channel_closed,
2466+
(eventRes: TChannelManagerChannelClosed) => {
2467+
if (eventRes.channel_id === res.value) {
2468+
clearTimeout(timeout);
2469+
reject(err('Channel closed before funding'));
2470+
}
2471+
},
2472+
);
24652473
});
24662474
}
24672475
}

0 commit comments

Comments
 (0)