@typus/typus-perp-sdk 1.1.32-testnet → 1.1.32-type-test
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/src/index.js
CHANGED
|
@@ -35,58 +35,59 @@ var plugin = (0, transactions_1.namedPackagesPlugin)({ url: mvrPlugin });
|
|
|
35
35
|
transactions_1.Transaction.registerGlobalSerializationPlugin("namedPackagesPlugin", plugin);
|
|
36
36
|
exports.PERP_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
37
37
|
? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
|
|
38
|
-
: "
|
|
38
|
+
: "0x29d1dcc803ec1cc1b4c98a8c818c655ecf432ebd2f85757bffc21806d329e240";
|
|
39
39
|
exports.PERP_PUBLISHED_AT = exports.NETWORK == "MAINNET" ? "0x9eda9afa0b42bf908766c42d02a549c271d7d0ae02c8c58c5075858f8f4d3b69" : "@typus/perp";
|
|
40
40
|
exports.PERP_PKG_V1 = exports.NETWORK == "MAINNET"
|
|
41
41
|
? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
|
|
42
42
|
: "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9";
|
|
43
43
|
exports.STAKE_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
44
44
|
? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
|
|
45
|
-
: "
|
|
45
|
+
: "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
|
|
46
46
|
exports.STAKE_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
47
47
|
? "0xdf96424bc1ba70a6e53c07b2b55c597eccb8a21f722a917a5b4c9d8514b2d858"
|
|
48
|
-
: "
|
|
48
|
+
: "0xcfe3d323fec2dde129480328dbcf075bc47bac50f916f33746d74f1c875acd2e";
|
|
49
49
|
exports.STAKE_PKG_V1 = exports.NETWORK == "MAINNET"
|
|
50
50
|
? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
|
|
51
51
|
: "0x220e7ba8923c0c30b57c0baab3bc15d781a39bb294cf7af318c0fc816b5cf7e6";
|
|
52
52
|
// Registry
|
|
53
53
|
exports.LP_POOL = exports.NETWORK == "MAINNET"
|
|
54
54
|
? "0xfee68e535bf24702be28fa38ea2d5946e617e0035027d5ca29dbed99efd82aaa"
|
|
55
|
-
: "
|
|
55
|
+
: "0x351312d71a8834cd978649ef065dc48928eaf07a279566bc93050a89c2b1edae";
|
|
56
56
|
exports.LIQUIDITY_POOL = exports.NETWORK == "MAINNET"
|
|
57
57
|
? "0x9973b7dd68ab8ba18702d913191a4c62c597847d9cd9f0b5bd97f1b938fc9a0a"
|
|
58
|
-
: "
|
|
58
|
+
: "0x185f5713a04a01dbb2ef1ca603177b21c26a8a1f7c3b60b0b94c77c31dd4602d";
|
|
59
59
|
exports.LIQUIDITY_POOL_0 = exports.NETWORK == "MAINNET"
|
|
60
60
|
? "0x98110aae0ffaf294259066380a2d35aba74e42860f1e87ee9c201f471eb3ba03"
|
|
61
|
-
: "
|
|
61
|
+
: "0x310a065075d2d49a09440402fcf8d2238886111c063cddaa4c118b09b1790e5e";
|
|
62
62
|
// MarketRegistry
|
|
63
63
|
exports.MARKET = exports.NETWORK == "MAINNET"
|
|
64
64
|
? "0xc969d946a2b6b917a83b5fb71765793c4a52149e50d2c8cf5c01d7421fc7cd73"
|
|
65
|
-
: "
|
|
65
|
+
: "0x00fdefdaa281113998afe29b3b8906a8f7bfdfc031891da3b9d7ddc08a924919";
|
|
66
66
|
// MARKET_0 = 0x442cc2c27cadaf287a5f4413967b4dacc6532bc9063875efbc7b178e5add3e4e
|
|
67
|
+
// testnet MARKET_0 = 0x7f427b15136ab0f5919e66612ff343f9c34d2733e636c95f6d9563a596a4b6ac
|
|
67
68
|
exports.PERP_VERSION = exports.NETWORK == "MAINNET"
|
|
68
69
|
? "0xa12c282a068328833ec4a9109fc77803ec1f523f8da1bb0f82bac8450335f0c9"
|
|
69
|
-
: "
|
|
70
|
+
: "0xfd3699c86cda99e542e4517dc3ad4d9164806664fcbcc23981ad0d5101b87abd";
|
|
70
71
|
// LpRegistry
|
|
71
72
|
exports.TLP = exports.NETWORK == "MAINNET"
|
|
72
73
|
? "0xc0a8cc0201d202321cd40b3f19fcf4cc88d6b63ceac0de55b08a2ab16f8a721e"
|
|
73
|
-
: "
|
|
74
|
+
: ""; // deprecated in new version TLP
|
|
74
75
|
exports.TLP_TOKEN = exports.NETWORK == "MAINNET"
|
|
75
76
|
? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5::tlp::TLP"
|
|
76
|
-
: "
|
|
77
|
+
: "0xc44ba56ee8f91195facaf7a5a39b5522e0e8268a21b324275757ecc8baaa4e11::itlp_typus::ITLP_TYPUS";
|
|
77
78
|
exports.TLP_TREASURY_CAP = exports.NETWORK == "MAINNET"
|
|
78
79
|
? "0x77c75fb1d78cca25b5e2d69decfe2837abf95c4ef44b809868e6ca20f42b63bc"
|
|
79
|
-
: "
|
|
80
|
+
: "0x118bd86c1885a02c2c8f8bb017b40b4a928d5dad1aa68802158171427f4c19c9";
|
|
80
81
|
// StakePoolRegistry
|
|
81
82
|
exports.STAKE_POOL = exports.NETWORK == "MAINNET"
|
|
82
83
|
? "0x2cdf93717f87a8a7aeb98b27777b3b643f0ae2b277f44e6bcda0fc655a47d3e0"
|
|
83
|
-
: "
|
|
84
|
+
: "0xc48d38a6cd76ac6628ba98f1bdad7ade8d4b5273066aa4408a81e5e00a92363e";
|
|
84
85
|
exports.STAKE_POOL_0 = exports.NETWORK == "MAINNET"
|
|
85
86
|
? "0x5c984987380805fbaaf78f41d8ff1973807b6c85176aa87cf5a58518e0a87418"
|
|
86
|
-
: "
|
|
87
|
+
: "0xce188b7277324a817a91ce1953dd1d71f2dbb4685364caa90eb430c9ac453dc8";
|
|
87
88
|
exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET"
|
|
88
89
|
? "0xdf3ed1599218b2415b2cd7fa06296f7f647676019b2873ec18e55a626c584f1b"
|
|
89
|
-
: "
|
|
90
|
+
: "0x138583562f9f8fc6261e8fd752a105eb42c8887f83efaba87b42a757f3d98765";
|
|
90
91
|
exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET"
|
|
91
92
|
? "0x36056abf9adde86f81667dad680a8ac98868c9fc1cb4d519fd2222d5d4522906"
|
|
92
|
-
: "
|
|
93
|
+
: "0xbb246d6ee24d7c751777d81cbf95ffcfcda26910fecfdcfedab81b2b8e48dfe5";
|
|
@@ -3,6 +3,7 @@ import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../
|
|
|
3
3
|
import { FieldsWithTypes } from "../../_framework/util";
|
|
4
4
|
import { PKG_V1 } from "../index";
|
|
5
5
|
import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
|
|
6
|
+
import { BcsType, BcsStruct } from "@mysten/sui/bcs";
|
|
6
7
|
export declare function isLpRegistry(type: string): boolean;
|
|
7
8
|
export interface LpRegistryFields {
|
|
8
9
|
id: ToField<UID>;
|
|
@@ -23,10 +24,10 @@ export declare class LpRegistry implements StructClass {
|
|
|
23
24
|
static get r(): import("../../_framework/reified").StructClassReified<LpRegistry, LpRegistryFields>;
|
|
24
25
|
static phantom(): PhantomReified<ToTypeStr<LpRegistry>>;
|
|
25
26
|
static get p(): PhantomReified<"0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5::tlp::LpRegistry" | "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9::tlp::LpRegistry">;
|
|
26
|
-
static get bcs():
|
|
27
|
-
id:
|
|
28
|
-
id:
|
|
29
|
-
bytes:
|
|
27
|
+
static get bcs(): BcsStruct<{
|
|
28
|
+
id: BcsStruct<{
|
|
29
|
+
id: BcsStruct<{
|
|
30
|
+
bytes: BcsType<string, string, string>;
|
|
30
31
|
}, string>;
|
|
31
32
|
}, string>;
|
|
32
33
|
}, string>;
|
|
@@ -67,8 +68,8 @@ export declare class TLP implements StructClass {
|
|
|
67
68
|
static get r(): import("../../_framework/reified").StructClassReified<TLP, TLPFields>;
|
|
68
69
|
static phantom(): PhantomReified<ToTypeStr<TLP>>;
|
|
69
70
|
static get p(): PhantomReified<"0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5::tlp::TLP" | "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9::tlp::TLP">;
|
|
70
|
-
static get bcs():
|
|
71
|
-
dummy_field:
|
|
71
|
+
static get bcs(): BcsStruct<{
|
|
72
|
+
dummy_field: BcsType<boolean, boolean, "bool">;
|
|
72
73
|
}, string>;
|
|
73
74
|
static fromFields(fields: Record<string, any>): TLP;
|
|
74
75
|
static fromFieldsWithTypes(item: FieldsWithTypes): TLP;
|
|
@@ -87,3 +88,34 @@ export declare class TLP implements StructClass {
|
|
|
87
88
|
static fromSuiObjectData(data: SuiObjectData): TLP;
|
|
88
89
|
static fetch(client: SuiClient, id: string): Promise<TLP>;
|
|
89
90
|
}
|
|
91
|
+
export declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
|
|
92
|
+
}
|
|
93
|
+
export type UnsettledBidReceiptType = typeof UnsettledBidReceipt.$inferType;
|
|
94
|
+
export declare const UnsettledBidReceipt: MoveStruct<{
|
|
95
|
+
/** A vector of `TypusBidReceipt` structs. */
|
|
96
|
+
receipt: BcsType<boolean[], Iterable<boolean> & {
|
|
97
|
+
length: number;
|
|
98
|
+
}, string>;
|
|
99
|
+
/** The ID of the position. */
|
|
100
|
+
position_id: BcsType<string, string | number | bigint, "u64">;
|
|
101
|
+
/** The address of the user. */
|
|
102
|
+
user: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
103
|
+
/** A vector of the token types. */
|
|
104
|
+
token_types: BcsType<boolean[], Iterable<boolean> & {
|
|
105
|
+
length: number;
|
|
106
|
+
}, string>;
|
|
107
|
+
/** The sign of the unrealized PNL. */
|
|
108
|
+
unrealized_pnl_sign: BcsType<boolean, boolean, "bool">;
|
|
109
|
+
/** The unrealized PNL. */
|
|
110
|
+
unrealized_pnl: BcsType<string, string | number | bigint, "u64">;
|
|
111
|
+
/** The unrealized trading fee. */
|
|
112
|
+
unrealized_trading_fee: BcsType<string, string | number | bigint, "u64">;
|
|
113
|
+
/** The unrealized borrow fee. */
|
|
114
|
+
unrealized_borrow_fee: BcsType<string, string | number | bigint, "u64">;
|
|
115
|
+
/** The sign of the unrealized funding fee. */
|
|
116
|
+
unrealized_funding_fee_sign: BcsType<boolean, boolean, "bool">;
|
|
117
|
+
/** The unrealized funding fee. */
|
|
118
|
+
unrealized_funding_fee: BcsType<string, string | number | bigint, "u64">;
|
|
119
|
+
/** The unrealized liquidator fee. */
|
|
120
|
+
unrealized_liquidator_fee: BcsType<string, string | number | bigint, "u64">;
|
|
121
|
+
}, "@typus/perp::escrow::UnsettledBidReceipt">;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
var __assign = (this && this.__assign) || function () {
|
|
3
18
|
__assign = Object.assign || function(t) {
|
|
4
19
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -72,15 +87,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
72
87
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
88
|
};
|
|
74
89
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
exports.TLP = exports.LpRegistry = void 0;
|
|
90
|
+
exports.UnsettledBidReceipt = exports.MoveStruct = exports.TLP = exports.LpRegistry = void 0;
|
|
76
91
|
exports.isLpRegistry = isLpRegistry;
|
|
77
92
|
exports.isTLP = isTLP;
|
|
78
93
|
var structs_1 = require("../../_dependencies/source/0x2/object/structs");
|
|
79
94
|
var reified_1 = require("../../_framework/reified");
|
|
80
95
|
var util_1 = require("../../_framework/util");
|
|
81
96
|
var index_1 = require("../index");
|
|
82
|
-
var bcs_1 = require("@mysten/sui/bcs");
|
|
83
97
|
var utils_1 = require("@mysten/sui/utils");
|
|
98
|
+
var bcs_1 = require("@mysten/sui/bcs");
|
|
84
99
|
/* ============================== LpRegistry =============================== */
|
|
85
100
|
function isLpRegistry(type) {
|
|
86
101
|
type = (0, util_1.compressSuiType)(type);
|
|
@@ -363,3 +378,39 @@ var TLP = /** @class */ (function () {
|
|
|
363
378
|
return TLP;
|
|
364
379
|
}());
|
|
365
380
|
exports.TLP = TLP;
|
|
381
|
+
var $moduleName = "@typus/perp::escrow";
|
|
382
|
+
var MoveStruct = /** @class */ (function (_super) {
|
|
383
|
+
__extends(MoveStruct, _super);
|
|
384
|
+
function MoveStruct() {
|
|
385
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
386
|
+
}
|
|
387
|
+
return MoveStruct;
|
|
388
|
+
}(bcs_1.BcsStruct));
|
|
389
|
+
exports.MoveStruct = MoveStruct;
|
|
390
|
+
exports.UnsettledBidReceipt = new MoveStruct({
|
|
391
|
+
name: "".concat($moduleName, "::UnsettledBidReceipt"),
|
|
392
|
+
fields: {
|
|
393
|
+
/** A vector of `TypusBidReceipt` structs. */
|
|
394
|
+
receipt: bcs_1.bcs.vector(bcs_1.bcs.Bool),
|
|
395
|
+
/** The ID of the position. */
|
|
396
|
+
position_id: bcs_1.bcs.u64(),
|
|
397
|
+
/** The address of the user. */
|
|
398
|
+
user: bcs_1.bcs.Address,
|
|
399
|
+
/** A vector of the token types. */
|
|
400
|
+
token_types: bcs_1.bcs.vector(bcs_1.bcs.Bool),
|
|
401
|
+
/** The sign of the unrealized PNL. */
|
|
402
|
+
unrealized_pnl_sign: bcs_1.bcs.bool(),
|
|
403
|
+
/** The unrealized PNL. */
|
|
404
|
+
unrealized_pnl: bcs_1.bcs.u64(),
|
|
405
|
+
/** The unrealized trading fee. */
|
|
406
|
+
unrealized_trading_fee: bcs_1.bcs.u64(),
|
|
407
|
+
/** The unrealized borrow fee. */
|
|
408
|
+
unrealized_borrow_fee: bcs_1.bcs.u64(),
|
|
409
|
+
/** The sign of the unrealized funding fee. */
|
|
410
|
+
unrealized_funding_fee_sign: bcs_1.bcs.bool(),
|
|
411
|
+
/** The unrealized funding fee. */
|
|
412
|
+
unrealized_funding_fee: bcs_1.bcs.u64(),
|
|
413
|
+
/** The unrealized liquidator fee. */
|
|
414
|
+
unrealized_liquidator_fee: bcs_1.bcs.u64(),
|
|
415
|
+
},
|
|
416
|
+
});
|
package/dist/src/user/history.js
CHANGED
|
@@ -91,267 +91,265 @@ function parseUserHistory(raw_events) {
|
|
|
91
91
|
}
|
|
92
92
|
var json = event.contents.json;
|
|
93
93
|
var timestamp = event.timestamp;
|
|
94
|
-
var tx_digest = event.
|
|
94
|
+
var tx_digest = event.transactionBlock.digest;
|
|
95
95
|
// console.log(type);
|
|
96
96
|
// console.log(tx_digest);
|
|
97
97
|
// console.log(json);
|
|
98
98
|
// console.log(timestamp);
|
|
99
99
|
var _g = __read(type.split("::"), 3), pkg = _g[0], mod = _g[1], name = _g[2];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
action = "Order Filled (Increase Position)";
|
|
176
|
-
}
|
|
177
|
-
if (realized_pnl > 0) {
|
|
178
|
-
collateral = (realized_amount - realized_trading_fee) / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token));
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
action = "Order Filled (Open Position)";
|
|
183
|
-
related = events.findLast(function (e) { return e.order_id === json.order_id && e.market === market; });
|
|
184
|
-
collateral = related === null || related === void 0 ? void 0 : related.collateral;
|
|
185
|
-
}
|
|
186
|
-
var e = {
|
|
187
|
-
action: action,
|
|
188
|
-
typeName: name,
|
|
189
|
-
order_id: json.order_id,
|
|
190
|
-
position_id: (_c = json.linked_position_id) !== null && _c !== void 0 ? _c : json.new_position_id,
|
|
191
|
-
market: market,
|
|
192
|
-
side: json.position_side ? "Long" : "Short",
|
|
193
|
-
order_type: related === null || related === void 0 ? void 0 : related.order_type,
|
|
194
|
-
status: "Filled",
|
|
195
|
-
size: size,
|
|
196
|
-
base_token: base_token,
|
|
197
|
-
collateral: collateral, // TODO: check for option collateral
|
|
198
|
-
collateral_token: collateral_token,
|
|
199
|
-
price: Number(price) / Math.pow(10, 8), // WARNING: fixed decimal
|
|
200
|
-
realized_pnl: realized_pnl,
|
|
201
|
-
timestamp: timestamp,
|
|
202
|
-
tx_digest: tx_digest,
|
|
203
|
-
dov_index: related === null || related === void 0 ? void 0 : related.dov_index,
|
|
204
|
-
sender: "user",
|
|
205
|
-
};
|
|
206
|
-
events.push(e);
|
|
207
|
-
break;
|
|
208
|
-
case structs_1.RemovePositionEvent.$typeName.split("::")[2]:
|
|
209
|
-
// same tx with order filled
|
|
210
|
-
var index = events.findLastIndex(function (e) { return e.tx_digest == tx_digest && e.action == "Order Filled (Close Position)"; });
|
|
211
|
-
// console.log(index);
|
|
212
|
-
if (index !== -1) {
|
|
213
|
-
// true => user paid to pool
|
|
214
|
-
var remaining_collateral_amount = json.remaining_collateral_amount / Math.pow(10, (0, constants_1.assetToDecimal)(events[index].collateral_token));
|
|
215
|
-
events[index] = __assign(__assign({}, events[index]), { collateral: remaining_collateral_amount + ((_d = events[index].collateral) !== null && _d !== void 0 ? _d : 0) });
|
|
216
|
-
}
|
|
217
|
-
break;
|
|
218
|
-
case structs_1.RealizeFundingEvent.$typeName.split("::")[2]:
|
|
219
|
-
var base_token = (0, constants_1.typeArgToAsset)(json.symbol.base_token.name);
|
|
220
|
-
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
221
|
-
var market = "".concat(base_token, "/USD");
|
|
222
|
-
var related = events.find(function (e) { return e.position_id === json.position_id && e.market === market; });
|
|
223
|
-
// if realized_funding_sign is true, user pays to pool
|
|
224
|
-
var realized_funding_fee = json.realized_funding_sign
|
|
225
|
-
? -json.realized_funding_fee / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token))
|
|
226
|
-
: json.realized_funding_fee / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token));
|
|
227
|
-
var realized_funding_fee_usd = json.realized_funding_sign
|
|
228
|
-
? -json.realized_funding_fee_usd / Math.pow(10, 9)
|
|
229
|
-
: json.realized_funding_fee_usd / Math.pow(10, 9);
|
|
230
|
-
// same tx with order filled
|
|
231
|
-
var index = events.findLastIndex(function (e) { return e.tx_digest == tx_digest && e.action == "Order Filled (Close Position)"; });
|
|
232
|
-
// console.log(index);
|
|
233
|
-
if (index !== -1) {
|
|
234
|
-
// true => user paid to pool
|
|
235
|
-
events[index] = __assign(__assign({}, events[index]), { collateral: (_e = events[index].collateral) !== null && _e !== void 0 ? _e : 0 - realized_funding_fee, realized_pnl: (_f = events[index].realized_pnl) !== null && _f !== void 0 ? _f : 0 - realized_funding_fee_usd });
|
|
236
|
-
}
|
|
237
|
-
var e = {
|
|
238
|
-
action: "Realize Funding",
|
|
239
|
-
typeName: name,
|
|
240
|
-
order_id: undefined,
|
|
241
|
-
position_id: json.position_id,
|
|
242
|
-
market: market,
|
|
243
|
-
side: related === null || related === void 0 ? void 0 : related.side,
|
|
244
|
-
order_type: related === null || related === void 0 ? void 0 : related.order_type,
|
|
245
|
-
status: "Filled",
|
|
246
|
-
size: related === null || related === void 0 ? void 0 : related.size,
|
|
247
|
-
base_token: base_token,
|
|
248
|
-
collateral: realized_funding_fee,
|
|
249
|
-
collateral_token: collateral_token,
|
|
250
|
-
price: undefined,
|
|
251
|
-
realized_pnl: realized_funding_fee_usd,
|
|
252
|
-
timestamp: timestamp,
|
|
253
|
-
tx_digest: tx_digest,
|
|
254
|
-
dov_index: related === null || related === void 0 ? void 0 : related.dov_index,
|
|
255
|
-
sender: "user",
|
|
256
|
-
};
|
|
257
|
-
events.push(e);
|
|
258
|
-
break;
|
|
259
|
-
case structs_2.CancelTradingOrderEvent.$typeName.split("::")[2]:
|
|
260
|
-
var base_token = (0, constants_1.typeArgToAsset)(json.base_token.name);
|
|
261
|
-
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
262
|
-
var market = "".concat(base_token, "/USD");
|
|
263
|
-
var related = events.findLast(function (e) { return e.order_id === json.order_id && e.market === market; });
|
|
264
|
-
var e = {
|
|
265
|
-
action: "Cancel Order",
|
|
266
|
-
typeName: name,
|
|
267
|
-
order_id: json.order_id,
|
|
268
|
-
position_id: related === null || related === void 0 ? void 0 : related.position_id,
|
|
269
|
-
market: market,
|
|
270
|
-
side: related === null || related === void 0 ? void 0 : related.side,
|
|
271
|
-
order_type: related === null || related === void 0 ? void 0 : related.order_type,
|
|
272
|
-
status: "Canceled",
|
|
273
|
-
size: related === null || related === void 0 ? void 0 : related.size,
|
|
274
|
-
base_token: base_token,
|
|
275
|
-
collateral: Number(json.released_collateral_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token)), // WARNING: fixed decimal
|
|
276
|
-
collateral_token: collateral_token,
|
|
277
|
-
price: Number(json.trigger_price) / Math.pow(10, 8), // WARNING: fixed decimal
|
|
278
|
-
realized_pnl: undefined,
|
|
279
|
-
timestamp: timestamp,
|
|
280
|
-
tx_digest: tx_digest,
|
|
281
|
-
dov_index: related === null || related === void 0 ? void 0 : related.dov_index,
|
|
282
|
-
sender: "user",
|
|
283
|
-
};
|
|
284
|
-
events.push(e);
|
|
285
|
-
break;
|
|
286
|
-
case structs_2.IncreaseCollateralEvent.$typeName.split("::")[2]:
|
|
287
|
-
case structs_2.ReleaseCollateralEvent.$typeName.split("::")[2]:
|
|
288
|
-
var base_token = (0, constants_1.typeArgToAsset)(json.base_token.name);
|
|
289
|
-
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
290
|
-
var market = "".concat(base_token, "/USD");
|
|
291
|
-
var related = events.find(function (e) { return e.position_id === json.position_id && e.market === market; });
|
|
292
|
-
var collateral;
|
|
293
|
-
if (json.increased_collateral_amount) {
|
|
294
|
-
collateral = Number(json.increased_collateral_amount) * -1;
|
|
100
|
+
switch (name) {
|
|
101
|
+
case structs_2.CreateTradingOrderEvent.$typeName.split("::")[2]:
|
|
102
|
+
case structs_2.CreateTradingOrderWithBidReceiptsEvent.$typeName.split("::")[2]:
|
|
103
|
+
var base_token = (0, constants_1.typeArgToAsset)(json.base_token.name);
|
|
104
|
+
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
105
|
+
var market = "".concat(base_token, "/USD");
|
|
106
|
+
var size = Number(json.size) / Math.pow(10, (0, constants_1.assetToDecimal)(base_token));
|
|
107
|
+
var collateral;
|
|
108
|
+
if (json.collateral_amount) {
|
|
109
|
+
collateral = Number(json.collateral_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
collateral = Number(json.collateral_in_deposit_token) / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token));
|
|
113
|
+
}
|
|
114
|
+
var order_type = "Limit";
|
|
115
|
+
var price = json.trigger_price;
|
|
116
|
+
if (json.filled) {
|
|
117
|
+
order_type = "Market";
|
|
118
|
+
price = json.filled_price;
|
|
119
|
+
}
|
|
120
|
+
else if (json.reduce_only && !json.is_stop_order) {
|
|
121
|
+
order_type = "Take Profit";
|
|
122
|
+
}
|
|
123
|
+
else if (json.reduce_only && json.is_stop_order) {
|
|
124
|
+
order_type = "Stop Loss";
|
|
125
|
+
}
|
|
126
|
+
var e = {
|
|
127
|
+
action: "Place Order",
|
|
128
|
+
typeName: name,
|
|
129
|
+
order_id: json.order_id,
|
|
130
|
+
position_id: json.linked_position_id,
|
|
131
|
+
market: market,
|
|
132
|
+
side: json.is_long ? "Long" : "Short",
|
|
133
|
+
order_type: order_type,
|
|
134
|
+
status: json.filled ? "Filled" : "Open",
|
|
135
|
+
size: size,
|
|
136
|
+
base_token: base_token,
|
|
137
|
+
collateral: collateral,
|
|
138
|
+
collateral_token: collateral_token,
|
|
139
|
+
price: Number(price) / Math.pow(10, 8), // WARNING: fixed decimal
|
|
140
|
+
realized_pnl: undefined,
|
|
141
|
+
timestamp: timestamp,
|
|
142
|
+
tx_digest: tx_digest,
|
|
143
|
+
dov_index: json.dov_index,
|
|
144
|
+
reduce_only: json.reduce_only,
|
|
145
|
+
is_stop_order: json.is_stop_order,
|
|
146
|
+
sender: "user",
|
|
147
|
+
};
|
|
148
|
+
events.push(e);
|
|
149
|
+
break;
|
|
150
|
+
case structs_1.OrderFilledEvent.$typeName.split("::")[2]:
|
|
151
|
+
var base_token = (0, constants_1.typeArgToAsset)(json.symbol.base_token.name);
|
|
152
|
+
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
153
|
+
var market = "".concat(base_token, "/USD");
|
|
154
|
+
var size = Number(json.filled_size) / Math.pow(10, (0, constants_1.assetToDecimal)(base_token));
|
|
155
|
+
var price = json.filled_price;
|
|
156
|
+
var action;
|
|
157
|
+
var related;
|
|
158
|
+
var collateral;
|
|
159
|
+
var realized_trading_fee = Number(json.realized_trading_fee) + Number(json.realized_borrow_fee);
|
|
160
|
+
var realized_fee_in_usd = Number(json.realized_fee_in_usd) / Math.pow(10, 9);
|
|
161
|
+
var realized_amount = json.realized_amount_sign ? Number(json.realized_amount) : -Number(json.realized_amount);
|
|
162
|
+
// console.log(realized_amount);
|
|
163
|
+
var realized_pnl = realized_trading_fee > 0 ? ((realized_amount - realized_trading_fee) * realized_fee_in_usd) / realized_trading_fee : 0;
|
|
164
|
+
if (json.linked_position_id != undefined) {
|
|
165
|
+
action = "Order Filled (Close Position)";
|
|
166
|
+
related = events.findLast(function (e) { return e.position_id === json.linked_position_id && e.market === market; });
|
|
167
|
+
// the "Place Order" is emit after Order Filled if filled immediately
|
|
168
|
+
var relatedRawEvent = raw_events.find(function (e) {
|
|
169
|
+
var type = e.contents.type.repr;
|
|
170
|
+
var _a = __read(type.split("::"), 3), pkg = _a[0], mod = _a[1], name = _a[2];
|
|
171
|
+
return name === (related === null || related === void 0 ? void 0 : related.typeName) && e.transactionBlock.digest === (related === null || related === void 0 ? void 0 : related.tx_digest) && (related === null || related === void 0 ? void 0 : related.order_id) === json.order_id;
|
|
172
|
+
});
|
|
173
|
+
if (((_b = (_a = relatedRawEvent === null || relatedRawEvent === void 0 ? void 0 : relatedRawEvent.contents) === null || _a === void 0 ? void 0 : _a.json) === null || _b === void 0 ? void 0 : _b.reduce_only) === false) {
|
|
174
|
+
action = "Order Filled (Increase Position)";
|
|
295
175
|
}
|
|
296
|
-
|
|
297
|
-
collateral =
|
|
176
|
+
if (realized_pnl > 0) {
|
|
177
|
+
collateral = (realized_amount - realized_trading_fee) / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token));
|
|
298
178
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
action = "Order Filled (Open Position)";
|
|
182
|
+
related = events.findLast(function (e) { return e.order_id === json.order_id && e.market === market; });
|
|
183
|
+
collateral = related === null || related === void 0 ? void 0 : related.collateral;
|
|
184
|
+
}
|
|
185
|
+
var e = {
|
|
186
|
+
action: action,
|
|
187
|
+
typeName: name,
|
|
188
|
+
order_id: json.order_id,
|
|
189
|
+
position_id: (_c = json.linked_position_id) !== null && _c !== void 0 ? _c : json.new_position_id,
|
|
190
|
+
market: market,
|
|
191
|
+
side: json.position_side ? "Long" : "Short",
|
|
192
|
+
order_type: related === null || related === void 0 ? void 0 : related.order_type,
|
|
193
|
+
status: "Filled",
|
|
194
|
+
size: size,
|
|
195
|
+
base_token: base_token,
|
|
196
|
+
collateral: collateral, // TODO: check for option collateral
|
|
197
|
+
collateral_token: collateral_token,
|
|
198
|
+
price: Number(price) / Math.pow(10, 8), // WARNING: fixed decimal
|
|
199
|
+
realized_pnl: realized_pnl,
|
|
200
|
+
timestamp: timestamp,
|
|
201
|
+
tx_digest: tx_digest,
|
|
202
|
+
dov_index: related === null || related === void 0 ? void 0 : related.dov_index,
|
|
203
|
+
sender: "user",
|
|
204
|
+
};
|
|
205
|
+
events.push(e);
|
|
206
|
+
break;
|
|
207
|
+
case structs_1.RemovePositionEvent.$typeName.split("::")[2]:
|
|
208
|
+
// same tx with order filled
|
|
209
|
+
var index = events.findLastIndex(function (e) { return e.tx_digest == tx_digest && e.action == "Order Filled (Close Position)"; });
|
|
210
|
+
// console.log(index);
|
|
211
|
+
if (index !== -1) {
|
|
212
|
+
// true => user paid to pool
|
|
213
|
+
var remaining_collateral_amount = json.remaining_collateral_amount / Math.pow(10, (0, constants_1.assetToDecimal)(events[index].collateral_token));
|
|
214
|
+
events[index] = __assign(__assign({}, events[index]), { collateral: remaining_collateral_amount + ((_d = events[index].collateral) !== null && _d !== void 0 ? _d : 0) });
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case structs_1.RealizeFundingEvent.$typeName.split("::")[2]:
|
|
218
|
+
var base_token = (0, constants_1.typeArgToAsset)(json.symbol.base_token.name);
|
|
219
|
+
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
220
|
+
var market = "".concat(base_token, "/USD");
|
|
221
|
+
var related = events.find(function (e) { return e.position_id === json.position_id && e.market === market; });
|
|
222
|
+
// if realized_funding_sign is true, user pays to pool
|
|
223
|
+
var realized_funding_fee = json.realized_funding_sign
|
|
224
|
+
? -json.realized_funding_fee / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token))
|
|
225
|
+
: json.realized_funding_fee / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token));
|
|
226
|
+
var realized_funding_fee_usd = json.realized_funding_sign
|
|
227
|
+
? -json.realized_funding_fee_usd / Math.pow(10, 9)
|
|
228
|
+
: json.realized_funding_fee_usd / Math.pow(10, 9);
|
|
229
|
+
// same tx with order filled
|
|
230
|
+
var index = events.findLastIndex(function (e) { return e.tx_digest == tx_digest && e.action == "Order Filled (Close Position)"; });
|
|
231
|
+
// console.log(index);
|
|
232
|
+
if (index !== -1) {
|
|
233
|
+
// true => user paid to pool
|
|
234
|
+
events[index] = __assign(__assign({}, events[index]), { collateral: (_e = events[index].collateral) !== null && _e !== void 0 ? _e : 0 - realized_funding_fee, realized_pnl: (_f = events[index].realized_pnl) !== null && _f !== void 0 ? _f : 0 - realized_funding_fee_usd });
|
|
235
|
+
}
|
|
236
|
+
var e = {
|
|
237
|
+
action: "Realize Funding",
|
|
238
|
+
typeName: name,
|
|
239
|
+
order_id: undefined,
|
|
240
|
+
position_id: json.position_id,
|
|
241
|
+
market: market,
|
|
242
|
+
side: related === null || related === void 0 ? void 0 : related.side,
|
|
243
|
+
order_type: related === null || related === void 0 ? void 0 : related.order_type,
|
|
244
|
+
status: "Filled",
|
|
245
|
+
size: related === null || related === void 0 ? void 0 : related.size,
|
|
246
|
+
base_token: base_token,
|
|
247
|
+
collateral: realized_funding_fee,
|
|
248
|
+
collateral_token: collateral_token,
|
|
249
|
+
price: undefined,
|
|
250
|
+
realized_pnl: realized_funding_fee_usd,
|
|
251
|
+
timestamp: timestamp,
|
|
252
|
+
tx_digest: tx_digest,
|
|
253
|
+
dov_index: related === null || related === void 0 ? void 0 : related.dov_index,
|
|
254
|
+
sender: "user",
|
|
255
|
+
};
|
|
256
|
+
events.push(e);
|
|
257
|
+
break;
|
|
258
|
+
case structs_2.CancelTradingOrderEvent.$typeName.split("::")[2]:
|
|
259
|
+
var base_token = (0, constants_1.typeArgToAsset)(json.base_token.name);
|
|
260
|
+
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
261
|
+
var market = "".concat(base_token, "/USD");
|
|
262
|
+
var related = events.findLast(function (e) { return e.order_id === json.order_id && e.market === market; });
|
|
263
|
+
var e = {
|
|
264
|
+
action: "Cancel Order",
|
|
265
|
+
typeName: name,
|
|
266
|
+
order_id: json.order_id,
|
|
267
|
+
position_id: related === null || related === void 0 ? void 0 : related.position_id,
|
|
268
|
+
market: market,
|
|
269
|
+
side: related === null || related === void 0 ? void 0 : related.side,
|
|
270
|
+
order_type: related === null || related === void 0 ? void 0 : related.order_type,
|
|
271
|
+
status: "Canceled",
|
|
272
|
+
size: related === null || related === void 0 ? void 0 : related.size,
|
|
273
|
+
base_token: base_token,
|
|
274
|
+
collateral: Number(json.released_collateral_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token)), // WARNING: fixed decimal
|
|
275
|
+
collateral_token: collateral_token,
|
|
276
|
+
price: Number(json.trigger_price) / Math.pow(10, 8), // WARNING: fixed decimal
|
|
277
|
+
realized_pnl: undefined,
|
|
278
|
+
timestamp: timestamp,
|
|
279
|
+
tx_digest: tx_digest,
|
|
280
|
+
dov_index: related === null || related === void 0 ? void 0 : related.dov_index,
|
|
281
|
+
sender: "user",
|
|
282
|
+
};
|
|
283
|
+
events.push(e);
|
|
284
|
+
break;
|
|
285
|
+
case structs_2.IncreaseCollateralEvent.$typeName.split("::")[2]:
|
|
286
|
+
case structs_2.ReleaseCollateralEvent.$typeName.split("::")[2]:
|
|
287
|
+
var base_token = (0, constants_1.typeArgToAsset)(json.base_token.name);
|
|
288
|
+
var collateral_token = (0, constants_1.typeArgToAsset)(json.collateral_token.name);
|
|
289
|
+
var market = "".concat(base_token, "/USD");
|
|
290
|
+
var related = events.find(function (e) { return e.position_id === json.position_id && e.market === market; });
|
|
291
|
+
var collateral;
|
|
292
|
+
if (json.increased_collateral_amount) {
|
|
293
|
+
collateral = Number(json.increased_collateral_amount) * -1;
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
collateral = Number(json.released_collateral_amount);
|
|
297
|
+
}
|
|
298
|
+
var e = {
|
|
299
|
+
action: "Modify Collateral",
|
|
300
|
+
typeName: name,
|
|
301
|
+
order_id: undefined,
|
|
302
|
+
position_id: json.position_id,
|
|
303
|
+
market: market,
|
|
304
|
+
side: !related
|
|
305
|
+
? undefined
|
|
306
|
+
: related.action === "Order Filled (Open Position)"
|
|
307
|
+
? related.side
|
|
308
|
+
: related.side === "Long"
|
|
309
|
+
? "Short"
|
|
310
|
+
: "Long",
|
|
311
|
+
order_type: related === null || related === void 0 ? void 0 : related.order_type,
|
|
312
|
+
status: "Filled",
|
|
313
|
+
size: related === null || related === void 0 ? void 0 : related.size,
|
|
314
|
+
base_token: base_token,
|
|
315
|
+
collateral: collateral / Math.pow(10, (0, constants_1.assetToDecimal)(collateral_token)), // WARNING: fixed decimal
|
|
316
|
+
collateral_token: collateral_token,
|
|
317
|
+
price: related === null || related === void 0 ? void 0 : related.price,
|
|
318
|
+
realized_pnl: undefined,
|
|
319
|
+
timestamp: timestamp,
|
|
320
|
+
tx_digest: tx_digest,
|
|
321
|
+
dov_index: related === null || related === void 0 ? void 0 : related.dov_index,
|
|
322
|
+
sender: "user",
|
|
323
|
+
};
|
|
324
|
+
events.push(e);
|
|
325
|
+
break;
|
|
326
|
+
case structs_3.SwapEvent.$typeName.split("::")[2]:
|
|
327
|
+
var from_token = (0, constants_1.typeArgToAsset)(json.from_token_type.name);
|
|
328
|
+
var to_token = (0, constants_1.typeArgToAsset)(json.to_token_type.name);
|
|
329
|
+
var from_price = Number(json.oracle_price_from_token);
|
|
330
|
+
var to_price = Number(json.oracle_price_to_token);
|
|
331
|
+
var e = {
|
|
332
|
+
action: "Swap",
|
|
333
|
+
typeName: name,
|
|
334
|
+
order_id: undefined,
|
|
335
|
+
position_id: undefined,
|
|
336
|
+
market: "".concat(from_token, "/").concat(to_token),
|
|
337
|
+
side: undefined,
|
|
338
|
+
order_type: "Market",
|
|
339
|
+
status: "Filled",
|
|
340
|
+
size: Number(json.actual_to_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(to_token)),
|
|
341
|
+
base_token: to_token,
|
|
342
|
+
collateral: Number(json.from_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(from_token)),
|
|
343
|
+
collateral_token: from_token,
|
|
344
|
+
price: from_price / to_price,
|
|
345
|
+
realized_pnl: -Number(json.fee_amount_usd) / Math.pow(10, 9),
|
|
346
|
+
timestamp: timestamp,
|
|
347
|
+
tx_digest: tx_digest,
|
|
348
|
+
dov_index: undefined,
|
|
349
|
+
sender: "user",
|
|
350
|
+
};
|
|
351
|
+
events.push(e);
|
|
352
|
+
break;
|
|
355
353
|
}
|
|
356
354
|
});
|
|
357
355
|
// console.log(events);
|
|
@@ -375,7 +373,7 @@ function getGraphQLEvents(module_1, sender_1) {
|
|
|
375
373
|
senderFilter = "sender: \"".concat(sender, "\"");
|
|
376
374
|
}
|
|
377
375
|
graphql = JSON.stringify({
|
|
378
|
-
query: "\n {\n events(\n last: 50,\n ".concat(before, "\n filter: {\n
|
|
376
|
+
query: "\n {\n events(\n last: 50,\n ".concat(before, "\n filter: {\n eventType: \"").concat(module, "\",\n ").concat(senderFilter, "\n }\n ) {\n pageInfo {\n hasPreviousPage\n hasNextPage\n startCursor\n endCursor\n }\n edges { cursor }\n nodes {\n transactionBlock { digest }\n sendingModule {\n name\n package { digest }\n }\n sender { address }\n timestamp\n contents {\n type { repr }\n json\n }\n }\n }}\n "),
|
|
379
377
|
});
|
|
380
378
|
return [4 /*yield*/, fetch("https://graphql.".concat(src_1.NETWORK.toLowerCase(), ".sui.io/graphql"), {
|
|
381
379
|
method: "POST",
|
|
@@ -90,7 +90,6 @@ function createTradingOrderWithBidReceiptByAutoBid(config, tx, pythClient, input
|
|
|
90
90
|
signalIndex: input.signalIndex,
|
|
91
91
|
strategyIndex: input.strategyIndex,
|
|
92
92
|
user: input.user,
|
|
93
|
-
share: input.share,
|
|
94
93
|
});
|
|
95
94
|
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
96
95
|
bToken = constants_1.tokenType[__1.NETWORK][input.bToken];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typus/typus-perp-sdk",
|
|
3
|
-
"version": "1.1.32-
|
|
3
|
+
"version": "1.1.32-type-test",
|
|
4
4
|
"repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
|
|
5
5
|
"author": "Typus",
|
|
6
6
|
"description": "typus perp sdk",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@typus/typus-sdk": "1.8.
|
|
9
|
+
"@typus/typus-sdk": "1.8.24"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/bs58": "^4.0.1",
|