@dhedge/backend-flatcoin-core 0.3.2 → 0.3.4

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.
@@ -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('price')
39
+ .createQueryBuilder()
40
40
  .where('blockchain_code = :blockchainCode')
41
41
  .setParameter('blockchainCode', blockchainCode)
42
- .orderBy('price.timestamp', 'DESC')
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')
@@ -567,6 +567,8 @@ exports.getClosedPositionsQuery = (0, graphql_request_1.gql) `
567
567
  status
568
568
  closeTimestamp
569
569
  accruedFunding
570
+ marginDepositedReth
571
+ marginWithdrawnReth
570
572
  }
571
573
  }
572
574
  `;
@@ -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 ${process.env.SLACK_CHANNEL}`, error);
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 ${process.env.SLACK_EMERGENCY_CHANNEL}`, error);
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 ${process.env.SLACK_MONITORING_CHANNEL}`, error);
65
+ this.logger.error(`Error sending notification '${message}' to slack channel ${slackUri}`, error);
66
66
  }
67
67
  }
68
68
  }
@@ -96,6 +96,8 @@ export interface Position {
96
96
  closeTimestamp: number;
97
97
  closeBlock: number;
98
98
  accruedFunding: number;
99
+ marginDepositedReth: number;
100
+ marginWithdrawnReth: number;
99
101
  }
100
102
  export interface UnitHolder {
101
103
  address: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/backend-flatcoin-core",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Backend Flatcoin Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",