@secondlayer/shared 16.0.0 → 17.1.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/dist/src/archive/range-digest.d.ts +0 -36
- package/dist/src/archive/semantic-digest-builder.d.ts +0 -36
- package/dist/src/classify/index.js +1 -4
- package/dist/src/classify/index.js.map +3 -3
- package/dist/src/coverage/index.d.ts +0 -36
- package/dist/src/crypto/secondlayer-webhook.js +1 -4
- package/dist/src/crypto/secondlayer-webhook.js.map +3 -3
- package/dist/src/db/index.d.ts +1 -151
- package/dist/src/db/index.js +1 -70
- package/dist/src/db/index.js.map +6 -6
- package/dist/src/db/queries/chain-reorgs.d.ts +0 -36
- package/dist/src/db/queries/chain-reorgs.js +1 -70
- package/dist/src/db/queries/chain-reorgs.js.map +6 -6
- package/dist/src/db/queries/contracts.d.ts +0 -36
- package/dist/src/db/queries/contracts.js.map +2 -2
- package/dist/src/db/queries/instance.d.ts +0 -36
- package/dist/src/db/queries/instance.js +1 -4
- package/dist/src/db/queries/instance.js.map +3 -3
- package/dist/src/db/queries/integrity.d.ts +0 -36
- package/dist/src/db/queries/integrity.js +1 -4
- package/dist/src/db/queries/integrity.js.map +3 -3
- package/dist/src/db/queries/subgraph-gaps.d.ts +0 -36
- package/dist/src/db/queries/subgraph-operations.d.ts +0 -36
- package/dist/src/db/queries/subgraphs.d.ts +0 -36
- package/dist/src/db/queries/sync-scope.d.ts +0 -36
- package/dist/src/db/queries/webhook-replays.d.ts +0 -36
- package/dist/src/db/queries/webhooks.d.ts +0 -36
- package/dist/src/db/schema.d.ts +1 -37
- package/dist/src/db/schema.js.map +2 -2
- package/dist/src/email/index.js +1 -4
- package/dist/src/email/index.js.map +3 -3
- package/dist/src/env.d.ts +2 -8
- package/dist/src/env.js +1 -5
- package/dist/src/env.js.map +3 -3
- package/dist/src/index.d.ts +19 -158
- package/dist/src/index.js +51 -77
- package/dist/src/index.js.map +10 -8
- package/dist/src/insights/index.d.ts +0 -36
- package/dist/src/insights/index.js +1 -4
- package/dist/src/insights/index.js.map +3 -3
- package/dist/src/leader.js +1 -70
- package/dist/src/leader.js.map +6 -6
- package/dist/src/logger.js +1 -4
- package/dist/src/logger.js.map +3 -3
- package/dist/src/node/local-client.d.ts +0 -36
- package/dist/src/node/tx-summary.d.ts +7 -1
- package/dist/src/node/tx-summary.js +17 -5
- package/dist/src/node/tx-summary.js.map +4 -4
- package/dist/src/queue/listener.js +1 -70
- package/dist/src/queue/listener.js.map +6 -6
- package/dist/src/runtime/index.js +1 -2
- package/dist/src/runtime/index.js.map +3 -3
- package/dist/src/schemas/index.js +28 -7
- package/dist/src/schemas/index.js.map +5 -4
- package/dist/src/schemas/webhooks.js +28 -7
- package/dist/src/schemas/webhooks.js.map +5 -4
- package/dist/src/streams-rows/index.d.ts +35 -12
- package/dist/src/streams-rows/index.js +25 -21
- package/dist/src/streams-rows/index.js.map +5 -5
- package/migrations/0206_drop_pox4_calls.ts +32 -0
- package/migrations/0207_bns_buy_listing_price.ts +39 -0
- package/migrations/0208_pox5_calculate_rewards_cycle.ts +31 -0
- package/migrations/0209_chain_reorgs_index_block_hash.ts +51 -0
- package/migrations/0210_mempool_evict_superseded_nonces.ts +71 -0
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -166,9 +166,6 @@ function stacksNetwork(env = process.env) {
|
|
|
166
166
|
function isProductionEnv() {
|
|
167
167
|
return process.env["NODE_ENV"] === "production";
|
|
168
168
|
}
|
|
169
|
-
function isPox4DecoderEnabled(env = process.env) {
|
|
170
|
-
return env.POX4_DECODER_ENABLED !== "false";
|
|
171
|
-
}
|
|
172
169
|
function isPox5DecoderEnabled(env = process.env) {
|
|
173
170
|
return env.POX5_DECODER_ENABLED !== "false";
|
|
174
171
|
}
|
|
@@ -381,38 +378,6 @@ var SOURCE_READ_COLUMNS = {
|
|
|
381
378
|
"tx_id",
|
|
382
379
|
"type"
|
|
383
380
|
],
|
|
384
|
-
pox4_calls: [
|
|
385
|
-
"aggregated_amount_ustx",
|
|
386
|
-
"aggregated_signer_index",
|
|
387
|
-
"amount_ustx",
|
|
388
|
-
"auth_allowed",
|
|
389
|
-
"auth_id",
|
|
390
|
-
"auth_period",
|
|
391
|
-
"auth_topic",
|
|
392
|
-
"block_height",
|
|
393
|
-
"block_time",
|
|
394
|
-
"burn_block_height",
|
|
395
|
-
"caller",
|
|
396
|
-
"canonical",
|
|
397
|
-
"cursor",
|
|
398
|
-
"delegate_to",
|
|
399
|
-
"end_cycle",
|
|
400
|
-
"function_name",
|
|
401
|
-
"lock_period",
|
|
402
|
-
"max_amount",
|
|
403
|
-
"pox_addr_btc",
|
|
404
|
-
"pox_addr_hashbytes",
|
|
405
|
-
"pox_addr_version",
|
|
406
|
-
"result_ok",
|
|
407
|
-
"reward_cycle",
|
|
408
|
-
"signer_key",
|
|
409
|
-
"signer_signature",
|
|
410
|
-
"source_cursor",
|
|
411
|
-
"stacker",
|
|
412
|
-
"start_cycle",
|
|
413
|
-
"tx_id",
|
|
414
|
-
"tx_index"
|
|
415
|
-
],
|
|
416
381
|
pox5_events: [
|
|
417
382
|
"amount_sats",
|
|
418
383
|
"amount_ustx",
|
|
@@ -625,38 +590,6 @@ var SOURCE_READ_TYPES = {
|
|
|
625
590
|
tx_id: { type: "text" },
|
|
626
591
|
type: { type: "text" }
|
|
627
592
|
},
|
|
628
|
-
pox4_calls: {
|
|
629
|
-
aggregated_amount_ustx: { type: "text", nullable: true },
|
|
630
|
-
aggregated_signer_index: { type: "int", nullable: true },
|
|
631
|
-
amount_ustx: { type: "text", nullable: true },
|
|
632
|
-
auth_allowed: { type: "boolean", nullable: true },
|
|
633
|
-
auth_id: { type: "text", nullable: true },
|
|
634
|
-
auth_period: { type: "int", nullable: true },
|
|
635
|
-
auth_topic: { type: "text", nullable: true },
|
|
636
|
-
block_height: { type: "int" },
|
|
637
|
-
block_time: { type: "timestamp" },
|
|
638
|
-
burn_block_height: { type: "int" },
|
|
639
|
-
caller: { type: "text" },
|
|
640
|
-
canonical: { type: "boolean" },
|
|
641
|
-
cursor: { type: "text" },
|
|
642
|
-
delegate_to: { type: "text", nullable: true },
|
|
643
|
-
end_cycle: { type: "int", nullable: true },
|
|
644
|
-
function_name: { type: "text" },
|
|
645
|
-
lock_period: { type: "int", nullable: true },
|
|
646
|
-
max_amount: { type: "text", nullable: true },
|
|
647
|
-
pox_addr_btc: { type: "text", nullable: true },
|
|
648
|
-
pox_addr_hashbytes: { type: "text", nullable: true },
|
|
649
|
-
pox_addr_version: { type: "int", nullable: true },
|
|
650
|
-
result_ok: { type: "boolean" },
|
|
651
|
-
reward_cycle: { type: "int", nullable: true },
|
|
652
|
-
signer_key: { type: "text", nullable: true },
|
|
653
|
-
signer_signature: { type: "text", nullable: true },
|
|
654
|
-
source_cursor: { type: "text" },
|
|
655
|
-
stacker: { type: "text", nullable: true },
|
|
656
|
-
start_cycle: { type: "int", nullable: true },
|
|
657
|
-
tx_id: { type: "text" },
|
|
658
|
-
tx_index: { type: "int" }
|
|
659
|
-
},
|
|
660
593
|
pox5_events: {
|
|
661
594
|
amount_sats: { type: "text", nullable: true },
|
|
662
595
|
amount_ustx: { type: "text", nullable: true },
|
|
@@ -831,7 +764,6 @@ var SOURCE_READ_PKS = {
|
|
|
831
764
|
decoded_events: ["cursor"],
|
|
832
765
|
transactions: ["tx_id"],
|
|
833
766
|
mempool_transactions: ["seq"],
|
|
834
|
-
pox4_calls: ["cursor"],
|
|
835
767
|
pox5_events: ["cursor"],
|
|
836
768
|
sbtc_events: ["cursor"],
|
|
837
769
|
sbtc_token_events: ["cursor"],
|
|
@@ -904,7 +836,6 @@ var TABLE_TO_DB = {
|
|
|
904
836
|
stage_failures: "source",
|
|
905
837
|
decoded_events: "source",
|
|
906
838
|
decoder_checkpoints: "source",
|
|
907
|
-
pox4_calls: "source",
|
|
908
839
|
pox5_events: "source",
|
|
909
840
|
pox5_cycles: "source",
|
|
910
841
|
pox5_cycle_signers: "source",
|
|
@@ -1389,6 +1320,34 @@ function blockEndCursor(height) {
|
|
|
1389
1320
|
event_index: EMPTY_RANGE_EVENT_INDEX_SENTINEL
|
|
1390
1321
|
};
|
|
1391
1322
|
}
|
|
1323
|
+
// src/btc-txid.ts
|
|
1324
|
+
var BTC_TXID = /^(?:0x)?[0-9a-f]{64}$/;
|
|
1325
|
+
function normalizeBtcTxid(value) {
|
|
1326
|
+
const v = value.trim().toLowerCase();
|
|
1327
|
+
if (!BTC_TXID.test(v))
|
|
1328
|
+
return null;
|
|
1329
|
+
return v.startsWith("0x") ? v : `0x${v}`;
|
|
1330
|
+
}
|
|
1331
|
+
// src/pox-contracts.ts
|
|
1332
|
+
var BOOT = "SP000000000000000000002Q6VF78";
|
|
1333
|
+
var MAINNET_POX_CONTRACT_ERAS = [
|
|
1334
|
+
{ fromBurnHeight: 0, contractId: `${BOOT}.pox` },
|
|
1335
|
+
{ fromBurnHeight: 781551, contractId: `${BOOT}.pox-2` },
|
|
1336
|
+
{ fromBurnHeight: 789250, contractId: `${BOOT}.pox-3` },
|
|
1337
|
+
{ fromBurnHeight: 840360, contractId: `${BOOT}.pox-4` },
|
|
1338
|
+
{ fromBurnHeight: 960230, contractId: `${BOOT}.pox-5` }
|
|
1339
|
+
];
|
|
1340
|
+
function mainnetPoxContractAt(burnHeight) {
|
|
1341
|
+
let contractId = MAINNET_POX_CONTRACT_ERAS[0].contractId;
|
|
1342
|
+
for (const era of MAINNET_POX_CONTRACT_ERAS) {
|
|
1343
|
+
if (burnHeight >= era.fromBurnHeight)
|
|
1344
|
+
contractId = era.contractId;
|
|
1345
|
+
}
|
|
1346
|
+
return contractId;
|
|
1347
|
+
}
|
|
1348
|
+
function isPoxContractId(contractId) {
|
|
1349
|
+
return /\.pox(-\d+)?$/.test(contractId);
|
|
1350
|
+
}
|
|
1392
1351
|
// src/schemas/subgraphs.ts
|
|
1393
1352
|
import { z as z2 } from "zod";
|
|
1394
1353
|
var DeploySubgraphRequestSchema = z2.object({
|
|
@@ -1654,6 +1613,18 @@ var triggerAmount = z4.union([
|
|
|
1654
1613
|
z4.number().int().nonnegative()
|
|
1655
1614
|
]);
|
|
1656
1615
|
var triggerPattern = z4.string().trim().min(1);
|
|
1616
|
+
var triggerExact = z4.string().trim().min(1);
|
|
1617
|
+
var btcTxid = z4.string().transform((value, ctx) => {
|
|
1618
|
+
const txid = normalizeBtcTxid(value);
|
|
1619
|
+
if (txid === null) {
|
|
1620
|
+
ctx.addIssue({
|
|
1621
|
+
code: "custom",
|
|
1622
|
+
message: "must be a 64-character hex Bitcoin txid (0x optional)"
|
|
1623
|
+
});
|
|
1624
|
+
return z4.NEVER;
|
|
1625
|
+
}
|
|
1626
|
+
return txid;
|
|
1627
|
+
});
|
|
1657
1628
|
var trait = z4.string().trim().min(1);
|
|
1658
1629
|
var printWhereValue = z4.string().min(1).max(256);
|
|
1659
1630
|
var PrintWhereSchema = z4.record(z4.string().trim().min(1).max(64), z4.union([printWhereValue, z4.array(printWhereValue).min(1).max(20)])).refine((o) => {
|
|
@@ -1777,14 +1748,14 @@ var ChainTriggerSchema = z4.discriminatedUnion("type", [
|
|
|
1777
1748
|
}).strict(),
|
|
1778
1749
|
z4.object({
|
|
1779
1750
|
type: z4.literal("sbtc_deposit"),
|
|
1780
|
-
recipient:
|
|
1751
|
+
recipient: triggerExact.optional(),
|
|
1781
1752
|
minAmount: triggerAmount.optional(),
|
|
1782
1753
|
maxAmount: triggerAmount.optional(),
|
|
1783
|
-
bitcoinTxid:
|
|
1754
|
+
bitcoinTxid: btcTxid.optional()
|
|
1784
1755
|
}).strict(),
|
|
1785
1756
|
z4.object({
|
|
1786
1757
|
type: z4.literal("sbtc_withdrawal_create"),
|
|
1787
|
-
sender:
|
|
1758
|
+
sender: triggerExact.optional(),
|
|
1788
1759
|
minAmount: triggerAmount.optional(),
|
|
1789
1760
|
maxAmount: triggerAmount.optional(),
|
|
1790
1761
|
requestId: z4.number().int().nonnegative().optional()
|
|
@@ -1792,7 +1763,7 @@ var ChainTriggerSchema = z4.discriminatedUnion("type", [
|
|
|
1792
1763
|
z4.object({
|
|
1793
1764
|
type: z4.literal("sbtc_withdrawal_accept"),
|
|
1794
1765
|
requestId: z4.number().int().nonnegative().optional(),
|
|
1795
|
-
sweepTxid:
|
|
1766
|
+
sweepTxid: btcTxid.optional()
|
|
1796
1767
|
}).strict(),
|
|
1797
1768
|
z4.object({
|
|
1798
1769
|
type: z4.literal("sbtc_withdrawal_reject"),
|
|
@@ -1801,7 +1772,7 @@ var ChainTriggerSchema = z4.discriminatedUnion("type", [
|
|
|
1801
1772
|
z4.object({
|
|
1802
1773
|
type: z4.literal("sbtc_withdrawal_swept_confirmed"),
|
|
1803
1774
|
requestId: z4.number().int().nonnegative().optional(),
|
|
1804
|
-
sweepTxid:
|
|
1775
|
+
sweepTxid: btcTxid.optional()
|
|
1805
1776
|
}).strict(),
|
|
1806
1777
|
z4.object({
|
|
1807
1778
|
type: z4.literal("rune_etch"),
|
|
@@ -1814,7 +1785,7 @@ var ChainTriggerSchema = z4.discriminatedUnion("type", [
|
|
|
1814
1785
|
z4.object({
|
|
1815
1786
|
type: z4.literal("rune_transfer"),
|
|
1816
1787
|
rune: runeRef.optional(),
|
|
1817
|
-
address:
|
|
1788
|
+
address: triggerExact.optional(),
|
|
1818
1789
|
minAmount: triggerAmount.optional()
|
|
1819
1790
|
}).strict(),
|
|
1820
1791
|
z4.object({
|
|
@@ -2460,6 +2431,7 @@ export {
|
|
|
2460
2431
|
InsightSchema,
|
|
2461
2432
|
InsightSeveritySchema,
|
|
2462
2433
|
KeyRotatedError,
|
|
2434
|
+
MAINNET_POX_CONTRACT_ERAS,
|
|
2463
2435
|
NotFoundError,
|
|
2464
2436
|
OBSERVER_JOURNAL_STATUSES,
|
|
2465
2437
|
PaymentRequiredError,
|
|
@@ -2523,11 +2495,13 @@ export {
|
|
|
2523
2495
|
getTargetDb,
|
|
2524
2496
|
isBnsDecoderEnabled,
|
|
2525
2497
|
isEmptyRangeCursor,
|
|
2526
|
-
isPox4DecoderEnabled,
|
|
2527
2498
|
isPox5DecoderEnabled,
|
|
2499
|
+
isPoxContractId,
|
|
2528
2500
|
isSbtcDecoderEnabled,
|
|
2529
2501
|
jsonb,
|
|
2530
2502
|
logger,
|
|
2503
|
+
mainnetPoxContractAt,
|
|
2504
|
+
normalizeBtcTxid,
|
|
2531
2505
|
onChainPlane,
|
|
2532
2506
|
onControlPlane,
|
|
2533
2507
|
parseJsonb,
|
|
@@ -2539,5 +2513,5 @@ export {
|
|
|
2539
2513
|
syncState
|
|
2540
2514
|
};
|
|
2541
2515
|
|
|
2542
|
-
//# debugId=
|
|
2516
|
+
//# debugId=36068E06C8C082DB64756E2164756E21
|
|
2543
2517
|
//# sourceMappingURL=index.js.map
|