@@ -43,17 +43,15 @@ export class ApplicationService {
4343
4444 const assets = await this . assetsService . getAllAccountAssets ( ) ;
4545 const verifiedAccounts = await this . cacheService . get < string [ ] > ( CacheInfo . VerifiedAccounts . key ) || [ ] ;
46- const balances = await this . elasticIndexerService . getApplicationsBulkBalance ( elasticResults . map ( item => item . address ) , pagination ) ;
4746
4847 const applications = elasticResults . map ( item => new Application ( {
4948 contract : item . address ,
50- deployer : item . deployer ,
5149 owner : item . currentOwner ,
52- codeHash : item . initialCodeHash ,
5350 timestamp : item . timestamp ,
5451 assets : assets [ item . address ] ,
55- balance : balances [ item . address ] ? .balance || '0' ,
52+ balance : item . balance || '0' ,
5653 isVerified : verifiedAccounts . includes ( item . address ) ,
54+ transfersLast24h : item . api_transfersLast24h || 0 ,
5755 ...( filter . withTxCount && { txCount : 0 } ) ,
5856 } ) ) ;
5957
@@ -71,29 +69,17 @@ export class ApplicationService {
7169 return await this . elasticIndexerService . getApplicationCount ( filter ) ;
7270 }
7371
74- async getApplication ( address : string ) : Promise < Application > {
75- const indexResult = await this . elasticIndexerService . getApplication ( address ) ;
76- const assets = await this . assetsService . getAllAccountAssets ( ) ;
77- const verifiedAccounts = await this . cacheService . get < string [ ] > ( CacheInfo . VerifiedAccounts . key ) || [ ] ;
78-
72+ async getApplication ( address : string ) : Promise < Application | undefined > {
7973 const pagination = new QueryPagination ( { from : 0 , size : 1 } ) ;
80- const balances = await this . elasticIndexerService . getApplicationsBulkBalance ( [ address ] , pagination ) ;
81-
82- const result = new Application ( {
83- contract : indexResult . address ,
84- deployer : indexResult . deployer ,
85- owner : indexResult . currentOwner ,
86- codeHash : indexResult . initialCodeHash ,
87- timestamp : indexResult . timestamp ,
88- assets : assets [ address ] ,
89- balance : balances [ address ] ?. balance || '0' ,
90- txCount : 0 ,
91- isVerified : verifiedAccounts . includes ( address ) ,
92- } ) ;
93-
94- result . txCount = await this . getApplicationTxCount ( result . contract ) ;
95-
96- return result ;
74+ const filter = new ApplicationFilter ( { address } ) ;
75+
76+ const applications = await this . getApplicationsRaw ( pagination , filter ) ;
77+
78+ if ( ! applications || ! applications . length ) {
79+ return undefined ;
80+ }
81+
82+ return applications . at ( 0 ) ;
9783 }
9884
9985 private async getApplicationTxCount ( address : string ) : Promise < number > {
0 commit comments