Skip to content

Commit

Permalink
default chain as passed in the header
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco committed Oct 18, 2023
1 parent 6c7441e commit 3fc1292
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions modules/user/user.resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { Resolvers } from '../../schema';
import { userService } from './user.service';
import { getRequiredAccountAddress, isAdminRoute } from '../auth/auth-context';
import { tokenService } from '../token/token.service';
import { $Enums } from '@prisma/client';

const allChains = Object.values($Enums.Chain);
import { networkContext } from '../network/network-context.service';

const resolvers: Resolvers = {
Query: {
userGetPoolBalances: async (parent, { chains, address }, context) => {
chains = chains && chains.length > 0 ? chains : allChains;
chains = chains && chains.length > 0 ? chains : [networkContext.chain];
const accountAddress = address || getRequiredAccountAddress(context);
const tokenPrices = await tokenService.getTokenPricesForChains(chains);
const balances = await userService.getUserPoolBalances(accountAddress, chains);
Expand Down

0 comments on commit 3fc1292

Please sign in to comment.