@ercworldio/blockchain-shared 1.0.0-dev.24 → 1.0.0-dev.26

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.
@@ -3,11 +3,13 @@ import { IConfig } from "../../interfaces/config";
3
3
  import BaseErrors from "../../errors/errors";
4
4
  import { RateLimiterOptions } from "../../utils/AsyncRateLimiter";
5
5
  declare class QnNotificationsApi extends BaseErrors {
6
+ private static instance;
6
7
  private api_key;
7
8
  private base_url;
8
9
  private rate_limiter;
9
10
  private rlc;
10
- constructor(config: IConfig, rlc?: RateLimiterOptions);
11
+ private constructor();
12
+ static getInstance(config: IConfig, rlc?: RateLimiterOptions): QnNotificationsApi;
11
13
  create_webhook(template: string, name: string, network: string, webhook_url: string, initial_addresses: string[]): Promise<QnNotificationCreateResponse>;
12
14
  get_all_webhooks(): Promise<QnNotificationListResponse>;
13
15
  update_webhook_addresses(webhook_id: string, template: string, all_addresses: string[]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"QnNotificationsApi.d.ts","sourceRoot":"","sources":["../../../src/services/quicknode-notifications/QnNotificationsApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAyB,EAAE,kBAAkB,EAAa,MAAM,8BAA8B,CAAC;AAE/F,cAAM,kBAAmB,SAAQ,UAAU;IACvC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAgD;IAChE,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,GAAG,CAA6D;gBAE5D,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,kBAAkB;IAWxC,cAAc,CACvB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE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IAIvD,wBAAwB,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC;IAQH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIhD,IAAI;CAsCrB;AAED,eAAe,kBAAkB,CAAC"}
@@ -60,6 +60,12 @@ class QnNotificationsApi extends errors_1.default {
60
60
  }
61
61
  this.rate_limiter = new AsyncRateLimiter_1.default(this.rlc);
62
62
  }
63
+ static getInstance(config, rlc) {
64
+ if (!this.instance) {
65
+ this.instance = new QnNotificationsApi(config, rlc);
66
+ }
67
+ return this.instance;
68
+ }
63
69
  create_webhook(template, name, network, webhook_url, initial_addresses) {
64
70
  return __awaiter(this, void 0, void 0, function* () {
65
71
  const template_arg_key = template === 'solanaWalletFilter' ? 'accounts' : 'wallets';
@@ -19,7 +19,7 @@ class QnWebhookAddressManager {
19
19
  constructor(config, rlc) {
20
20
  this.cache = new Map();
21
21
  this.config = config;
22
- this.api = new QnNotificationsApi_1.default(config, rlc);
22
+ this.api = QnNotificationsApi_1.default.getInstance(config, rlc);
23
23
  }
24
24
  static getInstance(config, rlc) {
25
25
  if (!this.instance) {
@@ -119,7 +119,7 @@ class QnWebhookAddressManager {
119
119
  continue;
120
120
  entry.address_set.add(address);
121
121
  try {
122
- this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
122
+ yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
123
123
  console.log(`QnWebhookAddressManager: Added ${address} to ${entry.name} webhook`);
124
124
  }
125
125
  catch (error) {
@@ -30,7 +30,7 @@ class SetupNotifications extends errors_1.default {
30
30
  this.pending_configs = new Map();
31
31
  this.config = config;
32
32
  this.db = db;
33
- this.api = new QnNotificationsApi_1.default(config, rlc);
33
+ this.api = QnNotificationsApi_1.default.getInstance(config, rlc);
34
34
  }
35
35
  static getInstance(config, db, rlc) {
36
36
  if (!this.instance) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ercworldio/blockchain-shared",
3
- "version": "1.0.0-dev.24",
3
+ "version": "1.0.0-dev.26",
4
4
  "description": "Shared library for blockchain projects",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",