@dhedge/backend-flatcoin-core 0.2.31 → 0.2.32
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/entity/order-execution.d.ts +7 -0
- package/dist/entity/order-execution.js +40 -0
- package/dist/repository/order-execution.repository.d.ts +9 -0
- package/dist/repository/order-execution.repository.js +39 -0
- package/dist/service/graph-query.service.d.ts +11 -1
- package/dist/service/graph-query.service.js +119 -3
- package/dist/utils/shared-types.d.ts +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OrderExecution = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const utils_1 = require("../utils");
|
|
15
|
+
let OrderExecution = class OrderExecution {
|
|
16
|
+
};
|
|
17
|
+
exports.OrderExecution = OrderExecution;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ name: 'id' }),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], OrderExecution.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.Column)({ name: 'tx_hash' }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], OrderExecution.prototype, "txHash", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.Column)({ name: 'executor_address' }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], OrderExecution.prototype, "executorAddress", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)({ name: 'type', nullable: false }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], OrderExecution.prototype, "type", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ name: 'executed_at', type: 'numeric', precision: 25, transformer: utils_1.numericTransformer }),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], OrderExecution.prototype, "executedAt", void 0);
|
|
38
|
+
exports.OrderExecution = OrderExecution = __decorate([
|
|
39
|
+
(0, typeorm_1.Entity)({ name: 'order-executions' })
|
|
40
|
+
], OrderExecution);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { OrderExecution } from '../entity/order-execution';
|
|
3
|
+
export declare class OrderExecutionRepository {
|
|
4
|
+
private repository;
|
|
5
|
+
constructor(repository: Repository<OrderExecution>);
|
|
6
|
+
save(orderExecution: OrderExecution): Promise<OrderExecution>;
|
|
7
|
+
saveAll(orderExecutions: OrderExecution[]): Promise<OrderExecution[]>;
|
|
8
|
+
getLatestRecord(): Promise<OrderExecution | null>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.OrderExecutionRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const typeorm_2 = require("typeorm");
|
|
19
|
+
const order_execution_1 = require("../entity/order-execution");
|
|
20
|
+
let OrderExecutionRepository = class OrderExecutionRepository {
|
|
21
|
+
constructor(repository) {
|
|
22
|
+
this.repository = repository;
|
|
23
|
+
}
|
|
24
|
+
async save(orderExecution) {
|
|
25
|
+
return this.repository.save(orderExecution);
|
|
26
|
+
}
|
|
27
|
+
async saveAll(orderExecutions) {
|
|
28
|
+
return this.repository.save(orderExecutions);
|
|
29
|
+
}
|
|
30
|
+
async getLatestRecord() {
|
|
31
|
+
return this.repository.createQueryBuilder().orderBy('executedAt', 'DESC').limit(1).getOne();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.OrderExecutionRepository = OrderExecutionRepository;
|
|
35
|
+
exports.OrderExecutionRepository = OrderExecutionRepository = __decorate([
|
|
36
|
+
(0, common_1.Injectable)(),
|
|
37
|
+
__param(0, (0, typeorm_1.InjectRepository)(order_execution_1.OrderExecution)),
|
|
38
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
39
|
+
], OrderExecutionRepository);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger } from '@nestjs/common';
|
|
2
|
-
import { AnnouncedLimitOrder, AnnouncedOrder, DepositEvent, LeveragePositionEvent, Position, WithdrawEvent } from '../utils';
|
|
2
|
+
import { AnnouncedLimitOrder, AnnouncedOrder, DepositEvent, LeverageAdjust, LeveragePositionEvent, Position, WithdrawEvent } from '../utils';
|
|
3
3
|
import { GraphQLClient } from 'graphql-request';
|
|
4
4
|
export declare class GraphQueryService {
|
|
5
5
|
private readonly graphQLClient;
|
|
@@ -7,25 +7,35 @@ export declare class GraphQueryService {
|
|
|
7
7
|
constructor(graphQLClient: GraphQLClient, logger: Logger);
|
|
8
8
|
getAnnouncedOrders(timestampFrom: number): Promise<AnnouncedOrder[]>;
|
|
9
9
|
getLeverageOpens(blockFrom: number): Promise<LeveragePositionEvent[]>;
|
|
10
|
+
getLeverageOpensByTimestampFrom(timestampFrom: number): Promise<LeveragePositionEvent[]>;
|
|
10
11
|
getLeverageCloses(blockFrom: number): Promise<LeveragePositionEvent[]>;
|
|
12
|
+
getLeverageClosesByTimestampFrom(timestampFrom: number): Promise<LeveragePositionEvent[]>;
|
|
13
|
+
getLeverageAdjustsByTimestampFrom(timestampFrom: number): Promise<LeverageAdjust[]>;
|
|
11
14
|
getPositionLiquidateds(blockFrom: number): Promise<LeveragePositionEvent[]>;
|
|
12
15
|
getDeposits(blockFrom: number): Promise<DepositEvent[]>;
|
|
16
|
+
getDepositsByTimestampFrom(timestampFrom: number): Promise<DepositEvent[]>;
|
|
13
17
|
getDepositsByDepositorAddress(account: string, blockFrom: number): Promise<DepositEvent[]>;
|
|
14
18
|
getWithdraws(blockFrom: number): Promise<WithdrawEvent[]>;
|
|
15
19
|
getWithdrawsByWithdrawerAddress(account: string, blockFrom: number): Promise<WithdrawEvent[]>;
|
|
16
20
|
getLimitOrderAnnounceds(blockNumberFrom: number): Promise<AnnouncedLimitOrder[]>;
|
|
21
|
+
getLimitOrderExecutedsByTimestampFrom(timestampFrom: number): Promise<LeverageAdjust[]>;
|
|
17
22
|
getAllOpenPositions(): Promise<Position[]>;
|
|
18
23
|
getOpenPositions(skip: number, first: number): Promise<Position[]>;
|
|
19
24
|
getClosedPositions(closeTimestampVar: number): Promise<Position[]>;
|
|
20
25
|
}
|
|
21
26
|
export declare const getAnnouncedOrdersQuery: string;
|
|
22
27
|
export declare const getLeverageOpensQuery: string;
|
|
28
|
+
export declare const getLeverageOpensByTimestampFromQuery: string;
|
|
23
29
|
export declare const getLeverageClosesQuery: string;
|
|
30
|
+
export declare const getLeverageClosesByTimestampFromQuery: string;
|
|
31
|
+
export declare const getLeverageAdjustsByTimestampFromQuery: string;
|
|
24
32
|
export declare const getPositionLiquidatedsQuery: string;
|
|
25
33
|
export declare const getDepositsQuery: string;
|
|
34
|
+
export declare const getDepositsByTimestampFromQuery: string;
|
|
26
35
|
export declare const getDepositsByDepositorAddressQuery: string;
|
|
27
36
|
export declare const getWithdrawsQuery: string;
|
|
28
37
|
export declare const getWithdrawsByWithdrawerAddressQuery: string;
|
|
29
38
|
export declare const getLimitOrderAnnouncedsQuery: string;
|
|
39
|
+
export declare const getLimitOrderExecutedsByTimestampFromQuery: string;
|
|
30
40
|
export declare const getOpenPositionsQuery: string;
|
|
31
41
|
export declare const getClosedPositionsQuery: string;
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getClosedPositionsQuery = exports.getOpenPositionsQuery = exports.getLimitOrderAnnouncedsQuery = exports.getWithdrawsByWithdrawerAddressQuery = exports.getWithdrawsQuery = exports.getDepositsByDepositorAddressQuery = exports.getDepositsQuery = exports.getPositionLiquidatedsQuery = exports.getLeverageClosesQuery = exports.getLeverageOpensQuery = exports.getAnnouncedOrdersQuery = exports.GraphQueryService = void 0;
|
|
12
|
+
exports.getClosedPositionsQuery = exports.getOpenPositionsQuery = exports.getLimitOrderExecutedsByTimestampFromQuery = exports.getLimitOrderAnnouncedsQuery = exports.getWithdrawsByWithdrawerAddressQuery = exports.getWithdrawsQuery = exports.getDepositsByDepositorAddressQuery = exports.getDepositsByTimestampFromQuery = exports.getDepositsQuery = exports.getPositionLiquidatedsQuery = exports.getLeverageAdjustsByTimestampFromQuery = exports.getLeverageClosesByTimestampFromQuery = exports.getLeverageClosesQuery = exports.getLeverageOpensByTimestampFromQuery = exports.getLeverageOpensQuery = exports.getAnnouncedOrdersQuery = exports.GraphQueryService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const graphql_request_1 = require("graphql-request");
|
|
15
15
|
const constants_1 = require("../constants");
|
|
@@ -22,11 +22,11 @@ let GraphQueryService = class GraphQueryService {
|
|
|
22
22
|
const variables = { timestamp: timestampFrom.toString() };
|
|
23
23
|
try {
|
|
24
24
|
const response = await this.graphQLClient.request(exports.getAnnouncedOrdersQuery, variables);
|
|
25
|
-
this.logger.log(`Fetched ${response.orderAnnounceds.length} orderAnnounceds events from the graph`);
|
|
25
|
+
this.logger.log(`Fetched ${response.orderAnnounceds.length} orderAnnounceds events from the graph from timestamp: ${timestampFrom}`);
|
|
26
26
|
return response.orderAnnounceds;
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
|
-
this.logger.error('Error fetching announced orders from the graph:', error);
|
|
29
|
+
this.logger.error('Error fetching announced orders from the graph by timestamp from:', error);
|
|
30
30
|
throw error;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -43,6 +43,19 @@ let GraphQueryService = class GraphQueryService {
|
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
async getLeverageOpensByTimestampFrom(timestampFrom) {
|
|
47
|
+
const variables = { blockTimestamp: timestampFrom };
|
|
48
|
+
try {
|
|
49
|
+
const response = await this.graphQLClient.request(exports.getLeverageOpensByTimestampFromQuery, variables);
|
|
50
|
+
this.logger.log(`Fetched ${response.leverageOpens.length} leverageOpens events from the graph from timestamp: ${timestampFrom}`);
|
|
51
|
+
response.leverageOpens.forEach((events) => (events.eventType = constants_1.LeveragePositionStatus.OPEN));
|
|
52
|
+
return response.leverageOpens;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
this.logger.error('Error fetching leverageOpens events from the graph by timestamp from:', error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
46
59
|
async getLeverageCloses(blockFrom) {
|
|
47
60
|
const variables = { fromBlock: blockFrom };
|
|
48
61
|
try {
|
|
@@ -56,6 +69,31 @@ let GraphQueryService = class GraphQueryService {
|
|
|
56
69
|
throw error;
|
|
57
70
|
}
|
|
58
71
|
}
|
|
72
|
+
async getLeverageClosesByTimestampFrom(timestampFrom) {
|
|
73
|
+
const variables = { blockTimestamp: timestampFrom };
|
|
74
|
+
try {
|
|
75
|
+
const response = await this.graphQLClient.request(exports.getLeverageClosesByTimestampFromQuery, variables);
|
|
76
|
+
this.logger.log(`Fetched ${response.leverageCloses.length} leverageCloses events from the graph from timestamp: ${timestampFrom}`);
|
|
77
|
+
response.leverageCloses.forEach((events) => (events.eventType = constants_1.LeveragePositionStatus.CLOSED));
|
|
78
|
+
return response.leverageCloses;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
this.logger.error('Error fetching leverageCloses events from the graph by timestamp from:', error);
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async getLeverageAdjustsByTimestampFrom(timestampFrom) {
|
|
86
|
+
const variables = { blockTimestamp: timestampFrom };
|
|
87
|
+
try {
|
|
88
|
+
const response = await this.graphQLClient.request(exports.getLeverageAdjustsByTimestampFromQuery, variables);
|
|
89
|
+
this.logger.log(`Fetched ${response.leverageAdjusts.length} leverageAdjusts events from the graph from timestamp: ${timestampFrom}`);
|
|
90
|
+
return response.leverageAdjusts;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
this.logger.error('Error fetching leverageAdjusts events from the graph by timestamp from:', error);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
59
97
|
async getPositionLiquidateds(blockFrom) {
|
|
60
98
|
const variables = { fromBlock: blockFrom };
|
|
61
99
|
try {
|
|
@@ -81,6 +119,18 @@ let GraphQueryService = class GraphQueryService {
|
|
|
81
119
|
throw error;
|
|
82
120
|
}
|
|
83
121
|
}
|
|
122
|
+
async getDepositsByTimestampFrom(timestampFrom) {
|
|
123
|
+
const variables = { blockTimestamp: timestampFrom };
|
|
124
|
+
try {
|
|
125
|
+
const response = await this.graphQLClient.request(exports.getDepositsByTimestampFromQuery, variables);
|
|
126
|
+
this.logger.log(`Fetched ${response.deposits.length} deposits events from the graph from timestamp: ${timestampFrom}`);
|
|
127
|
+
return response.deposits;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
this.logger.error('Error fetching deposits events from the graph by timestamp from:', error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
84
134
|
async getDepositsByDepositorAddress(account, blockFrom) {
|
|
85
135
|
const variables = { account: account, fromBlock: blockFrom };
|
|
86
136
|
try {
|
|
@@ -129,6 +179,18 @@ let GraphQueryService = class GraphQueryService {
|
|
|
129
179
|
throw error;
|
|
130
180
|
}
|
|
131
181
|
}
|
|
182
|
+
async getLimitOrderExecutedsByTimestampFrom(timestampFrom) {
|
|
183
|
+
const variables = { blockTimestamp: timestampFrom };
|
|
184
|
+
try {
|
|
185
|
+
const response = await this.graphQLClient.request(exports.getLimitOrderExecutedsByTimestampFromQuery, variables);
|
|
186
|
+
this.logger.log(`Fetched ${response.limitOrderExecuteds.length} limitOrderExecuteds events from the graph from timestamp: ${timestampFrom}`);
|
|
187
|
+
return response.limitOrderExecuteds;
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
this.logger.error('Error fetching limitOrderExecuteds events from the graph by timestamp from:', error);
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
132
194
|
async getAllOpenPositions() {
|
|
133
195
|
const allPositions = [];
|
|
134
196
|
const first = 999;
|
|
@@ -195,6 +257,18 @@ exports.getLeverageOpensQuery = (0, graphql_request_1.gql) `
|
|
|
195
257
|
}
|
|
196
258
|
}
|
|
197
259
|
`;
|
|
260
|
+
exports.getLeverageOpensByTimestampFromQuery = (0, graphql_request_1.gql) `
|
|
261
|
+
query GetLeverageOpens($timestampFrom: Int) {
|
|
262
|
+
leverageOpens(where: { blockTimestamp_gt: $timestampFrom }) {
|
|
263
|
+
blockNumber
|
|
264
|
+
blockTimestamp
|
|
265
|
+
tokenId
|
|
266
|
+
account
|
|
267
|
+
transactionHash
|
|
268
|
+
executedBy
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
`;
|
|
198
272
|
exports.getLeverageClosesQuery = (0, graphql_request_1.gql) `
|
|
199
273
|
query GetLeverageCloses($fromBlock: Int) {
|
|
200
274
|
leverageCloses(where: { blockNumber_gt: $fromBlock }) {
|
|
@@ -204,6 +278,26 @@ exports.getLeverageClosesQuery = (0, graphql_request_1.gql) `
|
|
|
204
278
|
}
|
|
205
279
|
}
|
|
206
280
|
`;
|
|
281
|
+
exports.getLeverageClosesByTimestampFromQuery = (0, graphql_request_1.gql) `
|
|
282
|
+
query GetLeverageCloses($timestampFrom: Int) {
|
|
283
|
+
leverageCloses(where: { blockTimestamp_gt: $timestampFrom }) {
|
|
284
|
+
blockNumber
|
|
285
|
+
blockTimestamp
|
|
286
|
+
tokenId
|
|
287
|
+
transactionHash
|
|
288
|
+
executedBy
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
`;
|
|
292
|
+
exports.getLeverageAdjustsByTimestampFromQuery = (0, graphql_request_1.gql) `
|
|
293
|
+
query GetLeverageAdhusts($timestampFrom: Int) {
|
|
294
|
+
leverageAdjusts(where: { blockTimestamp_gt: $timestampFrom }) {
|
|
295
|
+
blockTimestamp
|
|
296
|
+
transactionHash
|
|
297
|
+
executedBy
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
`;
|
|
207
301
|
exports.getPositionLiquidatedsQuery = (0, graphql_request_1.gql) `
|
|
208
302
|
query GetPositionLiquidateds($fromBlock: Int) {
|
|
209
303
|
positionLiquidateds(where: { blockNumber_gt: $fromBlock }) {
|
|
@@ -225,6 +319,19 @@ exports.getDepositsQuery = (0, graphql_request_1.gql) `
|
|
|
225
319
|
}
|
|
226
320
|
}
|
|
227
321
|
`;
|
|
322
|
+
exports.getDepositsByTimestampFromQuery = (0, graphql_request_1.gql) `
|
|
323
|
+
query GetDeposits($timestampFrom: Int) {
|
|
324
|
+
deposits(where: { blockTimestamp_gt: $timestampFrom }) {
|
|
325
|
+
depositor
|
|
326
|
+
depositAmount
|
|
327
|
+
mintedAmount
|
|
328
|
+
blockNumber
|
|
329
|
+
blockTimestamp
|
|
330
|
+
transactionHash
|
|
331
|
+
executedBy
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
`;
|
|
228
335
|
exports.getDepositsByDepositorAddressQuery = (0, graphql_request_1.gql) `
|
|
229
336
|
query GetDeposits($account: String, $fromBlock: Int) {
|
|
230
337
|
deposits(
|
|
@@ -279,6 +386,15 @@ exports.getLimitOrderAnnouncedsQuery = (0, graphql_request_1.gql) `
|
|
|
279
386
|
}
|
|
280
387
|
}
|
|
281
388
|
`;
|
|
389
|
+
exports.getLimitOrderExecutedsByTimestampFromQuery = (0, graphql_request_1.gql) `
|
|
390
|
+
query GetLimitOrderExecuteds($timestampFrom: Int) {
|
|
391
|
+
limitOrderExecuteds(where: { blockTimestamp_gt: $timestampFrom }) {
|
|
392
|
+
blockTimestamp
|
|
393
|
+
transactionHash
|
|
394
|
+
executedBy
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
`;
|
|
282
398
|
exports.getOpenPositionsQuery = (0, graphql_request_1.gql) `
|
|
283
399
|
query GetOpenPositions($skip: Int, $first: Int) {
|
|
284
400
|
positions(where: { status: 0 }, skip: $skip, first: $first) {
|
|
@@ -4,12 +4,18 @@ export interface DepositEvent {
|
|
|
4
4
|
depositor: string;
|
|
5
5
|
depositAmount: string;
|
|
6
6
|
mintedAmount: string;
|
|
7
|
+
blockTimestamp: number;
|
|
8
|
+
executeInTime: number;
|
|
9
|
+
expirationTime: number;
|
|
7
10
|
}
|
|
8
11
|
export interface WithdrawEvent {
|
|
9
12
|
blockNumber: string;
|
|
10
13
|
withdrawer: string;
|
|
11
14
|
withdrawAmount: string;
|
|
12
15
|
burnedAmount: string;
|
|
16
|
+
blockTimestamp: number;
|
|
17
|
+
executeInTime: number;
|
|
18
|
+
expirationTime: number;
|
|
13
19
|
}
|
|
14
20
|
export declare class DepositWithdrawAction {
|
|
15
21
|
isDeposit: boolean;
|
|
@@ -33,6 +39,13 @@ export interface LeveragePositionEvent {
|
|
|
33
39
|
liquidator: string;
|
|
34
40
|
closePrice: string;
|
|
35
41
|
eventType: string;
|
|
42
|
+
transactionHash: string;
|
|
43
|
+
executedBy: string;
|
|
44
|
+
}
|
|
45
|
+
export interface LeverageAdjust {
|
|
46
|
+
blockTimestamp: number;
|
|
47
|
+
transactionHash: string;
|
|
48
|
+
executedBy: string;
|
|
36
49
|
}
|
|
37
50
|
export interface AnnouncedLimitOrder {
|
|
38
51
|
id: string;
|
|
@@ -44,6 +57,11 @@ export interface AnnouncedLimitOrder {
|
|
|
44
57
|
priceUpperThreshold: number;
|
|
45
58
|
transactionHash: string;
|
|
46
59
|
}
|
|
60
|
+
export interface LimitOrderExecuted {
|
|
61
|
+
blockTimestamp: number;
|
|
62
|
+
transactionHash: string;
|
|
63
|
+
executedBy: string;
|
|
64
|
+
}
|
|
47
65
|
export interface Position {
|
|
48
66
|
tokenId: number;
|
|
49
67
|
account: string;
|
|
@@ -66,12 +84,18 @@ export interface LeverageOpensData {
|
|
|
66
84
|
export interface PositionLiquidatedsData {
|
|
67
85
|
positionLiquidateds: LeveragePositionEvent[];
|
|
68
86
|
}
|
|
87
|
+
export interface LeverageAdjustsData {
|
|
88
|
+
leverageAdjusts: LeverageAdjust[];
|
|
89
|
+
}
|
|
69
90
|
export interface AnnouncedOrderData {
|
|
70
91
|
orderAnnounceds: AnnouncedOrder[];
|
|
71
92
|
}
|
|
72
93
|
export interface AnnouncedLimitOrderData {
|
|
73
94
|
limitOrderAnnounceds: AnnouncedLimitOrder[];
|
|
74
95
|
}
|
|
96
|
+
export interface LimitOrderExecutedsData {
|
|
97
|
+
limitOrderExecuteds: LimitOrderExecuted[];
|
|
98
|
+
}
|
|
75
99
|
export interface PositionData {
|
|
76
100
|
positions: Position[];
|
|
77
101
|
}
|