@atomiqlabs/lp-lib 14.0.0-dev.28 → 14.0.0-dev.29

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.
@@ -628,21 +628,23 @@ class ToBtcAbs extends ToBtcBaseSwapHandler_1.ToBtcBaseSwapHandler {
628
628
  msg: "Payment not found"
629
629
  };
630
630
  await this.checkExpired(payment);
631
- if (payment.state === ToBtcSwapAbs_1.ToBtcSwapState.COMMITED)
632
- throw {
633
- _httpStatus: 200,
631
+ if (payment.state === ToBtcSwapAbs_1.ToBtcSwapState.COMMITED) {
632
+ res.status(200).json({
634
633
  code: 20008,
635
634
  msg: "Payment processing"
636
- };
637
- if (payment.state === ToBtcSwapAbs_1.ToBtcSwapState.BTC_SENT || payment.state === ToBtcSwapAbs_1.ToBtcSwapState.BTC_SENDING)
638
- throw {
639
- _httpStatus: 200,
635
+ });
636
+ return;
637
+ }
638
+ if (payment.state === ToBtcSwapAbs_1.ToBtcSwapState.BTC_SENT || payment.state === ToBtcSwapAbs_1.ToBtcSwapState.BTC_SENDING) {
639
+ res.status(200).json({
640
640
  code: 20006,
641
641
  msg: "Already paid",
642
642
  data: {
643
643
  txId: payment.txId
644
644
  }
645
- };
645
+ });
646
+ return;
647
+ }
646
648
  const { swapContract, signer } = this.getChain(payment.chainIdentifier);
647
649
  if (payment.state === ToBtcSwapAbs_1.ToBtcSwapState.NON_PAYABLE) {
648
650
  const isCommited = await swapContract.isCommited(payment.data);
@@ -811,21 +811,23 @@ class ToBtcLnAbs extends ToBtcBaseSwapHandler_1.ToBtcBaseSwapHandler {
811
811
  code: 20007,
812
812
  msg: "Payment not found"
813
813
  };
814
- if (payment.status === "pending")
815
- throw {
816
- _httpStatus: 200,
814
+ if (payment.status === "pending") {
815
+ res.status(200).json({
817
816
  code: 20008,
818
817
  msg: "Payment in-flight"
819
- };
820
- if (payment.status === "confirmed")
821
- throw {
822
- _httpStatus: 200,
818
+ });
819
+ return;
820
+ }
821
+ if (payment.status === "confirmed") {
822
+ res.status(200).json({
823
823
  code: 20006,
824
824
  msg: "Already paid",
825
825
  data: {
826
826
  secret: payment.secret
827
827
  }
828
- };
828
+ });
829
+ return;
830
+ }
829
831
  if (payment.status === "failed")
830
832
  throw {
831
833
  _httpStatus: 200,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/lp-lib",
3
- "version": "14.0.0-dev.28",
3
+ "version": "14.0.0-dev.29",
4
4
  "description": "Main functionality implementation for atomiq LP node",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -789,20 +789,24 @@ export class ToBtcAbs extends ToBtcBaseSwapHandler<ToBtcSwapAbs, ToBtcSwapState>
789
789
 
790
790
  await this.checkExpired(payment);
791
791
 
792
- if (payment.state === ToBtcSwapState.COMMITED) throw {
793
- _httpStatus: 200,
794
- code: 20008,
795
- msg: "Payment processing"
796
- };
792
+ if (payment.state === ToBtcSwapState.COMMITED) {
793
+ res.status(200).json({
794
+ code: 20008,
795
+ msg: "Payment processing"
796
+ });
797
+ return;
798
+ }
797
799
 
798
- if (payment.state === ToBtcSwapState.BTC_SENT || payment.state===ToBtcSwapState.BTC_SENDING) throw {
799
- _httpStatus: 200,
800
- code: 20006,
801
- msg: "Already paid",
802
- data: {
803
- txId: payment.txId
804
- }
805
- };
800
+ if (payment.state === ToBtcSwapState.BTC_SENT || payment.state===ToBtcSwapState.BTC_SENDING) {
801
+ res.status(200).json({
802
+ code: 20006,
803
+ msg: "Already paid",
804
+ data: {
805
+ txId: payment.txId
806
+ }
807
+ });
808
+ return;
809
+ }
806
810
 
807
811
  const {swapContract, signer} = this.getChain(payment.chainIdentifier);
808
812
 
@@ -1057,20 +1057,24 @@ export class ToBtcLnAbs extends ToBtcBaseSwapHandler<ToBtcLnSwapAbs, ToBtcLnSwap
1057
1057
  msg: "Payment not found"
1058
1058
  };
1059
1059
 
1060
- if(payment.status==="pending") throw {
1061
- _httpStatus: 200,
1062
- code: 20008,
1063
- msg: "Payment in-flight"
1064
- };
1060
+ if(payment.status==="pending") {
1061
+ res.status(200).json({
1062
+ code: 20008,
1063
+ msg: "Payment in-flight"
1064
+ });
1065
+ return;
1066
+ }
1065
1067
 
1066
- if(payment.status==="confirmed") throw {
1067
- _httpStatus: 200,
1068
- code: 20006,
1069
- msg: "Already paid",
1070
- data: {
1071
- secret: payment.secret
1072
- }
1073
- };
1068
+ if(payment.status==="confirmed") {
1069
+ res.status(200).json({
1070
+ code: 20006,
1071
+ msg: "Already paid",
1072
+ data: {
1073
+ secret: payment.secret
1074
+ }
1075
+ });
1076
+ return;
1077
+ }
1074
1078
 
1075
1079
  if(payment.status==="failed") throw {
1076
1080
  _httpStatus: 200,