Skip to content

Commit

Permalink
chore: fix biome linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Apr 30, 2024
1 parent 8558c71 commit 7ce9ab4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/lib/schemaParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('schemaParser getSchema', () => {
it('finds known SomeBytes32Mapping:<bytes32>', () => {
const bytes32Value =
'1111222233334444555566667777888899990000aaaabbbbccccddddeeeeffff';
const name = `SomeBytes32Mapping:<bytes32>`;
const name = 'SomeBytes32Mapping:<bytes32>';
const dynamicName = `SomeBytes32Mapping:0x${bytes32Value}`;
const key = `0x0cfc51aec37c55a4d0b10000${bytes32Value.slice(0, 42)}`;

Expand All @@ -157,7 +157,7 @@ describe('schemaParser getSchema', () => {

it('finds known SomeSelectorMap:<bytes4>', () => {
const bytes4Value = 'beefbeef';
const name = `SomeSelectorMap:<bytes4>`;
const name = 'SomeSelectorMap:<bytes4>';
const dynamicName = `SomeSelectorMap:0x${bytes4Value}`;
const key = `0x0cfc51aec37c55a4d0b10000${bytes4Value}00000000000000000000000000000000`;

Expand All @@ -180,7 +180,7 @@ describe('schemaParser getSchema', () => {
describe('MappingWithGrouping', () => {
it('finds MappingWithGrouping', () => {
const address = 'af3bf2ffb025098b79caddfbdd113b3681817744';
const name = `AddressPermissions:Permissions:<address>`;
const name = 'AddressPermissions:Permissions:<address>';
const dynamicName = `AddressPermissions:Permissions:0x${address}`;
const key = `0x4b80742de2bf82acb3630000${address}`;
const schema = getSchema(key);
Expand Down
14 changes: 8 additions & 6 deletions src/lib/schemaParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ const findMappingSchemaForKey = (
// replace dynamic placeholder in the map part (e.g: <address>, <bytes32>) with the hex value
if (isDynamicKeyName(keySchema.name)) {
dynamicPartName = secondWordHex;
result['dynamicName'] = `${keyNameParts[0]}:0x${dynamicPartName}`;
result['dynamicKeyPart'] = `0x${secondWordHex}`;
(
result as DynamicNameSchema
).dynamicName = `${keyNameParts[0]}:0x${dynamicPartName}`;
(result as DynamicNameSchema).dynamicKeyPart = `0x${secondWordHex}`;
}

// if first 20 bytes of the hash of second word in schema match,
Expand All @@ -153,10 +155,10 @@ const findMappingWithGroupingSchemaForKey = (
const dynamicKeyPart = key.substring(26);

if (isDynamicKeyName(keySchema.name)) {
keySchema[
'dynamicName'
] = `${keyNameParts[0]}:${keyNameParts[1]}:0x${dynamicKeyPart}`;
keySchema['dynamicKeyPart'] = `0x${dynamicKeyPart}`;
(
keySchema as DynamicNameSchema
).dynamicName = `${keyNameParts[0]}:${keyNameParts[1]}:0x${dynamicKeyPart}`;
(keySchema as DynamicNameSchema).dynamicKeyPart = `0x${dynamicKeyPart}`;
}

return {
Expand Down

0 comments on commit 7ce9ab4

Please sign in to comment.