-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Feat(contract): Add address utility to contract (#828)
## Description Add address utility and finalize the contract api ## 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 - **New Features** - Introduced `Script` as a new contract type with bytecode. - Added `withAddress` method to associate addresses with contracts. - **Enhancements** - Simplified contract creation process by removing the need for `undefined` in optional parameters. - **Refactor** - Renamed `TevmContract` to `Contract` across the application. - Updated contract creation function to `createContract` for clarity. - Improved import handling in runtime generation based on module type and bytecode inclusion. - **Documentation** - Updated documentation to reflect renaming and new features. - **Bug Fixes** - Adjusted error messages and default contract name in TypeScript plugin files for consistency. - **Tests** - Removed specific coverage configuration properties from `vitest.config.ts`. - Updated test suites to verify new contract and script creation functionalities. - **Style** - Standardized the `Events` type definition for consistency with new address handling. - **Chores** - Cleaned up references and links in markdown documentation files. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Will Cory <[email protected]>
- Loading branch information
1 parent
905dfa5
commit 3b5f672
Showing
67 changed files
with
1,313 additions
and
813 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
"@tevm/contract": major | ||
--- | ||
|
||
- 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) | ||
) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
3b5f672
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
evmts-docs – ./
evmts-docs-git-main-evmts.vercel.app
evmts.dev
evmts-docs-evmts.vercel.app