-
Notifications
You must be signed in to change notification settings - Fork 50
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 #219 from makerdao/feature/sc-661/add-visual-for-h…
…ow-many-mkr-needed-to-pass Feature/sc 661/add visual for how many mkr needed to pass
- Loading branch information
Showing
4 changed files
with
78 additions
and
8 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,28 @@ | ||
import getMaker from 'lib/maker'; | ||
import useSWR from 'swr'; | ||
import { CurrencyObject } from 'types/currency'; | ||
|
||
type MkrOnHatResponse = { | ||
data?: CurrencyObject; | ||
loading: boolean; | ||
error: Error; | ||
}; | ||
|
||
export const useMkrOnHat = (): MkrOnHatResponse => { | ||
const { data, error } = useSWR<CurrencyObject>( | ||
'/executive/mkr-on-hat', | ||
async () => { | ||
const maker = await getMaker(); | ||
const hat = await maker.service('chief').getHat(); | ||
return maker.service('chief').getApprovalCount(hat); | ||
}, | ||
// refresh every 5 mins | ||
{ refreshInterval: 300000 } | ||
); | ||
|
||
return { | ||
data, | ||
loading: !error && !data, | ||
error | ||
}; | ||
}; |
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