@atomiqlabs/lp-lib 12.0.0-beta.1 → 12.0.0
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/SwapHandlerSwap.d.ts +4 -0
- package/dist/swaps/SwapHandlerSwap.js +6 -0
- package/dist/swaps/frombtc_trusted/FromBtcTrustedSwap.d.ts +1 -0
- package/dist/swaps/frombtc_trusted/FromBtcTrustedSwap.js +3 -0
- package/dist/swaps/frombtcln_abstract/FromBtcLnSwapAbs.d.ts +2 -0
- package/dist/swaps/frombtcln_abstract/FromBtcLnSwapAbs.js +6 -0
- package/dist/swaps/frombtcln_trusted/FromBtcLnTrustedSwap.d.ts +2 -0
- package/dist/swaps/frombtcln_trusted/FromBtcLnTrustedSwap.js +6 -0
- package/package.json +2 -2
- package/src/swaps/SwapHandlerSwap.ts +7 -0
- package/src/swaps/frombtc_trusted/FromBtcTrustedSwap.ts +4 -0
- package/src/swaps/frombtcln_abstract/FromBtcLnSwapAbs.ts +8 -0
- package/src/swaps/frombtcln_trusted/FromBtcLnTrustedSwap.ts +8 -0
|
@@ -51,6 +51,10 @@ export declare abstract class SwapHandlerSwap<T extends SwapData = SwapData, S =
|
|
|
51
51
|
* use sequence number
|
|
52
52
|
*/
|
|
53
53
|
getIdentifier(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the smart chain token used for the swap
|
|
56
|
+
*/
|
|
57
|
+
getToken(): string;
|
|
54
58
|
/**
|
|
55
59
|
* Checks whether the swap is finished, such that it is final and either successful or failed
|
|
56
60
|
*/
|
|
@@ -94,6 +94,12 @@ class SwapHandlerSwap extends base_1.Lockable {
|
|
|
94
94
|
}
|
|
95
95
|
return this.chainIdentifier + "_" + this.getIdentifierHash();
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns the smart chain token used for the swap
|
|
99
|
+
*/
|
|
100
|
+
getToken() {
|
|
101
|
+
return this.data?.getToken();
|
|
102
|
+
}
|
|
97
103
|
/**
|
|
98
104
|
* Checks whether the swap is finished, such that it is final and either successful or failed
|
|
99
105
|
*/
|
|
@@ -38,6 +38,7 @@ export declare class FromBtcTrustedSwap<T extends SwapData = SwapData> extends F
|
|
|
38
38
|
serialize(): any;
|
|
39
39
|
getClaimHash(): string;
|
|
40
40
|
getSequence(): bigint;
|
|
41
|
+
getToken(): string;
|
|
41
42
|
getOutputAmount(): bigint;
|
|
42
43
|
getTotalInputAmount(): bigint;
|
|
43
44
|
isFailed(): boolean;
|
|
@@ -22,6 +22,8 @@ export declare class FromBtcLnSwapAbs<T extends SwapData = SwapData> extends Fro
|
|
|
22
22
|
constructor(chainIdentifier: string, pr: string, lnPaymentHash: string, amountMtokens: bigint, swapFee: bigint, swapFeeInToken: bigint, claimer: string, token: string, totalTokens: bigint, claimHash: string, securityDeposit: bigint, depositToken: string);
|
|
23
23
|
constructor(obj: any);
|
|
24
24
|
serialize(): any;
|
|
25
|
+
getToken(): string;
|
|
26
|
+
getOutputAmount(): bigint;
|
|
25
27
|
getIdentifierHash(): string;
|
|
26
28
|
getSequence(): bigint;
|
|
27
29
|
isInitiated(): boolean;
|
|
@@ -63,6 +63,12 @@ class FromBtcLnSwapAbs extends FromBtcBaseSwap_1.FromBtcBaseSwap {
|
|
|
63
63
|
partialSerialized.depositToken = this.depositToken;
|
|
64
64
|
return partialSerialized;
|
|
65
65
|
}
|
|
66
|
+
getToken() {
|
|
67
|
+
return this.token;
|
|
68
|
+
}
|
|
69
|
+
getOutputAmount() {
|
|
70
|
+
return this.totalTokens;
|
|
71
|
+
}
|
|
66
72
|
getIdentifierHash() {
|
|
67
73
|
return this.lnPaymentHash;
|
|
68
74
|
}
|
|
@@ -18,6 +18,8 @@ export declare class FromBtcLnTrustedSwap<T extends SwapData = SwapData> extends
|
|
|
18
18
|
scRawTx: string;
|
|
19
19
|
constructor(chainIdentifier: string, pr: string, inputMtokens: bigint, swapFee: bigint, swapFeeInToken: bigint, output: bigint, secret: string, dstAddress: string, token: string);
|
|
20
20
|
constructor(obj: any);
|
|
21
|
+
getToken(): string;
|
|
22
|
+
getOutputAmount(): bigint;
|
|
21
23
|
getClaimHash(): string;
|
|
22
24
|
getSequence(): bigint;
|
|
23
25
|
serialize(): any;
|
|
@@ -36,6 +36,12 @@ class FromBtcLnTrustedSwap extends FromBtcBaseSwap_1.FromBtcBaseSwap {
|
|
|
36
36
|
}
|
|
37
37
|
this.type = null;
|
|
38
38
|
}
|
|
39
|
+
getToken() {
|
|
40
|
+
return this.token;
|
|
41
|
+
}
|
|
42
|
+
getOutputAmount() {
|
|
43
|
+
return this.output;
|
|
44
|
+
}
|
|
39
45
|
getClaimHash() {
|
|
40
46
|
return (0, crypto_1.createHash)("sha256").update(Buffer.from(this.secret, "hex")).digest().toString("hex");
|
|
41
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomiqlabs/lp-lib",
|
|
3
|
-
"version": "12.0.0
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Main functionality implementation for atomiq LP node",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types:": "./dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"author": "adambor",
|
|
23
23
|
"license": "ISC",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@atomiqlabs/base": "8.0.0
|
|
25
|
+
"@atomiqlabs/base": "8.0.0",
|
|
26
26
|
"@atomiqlabs/server-base": "2.0.0",
|
|
27
27
|
"@scure/btc-signer": "1.6.0",
|
|
28
28
|
"express": "4.21.1",
|
|
@@ -125,6 +125,13 @@ export abstract class SwapHandlerSwap<T extends SwapData = SwapData, S = any> ex
|
|
|
125
125
|
return this.chainIdentifier+"_"+this.getIdentifierHash();
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Returns the smart chain token used for the swap
|
|
130
|
+
*/
|
|
131
|
+
getToken(): string {
|
|
132
|
+
return this.data?.getToken();
|
|
133
|
+
}
|
|
134
|
+
|
|
128
135
|
/**
|
|
129
136
|
* Checks whether the swap is finished, such that it is final and either successful or failed
|
|
130
137
|
*/
|
|
@@ -149,6 +149,10 @@ export class FromBtcTrustedSwap<T extends SwapData = SwapData> extends FromBtcBa
|
|
|
149
149
|
return this.sequence;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
getToken(): string {
|
|
153
|
+
return this.token;
|
|
154
|
+
}
|
|
155
|
+
|
|
152
156
|
getOutputAmount(): bigint {
|
|
153
157
|
return this.adjustedOutput || this.outputTokens;
|
|
154
158
|
}
|
|
@@ -106,6 +106,14 @@ export class FromBtcLnSwapAbs<T extends SwapData = SwapData> extends FromBtcBase
|
|
|
106
106
|
return partialSerialized;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
getToken(): string {
|
|
110
|
+
return this.token;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
getOutputAmount(): bigint {
|
|
114
|
+
return this.totalTokens;
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
getIdentifierHash(): string {
|
|
110
118
|
return this.lnPaymentHash;
|
|
111
119
|
}
|
|
@@ -67,6 +67,14 @@ export class FromBtcLnTrustedSwap<T extends SwapData = SwapData> extends FromBtc
|
|
|
67
67
|
this.type = null;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
getToken(): string {
|
|
71
|
+
return this.token;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
getOutputAmount(): bigint {
|
|
75
|
+
return this.output;
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
getClaimHash(): string {
|
|
71
79
|
return createHash("sha256").update(Buffer.from(this.secret, "hex")).digest().toString("hex");
|
|
72
80
|
}
|