org.web3j.protocol.core.methods.response.EthCompileSolidity Java Examples
The following examples show how to use
org.web3j.protocol.core.methods.response.EthCompileSolidity.
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: EqualsVerifierResponseTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testDocumentation() { EqualsVerifier.forClass(EthCompileSolidity.Documentation.class) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #2
Source File: JsonRpc2_0Web3j.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Override public Request<?, EthCompileSolidity> ethCompileSolidity(String sourceCode) { return new Request<>( "eth_compileSolidity", Arrays.asList(sourceCode), web3jService, EthCompileSolidity.class); }
Example #3
Source File: EqualsVerifierResponseTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testCompiledSolidityCode() { EqualsVerifier.forClass(EthCompileSolidity.Code.class) .withPrefabValues( AbiDefinition.NamedType.class, new AbiDefinition.NamedType(), new AbiDefinition.NamedType("name", "uint256")) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #4
Source File: EqualsVerifierResponseTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testSolidityInfo() { EqualsVerifier.forClass(EthCompileSolidity.SolidityInfo.class) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #5
Source File: EqualsVerifierResponseTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testCode() { EqualsVerifier.forClass(EthCompileSolidity.Code.class) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #6
Source File: EqualsVerifierResponseTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testCompiledSolidityCode() { EqualsVerifier.forClass(EthCompileSolidity.Code.class) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #7
Source File: EqualsVerifierResponseTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testDocumentation() { EqualsVerifier.forClass(EthCompileSolidity.Documentation.class) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #8
Source File: CoreIT.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testEthCompileSolidity() throws Exception { String sourceCode = "pragma solidity ^0.4.0;" + "\ncontract test { function multiply(uint a) returns(uint d) {" + " return a * 7; } }" + "\ncontract test2 { function multiply2(uint a) returns(uint d) {" + " return a * 7; } }"; EthCompileSolidity ethCompileSolidity = web3j.ethCompileSolidity(sourceCode) .send(); assertNotNull(ethCompileSolidity.getCompiledSolidity()); assertThat( ethCompileSolidity.getCompiledSolidity().get("test2").getInfo().getSource(), is(sourceCode)); }
Example #9
Source File: CoreIT.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testEthCompileSolidity() throws Exception { String sourceCode = "pragma solidity ^0.4.0;" + "\ncontract test { function multiply(uint a) returns(uint d) {" + " return a * 7; } }" + "\ncontract test2 { function multiply2(uint a) returns(uint d) {" + " return a * 7; } }"; EthCompileSolidity ethCompileSolidity = web3j.ethCompileSolidity(sourceCode).send(); assertNotNull(ethCompileSolidity.getCompiledSolidity()); assertEquals( ethCompileSolidity.getCompiledSolidity().get("test2").getInfo().getSource(), (sourceCode)); }
Example #10
Source File: EqualsVerifierResponseTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testCode() { EqualsVerifier.forClass(EthCompileSolidity.Code.class) .withPrefabValues( AbiDefinition.NamedType.class, new AbiDefinition.NamedType(), new AbiDefinition.NamedType("name", "uint256")) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #11
Source File: JsonRpc2_0Web3j.java From web3j with Apache License 2.0 | 5 votes |
@Override public Request<?, EthCompileSolidity> ethCompileSolidity(String sourceCode) { return new Request<>( "eth_compileSolidity", Arrays.asList(sourceCode), web3jService, EthCompileSolidity.class); }
Example #12
Source File: EqualsVerifierResponseTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testSolidityInfo() { EqualsVerifier.forClass(EthCompileSolidity.SolidityInfo.class) .withPrefabValues( AbiDefinition.NamedType.class, new AbiDefinition.NamedType(), new AbiDefinition.NamedType("name", "uint256")) .suppress(Warning.NONFINAL_FIELDS) .suppress(Warning.STRICT_INHERITANCE) .verify(); }
Example #13
Source File: CompileDemo.java From web3j_demo with Apache License 2.0 | 4 votes |
/** * Compiles solidity source code using web3j. * Currently not working for testrpc see {@link https://github.com/web3j/web3j/issues/53}. */ public void compileNotWorkding(String source) { Request<?, EthCompileSolidity> result = web3j.ethCompileSolidity(source); System.out.println(result.toString()); }
Example #14
Source File: ResponseTest.java From web3j with Apache License 2.0 | 4 votes |
@Test public void testEthCompileSolidity() { buildResponse( "{\n" + " \"id\":1,\n" + " \"jsonrpc\": \"2.0\",\n" + " \"result\": {\n" + " \"test\": {\n" + " \"code\": \"0x605280600c6000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063c6888fa114602e57005b60376004356041565b8060005260206000f35b6000600782029050604d565b91905056\",\n" + " \"info\": {\n" + " \"source\": \"contract test {\\n\\tfunction multiply(uint a) returns(uint d) {\\n\\t\\treturn a * 7;\\n\\t}\\n}\\n\",\n" + " \"language\": \"Solidity\",\n" + " \"languageVersion\": \"0\",\n" + " \"compilerVersion\": \"0.8.2\",\n" + " \"compilerOptions\": \"--bin --abi --userdoc --devdoc --add-std --optimize -o /var/folders/3m/_6gnl12n1tj_5kf7sc3d72dw0000gn/T/solc498936951\",\n" + " \"abiDefinition\": [\n" + " {\n" + " \"constant\": false,\n" + " \"inputs\": [\n" + " {\n" + " \"name\": \"a\",\n" + " \"type\": \"uint256\"\n" + " }\n" + " ],\n" + " \"name\": \"multiply\",\n" + " \"outputs\": [\n" + " {\n" + " \"name\": \"d\",\n" + " \"type\": \"uint256\"\n" + " }\n" + " ],\n" + " \"type\": \"function\",\n" + " \"payable\": false\n" + " }\n" + " ],\n" + " \"userDoc\": {\n" + " \"methods\": {}\n" + " },\n" + " \"developerDoc\": {\n" + " \"methods\": {}\n" + " }\n" + " }\n" + " }\n" + " }" + " }\n" + "}"); Map<String, EthCompileSolidity.Code> compiledSolidity = new HashMap<>(1); compiledSolidity.put( "test", new EthCompileSolidity.Code( "0x605280600c6000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063c6888fa114602e57005b60376004356041565b8060005260206000f35b6000600782029050604d565b91905056", new EthCompileSolidity.SolidityInfo( "contract test {\n\tfunction multiply(uint a) returns(uint d) {\n" + "\t\treturn a * 7;\n\t}\n}\n", "Solidity", "0", "0.8.2", "--bin --abi --userdoc --devdoc --add-std --optimize -o " + "/var/folders/3m/_6gnl12n1tj_5kf7sc3d72dw0000gn/T/solc498936951", Arrays.asList( new AbiDefinition( false, Arrays.asList( new AbiDefinition.NamedType( "a", "uint256")), "multiply", Arrays.asList( new AbiDefinition.NamedType( "d", "uint256")), "function", false)), new EthCompileSolidity.Documentation(), new EthCompileSolidity.Documentation()))); EthCompileSolidity ethCompileSolidity = deserialiseResponse(EthCompileSolidity.class); assertEquals(ethCompileSolidity.getCompiledSolidity(), (compiledSolidity)); }
Example #15
Source File: ResponseTest.java From etherscan-explorer with GNU General Public License v3.0 | 4 votes |
@Test public void testEthCompileSolidity() { //CHECKSTYLE:OFF buildResponse( "{\n" + " \"id\":1,\n" + " \"jsonrpc\": \"2.0\",\n" + " \"result\": {\n" + " \"test\": {\n" + " \"code\": \"0x605280600c6000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063c6888fa114602e57005b60376004356041565b8060005260206000f35b6000600782029050604d565b91905056\",\n" + " \"info\": {\n" + " \"source\": \"contract test {\\n\\tfunction multiply(uint a) returns(uint d) {\\n\\t\\treturn a * 7;\\n\\t}\\n}\\n\",\n" + " \"language\": \"Solidity\",\n" + " \"languageVersion\": \"0\",\n" + " \"compilerVersion\": \"0.8.2\",\n" + " \"compilerOptions\": \"--bin --abi --userdoc --devdoc --add-std --optimize -o /var/folders/3m/_6gnl12n1tj_5kf7sc3d72dw0000gn/T/solc498936951\",\n" + " \"abiDefinition\": [\n" + " {\n" + " \"constant\": false,\n" + " \"inputs\": [\n" + " {\n" + " \"name\": \"a\",\n" + " \"type\": \"uint256\"\n" + " }\n" + " ],\n" + " \"name\": \"multiply\",\n" + " \"outputs\": [\n" + " {\n" + " \"name\": \"d\",\n" + " \"type\": \"uint256\"\n" + " }\n" + " ],\n" + " \"type\": \"function\",\n" + " \"payable\": false\n" + " }\n" + " ],\n" + " \"userDoc\": {\n" + " \"methods\": {}\n" + " },\n" + " \"developerDoc\": {\n" + " \"methods\": {}\n" + " }\n" + " }\n" + " }\n" + " }" + " }\n" + "}" ); //CHECKSTYLE:OFF Map<String, EthCompileSolidity.Code> compiledSolidity = new HashMap<>(1); compiledSolidity.put("test", new EthCompileSolidity.Code( //CHECKSTYLE:OFF "0x605280600c6000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063c6888fa114602e57005b60376004356041565b8060005260206000f35b6000600782029050604d565b91905056", //CHECKSTYLE:ON new EthCompileSolidity.SolidityInfo( "contract test {\n\tfunction multiply(uint a) returns(uint d) {\n" + "\t\treturn a * 7;\n\t}\n}\n", "Solidity", "0", "0.8.2", "--bin --abi --userdoc --devdoc --add-std --optimize -o " + "/var/folders/3m/_6gnl12n1tj_5kf7sc3d72dw0000gn/T/solc498936951", Arrays.asList(new AbiDefinition( false, Arrays.asList(new AbiDefinition.NamedType("a", "uint256")), "multiply", Arrays.asList(new AbiDefinition.NamedType("d", "uint256")), "function", false )), new EthCompileSolidity.Documentation(), new EthCompileSolidity.Documentation() ) )); EthCompileSolidity ethCompileSolidity = deserialiseResponse(EthCompileSolidity.class); assertThat(ethCompileSolidity.getCompiledSolidity(), equalTo(compiledSolidity)); }
Example #16
Source File: Ethereum.java From web3j with Apache License 2.0 | votes |
Request<?, EthCompileSolidity> ethCompileSolidity(String sourceCode);
Example #17
Source File: Ethereum.java From etherscan-explorer with GNU General Public License v3.0 | votes |
Request<?, EthCompileSolidity> ethCompileSolidity(String sourceCode);