mars-v2-frontend/hooks/useAllBalances.tsx
Gustavo Mauricio 28c53b1e59
Wallets integration (#3)
* keplr/metamask integration initial commit

* chains settings and type definitions. notifications prototype

* fix: dom nested buttons

* address copied toast

* react-toastify colors

* wallet store and initial queries setup. zustand and react query dependencies added

* _app code cleanup

* remove obsolete WalletContext

* unused import

* walletStore initial commit

* leftover component reference removed

* fix: react hydration mismatch wallet component

* metamask conditional click handler

* connect modal minor tweaks and wallet installation urls added
2022-09-14 12:28:18 +01:00

21 lines
452 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import useWalletStore from "stores/useWalletStore";
const useAllBalances = () => {
const address = useWalletStore((state) => state.address);
return useQuery(
["allBalances"],
() =>
fetch(
`https://lcd.injective.network/cosmos/bank/v1beta1/balances/${address}`
).then((res) => res.json()),
{
enabled: !!address,
}
);
};
export default useAllBalances;