Evmts bun example
Starter project of using Bun with EVMts. EVMts is an LSP and bundler used to import solidity contracts directly into your TypeScript code.
- Install Node Modules
bun install
- Run tests
bun test
- Run bun script in watch mode
bun dev
EVMts works via a bun plugin. This includes:
- EVMts configuration which is in the tsconfig.json. Note in future EVMts will be configurable via a
evmts.config.ts
file.
The minimal configuration simply needs to specify typescript uses the @evmts/ts-plugin
but it also has other configuration options. This template globally configured the contract addresses for ExampleContract.sol
- Bun plugin configuration in the plugins.ts file along with loading the plugin file in bunfig.toml
This enables bun to import solidity files
EVMts LSP gives you language server functionality in your editor. In EVMts this includes many nice features
- Natspec comments on hover
- go-to-definition takes you directly to the solidity code that defined the contract method or event
- Etherscan links to your contracts on hover
Below is an example of go-to-definition support
An ethers.js version of this template is available on the ethers branch
Special steps are needed to get the LSP features working in VSCode. Most editors should work out the box but please open an issue if you run into trouble.
To use this plugin with Visual Studio Code, you should set your workspace's version of TypeScript, which will load plugins from your tsconfig.json file.
- Open a typescript file in your project in vscode
- Open command pallet +p or +p
- Select
>Typescript: Select TypeScript Version
in command pallet - Select
Use workspace version
You now should get all the EVMts LSP features such as natspec comments on hover and go-to-solidity-definition support
For more details see: Using the workspace version of TypeScript.
If you like Evmts give it a ⭐ at the Evmts monorepo
- Check out Next.js starterkit for an example of Evmts wagmi and Next
- Check out Vite starterkit for an example of Evmts wagmi and Vite