@atomiqlabs/lp-lib 14.0.0-dev.4 → 14.0.0-dev.6
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.
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StorageManager = void 0;
|
|
4
4
|
const fs = require("fs/promises");
|
|
5
5
|
const Utils_1 = require("../utils/Utils");
|
|
6
|
-
const
|
|
6
|
+
const fsSync = require("fs");
|
|
7
7
|
class StorageManager {
|
|
8
8
|
constructor(directory) {
|
|
9
9
|
this.data = {};
|
|
@@ -37,7 +37,7 @@ class StorageManager {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
async loadData(type) {
|
|
40
|
-
if (!
|
|
40
|
+
if (!fsSync.existsSync(this.directory)) {
|
|
41
41
|
this.logger.debug("loadData(): Data directory not found!");
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
@@ -53,12 +53,12 @@ class FromBtcBaseSwapHandler extends EscrowHandler_1.EscrowHandler {
|
|
|
53
53
|
*/
|
|
54
54
|
async getBaseSecurityDepositPrefetch(chainIdentifier, dummySwapData, depositToken, gasTokenPricePrefetchPromise, depositTokenPricePrefetchPromise, abortController) {
|
|
55
55
|
//Solana workaround
|
|
56
|
-
const { swapContract, chainInterface } = this.getChain(chainIdentifier);
|
|
56
|
+
const { swapContract, chainInterface, signer } = this.getChain(chainIdentifier);
|
|
57
57
|
let feeResult;
|
|
58
58
|
const gasToken = chainInterface.getNativeCurrencyAddress();
|
|
59
59
|
if (swapContract.getRawRefundFee != null) {
|
|
60
60
|
try {
|
|
61
|
-
feeResult = await swapContract.getRawRefundFee(dummySwapData);
|
|
61
|
+
feeResult = await swapContract.getRawRefundFee(signer.getAddress(), dummySwapData);
|
|
62
62
|
}
|
|
63
63
|
catch (e) {
|
|
64
64
|
this.logger.error("getBaseSecurityDepositPrefetch(): pre-fetch error: ", e);
|
|
@@ -68,7 +68,7 @@ class FromBtcBaseSwapHandler extends EscrowHandler_1.EscrowHandler {
|
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
70
|
try {
|
|
71
|
-
feeResult = await swapContract.getRefundFee(dummySwapData);
|
|
71
|
+
feeResult = await swapContract.getRefundFee(signer.getAddress(), dummySwapData);
|
|
72
72
|
}
|
|
73
73
|
catch (e1) {
|
|
74
74
|
this.logger.error("getBaseSecurityDepositPrefetch(): pre-fetch error: ", e1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomiqlabs/lp-lib",
|
|
3
|
-
"version": "14.0.0-dev.
|
|
3
|
+
"version": "14.0.0-dev.6",
|
|
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": "^10.0.0-dev.
|
|
25
|
+
"@atomiqlabs/base": "^10.0.0-dev.2",
|
|
26
26
|
"@atomiqlabs/server-base": "2.0.0",
|
|
27
27
|
"@scure/btc-signer": "1.6.0",
|
|
28
28
|
"express": "4.21.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {StorageObject, IStorageManager} from "@atomiqlabs/base";
|
|
2
2
|
import * as fs from "fs/promises";
|
|
3
3
|
import {getLogger, LoggerType} from "../utils/Utils";
|
|
4
|
-
import fsSync from "fs";
|
|
4
|
+
import * as fsSync from "fs";
|
|
5
5
|
|
|
6
6
|
export class StorageManager<T extends StorageObject> implements IStorageManager<T> {
|
|
7
7
|
|
|
@@ -84,12 +84,12 @@ export abstract class FromBtcBaseSwapHandler<V extends FromBtcBaseSwap<SwapData,
|
|
|
84
84
|
abortController: AbortController
|
|
85
85
|
): Promise<bigint> {
|
|
86
86
|
//Solana workaround
|
|
87
|
-
const {swapContract, chainInterface} = this.getChain(chainIdentifier);
|
|
87
|
+
const {swapContract, chainInterface, signer} = this.getChain(chainIdentifier);
|
|
88
88
|
let feeResult: bigint;
|
|
89
89
|
const gasToken = chainInterface.getNativeCurrencyAddress();
|
|
90
90
|
if (swapContract.getRawRefundFee != null) {
|
|
91
91
|
try {
|
|
92
|
-
feeResult = await swapContract.getRawRefundFee(dummySwapData);
|
|
92
|
+
feeResult = await swapContract.getRawRefundFee(signer.getAddress(), dummySwapData);
|
|
93
93
|
} catch (e) {
|
|
94
94
|
this.logger.error("getBaseSecurityDepositPrefetch(): pre-fetch error: ", e);
|
|
95
95
|
abortController.abort(e);
|
|
@@ -97,7 +97,7 @@ export abstract class FromBtcBaseSwapHandler<V extends FromBtcBaseSwap<SwapData,
|
|
|
97
97
|
}
|
|
98
98
|
} else {
|
|
99
99
|
try {
|
|
100
|
-
feeResult = await swapContract.getRefundFee(dummySwapData);
|
|
100
|
+
feeResult = await swapContract.getRefundFee(signer.getAddress(), dummySwapData);
|
|
101
101
|
} catch (e1) {
|
|
102
102
|
this.logger.error("getBaseSecurityDepositPrefetch(): pre-fetch error: ", e1);
|
|
103
103
|
abortController.abort(e1);
|