Releases: gnidan/web-solc
web-solc@0.7.0
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
ℹ️ 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
undefinedmeans loading or error in React projects
Compatibility changes
- Fully supports Solidity v0.5.14 and newer
- Older versions may work but aren't guaranteed in browsers
- See automated compatibility report for details
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 instanceBreaking changes for web-solc
fetchSolc()now only fetches and returns a soljson string; the old behavior of fetching and loading is renamed tofetchAndLoadSolc()
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/loadingresult.type === 'error'- something went wrongresult.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 ofWebSolc | undefined