@secondlayer/shared 14.1.1 → 15.0.0
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/README.md +1 -1
- package/dist/src/archive/range-digest.d.ts +1 -1
- package/dist/src/archive/semantic-digest-builder.d.ts +1 -1
- package/dist/src/coverage/index.d.ts +1 -1
- package/dist/src/db/index.d.ts +1 -1
- package/dist/src/db/queries/chain-reorgs.d.ts +1 -1
- package/dist/src/db/queries/contracts.d.ts +1 -1
- package/dist/src/db/queries/instance.d.ts +1 -1
- package/dist/src/db/queries/integrity.d.ts +1 -1
- package/dist/src/db/queries/subgraph-gaps.d.ts +1 -1
- package/dist/src/db/queries/subgraph-operations.d.ts +1 -1
- package/dist/src/db/queries/subgraph-operations.js +3 -7
- package/dist/src/db/queries/subgraph-operations.js.map +3 -3
- package/dist/src/db/queries/subgraphs.d.ts +1 -1
- package/dist/src/db/queries/sync-scope.d.ts +1 -1
- package/dist/src/db/queries/webhook-replays.d.ts +1 -1
- package/dist/src/db/queries/webhooks.d.ts +1 -1
- package/dist/src/db/schema.d.ts +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/insights/index.d.ts +1 -1
- package/dist/src/node/local-client.d.ts +1 -1
- package/dist/src/runtime/index.d.ts +1 -1
- package/dist/src/runtime/index.js +4 -9
- package/dist/src/runtime/index.js.map +6 -6
- package/migrations/0101_events_logical_unique_idx.ts +2 -2
- package/migrations/0103_rename_decoder_checkpoints.ts +1 -1
- package/migrations/0133_vm_events_fk_cascade.ts +1 -1
- package/package.json +2 -10
- package/dist/src/node/hiro-client.d.ts +0 -196
- package/dist/src/node/hiro-client.js +0 -495
- package/dist/src/node/hiro-client.js.map +0 -12
- package/dist/src/node/hiro-pg-client.d.ts +0 -29
- package/dist/src/node/hiro-pg-client.js +0 -532
- package/dist/src/node/hiro-pg-client.js.map +0 -10
|
@@ -1,532 +0,0 @@
|
|
|
1
|
-
// src/node/hiro-pg-client.ts
|
|
2
|
-
import postgres from "postgres";
|
|
3
|
-
var SCHEMA = "stacks_blockchain_api";
|
|
4
|
-
function toHex(buf) {
|
|
5
|
-
if (!buf)
|
|
6
|
-
return "0x";
|
|
7
|
-
return `0x${Buffer.from(buf).toString("hex")}`;
|
|
8
|
-
}
|
|
9
|
-
function stxEventType(assetTypeId) {
|
|
10
|
-
switch (assetTypeId) {
|
|
11
|
-
case 1:
|
|
12
|
-
return "stx_transfer_event";
|
|
13
|
-
case 2:
|
|
14
|
-
return "stx_mint_event";
|
|
15
|
-
case 3:
|
|
16
|
-
return "stx_burn_event";
|
|
17
|
-
default:
|
|
18
|
-
return "stx_transfer_event";
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function ftEventType(assetTypeId) {
|
|
22
|
-
switch (assetTypeId) {
|
|
23
|
-
case 1:
|
|
24
|
-
return "ft_transfer_event";
|
|
25
|
-
case 2:
|
|
26
|
-
return "ft_mint_event";
|
|
27
|
-
case 3:
|
|
28
|
-
return "ft_burn_event";
|
|
29
|
-
default:
|
|
30
|
-
return "ft_transfer_event";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function nftEventType(assetTypeId) {
|
|
34
|
-
switch (assetTypeId) {
|
|
35
|
-
case 1:
|
|
36
|
-
return "nft_transfer_event";
|
|
37
|
-
case 2:
|
|
38
|
-
return "nft_mint_event";
|
|
39
|
-
case 3:
|
|
40
|
-
return "nft_burn_event";
|
|
41
|
-
default:
|
|
42
|
-
return "nft_transfer_event";
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function mapTxTypeId(typeId) {
|
|
46
|
-
switch (typeId) {
|
|
47
|
-
case 0:
|
|
48
|
-
return "token_transfer";
|
|
49
|
-
case 1:
|
|
50
|
-
return "smart_contract";
|
|
51
|
-
case 2:
|
|
52
|
-
return "contract_call";
|
|
53
|
-
case 3:
|
|
54
|
-
return "poison_microblock";
|
|
55
|
-
case 4:
|
|
56
|
-
return "coinbase";
|
|
57
|
-
case 5:
|
|
58
|
-
return "coinbase";
|
|
59
|
-
case 6:
|
|
60
|
-
return "smart_contract";
|
|
61
|
-
case 7:
|
|
62
|
-
return "tenure_change";
|
|
63
|
-
case 8:
|
|
64
|
-
return "coinbase";
|
|
65
|
-
default:
|
|
66
|
-
return "token_transfer";
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function mapTxStatus(status) {
|
|
70
|
-
switch (status) {
|
|
71
|
-
case 1:
|
|
72
|
-
return "success";
|
|
73
|
-
case -1:
|
|
74
|
-
return "abort_by_response";
|
|
75
|
-
case -2:
|
|
76
|
-
return "abort_by_post_condition";
|
|
77
|
-
default:
|
|
78
|
-
throw new Error(`unmapped Hiro tx status ${status}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
class HiroPgClient {
|
|
83
|
-
sql;
|
|
84
|
-
constructor(connectionUrl) {
|
|
85
|
-
const url = connectionUrl || process.env.HIRO_PG_URL;
|
|
86
|
-
if (!url)
|
|
87
|
-
throw new Error("HIRO_PG_URL is required for HiroPgClient");
|
|
88
|
-
this.sql = postgres(url, {
|
|
89
|
-
max: 10,
|
|
90
|
-
idle_timeout: 30
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
async getChainTip() {
|
|
94
|
-
const rows = await this.sql`
|
|
95
|
-
SELECT MAX(block_height) as tip FROM ${this.sql(SCHEMA)}.blocks WHERE canonical = true
|
|
96
|
-
`;
|
|
97
|
-
return Number(rows[0]?.tip ?? 0);
|
|
98
|
-
}
|
|
99
|
-
async getBlockForIndexer(height, options) {
|
|
100
|
-
const blocks = await this.sql`
|
|
101
|
-
SELECT block_hash, block_height, index_block_hash, parent_block_hash,
|
|
102
|
-
parent_index_block_hash, burn_block_hash, burn_block_height,
|
|
103
|
-
burn_block_time, block_time, miner_txid
|
|
104
|
-
FROM ${this.sql(SCHEMA)}.blocks
|
|
105
|
-
WHERE block_height = ${height} AND canonical = true
|
|
106
|
-
LIMIT 1
|
|
107
|
-
`;
|
|
108
|
-
if (blocks.length === 0)
|
|
109
|
-
return null;
|
|
110
|
-
const block = blocks[0];
|
|
111
|
-
const txs = await this.sql`
|
|
112
|
-
SELECT tx_id, tx_index, type_id, status, sender_address, raw_tx, raw_result, event_count,
|
|
113
|
-
contract_call_contract_id, contract_call_function_name, smart_contract_contract_id
|
|
114
|
-
FROM ${this.sql(SCHEMA)}.txs
|
|
115
|
-
WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true
|
|
116
|
-
ORDER BY tx_index
|
|
117
|
-
`;
|
|
118
|
-
const transactions = txs.map((tx) => {
|
|
119
|
-
const txType = mapTxTypeId(tx.type_id);
|
|
120
|
-
const entry = {
|
|
121
|
-
txid: toHex(tx.tx_id),
|
|
122
|
-
raw_tx: options?.includeRawTx ? toHex(tx.raw_tx) : "0x00",
|
|
123
|
-
raw_result: tx.raw_result ? toHex(tx.raw_result) : undefined,
|
|
124
|
-
status: mapTxStatus(tx.status),
|
|
125
|
-
tx_index: tx.tx_index,
|
|
126
|
-
tx_type: txType,
|
|
127
|
-
sender_address: tx.sender_address
|
|
128
|
-
};
|
|
129
|
-
if (txType === "contract_call" && tx.contract_call_contract_id) {
|
|
130
|
-
entry.contract_call = {
|
|
131
|
-
contract_id: tx.contract_call_contract_id,
|
|
132
|
-
function_name: tx.contract_call_function_name || ""
|
|
133
|
-
};
|
|
134
|
-
} else if (txType === "smart_contract" && tx.smart_contract_contract_id) {
|
|
135
|
-
entry.smart_contract = {
|
|
136
|
-
contract_id: tx.smart_contract_contract_id
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return entry;
|
|
140
|
-
});
|
|
141
|
-
const events = [];
|
|
142
|
-
const stxEvents = await this.sql`
|
|
143
|
-
SELECT tx_id, event_index, asset_event_type_id, amount, sender, recipient, memo
|
|
144
|
-
FROM ${this.sql(SCHEMA)}.stx_events
|
|
145
|
-
WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true
|
|
146
|
-
ORDER BY event_index
|
|
147
|
-
`;
|
|
148
|
-
for (const e of stxEvents) {
|
|
149
|
-
const type = stxEventType(e.asset_event_type_id);
|
|
150
|
-
const evt = {
|
|
151
|
-
txid: toHex(e.tx_id),
|
|
152
|
-
event_index: e.event_index,
|
|
153
|
-
committed: true,
|
|
154
|
-
type
|
|
155
|
-
};
|
|
156
|
-
if (type === "stx_transfer_event") {
|
|
157
|
-
evt.stx_transfer_event = {
|
|
158
|
-
sender: e.sender || "",
|
|
159
|
-
recipient: e.recipient || "",
|
|
160
|
-
amount: String(e.amount),
|
|
161
|
-
...e.memo ? { memo: toHex(e.memo) } : {}
|
|
162
|
-
};
|
|
163
|
-
} else if (type === "stx_mint_event") {
|
|
164
|
-
evt.stx_mint_event = {
|
|
165
|
-
recipient: e.recipient || "",
|
|
166
|
-
amount: String(e.amount)
|
|
167
|
-
};
|
|
168
|
-
} else if (type === "stx_burn_event") {
|
|
169
|
-
evt.stx_burn_event = {
|
|
170
|
-
sender: e.sender || "",
|
|
171
|
-
amount: String(e.amount)
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
events.push(evt);
|
|
175
|
-
}
|
|
176
|
-
const lockEvents = await this.sql`
|
|
177
|
-
SELECT tx_id, event_index, locked_amount, unlock_height, locked_address
|
|
178
|
-
FROM ${this.sql(SCHEMA)}.stx_lock_events
|
|
179
|
-
WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true
|
|
180
|
-
ORDER BY event_index
|
|
181
|
-
`;
|
|
182
|
-
for (const e of lockEvents) {
|
|
183
|
-
events.push({
|
|
184
|
-
txid: toHex(e.tx_id),
|
|
185
|
-
event_index: e.event_index,
|
|
186
|
-
committed: true,
|
|
187
|
-
type: "stx_lock_event",
|
|
188
|
-
stx_lock_event: {
|
|
189
|
-
locked_amount: String(e.locked_amount),
|
|
190
|
-
unlock_height: String(e.unlock_height),
|
|
191
|
-
locked_address: e.locked_address
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
const ftEvents = await this.sql`
|
|
196
|
-
SELECT tx_id, event_index, asset_event_type_id, asset_identifier, amount, sender, recipient
|
|
197
|
-
FROM ${this.sql(SCHEMA)}.ft_events
|
|
198
|
-
WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true
|
|
199
|
-
ORDER BY event_index
|
|
200
|
-
`;
|
|
201
|
-
for (const e of ftEvents) {
|
|
202
|
-
const type = ftEventType(e.asset_event_type_id);
|
|
203
|
-
const evt = {
|
|
204
|
-
txid: toHex(e.tx_id),
|
|
205
|
-
event_index: e.event_index,
|
|
206
|
-
committed: true,
|
|
207
|
-
type
|
|
208
|
-
};
|
|
209
|
-
if (type === "ft_transfer_event") {
|
|
210
|
-
evt.ft_transfer_event = {
|
|
211
|
-
asset_identifier: e.asset_identifier,
|
|
212
|
-
sender: e.sender || "",
|
|
213
|
-
recipient: e.recipient || "",
|
|
214
|
-
amount: String(e.amount)
|
|
215
|
-
};
|
|
216
|
-
} else if (type === "ft_mint_event") {
|
|
217
|
-
evt.ft_mint_event = {
|
|
218
|
-
asset_identifier: e.asset_identifier,
|
|
219
|
-
recipient: e.recipient || "",
|
|
220
|
-
amount: String(e.amount)
|
|
221
|
-
};
|
|
222
|
-
} else if (type === "ft_burn_event") {
|
|
223
|
-
evt.ft_burn_event = {
|
|
224
|
-
asset_identifier: e.asset_identifier,
|
|
225
|
-
sender: e.sender || "",
|
|
226
|
-
amount: String(e.amount)
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
events.push(evt);
|
|
230
|
-
}
|
|
231
|
-
const nftEvents = await this.sql`
|
|
232
|
-
SELECT tx_id, event_index, asset_event_type_id, asset_identifier, value, sender, recipient
|
|
233
|
-
FROM ${this.sql(SCHEMA)}.nft_events
|
|
234
|
-
WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true
|
|
235
|
-
ORDER BY event_index
|
|
236
|
-
`;
|
|
237
|
-
for (const e of nftEvents) {
|
|
238
|
-
const type = nftEventType(e.asset_event_type_id);
|
|
239
|
-
const evt = {
|
|
240
|
-
txid: toHex(e.tx_id),
|
|
241
|
-
event_index: e.event_index,
|
|
242
|
-
committed: true,
|
|
243
|
-
type
|
|
244
|
-
};
|
|
245
|
-
const val = toHex(e.value);
|
|
246
|
-
if (type === "nft_transfer_event") {
|
|
247
|
-
evt.nft_transfer_event = {
|
|
248
|
-
asset_identifier: e.asset_identifier,
|
|
249
|
-
sender: e.sender || "",
|
|
250
|
-
recipient: e.recipient || "",
|
|
251
|
-
value: val
|
|
252
|
-
};
|
|
253
|
-
} else if (type === "nft_mint_event") {
|
|
254
|
-
evt.nft_mint_event = {
|
|
255
|
-
asset_identifier: e.asset_identifier,
|
|
256
|
-
recipient: e.recipient || "",
|
|
257
|
-
value: val
|
|
258
|
-
};
|
|
259
|
-
} else if (type === "nft_burn_event") {
|
|
260
|
-
evt.nft_burn_event = {
|
|
261
|
-
asset_identifier: e.asset_identifier,
|
|
262
|
-
sender: e.sender || "",
|
|
263
|
-
value: val
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
events.push(evt);
|
|
267
|
-
}
|
|
268
|
-
const logEvents = await this.sql`
|
|
269
|
-
SELECT tx_id, event_index, contract_identifier, topic, value
|
|
270
|
-
FROM ${this.sql(SCHEMA)}.contract_logs
|
|
271
|
-
WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true
|
|
272
|
-
ORDER BY event_index
|
|
273
|
-
`;
|
|
274
|
-
for (const e of logEvents) {
|
|
275
|
-
events.push({
|
|
276
|
-
txid: toHex(e.tx_id),
|
|
277
|
-
event_index: e.event_index,
|
|
278
|
-
committed: true,
|
|
279
|
-
type: "smart_contract_event",
|
|
280
|
-
smart_contract_event: {
|
|
281
|
-
contract_identifier: e.contract_identifier,
|
|
282
|
-
topic: e.topic,
|
|
283
|
-
value: toHex(e.value)
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
return {
|
|
288
|
-
block_hash: toHex(block.block_hash),
|
|
289
|
-
block_height: block.block_height,
|
|
290
|
-
index_block_hash: toHex(block.index_block_hash),
|
|
291
|
-
parent_block_hash: toHex(block.parent_block_hash),
|
|
292
|
-
parent_index_block_hash: toHex(block.parent_index_block_hash),
|
|
293
|
-
burn_block_hash: toHex(block.burn_block_hash),
|
|
294
|
-
burn_block_height: block.burn_block_height,
|
|
295
|
-
burn_block_timestamp: block.burn_block_time,
|
|
296
|
-
miner_txid: toHex(block.miner_txid),
|
|
297
|
-
timestamp: block.block_time,
|
|
298
|
-
transactions,
|
|
299
|
-
events
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
async getBlockBatch(heights, options) {
|
|
303
|
-
if (heights.length === 0)
|
|
304
|
-
return [];
|
|
305
|
-
const blocks = await this.sql`
|
|
306
|
-
SELECT block_hash, block_height, index_block_hash, parent_block_hash,
|
|
307
|
-
parent_index_block_hash, burn_block_hash, burn_block_height,
|
|
308
|
-
burn_block_time, block_time, miner_txid
|
|
309
|
-
FROM ${this.sql(SCHEMA)}.blocks
|
|
310
|
-
WHERE block_height = ANY(${heights}) AND canonical = true
|
|
311
|
-
`;
|
|
312
|
-
if (blocks.length === 0)
|
|
313
|
-
return [];
|
|
314
|
-
const blockMap = new Map;
|
|
315
|
-
for (const b of blocks) {
|
|
316
|
-
blockMap.set(b.block_height, { ...b, transactions: [], events: [] });
|
|
317
|
-
}
|
|
318
|
-
const txs = await this.sql`
|
|
319
|
-
SELECT tx_id, tx_index, type_id, status, sender_address, raw_tx, raw_result, event_count, block_height,
|
|
320
|
-
contract_call_contract_id, contract_call_function_name, smart_contract_contract_id
|
|
321
|
-
FROM ${this.sql(SCHEMA)}.txs
|
|
322
|
-
WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true
|
|
323
|
-
ORDER BY block_height, tx_index
|
|
324
|
-
`;
|
|
325
|
-
for (const tx of txs) {
|
|
326
|
-
const block = blockMap.get(tx.block_height);
|
|
327
|
-
if (!block)
|
|
328
|
-
continue;
|
|
329
|
-
const txType = mapTxTypeId(tx.type_id);
|
|
330
|
-
const entry = {
|
|
331
|
-
txid: toHex(tx.tx_id),
|
|
332
|
-
raw_tx: options?.includeRawTx ? toHex(tx.raw_tx) : "0x00",
|
|
333
|
-
raw_result: tx.raw_result ? toHex(tx.raw_result) : undefined,
|
|
334
|
-
status: mapTxStatus(tx.status),
|
|
335
|
-
tx_index: tx.tx_index,
|
|
336
|
-
tx_type: txType,
|
|
337
|
-
sender_address: tx.sender_address
|
|
338
|
-
};
|
|
339
|
-
if (txType === "contract_call" && tx.contract_call_contract_id) {
|
|
340
|
-
entry.contract_call = {
|
|
341
|
-
contract_id: tx.contract_call_contract_id,
|
|
342
|
-
function_name: tx.contract_call_function_name || ""
|
|
343
|
-
};
|
|
344
|
-
} else if (txType === "smart_contract" && tx.smart_contract_contract_id) {
|
|
345
|
-
entry.smart_contract = { contract_id: tx.smart_contract_contract_id };
|
|
346
|
-
}
|
|
347
|
-
block.transactions.push(entry);
|
|
348
|
-
}
|
|
349
|
-
const stxEvents = await this.sql`
|
|
350
|
-
SELECT tx_id, event_index, asset_event_type_id, amount, sender, recipient, memo, block_height
|
|
351
|
-
FROM ${this.sql(SCHEMA)}.stx_events
|
|
352
|
-
WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true
|
|
353
|
-
`;
|
|
354
|
-
for (const e of stxEvents) {
|
|
355
|
-
const block = blockMap.get(e.block_height);
|
|
356
|
-
if (!block)
|
|
357
|
-
continue;
|
|
358
|
-
const type = stxEventType(e.asset_event_type_id);
|
|
359
|
-
const evt = {
|
|
360
|
-
txid: toHex(e.tx_id),
|
|
361
|
-
event_index: e.event_index,
|
|
362
|
-
committed: true,
|
|
363
|
-
type
|
|
364
|
-
};
|
|
365
|
-
if (type === "stx_transfer_event") {
|
|
366
|
-
evt.stx_transfer_event = {
|
|
367
|
-
sender: e.sender || "",
|
|
368
|
-
recipient: e.recipient || "",
|
|
369
|
-
amount: String(e.amount),
|
|
370
|
-
...e.memo ? { memo: toHex(e.memo) } : {}
|
|
371
|
-
};
|
|
372
|
-
} else if (type === "stx_mint_event") {
|
|
373
|
-
evt.stx_mint_event = {
|
|
374
|
-
recipient: e.recipient || "",
|
|
375
|
-
amount: String(e.amount)
|
|
376
|
-
};
|
|
377
|
-
} else if (type === "stx_burn_event") {
|
|
378
|
-
evt.stx_burn_event = {
|
|
379
|
-
sender: e.sender || "",
|
|
380
|
-
amount: String(e.amount)
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
block.events.push(evt);
|
|
384
|
-
}
|
|
385
|
-
const lockEvents = await this.sql`
|
|
386
|
-
SELECT tx_id, event_index, locked_amount, unlock_height, locked_address, block_height
|
|
387
|
-
FROM ${this.sql(SCHEMA)}.stx_lock_events
|
|
388
|
-
WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true
|
|
389
|
-
`;
|
|
390
|
-
for (const e of lockEvents) {
|
|
391
|
-
const block = blockMap.get(e.block_height);
|
|
392
|
-
if (!block)
|
|
393
|
-
continue;
|
|
394
|
-
block.events.push({
|
|
395
|
-
txid: toHex(e.tx_id),
|
|
396
|
-
event_index: e.event_index,
|
|
397
|
-
committed: true,
|
|
398
|
-
type: "stx_lock_event",
|
|
399
|
-
stx_lock_event: {
|
|
400
|
-
locked_amount: String(e.locked_amount),
|
|
401
|
-
unlock_height: String(e.unlock_height),
|
|
402
|
-
locked_address: e.locked_address
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
const ftEvents = await this.sql`
|
|
407
|
-
SELECT tx_id, event_index, asset_event_type_id, asset_identifier, amount, sender, recipient, block_height
|
|
408
|
-
FROM ${this.sql(SCHEMA)}.ft_events
|
|
409
|
-
WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true
|
|
410
|
-
`;
|
|
411
|
-
for (const e of ftEvents) {
|
|
412
|
-
const block = blockMap.get(e.block_height);
|
|
413
|
-
if (!block)
|
|
414
|
-
continue;
|
|
415
|
-
const type = ftEventType(e.asset_event_type_id);
|
|
416
|
-
const evt = {
|
|
417
|
-
txid: toHex(e.tx_id),
|
|
418
|
-
event_index: e.event_index,
|
|
419
|
-
committed: true,
|
|
420
|
-
type
|
|
421
|
-
};
|
|
422
|
-
if (type === "ft_transfer_event") {
|
|
423
|
-
evt.ft_transfer_event = {
|
|
424
|
-
asset_identifier: e.asset_identifier,
|
|
425
|
-
sender: e.sender || "",
|
|
426
|
-
recipient: e.recipient || "",
|
|
427
|
-
amount: String(e.amount)
|
|
428
|
-
};
|
|
429
|
-
} else if (type === "ft_mint_event") {
|
|
430
|
-
evt.ft_mint_event = {
|
|
431
|
-
asset_identifier: e.asset_identifier,
|
|
432
|
-
recipient: e.recipient || "",
|
|
433
|
-
amount: String(e.amount)
|
|
434
|
-
};
|
|
435
|
-
} else if (type === "ft_burn_event") {
|
|
436
|
-
evt.ft_burn_event = {
|
|
437
|
-
asset_identifier: e.asset_identifier,
|
|
438
|
-
sender: e.sender || "",
|
|
439
|
-
amount: String(e.amount)
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
block.events.push(evt);
|
|
443
|
-
}
|
|
444
|
-
const nftEvents = await this.sql`
|
|
445
|
-
SELECT tx_id, event_index, asset_event_type_id, asset_identifier, value, sender, recipient, block_height
|
|
446
|
-
FROM ${this.sql(SCHEMA)}.nft_events
|
|
447
|
-
WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true
|
|
448
|
-
`;
|
|
449
|
-
for (const e of nftEvents) {
|
|
450
|
-
const block = blockMap.get(e.block_height);
|
|
451
|
-
if (!block)
|
|
452
|
-
continue;
|
|
453
|
-
const type = nftEventType(e.asset_event_type_id);
|
|
454
|
-
const evt = {
|
|
455
|
-
txid: toHex(e.tx_id),
|
|
456
|
-
event_index: e.event_index,
|
|
457
|
-
committed: true,
|
|
458
|
-
type
|
|
459
|
-
};
|
|
460
|
-
const val = toHex(e.value);
|
|
461
|
-
if (type === "nft_transfer_event") {
|
|
462
|
-
evt.nft_transfer_event = {
|
|
463
|
-
asset_identifier: e.asset_identifier,
|
|
464
|
-
sender: e.sender || "",
|
|
465
|
-
recipient: e.recipient || "",
|
|
466
|
-
value: val
|
|
467
|
-
};
|
|
468
|
-
} else if (type === "nft_mint_event") {
|
|
469
|
-
evt.nft_mint_event = {
|
|
470
|
-
asset_identifier: e.asset_identifier,
|
|
471
|
-
recipient: e.recipient || "",
|
|
472
|
-
value: val
|
|
473
|
-
};
|
|
474
|
-
} else if (type === "nft_burn_event") {
|
|
475
|
-
evt.nft_burn_event = {
|
|
476
|
-
asset_identifier: e.asset_identifier,
|
|
477
|
-
sender: e.sender || "",
|
|
478
|
-
value: val
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
block.events.push(evt);
|
|
482
|
-
}
|
|
483
|
-
const logEvents = await this.sql`
|
|
484
|
-
SELECT tx_id, event_index, contract_identifier, topic, value, block_height
|
|
485
|
-
FROM ${this.sql(SCHEMA)}.contract_logs
|
|
486
|
-
WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true
|
|
487
|
-
`;
|
|
488
|
-
for (const e of logEvents) {
|
|
489
|
-
const block = blockMap.get(e.block_height);
|
|
490
|
-
if (!block)
|
|
491
|
-
continue;
|
|
492
|
-
block.events.push({
|
|
493
|
-
txid: toHex(e.tx_id),
|
|
494
|
-
event_index: e.event_index,
|
|
495
|
-
committed: true,
|
|
496
|
-
type: "smart_contract_event",
|
|
497
|
-
smart_contract_event: {
|
|
498
|
-
contract_identifier: e.contract_identifier,
|
|
499
|
-
topic: e.topic,
|
|
500
|
-
value: toHex(e.value)
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
return heights.filter((h) => blockMap.has(h)).map((h) => {
|
|
505
|
-
const b = blockMap.get(h);
|
|
506
|
-
return {
|
|
507
|
-
block_hash: toHex(b.block_hash),
|
|
508
|
-
block_height: b.block_height,
|
|
509
|
-
index_block_hash: toHex(b.index_block_hash),
|
|
510
|
-
parent_block_hash: toHex(b.parent_block_hash),
|
|
511
|
-
parent_index_block_hash: toHex(b.parent_index_block_hash),
|
|
512
|
-
burn_block_hash: toHex(b.burn_block_hash),
|
|
513
|
-
burn_block_height: b.burn_block_height,
|
|
514
|
-
burn_block_timestamp: b.burn_block_time,
|
|
515
|
-
miner_txid: toHex(b.miner_txid),
|
|
516
|
-
timestamp: b.block_time,
|
|
517
|
-
transactions: b.transactions,
|
|
518
|
-
events: b.events
|
|
519
|
-
};
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
async close() {
|
|
523
|
-
await this.sql.end();
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
export {
|
|
527
|
-
HiroPgClient,
|
|
528
|
-
mapTxStatus
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
//# debugId=73B240F5BDF2DABC64756E2164756E21
|
|
532
|
-
//# sourceMappingURL=hiro-pg-client.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/node/hiro-pg-client.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Direct Postgres client for reading from a local Hiro API database.\n *\n * Bypasses the Hiro HTTP API entirely — queries the stacks_blockchain_api\n * schema directly. Orders of magnitude faster for bulk backfill since we\n * avoid per-tx HTTP round-trips and the API's slow UNION event queries.\n *\n * Expects HIRO_PG_URL env var pointing to the Hiro API database, e.g.:\n * postgres://secondlayer:pass@localhost:5432/stacks_blockchain_api\n */\n\nimport postgres from \"postgres\";\n\nconst SCHEMA = \"stacks_blockchain_api\";\n\n// Hiro DB stores bytea; we need 0x-prefixed hex strings\nfunction toHex(buf: Buffer | Uint8Array | null): string {\n\tif (!buf) return \"0x\";\n\treturn `0x${Buffer.from(buf).toString(\"hex\")}`;\n}\n\n// asset_event_type_id mapping: 1=transfer, 2=mint, 3=burn\nfunction stxEventType(assetTypeId: number): string {\n\tswitch (assetTypeId) {\n\t\tcase 1:\n\t\t\treturn \"stx_transfer_event\";\n\t\tcase 2:\n\t\t\treturn \"stx_mint_event\";\n\t\tcase 3:\n\t\t\treturn \"stx_burn_event\";\n\t\tdefault:\n\t\t\treturn \"stx_transfer_event\";\n\t}\n}\n\nfunction ftEventType(assetTypeId: number): string {\n\tswitch (assetTypeId) {\n\t\tcase 1:\n\t\t\treturn \"ft_transfer_event\";\n\t\tcase 2:\n\t\t\treturn \"ft_mint_event\";\n\t\tcase 3:\n\t\t\treturn \"ft_burn_event\";\n\t\tdefault:\n\t\t\treturn \"ft_transfer_event\";\n\t}\n}\n\nfunction nftEventType(assetTypeId: number): string {\n\tswitch (assetTypeId) {\n\t\tcase 1:\n\t\t\treturn \"nft_transfer_event\";\n\t\tcase 2:\n\t\t\treturn \"nft_mint_event\";\n\t\tcase 3:\n\t\t\treturn \"nft_burn_event\";\n\t\tdefault:\n\t\t\treturn \"nft_transfer_event\";\n\t}\n}\n\n// Hiro tx type_id mapping\nfunction mapTxTypeId(typeId: number): string {\n\tswitch (typeId) {\n\t\tcase 0:\n\t\t\treturn \"token_transfer\";\n\t\tcase 1:\n\t\t\treturn \"smart_contract\";\n\t\tcase 2:\n\t\t\treturn \"contract_call\";\n\t\tcase 3:\n\t\t\treturn \"poison_microblock\";\n\t\tcase 4:\n\t\t\treturn \"coinbase\";\n\t\tcase 5:\n\t\t\treturn \"coinbase\"; // coinbase-pay-to-alt\n\t\tcase 6:\n\t\t\treturn \"smart_contract\"; // versioned\n\t\tcase 7:\n\t\t\treturn \"tenure_change\";\n\t\tcase 8:\n\t\t\treturn \"coinbase\"; // nakamoto coinbase\n\t\tdefault:\n\t\t\treturn \"token_transfer\";\n\t}\n}\n\n/**\n * Hiro `DbTxStatus` → our tx status. Codes from stacks-blockchain-api\n * src/datastore/common.ts: 1 success, -1 abort_by_response,\n * -2 abort_by_post_condition. Anything else (0 pending, -3 problematic\n * skipped, -10.. dropped) is not a mined result we can label, so throw\n * rather than guess.\n */\nexport function mapTxStatus(status: number): string {\n\tswitch (status) {\n\t\tcase 1:\n\t\t\treturn \"success\";\n\t\tcase -1:\n\t\t\treturn \"abort_by_response\";\n\t\tcase -2:\n\t\t\treturn \"abort_by_post_condition\";\n\t\tdefault:\n\t\t\tthrow new Error(`unmapped Hiro tx status ${status}`);\n\t}\n}\n\ninterface BlockRow {\n\tblock_hash: Buffer;\n\tblock_height: number;\n\tindex_block_hash: Buffer;\n\tparent_block_hash: Buffer;\n\tparent_index_block_hash: Buffer;\n\tburn_block_hash: Buffer;\n\tburn_block_height: number;\n\tburn_block_time: number;\n\tblock_time: number;\n\tminer_txid: Buffer;\n}\n\ninterface TxRow {\n\ttx_id: Buffer;\n\ttx_index: number;\n\ttype_id: number;\n\tstatus: number;\n\tsender_address: string;\n\traw_tx: Buffer;\n\traw_result: Buffer | null;\n\tevent_count: number;\n\tcontract_call_contract_id: string | null;\n\tcontract_call_function_name: string | null;\n\tsmart_contract_contract_id: string | null;\n}\n\nexport class HiroPgClient {\n\tprivate sql: ReturnType<typeof postgres>;\n\n\tconstructor(connectionUrl?: string) {\n\t\tconst url = connectionUrl || process.env.HIRO_PG_URL;\n\t\tif (!url) throw new Error(\"HIRO_PG_URL is required for HiroPgClient\");\n\t\tthis.sql = postgres(url, {\n\t\t\tmax: 10,\n\t\t\tidle_timeout: 30,\n\t\t});\n\t}\n\n\tasync getChainTip(): Promise<number> {\n\t\tconst rows = await this.sql`\n SELECT MAX(block_height) as tip FROM ${this.sql(SCHEMA)}.blocks WHERE canonical = true\n `;\n\t\treturn Number(rows[0]?.tip ?? 0);\n\t}\n\n\t/**\n\t * Fetch a complete block by height directly from PG.\n\t * Returns data in the same NewBlockPayload shape the backfill expects.\n\t */\n\tasync getBlockForIndexer(\n\t\theight: number,\n\t\toptions?: { includeRawTx?: boolean },\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t): Promise<any | null> {\n\t\t// 1. Block metadata\n\t\tconst blocks = await this.sql<BlockRow[]>`\n SELECT block_hash, block_height, index_block_hash, parent_block_hash,\n parent_index_block_hash, burn_block_hash, burn_block_height,\n burn_block_time, block_time, miner_txid\n FROM ${this.sql(SCHEMA)}.blocks\n WHERE block_height = ${height} AND canonical = true\n LIMIT 1\n `;\n\t\tif (blocks.length === 0) return null;\n\t\tconst block = blocks[0];\n\n\t\t// 2. Transactions\n\t\tconst txs = await this.sql<TxRow[]>`\n SELECT tx_id, tx_index, type_id, status, sender_address, raw_tx, raw_result, event_count,\n contract_call_contract_id, contract_call_function_name, smart_contract_contract_id\n FROM ${this.sql(SCHEMA)}.txs\n WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true\n ORDER BY tx_index\n `;\n\n\t\tconst transactions = txs.map((tx) => {\n\t\t\tconst txType = mapTxTypeId(tx.type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst entry: any = {\n\t\t\t\ttxid: toHex(tx.tx_id),\n\t\t\t\traw_tx: options?.includeRawTx ? toHex(tx.raw_tx) : \"0x00\",\n\t\t\t\traw_result: tx.raw_result ? toHex(tx.raw_result) : undefined,\n\t\t\t\tstatus: mapTxStatus(tx.status),\n\t\t\t\ttx_index: tx.tx_index,\n\t\t\t\ttx_type: txType,\n\t\t\t\tsender_address: tx.sender_address,\n\t\t\t};\n\t\t\tif (txType === \"contract_call\" && tx.contract_call_contract_id) {\n\t\t\t\tentry.contract_call = {\n\t\t\t\t\tcontract_id: tx.contract_call_contract_id,\n\t\t\t\t\tfunction_name: tx.contract_call_function_name || \"\",\n\t\t\t\t};\n\t\t\t} else if (txType === \"smart_contract\" && tx.smart_contract_contract_id) {\n\t\t\t\tentry.smart_contract = {\n\t\t\t\t\tcontract_id: tx.smart_contract_contract_id,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn entry;\n\t\t});\n\n\t\t// 3. Events — query all event tables by block_height (fast, indexed)\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\tconst events: any[] = [];\n\n\t\t// STX events\n\t\tconst stxEvents = await this.sql`\n SELECT tx_id, event_index, asset_event_type_id, amount, sender, recipient, memo\n FROM ${this.sql(SCHEMA)}.stx_events\n WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true\n ORDER BY event_index\n `;\n\t\tfor (const e of stxEvents) {\n\t\t\tconst type = stxEventType(e.asset_event_type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst evt: any = {\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype,\n\t\t\t};\n\t\t\tif (type === \"stx_transfer_event\") {\n\t\t\t\tevt.stx_transfer_event = {\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t\t...(e.memo ? { memo: toHex(e.memo) } : {}),\n\t\t\t\t};\n\t\t\t} else if (type === \"stx_mint_event\") {\n\t\t\t\tevt.stx_mint_event = {\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t} else if (type === \"stx_burn_event\") {\n\t\t\t\tevt.stx_burn_event = {\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t}\n\t\t\tevents.push(evt);\n\t\t}\n\n\t\t// STX lock events\n\t\tconst lockEvents = await this.sql`\n SELECT tx_id, event_index, locked_amount, unlock_height, locked_address\n FROM ${this.sql(SCHEMA)}.stx_lock_events\n WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true\n ORDER BY event_index\n `;\n\t\tfor (const e of lockEvents) {\n\t\t\tevents.push({\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype: \"stx_lock_event\",\n\t\t\t\tstx_lock_event: {\n\t\t\t\t\tlocked_amount: String(e.locked_amount),\n\t\t\t\t\tunlock_height: String(e.unlock_height),\n\t\t\t\t\tlocked_address: e.locked_address,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// FT events\n\t\tconst ftEvents = await this.sql`\n SELECT tx_id, event_index, asset_event_type_id, asset_identifier, amount, sender, recipient\n FROM ${this.sql(SCHEMA)}.ft_events\n WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true\n ORDER BY event_index\n `;\n\t\tfor (const e of ftEvents) {\n\t\t\tconst type = ftEventType(e.asset_event_type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst evt: any = {\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype,\n\t\t\t};\n\t\t\tif (type === \"ft_transfer_event\") {\n\t\t\t\tevt.ft_transfer_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t} else if (type === \"ft_mint_event\") {\n\t\t\t\tevt.ft_mint_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t} else if (type === \"ft_burn_event\") {\n\t\t\t\tevt.ft_burn_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t}\n\t\t\tevents.push(evt);\n\t\t}\n\n\t\t// NFT events\n\t\tconst nftEvents = await this.sql`\n SELECT tx_id, event_index, asset_event_type_id, asset_identifier, value, sender, recipient\n FROM ${this.sql(SCHEMA)}.nft_events\n WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true\n ORDER BY event_index\n `;\n\t\tfor (const e of nftEvents) {\n\t\t\tconst type = nftEventType(e.asset_event_type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst evt: any = {\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype,\n\t\t\t};\n\t\t\tconst val = toHex(e.value);\n\t\t\tif (type === \"nft_transfer_event\") {\n\t\t\t\tevt.nft_transfer_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tvalue: val,\n\t\t\t\t};\n\t\t\t} else if (type === \"nft_mint_event\") {\n\t\t\t\tevt.nft_mint_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tvalue: val,\n\t\t\t\t};\n\t\t\t} else if (type === \"nft_burn_event\") {\n\t\t\t\tevt.nft_burn_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\tvalue: val,\n\t\t\t\t};\n\t\t\t}\n\t\t\tevents.push(evt);\n\t\t}\n\n\t\t// Contract log events\n\t\tconst logEvents = await this.sql`\n SELECT tx_id, event_index, contract_identifier, topic, value\n FROM ${this.sql(SCHEMA)}.contract_logs\n WHERE block_height = ${height} AND canonical = true AND microblock_canonical = true\n ORDER BY event_index\n `;\n\t\tfor (const e of logEvents) {\n\t\t\tevents.push({\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype: \"smart_contract_event\",\n\t\t\t\tsmart_contract_event: {\n\t\t\t\t\tcontract_identifier: e.contract_identifier,\n\t\t\t\t\ttopic: e.topic,\n\t\t\t\t\tvalue: toHex(e.value),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tblock_hash: toHex(block.block_hash),\n\t\t\tblock_height: block.block_height,\n\t\t\tindex_block_hash: toHex(block.index_block_hash),\n\t\t\tparent_block_hash: toHex(block.parent_block_hash),\n\t\t\tparent_index_block_hash: toHex(block.parent_index_block_hash),\n\t\t\tburn_block_hash: toHex(block.burn_block_hash),\n\t\t\tburn_block_height: block.burn_block_height,\n\t\t\tburn_block_timestamp: block.burn_block_time,\n\t\t\tminer_txid: toHex(block.miner_txid),\n\t\t\ttimestamp: block.block_time,\n\t\t\ttransactions,\n\t\t\tevents,\n\t\t};\n\t}\n\n\t/**\n\t * Fetch multiple blocks in bulk — 6 queries total instead of 6 per block.\n\t * Returns array of NewBlockPayload in height order.\n\t */\n\tasync getBlockBatch(\n\t\theights: number[],\n\t\toptions?: { includeRawTx?: boolean },\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t): Promise<any[]> {\n\t\tif (heights.length === 0) return [];\n\n\t\t// 1. All blocks in range\n\t\tconst blocks = await this.sql`\n SELECT block_hash, block_height, index_block_hash, parent_block_hash,\n parent_index_block_hash, burn_block_hash, burn_block_height,\n burn_block_time, block_time, miner_txid\n FROM ${this.sql(SCHEMA)}.blocks\n WHERE block_height = ANY(${heights}) AND canonical = true\n `;\n\n\t\tif (blocks.length === 0) return [];\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\tconst blockMap = new Map<number, any>();\n\t\tfor (const b of blocks) {\n\t\t\tblockMap.set(b.block_height, { ...b, transactions: [], events: [] });\n\t\t}\n\n\t\t// 2. All transactions\n\t\tconst txs = await this.sql`\n SELECT tx_id, tx_index, type_id, status, sender_address, raw_tx, raw_result, event_count, block_height,\n contract_call_contract_id, contract_call_function_name, smart_contract_contract_id\n FROM ${this.sql(SCHEMA)}.txs\n WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true\n ORDER BY block_height, tx_index\n `;\n\t\tfor (const tx of txs) {\n\t\t\tconst block = blockMap.get(tx.block_height);\n\t\t\tif (!block) continue;\n\t\t\tconst txType = mapTxTypeId(tx.type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst entry: any = {\n\t\t\t\ttxid: toHex(tx.tx_id),\n\t\t\t\traw_tx: options?.includeRawTx ? toHex(tx.raw_tx) : \"0x00\",\n\t\t\t\traw_result: tx.raw_result ? toHex(tx.raw_result) : undefined,\n\t\t\t\tstatus: mapTxStatus(tx.status),\n\t\t\t\ttx_index: tx.tx_index,\n\t\t\t\ttx_type: txType,\n\t\t\t\tsender_address: tx.sender_address,\n\t\t\t};\n\t\t\tif (txType === \"contract_call\" && tx.contract_call_contract_id) {\n\t\t\t\tentry.contract_call = {\n\t\t\t\t\tcontract_id: tx.contract_call_contract_id,\n\t\t\t\t\tfunction_name: tx.contract_call_function_name || \"\",\n\t\t\t\t};\n\t\t\t} else if (txType === \"smart_contract\" && tx.smart_contract_contract_id) {\n\t\t\t\tentry.smart_contract = { contract_id: tx.smart_contract_contract_id };\n\t\t\t}\n\t\t\tblock.transactions.push(entry);\n\t\t}\n\n\t\t// 3. STX events\n\t\tconst stxEvents = await this.sql`\n SELECT tx_id, event_index, asset_event_type_id, amount, sender, recipient, memo, block_height\n FROM ${this.sql(SCHEMA)}.stx_events\n WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true\n `;\n\t\tfor (const e of stxEvents) {\n\t\t\tconst block = blockMap.get(e.block_height);\n\t\t\tif (!block) continue;\n\t\t\tconst type = stxEventType(e.asset_event_type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst evt: any = {\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype,\n\t\t\t};\n\t\t\tif (type === \"stx_transfer_event\") {\n\t\t\t\tevt.stx_transfer_event = {\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t\t...(e.memo ? { memo: toHex(e.memo) } : {}),\n\t\t\t\t};\n\t\t\t} else if (type === \"stx_mint_event\") {\n\t\t\t\tevt.stx_mint_event = {\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t} else if (type === \"stx_burn_event\") {\n\t\t\t\tevt.stx_burn_event = {\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t}\n\t\t\tblock.events.push(evt);\n\t\t}\n\n\t\t// 4. STX lock events\n\t\tconst lockEvents = await this.sql`\n SELECT tx_id, event_index, locked_amount, unlock_height, locked_address, block_height\n FROM ${this.sql(SCHEMA)}.stx_lock_events\n WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true\n `;\n\t\tfor (const e of lockEvents) {\n\t\t\tconst block = blockMap.get(e.block_height);\n\t\t\tif (!block) continue;\n\t\t\tblock.events.push({\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype: \"stx_lock_event\",\n\t\t\t\tstx_lock_event: {\n\t\t\t\t\tlocked_amount: String(e.locked_amount),\n\t\t\t\t\tunlock_height: String(e.unlock_height),\n\t\t\t\t\tlocked_address: e.locked_address,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// 5. FT events\n\t\tconst ftEvents = await this.sql`\n SELECT tx_id, event_index, asset_event_type_id, asset_identifier, amount, sender, recipient, block_height\n FROM ${this.sql(SCHEMA)}.ft_events\n WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true\n `;\n\t\tfor (const e of ftEvents) {\n\t\t\tconst block = blockMap.get(e.block_height);\n\t\t\tif (!block) continue;\n\t\t\tconst type = ftEventType(e.asset_event_type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst evt: any = {\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype,\n\t\t\t};\n\t\t\tif (type === \"ft_transfer_event\") {\n\t\t\t\tevt.ft_transfer_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t} else if (type === \"ft_mint_event\") {\n\t\t\t\tevt.ft_mint_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t} else if (type === \"ft_burn_event\") {\n\t\t\t\tevt.ft_burn_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\tamount: String(e.amount),\n\t\t\t\t};\n\t\t\t}\n\t\t\tblock.events.push(evt);\n\t\t}\n\n\t\t// 6. NFT events\n\t\tconst nftEvents = await this.sql`\n SELECT tx_id, event_index, asset_event_type_id, asset_identifier, value, sender, recipient, block_height\n FROM ${this.sql(SCHEMA)}.nft_events\n WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true\n `;\n\t\tfor (const e of nftEvents) {\n\t\t\tconst block = blockMap.get(e.block_height);\n\t\t\tif (!block) continue;\n\t\t\tconst type = nftEventType(e.asset_event_type_id);\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\tconst evt: any = {\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype,\n\t\t\t};\n\t\t\tconst val = toHex(e.value);\n\t\t\tif (type === \"nft_transfer_event\") {\n\t\t\t\tevt.nft_transfer_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tvalue: val,\n\t\t\t\t};\n\t\t\t} else if (type === \"nft_mint_event\") {\n\t\t\t\tevt.nft_mint_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\trecipient: e.recipient || \"\",\n\t\t\t\t\tvalue: val,\n\t\t\t\t};\n\t\t\t} else if (type === \"nft_burn_event\") {\n\t\t\t\tevt.nft_burn_event = {\n\t\t\t\t\tasset_identifier: e.asset_identifier,\n\t\t\t\t\tsender: e.sender || \"\",\n\t\t\t\t\tvalue: val,\n\t\t\t\t};\n\t\t\t}\n\t\t\tblock.events.push(evt);\n\t\t}\n\n\t\t// 7. Contract log events\n\t\tconst logEvents = await this.sql`\n SELECT tx_id, event_index, contract_identifier, topic, value, block_height\n FROM ${this.sql(SCHEMA)}.contract_logs\n WHERE block_height = ANY(${heights}) AND canonical = true AND microblock_canonical = true\n `;\n\t\tfor (const e of logEvents) {\n\t\t\tconst block = blockMap.get(e.block_height);\n\t\t\tif (!block) continue;\n\t\t\tblock.events.push({\n\t\t\t\ttxid: toHex(e.tx_id),\n\t\t\t\tevent_index: e.event_index,\n\t\t\t\tcommitted: true,\n\t\t\t\ttype: \"smart_contract_event\",\n\t\t\t\tsmart_contract_event: {\n\t\t\t\t\tcontract_identifier: e.contract_identifier,\n\t\t\t\t\ttopic: e.topic,\n\t\t\t\t\tvalue: toHex(e.value),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Build results in height order\n\t\treturn heights\n\t\t\t.filter((h) => blockMap.has(h))\n\t\t\t.map((h) => {\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: value is non-null after preceding check or by construction; TS narrowing limitation\n\t\t\t\tconst b = blockMap.get(h)!;\n\t\t\t\treturn {\n\t\t\t\t\tblock_hash: toHex(b.block_hash),\n\t\t\t\t\tblock_height: b.block_height,\n\t\t\t\t\tindex_block_hash: toHex(b.index_block_hash),\n\t\t\t\t\tparent_block_hash: toHex(b.parent_block_hash),\n\t\t\t\t\tparent_index_block_hash: toHex(b.parent_index_block_hash),\n\t\t\t\t\tburn_block_hash: toHex(b.burn_block_hash),\n\t\t\t\t\tburn_block_height: b.burn_block_height,\n\t\t\t\t\tburn_block_timestamp: b.burn_block_time,\n\t\t\t\t\tminer_txid: toHex(b.miner_txid),\n\t\t\t\t\ttimestamp: b.block_time,\n\t\t\t\t\ttransactions: b.transactions,\n\t\t\t\t\tevents: b.events,\n\t\t\t\t};\n\t\t\t});\n\t}\n\n\tasync close(): Promise<void> {\n\t\tawait this.sql.end();\n\t}\n}\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";AAWA;AAEA,IAAM,SAAS;AAGf,SAAS,KAAK,CAAC,KAAyC;AAAA,EACvD,IAAI,CAAC;AAAA,IAAK,OAAO;AAAA,EACjB,OAAO,KAAK,OAAO,KAAK,GAAG,EAAE,SAAS,KAAK;AAAA;AAI5C,SAAS,YAAY,CAAC,aAA6B;AAAA,EAClD,QAAQ;AAAA,SACF;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO;AAAA;AAAA,MAEP,OAAO;AAAA;AAAA;AAIV,SAAS,WAAW,CAAC,aAA6B;AAAA,EACjD,QAAQ;AAAA,SACF;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO;AAAA;AAAA,MAEP,OA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