Skip to content

Commit

Permalink
1. Regenerated smart contract wrappers.
Browse files Browse the repository at this point in the history
2. Added suppress warning annotation to codegen for working with array types.
3. Bumped version to 3.3.1.
  • Loading branch information
conor10 committed Mar 2, 2018
1 parent 5e7bab2 commit 80b3f2f
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ allprojects {
targetCompatibility = 1.8

group 'org.web3j'
version '3.3.0'
version '3.3.1'

apply plugin: 'java'
apply plugin: 'jacoco'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.lang.model.element.Modifier;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
Expand Down Expand Up @@ -578,6 +579,9 @@ private void buildConstantFunction(
ClassName.get(Callable.class), nativeReturnTypeName))
.addMethod(MethodSpec.methodBuilder("call")
.addAnnotation(Override.class)
.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class)
.addMember("value", "$S", "unchecked")
.build())
.addModifiers(Modifier.PUBLIC)
.addException(Exception.class)
.returns(nativeReturnTypeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public void testBuildFunctionConstantSingleValueRawListReturn() throws Exception
+ " return new org.web3j.protocol.core.RemoteCall<java.util.List>(\n"
+ " new java.util.concurrent.Callable<java.util.List>() {\n"
+ " @java.lang.Override\n"
+ " @java.lang.SuppressWarnings(\"unchecked\")\n"
+ " public java.util.List call() throws java.lang.Exception {\n"
+ " java.util.List<org.web3j.abi.datatypes.Type> result = (java.util.List<org.web3j.abi.datatypes.Type>) executeCallSingleValueReturn(function, java.util.List.class);\n"
+ " return convertToNative(result);\n"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6060604052341561000f57600080fd5b6101e48061001e6000396000f3006060604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d51cd4ac8114610045575b600080fd5b341561005057600080fd5b61007173ffffffffffffffffffffffffffffffffffffffff60043516610159565b60405173ffffffffffffffffffffffffffffffffffffffff808a168252881660208201526040810187905260608101869052608081018560008111156100b357fe5b60ff168152602081018590526060810183905260808282038101604083019081528554600260001960018316156101000201909116049183018290529160a00190859080156101435780601f1061011857610100808354040283529160200191610143565b820191906000526020600020905b81548152906001019060200180831161012657829003601f168201915b5050995050505050505050505060405180910390f35b6000602081905290815260409020805460018201546002830154600384015460048501546005860154600787015473ffffffffffffffffffffffffffffffffffffffff9687169796909516959394929360ff90921692909160060190885600a165627a7a72305820b9eddd870fcbf5f71addbcec8bab66cb21d6e74b3a6f559009dc6810af0407230029
6060604052341561000f57600080fd5b6101e48061001e6000396000f3006060604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d51cd4ac8114610045575b600080fd5b341561005057600080fd5b61007173ffffffffffffffffffffffffffffffffffffffff60043516610159565b60405173ffffffffffffffffffffffffffffffffffffffff808a168252881660208201526040810187905260608101869052608081018560008111156100b357fe5b60ff168152602081018590526060810183905260808282038101604083019081528554600260001960018316156101000201909116049183018290529160a00190859080156101435780601f1061011857610100808354040283529160200191610143565b820191906000526020600020905b81548152906001019060200180831161012657829003601f168201915b5050995050505050505050505060405180910390f35b6000602081905290815260409020805460018201546002830154600384015460048501546005860154600787015473ffffffffffffffffffffffffffffffffffffffff9687169796909516959394929360ff90921692909160060190885600a165627a7a72305820f4d4bf1c9ea57666a0a0e3a810321535fee9dd5f0809158d2f27a18e0a2df2560029
19 changes: 14 additions & 5 deletions integration-tests/src/test/java/org/web3j/generated/Arrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Address;
import org.web3j.abi.datatypes.DynamicArray;
Expand All @@ -22,7 +23,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
*
* <p>Generated with web3j version 3.2.0.
* <p>Generated with web3j version none.
*/
public class Arrays extends Contract {
private static final String BINARY = "6060604052341561000f57600080fd5b6102da8061001e6000396000f3006060604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633cac14c8811461005b578063b96f54d1146100c1578063beda363b14610136575b600080fd5b341561006657600080fd5b61006e610185565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156100ad578082015183820152602001610095565b505050509050019250505060405180910390f35b34156100cc57600080fd5b6100fd600461014481600a6101406040519081016040529190828261014080828437509395506101b2945050505050565b604051808261014080838360005b8381101561012357808201518382015260200161010b565b5050505090500191505060405180910390f35b341561014157600080fd5b61006e60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496506101fe95505050505050565b61018d610274565b600060405180591061019c5750595b9080825280602002602001820160405250905090565b6101ba610286565b600a60005b818110156101f7578360001982840301600a81106101d957fe5b60200201518382600a81106101ea57fe5b60200201526001016101bf565b5050919050565b610206610274565b600080835191508160405180591061021b5750595b90808252806020026020018201604052509250600090505b818110156101f757838160010183038151811061024c57fe5b9060200190602002015183828151811061026257fe5b60209081029091010152600101610233565b60206040519081016040526000815290565b610140604051908101604052600a815b600081526020019060019003908161029657905050905600a165627a7a72305820305df0b85cbf8cf9c0720830cf03914a3044a0459d83288859a24d3dd311ef840029";
Expand All @@ -36,14 +37,22 @@ protected Arrays(String contractAddress, Web3j web3j, TransactionManager transac
}

public RemoteCall<List> returnArray() {
Function function = new Function("returnArray",
final Function function = new Function("returnArray",
java.util.Arrays.<Type>asList(),
java.util.Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {}));
return executeRemoteCallSingleValueReturn(function, List.class);
return new RemoteCall<List>(
new Callable<List>() {
@Override
@SuppressWarnings("unchecked")
public List call() throws Exception {
List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
return convertToNative(result);
}
});
}

public RemoteCall<TransactionReceipt> fixedReverse(List<BigInteger> input) {
Function function = new Function(
final Function function = new Function(
"fixedReverse",
java.util.Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.StaticArray10<org.web3j.abi.datatypes.generated.Uint256>(
org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.Uint256.class))),
Expand All @@ -52,7 +61,7 @@ public RemoteCall<TransactionReceipt> fixedReverse(List<BigInteger> input) {
}

public RemoteCall<TransactionReceipt> dynamicReverse(List<BigInteger> input) {
Function function = new Function(
final Function function = new Function(
"dynamicReverse",
java.util.Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint256>(
org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.Uint256.class))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.Collections;
import java.util.List;
import org.web3j.abi.EventEncoder;
import org.web3j.abi.EventValues;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Event;
import org.web3j.abi.datatypes.Function;
Expand All @@ -31,7 +30,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
*
* <p>Generated with web3j version 3.2.0.
* <p>Generated with web3j version 3.3.0.
*/
public class Fibonacci extends Contract {
private static final String BINARY = "6060604052341561000f57600080fd5b6101498061001e6000396000f30060606040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff414610078575b600080fd5b341561005b57600080fd5b61006660043561008e565b60405190815260200160405180910390f35b341561008357600080fd5b6100666004356100da565b6000610099826100da565b90507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed828260405191825260208201526040908101905180910390a1919050565b60008115156100eb57506000610118565b81600114156100fc57506001610118565b610108600283036100da565b610114600184036100da565b0190505b9190505600a165627a7a72305820e408d0180959faf2f0168a105318c66ad9cee6a322569be9157dfc267cf450ce0029";
Expand All @@ -48,11 +47,11 @@ public List<NotifyEventResponse> getNotifyEvents(TransactionReceipt transactionR
final Event event = new Event("Notify",
Arrays.<TypeReference<?>>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(event, transactionReceipt);
ArrayList<NotifyEventResponse> responses = new ArrayList<NotifyEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
for (Contract.EventValuesWithLog eventValues : valueList) {
NotifyEventResponse typedResponse = new NotifyEventResponse();
typedResponse.log = transactionReceipt.getLogs().get(valueList.indexOf(eventValues));
typedResponse.log = eventValues.getLog();
typedResponse.input = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
typedResponse.result = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue();
responses.add(typedResponse);
Expand All @@ -69,7 +68,7 @@ public Observable<NotifyEventResponse> notifyEventObservable(DefaultBlockParamet
return web3j.ethLogObservable(filter).map(new Func1<Log, NotifyEventResponse>() {
@Override
public NotifyEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(event, log);
NotifyEventResponse typedResponse = new NotifyEventResponse();
typedResponse.log = log;
typedResponse.input = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
*
* <p>Generated with web3j version 3.2.0.
* <p>Generated with web3j version 3.3.0.
*/
public class Greeter extends Contract {
private static final String BINARY = "6060604052341561000f57600080fd5b6040516103203803806103208339810160405280805160008054600160a060020a03191633600160a060020a03161790559190910190506001818051610059929160200190610060565b50506100fb565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a157805160ff19168380011785556100ce565b828001600101855582156100ce579182015b828111156100ce5782518255916020019190600101906100b3565b506100da9291506100de565b5090565b6100f891905b808211156100da57600081556001016100e4565b90565b6102168061010a6000396000f30060606040526004361061004b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114610050578063cfae321714610065575b600080fd5b341561005b57600080fd5b6100636100ef565b005b341561007057600080fd5b610078610130565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156100b457808201518382015260200161009c565b50505050905090810190601f1680156100e15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116141561012e5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6101386101d8565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101ce5780601f106101a3576101008083540402835291602001916101ce565b820191906000526020600020905b8154815290600101906020018083116101b157829003601f168201915b5050505050905090565b602060405190810160405260008152905600a165627a7a723058209dd925f8a845985cc97b98b1d11e67cb72915d7316a7eeb4e28cec3f5f398c9f0029";
Expand Down
Loading

0 comments on commit 80b3f2f

Please sign in to comment.