Java Code Examples for org.web3j.codegen.SolidityFunctionWrapperGenerator#main()

The following examples show how to use org.web3j.codegen.SolidityFunctionWrapperGenerator#main() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenerateContractWrapper.java    From web3j-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    final String typesFlag = useNativeJavaTypes ? "--javaTypes" : "--solidityTypes";

    SolidityFunctionWrapperGenerator.main(
            new String[] {
                "--abiFile",
                contractAbi.getAbsolutePath(),
                "--binFile",
                contractBin.getAbsolutePath(),
                "--outputDir",
                outputDir,
                "--package",
                packageName,
                "--contractName",
                contractName,
                "--addressLength",
                String.valueOf(addressLength),
                typesFlag
            });
}
 
Example 2
Source File: CompileDemo.java    From web3j_demo with Apache License 2.0 5 votes vote down vote up
@Override
public void run() throws Exception {
	super.run();

	// get and print installed compilers
	EthGetCompilers compilers = web3j
			.ethGetCompilers()
			.sendAsync()
			.get();

	System.out.println("Available compilers:");
	for(String compiler: compilers.getResult()) {
		System.out.println("- " + compiler);
	}
	System.out.println();

	// compile solidity code
	String sourceFile = String.format("%s/%s.%s", FOLDER_SOURCE, CONTRACT, Web3jConstants.EXT_SOLIDITY);
	String sourceCode = Web3jUtils.readSolidityFile(sourceFile);
	compileSolidity(sourceCode, CONTRACT, FOLDER_SOURCE);

	// generate java wrapper class
	String binaryFile = getBinaryFileName(CONTRACT, FOLDER_SOURCE);
	String abiFile = getAbiFileName(CONTRACT, FOLDER_SOURCE);
	String [] cmdLine = {binaryFile, abiFile, "-p", BASE_PACKAGE, "-o", FOLDER_TARGET};

	System.out.printf("Running SolidityFunctionWrapperGenerator " + String.join(" ", cmdLine) + " ... ");
	SolidityFunctionWrapperGenerator.main(cmdLine);
}