
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
solidity-browser-compiler
Advanced tools
This is example how to use:
import React from 'react'
import { solidityCompiler } from 'solidity-browser-compiler';
const Homepage = () => {
const compile = async () => {
const version = 'soljson-v0.8.8+commit.dddeac2f.js';
const useOptimization = true;
const runs = 200;
const contract = `
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
contract Counter {
uint public count;
// Function to get the current count
function get() public view returns (uint) {
return count;
}
// Function to increment count by 1
function inc() public {
count += 1;
}
// Function to decrement count by 1
function dec() public {
// This function will fail if count = 0
count -= 1;
}
}`
const result = await solidityCompiler({
version: `https://binaries.soliditylang.org/bin/${version}`,
contractBody: contract,
options: { optimizer: { enabled: useOptimization, runs: runs } }
});
console.info(result);
}
return (
<div>
<button onClick={compile}>Compile</button>
</div>
)
}
export default Homepage
abi, evm, metadata, storage layout is found in:
result.contracts.Compiled_Contracts.<YOUR_CONTRACT_NAME>.The thing you need
incase there is an error, result will contain two entries: result.errors
and result.sources
FAQs
Package for compiling solidity code in the browser.
The npm package solidity-browser-compiler receives a total of 4,750 weekly downloads. As such, solidity-browser-compiler popularity was classified as popular.
We found that solidity-browser-compiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.