cache transaction and receipt data in sqlite

This commit is contained in:
2026-05-16 21:09:22 +08:00
parent 49ada2febd
commit 6b7a773845
6 changed files with 676 additions and 3 deletions
@@ -0,0 +1,41 @@
CREATE TABLE `transaction_receipts` (
`transactionHash` text NOT NULL,
`chainId` text NOT NULL,
`blockHash` text NOT NULL,
`blockNumber` text NOT NULL,
`from` text NOT NULL,
`to` text,
`cumulativeGasUsed` text NOT NULL,
`gasUsed` text NOT NULL,
`status` text NOT NULL,
`effectiveGasPrice` text,
`contractAddress` text,
`type` text NOT NULL,
`transactionIndex` integer NOT NULL,
`logsBloom` text
);
--> statement-breakpoint
CREATE TABLE `transactions` (
`hash` text NOT NULL,
`chainId` text NOT NULL,
`from` text NOT NULL,
`to` text,
`value` text NOT NULL,
`blockNumber` text,
`blockHash` text,
`gas` text NOT NULL,
`gasPrice` text,
`maxFeePerGas` text,
`maxPriorityFeePerGas` text,
`input` text NOT NULL,
`nonce` integer NOT NULL,
`transactionIndex` integer,
`type` text,
`v` text,
`r` text,
`s` text,
`yParity` integer
);
--> statement-breakpoint
CREATE UNIQUE INDEX `receipt_unique` ON `transaction_receipts` (`chainId`,`transactionHash`);--> statement-breakpoint
CREATE UNIQUE INDEX `tx_unique` ON `transactions` (`chainId`,`hash`);