on master help sign in
bridge/src/lib/useIsEclipticOwner.js
25 lines 580 B history raw
1import { useWallet } from 'store/wallet';
2import { usePointCache } from 'store/pointCache';
4import { eqAddr } from 'lib/utils/address';
5import useLifecycle from './useLifecycle';
7export default function useIsEclipticOwner() {
8 const { wallet } = useWallet();
9 const { eclipticOwner, syncEclipticOwner } = usePointCache();
11 useLifecycle(() => {
12 syncEclipticOwner();
13 });
15 return wallet.matchWith({
16 Nothing: () => false,
17 Just: p => {
18 if (!eclipticOwner) {
19 return false;
20 }
22 return eqAddr(p.value.address, eclipticOwner);
23 },
24 });