Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(common): clarify resourceId (hex) from resource (object) #1706

Merged
merged 7 commits into from
Oct 9, 2023

Conversation

holic
Copy link
Member

@holic holic commented Oct 5, 2023

in #1702, I found myself getting a bit confused between resource ID (hex on chain) and resource ID (object in client)

I'm not sure if this is better but pulling this out in case we think this is a good direction

should hexToResource be resourceIdToResource or decodeResourceId?

@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2023

🦋 Changeset detected

Latest commit: f77f2ce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@latticexyz/common Major
@latticexyz/cli Major
@latticexyz/dev-tools Major
@latticexyz/store-sync Major
@latticexyz/block-logs-stream Major
@latticexyz/config Major
@latticexyz/protocol-parser Major
@latticexyz/store-indexer Major
@latticexyz/store Major
@latticexyz/world-modules Major
@latticexyz/world Major
@latticexyz/react Major
@latticexyz/abi-ts Major
create-mud Major
@latticexyz/ecs-browser Major
@latticexyz/faucet Major
@latticexyz/gas-report Major
@latticexyz/network Major
@latticexyz/noise Major
@latticexyz/phaserx Major
@latticexyz/recs Major
@latticexyz/schema-type Major
@latticexyz/services Major
@latticexyz/solecs Major
solhint-config-mud Major
solhint-plugin-mud Major
@latticexyz/std-client Major
@latticexyz/std-contracts Major
@latticexyz/store-cache Major
@latticexyz/utils Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

namespace: string;
name: string;
type: ResourceType;
hex: Hex;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should arguably call this resourceId if we're calling the object "resource"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree this could be resourceId

@holic holic marked this pull request as ready for review October 9, 2023 09:31
@@ -30,9 +29,6 @@
"codegen": [
"./src/codegen/index.ts"
],
"deprecated": [
"./src/deprecated/index.ts"
],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since there's @deprecated typedoc operator that does a better job of signaling deprecated stuff, I am preferring that now over marking this as deprecated in the export path

import { Hex, stringToHex, hexToString, sliceHex, concatHex } from "viem";

/** @deprecated Use `tableIdToHex` and `hexToTableId` instead. */
export class TableId {
Copy link
Member Author

@holic holic Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was deprecated/replaced a while ago but never removed and technically wouldn't work now anyway, so not sure we should consider this "breaking" because it's ~incompatible with the current MUD versions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like /deprecated is not exported anymore, should we keep createContract in the src directory then? Or fully remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see now /deprecated is still exported from the root index, so nevermind

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! we're just keeping things in /deprecated to make it easier to figure out what we need to remove in the future

@holic holic merged commit d2f8e94 into main Oct 9, 2023
@holic holic deleted the holic/resourceId-to-resource branch October 9, 2023 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants