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: Add README and JSDOC to Tevm API #800

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

roninjin10
Copy link
Collaborator

@roninjin10 roninjin10 commented Jan 8, 2024

Description

Fully productionize the API package

Testing

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

Additional Information

Your ENS/address:

Summary by CodeRabbit

  • Documentation

    • Updated API documentation to clarify the usage and structure of the Tevm system.
    • Enhanced readability of the documentation by reorganizing content and improving descriptions.
    • Added clear distinctions between high-level and low-level APIs in the Tevm system.
  • New Features

    • Introduced a new method writeContractOptimistic to the Tevm API.
  • Refactor

    • Updated type definitions and references to align with the new Tevm entity replacing TevmClient.
  • Chores

    • Reorganized package structure for better clarity and maintenance.
    • Modified build configuration to include new entry points for the package.
  • Style

    • Removed visual elements from documentation to focus on textual clarity.
    • Standardized naming conventions across Tevm JSON-RPC requests and responses for consistency.
  • Tests

    • Adjusted test cases to reflect changes in type declarations and API structure.

Copy link

vercel bot commented Jan 8, 2024

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

Name Status Preview Comments Updated (UTC)
evmts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2024 3:48am

Copy link

changeset-bot bot commented Jan 8, 2024

🦋 Changeset detected

Latest commit: 1857945

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

This PR includes changesets to release 5 packages
Name Type
@tevm/api Patch
@tevm/procedures Patch
@tevm/server Patch
@tevm/vm Patch
@tevm/zod 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

@roninjin10
Copy link
Collaborator Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Contributor

coderabbitai bot commented Jan 8, 2024

Warning

Rate Limit Exceeded

@roninjin10 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 50 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between c9c054a and 1857945.

Walkthrough

The codebase has undergone a refactoring process where the TevmClient type has been universally renamed to Tevm. A new method writeContractOptimistic was added, and the documentation, including READMEs and module descriptions, has been updated to reflect these changes and improve clarity. The high-level and low-level APIs of the @tevm/api package have been delineated, and the error handling has been enhanced with more descriptive comments and examples.

Changes

File Pattern Change Summary
.extensions/viem/...
.vm/vm/src/Tevm.ts
Renamed TevmClient to Tevm and added writeContractOptimistic method. Updated type references and comments for clarity.
.vm/api/README.md
.vm/api/docs/README.md
Reorganized and restructured documentation for better clarity. Removed visual elements and updated headings.
.vm/api/src/.../README.md Added new READMEs explaining the purpose and usage of handlers, procedures, params, requests, responses, results, and utilities in the @tevm/api.
.vm/api/tsup.config.ts Updated build configuration to include new entry points for index files.
.vm/procedures/src/requestProcedure.js Updated the return type declaration to reflect the renaming from TevmClient to Tevm.
.changeset/...
.vm/api/src/errors/...
.vm/api/src/handlers/...
.vm/api/src/params/...
.vm/api/src/procedure/...
.vm/api/src/requests/...
Various files updated with comments, examples, and documentation for clarity.

🐇✨
In the realm of code, where rabbits dare to tread,
A Tevm emerges, as TevmClient sheds.
With writeContractOptimistic in its hop,
The docs now clearer, the confusion they stop. 🌟📜

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

vm/api/tsup.config.ts Outdated Show resolved Hide resolved
Apply suggestions from code review
@roninjin10 roninjin10 force-pushed the 01-07-feat_Add_README_and_JSDOC_to_Tevm_API branch from 908345e to 5e33d9b Compare January 8, 2024 01:43
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c9c054a and c365712.
Files ignored due to filter (1)
  • vm/api/package.json
Files selected for processing (76)
  • .changeset/quiet-eagles-sniff.md (1 hunks)
  • .changeset/shy-clouds-teach.md (1 hunks)
  • extensions/viem/docs/modules.md (2 hunks)
  • extensions/viem/src/ViemTevmClient.ts (1 hunks)
  • extensions/viem/src/ViemTevmOptimisticClient.ts (2 hunks)
  • extensions/viem/src/tevmViemExtension.js (5 hunks)
  • vm/api/README.md (1 hunks)
  • vm/api/docs/README.md (1 hunks)
  • vm/api/docs/modules.md (33 hunks)
  • vm/api/src/README.md (1 hunks)
  • vm/api/src/Tevm.ts (1 hunks)
  • vm/api/src/TevmJsonRpcRequestHandler.ts (1 hunks)
  • vm/api/src/errors/AccountError.ts (1 hunks)
  • vm/api/src/errors/BaseCallError.ts (1 hunks)
  • vm/api/src/errors/CallError.ts (1 hunks)
  • vm/api/src/errors/ContractError.ts (1 hunks)
  • vm/api/src/errors/DecodeFunctionDataError.ts (1 hunks)
  • vm/api/src/errors/EncodeFunctionReturnDataError.ts (1 hunks)
  • vm/api/src/errors/EvmError.ts (1 hunks)
  • vm/api/src/errors/InvalidAbiError.ts (1 hunks)
  • vm/api/src/errors/InvalidAddressError.ts (1 hunks)
  • vm/api/src/errors/InvalidArgsError.ts (1 hunks)
  • vm/api/src/errors/InvalidBalanceError.ts (1 hunks)
  • vm/api/src/errors/InvalidBlobVersionedHashesError.ts (1 hunks)
  • vm/api/src/errors/InvalidBlockError.ts (1 hunks)
  • vm/api/src/errors/InvalidBytecodeError.ts (1 hunks)
  • vm/api/src/errors/InvalidCallerError.ts (1 hunks)
  • vm/api/src/errors/InvalidDataError.ts (1 hunks)
  • vm/api/src/errors/InvalidDeployedBytecodeError.ts (1 hunks)
  • vm/api/src/errors/InvalidDepthError.ts (1 hunks)
  • vm/api/src/errors/InvalidFunctionNameError.ts (1 hunks)
  • vm/api/src/errors/InvalidGasLimitError.ts (1 hunks)
  • vm/api/src/errors/InvalidGasPriceError.ts (1 hunks)
  • vm/api/src/errors/InvalidGasRefundError.ts (1 hunks)
  • vm/api/src/errors/InvalidNonceError.ts (1 hunks)
  • vm/api/src/errors/InvalidOriginError.ts (1 hunks)
  • vm/api/src/errors/InvalidRequestError.ts (1 hunks)
  • vm/api/src/errors/InvalidSaltError.ts (1 hunks)
  • vm/api/src/errors/InvalidSelfdestructError.ts (1 hunks)
  • vm/api/src/errors/InvalidSkipBalanceError.ts (1 hunks)
  • vm/api/src/errors/InvalidStorageRootError.ts (1 hunks)
  • vm/api/src/errors/InvalidToError.ts (1 hunks)
  • vm/api/src/errors/InvalidValueError.ts (1 hunks)
  • vm/api/src/errors/README.md (1 hunks)
  • vm/api/src/errors/ScriptError.ts (1 hunks)
  • vm/api/src/errors/TypedError.ts (1 hunks)
  • vm/api/src/errors/UnexpectedError.ts (1 hunks)
  • vm/api/src/handlers/AccountHandler.ts (1 hunks)
  • vm/api/src/handlers/CallHandler.ts (1 hunks)
  • vm/api/src/handlers/ContractHandler.ts (1 hunks)
  • vm/api/src/handlers/README.md (1 hunks)
  • vm/api/src/handlers/ScriptHandler.ts (1 hunks)
  • vm/api/src/index.ts (1 hunks)
  • vm/api/src/params/AccountParams.ts (1 hunks)
  • vm/api/src/params/BaseCallParams.ts (1 hunks)
  • vm/api/src/params/CallParams.ts (1 hunks)
  • vm/api/src/params/ContractParams.ts (1 hunks)
  • vm/api/src/params/README.md (1 hunks)
  • vm/api/src/params/ScriptParams.ts (1 hunks)
  • vm/api/src/procedure/AccountJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/procedure/CallJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/procedure/ContractJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/procedure/README.md (1 hunks)
  • vm/api/src/procedure/ScriptJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/requests/AccountJsonRpcRequest.ts (1 hunks)
  • vm/api/src/requests/CallJsonRpcRequest.ts (1 hunks)
  • vm/api/src/requests/JsonRpcRequest.ts (1 hunks)
  • vm/api/src/requests/README.md (1 hunks)
  • vm/api/src/requests/ScriptJsonRpcRequest.ts (2 hunks)
  • vm/api/src/requests/TevmJsonRpcRequest.ts (1 hunks)
  • vm/api/src/responses/README.md (1 hunks)
  • vm/api/src/result/README.md (1 hunks)
  • vm/api/src/utils/README.md (1 hunks)
  • vm/api/tsup.config.ts (1 hunks)
  • vm/procedures/src/requestProcedure.js (2 hunks)
  • vm/vm/src/Tevm.ts (2 hunks)
Files skipped from review due to trivial changes (60)
  • .changeset/quiet-eagles-sniff.md
  • extensions/viem/src/ViemTevmOptimisticClient.ts
  • vm/api/docs/README.md
  • vm/api/src/TevmJsonRpcRequestHandler.ts
  • vm/api/src/errors/AccountError.ts
  • vm/api/src/errors/BaseCallError.ts
  • vm/api/src/errors/CallError.ts
  • vm/api/src/errors/ContractError.ts
  • vm/api/src/errors/DecodeFunctionDataError.ts
  • vm/api/src/errors/EncodeFunctionReturnDataError.ts
  • vm/api/src/errors/EvmError.ts
  • vm/api/src/errors/InvalidAbiError.ts
  • vm/api/src/errors/InvalidAddressError.ts
  • vm/api/src/errors/InvalidArgsError.ts
  • vm/api/src/errors/InvalidBalanceError.ts
  • vm/api/src/errors/InvalidBlobVersionedHashesError.ts
  • vm/api/src/errors/InvalidBlockError.ts
  • vm/api/src/errors/InvalidBytecodeError.ts
  • vm/api/src/errors/InvalidCallerError.ts
  • vm/api/src/errors/InvalidDataError.ts
  • vm/api/src/errors/InvalidDeployedBytecodeError.ts
  • vm/api/src/errors/InvalidDepthError.ts
  • vm/api/src/errors/InvalidFunctionNameError.ts
  • vm/api/src/errors/InvalidGasPriceError.ts
  • vm/api/src/errors/InvalidGasRefundError.ts
  • vm/api/src/errors/InvalidNonceError.ts
  • vm/api/src/errors/InvalidOriginError.ts
  • vm/api/src/errors/InvalidRequestError.ts
  • vm/api/src/errors/InvalidSaltError.ts
  • vm/api/src/errors/InvalidSelfdestructError.ts
  • vm/api/src/errors/InvalidSkipBalanceError.ts
  • vm/api/src/errors/InvalidStorageRootError.ts
  • vm/api/src/errors/InvalidToError.ts
  • vm/api/src/errors/InvalidValueError.ts
  • vm/api/src/errors/README.md
  • vm/api/src/errors/ScriptError.ts
  • vm/api/src/errors/TypedError.ts
  • vm/api/src/errors/UnexpectedError.ts
  • vm/api/src/handlers/CallHandler.ts
  • vm/api/src/handlers/ContractHandler.ts
  • vm/api/src/handlers/README.md
  • vm/api/src/handlers/ScriptHandler.ts
  • vm/api/src/params/AccountParams.ts
  • vm/api/src/params/CallParams.ts
  • vm/api/src/params/ContractParams.ts
  • vm/api/src/params/README.md
  • vm/api/src/params/ScriptParams.ts
  • vm/api/src/procedure/AccountJsonRpcProcedure.ts
  • vm/api/src/procedure/CallJsonRpcProcedure.ts
  • vm/api/src/procedure/README.md
  • vm/api/src/procedure/ScriptJsonRpcProcedure.ts
  • vm/api/src/requests/AccountJsonRpcRequest.ts
  • vm/api/src/requests/CallJsonRpcRequest.ts
  • vm/api/src/requests/JsonRpcRequest.ts
  • vm/api/src/requests/ScriptJsonRpcRequest.ts
  • vm/api/src/requests/TevmJsonRpcRequest.ts
  • vm/api/src/responses/README.md
  • vm/api/src/result/README.md
  • vm/api/src/utils/README.md
  • vm/api/tsup.config.ts
Additional comments: 36
.changeset/shy-clouds-teach.md (1)
  • 1-5: The changeset correctly documents the addition of JSDOC to the @tevm/api package.
extensions/viem/src/ViemTevmClient.ts (1)
  • 1-4: The type change from TevmClient to Tevm is consistent with the PR's objectives.
vm/api/src/errors/InvalidGasLimitError.ts (1)
  • 3-5: The addition of the InvalidGasLimitError type enhances error handling capabilities.
vm/api/src/handlers/AccountHandler.ts (1)
  • 3-5: The added comment for the AccountHandler type improves code documentation.
vm/api/src/procedure/ContractJsonRpcProcedure.ts (1)
  • 2-8: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-6]

The expanded comment provides a clearer explanation of the type overloading for ContractJsonRpcProcedure.

vm/api/src/requests/README.md (1)
  • 1-11: The README addition for the requests directory improves documentation and guides users on the API's usage.
vm/api/src/Tevm.ts (1)
  • 7-17: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-14]

The updates to the Tevm type and comments align with the PR's objectives to rename types and enhance documentation.

vm/api/src/README.md (1)
  • 1-45: The README update provides a comprehensive overview of the API's structure and usage.
vm/vm/src/Tevm.ts (1)
  • 1-9: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-35]

The updates to the Tevm type in the vm/vm/src directory align with the PR's objectives to rename types and clarify implementation details.

vm/api/src/params/BaseCallParams.ts (1)
  • 2-8: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-5]

The update to the comment in the BaseCallParams type definition corrects terminology for clarity.

vm/procedures/src/requestProcedure.js (1)
  • 5-11: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-8]

The update to the requestProcedure function reflects the type renaming from TevmClient to Tevm, aligning with the PR's objectives.

vm/api/src/index.ts (1)
  • 75-75: The update to export the renamed type Tevm aligns with the PR's objectives.
vm/api/README.md (1)
  • 22-62: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-25]

The README update for the @tevm/api package provides a comprehensive overview of the API's structure and usage.

extensions/viem/src/tevmViemExtension.js (1)
  • 25-31: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-28]

The updates in the tevmViemExtension.js file to use the renamed type Tevm align with the PR's objectives.

extensions/viem/docs/modules.md (2)
  • 121-121: The documentation update to reflect the type change from TevmClient to Tevm aligns with the PR's objectives.

  • 186-186: The addition of the writeContractOptimistic method to the documentation aligns with the PR's objectives to add new methods.

vm/api/docs/modules.md (20)
  • 66-66: The renaming of TevmClient to Tevm is consistent with the PR objectives and summary.

  • 78-89: The addition of an example to the AccountError type is a good practice as it helps users understand how to handle errors.

  • 102-109: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [105-119]

The AccountHandler type declaration has been updated. Ensure that the corresponding handler implementation matches this type signature.

  • 128-135: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [131-145]

The AccountJsonRpcProcedure type declaration has been updated. Verify that the procedure implementation is consistent with this type.

  • 175-175: The description added to the AccountParams type provides clarity on its usage.

  • 234-235: The BaseCallError type has been updated. Confirm that all call-based procedures correctly handle the new error types.

Verification successful

The review comment asked to confirm that all call-based procedures correctly handle the new error types in BaseCallError. The script outputs show that BaseCallError is used as a base type in both ContractError.ts and CallError.ts. These files define ContractError and CallError types, respectively, which include BaseCallError as one of their possible error types.

In ContractError.ts, BaseCallError is combined with other specific error types like InvalidAddressError, EvmError, and others, to form the ContractError type. Similarly, in CallError.ts, BaseCallError is combined with InvalidSaltError, InvalidDataError, and InvalidDeployedBytecodeError to form the CallError type.

Both ContractError and CallError types are used to represent possible errors returned by the contract and call procedures of the Tevm API. The inclusion of BaseCallError in these types suggests that the new error types added to BaseCallError are being handled correctly by the call-based procedures, as they are part of the union types that define all possible errors for these procedures.

Based on the information provided by the scripts, it appears that the call-based procedures are set up to handle the new error types in BaseCallError.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that call-based procedures handle the new error types in BaseCallError.
ast-grep --lang typescript --pattern $'BaseCallError($_) { $$$ }'

Length of output: 514



Script:

#!/bin/bash
# Search for instances where BaseCallError is extended or instantiated.
ast-grep --lang typescript --pattern $'class $_ extends BaseCallError { $$$ }'

Length of output: 79



Script:

#!/bin/bash
# Search for any reference to BaseCallError to see how it is used throughout the codebase.
ast-grep --lang typescript --pattern $'BaseCallError'

Length of output: 279



Script:

#!/bin/bash
# View the contents of ContractError.ts and CallError.ts to understand how they use BaseCallError.
cat ./vm/api/src/errors/ContractError.ts
cat ./vm/api/src/errors/CallError.ts

Length of output: 1906

* 299-308: Adding an example to the `CallError` type is beneficial for users to understand error handling.
  • 321-328: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [324-338]

The CallHandler type declaration has been updated. Ensure that the corresponding handler implementation matches this type signature.

Verification successful

The CallHandler is defined as a type for a function that takes CallParams as an argument and returns a Promise<CallResult>. This matches the documentation provided in the modules.md file, confirming that the type declaration and the documentation are consistent.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the CallHandler implementation matches the updated type signature.
ast-grep --lang typescript --pattern $'CallHandler($_) { $$$ }'

Length of output: 510



Script:

#!/bin/bash
# Correct the pattern to match the structure of a TypeScript class or function for CallHandler.
ast-grep --lang typescript --pattern $'class $_ { $$$ CallHandler($_) { $$$ } $$$ }'

Length of output: 85



Script:

#!/bin/bash
# Attempt to match CallHandler as either a class method or a standalone function.
ast-grep --lang typescript --pattern $'$$$ CallHandler($_) { $$$ }'

Length of output: 518



Script:

#!/bin/bash
# First, find the file that contains the CallHandler definition.
rg "CallHandler" --files-with-matches

Length of output: 283



Script:

#!/bin/bash
# Verify the implementation of CallHandler in the identified file.
ast-grep --lang typescript --pattern $'export function CallHandler($_) { $$$ }' --file vm/api/src/handlers/CallHandler.ts

Length of output: 316



Script:

#!/bin/bash
# Adjust the script to correctly pass the file path to ast-grep.
ast-grep --lang typescript --pattern $'export function CallHandler($_) { $$$ }' vm/api/src/handlers/CallHandler.ts

Length of output: 115



Script:

#!/bin/bash
# Directly inspect the contents of the CallHandler.ts file to understand its structure.
cat vm/api/src/handlers/CallHandler.ts

Length of output: 212

* 347-354: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [350-364]

The CallJsonRpcProcedure type declaration has been updated. Verify that the procedure implementation is consistent with this type.

Verification successful

The search with ripgrep has located the CallJsonRpcProcedure in several files. The relevant file appears to be vm/api/src/procedure/CallJsonRpcProcedure.ts, where the type CallJsonRpcProcedure is exported. This matches the context provided in the review comment, which refers to a type declaration.

To verify that the implementation of CallJsonRpcProcedure is consistent with the updated type, I will need to examine the contents of vm/api/src/procedure/CallJsonRpcProcedure.ts. Since CallJsonRpcProcedure is a type and not a class or function, I will use cat to display the contents of the file.


The contents of vm/api/src/procedure/CallJsonRpcProcedure.ts show that CallJsonRpcProcedure is a type that takes a CallJsonRpcRequest and returns a Promise of CallJsonRpcResponse. This matches the information provided in the snippet from the modules.md documentation file, which describes the parameters and return type of the CallJsonRpcProcedure.

Based on the provided output, the CallJsonRpcProcedure type declaration is consistent with the documentation in modules.md. Therefore, the procedure implementation appears to be consistent with the updated type as documented.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the CallJsonRpcProcedure implementation matches the updated type signature.
ast-grep --lang typescript --pattern $'CallJsonRpcProcedure($_) { $$$ }'

Length of output: 528



Script:

#!/bin/bash
# Attempting to find the CallJsonRpcProcedure implementation with a corrected pattern.
ast-grep --lang typescript --pattern $'class $_ { $$$ CallJsonRpcProcedure($_) { $$$ } $$$ }'

Length of output: 94



Script:

#!/bin/bash
# Attempting to find the CallJsonRpcProcedure implementation with a more general pattern.
ast-grep --lang typescript --pattern $'function CallJsonRpcProcedure($_) { $$$ }'

Length of output: 82



Script:

#!/bin/bash
# Using ripgrep to search for the CallJsonRpcProcedure implementation in TypeScript files.
rg "CallJsonRpcProcedure" --type ts

Length of output: 378



Script:

#!/bin/bash
# Display the contents of CallJsonRpcProcedure.ts to verify the type implementation.
cat vm/api/src/procedure/CallJsonRpcProcedure.ts

Length of output: 299

* 394-394: The description added to the `CallParams` type provides clarity on its usage.
  • 452-461: The ContractError type has been updated with an example. Confirm that contract procedures correctly handle the new error types.
Verification successful

The search results show that ContractError is used in various files across the vm/api and packages/viem-effect directories. It is exported, imported, and used in multiple contexts, including error handling in contract-related functions such as getContractError, readContract, writeContract, and others.

The presence of ContractError in these files, especially in utility functions like getContractError and in tests, suggests that the new error types are being handled within the contract procedures. The tests for getContractError indicate that different error scenarios are being considered and handled.

Based on the search results, it appears that the contract procedures are set up to handle the new error types defined in ContractError.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that contract procedures handle the new error types in ContractError.
ast-grep --lang typescript --pattern $'ContractError($_) { $$$ }'

Length of output: 514



Script:

#!/bin/bash
# Attempt to find the definition of ContractError to verify how it's structured and how it handles errors.
ast-grep --lang typescript --pattern $'type ContractError = $_'

Length of output: 890



Script:

#!/bin/bash
# Search for usage of ContractError within contract procedures to verify error handling.
rg "ContractError" --type ts

Length of output: 10580

* 474-482: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [477-499]

The ContractHandler type declaration has been updated. Ensure that the corresponding handler implementation matches this type signature.

Verification successful

The search with ripgrep has provided us with several references to ContractHandler in the codebase. The relevant file for the type definition appears to be vm/api/src/handlers/ContractHandler.ts. To verify that the implementation matches the updated type signature, we should examine the contents of this file.


The contents of ContractHandler.ts show that the ContractHandler type is indeed defined as expected, with the type parameters TAbi and TFunctionName, and it takes an action parameter of type ContractParams<TAbi, TFunctionName>. The return type is a Promise of ContractResult<TAbi, TFunctionName>.

This matches the type signature provided in the snippet from the modules.md documentation file, confirming that the ContractHandler type declaration is consistent with the documentation.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the ContractHandler implementation matches the updated type signature.
ast-grep --lang typescript --pattern $'ContractHandler($_) { $$$ }'

Length of output: 518



Script:

#!/bin/bash
# Adjusting the ast-grep pattern to correctly match the structure of the ContractHandler type or class.
ast-grep --lang typescript --pattern $'class ContractHandler { $$$ }'

Length of output: 70



Script:

#!/bin/bash
# Adjusting the ast-grep pattern to search for a type or interface declaration of ContractHandler.
ast-grep --lang typescript --pattern $'type ContractHandler = $_;'

Length of output: 67



Script:

#!/bin/bash
# Trying a more general ast-grep pattern to match ContractHandler as a type, interface, or function.
ast-grep --lang typescript --pattern $'$_ ContractHandler { $$$ }'

Length of output: 516



Script:

#!/bin/bash
# Using ripgrep to search for the ContractHandler definition in the codebase.
rg 'ContractHandler' --type ts

Length of output: 578



Script:

#!/bin/bash
# Examine the contents of ContractHandler.ts to verify the implementation matches the updated type signature.
cat vm/api/src/handlers/ContractHandler.ts

Length of output: 601

* 508-513: The `ContractJsonRpcProcedure` type is an alias for `CallJsonRpcRequest`. Confirm that this aliasing does not cause any confusion or issues in the codebase.
  • 547-547: The ContractParams type has been updated. Ensure that the contract call implementations are updated to reflect these changes.

  • 581-588: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [584-594]

The EvmError type has been updated. Verify that the internal EVM call implementations handle this error type correctly.

Verification successful

I will generate a new shell script to search for instances where EvmError is being used, particularly where it is instantiated or thrown, to verify that internal EVM call implementations handle this updated error type correctly.


I will generate a new shell script to search for any reference to EvmError in the codebase to verify its usage.


The search for references to EvmError in the codebase has returned three results:

  1. EvmError is exported from ./vm/api/src/index.ts.
  2. EvmError is imported in ./vm/api/src/errors/ContractError.ts.
  3. EvmError is imported in ./vm/api/src/errors/BaseCallError.ts.

This indicates that EvmError is indeed used within the codebase, particularly in the context of error handling for contracts and calls. However, to fully verify that internal EVM call implementations handle the updated EvmError type correctly, we would need to examine the usage within the files where it is imported.

Given the results, I will now generate scripts to examine the files where EvmError is imported to understand how it is being used.


The examination of ContractError.ts and BaseCallError.ts files reveals that EvmError is included as a part of the ContractError and BaseCallError type unions. This indicates that EvmError is being used as one of the possible error types that can be returned by contract and call-based procedures within the Tevm API.

In ContractError.ts, EvmError is listed alongside other specific error types that can be returned by contract-related procedures. The file also includes an example of how errors might be handled when interacting with a contract procedure.

In BaseCallError.ts, EvmError is again listed as part of the type union for errors that can be returned by call-based procedures, which include calls, contracts, and scripts.

These findings suggest that the EvmError type is correctly integrated into the error handling system of the Tevm API, and it is accounted for in the types that define possible errors for contract and call-based procedures.

Based on the information provided, it appears that the EvmError type is being handled appropriately within the internal EVM call implementations as part of the error handling strategy.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that internal EVM call implementations handle the updated EvmError type correctly.
ast-grep --lang typescript --pattern $'EvmError($_) { $$$ }'

Length of output: 504



Script:

#!/bin/bash
# Search for instances where EvmError is instantiated or thrown
ast-grep --lang typescript --pattern $'throw new EvmError($$$)'

Length of output: 64



Script:

#!/bin/bash
# Search for any reference to EvmError in the codebase
ast-grep --lang typescript --pattern $'EvmError'

Length of output: 253



Script:

#!/bin/bash
# Examine the usage of EvmError in ContractError.ts and BaseCallError.ts
cat ./vm/api/src/errors/ContractError.ts
cat ./vm/api/src/errors/BaseCallError.ts

Length of output: 3183

* 932-942: The `ScriptError` type has been updated with an example. Confirm that script procedures correctly handle the new error types.
Verification successful

I will correct the syntax error in the ast-grep pattern and attempt to verify the handling of the new error types in ScriptError again.


I will now attempt to find the usage of ScriptError within the codebase using a different approach, possibly by searching for where it is thrown or handled.


To verify the handling of ScriptError by script procedures, I will now examine the implementation in scriptProcedure.js.


The review of scriptProcedure.js confirms that script procedures are designed to handle errors of type ScriptError. The code includes appropriate error handling logic, which uses the _tag property of the ScriptError type to construct error responses. This aligns with the updated example provided in the modules.md documentation.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that script procedures handle the new error types in ScriptError.
ast-grep --lang typescript --pattern $'ScriptError($_) { $$$ }'

Length of output: 510



Script:

#!/bin/bash
# Verify that script procedures handle the new error types in ScriptError.
ast-grep --lang typescript --pattern $'type ScriptError = $_ { $$$ }'

Length of output: 70



Script:

#!/bin/bash
# Search for usage of ScriptError in the codebase, including where it might be thrown or handled.
rg "ScriptError"

Length of output: 1728



Script:

#!/bin/bash
# Examine the implementation of script procedures in scriptProcedure.js
cat vm/procedures/src/jsonrpc/scriptProcedure.js

Length of output: 4510

* 955-962: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [958-979]

The ScriptHandler type declaration has been updated. Ensure that the corresponding handler implementation matches this type signature.

Verification successful

The ScriptHandler type definition in the ScriptHandler.ts file matches the documentation provided in the modules.md file. The type parameters TAbi and TFunctionName, as well as the function signature taking ScriptParams and returning a Promise of ScriptResult, are consistent with the documentation snippet provided.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the ScriptHandler implementation matches the updated type signature.
ast-grep --lang typescript --pattern $'ScriptHandler($_) { $$$ }'

Length of output: 514



Script:

#!/bin/bash
# Attempt to find the ScriptHandler type declaration and ensure it matches the updated type signature.
ast-grep --lang typescript --pattern $'type ScriptHandler = $_;'

Length of output: 65



Script:

#!/bin/bash
# Search for TypeScript files containing the ScriptHandler to examine its declaration and usage.
rg --type ts "ScriptHandler"

Length of output: 548



Script:

#!/bin/bash
# Examine the ScriptHandler type definition in the ScriptHandler.ts file.
cat vm/api/src/handlers/ScriptHandler.ts

Length of output: 485

* 988-995: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [991-1005]

The ScriptJsonRpcProcedure type declaration has been updated. Verify that the procedure implementation is consistent with this type.

Verification successful

The search with rg for ScriptJsonRpcProcedure has provided several results, indicating where the type is used and defined within the codebase. The relevant file for the type definition appears to be vm/api/src/procedure/ScriptJsonRpcProcedure.ts, and it is exported from vm/api/src/index.ts as well as from vm/api/src/procedure/index.ts.

The definition of ScriptJsonRpcProcedure is found in vm/api/src/procedure/ScriptJsonRpcProcedure.ts and is defined as a type that takes a ScriptJsonRpcRequest and returns a Promise of ScriptJsonRpcResponse.

Based on the information provided, it seems that the ScriptJsonRpcProcedure type declaration is consistent with the documentation in modules.md, which describes it as a procedure for handling script JSON-RPC requests that takes a ScriptJsonRpcRequest and returns a Promise of ScriptJsonRpcResponse.

Given this, the ScriptJsonRpcProcedure type declaration appears to be correctly documented and implemented in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the ScriptJsonRpcProcedure implementation matches the updated type signature.
ast-grep --lang typescript --pattern $'ScriptJsonRpcProcedure($_) { $$$ }'

Length of output: 532



Script:

#!/bin/bash
# Verify that the ScriptJsonRpcProcedure implementation matches the updated type signature.
ast-grep --lang typescript --pattern $'interface ScriptJsonRpcProcedure {
  $$$
}'

Length of output: 83



Script:

#!/bin/bash
# Attempt to find the ScriptJsonRpcProcedure as a type or function to verify its implementation.
ast-grep --lang typescript --pattern $'type ScriptJsonRpcProcedure = $_;'
ast-grep --lang typescript --pattern $'function ScriptJsonRpcProcedure($_) { $$$ }'

Length of output: 159



Script:

#!/bin/bash
# Use ripgrep to search for the ScriptJsonRpcProcedure within the codebase.
rg "ScriptJsonRpcProcedure"

Length of output: 977

* 1035-1035: The `ScriptParams` type has been updated. Ensure that the script deployment and execution implementations are updated to reflect these changes.
  • 1065-1077: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1068-1088]

The Tevm type has been updated to reflect the renaming and new method additions. Confirm that the Tevm API implementation matches this updated specification.

Verification successful

I will generate a new shell script with the corrected ast-grep pattern to verify the Tevm API implementation.


I will generate a new shell script using ripgrep to search for the Tevm type declaration in TypeScript files to verify the Tevm API implementation.


The search results indicate that there are two files containing the Tevm type declaration: vm/vm/src/Tevm.ts and vm/api/src/Tevm.ts. To verify that the Tevm API implementation matches the updated specification, we need to examine the contents of these type declarations.

I will generate a new shell script to display the contents of the Tevm type declarations from both files.


The contents of the Tevm type declarations from both vm/vm/src/Tevm.ts and vm/api/src/Tevm.ts files have been provided. The Tevm type in vm/api/src/Tevm.ts matches the specification mentioned in the modules.md documentation, with request, script, account, call, and contract handlers as part of its definition.

The Tevm type in vm/vm/src/Tevm.ts extends TevmSpec from @tevm/api and includes additional properties such as forkUrl, _evm, and createHttpHandler. This suggests that the Tevm type in the VM context has more capabilities and is likely used for more in-depth interactions with the EVM.

Based on the provided outputs, the Tevm type in the API context (vm/api/src/Tevm.ts) has been updated to reflect the renaming and new method additions as documented. The Tevm type in the VM context (vm/vm/src/Tevm.ts) provides additional context and functionality specific to the VM implementation.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the Tevm API implementation matches the updated Tevm type specification.
ast-grep --lang typescript --pattern $'Tevm { $$$ }'

Length of output: 488



Script:

#!/bin/bash
# Verify that the Tevm API implementation matches the updated Tevm type specification.
ast-grep --lang typescript --pattern $'interface Tevm {
  $$$
}'

Length of output: 65



Script:

#!/bin/bash
# Search for the Tevm type declaration within TypeScript files.
rg --type ts 'type Tevm ='

Length of output: 118



Script:

#!/bin/bash
# Display the contents of the Tevm type declarations from both Tevm.ts files.
cat vm/vm/src/Tevm.ts
cat vm/api/src/Tevm.ts

Length of output: 1768

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c9c054a and 3644663.
Files ignored due to filter (1)
  • vm/api/package.json
Files selected for processing (75)
  • .changeset/quiet-eagles-sniff.md (1 hunks)
  • .changeset/shy-clouds-teach.md (1 hunks)
  • extensions/viem/docs/modules.md (2 hunks)
  • extensions/viem/src/ViemTevmClient.ts (1 hunks)
  • extensions/viem/src/ViemTevmOptimisticClient.ts (2 hunks)
  • extensions/viem/src/tevmViemExtension.js (5 hunks)
  • vm/api/README.md (1 hunks)
  • vm/api/docs/README.md (1 hunks)
  • vm/api/docs/modules.md (33 hunks)
  • vm/api/src/README.md (1 hunks)
  • vm/api/src/Tevm.ts (1 hunks)
  • vm/api/src/TevmJsonRpcRequestHandler.ts (1 hunks)
  • vm/api/src/errors/AccountError.ts (1 hunks)
  • vm/api/src/errors/BaseCallError.ts (1 hunks)
  • vm/api/src/errors/CallError.ts (1 hunks)
  • vm/api/src/errors/ContractError.ts (1 hunks)
  • vm/api/src/errors/DecodeFunctionDataError.ts (1 hunks)
  • vm/api/src/errors/EncodeFunctionReturnDataError.ts (1 hunks)
  • vm/api/src/errors/EvmError.ts (1 hunks)
  • vm/api/src/errors/InvalidAbiError.ts (1 hunks)
  • vm/api/src/errors/InvalidAddressError.ts (1 hunks)
  • vm/api/src/errors/InvalidArgsError.ts (1 hunks)
  • vm/api/src/errors/InvalidBalanceError.ts (1 hunks)
  • vm/api/src/errors/InvalidBlobVersionedHashesError.ts (1 hunks)
  • vm/api/src/errors/InvalidBlockError.ts (1 hunks)
  • vm/api/src/errors/InvalidBytecodeError.ts (1 hunks)
  • vm/api/src/errors/InvalidCallerError.ts (1 hunks)
  • vm/api/src/errors/InvalidDataError.ts (1 hunks)
  • vm/api/src/errors/InvalidDeployedBytecodeError.ts (1 hunks)
  • vm/api/src/errors/InvalidDepthError.ts (1 hunks)
  • vm/api/src/errors/InvalidFunctionNameError.ts (1 hunks)
  • vm/api/src/errors/InvalidGasLimitError.ts (1 hunks)
  • vm/api/src/errors/InvalidGasPriceError.ts (1 hunks)
  • vm/api/src/errors/InvalidGasRefundError.ts (1 hunks)
  • vm/api/src/errors/InvalidNonceError.ts (1 hunks)
  • vm/api/src/errors/InvalidOriginError.ts (1 hunks)
  • vm/api/src/errors/InvalidRequestError.ts (1 hunks)
  • vm/api/src/errors/InvalidSaltError.ts (1 hunks)
  • vm/api/src/errors/InvalidSelfdestructError.ts (1 hunks)
  • vm/api/src/errors/InvalidSkipBalanceError.ts (1 hunks)
  • vm/api/src/errors/InvalidStorageRootError.ts (1 hunks)
  • vm/api/src/errors/InvalidToError.ts (1 hunks)
  • vm/api/src/errors/InvalidValueError.ts (1 hunks)
  • vm/api/src/errors/README.md (1 hunks)
  • vm/api/src/errors/ScriptError.ts (1 hunks)
  • vm/api/src/errors/TypedError.ts (1 hunks)
  • vm/api/src/errors/UnexpectedError.ts (1 hunks)
  • vm/api/src/handlers/AccountHandler.ts (1 hunks)
  • vm/api/src/handlers/CallHandler.ts (1 hunks)
  • vm/api/src/handlers/ContractHandler.ts (1 hunks)
  • vm/api/src/handlers/README.md (1 hunks)
  • vm/api/src/handlers/ScriptHandler.ts (1 hunks)
  • vm/api/src/index.ts (1 hunks)
  • vm/api/src/params/AccountParams.ts (1 hunks)
  • vm/api/src/params/BaseCallParams.ts (1 hunks)
  • vm/api/src/params/CallParams.ts (1 hunks)
  • vm/api/src/params/ContractParams.ts (1 hunks)
  • vm/api/src/params/README.md (1 hunks)
  • vm/api/src/params/ScriptParams.ts (1 hunks)
  • vm/api/src/procedure/AccountJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/procedure/CallJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/procedure/ContractJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/procedure/README.md (1 hunks)
  • vm/api/src/procedure/ScriptJsonRpcProcedure.ts (1 hunks)
  • vm/api/src/requests/AccountJsonRpcRequest.ts (1 hunks)
  • vm/api/src/requests/CallJsonRpcRequest.ts (1 hunks)
  • vm/api/src/requests/JsonRpcRequest.ts (1 hunks)
  • vm/api/src/requests/README.md (1 hunks)
  • vm/api/src/requests/ScriptJsonRpcRequest.ts (2 hunks)
  • vm/api/src/requests/TevmJsonRpcRequest.ts (1 hunks)
  • vm/api/src/responses/README.md (1 hunks)
  • vm/api/src/result/README.md (1 hunks)
  • vm/api/src/utils/README.md (1 hunks)
  • vm/procedures/src/requestProcedure.js (2 hunks)
  • vm/vm/src/Tevm.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • vm/api/src/requests/AccountJsonRpcRequest.ts
Files skipped from review as they are similar to previous changes (70)
  • .changeset/quiet-eagles-sniff.md
  • .changeset/shy-clouds-teach.md
  • extensions/viem/docs/modules.md
  • extensions/viem/src/ViemTevmClient.ts
  • extensions/viem/src/ViemTevmOptimisticClient.ts
  • extensions/viem/src/tevmViemExtension.js
  • vm/api/docs/README.md
  • vm/api/src/README.md
  • vm/api/src/Tevm.ts
  • vm/api/src/TevmJsonRpcRequestHandler.ts
  • vm/api/src/errors/AccountError.ts
  • vm/api/src/errors/BaseCallError.ts
  • vm/api/src/errors/CallError.ts
  • vm/api/src/errors/ContractError.ts
  • vm/api/src/errors/DecodeFunctionDataError.ts
  • vm/api/src/errors/EncodeFunctionReturnDataError.ts
  • vm/api/src/errors/EvmError.ts
  • vm/api/src/errors/InvalidAbiError.ts
  • vm/api/src/errors/InvalidAddressError.ts
  • vm/api/src/errors/InvalidArgsError.ts
  • vm/api/src/errors/InvalidBalanceError.ts
  • vm/api/src/errors/InvalidBlobVersionedHashesError.ts
  • vm/api/src/errors/InvalidBlockError.ts
  • vm/api/src/errors/InvalidBytecodeError.ts
  • vm/api/src/errors/InvalidCallerError.ts
  • vm/api/src/errors/InvalidDataError.ts
  • vm/api/src/errors/InvalidDeployedBytecodeError.ts
  • vm/api/src/errors/InvalidDepthError.ts
  • vm/api/src/errors/InvalidFunctionNameError.ts
  • vm/api/src/errors/InvalidGasLimitError.ts
  • vm/api/src/errors/InvalidGasPriceError.ts
  • vm/api/src/errors/InvalidGasRefundError.ts
  • vm/api/src/errors/InvalidNonceError.ts
  • vm/api/src/errors/InvalidOriginError.ts
  • vm/api/src/errors/InvalidRequestError.ts
  • vm/api/src/errors/InvalidSaltError.ts
  • vm/api/src/errors/InvalidSelfdestructError.ts
  • vm/api/src/errors/InvalidSkipBalanceError.ts
  • vm/api/src/errors/InvalidStorageRootError.ts
  • vm/api/src/errors/InvalidToError.ts
  • vm/api/src/errors/InvalidValueError.ts
  • vm/api/src/errors/README.md
  • vm/api/src/errors/ScriptError.ts
  • vm/api/src/errors/TypedError.ts
  • vm/api/src/errors/UnexpectedError.ts
  • vm/api/src/handlers/AccountHandler.ts
  • vm/api/src/handlers/CallHandler.ts
  • vm/api/src/handlers/ContractHandler.ts
  • vm/api/src/handlers/README.md
  • vm/api/src/handlers/ScriptHandler.ts
  • vm/api/src/index.ts
  • vm/api/src/params/AccountParams.ts
  • vm/api/src/params/BaseCallParams.ts
  • vm/api/src/params/ContractParams.ts
  • vm/api/src/params/ScriptParams.ts
  • vm/api/src/procedure/AccountJsonRpcProcedure.ts
  • vm/api/src/procedure/CallJsonRpcProcedure.ts
  • vm/api/src/procedure/ContractJsonRpcProcedure.ts
  • vm/api/src/procedure/README.md
  • vm/api/src/procedure/ScriptJsonRpcProcedure.ts
  • vm/api/src/requests/CallJsonRpcRequest.ts
  • vm/api/src/requests/JsonRpcRequest.ts
  • vm/api/src/requests/README.md
  • vm/api/src/requests/ScriptJsonRpcRequest.ts
  • vm/api/src/requests/TevmJsonRpcRequest.ts
  • vm/api/src/responses/README.md
  • vm/api/src/result/README.md
  • vm/api/src/utils/README.md
  • vm/procedures/src/requestProcedure.js
  • vm/vm/src/Tevm.ts
Additional comments: 29
vm/api/src/params/README.md (2)
  • 3-3: The description of Tevm params is clear and concise, linking to related concepts such as handlers and results.

  • 7-7: The explanation of the relationship between Tevm params and JSON-RPC requests is well-articulated, with a clear distinction made between the two concepts.

vm/api/src/params/CallParams.ts (1)
  • 5-5: The updated comment clarifies the purpose of CallParams and its role in the Tevm API, which is consistent with the semantic change mentioned in the summary.
vm/api/README.md (6)
  • 25-25: The description of @tevm/api as the official Tevm spec represented as TypeScript types is clear and informative.

  • 27-27: The note about the package containing only TypeScript types and no JavaScript is a useful clarification for users.

  • 31-34: The explanation of the Tevm API type and its implementation by @tevm/vm and @tevm/client packages is well-detailed and informative.

  • 38-41: The high-level API description is clear, highlighting the input/output pattern and the two ways it is implemented.

  • 47-52: The details provided about the high-level action-based API are comprehensive, explaining its ergonomic nature and error handling capabilities.

  • 55-59: The description of the lower-level JSON-RPC API is clear, indicating its suitability for remote requests and its relationship with the high-level API.

vm/api/docs/modules.md (20)
  • 78-89: The example provided for AccountError is helpful and demonstrates how to handle errors in a practical scenario.

  • 102-109: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [105-119]

The AccountHandler type declaration is clear and follows TypeScript best practices.

  • 128-135: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [131-145]

The AccountJsonRpcProcedure type declaration is clear and indicates its purpose within the Tevm JSON-RPC structure.

  • 153-157: The AccountJsonRpcRequest type alias is correctly defined and follows the established pattern for JSON-RPC requests.

  • 234-235: The BaseCallError type alias is comprehensive, covering a wide range of potential errors for call-based procedures.

  • 299-308: The CallError type alias is well-documented with an example, which is beneficial for understanding its practical application.

  • 321-328: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [324-338]

The CallHandler type declaration is clear and follows TypeScript best practices.

  • 347-354: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [350-364]

The CallJsonRpcProcedure type declaration is clear and indicates its purpose within the Tevm JSON-RPC structure.

  • 372-376: The CallJsonRpcRequest type alias is correctly defined and follows the established pattern for JSON-RPC requests.

  • 452-461: The ContractError type alias is well-documented with an example, which is beneficial for understanding its practical application.

  • 474-482: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [477-499]

The ContractHandler type declaration is clear and follows TypeScript best practices.

  • 932-941: The ScriptError type alias is well-documented with an example, which is beneficial for understanding its practical application.

  • 955-962: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [958-979]

The ScriptHandler type declaration is clear and follows TypeScript best practices.

  • 988-995: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [991-1005]

The ScriptJsonRpcProcedure type declaration is clear and indicates its purpose within the Tevm JSON-RPC structure.

  • 1013-1017: The ScriptJsonRpcRequest type alias is correctly defined and follows the established pattern for JSON-RPC requests.

  • 1065-1077: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1070-1088]

The Tevm type declaration is comprehensive, detailing the API's structure and the methods it provides.

  • 1096-1101: The TevmJsonRpcRequest type alias is correctly defined and encompasses the various JSON-RPC request types within the Tevm API.

  • 1110-1118: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1113-1134]

The TevmJsonRpcRequestHandler type declaration is generic and correctly returns the appropriate response type for a given request.

  • 1131-1151: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1142-1167]

The TypedError type declaration is an internal utility that is well-documented and provides a structured way to handle typed errors.

  • 1175-1181: The UnexpectedError type declaration is clear and indicates that it represents an error that should not occur, suggesting robust error handling within the API.

@roninjin10 roninjin10 force-pushed the 01-07-feat_Add_README_and_JSDOC_to_Tevm_API branch from cd36028 to 1857945 Compare January 8, 2024 03:45
@roninjin10 roninjin10 merged commit 0ee22d0 into main Jan 8, 2024
19 checks passed
@roninjin10 roninjin10 deleted the 01-07-feat_Add_README_and_JSDOC_to_Tevm_API branch January 8, 2024 04:28
@github-actions github-actions bot mentioned this pull request Jan 8, 2024
0xNonCents pushed a commit that referenced this pull request Jan 9, 2024
## Description

Fully productionize the API package

## Testing

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

## Additional Information

- [ ] I read the [contributing docs](../docs/contributing.md) (if this
is your first contribution)

Your ENS/address:



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Documentation**
- Updated API documentation to clarify the usage and structure of the
Tevm system.
- Enhanced readability of the documentation by reorganizing content and
improving descriptions.
- Added clear distinctions between high-level and low-level APIs in the
Tevm system.

- **New Features**
	- Introduced a new method `writeContractOptimistic` to the Tevm API.

- **Refactor**
- Updated type definitions and references to align with the new `Tevm`
entity replacing `TevmClient`.

- **Chores**
	- Reorganized package structure for better clarity and maintenance.
- Modified build configuration to include new entry points for the
package.

- **Style**
- Removed visual elements from documentation to focus on textual
clarity.
- Standardized naming conventions across Tevm JSON-RPC requests and
responses for consistency.

- **Tests**
- Adjusted test cases to reflect changes in type declarations and API
structure.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Will Cory <[email protected]>
0xNonCents pushed a commit that referenced this pull request Jan 9, 2024
Fully productionize the API package

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

- [ ] I read the [contributing docs](../docs/contributing.md) (if this
is your first contribution)

Your ENS/address:

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Documentation**
- Updated API documentation to clarify the usage and structure of the
Tevm system.
- Enhanced readability of the documentation by reorganizing content and
improving descriptions.
- Added clear distinctions between high-level and low-level APIs in the
Tevm system.

- **New Features**
	- Introduced a new method `writeContractOptimistic` to the Tevm API.

- **Refactor**
- Updated type definitions and references to align with the new `Tevm`
entity replacing `TevmClient`.

- **Chores**
	- Reorganized package structure for better clarity and maintenance.
- Modified build configuration to include new entry points for the
package.

- **Style**
- Removed visual elements from documentation to focus on textual
clarity.
- Standardized naming conventions across Tevm JSON-RPC requests and
responses for consistency.

- **Tests**
- Adjusted test cases to reflect changes in type declarations and API
structure.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Will Cory <[email protected]>
roninjin10 pushed a commit that referenced this pull request Jan 17, 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]

### Major Changes

- [#828](#828)
[`3b5f6729`](3b5f672)
Thanks [@roninjin10](https://github.com/roninjin10)! - - Changed name of
`TevmContract` to `Contract`

    -   Changed name of `createTevmContract` to `createContract`
    -   Added `Script` to be a Contract with bytecode
    -   Removed bytecode from `Contract`
- Added a new `withAddress` method for adding an address to a contract
    -   Removed need to explicitly pass in undefined for optional params

    ## withAddress

    Before we had to spred contracts like this:

    ```typescript
    client.readContract({
      address: contractAddress,
      ...Erc20Contract.read.balanceOf(userAddress),
    });
    ```

    Now Tevm can create a contract with an address attatched

    ```typescript
    client.readContract(
Erc20Contract.withAddress(contractAddress).read.balanceOf(userAddress)
    );
    ```

## @tevm/[email protected]

### Minor Changes

- [#822](#822)
[`39a5b5e5`](39a5b5e)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added eth methods
such as chainId getCode and getStorageAt to Tevm.eth.

### Patch Changes

- [#804](#804)
[`d514d111`](d514d11)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
viem extension not decoding rawData into data

- Updated dependencies
\[[`8b3218b1`](8b3218b),
[`39a5b5e5`](39a5b5e),
[`98d76506`](98d7650)]:
    -   @tevm/[email protected]

## [email protected]

### Minor Changes

- [#822](#822)
[`39a5b5e5`](39a5b5e)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added eth methods
such as chainId getCode and getStorageAt to Tevm.eth.

### Patch Changes

- [#804](#804)
[`d514d111`](d514d11)
Thanks [@roninjin10](https://github.com/roninjin10)! - Update tevm
package to export all of tevm. Now users only need to `npm install tevm`
to use all of tevm

- Updated dependencies
\[[`87427f30`](87427f3),
[`8b3218b1`](8b3218b),
[`cae17b7d`](cae17b7),
[`39a5b5e5`](39a5b5e),
[`3b5f6729`](3b5f672),
[`0ee22d0a`](0ee22d0),
[`0ee22d0a`](0ee22d0),
[`d514d111`](d514d11),
[`941a630a`](941a630),
[`98d76506`](98d7650)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Minor Changes

- [#820](#820)
[`cae17b7d`](cae17b7)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added all eth_\*
debug_\_ and anvil\_\_ JSON-rpc methods and handlers to API.

- [#822](#822)
[`39a5b5e5`](39a5b5e)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added eth methods
such as chainId getCode and getStorageAt to Tevm.eth.

### Patch Changes

- [#811](#811)
[`87427f30`](87427f3)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
EVM errors requiring importing ethereumjs enum to typematch

- [#800](#800)
[`0ee22d0a`](0ee22d0)
Thanks [@roninjin10](https://github.com/roninjin10)! - Renamed
TevmClient type to Tevm

- [#800](#800)
[`0ee22d0a`](0ee22d0)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added JSDOC to
@tevm/api

- [#808](#808)
[`941a630a`](941a630)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
'to' and 'error' properties not quite working correctly for tevm. To was
listed as require instead of only existing when no errors.

## @tevm/[email protected]

### Minor Changes

- [#805](#805)
[`8b3218b1`](8b3218b)
Thanks [@0xNonCents](https://github.com/0xNonCents)! - Enable State Load
and Dump actions

- [#822](#822)
[`39a5b5e5`](39a5b5e)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added eth methods
such as chainId getCode and getStorageAt to Tevm.eth.

- [#823](#823)
[`f7865314`](f786531)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added support for
debug_traceCall handler

### Patch Changes

- [#804](#804)
[`d514d111`](d514d11)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
tevm account not updating code hash when deployedBytecode is put into
state

- Updated dependencies
\[[`3b4a347d`](3b4a347),
[`39a5b5e5`](39a5b5e),
[`d514d111`](d514d11),
[`d514d111`](d514d11),
[`aec294ba`](aec294b)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Minor Changes

- [#805](#805)
[`8b3218b1`](8b3218b)
Thanks [@0xNonCents](https://github.com/0xNonCents)! - Enable State Load
and Dump actions

## @tevm/[email protected]

### Minor Changes

- [#805](#805)
[`8b3218b1`](8b3218b)
Thanks [@0xNonCents](https://github.com/0xNonCents)! - Enable State Load
and Dump actions

- [#822](#822)
[`39a5b5e5`](39a5b5e)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added eth methods
such as chainId getCode and getStorageAt to Tevm.eth.

- [#818](#818)
[`98d76506`](98d7650)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added blockchain
to the Tevm VM so anvil, hardhat, and eth_json_rpc requests can be
handled

### Patch Changes

- Updated dependencies
\[[`87427f30`](87427f3),
[`d514d111`](d514d11),
[`39a5b5e5`](39a5b5e),
[`8b3218b1`](8b3218b),
[`d514d111`](d514d11),
[`cae17b7d`](cae17b7),
[`39a5b5e5`](39a5b5e),
[`3b5f6729`](3b5f672),
[`0ee22d0a`](0ee22d0),
[`0ee22d0a`](0ee22d0),
[`941a630a`](941a630),
[`f7865314`](f786531)]:
    -   @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
\[[`3b5f6729`](3b5f672)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#822](#822)
[`39a5b5e5`](39a5b5e)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
swallowing errors that didn't return text

- [#804](#804)
[`d514d111`](d514d11)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
checking method falsely

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`8b3218b1`](8b3218b),
[`39a5b5e5`](39a5b5e),
[`3b5f6729`](3b5f672),
[`d514d111`](d514d11),
[`98d76506`](98d7650)]:
    -   @tevm/[email protected]
    -   @tevm/[email protected]
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- Updated dependencies
\[[`3b5f6729`](3b5f672)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#809](#809)
[`0efe3b03`](0efe3b0)
Thanks [@roninjin10](https://github.com/roninjin10)! - Added jsdoc to
createHttpHandler

- Updated dependencies
\[[`3b4a347d`](3b4a347),
[`d514d111`](d514d11),
[`aec294ba`](aec294b)]:
    -   @tevm/[email protected]

## @tevm/[email protected]

### Patch Changes

- [#807](#807)
[`3b4a347d`](3b4a347)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
zod validator swallowing missing `to` parameter errors

- [#804](#804)
[`d514d111`](d514d11)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug with
JsonRpcRequest throwing for requests with no params

- [#806](#806)
[`aec294ba`](aec294b)
Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed bug in zod
validators for contract params which falsely listed `to` as optional

- Updated dependencies
\[[`87427f30`](87427f3),
[`cae17b7d`](cae17b7),
[`39a5b5e5`](39a5b5e),
[`0ee22d0a`](0ee22d0),
[`0ee22d0a`](0ee22d0),
[`941a630a`](941a630)]:
    -   @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.

1 participant