Skip to content

Commit

Permalink
early return for null account
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-rosianu committed Dec 20, 2024
1 parent 3ccc841 commit 035128e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/endpoints/accounts/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,30 @@ export class AccountService {
}

const account = await this.getAccountRaw(address);
if (!account) {
return null;
}

if (account && withTxCount === true) {
if (withTxCount === true) {
account.txCount = await this.getAccountTxCount(address);
}

if (account && withAccountScResults === true) {
if (withAccountScResults === true) {
account.scrCount = await this.getAccountScResults(address);
}

if (account && withGuardianInfo === true) {
if (withGuardianInfo === true) {
await this.applyGuardianInfo(account);
}

if (account && withTimestamp) {
if (withTimestamp) {
const elasticSearchAccount = await this.indexerService.getAccount(address);
account.timestamp = elasticSearchAccount.timestamp;
}

if (AddressUtils.isSmartContractAddress(address)) {
const provider: Provider | undefined = await this.providerService.getProvider(address);
if (account && provider && provider.owner) {
if (provider && provider.owner) {
account.ownerAddress = provider.owner;
}
}
Expand Down

0 comments on commit 035128e

Please sign in to comment.