Skip to content

Releases: gnidan/web-solc

web-solc@0.7.0

28 Jul 03:36

Choose a tag to compare

This release changes fetchSolc and fetchAndLoadSolc to both default to using the WebAssembly builds.

In addition, this is a breaking release for users of the repository.baseUrl parameter defined in FetchOptions. This value must now exclude the trailing /bin or /wasm. Build architecture is now specified in FetchOptions as build: "wasm" | "emscripten".

web-solc@0.6.0

23 Jul 18:30

Choose a tag to compare

ℹ️ This release also includes @web-solc/react v0.2.0.

What's new

Separate fetching from loading compilers - you can now cache soljson files, use nightly builds, or bring your own compiler.

This release also improves support for older versions of Solidity.

Benefits

  • Cache soljson strings between page loads
  • Use nightly builds or custom compilers
  • Better error handling
  • No more guessing if undefined means loading or error in React projects

Compatibility changes

Core changes (web-solc v0.6.0)

This package now separates instantiating the compiler from downloading it. Previously, this package provided fetchSolc() as a function that did both, but now fetchSolc() only downloads the compiler; loadSolc() is provided for instantiation. For users who wish to preserve the old, all-in-one workflow, fetchAndLoadSolc() offers both behaviors combined.

const soljson = await fetchSolc("^0.8.0"); // fetch the compiler file
const solc = await loadSolc(soljson); // create the compiler instance

Breaking changes for web-solc

  • fetchSolc() now only fetches and returns a soljson string; the old behavior of fetching and loading is renamed to fetchAndLoadSolc()

React changes (@web-solc/react v0.2.0)

New caching support: The provider now lets you cache soljson files between page loads or component mounts.

import { WebSolcProvider, useWebSolc } from "@web-solc/react";

// With provider for caching
<WebSolcProvider>
  <MyApp />
</WebSolcProvider>

// The hook works without the provider too (no caching)
const result = useWebSolc({ version: "^0.8.0" });

The hook now returns better loading states:

  • result.type === 'loading' - still fetching/loading
  • result.type === 'error' - something went wrong
  • result.type === 'loaded' - compiler ready to use

Breaking changes for @web-solc/react

  • React hook takes an options object instead of just a version string
  • Hook returns a discriminated union ({ type: 'loading' | 'error' | 'loaded' }) instead of WebSolc | undefined