@atomiqlabs/lp-lib 17.1.0 → 17.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/swaps/escrow/frombtcln_abstract/FromBtcLnAbs.d.ts +0 -1
- package/dist/swaps/escrow/frombtcln_abstract/FromBtcLnAbs.js +6 -3
- package/dist/swaps/escrow/frombtcln_autoinit/FromBtcLnAuto.d.ts +0 -1
- package/dist/swaps/escrow/frombtcln_autoinit/FromBtcLnAuto.js +6 -3
- package/package.json +1 -1
- package/src/swaps/escrow/frombtcln_abstract/FromBtcLnAbs.ts +7 -5
- package/src/swaps/escrow/frombtcln_autoinit/FromBtcLnAuto.ts +7 -4
|
@@ -500,7 +500,6 @@ class FromBtcLnAbs extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
500
500
|
token: (val) => val != null &&
|
|
501
501
|
typeof (val) === "string" &&
|
|
502
502
|
this.isTokenSupported(chainIdentifier, val) ? val : null,
|
|
503
|
-
description: SchemaVerifier_1.FieldTypeEnum.StringOptional,
|
|
504
503
|
descriptionHash: SchemaVerifier_1.FieldTypeEnum.StringOptional,
|
|
505
504
|
exactOut: SchemaVerifier_1.FieldTypeEnum.BooleanOptional
|
|
506
505
|
});
|
|
@@ -510,6 +509,10 @@ class FromBtcLnAbs extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
510
509
|
msg: "Invalid request body"
|
|
511
510
|
};
|
|
512
511
|
metadata.request = parsedBody;
|
|
512
|
+
const descriptionBodyPart = req.paramReader.getExistingParamsOrNull({
|
|
513
|
+
description: SchemaVerifier_1.FieldTypeEnum.StringOptional
|
|
514
|
+
});
|
|
515
|
+
const description = descriptionBodyPart?.description;
|
|
513
516
|
const requestedAmount = { input: !parsedBody.exactOut, amount: parsedBody.amount, token: parsedBody.token };
|
|
514
517
|
const request = {
|
|
515
518
|
chainIdentifier,
|
|
@@ -520,7 +523,7 @@ class FromBtcLnAbs extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
520
523
|
const useToken = parsedBody.token;
|
|
521
524
|
//Check request params
|
|
522
525
|
this.checkTooManyInflightSwaps();
|
|
523
|
-
this.checkDescription(
|
|
526
|
+
this.checkDescription(description);
|
|
524
527
|
this.checkDescriptionHash(parsedBody.descriptionHash);
|
|
525
528
|
const fees = await this.AmountAssertions.preCheckFromBtcAmounts(this.type, request, requestedAmount);
|
|
526
529
|
metadata.times.requestChecked = Date.now();
|
|
@@ -551,7 +554,7 @@ class FromBtcLnAbs extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
551
554
|
metadata.times.balanceChecked = Date.now();
|
|
552
555
|
//Create swap
|
|
553
556
|
const hodlInvoiceObj = {
|
|
554
|
-
description:
|
|
557
|
+
description: description ?? (chainIdentifier + "-" + parsedBody.address),
|
|
555
558
|
cltvDelta: Number(this.config.minCltv) + 5,
|
|
556
559
|
expiresAt: Date.now() + (this.config.invoiceTimeoutSeconds * 1000),
|
|
557
560
|
id: parsedBody.paymentHash,
|
|
@@ -527,7 +527,6 @@ class FromBtcLnAuto extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
527
527
|
token: (val) => val != null &&
|
|
528
528
|
typeof (val) === "string" &&
|
|
529
529
|
this.isTokenSupported(chainIdentifier, val) ? val : null,
|
|
530
|
-
description: SchemaVerifier_1.FieldTypeEnum.StringOptional,
|
|
531
530
|
descriptionHash: SchemaVerifier_1.FieldTypeEnum.StringOptional,
|
|
532
531
|
exactOut: SchemaVerifier_1.FieldTypeEnum.BooleanOptional,
|
|
533
532
|
gasToken: (val) => val != null &&
|
|
@@ -541,6 +540,10 @@ class FromBtcLnAuto extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
541
540
|
code: 20100,
|
|
542
541
|
msg: "Invalid request body"
|
|
543
542
|
};
|
|
543
|
+
const descriptionBodyPart = req.paramReader.getExistingParamsOrNull({
|
|
544
|
+
description: SchemaVerifier_1.FieldTypeEnum.StringOptional
|
|
545
|
+
});
|
|
546
|
+
const description = descriptionBodyPart?.description;
|
|
544
547
|
if (parsedBody.gasToken !== chainInterface.getNativeCurrencyAddress())
|
|
545
548
|
throw {
|
|
546
549
|
code: 20290,
|
|
@@ -572,7 +575,7 @@ class FromBtcLnAuto extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
572
575
|
const useToken = parsedBody.token;
|
|
573
576
|
const gasToken = parsedBody.gasToken;
|
|
574
577
|
//Check request params
|
|
575
|
-
this.checkDescription(
|
|
578
|
+
this.checkDescription(description);
|
|
576
579
|
this.checkDescriptionHash(parsedBody.descriptionHash);
|
|
577
580
|
this.checkTooManyInflightSwaps();
|
|
578
581
|
const fees = await this.AmountAssertions.preCheckFromBtcAmounts(this.type, request, requestedAmount, gasTokenAmount);
|
|
@@ -607,7 +610,7 @@ class FromBtcLnAuto extends FromBtcBaseSwapHandler_1.FromBtcBaseSwapHandler {
|
|
|
607
610
|
metadata.times.balanceChecked = Date.now();
|
|
608
611
|
//Create swap
|
|
609
612
|
const hodlInvoiceObj = {
|
|
610
|
-
description:
|
|
613
|
+
description: description ?? (chainIdentifier + "-" + parsedBody.address),
|
|
611
614
|
cltvDelta: Number(this.config.minCltv) + 5,
|
|
612
615
|
expiresAt: Date.now() + (this.config.invoiceTimeoutSeconds * 1000),
|
|
613
616
|
id: parsedBody.paymentHash,
|
package/package.json
CHANGED
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
LightningNetworkInvoice
|
|
28
28
|
} from "../../../wallets/ILightningWallet";
|
|
29
29
|
import {LightningAssertions} from "../../assertions/LightningAssertions";
|
|
30
|
-
import {FromBtcLnAutoSwapState} from "../frombtcln_autoinit/FromBtcLnAutoSwap";
|
|
31
30
|
|
|
32
31
|
export type FromBtcLnConfig = FromBtcBaseConfig & {
|
|
33
32
|
invoiceTimeoutSeconds?: number,
|
|
@@ -40,7 +39,6 @@ export type FromBtcLnRequestType = {
|
|
|
40
39
|
paymentHash: string,
|
|
41
40
|
amount: bigint,
|
|
42
41
|
token: string,
|
|
43
|
-
description?: string,
|
|
44
42
|
descriptionHash?: string,
|
|
45
43
|
exactOut?: boolean
|
|
46
44
|
}
|
|
@@ -618,7 +616,6 @@ export class FromBtcLnAbs extends FromBtcBaseSwapHandler<FromBtcLnSwapAbs, FromB
|
|
|
618
616
|
token: (val: string) => val!=null &&
|
|
619
617
|
typeof(val)==="string" &&
|
|
620
618
|
this.isTokenSupported(chainIdentifier, val) ? val : null,
|
|
621
|
-
description: FieldTypeEnum.StringOptional,
|
|
622
619
|
descriptionHash: FieldTypeEnum.StringOptional,
|
|
623
620
|
exactOut: FieldTypeEnum.BooleanOptional
|
|
624
621
|
});
|
|
@@ -628,6 +625,11 @@ export class FromBtcLnAbs extends FromBtcBaseSwapHandler<FromBtcLnSwapAbs, FromB
|
|
|
628
625
|
};
|
|
629
626
|
metadata.request = parsedBody;
|
|
630
627
|
|
|
628
|
+
const descriptionBodyPart = req.paramReader.getExistingParamsOrNull({
|
|
629
|
+
description: FieldTypeEnum.StringOptional
|
|
630
|
+
});
|
|
631
|
+
const description = descriptionBodyPart?.description;
|
|
632
|
+
|
|
631
633
|
const requestedAmount = {input: !parsedBody.exactOut, amount: parsedBody.amount, token: parsedBody.token};
|
|
632
634
|
const request = {
|
|
633
635
|
chainIdentifier,
|
|
@@ -639,7 +641,7 @@ export class FromBtcLnAbs extends FromBtcBaseSwapHandler<FromBtcLnSwapAbs, FromB
|
|
|
639
641
|
|
|
640
642
|
//Check request params
|
|
641
643
|
this.checkTooManyInflightSwaps();
|
|
642
|
-
this.checkDescription(
|
|
644
|
+
this.checkDescription(description);
|
|
643
645
|
this.checkDescriptionHash(parsedBody.descriptionHash);
|
|
644
646
|
const fees = await this.AmountAssertions.preCheckFromBtcAmounts(this.type, request, requestedAmount);
|
|
645
647
|
metadata.times.requestChecked = Date.now();
|
|
@@ -692,7 +694,7 @@ export class FromBtcLnAbs extends FromBtcBaseSwapHandler<FromBtcLnSwapAbs, FromB
|
|
|
692
694
|
|
|
693
695
|
//Create swap
|
|
694
696
|
const hodlInvoiceObj: HodlInvoiceInit = {
|
|
695
|
-
description:
|
|
697
|
+
description: description ?? (chainIdentifier+"-"+parsedBody.address),
|
|
696
698
|
cltvDelta: Number(this.config.minCltv) + 5,
|
|
697
699
|
expiresAt: Date.now()+(this.config.invoiceTimeoutSeconds*1000),
|
|
698
700
|
id: parsedBody.paymentHash,
|
|
@@ -35,7 +35,6 @@ export type FromBtcLnAutoRequestType = {
|
|
|
35
35
|
gasToken: string,
|
|
36
36
|
gasAmount: bigint,
|
|
37
37
|
claimerBounty: bigint,
|
|
38
|
-
description?: string,
|
|
39
38
|
descriptionHash?: string,
|
|
40
39
|
exactOut?: boolean
|
|
41
40
|
}
|
|
@@ -623,7 +622,6 @@ export class FromBtcLnAuto extends FromBtcBaseSwapHandler<FromBtcLnAutoSwap, Fro
|
|
|
623
622
|
token: (val: string) => val!=null &&
|
|
624
623
|
typeof(val)==="string" &&
|
|
625
624
|
this.isTokenSupported(chainIdentifier, val) ? val : null,
|
|
626
|
-
description: FieldTypeEnum.StringOptional,
|
|
627
625
|
descriptionHash: FieldTypeEnum.StringOptional,
|
|
628
626
|
exactOut: FieldTypeEnum.BooleanOptional,
|
|
629
627
|
gasToken: (val: string) => val!=null &&
|
|
@@ -637,6 +635,11 @@ export class FromBtcLnAuto extends FromBtcBaseSwapHandler<FromBtcLnAutoSwap, Fro
|
|
|
637
635
|
msg: "Invalid request body"
|
|
638
636
|
};
|
|
639
637
|
|
|
638
|
+
const descriptionBodyPart = req.paramReader.getExistingParamsOrNull({
|
|
639
|
+
description: FieldTypeEnum.StringOptional
|
|
640
|
+
});
|
|
641
|
+
const description = descriptionBodyPart?.description;
|
|
642
|
+
|
|
640
643
|
if(parsedBody.gasToken!==chainInterface.getNativeCurrencyAddress()) throw {
|
|
641
644
|
code: 20290,
|
|
642
645
|
msg: "Unsupported gas token"
|
|
@@ -668,7 +671,7 @@ export class FromBtcLnAuto extends FromBtcBaseSwapHandler<FromBtcLnAutoSwap, Fro
|
|
|
668
671
|
const gasToken = parsedBody.gasToken;
|
|
669
672
|
|
|
670
673
|
//Check request params
|
|
671
|
-
this.checkDescription(
|
|
674
|
+
this.checkDescription(description);
|
|
672
675
|
this.checkDescriptionHash(parsedBody.descriptionHash);
|
|
673
676
|
this.checkTooManyInflightSwaps();
|
|
674
677
|
const fees = await this.AmountAssertions.preCheckFromBtcAmounts(this.type, request, requestedAmount, gasTokenAmount);
|
|
@@ -727,7 +730,7 @@ export class FromBtcLnAuto extends FromBtcBaseSwapHandler<FromBtcLnAutoSwap, Fro
|
|
|
727
730
|
|
|
728
731
|
//Create swap
|
|
729
732
|
const hodlInvoiceObj: HodlInvoiceInit = {
|
|
730
|
-
description:
|
|
733
|
+
description: description ?? (chainIdentifier+"-"+parsedBody.address),
|
|
731
734
|
cltvDelta: Number(this.config.minCltv) + 5,
|
|
732
735
|
expiresAt: Date.now()+(this.config.invoiceTimeoutSeconds*1000),
|
|
733
736
|
id: parsedBody.paymentHash,
|