@atomiqlabs/sdk 8.6.2 → 8.7.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/events/UnifiedSwapEventListener.js +4 -2
- package/dist/http/paramcoders/ParamDecoder.js +9 -4
- package/dist/http/paramcoders/ParamEncoder.js +6 -1
- package/dist/intermediaries/Intermediary.d.ts +21 -0
- package/dist/intermediaries/Intermediary.js +25 -1
- package/dist/intermediaries/IntermediaryDiscovery.d.ts +15 -3
- package/dist/intermediaries/IntermediaryDiscovery.js +25 -6
- package/dist/intermediaries/apis/IntermediaryAPI.d.ts +1 -0
- package/dist/swapper/Swapper.d.ts +9 -4
- package/dist/swapper/Swapper.js +94 -42
- package/dist/swapper/SwapperUtils.js +2 -1
- package/dist/swaps/ISwap.d.ts +5 -0
- package/dist/swaps/ISwap.js +4 -1
- package/dist/swaps/escrow_swaps/IEscrowSelfInitSwap.js +5 -5
- package/dist/swaps/escrow_swaps/IEscrowSwap.d.ts +4 -0
- package/dist/swaps/escrow_swaps/IEscrowSwap.js +4 -3
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.d.ts +19 -6
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.js +54 -21
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.d.ts +7 -3
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.js +3 -4
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.js +3 -3
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCWrapper.d.ts +8 -2
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCWrapper.js +12 -8
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +18 -18
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +12 -6
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +38 -24
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +9 -9
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.d.ts +14 -7
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.js +54 -38
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +5 -5
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.d.ts +18 -7
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.js +61 -33
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +12 -12
- package/dist/swaps/escrow_swaps/tobtc/IToBTCWrapper.d.ts +8 -2
- package/dist/swaps/escrow_swaps/tobtc/IToBTCWrapper.js +13 -8
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.js +1 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.d.ts +13 -4
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.js +44 -28
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.js +2 -2
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.d.ts +8 -4
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.js +29 -21
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +1 -0
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +13 -12
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +21 -10
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +136 -73
- package/dist/swaps/trusted/ln/LnForGasWrapper.js +2 -1
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.js +2 -1
- package/dist/utils/RetryUtils.d.ts +2 -1
- package/dist/utils/RetryUtils.js +3 -2
- package/dist/utils/Utils.d.ts +9 -0
- package/dist/utils/Utils.js +15 -1
- package/package.json +2 -2
- package/src/events/UnifiedSwapEventListener.ts +4 -2
- package/src/http/paramcoders/ParamDecoder.ts +8 -4
- package/src/http/paramcoders/ParamEncoder.ts +5 -1
- package/src/intermediaries/Intermediary.ts +31 -1
- package/src/intermediaries/IntermediaryDiscovery.ts +33 -12
- package/src/intermediaries/apis/IntermediaryAPI.ts +2 -1
- package/src/swapper/Swapper.ts +141 -62
- package/src/swapper/SwapperUtils.ts +3 -1
- package/src/swaps/ISwap.ts +10 -2
- package/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts +5 -5
- package/src/swaps/escrow_swaps/IEscrowSwap.ts +10 -3
- package/src/swaps/escrow_swaps/IEscrowSwapWrapper.ts +64 -26
- package/src/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.ts +8 -5
- package/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts +3 -3
- package/src/swaps/escrow_swaps/frombtc/IFromBTCWrapper.ts +22 -12
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +18 -18
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +52 -31
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +9 -9
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +76 -52
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +5 -5
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +82 -38
- package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +12 -12
- package/src/swaps/escrow_swaps/tobtc/IToBTCWrapper.ts +21 -9
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts +1 -1
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +56 -33
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.ts +2 -2
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +40 -22
- package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +17 -13
- package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +149 -83
- package/src/swaps/trusted/ln/LnForGasWrapper.ts +2 -1
- package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +2 -1
- package/src/utils/RetryUtils.ts +11 -4
- package/src/utils/Utils.ts +14 -0
|
@@ -55,7 +55,7 @@ class IEscrowSelfInitSwap extends IEscrowSwap_1.IEscrowSwap {
|
|
|
55
55
|
while (!expired) {
|
|
56
56
|
await (0, TimeoutUtils_1.timeoutPromise)(intervalSeconds * 1000, abortSignal);
|
|
57
57
|
try {
|
|
58
|
-
expired = await this.
|
|
58
|
+
expired = await this._contract.isInitAuthorizationExpired(this._data, this.signatureData);
|
|
59
59
|
}
|
|
60
60
|
catch (e) {
|
|
61
61
|
this.logger.error("watchdogWaitTillSignatureExpiry(): Error when checking signature expiry: ", e);
|
|
@@ -71,13 +71,13 @@ class IEscrowSelfInitSwap extends IEscrowSwap_1.IEscrowSwap {
|
|
|
71
71
|
* @internal
|
|
72
72
|
*/
|
|
73
73
|
getCommitFee() {
|
|
74
|
-
return this.
|
|
74
|
+
return this._contract.getCommitFee(this._getInitiator(), this.getSwapData(), this.feeRate);
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Returns the transaction fee paid on the smart chain side to initiate the escrow
|
|
78
78
|
*/
|
|
79
79
|
async getSmartChainNetworkFee() {
|
|
80
|
-
const swapContract = this.
|
|
80
|
+
const swapContract = this._contract;
|
|
81
81
|
return (0, TokenAmount_1.toTokenAmount)(await (swapContract.getRawCommitFee != null ?
|
|
82
82
|
swapContract.getRawCommitFee(this._getInitiator(), this.getSwapData(), this.feeRate) :
|
|
83
83
|
swapContract.getCommitFee(this._getInitiator(), this.getSwapData(), this.feeRate)), this.wrapper._getNativeToken(), this.wrapper._prices);
|
|
@@ -90,7 +90,7 @@ class IEscrowSelfInitSwap extends IEscrowSwap_1.IEscrowSwap {
|
|
|
90
90
|
async _verifyQuoteDefinitelyExpired() {
|
|
91
91
|
if (this._data == null || this.signatureData == null)
|
|
92
92
|
throw new Error("data or signature data are null!");
|
|
93
|
-
return this.
|
|
93
|
+
return this._contract.isInitAuthorizationExpired(this._data, this.signatureData);
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Checks if the swap's quote is still valid
|
|
@@ -99,7 +99,7 @@ class IEscrowSelfInitSwap extends IEscrowSwap_1.IEscrowSwap {
|
|
|
99
99
|
if (this._data == null || this.signatureData == null)
|
|
100
100
|
throw new Error("data or signature data are null!");
|
|
101
101
|
try {
|
|
102
|
-
await this.
|
|
102
|
+
await this._contract.isValidInitAuthorization(this._getInitiator(), this._data, this.signatureData, this.feeRate);
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
105
105
|
catch (e) {
|
|
@@ -31,6 +31,10 @@ export declare abstract class IEscrowSwap<T extends ChainType = ChainType, D ext
|
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
33
|
_claimTxId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
protected _contract: T["Contract"];
|
|
34
38
|
protected constructor(wrapper: D["Wrapper"], obj: any);
|
|
35
39
|
protected constructor(wrapper: D["Wrapper"], swapInit: IEscrowSwapInit<T["Data"]>);
|
|
36
40
|
/**
|
|
@@ -24,11 +24,12 @@ class IEscrowSwap extends ISwap_1.ISwap {
|
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
if (swapInitOrObj.data != null)
|
|
27
|
-
this._data = new wrapper._swapDataDeserializer(swapInitOrObj.data);
|
|
27
|
+
this._data = new (wrapper._swapDataDeserializer(this._contractVersion))(swapInitOrObj.data);
|
|
28
28
|
this._commitTxId = swapInitOrObj.commitTxId;
|
|
29
29
|
this._claimTxId = swapInitOrObj.claimTxId;
|
|
30
30
|
this._refundTxId = swapInitOrObj.refundTxId;
|
|
31
31
|
}
|
|
32
|
+
this._contract = wrapper._contract(this._contractVersion);
|
|
32
33
|
}
|
|
33
34
|
//////////////////////////////
|
|
34
35
|
//// Identifiers
|
|
@@ -114,7 +115,7 @@ class IEscrowSwap extends ISwap_1.ISwap {
|
|
|
114
115
|
while (status?.type === base_1.SwapCommitStateType.NOT_COMMITED) {
|
|
115
116
|
await (0, TimeoutUtils_1.timeoutPromise)(intervalSeconds * 1000, abortSignal);
|
|
116
117
|
try {
|
|
117
|
-
status = await this.
|
|
118
|
+
status = await this._contract.getCommitStatus(this._getInitiator(), this._data);
|
|
118
119
|
if (status?.type === base_1.SwapCommitStateType.NOT_COMMITED &&
|
|
119
120
|
await this._verifyQuoteDefinitelyExpired())
|
|
120
121
|
return false;
|
|
@@ -142,7 +143,7 @@ class IEscrowSwap extends ISwap_1.ISwap {
|
|
|
142
143
|
while (status?.type === base_1.SwapCommitStateType.COMMITED || status?.type === base_1.SwapCommitStateType.REFUNDABLE) {
|
|
143
144
|
await (0, TimeoutUtils_1.timeoutPromise)(intervalSeconds * 1000, abortSignal);
|
|
144
145
|
try {
|
|
145
|
-
status = await this.
|
|
146
|
+
status = await this._contract.getCommitStatus(this._getInitiator(), this._data);
|
|
146
147
|
}
|
|
147
148
|
catch (e) {
|
|
148
149
|
this.logger.error("watchdogWaitTillResult(): Error when fetching commit status: ", e);
|
|
@@ -20,23 +20,35 @@ export declare abstract class IEscrowSwapWrapper<T extends ChainType, D extends
|
|
|
20
20
|
/**
|
|
21
21
|
* @internal
|
|
22
22
|
*/
|
|
23
|
-
readonly _contract: T["Contract"];
|
|
23
|
+
readonly _contract: (version?: string) => T["Contract"];
|
|
24
24
|
/**
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
|
-
readonly _swapDataDeserializer: new (data: any) => T["Data"];
|
|
28
|
-
|
|
27
|
+
readonly _swapDataDeserializer: (version?: string) => new (data: any) => T["Data"];
|
|
28
|
+
readonly _versionedContracts: {
|
|
29
|
+
[version: string]: {
|
|
30
|
+
swapContract: T["Contract"];
|
|
31
|
+
swapDataConstructor: new (data: any) => T["Data"];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
constructor(chainIdentifier: string, unifiedStorage: UnifiedSwapStorage<T>, unifiedChainEvents: UnifiedSwapEventListener<T>, chain: T["ChainInterface"], prices: ISwapPrice, tokens: WrapperCtorTokens, options: O, versionedContracts: {
|
|
35
|
+
[version: string]: {
|
|
36
|
+
swapContract: T["Contract"];
|
|
37
|
+
swapDataConstructor: new (data: any) => T["Data"];
|
|
38
|
+
};
|
|
39
|
+
}, events?: EventEmitter<{
|
|
29
40
|
swapState: [ISwap];
|
|
30
41
|
}>);
|
|
31
42
|
/**
|
|
32
43
|
* Pre-fetches signature verification data from the server's pre-sent promise, doesn't throw, instead returns null
|
|
33
44
|
*
|
|
34
45
|
* @param signDataPrefetch Promise that resolves when we receive "signDataPrefetch" from the LP in streaming mode
|
|
46
|
+
* @param contractVersion
|
|
35
47
|
* @returns Pre-fetched signature verification data or null if failed
|
|
36
48
|
*
|
|
37
49
|
* @internal
|
|
38
50
|
*/
|
|
39
|
-
protected preFetchSignData(signDataPrefetch: Promise<any | null
|
|
51
|
+
protected preFetchSignData(signDataPrefetch: Promise<any | null>, contractVersion: string): Promise<T["PreFetchVerification"] | undefined>;
|
|
40
52
|
/**
|
|
41
53
|
* Verifies swap initialization signature returned by the intermediary
|
|
42
54
|
*
|
|
@@ -45,13 +57,14 @@ export declare abstract class IEscrowSwapWrapper<T extends ChainType, D extends
|
|
|
45
57
|
* @param signature Response of the intermediary
|
|
46
58
|
* @param feeRatePromise Pre-fetched fee rate promise
|
|
47
59
|
* @param preFetchSignatureVerificationData Pre-fetched signature verification data
|
|
60
|
+
* @param contractVersion
|
|
48
61
|
* @param abortSignal
|
|
49
62
|
* @returns Swap initialization signature expiry
|
|
50
63
|
* @throws {SignatureVerificationError} when swap init signature is invalid
|
|
51
64
|
*
|
|
52
65
|
* @internal
|
|
53
66
|
*/
|
|
54
|
-
protected verifyReturnedSignature(initiator: string, data: T["Data"], signature: SignatureData, feeRatePromise: Promise<any>, preFetchSignatureVerificationData: Promise<any>, abortSignal?: AbortSignal): Promise<number>;
|
|
67
|
+
protected verifyReturnedSignature(initiator: string, data: T["Data"], signature: SignatureData, feeRatePromise: Promise<any>, preFetchSignatureVerificationData: Promise<any>, contractVersion: string, abortSignal?: AbortSignal): Promise<number>;
|
|
55
68
|
/**
|
|
56
69
|
* Processes InitializeEvent for a given swap
|
|
57
70
|
* @param swap
|
|
@@ -111,5 +124,5 @@ export declare abstract class IEscrowSwapWrapper<T extends ChainType, D extends
|
|
|
111
124
|
blockTime: number;
|
|
112
125
|
blockHeight: number;
|
|
113
126
|
}>;
|
|
114
|
-
}, state: SwapCommitState, lp?: Intermediary): Promise<D["Swap"] | null>;
|
|
127
|
+
}, state: SwapCommitState, contractVersion: string, lp?: Intermediary): Promise<D["Swap"] | null>;
|
|
115
128
|
}
|
|
@@ -9,21 +9,43 @@ const base_1 = require("@atomiqlabs/base");
|
|
|
9
9
|
* @category Swaps/Abstract
|
|
10
10
|
*/
|
|
11
11
|
class IEscrowSwapWrapper extends ISwapWrapper_1.ISwapWrapper {
|
|
12
|
-
constructor(chainIdentifier, unifiedStorage, unifiedChainEvents, chain,
|
|
12
|
+
constructor(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, options, versionedContracts, events) {
|
|
13
13
|
super(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, options, events);
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
this._contract = (version) => {
|
|
18
|
+
const _version = version ?? "v1";
|
|
19
|
+
const data = this._versionedContracts[_version];
|
|
20
|
+
if (data == null)
|
|
21
|
+
throw new Error(`Invalid contract version ${_version} requested`);
|
|
22
|
+
return data.swapContract;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
this._swapDataDeserializer = (version) => {
|
|
28
|
+
const _version = version ?? "v1";
|
|
29
|
+
const data = this._versionedContracts[_version];
|
|
30
|
+
if (data == null)
|
|
31
|
+
throw new Error(`Invalid contract version ${_version} requested`);
|
|
32
|
+
return data.swapDataConstructor;
|
|
33
|
+
};
|
|
34
|
+
//TODO: Properly populate in constructor
|
|
35
|
+
this._versionedContracts = {};
|
|
36
|
+
this._versionedContracts = versionedContracts;
|
|
16
37
|
}
|
|
17
38
|
/**
|
|
18
39
|
* Pre-fetches signature verification data from the server's pre-sent promise, doesn't throw, instead returns null
|
|
19
40
|
*
|
|
20
41
|
* @param signDataPrefetch Promise that resolves when we receive "signDataPrefetch" from the LP in streaming mode
|
|
42
|
+
* @param contractVersion
|
|
21
43
|
* @returns Pre-fetched signature verification data or null if failed
|
|
22
44
|
*
|
|
23
45
|
* @internal
|
|
24
46
|
*/
|
|
25
|
-
preFetchSignData(signDataPrefetch) {
|
|
26
|
-
if (this._contract.preFetchForInitSignatureVerification == null) {
|
|
47
|
+
preFetchSignData(signDataPrefetch, contractVersion) {
|
|
48
|
+
if (this._contract(contractVersion).preFetchForInitSignatureVerification == null) {
|
|
27
49
|
// Catch promise rejections, should they happen
|
|
28
50
|
signDataPrefetch.catch(() => { });
|
|
29
51
|
return Promise.resolve(undefined);
|
|
@@ -31,7 +53,7 @@ class IEscrowSwapWrapper extends ISwapWrapper_1.ISwapWrapper {
|
|
|
31
53
|
return signDataPrefetch.then(obj => {
|
|
32
54
|
if (obj == null)
|
|
33
55
|
return undefined;
|
|
34
|
-
return this._contract.preFetchForInitSignatureVerification(obj);
|
|
56
|
+
return this._contract(contractVersion).preFetchForInitSignatureVerification(obj);
|
|
35
57
|
}).catch(e => {
|
|
36
58
|
this.logger.error("preFetchSignData(): Error: ", e);
|
|
37
59
|
});
|
|
@@ -44,16 +66,17 @@ class IEscrowSwapWrapper extends ISwapWrapper_1.ISwapWrapper {
|
|
|
44
66
|
* @param signature Response of the intermediary
|
|
45
67
|
* @param feeRatePromise Pre-fetched fee rate promise
|
|
46
68
|
* @param preFetchSignatureVerificationData Pre-fetched signature verification data
|
|
69
|
+
* @param contractVersion
|
|
47
70
|
* @param abortSignal
|
|
48
71
|
* @returns Swap initialization signature expiry
|
|
49
72
|
* @throws {SignatureVerificationError} when swap init signature is invalid
|
|
50
73
|
*
|
|
51
74
|
* @internal
|
|
52
75
|
*/
|
|
53
|
-
async verifyReturnedSignature(initiator, data, signature, feeRatePromise, preFetchSignatureVerificationData, abortSignal) {
|
|
76
|
+
async verifyReturnedSignature(initiator, data, signature, feeRatePromise, preFetchSignatureVerificationData, contractVersion, abortSignal) {
|
|
54
77
|
const [feeRate, preFetchedSignatureData] = await Promise.all([feeRatePromise, preFetchSignatureVerificationData]);
|
|
55
|
-
await this._contract.isValidInitAuthorization(initiator, data, signature, feeRate, preFetchedSignatureData);
|
|
56
|
-
return await this._contract.getInitAuthorizationExpiry(data, signature, preFetchedSignatureData);
|
|
78
|
+
await this._contract(contractVersion).isValidInitAuthorization(initiator, data, signature, feeRate, preFetchedSignatureData);
|
|
79
|
+
return await this._contract(contractVersion).getInitAuthorizationExpiry(data, signature, preFetchedSignatureData);
|
|
57
80
|
}
|
|
58
81
|
/**
|
|
59
82
|
* Processes a single SC on-chain event
|
|
@@ -100,7 +123,7 @@ class IEscrowSwapWrapper extends ISwapWrapper_1.ISwapWrapper {
|
|
|
100
123
|
const changedSwaps = [];
|
|
101
124
|
const removeSwaps = [];
|
|
102
125
|
const swapExpiredStatus = {};
|
|
103
|
-
const checkStatusSwaps =
|
|
126
|
+
const checkStatusSwaps = {};
|
|
104
127
|
for (let pastSwap of pastSwaps) {
|
|
105
128
|
if (pastSwap._shouldFetchExpiryStatus()) {
|
|
106
129
|
//Check expiry
|
|
@@ -109,19 +132,29 @@ class IEscrowSwapWrapper extends ISwapWrapper_1.ISwapWrapper {
|
|
|
109
132
|
if (pastSwap._shouldFetchOnchainState()) {
|
|
110
133
|
//Add to swaps for which status should be checked
|
|
111
134
|
if (pastSwap._data != null)
|
|
112
|
-
checkStatusSwaps.push(pastSwap);
|
|
135
|
+
(checkStatusSwaps[pastSwap._contractVersion ?? "v1"] ??= []).push(pastSwap);
|
|
113
136
|
}
|
|
114
137
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
138
|
+
for (let version in checkStatusSwaps) {
|
|
139
|
+
if (this._versionedContracts[version] == null) {
|
|
140
|
+
this.logger.warn(`_checkPastSwaps(): No contract was found for ${this.chainIdentifier} version ${version}! Skipping these swaps!`);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const _checkStatusSwap = checkStatusSwaps[version];
|
|
144
|
+
const swapStatuses = await this._contract(version).getCommitStatuses(_checkStatusSwap.map(val => ({
|
|
145
|
+
signer: val._getInitiator(),
|
|
146
|
+
swapData: val._data
|
|
147
|
+
})));
|
|
148
|
+
for (let pastSwap of _checkStatusSwap) {
|
|
149
|
+
const escrowHash = pastSwap.getEscrowHash();
|
|
150
|
+
const shouldSave = await pastSwap._sync(false, swapExpiredStatus[pastSwap.getId()], escrowHash == null ? undefined : swapStatuses[escrowHash]);
|
|
151
|
+
if (shouldSave) {
|
|
152
|
+
if (pastSwap.isQuoteExpired()) {
|
|
153
|
+
removeSwaps.push(pastSwap);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
changedSwaps.push(pastSwap);
|
|
157
|
+
}
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
160
|
}
|
|
@@ -29,15 +29,19 @@ export declare abstract class IFromBTCLNWrapper<T extends ChainType, D extends I
|
|
|
29
29
|
* @param unifiedStorage Storage interface for the current environment
|
|
30
30
|
* @param unifiedChainEvents On-chain event listener
|
|
31
31
|
* @param chain
|
|
32
|
-
* @param contract Underlying contract handling the swaps
|
|
33
32
|
* @param prices Swap pricing handler
|
|
34
33
|
* @param tokens
|
|
35
|
-
* @param
|
|
34
|
+
* @param versionedContracts
|
|
36
35
|
* @param lnApi
|
|
37
36
|
* @param options
|
|
38
37
|
* @param events Instance to use for emitting events
|
|
39
38
|
*/
|
|
40
|
-
constructor(chainIdentifier: string, unifiedStorage: UnifiedSwapStorage<T>, unifiedChainEvents: UnifiedSwapEventListener<T>, chain: T["ChainInterface"],
|
|
39
|
+
constructor(chainIdentifier: string, unifiedStorage: UnifiedSwapStorage<T>, unifiedChainEvents: UnifiedSwapEventListener<T>, chain: T["ChainInterface"], prices: ISwapPrice, tokens: WrapperCtorTokens, versionedContracts: {
|
|
40
|
+
[version: string]: {
|
|
41
|
+
swapContract: T["Contract"];
|
|
42
|
+
swapDataConstructor: new (data: any) => T["Data"];
|
|
43
|
+
};
|
|
44
|
+
}, lnApi: LightningNetworkApi, options: O, events?: EventEmitter<{
|
|
41
45
|
swapState: [IEscrowSwap];
|
|
42
46
|
}>);
|
|
43
47
|
/**
|
|
@@ -19,16 +19,15 @@ class IFromBTCLNWrapper extends IFromBTCWrapper_1.IFromBTCWrapper {
|
|
|
19
19
|
* @param unifiedStorage Storage interface for the current environment
|
|
20
20
|
* @param unifiedChainEvents On-chain event listener
|
|
21
21
|
* @param chain
|
|
22
|
-
* @param contract Underlying contract handling the swaps
|
|
23
22
|
* @param prices Swap pricing handler
|
|
24
23
|
* @param tokens
|
|
25
|
-
* @param
|
|
24
|
+
* @param versionedContracts
|
|
26
25
|
* @param lnApi
|
|
27
26
|
* @param options
|
|
28
27
|
* @param events Instance to use for emitting events
|
|
29
28
|
*/
|
|
30
|
-
constructor(chainIdentifier, unifiedStorage, unifiedChainEvents, chain,
|
|
31
|
-
super(chainIdentifier, unifiedStorage, unifiedChainEvents, chain,
|
|
29
|
+
constructor(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, versionedContracts, lnApi, options, events) {
|
|
30
|
+
super(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, options, versionedContracts, events);
|
|
32
31
|
this.lnApi = lnApi;
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
@@ -128,7 +128,7 @@ class IFromBTCSelfInitSwap extends IEscrowSelfInitSwap_1.IEscrowSelfInitSwap {
|
|
|
128
128
|
*/
|
|
129
129
|
async hasEnoughForTxFees() {
|
|
130
130
|
const [balance, commitFee] = await Promise.all([
|
|
131
|
-
this.
|
|
131
|
+
this._contract.getBalance(this._getInitiator(), this.wrapper._chain.getNativeCurrencyAddress(), false),
|
|
132
132
|
this.getCommitFee()
|
|
133
133
|
]);
|
|
134
134
|
const totalFee = commitFee + this.getSwapData().getTotalDeposit();
|
|
@@ -174,7 +174,7 @@ class IFromBTCSelfInitSwap extends IEscrowSelfInitSwap_1.IEscrowSelfInitSwap {
|
|
|
174
174
|
this.initiated = true;
|
|
175
175
|
await this._saveAndEmit();
|
|
176
176
|
}
|
|
177
|
-
return await this.
|
|
177
|
+
return await this._contract.txsInit(this._getInitiator(), this._data, this.signatureData, skipChecks, this.feeRate).catch(e => Promise.reject(e instanceof base_1.SignatureVerificationError ? new Error("Request timed out") : e));
|
|
178
178
|
}
|
|
179
179
|
//////////////////////////////
|
|
180
180
|
//// Claim
|
|
@@ -183,7 +183,7 @@ class IFromBTCSelfInitSwap extends IEscrowSelfInitSwap_1.IEscrowSelfInitSwap {
|
|
|
183
183
|
* smart chain
|
|
184
184
|
*/
|
|
185
185
|
async getClaimNetworkFee() {
|
|
186
|
-
const swapContract = this.
|
|
186
|
+
const swapContract = this._contract;
|
|
187
187
|
return (0, TokenAmount_1.toTokenAmount)(await swapContract.getClaimFee(this._getInitiator(), this.getSwapData()), this.wrapper._getNativeToken(), this.wrapper._prices);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -27,11 +27,16 @@ export declare abstract class IFromBTCWrapper<T extends ChainType, D extends IFr
|
|
|
27
27
|
* @param claimHash optional claim hash of the swap or null
|
|
28
28
|
* @param abortController
|
|
29
29
|
*
|
|
30
|
+
* @param contractVersions
|
|
30
31
|
* @returns Fee rate
|
|
31
32
|
*
|
|
32
33
|
* @internal
|
|
33
34
|
*/
|
|
34
|
-
protected preFetchFeeRate(signer: string, amountData: AmountData, claimHash:
|
|
35
|
+
protected preFetchFeeRate(signer: string, amountData: AmountData, claimHash: {
|
|
36
|
+
[contractVersion: string]: string;
|
|
37
|
+
} | undefined, abortController: AbortController, contractVersions: string[]): {
|
|
38
|
+
[contractVersion: string]: Promise<string | undefined>;
|
|
39
|
+
};
|
|
35
40
|
/**
|
|
36
41
|
* Pre-fetches intermediary (LP) available smart chain liquidity
|
|
37
42
|
*
|
|
@@ -39,11 +44,12 @@ export declare abstract class IFromBTCWrapper<T extends ChainType, D extends IFr
|
|
|
39
44
|
* @param lp Intermediary
|
|
40
45
|
* @param abortController
|
|
41
46
|
*
|
|
47
|
+
* @param contractVersion
|
|
42
48
|
* @returns Intermediary's liquidity balance
|
|
43
49
|
*
|
|
44
50
|
* @internal
|
|
45
51
|
*/
|
|
46
|
-
protected preFetchIntermediaryLiquidity(amountData: AmountData, lp: Intermediary, abortController: AbortController): Promise<bigint | undefined>;
|
|
52
|
+
protected preFetchIntermediaryLiquidity(amountData: AmountData, lp: Intermediary, abortController: AbortController, contractVersion: string): Promise<bigint | undefined>;
|
|
47
53
|
/**
|
|
48
54
|
* Verifies whether the intermediary (LP) has enough available liquidity such that we can initiate the swap
|
|
49
55
|
*
|
|
@@ -29,16 +29,19 @@ class IFromBTCWrapper extends IEscrowSwapWrapper_1.IEscrowSwapWrapper {
|
|
|
29
29
|
* @param claimHash optional claim hash of the swap or null
|
|
30
30
|
* @param abortController
|
|
31
31
|
*
|
|
32
|
+
* @param contractVersions
|
|
32
33
|
* @returns Fee rate
|
|
33
34
|
*
|
|
34
35
|
* @internal
|
|
35
36
|
*/
|
|
36
|
-
preFetchFeeRate(signer, amountData, claimHash, abortController) {
|
|
37
|
-
return
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
preFetchFeeRate(signer, amountData, claimHash, abortController, contractVersions) {
|
|
38
|
+
return (0, Utils_1.mapArrayToObject)(contractVersions, (contractVersion) => {
|
|
39
|
+
return this._contract(contractVersion).getInitFeeRate(this._chain.randomAddress(), signer, amountData.token, claimHash?.[contractVersion])
|
|
40
|
+
.catch(e => {
|
|
41
|
+
this.logger.warn("preFetchFeeRate(): Error: ", e);
|
|
42
|
+
abortController.abort(e);
|
|
43
|
+
return undefined;
|
|
44
|
+
});
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
@@ -48,12 +51,13 @@ class IFromBTCWrapper extends IEscrowSwapWrapper_1.IEscrowSwapWrapper {
|
|
|
48
51
|
* @param lp Intermediary
|
|
49
52
|
* @param abortController
|
|
50
53
|
*
|
|
54
|
+
* @param contractVersion
|
|
51
55
|
* @returns Intermediary's liquidity balance
|
|
52
56
|
*
|
|
53
57
|
* @internal
|
|
54
58
|
*/
|
|
55
|
-
preFetchIntermediaryLiquidity(amountData, lp, abortController) {
|
|
56
|
-
return lp.getLiquidity(this.chainIdentifier, this._contract, amountData.token.toString(), abortController.signal).catch(e => {
|
|
59
|
+
preFetchIntermediaryLiquidity(amountData, lp, abortController, contractVersion) {
|
|
60
|
+
return lp.getLiquidity(this.chainIdentifier, this._contract(contractVersion), amountData.token.toString(), abortController.signal).catch(e => {
|
|
57
61
|
this.logger.warn("preFetchIntermediaryLiquidity(): Error: ", e);
|
|
58
62
|
abortController.abort(e);
|
|
59
63
|
return undefined;
|
|
@@ -394,11 +394,11 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
394
394
|
*/
|
|
395
395
|
async hasEnoughForTxFees() {
|
|
396
396
|
const [balance, feeRate] = await Promise.all([
|
|
397
|
-
this.
|
|
398
|
-
this.feeRate != null ? Promise.resolve(this.feeRate) : this.
|
|
397
|
+
this._contract.getBalance(this._getInitiator(), this.wrapper._chain.getNativeCurrencyAddress(), false),
|
|
398
|
+
this.feeRate != null ? Promise.resolve(this.feeRate) : this._contract.getInitFeeRate(this.getSwapData().getOfferer(), this.getSwapData().getClaimer(), this.getSwapData().getToken(), this.getSwapData().getClaimHash())
|
|
399
399
|
]);
|
|
400
|
-
const commitFee = await this.
|
|
401
|
-
const claimFee = await this.
|
|
400
|
+
const commitFee = await this._contract.getCommitFee(this._getInitiator(), this.getSwapData(), feeRate);
|
|
401
|
+
const claimFee = await this._contract.getClaimFee(this._getInitiator(), this.getSwapData(), feeRate);
|
|
402
402
|
const totalFee = commitFee + claimFee + this.getSwapData().getTotalDeposit();
|
|
403
403
|
return {
|
|
404
404
|
enoughBalance: balance >= totalFee,
|
|
@@ -408,7 +408,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
408
408
|
}
|
|
409
409
|
isValidSecretPreimage(secret) {
|
|
410
410
|
const paymentHash = buffer_1.Buffer.from((0, sha2_1.sha256)(buffer_1.Buffer.from(secret, "hex")));
|
|
411
|
-
const claimHash = this.
|
|
411
|
+
const claimHash = this._contract.getHashForHtlc(paymentHash).toString("hex");
|
|
412
412
|
return this.getSwapData().getClaimHash() === claimHash;
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
@@ -602,10 +602,10 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
602
602
|
const resp = await IntermediaryAPI_1.IntermediaryAPI.getPaymentAuthorization(this.url, paymentHash.toString("hex"));
|
|
603
603
|
switch (resp.code) {
|
|
604
604
|
case IntermediaryAPI_1.PaymentAuthorizationResponseCodes.AUTH_DATA:
|
|
605
|
-
const data = new this.wrapper._swapDataDeserializer(resp.data.data);
|
|
605
|
+
const data = new (this.wrapper._swapDataDeserializer(this._contractVersion))(resp.data.data);
|
|
606
606
|
try {
|
|
607
607
|
await this.checkIntermediaryReturnedAuthData(this._getInitiator(), data, resp.data);
|
|
608
|
-
this.expiry = await this.
|
|
608
|
+
this.expiry = await this._contract.getInitAuthorizationExpiry(data, resp.data);
|
|
609
609
|
this._state = FromBTCLNSwapState.PR_PAID;
|
|
610
610
|
this._data = data;
|
|
611
611
|
this.signatureData = {
|
|
@@ -666,8 +666,8 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
666
666
|
if (data.hasSuccessAction())
|
|
667
667
|
throw new IntermediaryError_1.IntermediaryError("Invalid has success action");
|
|
668
668
|
await Promise.all([
|
|
669
|
-
this.
|
|
670
|
-
this.
|
|
669
|
+
this._contract.isValidInitAuthorization(this._getInitiator(), data, signature, this.feeRate),
|
|
670
|
+
this._contract.getCommitStatus(data.getClaimer(), data)
|
|
671
671
|
.then(status => {
|
|
672
672
|
if (status?.type !== base_1.SwapCommitStateType.NOT_COMMITED)
|
|
673
673
|
throw new Error("Swap already committed on-chain!");
|
|
@@ -730,9 +730,9 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
730
730
|
abortController.signal.throwIfAborted();
|
|
731
731
|
if (resp.code === IntermediaryAPI_1.PaymentAuthorizationResponseCodes.AUTH_DATA) {
|
|
732
732
|
const sigData = resp.data;
|
|
733
|
-
const swapData = new this.wrapper._swapDataDeserializer(resp.data.data);
|
|
733
|
+
const swapData = new (this.wrapper._swapDataDeserializer(this._contractVersion))(resp.data.data);
|
|
734
734
|
await this.checkIntermediaryReturnedAuthData(this._getInitiator(), swapData, sigData);
|
|
735
|
-
this.expiry = await this.
|
|
735
|
+
this.expiry = await this._contract.getInitAuthorizationExpiry(swapData, sigData);
|
|
736
736
|
if (onPaymentReceived != null)
|
|
737
737
|
onPaymentReceived(this.getInputTxId());
|
|
738
738
|
if (this._state === FromBTCLNSwapState.PR_CREATED || this._state === FromBTCLNSwapState.QUOTE_SOFT_EXPIRED) {
|
|
@@ -840,7 +840,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
840
840
|
throw new Error("Swap secret pre-image not known and not provided, please provide the swap secret pre-image as an argument");
|
|
841
841
|
if (!this.isValidSecretPreimage(useSecret))
|
|
842
842
|
throw new Error("Invalid swap secret pre-image provided!");
|
|
843
|
-
return this.
|
|
843
|
+
return this._contract.txsClaimWithSecret(address ?? this._getInitiator(), this._data, useSecret, true, true);
|
|
844
844
|
}
|
|
845
845
|
/**
|
|
846
846
|
* @inheritDoc
|
|
@@ -950,7 +950,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
950
950
|
* to settle the swap on the smart chain destination side.
|
|
951
951
|
*/
|
|
952
952
|
async getCommitAndClaimNetworkFee() {
|
|
953
|
-
const swapContract = this.
|
|
953
|
+
const swapContract = this._contract;
|
|
954
954
|
const feeRate = this.feeRate ?? await swapContract.getInitFeeRate(this.getSwapData().getOfferer(), this.getSwapData().getClaimer(), this.getSwapData().getToken(), this.getSwapData().getClaimHash());
|
|
955
955
|
const commitFee = await (swapContract.getRawCommitFee != null ?
|
|
956
956
|
swapContract.getRawCommitFee(this._getInitiator(), this.getSwapData(), feeRate) :
|
|
@@ -966,7 +966,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
966
966
|
* call {@link commit} first and then {@link claim}.
|
|
967
967
|
*/
|
|
968
968
|
canCommitAndClaimInOneShot() {
|
|
969
|
-
return this.
|
|
969
|
+
return this._contract.initAndClaimWithSecret != null;
|
|
970
970
|
}
|
|
971
971
|
/**
|
|
972
972
|
* Returns transactions for both commit & claim operation together, such that they can be signed all at once by
|
|
@@ -995,7 +995,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
995
995
|
if (!this.isValidSecretPreimage(useSecret))
|
|
996
996
|
throw new Error("Invalid swap secret pre-image provided!");
|
|
997
997
|
const initTxs = await this.txsCommit(skipChecks);
|
|
998
|
-
const claimTxs = await this.
|
|
998
|
+
const claimTxs = await this._contract.txsClaimWithSecret(this._getInitiator(), this._data, useSecret, true, true, undefined, true);
|
|
999
999
|
return initTxs.concat(claimTxs);
|
|
1000
1000
|
}
|
|
1001
1001
|
/**
|
|
@@ -1125,7 +1125,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
1125
1125
|
quoteExpired = quoteDefinitelyExpired ?? await this._verifyQuoteDefinitelyExpired();
|
|
1126
1126
|
}
|
|
1127
1127
|
//Check if it's already successfully paid
|
|
1128
|
-
commitStatus ??= await this.
|
|
1128
|
+
commitStatus ??= await this._contract.getCommitStatus(this._getInitiator(), this._data);
|
|
1129
1129
|
if (commitStatus != null && await this._forciblySetOnchainState(commitStatus))
|
|
1130
1130
|
return true;
|
|
1131
1131
|
//Set the state on expiry here
|
|
@@ -1191,7 +1191,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
1191
1191
|
if (await this.syncStateFromChain(quoteDefinitelyExpired, commitStatus))
|
|
1192
1192
|
changed = true;
|
|
1193
1193
|
if (this._state === FromBTCLNSwapState.CLAIM_COMMITED) {
|
|
1194
|
-
const expired = await this.
|
|
1194
|
+
const expired = await this._contract.isExpired(this._getInitiator(), this._data);
|
|
1195
1195
|
if (expired) {
|
|
1196
1196
|
this._state = FromBTCLNSwapState.EXPIRED;
|
|
1197
1197
|
changed = true;
|
|
@@ -1259,7 +1259,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
break;
|
|
1261
1261
|
case FromBTCLNSwapState.CLAIM_COMMITED:
|
|
1262
|
-
const expired = await this.
|
|
1262
|
+
const expired = await this._contract.isExpired(this._getInitiator(), this._data);
|
|
1263
1263
|
if (expired) {
|
|
1264
1264
|
this._state = FromBTCLNSwapState.EXPIRED;
|
|
1265
1265
|
if (save)
|
|
@@ -79,15 +79,19 @@ export declare class FromBTCLNWrapper<T extends ChainType> extends IFromBTCLNWra
|
|
|
79
79
|
* @param unifiedStorage Storage interface for the current environment
|
|
80
80
|
* @param unifiedChainEvents On-chain event listener
|
|
81
81
|
* @param chain
|
|
82
|
-
* @param contract Underlying contract handling the swaps
|
|
83
82
|
* @param prices Swap pricing handler
|
|
84
83
|
* @param tokens
|
|
85
|
-
* @param
|
|
84
|
+
* @param versionedContracts
|
|
86
85
|
* @param lnApi
|
|
87
86
|
* @param options
|
|
88
87
|
* @param events Instance to use for emitting events
|
|
89
88
|
*/
|
|
90
|
-
constructor(chainIdentifier: string, unifiedStorage: UnifiedSwapStorage<T>, unifiedChainEvents: UnifiedSwapEventListener<T>, chain: T["ChainInterface"],
|
|
89
|
+
constructor(chainIdentifier: string, unifiedStorage: UnifiedSwapStorage<T>, unifiedChainEvents: UnifiedSwapEventListener<T>, chain: T["ChainInterface"], prices: ISwapPrice, tokens: WrapperCtorTokens, versionedContracts: {
|
|
90
|
+
[version: string]: {
|
|
91
|
+
swapContract: T["Contract"];
|
|
92
|
+
swapDataConstructor: new (data: any) => T["Data"];
|
|
93
|
+
};
|
|
94
|
+
}, lnApi: LightningNetworkApi, options?: AllOptional<FromBTCLNWrapperOptions>, events?: EventEmitter<{
|
|
91
95
|
swapState: [ISwap];
|
|
92
96
|
}>);
|
|
93
97
|
/**
|
|
@@ -136,8 +140,10 @@ export declare class FromBTCLNWrapper<T extends ChainType> extends IFromBTCLNWra
|
|
|
136
140
|
*/
|
|
137
141
|
create(recipient: string, amountData: AmountData, lps: Intermediary[], options?: FromBTCLNOptions, additionalParams?: Record<string, any>, abortSignal?: AbortSignal, preFetches?: {
|
|
138
142
|
usdPricePrefetchPromise: Promise<number | undefined>;
|
|
139
|
-
pricePrefetchPromise
|
|
140
|
-
feeRatePromise
|
|
143
|
+
pricePrefetchPromise: Promise<bigint | undefined>;
|
|
144
|
+
feeRatePromise: {
|
|
145
|
+
[contractVersion: string]: Promise<string | undefined>;
|
|
146
|
+
};
|
|
141
147
|
}): {
|
|
142
148
|
quote: Promise<FromBTCLNSwap<T>>;
|
|
143
149
|
intermediary: Intermediary;
|
|
@@ -180,5 +186,5 @@ export declare class FromBTCLNWrapper<T extends ChainType> extends IFromBTCLNWra
|
|
|
180
186
|
blockTime: number;
|
|
181
187
|
blockHeight: number;
|
|
182
188
|
}>;
|
|
183
|
-
}, state: SwapCommitState, lp?: Intermediary): Promise<FromBTCLNSwap<T> | null>;
|
|
189
|
+
}, state: SwapCommitState, contractVersion: string, lp?: Intermediary): Promise<FromBTCLNSwap<T> | null>;
|
|
184
190
|
}
|