@ercworldio/blockchain-shared 1.0.1-dev.10 → 1.0.1-dev.11
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.
|
@@ -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;
|
|
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,OA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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
|
}
|