@d8x/perpetuals-sdk 0.0.14 → 0.0.16
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.
|
@@ -87,7 +87,7 @@ class OrderReferrerTool extends writeAccessHandler_1.default {
|
|
|
87
87
|
if (typeof referrerAddr == "undefined") {
|
|
88
88
|
referrerAddr = this.traderAddr;
|
|
89
89
|
}
|
|
90
|
-
return yield orderBookSC.executeLimitOrderByDigest(orderId, referrerAddr);
|
|
90
|
+
return yield orderBookSC.executeLimitOrderByDigest(orderId, referrerAddr, { gasLimit: this.gasLimit });
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
/**
|
package/package.json
CHANGED
package/src/orderReferrerTool.ts
CHANGED
|
@@ -78,7 +78,7 @@ export default class OrderReferrerTool extends WriteAccessHandler {
|
|
|
78
78
|
if (typeof referrerAddr == "undefined") {
|
|
79
79
|
referrerAddr = this.traderAddr;
|
|
80
80
|
}
|
|
81
|
-
return await orderBookSC.executeLimitOrderByDigest(orderId, referrerAddr);
|
|
81
|
+
return await orderBookSC.executeLimitOrderByDigest(orderId, referrerAddr, { gasLimit: this.gasLimit });
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -523,13 +523,16 @@ export default class PerpetualDataHandler {
|
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
private static _flagToOrderType(order: SmartContractOrder): string {
|
|
526
|
-
let
|
|
527
|
-
let
|
|
528
|
-
|
|
526
|
+
let flag = BigNumber.from(order.flags);
|
|
527
|
+
let isLimit = containsFlag(flag, MASK_LIMIT_ORDER);
|
|
528
|
+
let hasLimit = !BigNumber.from(order.fLimitPrice).eq(0) || !BigNumber.from(order.fLimitPrice).eq(MAX_64x64);
|
|
529
|
+
let isStop = containsFlag(flag, MASK_STOP_ORDER);
|
|
530
|
+
|
|
531
|
+
if (isStop && hasLimit) {
|
|
529
532
|
return ORDER_TYPE_STOP_LIMIT;
|
|
530
|
-
} else if (
|
|
533
|
+
} else if (isStop && !hasLimit) {
|
|
531
534
|
return ORDER_TYPE_STOP_MARKET;
|
|
532
|
-
} else if (
|
|
535
|
+
} else if (isLimit && !isStop) {
|
|
533
536
|
return ORDER_TYPE_LIMIT;
|
|
534
537
|
} else {
|
|
535
538
|
return ORDER_TYPE_MARKET;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import WriteAccessHandler from "./writeAccessHandler";
|
|
2
|
-
import { NodeSDKConfig } from "./nodeSDKTypes";
|
|
3
|
-
/**
|
|
4
|
-
* LiquidatorTool
|
|
5
|
-
* Methods to liquidate traders
|
|
6
|
-
*/
|
|
7
|
-
export default class LiquidatorTool extends WriteAccessHandler {
|
|
8
|
-
/**
|
|
9
|
-
* Constructor
|
|
10
|
-
* @param config configuration
|
|
11
|
-
* @param privateKey private key of account that trades
|
|
12
|
-
*/
|
|
13
|
-
constructor(config: NodeSDKConfig, privateKey: string);
|
|
14
|
-
}
|
package/dist/liquiditatorTool.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const writeAccessHandler_1 = __importDefault(require("./writeAccessHandler"));
|
|
7
|
-
/**
|
|
8
|
-
* LiquidatorTool
|
|
9
|
-
* Methods to liquidate traders
|
|
10
|
-
*/
|
|
11
|
-
class LiquidatorTool extends writeAccessHandler_1.default {
|
|
12
|
-
/**
|
|
13
|
-
* Constructor
|
|
14
|
-
* @param config configuration
|
|
15
|
-
* @param privateKey private key of account that trades
|
|
16
|
-
*/
|
|
17
|
-
constructor(config, privateKey) {
|
|
18
|
-
super(config, privateKey);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.default = LiquidatorTool;
|