Skip to content

Commit a007536

Browse files
committed
Merge remote-tracking branch 'origin/master' into android
# Conflicts: # build.gradle
2 parents d7d4660 + 80b3f2f commit a007536

File tree

10 files changed

+41
-29
lines changed

10 files changed

+41
-29
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ allprojects {
4444
targetCompatibility = 1.6
4545

4646
group 'org.web3j'
47-
version '3.3.0-android'
47+
version '3.3.1-android'
4848

4949
apply plugin: 'java'
5050
apply plugin: 'jacoco'

codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import javax.lang.model.element.Modifier;
1313

1414
import com.fasterxml.jackson.databind.ObjectMapper;
15+
import com.squareup.javapoet.AnnotationSpec;
1516
import com.squareup.javapoet.ClassName;
1617
import com.squareup.javapoet.CodeBlock;
1718
import com.squareup.javapoet.FieldSpec;
@@ -588,6 +589,9 @@ private void buildConstantFunction(
588589
ClassName.get(Callable.class), nativeReturnTypeName))
589590
.addMethod(MethodSpec.methodBuilder("call")
590591
.addAnnotation(Override.class)
592+
.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class)
593+
.addMember("value", "$S", "unchecked")
594+
.build())
591595
.addModifiers(Modifier.PUBLIC)
592596
.addException(Exception.class)
593597
.returns(nativeReturnTypeName)

codegen/src/test/java/org/web3j/codegen/SolidityFunctionWrapperTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void testBuildFunctionTransaction() throws Exception {
153153
}
154154

155155
@Test
156-
public void testBuildPayabelFunctionTransaction() throws Exception {
156+
public void testBuildPayableFunctionTransaction() throws Exception {
157157
AbiDefinition functionDefinition = new AbiDefinition(
158158
false,
159159
Arrays.<AbiDefinition.NamedType>asList(
@@ -229,6 +229,7 @@ public void testBuildFunctionConstantSingleValueRawListReturn() throws Exception
229229
+ " return new org.web3j.protocol.core.RemoteCall<java.util.List>(\n"
230230
+ " new java.util.concurrent.Callable<java.util.List>() {\n"
231231
+ " @java.lang.Override\n"
232+
+ " @java.lang.SuppressWarnings(\"unchecked\")\n"
232233
+ " public java.util.List call() throws java.lang.Exception {\n"
233234
+ " java.util.List<org.web3j.abi.datatypes.Type> result = (java.util.List<org.web3j.abi.datatypes.Type>) executeCallSingleValueReturn(function, java.util.List.class);\n"
234235
+ " return convertToNative(result);\n"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6060604052341561000f57600080fd5b6101e48061001e6000396000f3006060604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d51cd4ac8114610045575b600080fd5b341561005057600080fd5b61007173ffffffffffffffffffffffffffffffffffffffff60043516610159565b60405173ffffffffffffffffffffffffffffffffffffffff808a168252881660208201526040810187905260608101869052608081018560008111156100b357fe5b60ff168152602081018590526060810183905260808282038101604083019081528554600260001960018316156101000201909116049183018290529160a00190859080156101435780601f1061011857610100808354040283529160200191610143565b820191906000526020600020905b81548152906001019060200180831161012657829003601f168201915b5050995050505050505050505060405180910390f35b6000602081905290815260409020805460018201546002830154600384015460048501546005860154600787015473ffffffffffffffffffffffffffffffffffffffff9687169796909516959394929360ff90921692909160060190885600a165627a7a72305820b9eddd870fcbf5f71addbcec8bab66cb21d6e74b3a6f559009dc6810af0407230029
1+
6060604052341561000f57600080fd5b6101e48061001e6000396000f3006060604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d51cd4ac8114610045575b600080fd5b341561005057600080fd5b61007173ffffffffffffffffffffffffffffffffffffffff60043516610159565b60405173ffffffffffffffffffffffffffffffffffffffff808a168252881660208201526040810187905260608101869052608081018560008111156100b357fe5b60ff168152602081018590526060810183905260808282038101604083019081528554600260001960018316156101000201909116049183018290529160a00190859080156101435780601f1061011857610100808354040283529160200191610143565b820191906000526020600020905b81548152906001019060200180831161012657829003601f168201915b5050995050505050505050505060405180910390f35b6000602081905290815260409020805460018201546002830154600384015460048501546005860154600787015473ffffffffffffffffffffffffffffffffffffffff9687169796909516959394929360ff90921692909160060190885600a165627a7a72305820f4d4bf1c9ea57666a0a0e3a810321535fee9dd5f0809158d2f27a18e0a2df2560029

integration-tests/src/test/java/org/web3j/generated/Arrays.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.math.BigInteger;
44
import java.util.Collections;
55
import java.util.List;
6+
import java.util.concurrent.Callable;
67
import org.web3j.abi.TypeReference;
78
import org.web3j.abi.datatypes.Address;
89
import org.web3j.abi.datatypes.DynamicArray;
@@ -22,7 +23,7 @@
2223
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
2324
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
2425
*
25-
* <p>Generated with web3j version 3.2.0.
26+
* <p>Generated with web3j version none.
2627
*/
2728
public class Arrays extends Contract {
2829
private static final String BINARY = "6060604052341561000f57600080fd5b6102da8061001e6000396000f3006060604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633cac14c8811461005b578063b96f54d1146100c1578063beda363b14610136575b600080fd5b341561006657600080fd5b61006e610185565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156100ad578082015183820152602001610095565b505050509050019250505060405180910390f35b34156100cc57600080fd5b6100fd600461014481600a6101406040519081016040529190828261014080828437509395506101b2945050505050565b604051808261014080838360005b8381101561012357808201518382015260200161010b565b5050505090500191505060405180910390f35b341561014157600080fd5b61006e60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496506101fe95505050505050565b61018d610274565b600060405180591061019c5750595b9080825280602002602001820160405250905090565b6101ba610286565b600a60005b818110156101f7578360001982840301600a81106101d957fe5b60200201518382600a81106101ea57fe5b60200201526001016101bf565b5050919050565b610206610274565b600080835191508160405180591061021b5750595b90808252806020026020018201604052509250600090505b818110156101f757838160010183038151811061024c57fe5b9060200190602002015183828151811061026257fe5b60209081029091010152600101610233565b60206040519081016040526000815290565b610140604051908101604052600a815b600081526020019060019003908161029657905050905600a165627a7a72305820305df0b85cbf8cf9c0720830cf03914a3044a0459d83288859a24d3dd311ef840029";
@@ -36,14 +37,22 @@ protected Arrays(String contractAddress, Web3j web3j, TransactionManager transac
3637
}
3738

3839
public RemoteCall<List> returnArray() {
39-
Function function = new Function("returnArray",
40+
final Function function = new Function("returnArray",
4041
java.util.Arrays.<Type>asList(),
4142
java.util.Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {}));
42-
return executeRemoteCallSingleValueReturn(function, List.class);
43+
return new RemoteCall<List>(
44+
new Callable<List>() {
45+
@Override
46+
@SuppressWarnings("unchecked")
47+
public List call() throws Exception {
48+
List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
49+
return convertToNative(result);
50+
}
51+
});
4352
}
4453

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

5463
public RemoteCall<TransactionReceipt> dynamicReverse(List<BigInteger> input) {
55-
Function function = new Function(
64+
final Function function = new Function(
5665
"dynamicReverse",
5766
java.util.Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint256>(
5867
org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.Uint256.class))),

integration-tests/src/test/java/org/web3j/generated/Fibonacci.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.util.Collections;
77
import java.util.List;
88
import org.web3j.abi.EventEncoder;
9-
import org.web3j.abi.EventValues;
109
import org.web3j.abi.TypeReference;
1110
import org.web3j.abi.datatypes.Event;
1211
import org.web3j.abi.datatypes.Function;
@@ -31,7 +30,7 @@
3130
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
3231
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
3332
*
34-
* <p>Generated with web3j version 3.2.0.
33+
* <p>Generated with web3j version 3.3.0.
3534
*/
3635
public class Fibonacci extends Contract {
3736
private static final String BINARY = "6060604052341561000f57600080fd5b6101498061001e6000396000f30060606040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff414610078575b600080fd5b341561005b57600080fd5b61006660043561008e565b60405190815260200160405180910390f35b341561008357600080fd5b6100666004356100da565b6000610099826100da565b90507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed828260405191825260208201526040908101905180910390a1919050565b60008115156100eb57506000610118565b81600114156100fc57506001610118565b610108600283036100da565b610114600184036100da565b0190505b9190505600a165627a7a72305820e408d0180959faf2f0168a105318c66ad9cee6a322569be9157dfc267cf450ce0029";
@@ -48,11 +47,11 @@ public List<NotifyEventResponse> getNotifyEvents(TransactionReceipt transactionR
4847
final Event event = new Event("Notify",
4948
Arrays.<TypeReference<?>>asList(),
5049
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}));
51-
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
50+
List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(event, transactionReceipt);
5251
ArrayList<NotifyEventResponse> responses = new ArrayList<NotifyEventResponse>(valueList.size());
53-
for (EventValues eventValues : valueList) {
52+
for (Contract.EventValuesWithLog eventValues : valueList) {
5453
NotifyEventResponse typedResponse = new NotifyEventResponse();
55-
typedResponse.log = transactionReceipt.getLogs().get(valueList.indexOf(eventValues));
54+
typedResponse.log = eventValues.getLog();
5655
typedResponse.input = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
5756
typedResponse.result = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue();
5857
responses.add(typedResponse);
@@ -69,7 +68,7 @@ public Observable<NotifyEventResponse> notifyEventObservable(DefaultBlockParamet
6968
return web3j.ethLogObservable(filter).map(new Func1<Log, NotifyEventResponse>() {
7069
@Override
7170
public NotifyEventResponse call(Log log) {
72-
EventValues eventValues = extractEventParameters(event, log);
71+
Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(event, log);
7372
NotifyEventResponse typedResponse = new NotifyEventResponse();
7473
typedResponse.log = log;
7574
typedResponse.input = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();

integration-tests/src/test/java/org/web3j/generated/Greeter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
2323
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
2424
*
25-
* <p>Generated with web3j version 3.2.0.
25+
* <p>Generated with web3j version 3.3.0.
2626
*/
2727
public class Greeter extends Contract {
2828
private static final String BINARY = "6060604052341561000f57600080fd5b6040516103203803806103208339810160405280805160008054600160a060020a03191633600160a060020a03161790559190910190506001818051610059929160200190610060565b50506100fb565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a157805160ff19168380011785556100ce565b828001600101855582156100ce579182015b828111156100ce5782518255916020019190600101906100b3565b506100da9291506100de565b5090565b6100f891905b808211156100da57600081556001016100e4565b90565b6102168061010a6000396000f30060606040526004361061004b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114610050578063cfae321714610065575b600080fd5b341561005b57600080fd5b6100636100ef565b005b341561007057600080fd5b610078610130565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156100b457808201518382015260200161009c565b50505050905090810190601f1680156100e15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116141561012e5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b6101386101d8565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101ce5780601f106101a3576101008083540402835291602001916101ce565b820191906000526020600020905b8154815290600101906020018083116101b157829003601f168201915b5050505050905090565b602060405190810160405260008152905600a165627a7a723058209dd925f8a845985cc97b98b1d11e67cb72915d7316a7eeb4e28cec3f5f398c9f0029";

0 commit comments

Comments
 (0)