@ercworldio/blockchain-shared 1.0.1-dev.10 → 1.0.1-dev.12

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.
@@ -62,6 +62,7 @@
62
62
  "type": "native",
63
63
  "decimals": 18,
64
64
  "address": "0x0000000000000000000000000000000000000000",
65
+ "isStableCoin": false,
65
66
  "sweepThreshold": 0.004,
66
67
  "sweepWalletMinBalance": 0.0002
67
68
  },
@@ -72,8 +73,9 @@
72
73
  "type": "erc20",
73
74
  "decimals": 6,
74
75
  "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
75
- "sweepThreshold": 5,
76
- "sweepWalletMinBalance": 1
76
+ "isStableCoin": true,
77
+ "sweepThreshold": 1,
78
+ "sweepWalletMinBalance": 0
77
79
  },
78
80
  {
79
81
  "name": "Circle Token",
@@ -83,8 +85,8 @@
83
85
  "isStableCoin": true,
84
86
  "decimals": 6,
85
87
  "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
86
- "sweepThreshold": 4,
87
- "sweepWalletMinBalance": 1
88
+ "sweepThreshold": 1,
89
+ "sweepWalletMinBalance": 0.1
88
90
  }
89
91
  ]
90
92
  },
@@ -149,6 +151,7 @@
149
151
  "symbol": "BNB",
150
152
  "token_standard": "BEP-20",
151
153
  "type": "native",
154
+ "isStableCoin": false,
152
155
  "decimals": 18,
153
156
  "address": "0x0000000000000000000000000000000000000000",
154
157
  "sweepThreshold": 0.008,
@@ -160,9 +163,10 @@
160
163
  "token_standard": "BEP-20",
161
164
  "type": "erc20",
162
165
  "decimals": 18,
166
+ "isStableCoin": true,
163
167
  "address": "0x55d398326f99059fF775485246999027B3197955",
164
- "sweepThreshold": 5,
165
- "sweepWalletMinBalance": 1
168
+ "sweepThreshold": 1,
169
+ "sweepWalletMinBalance": 0.1
166
170
  }
167
171
  ]
168
172
  },
@@ -242,7 +246,7 @@
242
246
  "decimals": 6,
243
247
  "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
244
248
  "sweepThreshold": 1,
245
- "sweepWalletMinBalance": 1
249
+ "sweepWalletMinBalance": 0.1
246
250
  }
247
251
  ]
248
252
  },
@@ -307,6 +311,7 @@
307
311
  "symbol": "POL",
308
312
  "token_standard": "POL",
309
313
  "type": "native",
314
+ "isStableCoin": false,
310
315
  "decimals": 18,
311
316
  "address": "0x0000000000000000000000000000000000000000",
312
317
  "sweepThreshold": 10,
@@ -317,10 +322,11 @@
317
322
  "symbol": "USDT",
318
323
  "token_standard": "POL",
319
324
  "type": "erc20",
325
+ "isStableCoin": true,
320
326
  "decimals": 6,
321
327
  "address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
322
- "sweepThreshold": 0,
323
- "sweepWalletMinBalance": 1
328
+ "sweepThreshold": 1,
329
+ "sweepWalletMinBalance": 0.1
324
330
  }
325
331
  ]
326
332
  },
@@ -386,6 +392,7 @@
386
392
  "token_standard": "ERC-20",
387
393
  "type": "native",
388
394
  "decimals": 18,
395
+ "isStableCoin": false,
389
396
  "address": "0x0000000000000000000000000000000000000000",
390
397
  "sweepThreshold": 10,
391
398
  "sweepWalletMinBalance": 0.1
@@ -453,6 +460,7 @@
453
460
  "symbol": "AVAX",
454
461
  "token_standard": "AVAXC",
455
462
  "type": "native",
463
+ "isStableCoin": false,
456
464
  "decimals": 18,
457
465
  "address": "0x0000000000000000000000000000000000000000",
458
466
  "sweepThreshold": 0.05,
@@ -463,10 +471,11 @@
463
471
  "symbol": "USDT",
464
472
  "token_standard": "AVAXC",
465
473
  "type": "erc20",
474
+ "isStableCoin": true,
466
475
  "decimals": 6,
467
476
  "address": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
468
- "sweepThreshold": 5,
469
- "sweepWalletMinBalance": 1
477
+ "sweepThreshold": 1,
478
+ "sweepWalletMinBalance": 0.1
470
479
  }
471
480
  ]
472
481
  },
@@ -522,6 +531,7 @@
522
531
  "symbol": "TRX",
523
532
  "token_standard": "TRX",
524
533
  "type": "native",
534
+ "isStableCoin": false,
525
535
  "decimals": 6,
526
536
  "address": "0000000000000000000000000000000000000000",
527
537
  "sweepThreshold": 10,
@@ -532,10 +542,11 @@
532
542
  "symbol": "USDT",
533
543
  "token_standard": "TRC-20",
534
544
  "type": "trc20",
545
+ "isStableCoin": true,
535
546
  "decimals": 6,
536
547
  "address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
537
- "sweepThreshold": 5,
538
- "sweepWalletMinBalance": 1
548
+ "sweepThreshold": 1,
549
+ "sweepWalletMinBalance": 0.1
539
550
  }
540
551
  ]
541
552
  }
@@ -1 +1 @@
1
- {"version":3,"file":"QnWebhookAddressManager.d.ts","sourceRoot":"","sources":["../../../src/services/quicknode-notifications/QnWebhookAddressManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AA8BlE,cAAM,uBAAuB;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA0B;IACjD,OAAO,CAAC,GAAG,CAAqB;IAChC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,KAAK,CAAmD;IAEhE,OAAO,CAAC,EAAE,CAAgB;IAC1B,OAAO;IAMP,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,kBAAkB,GAAG,uBAAuB;IAOzG,OAAO,CAAC,wBAAwB;IAKhC,yFAAyF;IACzF,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,QAAQ;YAMF,IAAI;YAwCJ,aAAa;IAO3B,OAAO,CAAC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O,CAAC,EAAE,CAAgB;IAC1B,OAAO;IAMP,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,kBAAkB,GAAG,uBAAuB;IAOzG,OAAO,CAAC,wBAAwB;IAKhC,yFAAyF;IACzF,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,QAAQ;YAMF,IAAI;YAyCJ,aAAa;IAQ3B,OAAO,CAAC,WAAW;IAIN,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB1E,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAmB1F;;;;OAIG;IACU,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuBvF;;;;OAIG;IACU,yBAAyB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuB5F;;;;OAIG;IACU,qBAAqB,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBzH;;;;OAIG;IACU,0BAA0B,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;YAqBhH,sBAAsB;CAuBvC;AAED,eAAe,uBAAuB,CAAC"}
@@ -80,6 +80,7 @@ class QnWebhookAddressManager {
80
80
  }
81
81
  // Get all addresses to add to webhook
82
82
  const addresses = yield this.fetch_all_db_addresses(blockchain);
83
+ console.log(`Loading ${addresses.length} addresses from db`);
83
84
  const entries = [];
84
85
  for (const notif_config of notif_configs) {
85
86
  const existing = all_webhooks.find(w => {
@@ -87,6 +88,7 @@ class QnWebhookAddressManager {
87
88
  return ((_a = w.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === notif_config.name.toLowerCase() &&
88
89
  ((_b = w.network) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === notif_config.network.toLowerCase();
89
90
  });
91
+ console.log(`Existing webhooks matching update: `, existing);
90
92
  if (!existing) {
91
93
  console.warn(`QnWebhookAddressManager: No webhook found for config=${notif_config.name} network=${notif_config.network}`);
92
94
  continue;
@@ -106,6 +108,7 @@ class QnWebhookAddressManager {
106
108
  return __awaiter(this, void 0, void 0, function* () {
107
109
  var _a;
108
110
  if (this.is_stale(blockchain)) {
111
+ console.log(`Stale: loading...`);
109
112
  yield this.load(blockchain);
110
113
  }
111
114
  return ((_a = this.cache.get(blockchain)) === null || _a === void 0 ? void 0 : _a.entries) || [];
@@ -139,12 +142,14 @@ class QnWebhookAddressManager {
139
142
  }
140
143
  remove_address(blockchain, address) {
141
144
  return __awaiter(this, void 0, void 0, function* () {
145
+ console.log(`Ensuring loaded...`);
142
146
  const entries = yield this.ensure_loaded(blockchain);
143
147
  for (const entry of entries) {
144
148
  if (!entry.address_set.has(address))
145
149
  continue;
146
150
  entry.address_set.delete(address);
147
151
  try {
152
+ console.log(`Updating webhook addresses to :`, Array.from(entry.address_set));
148
153
  yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
149
154
  console.log(`QnWebhookAddressManager: Removed ${address} from ${entry.name} webhook`);
150
155
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/utils/Logger.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAItD,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AASD,cAAM,MAAM;IACR,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAuB;IA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Warn level - sent to ElasticSearch
85
85
  */
86
86
  warn(message, data) {
87
- this.pino.warn(Object.assign({ source: this.source }, data), message);
88
- this.indexToElastic('Warning', message, data);
87
+ const logData = this.normalizeData(data);
88
+ this.pino.warn(Object.assign({ source: this.source }, logData), message);
89
+ this.indexToElastic('Warning', message, logData);
89
90
  }
90
91
  /**
91
92
  * Error level - sent to ElasticSearch
@@ -129,6 +130,16 @@ class Logger {
129
130
  stack: value.stack,
130
131
  };
131
132
  }
133
+ else if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
134
+ // Recurse one level to catch nested Error objects (e.g. { data: { err: Error } })
135
+ const nested = {};
136
+ for (const [nk, nv] of Object.entries(value)) {
137
+ nested[nk] = nv instanceof Error
138
+ ? { name: nv.name, message: nv.message, stack: nv.stack }
139
+ : nv;
140
+ }
141
+ normalized[key] = nested;
142
+ }
132
143
  else {
133
144
  normalized[key] = value;
134
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ercworldio/blockchain-shared",
3
- "version": "1.0.1-dev.10",
3
+ "version": "1.0.1-dev.12",
4
4
  "description": "Shared library for blockchain projects",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",