Skip to content

Commit

Permalink
useGovernanceUser(): convert strings to BigInt
Browse files Browse the repository at this point in the history
  • Loading branch information
bpierre committed Jan 14, 2025
1 parent 3457c23 commit 64ede7b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion frontend/app/src/subgraph-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,22 @@ export function useGovernanceUser(account: Address | null, options?: Options) {
const { governanceUser } = await graphQuery(GovernanceUser, {
id: account.toLowerCase(),
});
return governanceUser;
if (!governanceUser) {
return null;
}
return {
...governanceUser,
id: governanceUser.id as Address,
allocatedLQTY: BigInt(governanceUser.allocatedLQTY),
stakedLQTY: BigInt(governanceUser.stakedLQTY),
stakedOffset: BigInt(governanceUser.stakedOffset),
allocations: governanceUser.allocations.map((allocation) => ({
...allocation,
voteLQTY: BigInt(allocation.voteLQTY),
vetoLQTY: BigInt(allocation.vetoLQTY),
initiative: allocation.initiative.id as Address,
})),
};
};

// TODO: demo mode
Expand Down

0 comments on commit 64ede7b

Please sign in to comment.