-
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.
- Loading branch information
1 parent
b4a4bde
commit c1c5cb8
Showing
3 changed files
with
28 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); | ||
} | ||
} |