@ercworldio/blockchain-shared 1.0.0 → 1.0.1-dev.1
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/chains/networks_dev.json +44 -11
- package/build/chains/networks_prod-bu.json +7 -7
- package/build/chains/networks_prod-dz.json +510 -0
- package/build/chains/networks_prod.json +8 -8
- package/build/chains/networks_stg-bu.json +7 -7
- package/build/chains/networks_stg-dz.json +17 -6
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +13 -2
- package/build/interfaces/config.d.ts +15 -2
- package/build/interfaces/config.d.ts.map +1 -1
- package/build/interfaces/config.js +5 -0
- package/build/interfaces.d.ts +2 -1
- package/build/interfaces.d.ts.map +1 -1
- package/build/services/AlchemyService.d.ts +1 -0
- package/build/services/AlchemyService.d.ts.map +1 -1
- package/build/services/AlchemyService.js +6 -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/AlchemyWebhookSignature.d.ts +3 -3
- package/build/services/AlchemyWebhookSignature.d.ts.map +1 -1
- package/build/services/AlchemyWebhookSignature.js +8 -8
- package/build/services/BalanceService.d.ts +5 -1
- package/build/services/BalanceService.d.ts.map +1 -1
- package/build/services/BalanceService.js +32 -11
- package/build/services/ClaimJobService.d.ts.map +1 -1
- package/build/services/ClaimJobService.js +4 -1
- package/build/services/DepositAddressService.d.ts +8 -0
- package/build/services/DepositAddressService.d.ts.map +1 -1
- package/build/services/DepositAddressService.js +30 -0
- package/build/services/KeyVaultService.d.ts +1 -1
- package/build/services/KeyVaultService.d.ts.map +1 -1
- package/build/services/KeyVaultService.js +3 -30
- package/build/services/QuicknodeWebhookSignature.d.ts +3 -3
- package/build/services/QuicknodeWebhookSignature.d.ts.map +1 -1
- package/build/services/QuicknodeWebhookSignature.js +8 -8
- package/build/services/StorageService.js +2 -2
- package/build/services/SweepJobService.d.ts.map +1 -1
- package/build/services/SweepJobService.js +4 -1
- package/build/services/WalletManager.d.ts +3 -1
- package/build/services/WalletManager.d.ts.map +1 -1
- package/build/services/WalletManager.js +11 -7
- package/build/services/WalletManagerHelper.d.ts +15 -0
- package/build/services/WalletManagerHelper.d.ts.map +1 -0
- package/build/services/WalletManagerHelper.js +65 -0
- package/build/services/quicknode-notifications/QnNotificationsApi.d.ts +20 -0
- package/build/services/quicknode-notifications/QnNotificationsApi.d.ts.map +1 -0
- package/build/services/quicknode-notifications/QnNotificationsApi.js +134 -0
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts +47 -0
- package/build/services/quicknode-notifications/QnWebhookAddressManager.d.ts.map +1 -0
- package/build/services/quicknode-notifications/QnWebhookAddressManager.js +265 -0
- package/build/services/quicknode-notifications/SetupNotifications.d.ts +40 -0
- package/build/services/quicknode-notifications/SetupNotifications.d.ts.map +1 -0
- package/build/services/quicknode-notifications/SetupNotifications.js +253 -0
- package/build/services/quicknode-notifications/types/index.d.ts +2 -0
- package/build/services/quicknode-notifications/types/index.d.ts.map +1 -0
- package/build/services/quicknode-notifications/types/index.js +17 -0
- package/build/services/quicknode-notifications/types/notification_types.d.ts +154 -0
- package/build/services/quicknode-notifications/types/notification_types.d.ts.map +1 -0
- package/build/services/quicknode-notifications/types/notification_types.js +2 -0
- package/build/services/solana/escrow/idl/escrow.json +110 -1
- package/build/services/solana/escrow/types/escrow.d.ts +110 -1
- package/build/services/solana/escrow/types/escrow.d.ts.map +1 -1
- package/build/services/types/chain_manager.d.ts +5 -0
- package/build/services/types/chain_manager.d.ts.map +1 -1
- package/build/services/types/quicknode.d.ts +1 -0
- package/build/services/types/quicknode.d.ts.map +1 -1
- package/build/utils/AsyncTTLCache.d.ts +1 -0
- package/build/utils/AsyncTTLCache.d.ts.map +1 -1
- package/build/utils/AsyncTTLCache.js +3 -0
- package/build/utils/solana.d.ts +1 -0
- package/build/utils/solana.d.ts.map +1 -1
- package/build/utils/solana.js +15 -1
- package/package.json +1 -1
|
@@ -0,0 +1,253 @@
|
|
|
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 errors_1 = __importDefault(require("../../errors/errors"));
|
|
16
|
+
const ChainManager_1 = __importDefault(require("../ChainManager"));
|
|
17
|
+
const DepositAddressService_1 = __importDefault(require("../DepositAddressService"));
|
|
18
|
+
const QuicknodeWebhookSignature_1 = __importDefault(require("../QuicknodeWebhookSignature"));
|
|
19
|
+
const QnNotificationsApi_1 = __importDefault(require("./QnNotificationsApi"));
|
|
20
|
+
const ADDRESS_SYNC_BATCH_SIZE = 500;
|
|
21
|
+
const ADDRESS_LOG_THRESHOLD = 1000;
|
|
22
|
+
class SetupNotifications extends errors_1.default {
|
|
23
|
+
constructor(config, db, rlc) {
|
|
24
|
+
super();
|
|
25
|
+
// keyed by notification config name (unique per network)
|
|
26
|
+
this.webhook_map = new Map();
|
|
27
|
+
// keyed by blockchain type → list of notification entries for that blockchain
|
|
28
|
+
this.by_blockchain = new Map();
|
|
29
|
+
// configs deferred because no addresses existed at startup
|
|
30
|
+
this.pending_configs = new Map();
|
|
31
|
+
this.config = config;
|
|
32
|
+
this.db = db;
|
|
33
|
+
this.api = QnNotificationsApi_1.default.getInstance(config, rlc);
|
|
34
|
+
}
|
|
35
|
+
static getInstance(config, db, rlc) {
|
|
36
|
+
if (!this.instance) {
|
|
37
|
+
this.instance = new SetupNotifications(config, db, rlc);
|
|
38
|
+
}
|
|
39
|
+
return this.instance;
|
|
40
|
+
}
|
|
41
|
+
get_all_webhook_ids() {
|
|
42
|
+
return Array.from(this.webhook_map.values()).map(e => e.webhook_id);
|
|
43
|
+
}
|
|
44
|
+
get_entry_by_webhook_id(id) {
|
|
45
|
+
for (const entry of this.webhook_map.values()) {
|
|
46
|
+
if (entry.webhook_id === id)
|
|
47
|
+
return entry;
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Fetch all deposit addresses for a blockchain from the DB (paginated).
|
|
53
|
+
* The `blockchain` filter value in DepositAddressService is the string stored
|
|
54
|
+
* in the DB — e.g. "solana", "evm", "ethereum", etc.
|
|
55
|
+
*/
|
|
56
|
+
fetch_all_db_addresses(blockchain) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const service = new DepositAddressService_1.default(this.db);
|
|
59
|
+
const addresses = [];
|
|
60
|
+
let page = 1;
|
|
61
|
+
const page_size = ADDRESS_SYNC_BATCH_SIZE;
|
|
62
|
+
while (true) {
|
|
63
|
+
const result = yield service.getDepositAddressesPaginated(page, page_size, { blockchain });
|
|
64
|
+
for (const item of result.items) {
|
|
65
|
+
addresses.push(item.address);
|
|
66
|
+
}
|
|
67
|
+
if (!result.has_next)
|
|
68
|
+
break;
|
|
69
|
+
page++;
|
|
70
|
+
}
|
|
71
|
+
if (addresses.length > ADDRESS_LOG_THRESHOLD) {
|
|
72
|
+
console.warn(`SetupNotifications: ${addresses.length} addresses fetched for blockchain=${blockchain} — ensure QN webhook limit is sufficient`);
|
|
73
|
+
}
|
|
74
|
+
return addresses;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Register a newly-created webhook entry in the internal maps.
|
|
79
|
+
*/
|
|
80
|
+
register_entry(config_name, entry) {
|
|
81
|
+
this.webhook_map.set(config_name, entry);
|
|
82
|
+
const existing_by_bc = this.by_blockchain.get(entry.blockchain) || [];
|
|
83
|
+
existing_by_bc.push(entry);
|
|
84
|
+
this.by_blockchain.set(entry.blockchain, existing_by_bc);
|
|
85
|
+
}
|
|
86
|
+
initialize() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
var _a;
|
|
89
|
+
try {
|
|
90
|
+
const chain_manager = ChainManager_1.default.getInstance(this.config);
|
|
91
|
+
if (!chain_manager.contractsMap)
|
|
92
|
+
return;
|
|
93
|
+
// Collect all required notification configs from chain config
|
|
94
|
+
const required_notifications = Object.entries(chain_manager.contractsMap)
|
|
95
|
+
.filter(([_, cfg]) => { var _a; return ((_a = cfg.quicknodeNotificationConfig) === null || _a === void 0 ? void 0 : _a.length) > 0; })
|
|
96
|
+
.flatMap(([_, cfg]) => cfg.quicknodeNotificationConfig.map(n => (Object.assign(Object.assign({}, n), { blockchain: cfg.blockchainType }))));
|
|
97
|
+
if (required_notifications.length === 0) {
|
|
98
|
+
console.log(`SetupNotifications: No quicknodeNotifications config found. Skipping.`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// Deduplicate by name (multiple chains may share the same notification config name)
|
|
102
|
+
const unique_notifications = required_notifications.filter((n, i, arr) => arr.findIndex(x => x.name === n.name) === i);
|
|
103
|
+
// Fetch existing webhooks
|
|
104
|
+
let existing_webhooks = [];
|
|
105
|
+
try {
|
|
106
|
+
const res = yield this.api.get_all_webhooks();
|
|
107
|
+
existing_webhooks = res.data || [];
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.error(`SetupNotifications: Failed to fetch existing webhooks`, error);
|
|
111
|
+
}
|
|
112
|
+
const host = this.config.config.useTunnel ? this.config.config.tunnel : this.config.config.host;
|
|
113
|
+
const webhook_url = `${host}/webhook/quicknode/notifications`;
|
|
114
|
+
for (const notif_config of unique_notifications) {
|
|
115
|
+
const existing = existing_webhooks.find(w => {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
return ((_a = w.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === notif_config.name.toLowerCase() &&
|
|
118
|
+
((_b = w.network) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === notif_config.network.toLowerCase();
|
|
119
|
+
});
|
|
120
|
+
// Fetch current addresses from the DB for this blockchain
|
|
121
|
+
const db_addresses = yield this.fetch_all_db_addresses(notif_config.blockchain);
|
|
122
|
+
console.log(`SetupNotifications: ${db_addresses.length} DB addresses for blockchain=${notif_config.blockchain}`);
|
|
123
|
+
let webhook_id;
|
|
124
|
+
if (existing) {
|
|
125
|
+
webhook_id = existing.id;
|
|
126
|
+
console.log(`SetupNotifications: Found existing webhook for ${notif_config.name} (id: ${webhook_id})`);
|
|
127
|
+
// Sync the webhook with the full DB address list to fix any drift
|
|
128
|
+
if (db_addresses.length > 0) {
|
|
129
|
+
try {
|
|
130
|
+
yield this.api.update_webhook_addresses(webhook_id, notif_config.template, db_addresses);
|
|
131
|
+
console.log(`SetupNotifications: Synced ${db_addresses.length} addresses to existing webhook ${notif_config.name}`);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
console.error(`SetupNotifications: Failed to sync addresses to webhook ${notif_config.name}`, err);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const entry = {
|
|
138
|
+
webhook_id,
|
|
139
|
+
template: notif_config.template,
|
|
140
|
+
network: notif_config.network,
|
|
141
|
+
blockchain: notif_config.blockchain,
|
|
142
|
+
address_set: new Set(db_addresses),
|
|
143
|
+
};
|
|
144
|
+
this.register_entry(notif_config.name, entry);
|
|
145
|
+
}
|
|
146
|
+
else if (db_addresses.length === 0) {
|
|
147
|
+
// QN requires at least one address to create a webhook — defer until first address arrives
|
|
148
|
+
console.log(`SetupNotifications: No addresses for ${notif_config.name} — deferring webhook creation until first address is added`);
|
|
149
|
+
this.pending_configs.set(notif_config.name, { notif_config, webhook_url });
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// Create webhook with DB addresses as the initial set
|
|
153
|
+
console.log(`SetupNotifications: Creating webhook for ${notif_config.name} on ${notif_config.network} with ${db_addresses.length} initial addresses`);
|
|
154
|
+
try {
|
|
155
|
+
const res = yield this.api.create_webhook(notif_config.template, notif_config.name, notif_config.network, webhook_url, db_addresses);
|
|
156
|
+
webhook_id = res.id;
|
|
157
|
+
if ((_a = res.destination_attributes) === null || _a === void 0 ? void 0 : _a.security_token) {
|
|
158
|
+
yield QuicknodeWebhookSignature_1.default.getInstance().createSigningKey(this.config.config.keyVaultName, webhook_id, res.destination_attributes.security_token);
|
|
159
|
+
console.log(`SetupNotifications: Stored signing key for webhook ${webhook_id}`);
|
|
160
|
+
}
|
|
161
|
+
console.log(`SetupNotifications: Created webhook ${notif_config.name} (id: ${webhook_id})`);
|
|
162
|
+
const entry = {
|
|
163
|
+
webhook_id,
|
|
164
|
+
template: notif_config.template,
|
|
165
|
+
network: notif_config.network,
|
|
166
|
+
blockchain: notif_config.blockchain,
|
|
167
|
+
address_set: new Set(db_addresses),
|
|
168
|
+
};
|
|
169
|
+
this.register_entry(notif_config.name, entry);
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
console.error(`SetupNotifications: Failed to create webhook for ${notif_config.name}`, err);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
console.log(`SetupNotifications: Initialized ${this.webhook_map.size} notification webhooks, ${this.pending_configs.size} deferred.`);
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
console.error(`SetupNotifications: Error during initialization`, error);
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
add_address(blockchain, address) {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
var _a;
|
|
187
|
+
// If any pending configs exist for this blockchain, create the webhook now
|
|
188
|
+
for (const [config_name, pending] of this.pending_configs.entries()) {
|
|
189
|
+
if (pending.notif_config.blockchain !== blockchain)
|
|
190
|
+
continue;
|
|
191
|
+
console.log(`SetupNotifications: Lazily creating deferred webhook ${config_name} for first address ${address}`);
|
|
192
|
+
try {
|
|
193
|
+
const res = yield this.api.create_webhook(pending.notif_config.template, pending.notif_config.name, pending.notif_config.network, pending.webhook_url, [address]);
|
|
194
|
+
if ((_a = res.destination_attributes) === null || _a === void 0 ? void 0 : _a.security_token) {
|
|
195
|
+
yield QuicknodeWebhookSignature_1.default.getInstance().createSigningKey(this.config.config.keyVaultName, res.id, res.destination_attributes.security_token);
|
|
196
|
+
}
|
|
197
|
+
const entry = {
|
|
198
|
+
webhook_id: res.id,
|
|
199
|
+
template: pending.notif_config.template,
|
|
200
|
+
network: pending.notif_config.network,
|
|
201
|
+
blockchain: pending.notif_config.blockchain,
|
|
202
|
+
address_set: new Set([address]),
|
|
203
|
+
};
|
|
204
|
+
this.register_entry(config_name, entry);
|
|
205
|
+
this.pending_configs.delete(config_name);
|
|
206
|
+
console.log(`SetupNotifications: Lazily created webhook ${config_name} (id: ${res.id})`);
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
console.error(`SetupNotifications: Failed to lazily create webhook ${config_name}`, err);
|
|
210
|
+
throw err;
|
|
211
|
+
}
|
|
212
|
+
// After lazy creation the address is already in the entry — continue to next pending
|
|
213
|
+
// but skip the update_webhook_addresses call below for this entry since it's already set
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const entries = this.by_blockchain.get(blockchain) || [];
|
|
217
|
+
for (const entry of entries) {
|
|
218
|
+
if (entry.address_set.has(address))
|
|
219
|
+
continue;
|
|
220
|
+
entry.address_set.add(address);
|
|
221
|
+
try {
|
|
222
|
+
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
223
|
+
console.log(`SetupNotifications: Added ${address} to ${entry.network} webhook`);
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
entry.address_set.delete(address); // rollback on failure
|
|
227
|
+
console.error(`SetupNotifications: Failed to add ${address} to ${entry.network}`, error);
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
remove_address(blockchain, address) {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
const entries = this.by_blockchain.get(blockchain) || [];
|
|
236
|
+
for (const entry of entries) {
|
|
237
|
+
if (!entry.address_set.has(address))
|
|
238
|
+
continue;
|
|
239
|
+
entry.address_set.delete(address);
|
|
240
|
+
try {
|
|
241
|
+
yield this.api.update_webhook_addresses(entry.webhook_id, entry.template, Array.from(entry.address_set));
|
|
242
|
+
console.log(`SetupNotifications: Removed ${address} from ${entry.network} webhook`);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
entry.address_set.add(address); // rollback on failure
|
|
246
|
+
console.error(`SetupNotifications: Failed to remove ${address} from ${entry.network}`, error);
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
exports.default = SetupNotifications;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/quicknode-notifications/types/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./notification_types"), exports);
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export type QnEvmLog = {
|
|
2
|
+
address: string;
|
|
3
|
+
topics: string[];
|
|
4
|
+
data: string;
|
|
5
|
+
transactionHash: string;
|
|
6
|
+
blockNumber: string;
|
|
7
|
+
blockTimestamp: string;
|
|
8
|
+
logIndex: string;
|
|
9
|
+
removed: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type QnEvmReceipt = {
|
|
12
|
+
blockNumber: string;
|
|
13
|
+
from: string;
|
|
14
|
+
transactionHash: string;
|
|
15
|
+
to: string | null;
|
|
16
|
+
logs: QnEvmLog[];
|
|
17
|
+
status: string;
|
|
18
|
+
gasUsed: string;
|
|
19
|
+
logsBloom?: string;
|
|
20
|
+
contractAddress?: string | null;
|
|
21
|
+
};
|
|
22
|
+
export type QnEvmTransaction = {
|
|
23
|
+
blockNumber: string;
|
|
24
|
+
chainId: string;
|
|
25
|
+
from: string;
|
|
26
|
+
hash: string;
|
|
27
|
+
to: string;
|
|
28
|
+
value: string;
|
|
29
|
+
gas?: string;
|
|
30
|
+
gasPrice?: string;
|
|
31
|
+
nonce?: string;
|
|
32
|
+
};
|
|
33
|
+
export type QnEvmWalletFilterPayload = {
|
|
34
|
+
matchingReceipts: QnEvmReceipt[] | null;
|
|
35
|
+
matchingTransactions: QnEvmTransaction[] | null;
|
|
36
|
+
};
|
|
37
|
+
export type QnSolanaAccountKey = {
|
|
38
|
+
pubkey: string;
|
|
39
|
+
signer: boolean;
|
|
40
|
+
writable: boolean;
|
|
41
|
+
source: string;
|
|
42
|
+
};
|
|
43
|
+
export type QnSolanaTransferInfo = {
|
|
44
|
+
source?: string;
|
|
45
|
+
destination?: string;
|
|
46
|
+
lamports?: number;
|
|
47
|
+
mint?: string;
|
|
48
|
+
tokenAmount?: {
|
|
49
|
+
amount: string;
|
|
50
|
+
decimals: number;
|
|
51
|
+
uiAmount: number;
|
|
52
|
+
uiAmountString?: string;
|
|
53
|
+
};
|
|
54
|
+
authority?: string;
|
|
55
|
+
multisigAuthority?: string;
|
|
56
|
+
signers?: string[];
|
|
57
|
+
account?: string;
|
|
58
|
+
wallet?: string;
|
|
59
|
+
};
|
|
60
|
+
export type QnSolanaInstruction = {
|
|
61
|
+
parsed?: {
|
|
62
|
+
info: QnSolanaTransferInfo;
|
|
63
|
+
type: string;
|
|
64
|
+
};
|
|
65
|
+
program?: string;
|
|
66
|
+
programId: string;
|
|
67
|
+
stackHeight?: number;
|
|
68
|
+
accounts?: string[];
|
|
69
|
+
data?: string;
|
|
70
|
+
};
|
|
71
|
+
export type QnSolanaTokenBalance = {
|
|
72
|
+
accountIndex: number;
|
|
73
|
+
mint: string;
|
|
74
|
+
owner: string;
|
|
75
|
+
programId?: string;
|
|
76
|
+
uiTokenAmount: {
|
|
77
|
+
amount: string;
|
|
78
|
+
decimals: number;
|
|
79
|
+
uiAmount: number;
|
|
80
|
+
uiAmountString: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type QnSolanaTransaction = {
|
|
84
|
+
raw: {
|
|
85
|
+
meta: {
|
|
86
|
+
fee: number;
|
|
87
|
+
err: any;
|
|
88
|
+
computeUnitsConsumed?: number;
|
|
89
|
+
postTokenBalances?: QnSolanaTokenBalance[];
|
|
90
|
+
preTokenBalances?: QnSolanaTokenBalance[];
|
|
91
|
+
preBalances?: number[];
|
|
92
|
+
postBalances?: number[];
|
|
93
|
+
logMessages?: string[];
|
|
94
|
+
innerInstructions?: any[];
|
|
95
|
+
rewards?: any[];
|
|
96
|
+
status?: {
|
|
97
|
+
Ok: null;
|
|
98
|
+
} | {
|
|
99
|
+
Err: any;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
transaction: {
|
|
103
|
+
message: {
|
|
104
|
+
accountKeys: QnSolanaAccountKey[];
|
|
105
|
+
instructions: QnSolanaInstruction[];
|
|
106
|
+
recentBlockhash: string;
|
|
107
|
+
};
|
|
108
|
+
signatures: string[];
|
|
109
|
+
};
|
|
110
|
+
version: string;
|
|
111
|
+
};
|
|
112
|
+
wallets: string[];
|
|
113
|
+
};
|
|
114
|
+
export type QnSolanaBlockInfo = {
|
|
115
|
+
slot: number;
|
|
116
|
+
blockTime: number;
|
|
117
|
+
blockHeight: number;
|
|
118
|
+
blockhash?: string;
|
|
119
|
+
parentSlot?: number;
|
|
120
|
+
};
|
|
121
|
+
export type QnSolanaBlock = {
|
|
122
|
+
block: QnSolanaBlockInfo;
|
|
123
|
+
transactions: QnSolanaTransaction[];
|
|
124
|
+
};
|
|
125
|
+
export type QnSolanaWalletFilterPayload = QnSolanaBlock[];
|
|
126
|
+
export type QnNotificationPayload = QnEvmWalletFilterPayload | QnSolanaWalletFilterPayload;
|
|
127
|
+
export type QnNotificationWebhookInfo = {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
network: string;
|
|
131
|
+
status: string;
|
|
132
|
+
destination_attributes: {
|
|
133
|
+
url: string;
|
|
134
|
+
security_token?: string;
|
|
135
|
+
};
|
|
136
|
+
templateArgs?: {
|
|
137
|
+
wallets?: string[];
|
|
138
|
+
accounts?: string[];
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export type QnNotificationCreateResponse = {
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
network: string;
|
|
145
|
+
status: string;
|
|
146
|
+
destination_attributes: {
|
|
147
|
+
url: string;
|
|
148
|
+
security_token: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export type QnNotificationListResponse = {
|
|
152
|
+
data: QnNotificationWebhookInfo[];
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=notification_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification_types.d.ts","sourceRoot":"","sources":["../../../../src/services/quicknode-notifications/types/notification_types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MA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
"address": "
|
|
2
|
+
"address": "Cr1fJwtExaPdYG8huC5axiW2m2knSoTumLzYBj9rMjCd",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "escrow",
|
|
5
5
|
"version": "0.1.0",
|
|
@@ -1282,6 +1282,10 @@
|
|
|
1282
1282
|
{
|
|
1283
1283
|
"name": "signer_pubkey",
|
|
1284
1284
|
"type": "pubkey"
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
"name": "funding_pubkey",
|
|
1288
|
+
"type": "pubkey"
|
|
1285
1289
|
}
|
|
1286
1290
|
]
|
|
1287
1291
|
},
|
|
@@ -1335,6 +1339,56 @@
|
|
|
1335
1339
|
],
|
|
1336
1340
|
"returns": "bool"
|
|
1337
1341
|
},
|
|
1342
|
+
{
|
|
1343
|
+
"name": "is_funding_pubkey",
|
|
1344
|
+
"discriminator": [
|
|
1345
|
+
252,
|
|
1346
|
+
56,
|
|
1347
|
+
255,
|
|
1348
|
+
21,
|
|
1349
|
+
13,
|
|
1350
|
+
63,
|
|
1351
|
+
211,
|
|
1352
|
+
163
|
|
1353
|
+
],
|
|
1354
|
+
"accounts": [
|
|
1355
|
+
{
|
|
1356
|
+
"name": "escrow_config",
|
|
1357
|
+
"pda": {
|
|
1358
|
+
"seeds": [
|
|
1359
|
+
{
|
|
1360
|
+
"kind": "const",
|
|
1361
|
+
"value": [
|
|
1362
|
+
101,
|
|
1363
|
+
115,
|
|
1364
|
+
99,
|
|
1365
|
+
114,
|
|
1366
|
+
111,
|
|
1367
|
+
119,
|
|
1368
|
+
45,
|
|
1369
|
+
99,
|
|
1370
|
+
111,
|
|
1371
|
+
110,
|
|
1372
|
+
102,
|
|
1373
|
+
105,
|
|
1374
|
+
103,
|
|
1375
|
+
45,
|
|
1376
|
+
118,
|
|
1377
|
+
50
|
|
1378
|
+
]
|
|
1379
|
+
}
|
|
1380
|
+
]
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
],
|
|
1384
|
+
"args": [
|
|
1385
|
+
{
|
|
1386
|
+
"name": "account",
|
|
1387
|
+
"type": "pubkey"
|
|
1388
|
+
}
|
|
1389
|
+
],
|
|
1390
|
+
"returns": "bool"
|
|
1391
|
+
},
|
|
1338
1392
|
{
|
|
1339
1393
|
"name": "is_initialized_config",
|
|
1340
1394
|
"discriminator": [
|
|
@@ -2019,6 +2073,61 @@
|
|
|
2019
2073
|
}
|
|
2020
2074
|
]
|
|
2021
2075
|
},
|
|
2076
|
+
{
|
|
2077
|
+
"name": "set_funding_wallet",
|
|
2078
|
+
"discriminator": [
|
|
2079
|
+
134,
|
|
2080
|
+
34,
|
|
2081
|
+
203,
|
|
2082
|
+
88,
|
|
2083
|
+
248,
|
|
2084
|
+
13,
|
|
2085
|
+
78,
|
|
2086
|
+
30
|
|
2087
|
+
],
|
|
2088
|
+
"accounts": [
|
|
2089
|
+
{
|
|
2090
|
+
"name": "escrow_config",
|
|
2091
|
+
"writable": true,
|
|
2092
|
+
"pda": {
|
|
2093
|
+
"seeds": [
|
|
2094
|
+
{
|
|
2095
|
+
"kind": "const",
|
|
2096
|
+
"value": [
|
|
2097
|
+
101,
|
|
2098
|
+
115,
|
|
2099
|
+
99,
|
|
2100
|
+
114,
|
|
2101
|
+
111,
|
|
2102
|
+
119,
|
|
2103
|
+
45,
|
|
2104
|
+
99,
|
|
2105
|
+
111,
|
|
2106
|
+
110,
|
|
2107
|
+
102,
|
|
2108
|
+
105,
|
|
2109
|
+
103,
|
|
2110
|
+
45,
|
|
2111
|
+
118,
|
|
2112
|
+
50
|
|
2113
|
+
]
|
|
2114
|
+
}
|
|
2115
|
+
]
|
|
2116
|
+
}
|
|
2117
|
+
},
|
|
2118
|
+
{
|
|
2119
|
+
"name": "admin",
|
|
2120
|
+
"writable": true,
|
|
2121
|
+
"signer": true
|
|
2122
|
+
}
|
|
2123
|
+
],
|
|
2124
|
+
"args": [
|
|
2125
|
+
{
|
|
2126
|
+
"name": "new_funding_wallet",
|
|
2127
|
+
"type": "pubkey"
|
|
2128
|
+
}
|
|
2129
|
+
]
|
|
2130
|
+
},
|
|
2022
2131
|
{
|
|
2023
2132
|
"name": "withdraw_sol_with_sig",
|
|
2024
2133
|
"discriminator": [
|