@@ -20,6 +20,11 @@ import { responseHandler } from '#middlewares/response';
2020import type { RequestValidator } from '#middlewares/validate' ;
2121import sql from '#sql/accounts' ;
2222
23+ type Deployment = {
24+ block_timestamp : string ;
25+ receipt_id : string ;
26+ } ;
27+
2328const contract = responseHandler (
2429 response . contract ,
2530 async ( req : RequestValidator < ContractReq > ) => {
@@ -40,9 +45,7 @@ const deployments = responseHandler(
4045
4146 const first = await rollingWindow (
4247 ( start , end ) => {
43- return dbContract . oneOrNone <
44- Pick < ContractDeployment , 'block_timestamp' | 'receipt_id' >
45- > ( sql . contracts . deployments , {
48+ return dbContract . oneOrNone < Deployment > ( sql . contracts . deployments , {
4649 account,
4750 end,
4851 order : 'ASC' ,
@@ -54,9 +57,7 @@ const deployments = responseHandler(
5457
5558 const last = await rollingWindow (
5659 ( start , end ) => {
57- return dbContract . oneOrNone <
58- Pick < ContractDeployment , 'block_timestamp' | 'receipt_id' >
59- > ( sql . contracts . deployments , {
60+ return dbContract . oneOrNone < Deployment > ( sql . contracts . deployments , {
6061 account,
6162 end,
6263 order : 'DESC' ,
@@ -82,13 +83,7 @@ const deployments = responseHandler(
8283 } ) ;
8384 const unionQuery = queries . join ( '\nUNION ALL\n' ) ;
8485
85- const data =
86- await dbBase . manyOrNone <
87- Pick <
88- ContractDeployment ,
89- 'block' | 'predecessor_account_id' | 'transaction_hash'
90- >
91- > ( unionQuery ) ;
86+ const data = await dbBase . manyOrNone < ContractDeployment > ( unionQuery ) ;
9287
9388 return { data } ;
9489 } ,
0 commit comments