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

📝 Docs: Update memoryClient jsdoc #1234

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

roninjin10
Copy link
Collaborator

@roninjin10 roninjin10 commented Jun 21, 2024

Description

Concise description of proposed changes

Testing

Explain the quality checks that have been done on the code changes

Additional Information

Your ENS/address:

Summary by CodeRabbit

  • New Features

    • Added powerful low-level APIs for interacting with the EVM, including tevmCall, tevmContract, tevmDeploy, tevmDumpState, tevmGetAccount, tevmLoadState, tevmMine, tevmReady, tevmSetAccount.
    • Enhanced createMemoryClient to offer detailed examples and explanations for low-level TEVM access.
  • Documentation

    • Updated documentation to provide more detailed explanations, examples, and references for new TEVM functionalities.
    • Deprecated tevmScript in favor of tevmContract with migration instructions and examples.

Sorry, something went wrong.

Copy link

vercel bot commented Jun 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tevm-monorepo-tevm ❌ Failed (Inspect) Jun 21, 2024 9:51pm

Copy link

changeset-bot bot commented Jun 21, 2024

🦋 Changeset detected

Latest commit: f18e9a5

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

This PR includes changesets to release 4 packages
Name Type
@tevm/memory-client Patch
@tevm/http-client Patch
@tevm/server Patch
tevm Patch

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

Copy link
Contributor

coderabbitai bot commented Jun 21, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The changes introduce extensive enhancements to the @tevm/memory-client package, focusing on providing low-level APIs for interacting with the EVM. This includes adding new methods, improving documentation with detailed examples, and emphasizing the use of client.extend for adding test actions. Additionally, various documentation files have been updated to reflect these new functionalities and deprecated entities.

Changes

Files/Groups Change Summaries
.changeset/large-zoos-knock.md Introduced additional JSDoc documentation and removed references to test clients.
memory-client/src/MemoryClient.ts Removed test client references and added information on using client.extend for adding test actions.
memory-client/src/TevmActions.ts Expanded TevmActions with new methods like tevmCall, tevmDeploy, tevmGetAccount, and others. Deprecated tevmScript.
memory-client/src/createMemoryClient.js Updated documentation comments to elaborate on creating MemoryClient, actions API support, and forking networks.
docs/.../functions/createMemoryClient.md Enhanced functionality descriptions with examples and deprecated tevmScript. Detailed new functions like tevmDeploy, tevmMine, etc.
docs/.../type-aliases/MemoryClient.md Updated MemoryClient description to exclude test client references and added a TypeScript example for adding test actions using client.extend.
docs/.../type-aliases/TevmActions.md Documented new powerful actions for EVM interactions, detailed examples for various methods, and deprecated tevmScript.
docs/.../functions/createExpressMiddleware.md Added low-level access to tevm, various new functions with examples, and deprecated tevmScript.
docs/.../functions/createHttpHandler.md Introduced low-level access to tevm, new EVM interaction methods, and examples for each.
docs/.../functions/createNextApiHandler.md Enhanced documentation with new Tevm functionalities, low-level access, and examples.
docs/.../functions/createServer.md Added descriptions and examples for low-level access to tevm, new methods for interacting with Tevm, and deprecated tevmScript.
memory-client/docs/.../createMemoryClient.md Elaborated on the creation of MemoryClient, added examples of low-level EVM operations, and deprecated tevmScript in favor of tevmContract.
memory-client/docs/.../MemoryClient.md Updated the MemoryClient description to reflect wrapping of only the viem public client and added a TypeScript example for adding test actions.
memory-client/docs/.../TevmActions.md Enhanced documentation with powerful new methods for EVM interactions, deprecated tevmScript, and provided detailed examples for each action.
server/docs/.../createExpressMiddleware.md Introduced low-level access to tevm, examples for various Tevm functionalities, and deprecated tevmScript in favor of tevmContract.
server/docs/.../createHttpHandler.md Enhanced documentation with new Tevm functionalities, provided low-level API methods, and added detailed usage examples for each method.

Poem

In memory's virtual halls we delve,
New methods for the client we wield.
With tevmCall and tevmDeploy,
Blockchain’s secrets we'll now enjoy.

Documentation bright and clear,
Enhancing paths both far and near.
From extend we've learned the way,
To code and test in light of day.

🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@roninjin10 roninjin10 marked this pull request as ready for review June 21, 2024 21:37
Copy link
Collaborator Author

roninjin10 commented Jun 21, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @roninjin10 and the rest of your teammates on Graphite Graphite

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a170f0f and af2d591.

Files selected for processing (4)
  • .changeset/large-zoos-knock.md (1 hunks)
  • packages/memory-client/src/MemoryClient.ts (2 hunks)
  • packages/memory-client/src/TevmActions.ts (1 hunks)
  • packages/memory-client/src/createMemoryClient.js (2 hunks)
Files skipped from review due to trivial changes (2)
  • .changeset/large-zoos-knock.md
  • packages/memory-client/src/MemoryClient.ts
Additional comments not posted (1)
packages/memory-client/src/createMemoryClient.js (1)

Line range hint 9-93: Excellent documentation enhancement!

The updated JSDoc comments provide a comprehensive overview of the MemoryClient's capabilities, including detailed examples and links to further documentation. This should greatly aid users in understanding and utilizing the MemoryClient effectively.

Verification successful

Documentation links are valid.

The updated JSDoc comments in createMemoryClient.js are comprehensive and enhance the usability of the MemoryClient. The documentation links provided are valid and accessible.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the validity of documentation links.

# Test: Check for HTTP 200 status for each documentation link.
curl -o /dev/null --silent --head --write-out '%{http_code}\n' https://tevm.sh/learn/clients/ | grep 200
curl -o /dev/null --silent --head --write-out '%{http_code}\n' https://tevm.sh/reference/tevm/memory-client/type-aliases/tevmactions/ | grep 200
curl -o /dev/null --silent --head --write-out '%{http_code}\n' https://viem.sh/docs/actions/public/introduction | grep 200

Length of output: 390

Comment on lines +5 to +244
* import { ERC20 } from './MyERC721.sol'
*
* const client = createMemoryClient()
* const token = ERC20.withAddress(`0x${'0721'.repeat(10)}`)
*
* const deploymentResult = await client.tevmDeploy({
* abi: token.abi,
* bytecode: token.bytecode,
* args: ['TokenName', 18, 'SYMBOL'],
* })
*
* console.log(deployedResult.createdAddressess)
*/
tevmDeploy: TevmActionsApi['deploy']
/**
* Mines a new block with all pending transactions. In `manual` mode you must call this manually before the cannonical head state is updated
* @example
* ```typescript
* import { createMemoryClient } from 'tevm'
*
* const client = createMemoryClient()
*
* await client.tevmMine()
* ```
*/
tevmMine: TevmActionsApi['mine']
/**
* Loads a json serializable state into the evm. This can be useful for persisting and restoring state between processes
* @example
* ```typescript
* import { createMemoryClient } from 'tevm'
* import fs from 'fs'
*
* const client = createMemoryClient()
*
* const state = fs.readFileSync('state.json', 'utf8')
*
* await client.tevmLoadState(state)
* ````
*/
tevmLoadState: TevmActionsApi['loadState']
/**
* Dumps a json serializable state from the evm. This can be useful for persisting and restoring state between processes
* @example
* ```typescript
* import { createMemoryClient } from 'tevm'
* import fs from 'fs'
* const client = createMemoryClient()
* const state = await client.tevmDumpState()
* fs.writeFileSync('state.json', JSON.stringify(state))
* ```
*/
tevmDumpState: TevmActionsApi['dumpState']
/**
* Sets any property of an account including
* - it's balance
* - It's nonce
* - It's contract deployedBytecode
* - It's contract state
* - more
* @see [SetAccountParams](https://tevm.sh/reference/tevm/actions/type-aliases/setaccountparams/) for options reference]
* @see [SetAccountResult](https://tevm.sh/reference/tevm/actions/type-aliases/setaccountresult/) for return values reference
* @example
* ```typescript
* import { createMemoryClient, numberToHex } from 'tevm'
* import { SimpleContract } from 'tevm/contract'
*
* const client = createMemoryClient()
*
* await client.tevmSetAccount({
* address: `0x${'0123'.repeat(10)}`,
* balance: 100n,
* nonce: 1n,
* deployedBytecode: SimpleContract.deployedBytecode,
* state: {
* [`0x${'0'.repeat(64)}`]: numberToHex(420n),
* }
* })
* ```
*
*/
tevmSetAccount: TevmActionsApi['setAccount']
/**
* Gets the account state of an account
* It does not return the storage state by default but can if `returnStorage` is set to `true`. In forked mode the storage is only the storage
* Tevm has cached and may not represent all the onchain storage.
* @see [GetAccountParams](https://tevm.sh/reference/tevm/actions/type-aliases/getaccountparams/) for options reference
* @see [GetAccountResult](https://tevm.sh/reference/tevm/actions/type-aliases/getaccountresult/) for return values reference
* @example
* ```typescript
* import { createMemoryClient } from 'tevm'
*
* const client = createMemoryClient()
*
* const account = await client.tevmGetAccount({
* address: `0x${'0000'.repeat(10)}`,
* returnStorage: true,
* })
* ```
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Comprehensive API expansion and excellent documentation!

The API has been significantly expanded to include a variety of new methods that enhance interaction with the EVM. The documentation is detailed, providing clear examples and descriptions of each method's functionality. However, consider adding more detailed examples for the new methods to ensure users can fully understand their usage without ambiguity.

Would you like assistance in creating additional examples or refining the existing documentation?

@roninjin10 roninjin10 merged commit 6595da4 into main Jun 21, 2024
15 of 16 checks passed
@roninjin10 roninjin10 deleted the 06-21-_memo_docs_update_memoryclient_jsdoc branch June 21, 2024 21:43
roninjin10 pushed a commit that referenced this pull request Jun 21, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @tevm/[email protected]

### Patch Changes

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed issues with
error handling and added unit testing

## @tevm/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed issues with
error handling and added unit testing

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fix bug with
error tags not being set properly

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed issues with
error handling and added unit testing

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`6595da4`](6595da4),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed issues with
error handling and added unit testing

## @tevm/[email protected]

### Patch Changes

- [#1234](#1234)
[`6595da4`](6595da4)
Thanks [@roninjin10](https://github.com/roninjin10)! - Add more jsdoc to
MemoryClient docs

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed issues with
error handling and added unit testing

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`6595da4`](6595da4),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed issues with
error handling and added unit testing

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## [email protected]

### Patch Changes

- [#1232](#1232)
[`a170f0f`](a170f0f)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed issues with
error handling and added unit testing

- Updated dependencies
\[[`a170f0f`](a170f0f),
[`6595da4`](6595da4),
[`a170f0f`](a170f0f)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

None yet

1 participant