1import { eqAddr } from './wallet';
2import { usePointCache } from 'store/pointCache';
4const NULL_PERMISSIONS = {
6 isTransferProxy: false,
7 isManagementProxy: false,
12 * @param {string} address
13 * @param {number} point
15export default function usePermissionsForPoint(address, point) {
16 const { getDetails } = usePointCache();
18 return getDetails(point).matchWith({
19 Nothing: () => NULL_PERMISSIONS,
20 Just: ({ value: details }) => {
21 const isOwner = eqAddr(address, details.owner);
22 const isTransferProxy = eqAddr(address, details.transferProxy);
23 const isManagementProxy = eqAddr(address, details.managementProxy);
24 const canTransfer = isOwner || isTransferProxy;
26 return { isOwner, isTransferProxy, isManagementProxy, canTransfer };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list