Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/common/indexer/entities/collection.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
export interface CollectionProperties {
canMint?: boolean;
canBurn?: boolean;
canUpgrade?: boolean;
canTransferNFTCreateRole?: boolean;
canAddSpecialRoles?: boolean;
canPause?: boolean;
canFreeze?: boolean;
canWipe?: boolean;
canChangeOwner?: boolean;
canCreateMultiShard?: boolean;
}

export interface Collection {
_id: string;
name: string;
ticker: string;
token: string;
issuer: string;
currentOwner: string;
numDecimals?: number;
type: string;
timestamp: number;
ownersHistory: { address: string, timestamp: number }[];
properties?: CollectionProperties;
api_isVerified?: boolean;
api_nftCount?: number;
api_holderCount?: number;
Expand Down
54 changes: 30 additions & 24 deletions src/endpoints/accounts/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { GatewayService } from 'src/common/gateway/gateway.service';
import { IndexerService } from "src/common/indexer/indexer.service";
import { AccountAssets } from 'src/common/assets/entities/account.assets';
import { CacheInfo } from 'src/utils/cache.info';
import { ConcurrencyUtils } from 'src/utils/concurrency.utils';
import { UsernameService } from '../usernames/username.service';
import { ContractUpgrades } from './entities/contract.upgrades';
import { AccountVerification } from './entities/account.verification';
Expand Down Expand Up @@ -356,36 +357,41 @@ export class AccountService {
}
}

for (const account of accounts) {
account.shard = AddressUtils.computeShard(AddressUtils.bech32Decode(account.address), shardCount);
account.assets = assets[account.address];
await ConcurrencyUtils.executeWithConcurrencyLimit(
accounts,
async (account) => {
account.shard = AddressUtils.computeShard(AddressUtils.bech32Decode(account.address), shardCount);
account.assets = assets[account.address];

if (options.withDeployInfo && AddressUtils.isSmartContractAddress(account.address)) {
const [deployedAt, deployTxHash] = await Promise.all([
this.getAccountDeployedAt(account.address),
this.getAccountDeployedTxHash(account.address),
]);
if (options.withDeployInfo && AddressUtils.isSmartContractAddress(account.address)) {
const [deployedAt, deployTxHash] = await Promise.all([
this.getAccountDeployedAt(account.address),
this.getAccountDeployedTxHash(account.address),
]);

account.deployedAt = deployedAt;
account.deployTxHash = deployTxHash;
}
account.deployedAt = deployedAt;
account.deployTxHash = deployTxHash;
}

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

if (options.withScrCount) {
account.scrCount = await this.getAccountScResults(account.address);
}
if (options.withScrCount) {
account.scrCount = await this.getAccountScResults(account.address);
}

if (options.withOwnerAssets && account.ownerAddress) {
account.ownerAssets = assets[account.ownerAddress];
}
if (options.withOwnerAssets && account.ownerAddress) {
account.ownerAssets = assets[account.ownerAddress];
}

if (verifiedAccounts && verifiedAccounts.includes(account.address)) {
account.isVerified = true;
}
}
if (verifiedAccounts && verifiedAccounts.includes(account.address)) {
account.isVerified = true;
}
},
6,
'AccountService.getAccountsRaw',
);

return accounts;
}
Expand Down
Loading
Loading