@pioneer-platform/thorchain-client 0.0.33 → 0.0.34
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/lib/index.d.ts +11 -1
- package/lib/index.js +14 -6
- package/package.json +8 -8
- package/yarn-error.log +0 -15253
package/lib/index.d.ts
CHANGED
@@ -1 +1,11 @@
|
|
1
|
-
|
1
|
+
declare const TAG = " | maya | ";
|
2
|
+
declare const BaseDecimal: Record<string, number>;
|
3
|
+
declare const uuid: any;
|
4
|
+
declare const log: any;
|
5
|
+
declare let caipToNetworkId: any, shortListSymbolToCaip: any, ChainToNetworkId: any;
|
6
|
+
declare const createMemo: any, parseMemo: any;
|
7
|
+
declare let networkSupport: any[];
|
8
|
+
declare function nodeRequest(path: string): Promise<any>;
|
9
|
+
declare let assets: string[];
|
10
|
+
declare function getPools(): Promise<any>;
|
11
|
+
declare const get_quote: (quote: any) => Promise<any>;
|
package/lib/index.js
CHANGED
@@ -13,8 +13,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
13
13
|
});
|
14
14
|
};
|
15
15
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
16
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
17
|
-
return g =
|
16
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
17
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
18
18
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
19
19
|
function step(op) {
|
20
20
|
if (f) throw new TypeError("Generator is already executing.");
|
@@ -39,9 +39,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
39
39
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
40
40
|
}
|
41
41
|
};
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
43
42
|
var TAG = " | maya | ";
|
44
|
-
|
43
|
+
// Replace BaseDecimal import with local definition
|
44
|
+
// Define BaseDecimal as a simple record of string chains to number values
|
45
|
+
var BaseDecimal = {
|
46
|
+
"BTC": 8,
|
47
|
+
"ETH": 18,
|
48
|
+
"DOGE": 8,
|
49
|
+
"BCH": 8,
|
50
|
+
"LTC": 8,
|
51
|
+
"THOR": 8
|
52
|
+
};
|
45
53
|
var uuid = require('uuidv4').uuid;
|
46
54
|
var log = require('@pioneer-platform/loggerdog')();
|
47
55
|
var _a = require("@pioneer-platform/pioneer-caip"), caipToNetworkId = _a.caipToNetworkId, shortListSymbolToCaip = _a.shortListSymbolToCaip, ChainToNetworkId = _a.ChainToNetworkId;
|
@@ -185,11 +193,11 @@ var get_quote = function (quote) {
|
|
185
193
|
}
|
186
194
|
log.info(tag, "poolIn: ", poolIn, "poolOut: ", poolOut);
|
187
195
|
sellAssetChain = quote.sellAsset.split(".")[0];
|
188
|
-
DECIMALS = Number(
|
196
|
+
DECIMALS = Number(BaseDecimal[sellAssetChain]);
|
189
197
|
if (isNaN(DECIMALS))
|
190
198
|
throw new Error("Invalid DECIMALS value for asset: ".concat(sellAssetChain));
|
191
199
|
BASE_UNIT = Math.pow(10, DECIMALS);
|
192
|
-
sellAmountInBaseUnits = parseFloat(quote.sellAmount) * BASE_UNIT;
|
200
|
+
sellAmountInBaseUnits = Math.round(parseFloat(quote.sellAmount) * BASE_UNIT);
|
193
201
|
URL_1 = "/thorchain/quote/swap?from_asset=".concat(quote.sellAsset, "&to_asset=").concat(quote.buyAsset, "&amount=").concat(sellAmountInBaseUnits, "&destination=").concat(quote.recipientAddress);
|
194
202
|
log.info(tag, "URL: ", URL_1);
|
195
203
|
return [4 /*yield*/, nodeRequest(URL_1)];
|
package/package.json
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pioneer-platform/thorchain-client",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.34",
|
4
4
|
"main": "./lib/index.js",
|
5
5
|
"types": "./lib/index.d.ts",
|
6
6
|
"dependencies": {
|
7
7
|
"@pioneer-platform/loggerdog": "^8.3.1",
|
8
8
|
"@pioneer-platform/pioneer-caip": "^9.2.38",
|
9
9
|
"@pioneer-platform/pioneer-coins": "^9.2.24",
|
10
|
-
"axios": "^1.
|
10
|
+
"axios": "^1.6.0",
|
11
11
|
"dotenv": "^8.2.0",
|
12
12
|
"rango-sdk": "^0.1.45",
|
13
13
|
"uuidv4": "^6.2.13"
|
14
14
|
},
|
15
15
|
"scripts": {
|
16
|
-
"npm": "
|
17
|
-
"test": "
|
16
|
+
"npm": "pnpm i",
|
17
|
+
"test": "pnpm run build && node __tests__/test-module.js",
|
18
18
|
"build": "tsc -p .",
|
19
|
-
"prepublish": "
|
20
|
-
"refresh": "rm -rf ./node_modules ./package-lock.json &&
|
19
|
+
"prepublish": "pnpm run build",
|
20
|
+
"refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
23
|
"@types/jest": "^25.2.3",
|
24
|
-
"@types/node": "^
|
24
|
+
"@types/node": "^18.16.0",
|
25
25
|
"@types/source-map-support": "^0.5.3",
|
26
26
|
"jest": "^26.4.2",
|
27
27
|
"onchange": "^7.0.2",
|
28
28
|
"serve": "^11.3.2",
|
29
29
|
"ts-jest": "^29.0.5",
|
30
|
-
"typescript": "^5.0.
|
30
|
+
"typescript": "^5.0.4"
|
31
31
|
},
|
32
32
|
"gitHead": "a76012f6693a12181c4744e53e977a9eaeef0ed3"
|
33
33
|
}
|