org.web3j.codegen.SolidityFunctionWrapperGenerator Java Examples

The following examples show how to use org.web3j.codegen.SolidityFunctionWrapperGenerator. 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: Runner.java    From client-sdk-java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	System.out.println(LOGO);

	if (args.length < 1) {
		Console.exitError(USAGE);
	} else {
		switch (args[0]) {
		case "wallet":
			WalletRunner.run(tail(args));
			break;
		case "solidity":
			SolidityFunctionWrapperGenerator.run(tail(args));
			break;
		case "truffle":
			TruffleJsonFunctionWrapperGenerator.run(tail(args));
			break;
		case "wasm":
			WasmFunctionWrapperGenerator.run(tail(args));
			break;
		default:
			Console.exitError(USAGE);
		}
	}
}
 
Example #3
Source File: Runner.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.out.println(LOGO);

    if (args.length < 1) {
        Console.exitError(USAGE);
    } else {
        switch (args[0]) {
            case "wallet":
                WalletRunner.run(tail(args));
                break;
            case "solidity":
                SolidityFunctionWrapperGenerator.run(tail(args));
                break;
            case "truffle":
                TruffleJsonFunctionWrapperGenerator.run(tail(args));
                break;
            case "version":
                Console.exitSuccess("Version: " + Version.getVersion() + "\n"
                        + "Build timestamp: " + Version.getTimestamp());
                break;
            default:
                Console.exitError(USAGE);
        }
    }
}
 
Example #4
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);
}