27cdd1c954
* tidy: added eslintrc and prettierrc rules * tidy: formated the files via ‚yarn format‘ * import sort improvements * format script regex fix * replace eslint import severity to warning * remove staged file Co-authored-by: Gustavo Mauricio <gustavo.mauricio58@gmail.com>
32 lines
667 B
TypeScript
32 lines
667 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { contractAddresses } from 'config/contracts'
|
|
import useWalletStore from 'stores/useWalletStore'
|
|
import { queryKeys } from 'types/query-keys-factory'
|
|
|
|
type Result = string[]
|
|
|
|
const queryMsg = {
|
|
allowed_coins: {},
|
|
}
|
|
|
|
const useAllowedCoins = () => {
|
|
const client = useWalletStore((s) => s.client)
|
|
|
|
const result = useQuery<Result>(
|
|
queryKeys.allowedCoins(),
|
|
async () => client?.queryContractSmart(contractAddresses.creditManager, queryMsg),
|
|
{
|
|
enabled: !!client,
|
|
staleTime: Infinity,
|
|
},
|
|
)
|
|
|
|
return {
|
|
...result,
|
|
data: result?.data,
|
|
}
|
|
}
|
|
|
|
export default useAllowedCoins
|