bunPluginTevm
bunPluginTevm(
SolcVersions
):BunPlugin
Bun plugin for tevm. Enables Solidity imports in JavaScript. Once enabled the code
will transform solidity contract imports into Tevm Contract
instances.
Parameters
• SolcVersions
Which solc version to use
• SolcVersions.solc?: SolcVersions
= defaultSolc.version
Returns
BunPlugin
- A bun plugin
To configure add this plugin to your Bun config and add the ts-plugin to your tsconfig.json
Examples
// Add the plugin.ts to your bunfig.toml
For LSP so your editor recognizes the solidity imports correctly you must also configure tevm/ts-plugin in your tsconfig.json The ts-plugin will provide type hints, code completion, and other features.
Once the esbuild plugin and the ts-plugin are configured, you can import Solidity files in JavaScript. The compiler will
turn them into Tevm Contract
instances.
Under the hood the esbuild plugin is creating a virtual file for ERC20.sol called ERC20.sol.cjs that looks like this
For custom configuration of the Tevm compiler add a tevm.config.json file to your project root.