-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delegation and Error Handling (#662)
* Change logic for delegation voting power and add validation for user balance Signed-off-by: Manank Patni <[email protected]> * Change voting power voting logic Signed-off-by: Manank Patni <[email protected]> * Rename vote weight hook and add check for delegation supported Signed-off-by: Manank Patni <[email protected]> --------- Signed-off-by: Manank Patni <[email protected]>
- Loading branch information
Showing
10 changed files
with
58 additions
and
33 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
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
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
26 changes: 26 additions & 0 deletions
26
src/services/contracts/token/hooks/useTokenDelegationSupported.ts
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,26 @@ | ||
import { useQuery } from "react-query" | ||
import { isTokenDelegationSupported } from "services/bakingBad/tokenBalances" | ||
import { useTezos } from "services/beacon/hooks/useTezos" | ||
|
||
export const useTokenDelegationSupported = (tokenAddress: string | undefined) => { | ||
const { tezos } = useTezos() | ||
|
||
const { data, ...rest } = useQuery<boolean, Error>( | ||
["delegationSupported", tokenAddress], | ||
async () => { | ||
let tokenDelegationSupported = false | ||
if (tokenAddress) { | ||
tokenDelegationSupported = await isTokenDelegationSupported(tezos, tokenAddress) | ||
} | ||
return tokenDelegationSupported | ||
}, | ||
{ | ||
enabled: !!tokenAddress | ||
} | ||
) | ||
|
||
return { | ||
data, | ||
...rest | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
...ts/token/hooks/useDelegationVoteWeight.ts → ...ntracts/token/hooks/useTokenVoteWeight.ts
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