Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <kingersoll@gmail.com>
  • Loading branch information
alvrs and holic committed Sep 21, 2023
1 parent 3b76172 commit e4d97bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/hexToResourceId.test.ts
Expand Up @@ -4,8 +4,8 @@ import { hexToResourceId } from "./hexToResourceId";
describe("hexToResourceId", () => {
it("can convert from hex string", () => {
const resourceId = hexToResourceId("0x74626e616d65737061636500000000006e616d65000000000000000000000000");
expect(resourceId.type).toMatchInlineSnapshot('"table"');
expect(resourceId.namespace).toMatchInlineSnapshot('"namespace"');
expect(resourceId.name).toMatchInlineSnapshot('"name"');
expect(resourceId.type).toMatchInlineSnapshot('"table"');
});
});
4 changes: 2 additions & 2 deletions packages/common/src/hexToResourceId.ts
Expand Up @@ -18,13 +18,13 @@ function getResourceType(resourceTypeId: string): ResourceType | undefined {

export function hexToResourceId(hex: Hex): ResourceId {
const resourceTypeId = hexToString(sliceHex(hex, 0, 2)).replace(/\0+$/, "");
const type = getResourceType(resourceTypeId);
const namespace = hexToString(sliceHex(hex, 2, 16)).replace(/\0+$/, "");
const name = hexToString(sliceHex(hex, 16, 32)).replace(/\0+$/, "");
const type = getResourceType(resourceTypeId);

if (!type) {
throw new Error(`Unknown resource type: ${resourceTypeId}`);
}

return { namespace, name, type };
return { type, namespace, name };
}
1 change: 0 additions & 1 deletion packages/world/src/interfaces/IModule.sol
Expand Up @@ -10,7 +10,6 @@ bytes4 constant MODULE_INTERFACE_ID = IModule.getName.selector ^
ERC165_INTERFACE_ID;

interface IModule is IERC165 {
error RequiredModuleNotFound(string moduleIdString);
error RootInstallModeNotSupported();
error NonRootInstallNotSupported();

Expand Down

0 comments on commit e4d97bc

Please sign in to comment.