@secondlayer/shared 6.9.0 → 6.10.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.
@@ -398,6 +398,26 @@ interface Pox4SignersDailyTable {
398
398
  aggregation_calls: Generated<number>;
399
399
  updated_at: Generated<Date>;
400
400
  }
401
+ interface BurnBlockRewardsTable {
402
+ cursor: string;
403
+ burn_block_height: number;
404
+ burn_block_hash: string;
405
+ reward_index: number;
406
+ recipient_btc: string;
407
+ amount_sats: string;
408
+ burn_amount: Generated<string>;
409
+ canonical: Generated<boolean>;
410
+ created_at: Generated<Date>;
411
+ }
412
+ interface BurnBlockRewardSlotsTable {
413
+ cursor: string;
414
+ burn_block_height: number;
415
+ burn_block_hash: string;
416
+ slot_index: number;
417
+ holder_btc: string;
418
+ canonical: Generated<boolean>;
419
+ created_at: Generated<Date>;
420
+ }
401
421
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
402
422
  interface SbtcEventsTable {
403
423
  cursor: string;
@@ -586,6 +606,8 @@ interface Database {
586
606
  pox4_calls: Pox4CallsTable;
587
607
  pox4_cycles_daily: Pox4CyclesDailyTable;
588
608
  pox4_signers_daily: Pox4SignersDailyTable;
609
+ burn_block_rewards: BurnBlockRewardsTable;
610
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
589
611
  sbtc_events: SbtcEventsTable;
590
612
  sbtc_token_events: SbtcTokenEventsTable;
591
613
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -847,4 +869,4 @@ declare function getRawClient(role?: "source" | "target"): ReturnType<typeof pos
847
869
  declare function getRawClientFor(url: string): ReturnType<typeof postgres>;
848
870
  /** Close all DB connection pools. Call in CLI commands to allow process exit. */
849
871
  declare function closeDb(): Promise<void>;
850
- export { sql, parseJsonb, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getDb, closeDb, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionStatus, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormat, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, SessionsTable, Session, ServiceHeartbeatsTable, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, OutboxStatus, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, DecodedEventsTable, Database, ContractsTable, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
872
+ export { sql, parseJsonb, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getDb, closeDb, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionStatus, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormat, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, SessionsTable, Session, ServiceHeartbeatsTable, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, OutboxStatus, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, DecodedEventsTable, Database, ContractsTable, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
@@ -379,6 +379,26 @@ interface Pox4SignersDailyTable {
379
379
  aggregation_calls: Generated<number>;
380
380
  updated_at: Generated<Date>;
381
381
  }
382
+ interface BurnBlockRewardsTable {
383
+ cursor: string;
384
+ burn_block_height: number;
385
+ burn_block_hash: string;
386
+ reward_index: number;
387
+ recipient_btc: string;
388
+ amount_sats: string;
389
+ burn_amount: Generated<string>;
390
+ canonical: Generated<boolean>;
391
+ created_at: Generated<Date>;
392
+ }
393
+ interface BurnBlockRewardSlotsTable {
394
+ cursor: string;
395
+ burn_block_height: number;
396
+ burn_block_hash: string;
397
+ slot_index: number;
398
+ holder_btc: string;
399
+ canonical: Generated<boolean>;
400
+ created_at: Generated<Date>;
401
+ }
382
402
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
383
403
  interface SbtcEventsTable {
384
404
  cursor: string;
@@ -567,6 +587,8 @@ interface Database {
567
587
  pox4_calls: Pox4CallsTable;
568
588
  pox4_cycles_daily: Pox4CyclesDailyTable;
569
589
  pox4_signers_daily: Pox4SignersDailyTable;
590
+ burn_block_rewards: BurnBlockRewardsTable;
591
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
570
592
  sbtc_events: SbtcEventsTable;
571
593
  sbtc_token_events: SbtcTokenEventsTable;
572
594
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -380,6 +380,26 @@ interface Pox4SignersDailyTable {
380
380
  aggregation_calls: Generated<number>;
381
381
  updated_at: Generated<Date>;
382
382
  }
383
+ interface BurnBlockRewardsTable {
384
+ cursor: string;
385
+ burn_block_height: number;
386
+ burn_block_hash: string;
387
+ reward_index: number;
388
+ recipient_btc: string;
389
+ amount_sats: string;
390
+ burn_amount: Generated<string>;
391
+ canonical: Generated<boolean>;
392
+ created_at: Generated<Date>;
393
+ }
394
+ interface BurnBlockRewardSlotsTable {
395
+ cursor: string;
396
+ burn_block_height: number;
397
+ burn_block_hash: string;
398
+ slot_index: number;
399
+ holder_btc: string;
400
+ canonical: Generated<boolean>;
401
+ created_at: Generated<Date>;
402
+ }
383
403
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
384
404
  interface SbtcEventsTable {
385
405
  cursor: string;
@@ -568,6 +588,8 @@ interface Database {
568
588
  pox4_calls: Pox4CallsTable;
569
589
  pox4_cycles_daily: Pox4CyclesDailyTable;
570
590
  pox4_signers_daily: Pox4SignersDailyTable;
591
+ burn_block_rewards: BurnBlockRewardsTable;
592
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
571
593
  sbtc_events: SbtcEventsTable;
572
594
  sbtc_token_events: SbtcTokenEventsTable;
573
595
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -380,6 +380,26 @@ interface Pox4SignersDailyTable {
380
380
  aggregation_calls: Generated<number>;
381
381
  updated_at: Generated<Date>;
382
382
  }
383
+ interface BurnBlockRewardsTable {
384
+ cursor: string;
385
+ burn_block_height: number;
386
+ burn_block_hash: string;
387
+ reward_index: number;
388
+ recipient_btc: string;
389
+ amount_sats: string;
390
+ burn_amount: Generated<string>;
391
+ canonical: Generated<boolean>;
392
+ created_at: Generated<Date>;
393
+ }
394
+ interface BurnBlockRewardSlotsTable {
395
+ cursor: string;
396
+ burn_block_height: number;
397
+ burn_block_hash: string;
398
+ slot_index: number;
399
+ holder_btc: string;
400
+ canonical: Generated<boolean>;
401
+ created_at: Generated<Date>;
402
+ }
383
403
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
384
404
  interface SbtcEventsTable {
385
405
  cursor: string;
@@ -568,6 +588,8 @@ interface Database {
568
588
  pox4_calls: Pox4CallsTable;
569
589
  pox4_cycles_daily: Pox4CyclesDailyTable;
570
590
  pox4_signers_daily: Pox4SignersDailyTable;
591
+ burn_block_rewards: BurnBlockRewardsTable;
592
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
571
593
  sbtc_events: SbtcEventsTable;
572
594
  sbtc_token_events: SbtcTokenEventsTable;
573
595
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -380,6 +380,26 @@ interface Pox4SignersDailyTable {
380
380
  aggregation_calls: Generated<number>;
381
381
  updated_at: Generated<Date>;
382
382
  }
383
+ interface BurnBlockRewardsTable {
384
+ cursor: string;
385
+ burn_block_height: number;
386
+ burn_block_hash: string;
387
+ reward_index: number;
388
+ recipient_btc: string;
389
+ amount_sats: string;
390
+ burn_amount: Generated<string>;
391
+ canonical: Generated<boolean>;
392
+ created_at: Generated<Date>;
393
+ }
394
+ interface BurnBlockRewardSlotsTable {
395
+ cursor: string;
396
+ burn_block_height: number;
397
+ burn_block_hash: string;
398
+ slot_index: number;
399
+ holder_btc: string;
400
+ canonical: Generated<boolean>;
401
+ created_at: Generated<Date>;
402
+ }
383
403
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
384
404
  interface SbtcEventsTable {
385
405
  cursor: string;
@@ -568,6 +588,8 @@ interface Database {
568
588
  pox4_calls: Pox4CallsTable;
569
589
  pox4_cycles_daily: Pox4CyclesDailyTable;
570
590
  pox4_signers_daily: Pox4SignersDailyTable;
591
+ burn_block_rewards: BurnBlockRewardsTable;
592
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
571
593
  sbtc_events: SbtcEventsTable;
572
594
  sbtc_token_events: SbtcTokenEventsTable;
573
595
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -380,6 +380,26 @@ interface Pox4SignersDailyTable {
380
380
  aggregation_calls: Generated<number>;
381
381
  updated_at: Generated<Date>;
382
382
  }
383
+ interface BurnBlockRewardsTable {
384
+ cursor: string;
385
+ burn_block_height: number;
386
+ burn_block_hash: string;
387
+ reward_index: number;
388
+ recipient_btc: string;
389
+ amount_sats: string;
390
+ burn_amount: Generated<string>;
391
+ canonical: Generated<boolean>;
392
+ created_at: Generated<Date>;
393
+ }
394
+ interface BurnBlockRewardSlotsTable {
395
+ cursor: string;
396
+ burn_block_height: number;
397
+ burn_block_hash: string;
398
+ slot_index: number;
399
+ holder_btc: string;
400
+ canonical: Generated<boolean>;
401
+ created_at: Generated<Date>;
402
+ }
383
403
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
384
404
  interface SbtcEventsTable {
385
405
  cursor: string;
@@ -568,6 +588,8 @@ interface Database {
568
588
  pox4_calls: Pox4CallsTable;
569
589
  pox4_cycles_daily: Pox4CyclesDailyTable;
570
590
  pox4_signers_daily: Pox4SignersDailyTable;
591
+ burn_block_rewards: BurnBlockRewardsTable;
592
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
571
593
  sbtc_events: SbtcEventsTable;
572
594
  sbtc_token_events: SbtcTokenEventsTable;
573
595
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -381,6 +381,26 @@ interface Pox4SignersDailyTable {
381
381
  aggregation_calls: Generated<number>;
382
382
  updated_at: Generated<Date>;
383
383
  }
384
+ interface BurnBlockRewardsTable {
385
+ cursor: string;
386
+ burn_block_height: number;
387
+ burn_block_hash: string;
388
+ reward_index: number;
389
+ recipient_btc: string;
390
+ amount_sats: string;
391
+ burn_amount: Generated<string>;
392
+ canonical: Generated<boolean>;
393
+ created_at: Generated<Date>;
394
+ }
395
+ interface BurnBlockRewardSlotsTable {
396
+ cursor: string;
397
+ burn_block_height: number;
398
+ burn_block_hash: string;
399
+ slot_index: number;
400
+ holder_btc: string;
401
+ canonical: Generated<boolean>;
402
+ created_at: Generated<Date>;
403
+ }
384
404
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
385
405
  interface SbtcEventsTable {
386
406
  cursor: string;
@@ -569,6 +589,8 @@ interface Database {
569
589
  pox4_calls: Pox4CallsTable;
570
590
  pox4_cycles_daily: Pox4CyclesDailyTable;
571
591
  pox4_signers_daily: Pox4SignersDailyTable;
592
+ burn_block_rewards: BurnBlockRewardsTable;
593
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
572
594
  sbtc_events: SbtcEventsTable;
573
595
  sbtc_token_events: SbtcTokenEventsTable;
574
596
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -380,6 +380,26 @@ interface Pox4SignersDailyTable {
380
380
  aggregation_calls: Generated<number>;
381
381
  updated_at: Generated<Date>;
382
382
  }
383
+ interface BurnBlockRewardsTable {
384
+ cursor: string;
385
+ burn_block_height: number;
386
+ burn_block_hash: string;
387
+ reward_index: number;
388
+ recipient_btc: string;
389
+ amount_sats: string;
390
+ burn_amount: Generated<string>;
391
+ canonical: Generated<boolean>;
392
+ created_at: Generated<Date>;
393
+ }
394
+ interface BurnBlockRewardSlotsTable {
395
+ cursor: string;
396
+ burn_block_height: number;
397
+ burn_block_hash: string;
398
+ slot_index: number;
399
+ holder_btc: string;
400
+ canonical: Generated<boolean>;
401
+ created_at: Generated<Date>;
402
+ }
383
403
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
384
404
  interface SbtcEventsTable {
385
405
  cursor: string;
@@ -568,6 +588,8 @@ interface Database {
568
588
  pox4_calls: Pox4CallsTable;
569
589
  pox4_cycles_daily: Pox4CyclesDailyTable;
570
590
  pox4_signers_daily: Pox4SignersDailyTable;
591
+ burn_block_rewards: BurnBlockRewardsTable;
592
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
571
593
  sbtc_events: SbtcEventsTable;
572
594
  sbtc_token_events: SbtcTokenEventsTable;
573
595
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -379,6 +379,26 @@ interface Pox4SignersDailyTable {
379
379
  aggregation_calls: Generated<number>;
380
380
  updated_at: Generated<Date>;
381
381
  }
382
+ interface BurnBlockRewardsTable {
383
+ cursor: string;
384
+ burn_block_height: number;
385
+ burn_block_hash: string;
386
+ reward_index: number;
387
+ recipient_btc: string;
388
+ amount_sats: string;
389
+ burn_amount: Generated<string>;
390
+ canonical: Generated<boolean>;
391
+ created_at: Generated<Date>;
392
+ }
393
+ interface BurnBlockRewardSlotsTable {
394
+ cursor: string;
395
+ burn_block_height: number;
396
+ burn_block_hash: string;
397
+ slot_index: number;
398
+ holder_btc: string;
399
+ canonical: Generated<boolean>;
400
+ created_at: Generated<Date>;
401
+ }
382
402
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
383
403
  interface SbtcEventsTable {
384
404
  cursor: string;
@@ -567,6 +587,8 @@ interface Database {
567
587
  pox4_calls: Pox4CallsTable;
568
588
  pox4_cycles_daily: Pox4CyclesDailyTable;
569
589
  pox4_signers_daily: Pox4SignersDailyTable;
590
+ burn_block_rewards: BurnBlockRewardsTable;
591
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
570
592
  sbtc_events: SbtcEventsTable;
571
593
  sbtc_token_events: SbtcTokenEventsTable;
572
594
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -796,4 +818,4 @@ interface SubscriptionDeliveriesTable {
796
818
  }
797
819
  type SubscriptionDelivery = Selectable<SubscriptionDeliveriesTable>;
798
820
  type InsertSubscriptionDelivery = Insertable<SubscriptionDeliveriesTable>;
799
- export { UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionStatus, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormat, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, SessionsTable, Session, ServiceHeartbeatsTable, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, OutboxStatus, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, DecodedEventsTable, Database, ContractsTable, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
821
+ export { UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionStatus, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormat, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, SessionsTable, Session, ServiceHeartbeatsTable, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, OutboxStatus, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, DecodedEventsTable, Database, ContractsTable, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
@@ -379,6 +379,26 @@ interface Pox4SignersDailyTable {
379
379
  aggregation_calls: Generated<number>;
380
380
  updated_at: Generated<Date>;
381
381
  }
382
+ interface BurnBlockRewardsTable {
383
+ cursor: string;
384
+ burn_block_height: number;
385
+ burn_block_hash: string;
386
+ reward_index: number;
387
+ recipient_btc: string;
388
+ amount_sats: string;
389
+ burn_amount: Generated<string>;
390
+ canonical: Generated<boolean>;
391
+ created_at: Generated<Date>;
392
+ }
393
+ interface BurnBlockRewardSlotsTable {
394
+ cursor: string;
395
+ burn_block_height: number;
396
+ burn_block_hash: string;
397
+ slot_index: number;
398
+ holder_btc: string;
399
+ canonical: Generated<boolean>;
400
+ created_at: Generated<Date>;
401
+ }
382
402
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
383
403
  interface SbtcEventsTable {
384
404
  cursor: string;
@@ -567,6 +587,8 @@ interface Database {
567
587
  pox4_calls: Pox4CallsTable;
568
588
  pox4_cycles_daily: Pox4CyclesDailyTable;
569
589
  pox4_signers_daily: Pox4SignersDailyTable;
590
+ burn_block_rewards: BurnBlockRewardsTable;
591
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
570
592
  sbtc_events: SbtcEventsTable;
571
593
  sbtc_token_events: SbtcTokenEventsTable;
572
594
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -1408,4 +1430,4 @@ declare function createSignatureHeader(payload: string, secret: string, timestam
1408
1430
  * Returns true if valid, false otherwise
1409
1431
  */
1410
1432
  declare function verifySignatureHeader(payload: string, header: string, secret: string, toleranceSeconds?: number): boolean;
1411
- export { validateSubscriptionFilterForTable, sql, parseJsonb, logger, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getErrorMessage, getEnv, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, exports_hmac as crypto, closeDb, VersionConflictError, ValidationError, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantSuspendedError, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionStatus, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormatSchema, SubscriptionFormat, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphResourceWarning, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAgentSchema, Subgraph, StxTransferFilterSchema, StxTransferFilter, StxMintFilterSchema, StxMintFilter, StxLockFilterSchema, StxLockFilter, StxBurnFilterSchema, StxBurnFilter, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, RotateSecretResponse, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, ReindexResponse, RateLimitError, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, PrintEventFilterSchema, PrintEventFilter, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, OutboxStatus, NotFoundError, NftTransferFilterSchema, NftTransferFilter, NftMintFilterSchema, NftMintFilter, NftBurnFilterSchema, NftBurnFilter, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, KeyRotatedError, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ForbiddenError, EventsTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DeadRow, DatabaseError, Database, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, ContractsTable, ContractDeployFilterSchema, ContractDeployFilter, ContractCallFilterSchema, ContractCallFilter, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, CODE_TO_STATUS, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
1433
+ export { validateSubscriptionFilterForTable, sql, parseJsonb, logger, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getErrorMessage, getEnv, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, exports_hmac as crypto, closeDb, VersionConflictError, ValidationError, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantSuspendedError, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionStatus, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormatSchema, SubscriptionFormat, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphResourceWarning, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAgentSchema, Subgraph, StxTransferFilterSchema, StxTransferFilter, StxMintFilterSchema, StxMintFilter, StxLockFilterSchema, StxLockFilter, StxBurnFilterSchema, StxBurnFilter, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, RotateSecretResponse, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, ReindexResponse, RateLimitError, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, PrintEventFilterSchema, PrintEventFilter, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, OutboxStatus, NotFoundError, NftTransferFilterSchema, NftTransferFilter, NftMintFilterSchema, NftMintFilter, NftBurnFilterSchema, NftBurnFilter, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, KeyRotatedError, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ForbiddenError, EventsTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DeadRow, DatabaseError, Database, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, ContractsTable, ContractDeployFilterSchema, ContractDeployFilter, ContractCallFilterSchema, ContractCallFilter, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, CODE_TO_STATUS, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
@@ -380,6 +380,26 @@ interface Pox4SignersDailyTable {
380
380
  aggregation_calls: Generated<number>;
381
381
  updated_at: Generated<Date>;
382
382
  }
383
+ interface BurnBlockRewardsTable {
384
+ cursor: string;
385
+ burn_block_height: number;
386
+ burn_block_hash: string;
387
+ reward_index: number;
388
+ recipient_btc: string;
389
+ amount_sats: string;
390
+ burn_amount: Generated<string>;
391
+ canonical: Generated<boolean>;
392
+ created_at: Generated<Date>;
393
+ }
394
+ interface BurnBlockRewardSlotsTable {
395
+ cursor: string;
396
+ burn_block_height: number;
397
+ burn_block_hash: string;
398
+ slot_index: number;
399
+ holder_btc: string;
400
+ canonical: Generated<boolean>;
401
+ created_at: Generated<Date>;
402
+ }
383
403
  type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
384
404
  interface SbtcEventsTable {
385
405
  cursor: string;
@@ -568,6 +588,8 @@ interface Database {
568
588
  pox4_calls: Pox4CallsTable;
569
589
  pox4_cycles_daily: Pox4CyclesDailyTable;
570
590
  pox4_signers_daily: Pox4SignersDailyTable;
591
+ burn_block_rewards: BurnBlockRewardsTable;
592
+ burn_block_reward_slots: BurnBlockRewardSlotsTable;
571
593
  sbtc_events: SbtcEventsTable;
572
594
  sbtc_token_events: SbtcTokenEventsTable;
573
595
  sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
@@ -1,6 +1,7 @@
1
1
  import { type Kysely, sql } from "kysely";
2
2
 
3
- export async function up(db: Kysely<unknown>): Promise<void> {
3
+ // biome-ignore lint/suspicious/noExplicitAny: migration DDL is intentionally schema-dynamic
4
+ export async function up(db: Kysely<any>): Promise<void> {
4
5
  await sql`
5
6
  ALTER TABLE decoded_events
6
7
  ADD COLUMN microblock_hash TEXT,
@@ -41,7 +42,8 @@ export async function up(db: Kysely<unknown>): Promise<void> {
41
42
  `.execute(db);
42
43
  }
43
44
 
44
- export async function down(db: Kysely<unknown>): Promise<void> {
45
+ // biome-ignore lint/suspicious/noExplicitAny: migration DDL is intentionally schema-dynamic
46
+ export async function down(db: Kysely<any>): Promise<void> {
45
47
  await sql`DROP INDEX IF EXISTS decoded_events_recipient_height_event_idx`.execute(
46
48
  db,
47
49
  );
@@ -1,6 +1,7 @@
1
1
  import { type Kysely, sql } from "kysely";
2
2
 
3
- export async function up(db: Kysely<unknown>): Promise<void> {
3
+ // biome-ignore lint/suspicious/noExplicitAny: migration DDL is intentionally schema-dynamic
4
+ export async function up(db: Kysely<any>): Promise<void> {
4
5
  await sql`SET lock_timeout = '30s'`.execute(db);
5
6
  await sql`
6
7
  ALTER TABLE usage_daily
@@ -9,7 +10,8 @@ export async function up(db: Kysely<unknown>): Promise<void> {
9
10
  `.execute(db);
10
11
  }
11
12
 
12
- export async function down(db: Kysely<unknown>): Promise<void> {
13
+ // biome-ignore lint/suspicious/noExplicitAny: migration DDL is intentionally schema-dynamic
14
+ export async function down(db: Kysely<any>): Promise<void> {
13
15
  await sql`
14
16
  ALTER TABLE usage_daily
15
17
  DROP COLUMN IF EXISTS index_decoded_events_returned,
@@ -0,0 +1,63 @@
1
+ import { type Kysely, sql } from "kysely";
2
+
3
+ // Burnchain (Bitcoin) PoX reward data, sourced from the stacks-node
4
+ // /new_burn_block event observer payload (reward_recipients / reward_slot_holders),
5
+ // which the indexer previously discarded. Two views per burn block:
6
+ // - burn_block_rewards: actual BTC payouts (one row per reward slot, ≤2/block).
7
+ // Populated only during a reward cycle's reward phase.
8
+ // - burn_block_reward_slots: reward-set membership (eligible BTC addresses).
9
+ // Both are keyed by (burn_block_height, index) via `cursor`; the handler does
10
+ // delete-by-height-then-insert (replace-per-height), which makes redelivery and
11
+ // shallow burnchain reorgs idempotent. `canonical` is reserved for a future
12
+ // mark-non-canonical reorg path; v1 keeps every row canonical.
13
+ export async function up(db: Kysely<unknown>): Promise<void> {
14
+ await sql`SET lock_timeout = '30s'`.execute(db);
15
+
16
+ await sql`
17
+ CREATE TABLE IF NOT EXISTS burn_block_rewards (
18
+ cursor TEXT PRIMARY KEY,
19
+ burn_block_height BIGINT NOT NULL,
20
+ burn_block_hash TEXT NOT NULL,
21
+ reward_index INTEGER NOT NULL,
22
+ recipient_btc TEXT NOT NULL,
23
+ amount_sats TEXT NOT NULL,
24
+ burn_amount TEXT NOT NULL DEFAULT '0',
25
+ canonical BOOLEAN NOT NULL DEFAULT true,
26
+ created_at TIMESTAMPTZ NOT NULL DEFAULT now()
27
+ )
28
+ `.execute(db);
29
+
30
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_rewards_canonical_height_idx ON burn_block_rewards (canonical, burn_block_height)`.execute(
31
+ db,
32
+ );
33
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_rewards_recipient_height_idx ON burn_block_rewards (recipient_btc, burn_block_height)`.execute(
34
+ db,
35
+ );
36
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_rewards_hash_idx ON burn_block_rewards (burn_block_hash)`.execute(
37
+ db,
38
+ );
39
+
40
+ await sql`
41
+ CREATE TABLE IF NOT EXISTS burn_block_reward_slots (
42
+ cursor TEXT PRIMARY KEY,
43
+ burn_block_height BIGINT NOT NULL,
44
+ burn_block_hash TEXT NOT NULL,
45
+ slot_index INTEGER NOT NULL,
46
+ holder_btc TEXT NOT NULL,
47
+ canonical BOOLEAN NOT NULL DEFAULT true,
48
+ created_at TIMESTAMPTZ NOT NULL DEFAULT now()
49
+ )
50
+ `.execute(db);
51
+
52
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_reward_slots_canonical_height_idx ON burn_block_reward_slots (canonical, burn_block_height)`.execute(
53
+ db,
54
+ );
55
+ await sql`CREATE INDEX IF NOT EXISTS burn_block_reward_slots_holder_height_idx ON burn_block_reward_slots (holder_btc, burn_block_height)`.execute(
56
+ db,
57
+ );
58
+ }
59
+
60
+ export async function down(db: Kysely<unknown>): Promise<void> {
61
+ await sql`DROP TABLE IF EXISTS burn_block_reward_slots`.execute(db);
62
+ await sql`DROP TABLE IF EXISTS burn_block_rewards`.execute(db);
63
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/shared",
3
- "version": "6.9.0",
3
+ "version": "6.10.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",