/evmts-monorepo

Execute solidity scripts in the browser

Primary LanguageTypeScriptMIT LicenseMIT

wagmi logo

Execute solidity scripts in browser 🏗️🚧

CI CI Version

evmts-monorepo

EVMts core enables direct evm execution clientside with forge cheat codes (not implemented yet)

EVMts imports enable a streamlined dev experience with direct solidity imports and integration with Wagmi

Get Started Quick with the NEXT.js starter project

Visit Docs for docs, guides, API and more! 📄

See EVMts Beta project board for progress on the upcoming beta release! 💥

Runtime libraries 📦

  • core/ - core evmts library
  • config/ - Tooling for configuring an evmts.config.ts file

Note: evmts.config.ts is a WIP. Currently configuration is done through ts-config plugin

Bundlers

Bundlers such as Rollup, Webpack, or Vite are used By JavaScript tools to control the import graph of JavaScript projects. This is how EVMts contract imports are able to work seemlessly.

Bundlers are provided for all major tools. If yours is not supported consider opening an issue.

All bundlers are in the bundlers/* folder

Language server tools

The language service protocol is how tools such as VSCode and Neovim are able to provide features such as autocomplete, information on hover, autoimports, and more. EVMts language service tools brings this functionality to TypeScript for contracts.

Also included are tools for typechecking code and code generation for those using EVMts without a bundler

  • @evmts/ts-plugin - Typescript Server Plugin for decorating the TypeScript language server with additional functionality
  • @evmts/vscode - A work-in-progress vscode plugin for EVMts

Apps 📦

Example apps

Tests ✅

e2e/ Playwright e2e tests that run against the example apps

Getting started 🏗️

See docs/evmts for installation and more detailed usage documentation.

See docs/monorepo for documentation on how to execute the monorepo with nx

See docs/contributing for documentation on how to contribute to evmts. No contribution is too small

Basic usage ✨

Note: Scripting is currently unimplemented

EVMts has future plans to enable solidity scripting and optimistic execution. As of now only EVMts contract imports are supported

See EVMts Beta project board for updates.

1. First write a script in solidity

Scripts in EVMts work exactly like the scripts in forge

pragma solidity ^0.8.17;

import {Script} from "forge-std/Script.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Example is Script {
    function run(ERC20 erc20Contract, address recipient, uint256 amount) external {
        address signer = vm.envAddress("SIGNER");
        vm.startBroadcast(signer);
        contract.transferFrom(signer, recipient, amount);
        vm.stopBroadcast();
    }
}

2. Then execute your script in TypeScript

  • no code gen step
  • no abis
  • no boilerplate

Just import your script and run it.

import { Example } from "./Example.s.sol"; // [!code focus]
import { evmts } from "./evmts";
import { Address } from "@evmts/core";

const tokenAddress: Address = "0x4200000000000000000000000000000000000042";
const recipient: Address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
const amount = BigInt(420);

evmts // [!code focus]
  .script(Example) // [!code focus]
  .run(tokenAddress, receipeint, amount) // [!code focus]
  .broadcast()
  .then(({ txHash }) => {
    console.log(txHash);
  });

Try EVMts now

You don't need to install anything just to play with EVMts! Try editing this sandbox or check out the getting started docs

Author ✍️

Security 🔒

If you believe you have found a security vulnerability we encourage you to responsibly disclose this and not open a public issue. We will investigate all legitimate reports. Email will@oplabs.co to disclose any security vulnerabilities.

Contributing 💻

Contributions are encouraged, but please open an issue before doing anything major

🚧 WARNING: UNDER CONSTRUCTION 🚧

This project is in alpha and subject to frequent changes

Looking to get started building a production-ready dapp? Check out viem

Interested in the OP stack? Check out op stack blog here: https://optimism.mirror.xyz/fLk5UGjZDiXFuvQh6R_HscMQuuY9ABYNF7PI76-qJYs

Check out these tools 🔧

Enjoy this tool? Check out these other awesome tools that make this library possible

And these other awesome tools that helped with development process and planning

License 📄