Skip to content

Commit

Permalink
Use isStructMembers
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau committed Sep 19, 2023
1 parent 1ff29fe commit d9d7799
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/core/src/storage/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TypeName,
} from 'solidity-ast';
import { isNodeType, findAll, ASTDereferencer } from 'solidity-ast/utils';
import { StorageLayout, StructMember, TypeItem } from './layout';
import { StorageLayout, StructMember, TypeItem, isStructMembers } from './layout';
import { normalizeTypeIdentifier } from '../utils/type-id';
import { SrcDecoder } from '../src-decoder';
import { mapValues } from '../utils/map-values';
Expand Down Expand Up @@ -43,9 +43,10 @@ export function extractStorageLayout(
layout.types = mapValues({ ...namespacedContext?.storageLayout?.types, ...storageLayout?.types }, m => {
return {
label: m.label,
members: m.members?.map(m =>
typeof m === 'string' ? m : pick(m, ['label', 'type', 'offset', 'slot']),
) as TypeItem['members'],
members:
m.members && isStructMembers(m.members)
? m.members.map(m => pick(m, ['label', 'type', 'offset', 'slot']))
: m.members,
numberOfBytes: m.numberOfBytes,
};
});
Expand Down

0 comments on commit d9d7799

Please sign in to comment.