Skip to content

Commit

Permalink
1. Fixed up code generators to use 4 space indent.
Browse files Browse the repository at this point in the history
2. Modified Solidity code generator to provide block parameters.
  • Loading branch information
conor10 committed May 15, 2017
1 parent 3c6f609 commit 014036e
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 84 deletions.
15 changes: 7 additions & 8 deletions src/integration-test/java/org/web3j/generated/Arrays.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.web3j.generated;

import java.lang.String;
import java.math.BigInteger;
import java.util.Collections;
import java.util.concurrent.Future;
Expand All @@ -21,17 +20,17 @@
* <strong>Do not modify!</strong><br>
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update.
*
* <p>Generated with web3j version 2.0.1.
* <p>Generated with web3j version 2.2.0.
*/
public final class Arrays extends Contract {
private static final String BINARY = "6060604052341561000c57fe5b5b61028c8061001c6000396000f300606060405263ffffffff60e060020a600035041663b96f54d1811461002c578063beda363b146100a6575bfe5b341561003457fe5b6040805161014081810190925261006891600491610144918390600a90839083908082843750939550610154945050505050565b60405180826101408083835b80518252602083111561009457601f199092019160209182019101610074565b50505090500191505060405180910390f35b34156100ae57fe5b6100f96004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506101a295505050505050565b6040805160208082528351818301528351919283929083019185810191028083838215610141575b80518252602083111561014157601f199092019160209182019101610121565b5050509050019250505060405180910390f35b61015c610225565b600a60005b8181101561019a578360001982840301600a811061017b57fe5b60200201518382600a811061018c57fe5b60200201525b600101610161565b5b5050919050565b6101aa61024e565b815160405160009082908059106101be5750595b908082528060200260200182016040525b509250600090505b8181101561019a57838160010183038151811015156101f257fe5b90602001906020020151838281518110151561020a57fe5b602090810290910101525b6001016101d7565b5b5050919050565b61014060405190810160405280600a905b60008152602001906001900390816102365790505090565b604080516020810190915260008152905600a165627a7a7230582055320d18bbf364dc41bf0b6885a12ec739cacc25a300af31a3105b09ee5151d80029";

private Arrays(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
super(contractAddress, web3j, credentials, gasPrice, gasLimit);
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}

private Arrays(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}

public Future<TransactionReceipt> fixedReverse(StaticArray<Uint256> input) {
Expand All @@ -44,12 +43,12 @@ public Future<TransactionReceipt> dynamicReverse(DynamicArray<Uint256> input) {
return executeTransactionAsync(function);
}

public static Future<Arrays> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) {
return deployAsync(Arrays.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialValue);
public static Future<Arrays> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) {
return deployAsync(Arrays.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialEtherValue);
}

public static Future<Arrays> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) {
return deployAsync(Arrays.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialValue);
public static Future<Arrays> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) {
return deployAsync(Arrays.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialEtherValue);
}

public static Arrays load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
Expand Down
30 changes: 14 additions & 16 deletions src/integration-test/java/org/web3j/generated/Fibonacci.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.web3j.generated;

import java.lang.Override;
import java.lang.String;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -17,7 +15,7 @@
import org.web3j.abi.datatypes.generated.Uint256;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.DefaultBlockParameterName;
import org.web3j.protocol.core.DefaultBlockParameter;
import org.web3j.protocol.core.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.Log;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
Expand All @@ -31,17 +29,17 @@
* <strong>Do not modify!</strong><br>
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update.
*
* <p>Generated with web3j version 2.0.1.
* <p>Generated with web3j version 2.2.0.
*/
public final class Fibonacci extends Contract {
private static final String BINARY = "6060604052341561000c57fe5b5b6101278061001c6000396000f300606060405263ffffffff60e060020a6000350416633c7fdc708114602a57806361047ff414604c575bfe5b3415603157fe5b603a600435606e565b60408051918252519081900360200190f35b3415605357fe5b603a60043560bb565b60408051918252519081900360200190f35b600060778260bb565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a15b919050565b600081151560ca5750600060b6565b816001141560d95750600160b6565b60e36002830360bb565b60ed6001840360bb565b01905060b6565b5b5b9190505600a165627a7a72305820ab11641de769d11f19354d7b1109fd73cd4e799ccf7eeb83192400c110e3dc950029";

private Fibonacci(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
super(contractAddress, web3j, credentials, gasPrice, gasLimit);
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}

private Fibonacci(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}

public List<NotifyEventResponse> getNotifyEvents(TransactionReceipt transactionReceipt) {
Expand All @@ -52,26 +50,26 @@ public List<NotifyEventResponse> getNotifyEvents(TransactionReceipt transactionR
ArrayList<NotifyEventResponse> responses = new ArrayList<NotifyEventResponse>(valueList.size());
for(EventValues eventValues : valueList) {
NotifyEventResponse typedResponse = new NotifyEventResponse();
typedResponse.input = (Uint256)eventValues.getNonIndexedValues().get(0);
typedResponse.result = (Uint256)eventValues.getNonIndexedValues().get(1);
typedResponse.input = (Uint256) eventValues.getNonIndexedValues().get(0);
typedResponse.result = (Uint256) eventValues.getNonIndexedValues().get(1);
responses.add(typedResponse);
}
return responses;
}

public Observable<NotifyEventResponse> notifyEventObservable() {
public Observable<NotifyEventResponse> notifyEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("Notify",
Arrays.<TypeReference<?>>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}));
EthFilter filter = new EthFilter(DefaultBlockParameterName.EARLIEST,DefaultBlockParameterName.LATEST, getContractAddress());
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, NotifyEventResponse>() {
@Override
public NotifyEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
NotifyEventResponse typedResponse = new NotifyEventResponse();
typedResponse.input = (Uint256)eventValues.getNonIndexedValues().get(0);
typedResponse.result = (Uint256)eventValues.getNonIndexedValues().get(1);
typedResponse.input = (Uint256) eventValues.getNonIndexedValues().get(0);
typedResponse.result = (Uint256) eventValues.getNonIndexedValues().get(1);
return typedResponse;
}
});
Expand All @@ -89,12 +87,12 @@ public Future<Uint256> fibonacci(Uint256 number) {
return executeCallSingleValueReturnAsync(function);
}

public static Future<Fibonacci> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) {
return deployAsync(Fibonacci.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialValue);
public static Future<Fibonacci> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) {
return deployAsync(Fibonacci.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialEtherValue);
}

public static Future<Fibonacci> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) {
return deployAsync(Fibonacci.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialValue);
public static Future<Fibonacci> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) {
return deployAsync(Fibonacci.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialEtherValue);
}

public static Fibonacci load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
Expand Down
15 changes: 7 additions & 8 deletions src/integration-test/java/org/web3j/generated/Greeter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.web3j.generated;

import java.lang.String;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -21,17 +20,17 @@
* <strong>Do not modify!</strong><br>
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update.
*
* <p>Generated with web3j version 2.0.1.
* <p>Generated with web3j version 2.2.0.
*/
public final class Greeter extends Contract {
private static final String BINARY = "6060604052341561000c57fe5b6040516102f03803806102f0833981016040528051015b5b60008054600160a060020a03191633600160a060020a03161790555b805161005390600190602084019061005b565b505b506100fb565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009c57805160ff19168380011785556100c9565b828001600101855582156100c9579182015b828111156100c95782518255916020019190600101906100ae565b5b506100d69291506100da565b5090565b6100f891905b808211156100d657600081556001016100e0565b5090565b90565b6101e68061010a6000396000f300606060405263ffffffff60e060020a60003504166341c0e1b5811461002c578063cfae32171461003e575bfe5b341561003457fe5b61003c6100ce565b005b341561004657fe5b61004e610110565b604080516020808252835181830152835191928392908301918501908083838215610094575b80518252602083111561009457601f199092019160209182019101610074565b505050905090810190601f1680156100c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116141561010d5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b6101186101a8565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561019d5780601f106101725761010080835404028352916020019161019d565b820191906000526020600020905b81548152906001019060200180831161018057829003601f168201915b505050505090505b90565b604080516020810190915260008152905600a165627a7a72305820141d86fec5655546a8ea51f05c2df449092e6e94a88e09d4214fdf5836d7b56e0029";

private Greeter(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
super(contractAddress, web3j, credentials, gasPrice, gasLimit);
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}

private Greeter(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}

public Future<TransactionReceipt> kill() {
Expand All @@ -46,14 +45,14 @@ public Future<Utf8String> greet() {
return executeCallSingleValueReturnAsync(function);
}

public static Future<Greeter> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue, Utf8String _greeting) {
public static Future<Greeter> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue, Utf8String _greeting) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(_greeting));
return deployAsync(Greeter.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor, initialValue);
return deployAsync(Greeter.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor, initialEtherValue);
}

public static Future<Greeter> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue, Utf8String _greeting) {
public static Future<Greeter> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue, Utf8String _greeting) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(_greeting));
return deployAsync(Greeter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor, initialValue);
return deployAsync(Greeter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor, initialEtherValue);
}

public static Greeter load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
Expand Down
Loading

0 comments on commit 014036e

Please sign in to comment.