@ercworldio/blockchain-shared 1.0.0-dev.21 → 1.0.0-dev.23
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/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -2
- package/build/services/AlchemyWebhookAddressManager.d.ts +38 -0
- package/build/services/AlchemyWebhookAddressManager.d.ts.map +1 -0
- package/build/services/AlchemyWebhookAddressManager.js +123 -0
- package/build/services/quicknode-notifications/QnNotificationsApi.d.ts +2 -1
- package/build/services/quicknode-notifications/QnNotificationsApi.d.ts.map +1 -1
- package/build/services/quicknode-notifications/QnNotificationsApi.js +5 -2
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts +31 -2
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts.map +1 -1
- package/build/services/quicknode-notifications/QnWebhookAddressManager.js +137 -9
- package/build/services/quicknode-notifications/SetupNotifications.d.ts +2 -1
- package/build/services/quicknode-notifications/SetupNotifications.d.ts.map +1 -1
- package/build/services/quicknode-notifications/SetupNotifications.js +4 -4
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as AsyncTTLCache } from "./utils/AsyncTTLCache";
|
|
|
3
3
|
export { default as AzureEventHubHandler } from './services/AzureEventHubHandler';
|
|
4
4
|
export { default as AccountingService } from './services/AccountingService';
|
|
5
5
|
export { default as AlchemyService } from './services/AlchemyService';
|
|
6
|
+
export { default as AlchemyWebhookAddressManager } from './services/AlchemyWebhookAddressManager';
|
|
6
7
|
export { default as AlchemyWebhooks } from './services/AlchemyWebhooks';
|
|
7
8
|
export { default as AlchemyWebhookSignature } from './services/AlchemyWebhookSignature';
|
|
8
9
|
export { default as BalanceService } from './services/BalanceService';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA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AAyB,CAAC;AAIxC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAG/I,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGtD,cAAc,cAAc,CAAC;AAG7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -40,8 +40,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
41
|
};
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.
|
|
44
|
-
exports.AppErrors = exports.EscrowIdl = exports.CoverageInfo = exports.EscrowEvents = exports.Erc20Events = exports.AccessControlEvents = exports.ERC20Abi = exports.ErrorAbi = exports.EscrowAbi = exports.ERC20MockAbi = exports.BaseErrors = exports.VoltageErrors = exports.AlchemyErrors = exports.WalletErrors = void 0;
|
|
43
|
+
exports.BalanceErrors = exports.AdminErrors = exports.TransactionsErrors = exports.EscrowInteraction = exports.QnWebhookAddressManager = exports.SetupNotifications = exports.QnNotificationsApi = exports.QuicknodeWebhookSignature = exports.Worker = exports.WithdrawalManager = exports.WalletManagerHelper = exports.WalletManager = exports.WalletIndexService = exports.SweepHistoryService = exports.SweepJobService = exports.StorageService = exports.ProviderManager = exports.Provider = exports.TronFundingWallet = exports.TronCustodialWallet = exports.TronHotWallet = exports.TronHelper = exports.TronTransaction = exports.TronSigner = exports.TimerManager = exports.RedisPubSub = exports.RedisListQueue = exports.RedisQueue = exports.Redis = exports.MemoryMonitor = exports.Logger = exports.KeyVaultHandler = exports.InvoiceQueue = exports.EscrowService = exports.EventsService = exports.EventsHandler = exports.ElasticSearch = exports.DepositAddressService = exports.ClaimJobService = exports.ClaimHistoryService = exports.ChainManager = exports.BalanceService = exports.AlchemyWebhookSignature = exports.AlchemyWebhooks = exports.AlchemyWebhookAddressManager = exports.AlchemyService = exports.AccountingService = exports.AzureEventHubHandler = exports.AsyncTTLCache = exports.AsyncRateLimiter = void 0;
|
|
44
|
+
exports.AppErrors = exports.EscrowIdl = exports.CoverageInfo = exports.EscrowEvents = exports.Erc20Events = exports.AccessControlEvents = exports.ERC20Abi = exports.ErrorAbi = exports.EscrowAbi = exports.ERC20MockAbi = exports.BaseErrors = exports.VoltageErrors = exports.AlchemyErrors = exports.WalletErrors = exports.DatabaseErrors = void 0;
|
|
45
45
|
// Services
|
|
46
46
|
var AsyncRateLimiter_1 = require("./utils/AsyncRateLimiter");
|
|
47
47
|
Object.defineProperty(exports, "AsyncRateLimiter", { enumerable: true, get: function () { return __importDefault(AsyncRateLimiter_1).default; } });
|
|
@@ -53,6 +53,8 @@ var AccountingService_1 = require("./services/AccountingService");
|
|
|
53
53
|
Object.defineProperty(exports, "AccountingService", { enumerable: true, get: function () { return __importDefault(AccountingService_1).default; } });
|
|
54
54
|
var AlchemyService_1 = require("./services/AlchemyService");
|
|
55
55
|
Object.defineProperty(exports, "AlchemyService", { enumerable: true, get: function () { return __importDefault(AlchemyService_1).default; } });
|
|
56
|
+
var AlchemyWebhookAddressManager_1 = require("./services/AlchemyWebhookAddressManager");
|
|
57
|
+
Object.defineProperty(exports, "AlchemyWebhookAddressManager", { enumerable: true, get: function () { return __importDefault(AlchemyWebhookAddressManager_1).default; } });
|
|
56
58
|
var AlchemyWebhooks_1 = require("./services/AlchemyWebhooks");
|
|
57
59
|
Object.defineProperty(exports, "AlchemyWebhooks", { enumerable: true, get: function () { return __importDefault(AlchemyWebhooks_1).default; } });
|
|
58
60
|
var AlchemyWebhookSignature_1 = require("./services/AlchemyWebhookSignature");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BlockchainType, ChainId } from "../interfaces";
|
|
2
|
+
import { IConfig } from "../interfaces/config";
|
|
3
|
+
import { AlchemyWebhookEnvironment } from "./types/alchemy";
|
|
4
|
+
declare class AlchemyWebhookAddressManager {
|
|
5
|
+
private static instance;
|
|
6
|
+
private alchemy;
|
|
7
|
+
private config;
|
|
8
|
+
private cache;
|
|
9
|
+
private constructor();
|
|
10
|
+
static getInstance(config: IConfig): AlchemyWebhookAddressManager;
|
|
11
|
+
private is_stale;
|
|
12
|
+
private load;
|
|
13
|
+
private get_webhooks;
|
|
14
|
+
private get_webhooks_for_chain;
|
|
15
|
+
private get_chain_ids_for_blockchain;
|
|
16
|
+
/**
|
|
17
|
+
* Add an address to the webhook(s) for a single chain only.
|
|
18
|
+
* Use this for the immediate await before responding to the caller.
|
|
19
|
+
*/
|
|
20
|
+
add_address_to_chain(env: AlchemyWebhookEnvironment, chain_id: ChainId, address: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Remove an address from the webhook(s) for a single chain only.
|
|
23
|
+
* Use this for the immediate await before responding to the caller.
|
|
24
|
+
*/
|
|
25
|
+
remove_address_from_chain(env: AlchemyWebhookEnvironment, chain_id: ChainId, address: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Add an address to all webhooks for a blockchain except the already-updated chain.
|
|
28
|
+
* Call this fire-and-forget after responding to the caller.
|
|
29
|
+
*/
|
|
30
|
+
sync_add_to_remaining(env: AlchemyWebhookEnvironment, blockchain: BlockchainType, address: string, exclude_chain_id: ChainId): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Remove an address from all webhooks for a blockchain except the already-updated chain.
|
|
33
|
+
* Call this fire-and-forget after responding to the caller.
|
|
34
|
+
*/
|
|
35
|
+
sync_remove_from_remaining(env: AlchemyWebhookEnvironment, blockchain: BlockchainType, address: string, exclude_chain_id: ChainId): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export default AlchemyWebhookAddressManager;
|
|
38
|
+
//# sourceMappingURL=AlchemyWebhookAddressManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlchemyWebhookAddressManager.d.ts","sourceRoot":"","sources":["../../src/services/AlchemyWebhookAddressManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,yBAAyB,EAAe,MAAM,iBAAiB,CAAC;AAUzE,cAAM,4BAA4B;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,KAAK,CAA2D;IAExE,OAAO;IAKP,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,4BAA4B;IAOjE,OAAO,CAAC,QAAQ;YAMF,IAAI;YASJ,YAAY;IAK1B,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,4BAA4B;IAIpC;;;OAGG;IACU,oBAAoB,CAAC,GAAG,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASvH;;;OAGG;IACU,yBAAyB,CAAC,GAAG,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS5H;;;OAGG;IACU,qBAAqB,CAAC,GAAG,EAAE,yBAAyB,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAYzJ;;;OAGG;IACU,0BAA0B,CAAC,GAAG,EAAE,yBAAyB,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAWjK;AAED,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const ChainManager_1 = __importDefault(require("./ChainManager"));
|
|
16
|
+
const AlchemyService_1 = __importDefault(require("./AlchemyService"));
|
|
17
|
+
const alchemy_1 = require("./utils/alchemy");
|
|
18
|
+
const CACHE_TTL_MS = 10 * 60 * 1000; // 10 minutes
|
|
19
|
+
class AlchemyWebhookAddressManager {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.cache = new Map();
|
|
22
|
+
this.config = config;
|
|
23
|
+
this.alchemy = AlchemyService_1.default.getInstance(config);
|
|
24
|
+
}
|
|
25
|
+
static getInstance(config) {
|
|
26
|
+
if (!this.instance) {
|
|
27
|
+
this.instance = new AlchemyWebhookAddressManager(config);
|
|
28
|
+
}
|
|
29
|
+
return this.instance;
|
|
30
|
+
}
|
|
31
|
+
is_stale(env) {
|
|
32
|
+
const cached = this.cache.get(env);
|
|
33
|
+
if (!cached)
|
|
34
|
+
return true;
|
|
35
|
+
return Date.now() - cached.loaded_at > CACHE_TTL_MS;
|
|
36
|
+
}
|
|
37
|
+
load(env) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const webhooks = yield this.alchemy.get_all_webhooks(env);
|
|
41
|
+
this.cache.set(env, { webhooks, loaded_at: Date.now() });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error(`AlchemyWebhookAddressManager: Failed to fetch webhooks for env=${env}`, error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
get_webhooks(env) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
if (this.is_stale(env))
|
|
52
|
+
yield this.load(env);
|
|
53
|
+
return ((_a = this.cache.get(env)) === null || _a === void 0 ? void 0 : _a.webhooks) || [];
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
get_webhooks_for_chain(all, env, chain_id) {
|
|
57
|
+
let network;
|
|
58
|
+
try {
|
|
59
|
+
network = (0, alchemy_1.get_alchemy_chain_name)(chain_id);
|
|
60
|
+
}
|
|
61
|
+
catch (_a) {
|
|
62
|
+
console.warn(`AlchemyWebhookAddressManager: No Alchemy network mapping for chain_id=${chain_id}`);
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
return all.filter(w => w.network === network &&
|
|
66
|
+
w.webhook_type === "ADDRESS_ACTIVITY" &&
|
|
67
|
+
w.webhook_url.includes(env));
|
|
68
|
+
}
|
|
69
|
+
get_chain_ids_for_blockchain(blockchain) {
|
|
70
|
+
return ChainManager_1.default.getInstance(this.config).blockchain_chainid_map.get(blockchain) || [];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Add an address to the webhook(s) for a single chain only.
|
|
74
|
+
* Use this for the immediate await before responding to the caller.
|
|
75
|
+
*/
|
|
76
|
+
add_address_to_chain(env, chain_id, address) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const all = yield this.get_webhooks(env);
|
|
79
|
+
const webhooks = this.get_webhooks_for_chain(all, env, chain_id);
|
|
80
|
+
yield Promise.all(webhooks.map(w => this.alchemy.add_remove_addresses(env, { webhook_id: w.id, addresses_to_add: [address], addresses_to_remove: [] })));
|
|
81
|
+
return true;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Remove an address from the webhook(s) for a single chain only.
|
|
86
|
+
* Use this for the immediate await before responding to the caller.
|
|
87
|
+
*/
|
|
88
|
+
remove_address_from_chain(env, chain_id, address) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const all = yield this.get_webhooks(env);
|
|
91
|
+
const webhooks = this.get_webhooks_for_chain(all, env, chain_id);
|
|
92
|
+
yield Promise.all(webhooks.map(w => this.alchemy.add_remove_addresses(env, { webhook_id: w.id, addresses_to_add: [], addresses_to_remove: [address] })));
|
|
93
|
+
return true;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Add an address to all webhooks for a blockchain except the already-updated chain.
|
|
98
|
+
* Call this fire-and-forget after responding to the caller.
|
|
99
|
+
*/
|
|
100
|
+
sync_add_to_remaining(env, blockchain, address, exclude_chain_id) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const all = yield this.get_webhooks(env);
|
|
103
|
+
const remaining_chain_ids = this.get_chain_ids_for_blockchain(blockchain)
|
|
104
|
+
.filter(cid => cid !== exclude_chain_id);
|
|
105
|
+
const webhooks = remaining_chain_ids.flatMap(cid => this.get_webhooks_for_chain(all, env, cid));
|
|
106
|
+
yield Promise.allSettled(webhooks.map(w => this.alchemy.add_remove_addresses(env, { webhook_id: w.id, addresses_to_add: [address], addresses_to_remove: [] })));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Remove an address from all webhooks for a blockchain except the already-updated chain.
|
|
111
|
+
* Call this fire-and-forget after responding to the caller.
|
|
112
|
+
*/
|
|
113
|
+
sync_remove_from_remaining(env, blockchain, address, exclude_chain_id) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const all = yield this.get_webhooks(env);
|
|
116
|
+
const remaining_chain_ids = this.get_chain_ids_for_blockchain(blockchain)
|
|
117
|
+
.filter(cid => cid !== exclude_chain_id);
|
|
118
|
+
const webhooks = remaining_chain_ids.flatMap(cid => this.get_webhooks_for_chain(all, env, cid));
|
|
119
|
+
yield Promise.allSettled(webhooks.map(w => this.alchemy.add_remove_addresses(env, { webhook_id: w.id, addresses_to_add: [], addresses_to_remove: [address] })));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.default = AlchemyWebhookAddressManager;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { QnNotificationCreateResponse, QnNotificationListResponse } from "./types/notification_types";
|
|
2
2
|
import { IConfig } from "../../interfaces/config";
|
|
3
3
|
import BaseErrors from "../../errors/errors";
|
|
4
|
+
import { RateLimiterOptions } from "../../utils/AsyncRateLimiter";
|
|
4
5
|
declare class QnNotificationsApi extends BaseErrors {
|
|
5
6
|
private api_key;
|
|
6
7
|
private base_url;
|
|
7
8
|
private rate_limiter;
|
|
8
9
|
private rlc;
|
|
9
|
-
constructor(config: IConfig);
|
|
10
|
+
constructor(config: IConfig, rlc?: RateLimiterOptions);
|
|
10
11
|
create_webhook(template: string, name: string, network: string, webhook_url: string, initial_addresses: string[]): Promise<QnNotificationCreateResponse>;
|
|
11
12
|
get_all_webhooks(): Promise<QnNotificationListResponse>;
|
|
12
13
|
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;
|
|
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,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,4BAA4B,CAAC;IAY3B,gBAAgB,IAAI,OAAO,CAAC,0BAA0B,CAAC;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"}
|
|
@@ -48,13 +48,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
const errors_1 = __importDefault(require("../../errors/errors"));
|
|
49
49
|
const AsyncRateLimiter_1 = __importStar(require("../../utils/AsyncRateLimiter"));
|
|
50
50
|
class QnNotificationsApi extends errors_1.default {
|
|
51
|
-
constructor(config) {
|
|
51
|
+
constructor(config, rlc) {
|
|
52
52
|
super();
|
|
53
53
|
this.base_url = "https://api.quicknode.com/webhooks/rest/v1";
|
|
54
|
-
this.rlc = { maxConcurrent: 1, minDelayMs:
|
|
54
|
+
this.rlc = { maxConcurrent: 1, minDelayMs: 1000 };
|
|
55
55
|
this.api_key = config.config.quicknodeApiKey;
|
|
56
56
|
if (!this.api_key)
|
|
57
57
|
throw new Error(`quicknode api key is required`);
|
|
58
|
+
if (rlc) {
|
|
59
|
+
this.rlc = rlc;
|
|
60
|
+
}
|
|
58
61
|
this.rate_limiter = new AsyncRateLimiter_1.default(this.rlc);
|
|
59
62
|
}
|
|
60
63
|
create_webhook(template, name, network, webhook_url, initial_addresses) {
|
|
@@ -1,18 +1,47 @@
|
|
|
1
|
-
import { BlockchainType } from "../../interfaces";
|
|
1
|
+
import { BlockchainType, ChainId } from "../../interfaces";
|
|
2
2
|
import { IConfig } from "../../interfaces/config";
|
|
3
|
+
import { RateLimiterOptions } from "../../utils/AsyncRateLimiter";
|
|
3
4
|
declare class QnWebhookAddressManager {
|
|
4
5
|
private static instance;
|
|
5
6
|
private api;
|
|
6
7
|
private config;
|
|
7
8
|
private cache;
|
|
8
9
|
private constructor();
|
|
9
|
-
static getInstance(config: IConfig): QnWebhookAddressManager;
|
|
10
|
+
static getInstance(config: IConfig, rlc?: RateLimiterOptions): QnWebhookAddressManager;
|
|
11
|
+
private get_blockchain_for_chain;
|
|
12
|
+
/** Returns the { name, network } pairs for the notification configs of a given chain. */
|
|
13
|
+
private get_webhook_keys_for_chain;
|
|
10
14
|
private get_notif_configs;
|
|
11
15
|
private is_stale;
|
|
12
16
|
private load;
|
|
13
17
|
private ensure_loaded;
|
|
18
|
+
private matches_key;
|
|
14
19
|
add_address(blockchain: BlockchainType, address: string): Promise<boolean>;
|
|
15
20
|
remove_address(blockchain: BlockchainType, address: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Add an address to the webhook(s) for a single chain only.
|
|
23
|
+
* Matches by both name and network to avoid cross-service contamination.
|
|
24
|
+
* Use this for the immediate await before responding to the caller.
|
|
25
|
+
*/
|
|
26
|
+
add_address_to_chain(chain_id: ChainId, address: string): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Remove an address from the webhook(s) for a single chain only.
|
|
29
|
+
* Matches by both name and network to avoid cross-service contamination.
|
|
30
|
+
* Use this for the immediate await before responding to the caller.
|
|
31
|
+
*/
|
|
32
|
+
remove_address_from_chain(chain_id: ChainId, address: string): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Add an address to all webhooks for a blockchain except the already-updated chain.
|
|
35
|
+
* Excludes by both name and network so only the exact webhooks for that chain are skipped.
|
|
36
|
+
* Call this fire-and-forget after responding to the caller.
|
|
37
|
+
*/
|
|
38
|
+
sync_add_to_remaining(blockchain: BlockchainType, address: string, exclude_chain_id: ChainId): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Remove an address from all webhooks for a blockchain except the already-updated chain.
|
|
41
|
+
* Excludes by both name and network so only the exact webhooks for that chain are skipped.
|
|
42
|
+
* Call this fire-and-forget after responding to the caller.
|
|
43
|
+
*/
|
|
44
|
+
sync_remove_from_remaining(blockchain: BlockchainType, address: string, exclude_chain_id: ChainId): Promise<void>;
|
|
16
45
|
}
|
|
17
46
|
export default QnWebhookAddressManager;
|
|
18
47
|
//# sourceMappingURL=QnWebhookAddressManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QnWebhookAddressManager.d.ts","sourceRoot":"","sources":["../../../src/services/quicknode-notifications/QnWebhookAddressManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,kBAAkB,CAAC;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AAO,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;CAkBjI;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -16,17 +16,31 @@ const ChainManager_1 = __importDefault(require("../ChainManager"));
|
|
|
16
16
|
const QnNotificationsApi_1 = __importDefault(require("./QnNotificationsApi"));
|
|
17
17
|
const CACHE_TTL_MS = 10 * 60 * 1000; // 10 minutes
|
|
18
18
|
class QnWebhookAddressManager {
|
|
19
|
-
constructor(config) {
|
|
19
|
+
constructor(config, rlc) {
|
|
20
20
|
this.cache = new Map();
|
|
21
21
|
this.config = config;
|
|
22
|
-
this.api = new QnNotificationsApi_1.default(config);
|
|
22
|
+
this.api = new QnNotificationsApi_1.default(config, rlc);
|
|
23
23
|
}
|
|
24
|
-
static getInstance(config) {
|
|
24
|
+
static getInstance(config, rlc) {
|
|
25
25
|
if (!this.instance) {
|
|
26
|
-
this.instance = new QnWebhookAddressManager(config);
|
|
26
|
+
this.instance = new QnWebhookAddressManager(config, rlc);
|
|
27
27
|
}
|
|
28
28
|
return this.instance;
|
|
29
29
|
}
|
|
30
|
+
get_blockchain_for_chain(chain_id) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const cfg = (_a = ChainManager_1.default.getInstance(this.config).contractsMap) === null || _a === void 0 ? void 0 : _a[chain_id.toString()];
|
|
33
|
+
return (_b = cfg === null || cfg === void 0 ? void 0 : cfg.blockchainType) !== null && _b !== void 0 ? _b : null;
|
|
34
|
+
}
|
|
35
|
+
/** Returns the { name, network } pairs for the notification configs of a given chain. */
|
|
36
|
+
get_webhook_keys_for_chain(chain_id) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
const cfg = (_a = ChainManager_1.default.getInstance(this.config).contractsMap) === null || _a === void 0 ? void 0 : _a[chain_id.toString()];
|
|
39
|
+
return (_c = (_b = cfg === null || cfg === void 0 ? void 0 : cfg.quicknodeNotificationConfig) === null || _b === void 0 ? void 0 : _b.map(n => ({
|
|
40
|
+
name: n.name.toLowerCase(),
|
|
41
|
+
network: n.network.toLowerCase(),
|
|
42
|
+
}))) !== null && _c !== void 0 ? _c : [];
|
|
43
|
+
}
|
|
30
44
|
get_notif_configs(blockchain) {
|
|
31
45
|
const chain_manager = ChainManager_1.default.getInstance(this.config);
|
|
32
46
|
if (!chain_manager.contractsMap)
|
|
@@ -76,8 +90,9 @@ class QnWebhookAddressManager {
|
|
|
76
90
|
const addresses = ((_a = existing.templateArgs) === null || _a === void 0 ? void 0 : _a[arg_key]) || [];
|
|
77
91
|
entries.push({
|
|
78
92
|
webhook_id: existing.id,
|
|
93
|
+
name: notif_config.name.toLowerCase(),
|
|
79
94
|
template: notif_config.template,
|
|
80
|
-
network: notif_config.network,
|
|
95
|
+
network: notif_config.network.toLowerCase(),
|
|
81
96
|
address_set: new Set(addresses),
|
|
82
97
|
});
|
|
83
98
|
}
|
|
@@ -93,6 +108,9 @@ class QnWebhookAddressManager {
|
|
|
93
108
|
return ((_a = this.cache.get(blockchain)) === null || _a === void 0 ? void 0 : _a.entries) || [];
|
|
94
109
|
});
|
|
95
110
|
}
|
|
111
|
+
matches_key(entry, key) {
|
|
112
|
+
return entry.name === key.name && entry.network === key.network;
|
|
113
|
+
}
|
|
96
114
|
add_address(blockchain, address) {
|
|
97
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
116
|
const entries = yield this.ensure_loaded(blockchain);
|
|
@@ -102,11 +120,11 @@ class QnWebhookAddressManager {
|
|
|
102
120
|
entry.address_set.add(address);
|
|
103
121
|
try {
|
|
104
122
|
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
105
|
-
console.log(`QnWebhookAddressManager: Added ${address} to ${entry.
|
|
123
|
+
console.log(`QnWebhookAddressManager: Added ${address} to ${entry.name} webhook`);
|
|
106
124
|
}
|
|
107
125
|
catch (error) {
|
|
108
126
|
entry.address_set.delete(address);
|
|
109
|
-
console.error(`QnWebhookAddressManager: Failed to add ${address} to ${entry.
|
|
127
|
+
console.error(`QnWebhookAddressManager: Failed to add ${address} to ${entry.name}`, error);
|
|
110
128
|
throw error;
|
|
111
129
|
}
|
|
112
130
|
}
|
|
@@ -122,16 +140,126 @@ class QnWebhookAddressManager {
|
|
|
122
140
|
entry.address_set.delete(address);
|
|
123
141
|
try {
|
|
124
142
|
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
125
|
-
console.log(`QnWebhookAddressManager: Removed ${address} from ${entry.
|
|
143
|
+
console.log(`QnWebhookAddressManager: Removed ${address} from ${entry.name} webhook`);
|
|
126
144
|
}
|
|
127
145
|
catch (error) {
|
|
128
146
|
entry.address_set.add(address);
|
|
129
|
-
console.error(`QnWebhookAddressManager: Failed to remove ${address} from ${entry.
|
|
147
|
+
console.error(`QnWebhookAddressManager: Failed to remove ${address} from ${entry.name}`, error);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Add an address to the webhook(s) for a single chain only.
|
|
156
|
+
* Matches by both name and network to avoid cross-service contamination.
|
|
157
|
+
* Use this for the immediate await before responding to the caller.
|
|
158
|
+
*/
|
|
159
|
+
add_address_to_chain(chain_id, address) {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const blockchain = this.get_blockchain_for_chain(chain_id);
|
|
162
|
+
if (!blockchain)
|
|
163
|
+
return false;
|
|
164
|
+
const keys = this.get_webhook_keys_for_chain(chain_id);
|
|
165
|
+
const entries = (yield this.ensure_loaded(blockchain))
|
|
166
|
+
.filter(e => keys.some(k => this.matches_key(e, k)));
|
|
167
|
+
for (const entry of entries) {
|
|
168
|
+
if (entry.address_set.has(address))
|
|
169
|
+
continue;
|
|
170
|
+
entry.address_set.add(address);
|
|
171
|
+
try {
|
|
172
|
+
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
173
|
+
console.log(`QnWebhookAddressManager: Added ${address} to ${entry.name} webhook (chain ${chain_id})`);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
entry.address_set.delete(address);
|
|
177
|
+
console.error(`QnWebhookAddressManager: Failed to add ${address} to ${entry.name}`, error);
|
|
130
178
|
throw error;
|
|
131
179
|
}
|
|
132
180
|
}
|
|
133
181
|
return true;
|
|
134
182
|
});
|
|
135
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Remove an address from the webhook(s) for a single chain only.
|
|
186
|
+
* Matches by both name and network to avoid cross-service contamination.
|
|
187
|
+
* Use this for the immediate await before responding to the caller.
|
|
188
|
+
*/
|
|
189
|
+
remove_address_from_chain(chain_id, address) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
const blockchain = this.get_blockchain_for_chain(chain_id);
|
|
192
|
+
if (!blockchain)
|
|
193
|
+
return false;
|
|
194
|
+
const keys = this.get_webhook_keys_for_chain(chain_id);
|
|
195
|
+
const entries = (yield this.ensure_loaded(blockchain))
|
|
196
|
+
.filter(e => keys.some(k => this.matches_key(e, k)));
|
|
197
|
+
for (const entry of entries) {
|
|
198
|
+
if (!entry.address_set.has(address))
|
|
199
|
+
continue;
|
|
200
|
+
entry.address_set.delete(address);
|
|
201
|
+
try {
|
|
202
|
+
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
203
|
+
console.log(`QnWebhookAddressManager: Removed ${address} from ${entry.name} webhook (chain ${chain_id})`);
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
entry.address_set.add(address);
|
|
207
|
+
console.error(`QnWebhookAddressManager: Failed to remove ${address} from ${entry.name}`, error);
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return true;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Add an address to all webhooks for a blockchain except the already-updated chain.
|
|
216
|
+
* Excludes by both name and network so only the exact webhooks for that chain are skipped.
|
|
217
|
+
* Call this fire-and-forget after responding to the caller.
|
|
218
|
+
*/
|
|
219
|
+
sync_add_to_remaining(blockchain, address, exclude_chain_id) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
const exclude_keys = this.get_webhook_keys_for_chain(exclude_chain_id);
|
|
222
|
+
const entries = (yield this.ensure_loaded(blockchain))
|
|
223
|
+
.filter(e => !exclude_keys.some(k => this.matches_key(e, k)));
|
|
224
|
+
for (const entry of entries) {
|
|
225
|
+
if (entry.address_set.has(address))
|
|
226
|
+
continue;
|
|
227
|
+
entry.address_set.add(address);
|
|
228
|
+
try {
|
|
229
|
+
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
230
|
+
console.log(`QnWebhookAddressManager: Synced add ${address} to ${entry.name} webhook`);
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
entry.address_set.delete(address);
|
|
234
|
+
console.error(`QnWebhookAddressManager: Sync add failed for ${entry.name}`, error);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Remove an address from all webhooks for a blockchain except the already-updated chain.
|
|
241
|
+
* Excludes by both name and network so only the exact webhooks for that chain are skipped.
|
|
242
|
+
* Call this fire-and-forget after responding to the caller.
|
|
243
|
+
*/
|
|
244
|
+
sync_remove_from_remaining(blockchain, address, exclude_chain_id) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
const exclude_keys = this.get_webhook_keys_for_chain(exclude_chain_id);
|
|
247
|
+
const entries = (yield this.ensure_loaded(blockchain))
|
|
248
|
+
.filter(e => !exclude_keys.some(k => this.matches_key(e, k)));
|
|
249
|
+
for (const entry of entries) {
|
|
250
|
+
if (!entry.address_set.has(address))
|
|
251
|
+
continue;
|
|
252
|
+
entry.address_set.delete(address);
|
|
253
|
+
try {
|
|
254
|
+
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
255
|
+
console.log(`QnWebhookAddressManager: Synced remove ${address} from ${entry.name} webhook`);
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
entry.address_set.add(address);
|
|
259
|
+
console.error(`QnWebhookAddressManager: Sync remove failed for ${entry.name}`, error);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
136
264
|
}
|
|
137
265
|
exports.default = QnWebhookAddressManager;
|
|
@@ -2,6 +2,7 @@ import BaseErrors from "../../errors/errors";
|
|
|
2
2
|
import { BlockchainType } from "../../interfaces";
|
|
3
3
|
import { IConfig } from "../../interfaces/config";
|
|
4
4
|
import { IDatabasePool } from "../../interfaces/database";
|
|
5
|
+
import { RateLimiterOptions } from "../../utils/AsyncRateLimiter";
|
|
5
6
|
export interface NotificationWebhookEntry {
|
|
6
7
|
webhook_id: string;
|
|
7
8
|
template: string;
|
|
@@ -18,7 +19,7 @@ declare class SetupNotifications extends BaseErrors {
|
|
|
18
19
|
private config;
|
|
19
20
|
private db;
|
|
20
21
|
private constructor();
|
|
21
|
-
static getInstance(config: IConfig, db: IDatabasePool): SetupNotifications;
|
|
22
|
+
static getInstance(config: IConfig, db: IDatabasePool, rlc: RateLimiterOptions): SetupNotifications;
|
|
22
23
|
get_all_webhook_ids(): string[];
|
|
23
24
|
get_entry_by_webhook_id(id: string): NotificationWebhookEntry | undefined;
|
|
24
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetupNotifications.d.ts","sourceRoot":"","sources":["../../../src/services/quicknode-notifications/SetupNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC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;IAuBpC;;OAEG;IACH,OAAO,CAAC,cAAc;IAOT,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAwH3B,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDvE,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAe1F;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -20,7 +20,7 @@ const QnNotificationsApi_1 = __importDefault(require("./QnNotificationsApi"));
|
|
|
20
20
|
const ADDRESS_SYNC_BATCH_SIZE = 500;
|
|
21
21
|
const ADDRESS_LOG_THRESHOLD = 1000;
|
|
22
22
|
class SetupNotifications extends errors_1.default {
|
|
23
|
-
constructor(config, db) {
|
|
23
|
+
constructor(config, db, rlc) {
|
|
24
24
|
super();
|
|
25
25
|
// keyed by notification config name (unique per network)
|
|
26
26
|
this.webhook_map = new Map();
|
|
@@ -30,11 +30,11 @@ 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);
|
|
33
|
+
this.api = new QnNotificationsApi_1.default(config, rlc);
|
|
34
34
|
}
|
|
35
|
-
static getInstance(config, db) {
|
|
35
|
+
static getInstance(config, db, rlc) {
|
|
36
36
|
if (!this.instance) {
|
|
37
|
-
this.instance = new SetupNotifications(config, db);
|
|
37
|
+
this.instance = new SetupNotifications(config, db, rlc);
|
|
38
38
|
}
|
|
39
39
|
return this.instance;
|
|
40
40
|
}
|