@secondlayer/shared 6.13.0 → 6.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/db/index.d.ts +15 -1
- package/dist/src/db/queries/chain-reorgs.d.ts +12 -0
- package/dist/src/db/queries/contracts.d.ts +12 -0
- package/dist/src/db/queries/integrity.d.ts +12 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +12 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +12 -0
- package/dist/src/db/queries/subgraphs.d.ts +12 -0
- package/dist/src/db/queries/subscriptions.d.ts +12 -0
- package/dist/src/db/schema.d.ts +15 -1
- package/dist/src/index.d.ts +15 -1
- package/dist/src/node/local-client.d.ts +12 -0
- package/migrations/0086_mempool_transactions.ts +37 -0
- package/migrations/0087_decoded_events_type_height_event_idx.ts +26 -0
- package/package.json +1 -1
package/dist/src/db/index.d.ts
CHANGED
|
@@ -90,6 +90,17 @@ interface DeadLetterEventsTable {
|
|
|
90
90
|
reason: string;
|
|
91
91
|
created_at: Generated<Date>;
|
|
92
92
|
}
|
|
93
|
+
interface MempoolTransactionsTable {
|
|
94
|
+
seq: Generated<string>;
|
|
95
|
+
tx_id: string;
|
|
96
|
+
raw_tx: string;
|
|
97
|
+
type: string;
|
|
98
|
+
sender: string;
|
|
99
|
+
contract_id: string | null;
|
|
100
|
+
function_name: string | null;
|
|
101
|
+
function_args: unknown | null;
|
|
102
|
+
received_at: Generated<Date>;
|
|
103
|
+
}
|
|
93
104
|
interface IndexProgressTable {
|
|
94
105
|
network: string;
|
|
95
106
|
last_indexed_block: Generated<number>;
|
|
@@ -611,6 +622,7 @@ interface Database {
|
|
|
611
622
|
transactions_archive: TransactionsArchiveTable;
|
|
612
623
|
events_archive: EventsArchiveTable;
|
|
613
624
|
dead_letter_events: DeadLetterEventsTable;
|
|
625
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
614
626
|
index_progress: IndexProgressTable;
|
|
615
627
|
contracts: ContractsTable;
|
|
616
628
|
subgraphs: SubgraphsTable;
|
|
@@ -759,6 +771,8 @@ type UpdateBlock = Updateable<BlocksTable>;
|
|
|
759
771
|
type Transaction = Selectable<TransactionsTable>;
|
|
760
772
|
type InsertTransaction = Insertable<TransactionsTable>;
|
|
761
773
|
type UpdateTransaction = Updateable<TransactionsTable>;
|
|
774
|
+
type MempoolTransaction = Selectable<MempoolTransactionsTable>;
|
|
775
|
+
type InsertMempoolTransaction = Insertable<MempoolTransactionsTable>;
|
|
762
776
|
type Event = Selectable<EventsTable>;
|
|
763
777
|
type InsertEvent = Insertable<EventsTable>;
|
|
764
778
|
type UpdateEvent = Updateable<EventsTable>;
|
|
@@ -911,4 +925,4 @@ declare function getRawClient(role?: "source" | "target"): ReturnType<typeof pos
|
|
|
911
925
|
declare function getRawClientFor(url: string): ReturnType<typeof postgres>;
|
|
912
926
|
/** Close all DB connection pools. Call in CLI commands to allow process exit. */
|
|
913
927
|
declare function closeDb(): Promise<void>;
|
|
914
|
-
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, TransactionsArchiveTable, 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, EventsArchiveTable, Event, DecodedEventsTable, DeadLetterEventsTable, 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 };
|
|
928
|
+
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, TransactionsArchiveTable, 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, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, EventsArchiveTable, Event, DecodedEventsTable, DeadLetterEventsTable, 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 };
|
|
@@ -71,6 +71,17 @@ interface DeadLetterEventsTable {
|
|
|
71
71
|
reason: string;
|
|
72
72
|
created_at: Generated<Date>;
|
|
73
73
|
}
|
|
74
|
+
interface MempoolTransactionsTable {
|
|
75
|
+
seq: Generated<string>;
|
|
76
|
+
tx_id: string;
|
|
77
|
+
raw_tx: string;
|
|
78
|
+
type: string;
|
|
79
|
+
sender: string;
|
|
80
|
+
contract_id: string | null;
|
|
81
|
+
function_name: string | null;
|
|
82
|
+
function_args: unknown | null;
|
|
83
|
+
received_at: Generated<Date>;
|
|
84
|
+
}
|
|
74
85
|
interface IndexProgressTable {
|
|
75
86
|
network: string;
|
|
76
87
|
last_indexed_block: Generated<number>;
|
|
@@ -592,6 +603,7 @@ interface Database {
|
|
|
592
603
|
transactions_archive: TransactionsArchiveTable;
|
|
593
604
|
events_archive: EventsArchiveTable;
|
|
594
605
|
dead_letter_events: DeadLetterEventsTable;
|
|
606
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
595
607
|
index_progress: IndexProgressTable;
|
|
596
608
|
contracts: ContractsTable;
|
|
597
609
|
subgraphs: SubgraphsTable;
|
|
@@ -72,6 +72,17 @@ interface DeadLetterEventsTable {
|
|
|
72
72
|
reason: string;
|
|
73
73
|
created_at: Generated<Date>;
|
|
74
74
|
}
|
|
75
|
+
interface MempoolTransactionsTable {
|
|
76
|
+
seq: Generated<string>;
|
|
77
|
+
tx_id: string;
|
|
78
|
+
raw_tx: string;
|
|
79
|
+
type: string;
|
|
80
|
+
sender: string;
|
|
81
|
+
contract_id: string | null;
|
|
82
|
+
function_name: string | null;
|
|
83
|
+
function_args: unknown | null;
|
|
84
|
+
received_at: Generated<Date>;
|
|
85
|
+
}
|
|
75
86
|
interface IndexProgressTable {
|
|
76
87
|
network: string;
|
|
77
88
|
last_indexed_block: Generated<number>;
|
|
@@ -593,6 +604,7 @@ interface Database {
|
|
|
593
604
|
transactions_archive: TransactionsArchiveTable;
|
|
594
605
|
events_archive: EventsArchiveTable;
|
|
595
606
|
dead_letter_events: DeadLetterEventsTable;
|
|
607
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
596
608
|
index_progress: IndexProgressTable;
|
|
597
609
|
contracts: ContractsTable;
|
|
598
610
|
subgraphs: SubgraphsTable;
|
|
@@ -72,6 +72,17 @@ interface DeadLetterEventsTable {
|
|
|
72
72
|
reason: string;
|
|
73
73
|
created_at: Generated<Date>;
|
|
74
74
|
}
|
|
75
|
+
interface MempoolTransactionsTable {
|
|
76
|
+
seq: Generated<string>;
|
|
77
|
+
tx_id: string;
|
|
78
|
+
raw_tx: string;
|
|
79
|
+
type: string;
|
|
80
|
+
sender: string;
|
|
81
|
+
contract_id: string | null;
|
|
82
|
+
function_name: string | null;
|
|
83
|
+
function_args: unknown | null;
|
|
84
|
+
received_at: Generated<Date>;
|
|
85
|
+
}
|
|
75
86
|
interface IndexProgressTable {
|
|
76
87
|
network: string;
|
|
77
88
|
last_indexed_block: Generated<number>;
|
|
@@ -593,6 +604,7 @@ interface Database {
|
|
|
593
604
|
transactions_archive: TransactionsArchiveTable;
|
|
594
605
|
events_archive: EventsArchiveTable;
|
|
595
606
|
dead_letter_events: DeadLetterEventsTable;
|
|
607
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
596
608
|
index_progress: IndexProgressTable;
|
|
597
609
|
contracts: ContractsTable;
|
|
598
610
|
subgraphs: SubgraphsTable;
|
|
@@ -72,6 +72,17 @@ interface DeadLetterEventsTable {
|
|
|
72
72
|
reason: string;
|
|
73
73
|
created_at: Generated<Date>;
|
|
74
74
|
}
|
|
75
|
+
interface MempoolTransactionsTable {
|
|
76
|
+
seq: Generated<string>;
|
|
77
|
+
tx_id: string;
|
|
78
|
+
raw_tx: string;
|
|
79
|
+
type: string;
|
|
80
|
+
sender: string;
|
|
81
|
+
contract_id: string | null;
|
|
82
|
+
function_name: string | null;
|
|
83
|
+
function_args: unknown | null;
|
|
84
|
+
received_at: Generated<Date>;
|
|
85
|
+
}
|
|
75
86
|
interface IndexProgressTable {
|
|
76
87
|
network: string;
|
|
77
88
|
last_indexed_block: Generated<number>;
|
|
@@ -593,6 +604,7 @@ interface Database {
|
|
|
593
604
|
transactions_archive: TransactionsArchiveTable;
|
|
594
605
|
events_archive: EventsArchiveTable;
|
|
595
606
|
dead_letter_events: DeadLetterEventsTable;
|
|
607
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
596
608
|
index_progress: IndexProgressTable;
|
|
597
609
|
contracts: ContractsTable;
|
|
598
610
|
subgraphs: SubgraphsTable;
|
|
@@ -72,6 +72,17 @@ interface DeadLetterEventsTable {
|
|
|
72
72
|
reason: string;
|
|
73
73
|
created_at: Generated<Date>;
|
|
74
74
|
}
|
|
75
|
+
interface MempoolTransactionsTable {
|
|
76
|
+
seq: Generated<string>;
|
|
77
|
+
tx_id: string;
|
|
78
|
+
raw_tx: string;
|
|
79
|
+
type: string;
|
|
80
|
+
sender: string;
|
|
81
|
+
contract_id: string | null;
|
|
82
|
+
function_name: string | null;
|
|
83
|
+
function_args: unknown | null;
|
|
84
|
+
received_at: Generated<Date>;
|
|
85
|
+
}
|
|
75
86
|
interface IndexProgressTable {
|
|
76
87
|
network: string;
|
|
77
88
|
last_indexed_block: Generated<number>;
|
|
@@ -593,6 +604,7 @@ interface Database {
|
|
|
593
604
|
transactions_archive: TransactionsArchiveTable;
|
|
594
605
|
events_archive: EventsArchiveTable;
|
|
595
606
|
dead_letter_events: DeadLetterEventsTable;
|
|
607
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
596
608
|
index_progress: IndexProgressTable;
|
|
597
609
|
contracts: ContractsTable;
|
|
598
610
|
subgraphs: SubgraphsTable;
|
|
@@ -73,6 +73,17 @@ interface DeadLetterEventsTable {
|
|
|
73
73
|
reason: string;
|
|
74
74
|
created_at: Generated<Date>;
|
|
75
75
|
}
|
|
76
|
+
interface MempoolTransactionsTable {
|
|
77
|
+
seq: Generated<string>;
|
|
78
|
+
tx_id: string;
|
|
79
|
+
raw_tx: string;
|
|
80
|
+
type: string;
|
|
81
|
+
sender: string;
|
|
82
|
+
contract_id: string | null;
|
|
83
|
+
function_name: string | null;
|
|
84
|
+
function_args: unknown | null;
|
|
85
|
+
received_at: Generated<Date>;
|
|
86
|
+
}
|
|
76
87
|
interface IndexProgressTable {
|
|
77
88
|
network: string;
|
|
78
89
|
last_indexed_block: Generated<number>;
|
|
@@ -594,6 +605,7 @@ interface Database {
|
|
|
594
605
|
transactions_archive: TransactionsArchiveTable;
|
|
595
606
|
events_archive: EventsArchiveTable;
|
|
596
607
|
dead_letter_events: DeadLetterEventsTable;
|
|
608
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
597
609
|
index_progress: IndexProgressTable;
|
|
598
610
|
contracts: ContractsTable;
|
|
599
611
|
subgraphs: SubgraphsTable;
|
|
@@ -72,6 +72,17 @@ interface DeadLetterEventsTable {
|
|
|
72
72
|
reason: string;
|
|
73
73
|
created_at: Generated<Date>;
|
|
74
74
|
}
|
|
75
|
+
interface MempoolTransactionsTable {
|
|
76
|
+
seq: Generated<string>;
|
|
77
|
+
tx_id: string;
|
|
78
|
+
raw_tx: string;
|
|
79
|
+
type: string;
|
|
80
|
+
sender: string;
|
|
81
|
+
contract_id: string | null;
|
|
82
|
+
function_name: string | null;
|
|
83
|
+
function_args: unknown | null;
|
|
84
|
+
received_at: Generated<Date>;
|
|
85
|
+
}
|
|
75
86
|
interface IndexProgressTable {
|
|
76
87
|
network: string;
|
|
77
88
|
last_indexed_block: Generated<number>;
|
|
@@ -593,6 +604,7 @@ interface Database {
|
|
|
593
604
|
transactions_archive: TransactionsArchiveTable;
|
|
594
605
|
events_archive: EventsArchiveTable;
|
|
595
606
|
dead_letter_events: DeadLetterEventsTable;
|
|
607
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
596
608
|
index_progress: IndexProgressTable;
|
|
597
609
|
contracts: ContractsTable;
|
|
598
610
|
subgraphs: SubgraphsTable;
|
package/dist/src/db/schema.d.ts
CHANGED
|
@@ -71,6 +71,17 @@ interface DeadLetterEventsTable {
|
|
|
71
71
|
reason: string;
|
|
72
72
|
created_at: Generated<Date>;
|
|
73
73
|
}
|
|
74
|
+
interface MempoolTransactionsTable {
|
|
75
|
+
seq: Generated<string>;
|
|
76
|
+
tx_id: string;
|
|
77
|
+
raw_tx: string;
|
|
78
|
+
type: string;
|
|
79
|
+
sender: string;
|
|
80
|
+
contract_id: string | null;
|
|
81
|
+
function_name: string | null;
|
|
82
|
+
function_args: unknown | null;
|
|
83
|
+
received_at: Generated<Date>;
|
|
84
|
+
}
|
|
74
85
|
interface IndexProgressTable {
|
|
75
86
|
network: string;
|
|
76
87
|
last_indexed_block: Generated<number>;
|
|
@@ -592,6 +603,7 @@ interface Database {
|
|
|
592
603
|
transactions_archive: TransactionsArchiveTable;
|
|
593
604
|
events_archive: EventsArchiveTable;
|
|
594
605
|
dead_letter_events: DeadLetterEventsTable;
|
|
606
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
595
607
|
index_progress: IndexProgressTable;
|
|
596
608
|
contracts: ContractsTable;
|
|
597
609
|
subgraphs: SubgraphsTable;
|
|
@@ -740,6 +752,8 @@ type UpdateBlock = Updateable<BlocksTable>;
|
|
|
740
752
|
type Transaction = Selectable<TransactionsTable>;
|
|
741
753
|
type InsertTransaction = Insertable<TransactionsTable>;
|
|
742
754
|
type UpdateTransaction = Updateable<TransactionsTable>;
|
|
755
|
+
type MempoolTransaction = Selectable<MempoolTransactionsTable>;
|
|
756
|
+
type InsertMempoolTransaction = Insertable<MempoolTransactionsTable>;
|
|
743
757
|
type Event = Selectable<EventsTable>;
|
|
744
758
|
type InsertEvent = Insertable<EventsTable>;
|
|
745
759
|
type UpdateEvent = Updateable<EventsTable>;
|
|
@@ -860,4 +874,4 @@ interface SubscriptionDeliveriesTable {
|
|
|
860
874
|
}
|
|
861
875
|
type SubscriptionDelivery = Selectable<SubscriptionDeliveriesTable>;
|
|
862
876
|
type InsertSubscriptionDelivery = Insertable<SubscriptionDeliveriesTable>;
|
|
863
|
-
export { UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, TransactionsArchiveTable, 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, EventsArchiveTable, Event, DecodedEventsTable, DeadLetterEventsTable, 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 };
|
|
877
|
+
export { UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, TransactionsArchiveTable, 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, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, EventsArchiveTable, Event, DecodedEventsTable, DeadLetterEventsTable, 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 };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -71,6 +71,17 @@ interface DeadLetterEventsTable {
|
|
|
71
71
|
reason: string;
|
|
72
72
|
created_at: Generated<Date>;
|
|
73
73
|
}
|
|
74
|
+
interface MempoolTransactionsTable {
|
|
75
|
+
seq: Generated<string>;
|
|
76
|
+
tx_id: string;
|
|
77
|
+
raw_tx: string;
|
|
78
|
+
type: string;
|
|
79
|
+
sender: string;
|
|
80
|
+
contract_id: string | null;
|
|
81
|
+
function_name: string | null;
|
|
82
|
+
function_args: unknown | null;
|
|
83
|
+
received_at: Generated<Date>;
|
|
84
|
+
}
|
|
74
85
|
interface IndexProgressTable {
|
|
75
86
|
network: string;
|
|
76
87
|
last_indexed_block: Generated<number>;
|
|
@@ -592,6 +603,7 @@ interface Database {
|
|
|
592
603
|
transactions_archive: TransactionsArchiveTable;
|
|
593
604
|
events_archive: EventsArchiveTable;
|
|
594
605
|
dead_letter_events: DeadLetterEventsTable;
|
|
606
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
595
607
|
index_progress: IndexProgressTable;
|
|
596
608
|
contracts: ContractsTable;
|
|
597
609
|
subgraphs: SubgraphsTable;
|
|
@@ -740,6 +752,8 @@ type UpdateBlock = Updateable<BlocksTable>;
|
|
|
740
752
|
type Transaction = Selectable<TransactionsTable>;
|
|
741
753
|
type InsertTransaction = Insertable<TransactionsTable>;
|
|
742
754
|
type UpdateTransaction = Updateable<TransactionsTable>;
|
|
755
|
+
type MempoolTransaction = Selectable<MempoolTransactionsTable>;
|
|
756
|
+
type InsertMempoolTransaction = Insertable<MempoolTransactionsTable>;
|
|
743
757
|
type Event = Selectable<EventsTable>;
|
|
744
758
|
type InsertEvent = Insertable<EventsTable>;
|
|
745
759
|
type UpdateEvent = Updateable<EventsTable>;
|
|
@@ -1544,4 +1558,4 @@ declare function publicKeyPemFromPrivate(privateKeyPem: string): string;
|
|
|
1544
1558
|
declare function ed25519KeyId(publicKeyPem: string): string;
|
|
1545
1559
|
declare function signEd25519(payload: string, privateKey: KeyObject): string;
|
|
1546
1560
|
declare function verifyEd25519(payload: string, signatureBase64: string, publicKey: KeyObject): boolean;
|
|
1547
|
-
export { validateSubscriptionFilterForTable, sql, parseJsonb, logger, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getErrorMessage, getEnv, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, 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, TransactionsArchiveTable, 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, StreamsCursor, 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, EventsArchiveTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, EMPTY_RANGE_EVENT_INDEX_SENTINEL, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DeadRow, DeadLetterEventsTable, DatabaseError, Database, DEFAULT_BTC_CONFIRMATIONS, 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 };
|
|
1561
|
+
export { validateSubscriptionFilterForTable, sql, parseJsonb, logger, jsonb, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getErrorMessage, getEnv, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, 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, TransactionsArchiveTable, 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, StreamsCursor, 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, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, KeyRotatedError, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ForbiddenError, EventsTable, EventsArchiveTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, EMPTY_RANGE_EVENT_INDEX_SENTINEL, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DeadRow, DeadLetterEventsTable, DatabaseError, Database, DEFAULT_BTC_CONFIRMATIONS, 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 };
|
|
@@ -72,6 +72,17 @@ interface DeadLetterEventsTable {
|
|
|
72
72
|
reason: string;
|
|
73
73
|
created_at: Generated<Date>;
|
|
74
74
|
}
|
|
75
|
+
interface MempoolTransactionsTable {
|
|
76
|
+
seq: Generated<string>;
|
|
77
|
+
tx_id: string;
|
|
78
|
+
raw_tx: string;
|
|
79
|
+
type: string;
|
|
80
|
+
sender: string;
|
|
81
|
+
contract_id: string | null;
|
|
82
|
+
function_name: string | null;
|
|
83
|
+
function_args: unknown | null;
|
|
84
|
+
received_at: Generated<Date>;
|
|
85
|
+
}
|
|
75
86
|
interface IndexProgressTable {
|
|
76
87
|
network: string;
|
|
77
88
|
last_indexed_block: Generated<number>;
|
|
@@ -593,6 +604,7 @@ interface Database {
|
|
|
593
604
|
transactions_archive: TransactionsArchiveTable;
|
|
594
605
|
events_archive: EventsArchiveTable;
|
|
595
606
|
dead_letter_events: DeadLetterEventsTable;
|
|
607
|
+
mempool_transactions: MempoolTransactionsTable;
|
|
596
608
|
index_progress: IndexProgressTable;
|
|
597
609
|
contracts: ContractsTable;
|
|
598
610
|
subgraphs: SubgraphsTable;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
|
|
3
|
+
// Pending (unconfirmed) transactions captured directly from the Stacks node's
|
|
4
|
+
// /new_mempool_tx observer callback. Mempool is pre-chain: no block_height /
|
|
5
|
+
// tx_index / result / events, and never canonical or finalized. Rows are
|
|
6
|
+
// evicted when the tx confirms (block ingest) or drops (/drop_mempool_tx), and
|
|
7
|
+
// a retention sweep clears stuck rows. The node POSTs only raw_tx hex, so tx_id
|
|
8
|
+
// is derived from it. Ingest runs on every indexer instance, so writes are
|
|
9
|
+
// idempotent on tx_id.
|
|
10
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
11
|
+
await sql`SET lock_timeout = '30s'`.execute(db);
|
|
12
|
+
|
|
13
|
+
await sql`
|
|
14
|
+
CREATE TABLE IF NOT EXISTS mempool_transactions (
|
|
15
|
+
seq BIGSERIAL PRIMARY KEY,
|
|
16
|
+
tx_id TEXT NOT NULL UNIQUE,
|
|
17
|
+
raw_tx TEXT NOT NULL,
|
|
18
|
+
type TEXT NOT NULL,
|
|
19
|
+
sender TEXT NOT NULL,
|
|
20
|
+
contract_id TEXT,
|
|
21
|
+
function_name TEXT,
|
|
22
|
+
function_args JSONB,
|
|
23
|
+
received_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
24
|
+
)
|
|
25
|
+
`.execute(db);
|
|
26
|
+
|
|
27
|
+
await sql`CREATE INDEX IF NOT EXISTS mempool_transactions_sender_idx ON mempool_transactions (sender)`.execute(
|
|
28
|
+
db,
|
|
29
|
+
);
|
|
30
|
+
await sql`CREATE INDEX IF NOT EXISTS mempool_transactions_received_at_idx ON mempool_transactions (received_at)`.execute(
|
|
31
|
+
db,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
36
|
+
await sql`DROP TABLE IF EXISTS mempool_transactions`.execute(db);
|
|
37
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
|
|
3
|
+
// Composite index backing /v1/index/events keyset pagination for a bare
|
|
4
|
+
// event-type source (no contract/sender/recipient filter). The reader paginates
|
|
5
|
+
// with `event_type = ? AND (block_height, event_index) > (?, ?)
|
|
6
|
+
// ORDER BY block_height, event_index`. Without a leading-event_type composite,
|
|
7
|
+
// Postgres bitmap-ANDs the single-column event_type index — re-scanning the
|
|
8
|
+
// ENTIRE event-type partition (e.g. ~4.2M `print` rows) on every cursor page,
|
|
9
|
+
// turning a backfill into O(n²) (measured ~6.8s/page vs ~50ms for page one).
|
|
10
|
+
// With this index each page is an index range scan. Mirrors the existing
|
|
11
|
+
// (contract_id|sender|recipient, block_height, event_index) composites that
|
|
12
|
+
// already make filtered queries fast.
|
|
13
|
+
//
|
|
14
|
+
// Already created CONCURRENTLY on prod; IF NOT EXISTS makes this a no-op there
|
|
15
|
+
// and a cheap build on fresh/dev databases (small data).
|
|
16
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
17
|
+
await sql`CREATE INDEX IF NOT EXISTS decoded_events_type_height_event_idx ON decoded_events (event_type, block_height, event_index) WHERE canonical`.execute(
|
|
18
|
+
db,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
23
|
+
await sql`DROP INDEX IF EXISTS decoded_events_type_height_event_idx`.execute(
|
|
24
|
+
db,
|
|
25
|
+
);
|
|
26
|
+
}
|