@dhedge/backend-flatcoin-core 0.3.1 → 0.3.3
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/apy-history.d.ts +1 -1
- package/dist/entity/apy-history.js +3 -2
- package/dist/entity/borrowing-rate-apy-history.d.ts +1 -1
- package/dist/entity/borrowing-rate-apy-history.js +3 -2
- package/dist/repository/price.repository.d.ts +1 -0
- package/dist/repository/price.repository.js +13 -2
- package/dist/service/notification.service.js +3 -3
- package/package.json +1 -1
|
@@ -14,9 +14,10 @@ const typeorm_1 = require("typeorm");
|
|
|
14
14
|
const graphql_1 = require("@nestjs/graphql");
|
|
15
15
|
const utils_1 = require("../utils");
|
|
16
16
|
let ApyHistory = class ApyHistory {
|
|
17
|
-
constructor(daily, timestamp) {
|
|
17
|
+
constructor(daily, timestamp, blockchainCode) {
|
|
18
18
|
this.daily = daily;
|
|
19
19
|
this.timestamp = timestamp;
|
|
20
|
+
this.blockchainCode = blockchainCode;
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
exports.ApyHistory = ApyHistory;
|
|
@@ -42,5 +43,5 @@ __decorate([
|
|
|
42
43
|
exports.ApyHistory = ApyHistory = __decorate([
|
|
43
44
|
(0, graphql_1.ObjectType)(),
|
|
44
45
|
(0, typeorm_1.Entity)({ name: 'apy_history' }),
|
|
45
|
-
__metadata("design:paramtypes", [Number, Number])
|
|
46
|
+
__metadata("design:paramtypes", [Number, Number, String])
|
|
46
47
|
], ApyHistory);
|
|
@@ -14,10 +14,11 @@ const typeorm_1 = require("typeorm");
|
|
|
14
14
|
const graphql_1 = require("@nestjs/graphql");
|
|
15
15
|
const utils_1 = require("../utils");
|
|
16
16
|
let BorrowingRateApyHistory = class BorrowingRateApyHistory {
|
|
17
|
-
constructor(daily, eightHour, timestamp) {
|
|
17
|
+
constructor(daily, eightHour, timestamp, blockchainCode) {
|
|
18
18
|
this.daily = daily;
|
|
19
19
|
this.eightHour = eightHour;
|
|
20
20
|
this.timestamp = timestamp;
|
|
21
|
+
this.blockchainCode = blockchainCode;
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
exports.BorrowingRateApyHistory = BorrowingRateApyHistory;
|
|
@@ -55,5 +56,5 @@ __decorate([
|
|
|
55
56
|
exports.BorrowingRateApyHistory = BorrowingRateApyHistory = __decorate([
|
|
56
57
|
(0, graphql_1.ObjectType)(),
|
|
57
58
|
(0, typeorm_1.Entity)({ name: 'borrowing_rate_apy_history' }),
|
|
58
|
-
__metadata("design:paramtypes", [Number, Number, Number])
|
|
59
|
+
__metadata("design:paramtypes", [Number, Number, Number, String])
|
|
59
60
|
], BorrowingRateApyHistory);
|
|
@@ -10,6 +10,7 @@ export declare class PriceRepository {
|
|
|
10
10
|
findAllByPeriod(period: string, blockchainCode: string): Promise<FlatcoinPriceParent[]>;
|
|
11
11
|
findLast(blockchainCode: string): Promise<FlatcoinPrice | null>;
|
|
12
12
|
findFirstByTimestamp(fromTimestamp: number, blockchainCode: string): Promise<FlatcoinPrice | null>;
|
|
13
|
+
findFirstByBlock(fromBlock: number, blockchainCode: string): Promise<FlatcoinPrice | null>;
|
|
13
14
|
findFirst(blockchainCode: string): Promise<FlatcoinPrice | null>;
|
|
14
15
|
private getRepository;
|
|
15
16
|
}
|
|
@@ -36,10 +36,10 @@ let PriceRepository = class PriceRepository {
|
|
|
36
36
|
}
|
|
37
37
|
async findLast(blockchainCode) {
|
|
38
38
|
return this.repository
|
|
39
|
-
.createQueryBuilder(
|
|
39
|
+
.createQueryBuilder()
|
|
40
40
|
.where('blockchain_code = :blockchainCode')
|
|
41
41
|
.setParameter('blockchainCode', blockchainCode)
|
|
42
|
-
.orderBy('
|
|
42
|
+
.orderBy('timestamp', 'DESC')
|
|
43
43
|
.take(1)
|
|
44
44
|
.getOne();
|
|
45
45
|
}
|
|
@@ -54,6 +54,17 @@ let PriceRepository = class PriceRepository {
|
|
|
54
54
|
.take(1)
|
|
55
55
|
.getOne();
|
|
56
56
|
}
|
|
57
|
+
async findFirstByBlock(fromBlock, blockchainCode) {
|
|
58
|
+
return await this.repository
|
|
59
|
+
.createQueryBuilder()
|
|
60
|
+
.where('block_number > :fromBlock')
|
|
61
|
+
.andWhere('blockchain_code = :blockchainCode')
|
|
62
|
+
.setParameter('blockchainCode', blockchainCode)
|
|
63
|
+
.setParameter('fromBlock', fromBlock)
|
|
64
|
+
.orderBy('timestamp', 'ASC')
|
|
65
|
+
.take(1)
|
|
66
|
+
.getOne();
|
|
67
|
+
}
|
|
57
68
|
async findFirst(blockchainCode) {
|
|
58
69
|
return await this.repository
|
|
59
70
|
.createQueryBuilder('price')
|
|
@@ -45,7 +45,7 @@ let NotificationService = class NotificationService {
|
|
|
45
45
|
await axios_1.default.post(slackUri, { text: message });
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
48
|
-
this.logger.error(`Error sending notification '${message}' to slack channel ${
|
|
48
|
+
this.logger.error(`Error sending notification '${message}' to slack channel ${slackUri}`, error);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
async sendSlackEmergencyNotification(message, slackUri = this.slackEmergencyUri) {
|
|
@@ -53,7 +53,7 @@ let NotificationService = class NotificationService {
|
|
|
53
53
|
await axios_1.default.post(slackUri, { text: message });
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
|
-
this.logger.error(`Error sending notification '${message}' to slack channel ${
|
|
56
|
+
this.logger.error(`Error sending notification '${message}' to slack channel ${slackUri}`, error);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
async sendSlackMonitoringNotification(message, slackUri = this.slackMonitoringUri) {
|
|
@@ -62,7 +62,7 @@ let NotificationService = class NotificationService {
|
|
|
62
62
|
await axios_1.default.post(slackUri, { text: message });
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
65
|
-
this.logger.error(`Error sending notification '${message}' to slack channel ${
|
|
65
|
+
this.logger.error(`Error sending notification '${message}' to slack channel ${slackUri}`, error);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|