-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1021 from multiversx/SERVICES-1830-extend-account…
…-on-analytics Add account details
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Resolver, ResolveField, Parent } from '@nestjs/graphql'; | ||
import { BaseResolver } from '../common/base.resolver'; | ||
import { HoldersCount } from './models/general-stats.model'; | ||
import { Account } from '../account-stats/models'; | ||
import { AccountsProvider } from '../account-stats/loaders/accounts.loader'; | ||
|
||
@Resolver(() => HoldersCount) | ||
export class HoldersResolver extends BaseResolver(HoldersCount) { | ||
constructor(private readonly accountsProvider: AccountsProvider) { | ||
super(); | ||
} | ||
|
||
@ResolveField(() => Account) | ||
async accountDetails(@Parent() holders: HoldersCount) { | ||
const { address } = holders; | ||
|
||
if (!address) return null; | ||
const account = await this.accountsProvider.load(address); | ||
return Account.fromEntity(account?.value, address); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters