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

refactor(cli,world): move helper functions into world package, add getWorldAbi #3012

Merged
merged 26 commits into from
Aug 7, 2024

Conversation

karooolis
Copy link
Contributor

@karooolis karooolis commented Aug 6, 2024

getWorldAbi pulled out of #2849

Copy link

changeset-bot bot commented Aug 6, 2024

⚠️ No Changeset found

Latest commit: 9e8db4c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Member

Choose a reason for hiding this comment

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

do we need to move this? I don't think this is used by any helpers here

Copy link
Contributor Author

@karooolis karooolis Aug 6, 2024

Choose a reason for hiding this comment

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

It's needed because of how getWorldAbi is expecting the world deploy to be passed as one of the parameters https://github.com/latticexyz/mud/pull/2849/files#diff-c387c5680d2d7ed3fc8008e9769b2c37be5e4e2a0f11dda28f02521618047d1fR48-R53 . Subsequently, the world deploy param is used in getResourceIds({ client, worldDeploy }), getFunctions({ client, worldDeploy }), getResourceAccess({ client, worldDeploy }), getTableValue, and maybe some more.

Copy link
Member

Choose a reason for hiding this comment

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

if we change the helper signatures to not be deployment specific and take in just what they need (i.e. world address, from/to block), we won't need this!

Copy link
Contributor Author

@karooolis karooolis Aug 6, 2024

Choose a reason for hiding this comment

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

Ah that's right, just removed the worldDeploy dependency everywhere, and updated getSystems params to be:

export async function getSystems({
  client,
  worldAddress,
  stateBlock,
  deployBlock,
}: {
  readonly client: Client;
  readonly worldAddress: Address;
  readonly stateBlock: bigint;
  readonly deployBlock: bigint;
}): Promise<readonly DeployedSystem[]> {
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And updated all other helper functions to take in only the required params i.e. no more worldDeploy.

packages/world/ts/common.ts Outdated Show resolved Hide resolved
@karooolis karooolis requested a review from holic August 6, 2024 16:01
@holic holic changed the title chore(cli): move helper functions into world package refactor(cli): move helper functions into world package Aug 7, 2024
@holic holic changed the title refactor(cli): move helper functions into world package refactor(cli,world): move helper functions into world package Aug 7, 2024
holic
holic previously approved these changes Aug 7, 2024
Copy link
Member

@holic holic left a comment

Choose a reason for hiding this comment

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

overall looks good, but might consider including the entire base interface of the world alongside the world-scoped system functions

@karooolis
Copy link
Contributor Author

karooolis commented Aug 7, 2024

overall looks good, but might consider including the entire base interface of the world alongside the world-scoped system functions

Great! Good idea, makes sense to add base ABI at this layer, just added.

@karooolis karooolis requested a review from holic August 7, 2024 14:12
holic
holic previously approved these changes Aug 7, 2024
@holic holic changed the title refactor(cli,world): move helper functions into world package refactor(cli,world): move helper functions into world package, add getWorldAbi Aug 7, 2024
@karooolis karooolis requested a review from holic August 7, 2024 14:32
@karooolis karooolis merged commit 1b7004b into main Aug 7, 2024
15 checks passed
@karooolis karooolis deleted the kumpis/world-abi-functions branch August 7, 2024 14:41
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