@dhedge/backend-flatcoin-core 0.3.48 → 0.3.50
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.
|
@@ -58,6 +58,7 @@ export declare class GraphQueryService {
|
|
|
58
58
|
getAllIncomingUnitTransfersForAccount(account: string): Promise<UnitTransfer[]>;
|
|
59
59
|
private getOutgoingUnitTransfersPaginated;
|
|
60
60
|
private getIncomingUnitTransfersPaginated;
|
|
61
|
+
getPositionsByTokenId(tokenId: number): Promise<Position[]>;
|
|
61
62
|
}
|
|
62
63
|
export declare function callGraphWithRetries<T>(fn: () => Promise<T>, retries?: number, delayMilliseconds?: number, exponential?: boolean): Promise<T>;
|
|
63
64
|
export declare const getAnnouncedOrdersByTimestampFromQueryPaginated: string;
|
|
@@ -87,3 +88,4 @@ export declare const getOutgoingUnitTransfersByAccountByBlockNumberFromQueryPagi
|
|
|
87
88
|
export declare const getIncomingUnitTransfersByAccountByBlockNumberFromQueryPaginated: string;
|
|
88
89
|
export declare const getOutgoingUnitTransfersQueryPaginated: string;
|
|
89
90
|
export declare const getIncomingUnitTransfersQueryPaginated: string;
|
|
91
|
+
export declare const getPositionByTokenIdQuery: 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.getIncomingUnitTransfersQueryPaginated = exports.getOutgoingUnitTransfersQueryPaginated = exports.getIncomingUnitTransfersByAccountByBlockNumberFromQueryPaginated = exports.getOutgoingUnitTransfersByAccountByBlockNumberFromQueryPaginated = exports.getUnitTransfersByBlockNumberFromQueryPaginated = exports.getUnitHoldersQueryPaginated = exports.getLiquidatedPositionsByCloseBlockFromQueryPaginated = exports.getClosedPositionsByCloseBlockFromQueryPaginated = exports.getClosedPositionsByCloseTimestampFromQueryPaginated = exports.getClosedPositionsQueryPaginated = exports.getOpenPositionsQueryPaginated = exports.getLimitOrderExecutedsByTimestampFromQueryPaginated = exports.getLimitOrderAnnouncedsByBlockFromQueryPaginated = exports.getWithdrawsByWithdrawerAddressByBlockFromQueryPaginated = exports.getWithdrawsByTimestampFromQueryPaginated = exports.getWithdrawsByBlockFromQueryPaginated = exports.getDepositsByDepositorAddressByBlockFromQueryPaginated = exports.getDepositsByTimestampFromQueryPaginated = exports.getDepositsByBlockFromQueryPaginated = exports.getPositionLiquidatedsByBlockFromQueryPaginated = exports.getLeverageAdjustsByBlockFromQueryPaginated = exports.getLeverageAdjustsByTimestampFromQueryPaginated = exports.getLeverageClosesByTimestampFromQueryPaginated = exports.getLeverageClosesByBlockFromQueryPaginated = exports.getLeverageOpensByTimestampFromQueryPaginated = exports.getLeverageOpensByBlockFromQueryPaginated = exports.getAnnouncedOrdersByTimestampFromQueryPaginated = exports.callGraphWithRetries = exports.GraphQueryService = void 0;
|
|
12
|
+
exports.getPositionByTokenIdQuery = exports.getIncomingUnitTransfersQueryPaginated = exports.getOutgoingUnitTransfersQueryPaginated = exports.getIncomingUnitTransfersByAccountByBlockNumberFromQueryPaginated = exports.getOutgoingUnitTransfersByAccountByBlockNumberFromQueryPaginated = exports.getUnitTransfersByBlockNumberFromQueryPaginated = exports.getUnitHoldersQueryPaginated = exports.getLiquidatedPositionsByCloseBlockFromQueryPaginated = exports.getClosedPositionsByCloseBlockFromQueryPaginated = exports.getClosedPositionsByCloseTimestampFromQueryPaginated = exports.getClosedPositionsQueryPaginated = exports.getOpenPositionsQueryPaginated = exports.getLimitOrderExecutedsByTimestampFromQueryPaginated = exports.getLimitOrderAnnouncedsByBlockFromQueryPaginated = exports.getWithdrawsByWithdrawerAddressByBlockFromQueryPaginated = exports.getWithdrawsByTimestampFromQueryPaginated = exports.getWithdrawsByBlockFromQueryPaginated = exports.getDepositsByDepositorAddressByBlockFromQueryPaginated = exports.getDepositsByTimestampFromQueryPaginated = exports.getDepositsByBlockFromQueryPaginated = exports.getPositionLiquidatedsByBlockFromQueryPaginated = exports.getLeverageAdjustsByBlockFromQueryPaginated = exports.getLeverageAdjustsByTimestampFromQueryPaginated = exports.getLeverageClosesByTimestampFromQueryPaginated = exports.getLeverageClosesByBlockFromQueryPaginated = exports.getLeverageOpensByTimestampFromQueryPaginated = exports.getLeverageOpensByBlockFromQueryPaginated = exports.getAnnouncedOrdersByTimestampFromQueryPaginated = exports.callGraphWithRetries = exports.GraphQueryService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const graphql_request_1 = require("graphql-request");
|
|
15
15
|
let GraphQueryService = class GraphQueryService {
|
|
@@ -731,6 +731,18 @@ let GraphQueryService = class GraphQueryService {
|
|
|
731
731
|
throw error;
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
+
async getPositionsByTokenId(tokenId) {
|
|
735
|
+
const variables = { tokenId };
|
|
736
|
+
try {
|
|
737
|
+
const response = await this.graphQLClient.request(exports.getPositionByTokenIdQuery, variables);
|
|
738
|
+
this.logger.log(`Fetched ${response.positions.length} positions by token id from the graph`);
|
|
739
|
+
return response.positions;
|
|
740
|
+
}
|
|
741
|
+
catch (error) {
|
|
742
|
+
this.logger.error('Error fetching positions by token id from the graph:', error);
|
|
743
|
+
throw error;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
734
746
|
};
|
|
735
747
|
exports.GraphQueryService = GraphQueryService;
|
|
736
748
|
exports.GraphQueryService = GraphQueryService = __decorate([
|
|
@@ -1007,9 +1019,9 @@ exports.getClosedPositionsQueryPaginated = (0, graphql_request_1.gql) `
|
|
|
1007
1019
|
}
|
|
1008
1020
|
`;
|
|
1009
1021
|
exports.getClosedPositionsByCloseTimestampFromQueryPaginated = (0, graphql_request_1.gql) `
|
|
1010
|
-
query GetClosedPositions($
|
|
1022
|
+
query GetClosedPositions($closeTimestampFrom: Int, $skip: Int, $first: Int) {
|
|
1011
1023
|
positions(
|
|
1012
|
-
where: { status_in: [1, 2, 3], closeTimestamp_gt: $
|
|
1024
|
+
where: { status_in: [1, 2, 3], closeTimestamp_gt: $closeTimestampFrom }
|
|
1013
1025
|
orderBy: closeTimestamp
|
|
1014
1026
|
orderDirection: desc
|
|
1015
1027
|
skip: $skip
|
|
@@ -1115,3 +1127,14 @@ exports.getIncomingUnitTransfersQueryPaginated = (0, graphql_request_1.gql) `
|
|
|
1115
1127
|
}
|
|
1116
1128
|
}
|
|
1117
1129
|
`;
|
|
1130
|
+
exports.getPositionByTokenIdQuery = (0, graphql_request_1.gql) `
|
|
1131
|
+
query GetPositionsByTokenId($tokenId: String) {
|
|
1132
|
+
positions(where: { tokenId: $tokenId }) {
|
|
1133
|
+
tokenId
|
|
1134
|
+
account
|
|
1135
|
+
liquidationPrice
|
|
1136
|
+
openBlock
|
|
1137
|
+
openTimestamp
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
`;
|