Skip to content

Commit

Permalink
Merge pull request #162 from ensdomains/mdt/update-fuse-util
Browse files Browse the repository at this point in the history
update fuse util
  • Loading branch information
mdtanrikulu authored May 10, 2023
2 parents 859df58 + f66ace1 commit 79deb11
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/fuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const userSettableFuseEnum = {

export const fullFuseEnum = {
...userSettableFuseEnum,
...fullParentFuseEnum,
CAN_DO_EVERYTHING,
};

Expand Down Expand Up @@ -116,9 +117,8 @@ const decodeNamedFuses = (fuses: number, arr: readonly string[]) => {
const fuseObj = Object.fromEntries(
arr.map((fuse) => [
fuse,
(fuses &
userSettableFuseEnum[fuse as keyof typeof userSettableFuseEnum]) >
0,
(fuses & fullFuseEnum[fuse as keyof typeof fullFuseEnum]) ===
fullFuseEnum[fuse as keyof typeof fullFuseEnum],
])
);

Expand All @@ -127,7 +127,7 @@ const decodeNamedFuses = (fuses: number, arr: readonly string[]) => {

const decodeUnnamedFuses = (fuses: number, arr: readonly number[]) => {
const fuseObj = Object.fromEntries(
arr.map((fuse) => [fuse, (fuses & fuse) > 0])
arr.map((fuse) => [fuse, (fuses & fuse) === fuse])
);

return fuseObj;
Expand Down Expand Up @@ -176,7 +176,7 @@ export const WrapperState = Object.freeze({
WRAPPED: 'Wrapped',
});

export type WrapperState = typeof WrapperState[keyof typeof WrapperState];
export type WrapperState = (typeof WrapperState)[keyof typeof WrapperState];

export function getWrapperState(fuses: PartialFuseSet): WrapperState {
if (fuses.parent.PARENT_CANNOT_CONTROL) {
Expand Down

0 comments on commit 79deb11

Please sign in to comment.