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
3 changes: 3 additions & 0 deletions src/common/plugins/plugin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AccountDetailed } from "src/endpoints/accounts/entities/account.detaile
import { About } from "src/endpoints/network/entities/about";
import { Nft } from "src/endpoints/nfts/entities/nft";
import { Transaction } from "src/endpoints/transactions/entities/transaction";
import { EsdtSupply } from "../gateway/entities/esdt.supply";

@Injectable()
export class PluginService {
Expand All @@ -18,4 +19,6 @@ export class PluginService {
async batchProcessNfts(_nfts: Nft[], _withScamInfo?: boolean): Promise<void> { }

async processAbout(_about: About): Promise<void> { }

formatTokenSupply(_identifier: string, _esdtSupply: EsdtSupply) { }
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method formatTokenSupply is currently an empty stub. Consider adding a comment or a placeholder implementation (e.g., a NotImplemented error) to clarify its intended behavior.

Copilot uses AI. Check for mistakes.
}
2 changes: 2 additions & 0 deletions src/endpoints/esdt/esdt.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CollectionModule } from "../collections/collection.module";
import { TransactionModule } from "../transactions/transaction.module";
import { MexModule } from "../mex/mex.module";
import { AssetsModule } from "src/common/assets/assets.module";
import { PluginModule } from "../../plugins/plugin.module";


@Module({
Expand All @@ -19,6 +20,7 @@ import { AssetsModule } from "src/common/assets/assets.module";
forwardRef(() => TransactionModule),
forwardRef(() => MexModule.forRoot()),
forwardRef(() => AssetsModule),
forwardRef(() => PluginModule),
],
providers: [
EsdtService, EsdtAddressService,
Expand Down
6 changes: 5 additions & 1 deletion src/endpoints/esdt/esdt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { EsdtType } from "./entities/esdt.type";
import { ElasticIndexerService } from "src/common/indexer/elastic/elastic.indexer.service";
import { randomUUID } from "crypto";
import { EsdtSubType } from "./entities/esdt.sub.type";
import { PluginService } from "../../common/plugins/plugin.service";

@Injectable()
export class EsdtService {
Expand All @@ -27,6 +28,7 @@ export class EsdtService {
private readonly cachingService: CacheService,
private readonly vmQueryService: VmQueryService,
private readonly indexerService: IndexerService,
private readonly pluginService: PluginService,
@Inject(forwardRef(() => AssetsService))
private readonly assetsService: AssetsService,
private readonly elasticIndexerService: ElasticIndexerService
Expand Down Expand Up @@ -367,7 +369,9 @@ export class EsdtService {
}

async getTokenSupply(identifier: string): Promise<EsdtSupply> {
const { supply, minted, burned, initialMinted } = await this.gatewayService.getEsdtSupply(identifier);
const esdtSupply = await this.gatewayService.getEsdtSupply(identifier);
this.pluginService.formatTokenSupply(identifier, esdtSupply);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not fail if the formatTokenSupply is not defined in the plugin module

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, just tested and it works

Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to formatTokenSupply does not capture any return value. If the intent is to modify esdtSupply, consider either returning the formatted result or documenting that the method works via side effects.

Suggested change
this.pluginService.formatTokenSupply(identifier, esdtSupply);
esdtSupply = this.pluginService.formatTokenSupply(identifier, esdtSupply);

Copilot uses AI. Check for mistakes.
const { supply, minted, burned, initialMinted } = esdtSupply;

const isCollectionOrToken = identifier.split('-').length === 2;
if (isCollectionOrToken) {
Expand Down