vega-frontend-monorepo/libs/deal-ticket/src/hooks/use-has-no-balance.tsx
macqbat b749a05736
chore(2071): deal ticket data update fixing (#2169)
* chore: update of deal ticket data

* chore: update of deal ticket data

* chore: update of deal ticket data - fix re-render loop

* chore: update of deal ticket data - add marketDealTicketProvider

* chore: update of deal ticket data - add marketDealTicketProvider

* chore: update of deal ticket data - adjust console-lite to the changes

* chore: update of deal ticket data - fix failing unit tests

* chore: update of deal ticket data - fix failing unit tests

* chore: update of deal ticket data - fix linter failings

* chore: update of deal ticket data - adjust console-lite-e2e

* chore: update of deal ticket data - fix build-spec failings

* chore: update of deal ticket data - fix failing e2e tests

* chore: update of deal ticket data - fix failing e2e tests

* chore: update of deal ticket data - fix failing e2e tests

* chore: update of deal ticket data - remove unnecessary gqls

* chore: update of deal ticket data - remove unnecessary gqls

* chore: update of deal ticket data - remove unnecessary gqls

* chore: update of deal ticket data - fix failings build

* chore: update of deal ticket data - remove redundant data provider

* chore: update of deal ticket data - remove redundant data provider

* chore: update of deal ticket data - fix some types
2022-11-22 09:31:26 +01:00

12 lines
416 B
TypeScript

import { useAccountBalance } from '@vegaprotocol/accounts';
import { toBigNum } from '@vegaprotocol/react-helpers';
export const useHasNoBalance = (assetId: string) => {
const { accountBalance, accountDecimals } = useAccountBalance(assetId);
const balance =
accountBalance && accountDecimals !== null
? toBigNum(accountBalance, accountDecimals)
: toBigNum('0', 0);
return balance.isZero();
};