diff --git a/src/integration-test/java/org/web3j/generated/Arrays.java b/src/integration-test/java/org/web3j/generated/Arrays.java index b03bdbc66..a69da7ef6 100644 --- a/src/integration-test/java/org/web3j/generated/Arrays.java +++ b/src/integration-test/java/org/web3j/generated/Arrays.java @@ -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; @@ -21,17 +20,17 @@ * Do not modify!
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update. * - *

Generated with web3j version 2.0.1. + *

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 fixedReverse(StaticArray input) { @@ -44,12 +43,12 @@ public Future dynamicReverse(DynamicArray input) { return executeTransactionAsync(function); } - public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) { - return deployAsync(Arrays.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialValue); + public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) { + return deployAsync(Arrays.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialEtherValue); } - public static Future deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) { - return deployAsync(Arrays.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialValue); + public static Future 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) { diff --git a/src/integration-test/java/org/web3j/generated/Fibonacci.java b/src/integration-test/java/org/web3j/generated/Fibonacci.java index 87cac991a..3cbccd623 100644 --- a/src/integration-test/java/org/web3j/generated/Fibonacci.java +++ b/src/integration-test/java/org/web3j/generated/Fibonacci.java @@ -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; @@ -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; @@ -31,17 +29,17 @@ * Do not modify!
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update. * - *

Generated with web3j version 2.0.1. + *

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 getNotifyEvents(TransactionReceipt transactionReceipt) { @@ -52,26 +50,26 @@ public List getNotifyEvents(TransactionReceipt transactionR ArrayList responses = new ArrayList(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 notifyEventObservable() { + public Observable notifyEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { final Event event = new Event("Notify", Arrays.>asList(), Arrays.>asList(new TypeReference() {}, new TypeReference() {})); - 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() { @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; } }); @@ -89,12 +87,12 @@ public Future fibonacci(Uint256 number) { return executeCallSingleValueReturnAsync(function); } - public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) { - return deployAsync(Fibonacci.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialValue); + public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) { + return deployAsync(Fibonacci.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialEtherValue); } - public static Future deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) { - return deployAsync(Fibonacci.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialValue); + public static Future 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) { diff --git a/src/integration-test/java/org/web3j/generated/Greeter.java b/src/integration-test/java/org/web3j/generated/Greeter.java index 4116b6b5e..e13572484 100644 --- a/src/integration-test/java/org/web3j/generated/Greeter.java +++ b/src/integration-test/java/org/web3j/generated/Greeter.java @@ -1,6 +1,5 @@ package org.web3j.generated; -import java.lang.String; import java.math.BigInteger; import java.util.Arrays; import java.util.Collections; @@ -21,17 +20,17 @@ * Do not modify!
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update. * - *

Generated with web3j version 2.0.1. + *

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 kill() { @@ -46,14 +45,14 @@ public Future greet() { return executeCallSingleValueReturnAsync(function); } - public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue, Utf8String _greeting) { + public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue, Utf8String _greeting) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.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 deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue, Utf8String _greeting) { + public static Future deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue, Utf8String _greeting) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.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) { diff --git a/src/integration-test/java/org/web3j/generated/HumanStandardToken.java b/src/integration-test/java/org/web3j/generated/HumanStandardToken.java index c49ae4507..a69b9736c 100644 --- a/src/integration-test/java/org/web3j/generated/HumanStandardToken.java +++ b/src/integration-test/java/org/web3j/generated/HumanStandardToken.java @@ -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; @@ -22,7 +20,7 @@ import org.web3j.abi.datatypes.generated.Uint8; 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; @@ -36,17 +34,17 @@ * Do not modify!
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update. * - *

Generated with web3j version 2.0.1. + *

Generated with web3j version 2.2.0. */ public final class HumanStandardToken extends Contract { private static final String BINARY = "60a0604052600460608190527f48302e3100000000000000000000000000000000000000000000000000000000608090815261003e91600691906100d7565b50341561004757fe5b604051610b8f380380610b8f833981016040908152815160208301519183015160608401519193928301929091015b600160a060020a033316600090815260016020908152604082208690559085905583516100a991600391908601906100d7565b506004805460ff191660ff841617905580516100cc9060059060208401906100d7565b505b50505050610177565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061011857805160ff1916838001178555610145565b82800160010185558215610145579182015b8281111561014557825182559160200191906001019061012a565b5b50610152929150610156565b5090565b61017491905b80821115610152576000815560010161015c565b5090565b90565b610a09806101866000396000f300606060405236156100935763ffffffff60e060020a60003504166306fdde0381146100a9578063095ea7b31461013957806318160ddd1461016c57806323b872dd1461018e578063313ce567146101c757806354fd4d50146101ed57806370a082311461027d57806395d89b41146102ab578063a9059cbb1461033b578063cae9ca511461036e578063dd62ed3e146103e5575b341561009b57fe5b6100a75b60006000fd5b565b005b34156100b157fe5b6100b9610419565b6040805160208082528351818301528351919283929083019185019080838382156100ff575b8051825260208311156100ff57601f1990920191602091820191016100df565b505050905090810190601f16801561012b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014157fe5b610158600160a060020a03600435166024356104a7565b604080519115158252519081900360200190f35b341561017457fe5b61017c610512565b60408051918252519081900360200190f35b341561019657fe5b610158600160a060020a0360043581169060243516604435610518565b604080519115158252519081900360200190f35b34156101cf57fe5b6101d761060e565b6040805160ff9092168252519081900360200190f35b34156101f557fe5b6100b9610617565b6040805160208082528351818301528351919283929083019185019080838382156100ff575b8051825260208311156100ff57601f1990920191602091820191016100df565b505050905090810190601f16801561012b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561028557fe5b61017c600160a060020a03600435166106a5565b60408051918252519081900360200190f35b34156102b357fe5b6100b96106c4565b6040805160208082528351818301528351919283929083019185019080838382156100ff575b8051825260208311156100ff57601f1990920191602091820191016100df565b505050905090810190601f16801561012b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034357fe5b610158600160a060020a0360043516602435610752565b604080519115158252519081900360200190f35b341561037657fe5b604080516020600460443581810135601f8101849004840285018401909552848452610158948235600160a060020a03169460248035956064949293919092019181908401838280828437509496506107fe95505050505050565b604080519115158252519081900360200190f35b34156103ed57fe5b61017c600160a060020a03600435811690602435166109b0565b60408051918252519081900360200190f35b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561049f5780601f106104745761010080835404028352916020019161049f565b820191906000526020600020905b81548152906001019060200180831161048257829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60005481565b600160a060020a0383166000908152600160205260408120548290108015906105685750600160a060020a0380851660009081526002602090815260408083203390941683529290522054829010155b80156105745750600082115b1561060257600160a060020a03808416600081815260016020908152604080832080548801905588851680845281842080548990039055600283528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610606565b5060005b5b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561049f5780601f106104745761010080835404028352916020019161049f565b820191906000526020600020905b81548152906001019060200180831161048257829003601f168201915b505050505081565b600160a060020a0381166000908152600160205260409020545b919050565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561049f5780601f106104745761010080835404028352916020019161049f565b820191906000526020600020905b81548152906001019060200180831161048257829003601f168201915b505050505081565b600160a060020a03331660009081526001602052604081205482901080159061077b5750600082115b156107ef57600160a060020a03338116600081815260016020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350600161050c565b50600061050c565b5b92915050565b600160a060020a03338116600081815260026020908152604080832094881680845294825280832087905580518781529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360008314610950575b80518252602083111561095057601f199092019160209182019101610930565b505050905090810190601f16801561097c5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000876161da5a03f19250505015156109a55760006000fd5b5060015b9392505050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b929150505600a165627a7a723058201db20700bbf339c090ff66a3bf5b648a5b8a928c5d2b6bb42da35d08c415a83a0029"; private HumanStandardToken(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(contractAddress, web3j, credentials, gasPrice, gasLimit); + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); } private HumanStandardToken(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 getTransferEvents(TransactionReceipt transactionReceipt) { @@ -57,28 +55,28 @@ public List getTransferEvents(TransactionReceipt transact ArrayList responses = new ArrayList(valueList.size()); for(EventValues eventValues : valueList) { TransferEventResponse typedResponse = new TransferEventResponse(); - typedResponse._from = (Address)eventValues.getIndexedValues().get(0); - typedResponse._to = (Address)eventValues.getIndexedValues().get(1); - typedResponse._value = (Uint256)eventValues.getNonIndexedValues().get(0); + typedResponse._from = (Address) eventValues.getIndexedValues().get(0); + typedResponse._to = (Address) eventValues.getIndexedValues().get(1); + typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0); responses.add(typedResponse); } return responses; } - public Observable transferEventObservable() { + public Observable transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { final Event event = new Event("Transfer", Arrays.>asList(new TypeReference

() {}, new TypeReference
() {}), Arrays.>asList(new TypeReference() {})); - 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() { @Override public TransferEventResponse call(Log log) { EventValues eventValues = extractEventParameters(event, log); TransferEventResponse typedResponse = new TransferEventResponse(); - typedResponse._from = (Address)eventValues.getIndexedValues().get(0); - typedResponse._to = (Address)eventValues.getIndexedValues().get(1); - typedResponse._value = (Uint256)eventValues.getNonIndexedValues().get(0); + typedResponse._from = (Address) eventValues.getIndexedValues().get(0); + typedResponse._to = (Address) eventValues.getIndexedValues().get(1); + typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0); return typedResponse; } }); @@ -92,28 +90,28 @@ public List getApprovalEvents(TransactionReceipt transact ArrayList responses = new ArrayList(valueList.size()); for(EventValues eventValues : valueList) { ApprovalEventResponse typedResponse = new ApprovalEventResponse(); - typedResponse._owner = (Address)eventValues.getIndexedValues().get(0); - typedResponse._spender = (Address)eventValues.getIndexedValues().get(1); - typedResponse._value = (Uint256)eventValues.getNonIndexedValues().get(0); + typedResponse._owner = (Address) eventValues.getIndexedValues().get(0); + typedResponse._spender = (Address) eventValues.getIndexedValues().get(1); + typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0); responses.add(typedResponse); } return responses; } - public Observable approvalEventObservable() { + public Observable approvalEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { final Event event = new Event("Approval", Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}), Arrays.>asList(new TypeReference() {})); - 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() { @Override public ApprovalEventResponse call(Log log) { EventValues eventValues = extractEventParameters(event, log); ApprovalEventResponse typedResponse = new ApprovalEventResponse(); - typedResponse._owner = (Address)eventValues.getIndexedValues().get(0); - typedResponse._spender = (Address)eventValues.getIndexedValues().get(1); - typedResponse._value = (Uint256)eventValues.getNonIndexedValues().get(0); + typedResponse._owner = (Address) eventValues.getIndexedValues().get(0); + typedResponse._spender = (Address) eventValues.getIndexedValues().get(1); + typedResponse._value = (Uint256) eventValues.getNonIndexedValues().get(0); return typedResponse; } }); @@ -188,14 +186,14 @@ public Future allowance(Address _owner, Address _spender) { return executeCallSingleValueReturnAsync(function); } - public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue, Uint256 _initialAmount, Utf8String _tokenName, Uint8 _decimalUnits, Utf8String _tokenSymbol) { + public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue, Uint256 _initialAmount, Utf8String _tokenName, Uint8 _decimalUnits, Utf8String _tokenSymbol) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol)); - return deployAsync(HumanStandardToken.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor, initialValue); + return deployAsync(HumanStandardToken.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor, initialEtherValue); } - public static Future deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue, Uint256 _initialAmount, Utf8String _tokenName, Uint8 _decimalUnits, Utf8String _tokenSymbol) { + public static Future deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue, Uint256 _initialAmount, Utf8String _tokenName, Uint8 _decimalUnits, Utf8String _tokenSymbol) { String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol)); - return deployAsync(HumanStandardToken.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor, initialValue); + return deployAsync(HumanStandardToken.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor, initialEtherValue); } public static HumanStandardToken load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { diff --git a/src/integration-test/java/org/web3j/generated/ShipIt.java b/src/integration-test/java/org/web3j/generated/ShipIt.java index 15da51e9a..1fba51536 100644 --- a/src/integration-test/java/org/web3j/generated/ShipIt.java +++ b/src/integration-test/java/org/web3j/generated/ShipIt.java @@ -1,6 +1,5 @@ package org.web3j.generated; -import java.lang.String; import java.math.BigInteger; import java.util.Arrays; import java.util.List; @@ -23,17 +22,17 @@ * Do not modify!
* Please use {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update. * - *

Generated with web3j version 2.0.1. + *

Generated with web3j version 2.2.0. */ public final class ShipIt extends Contract { private static final String BINARY = "6060604052341561000c57fe5b5b6101968061001c6000396000f300606060405263ffffffff60e060020a600035041663d51cd4ac8114610021575bfe5b341561002957fe5b61003d600160a060020a0360043516610118565b60408051600160a060020a03808b16825289166020820152908101879052606081018690526080810185600081111561007257fe5b60ff168152602081018590526060810183905260808282038101604083019081528554600260001960018316156101000201909116049183018290529160a00190859080156101025780601f106100d757610100808354040283529160200191610102565b820191906000526020600020905b8154815290600101906020018083116100e557829003601f168201915b5050995050505050505050505060405180910390f35b60006020819052908152604090208054600182015460028301546003840154600485015460058601546007870154600160a060020a039687169796909516959394929360ff90921692909160060190885600a165627a7a723058201e285ed5a311302c7e3870a6bebc9464c5677d294265aeb7d1aa6b37b9c5a7dc0029"; private ShipIt(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(contractAddress, web3j, credentials, gasPrice, gasLimit); + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); } private ShipIt(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> shipments(Address param0) { @@ -43,12 +42,12 @@ public Future> shipments(Address param0) { return executeCallMultipleValueReturnAsync(function); } - public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) { - return deployAsync(ShipIt.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialValue); + public static Future deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) { + return deployAsync(ShipIt.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialEtherValue); } - public static Future deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialValue) { - return deployAsync(ShipIt.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialValue); + public static Future deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialEtherValue) { + return deployAsync(ShipIt.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialEtherValue); } public static ShipIt load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { diff --git a/src/main/java/org/web3j/codegen/AbiTypesGenerator.java b/src/main/java/org/web3j/codegen/AbiTypesGenerator.java index d128c03b7..de4914842 100644 --- a/src/main/java/org/web3j/codegen/AbiTypesGenerator.java +++ b/src/main/java/org/web3j/codegen/AbiTypesGenerator.java @@ -174,6 +174,7 @@ private void generateBytesTypes( private void write(String packageName, TypeSpec typeSpec, Path destination) throws IOException { JavaFile javaFile = JavaFile.builder(packageName, typeSpec) + .indent(" ") .skipJavaLangImports(true) .build(); diff --git a/src/main/java/org/web3j/codegen/AbiTypesMapperGenerator.java b/src/main/java/org/web3j/codegen/AbiTypesMapperGenerator.java index 0ba5f7b92..764988585 100644 --- a/src/main/java/org/web3j/codegen/AbiTypesMapperGenerator.java +++ b/src/main/java/org/web3j/codegen/AbiTypesMapperGenerator.java @@ -84,6 +84,7 @@ private void generate(String destinationDir) throws IOException { private void write(String packageName, TypeSpec typeSpec, Path destination) throws IOException { JavaFile javaFile = JavaFile.builder(packageName, typeSpec) + .indent(" ") .skipJavaLangImports(true) .build(); diff --git a/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java b/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java index 43dd1f182..99044e7b5 100644 --- a/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java +++ b/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java @@ -25,7 +25,7 @@ import org.web3j.crypto.Credentials; import org.web3j.protocol.ObjectMapperFactory; 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.AbiDefinition; import org.web3j.protocol.core.methods.response.Log; @@ -50,7 +50,7 @@ import rx.functions.Func1; /** - * Generate Java Classes based on generated Solidity BIN and ABI. + * Generate Java Classes based on generated Solidity bin and abi files. */ public class SolidityFunctionWrapper { @@ -62,6 +62,8 @@ public class SolidityFunctionWrapper { private static final String CONTRACT_ADDRESS = "contractAddress"; private static final String GAS_PRICE = "gasPrice"; private static final String GAS_LIMIT = "gasLimit"; + private static final String START_BLOCK = "startBlock"; + private static final String END_BLOCK = "endBlock"; private static final String CODEGEN_WARNING = "

Auto generated code.
\n" + "Do not modify!
\n" + @@ -82,6 +84,8 @@ public void generateJavaFiles( classBuilder.addMethod(buildLoad(className, TransactionManager.class, TRANSACTION_MANAGER)); JavaFile javaFile = JavaFile.builder(basePackageName, classBuilder.build()) + .indent(" ") + .skipJavaLangImports(true) .build(); javaFile.writeTo(new File(destinationDirLocation)); @@ -391,13 +395,13 @@ static MethodSpec buildEventObservableFunction(String responseClassName, MethodSpec.Builder observableMethodBuilder = MethodSpec.methodBuilder(generatedFunctionName) .addModifiers(Modifier.PUBLIC) + .addParameter(DefaultBlockParameter.class, START_BLOCK) + .addParameter(DefaultBlockParameter.class, END_BLOCK) .returns(parameterizedTypeName); - buildVariableLengthEventConstructor( observableMethodBuilder, functionName, indexedParameters, nonIndexedParameters); - TypeSpec converter = TypeSpec.anonymousClassBuilder("") .addSuperinterface(ParameterizedTypeName.get( ClassName.get(Func1.class), @@ -418,8 +422,8 @@ static MethodSpec buildEventObservableFunction(String responseClassName, .build()) .build(); - observableMethodBuilder.addStatement("$1T filter = new $1T($2T.EARLIEST,$2T.LATEST, " + - "getContractAddress())", EthFilter.class, DefaultBlockParameterName.class) + observableMethodBuilder.addStatement("$1T filter = new $1T($2L, $3L, " + + "getContractAddress())", EthFilter.class, START_BLOCK, END_BLOCK) .addStatement("filter.addSingleTopic($T.encode(event))", EventEncoder.class) .addStatement("return web3j.ethLogObservable(filter).map($L)", converter); @@ -498,7 +502,7 @@ static CodeBlock buildTypedResponse(String objectName, List nonIndexedParameters) { CodeBlock.Builder builder = CodeBlock.builder(); for (int i = 0; i < indexedParameters.size(); i++) { - builder.addStatement("$L.$L = ($T)eventValues.getIndexedValues().get($L)", + builder.addStatement("$L.$L = ($T) eventValues.getIndexedValues().get($L)", objectName, indexedParameters.get(i).getName(), indexedParameters.get(i).getTypeName(), @@ -506,7 +510,7 @@ static CodeBlock buildTypedResponse(String objectName, } for (int i = 0; i < nonIndexedParameters.size(); i++) { - builder.addStatement("$L.$L = ($T)eventValues.getNonIndexedValues().get($L)", + builder.addStatement("$L.$L = ($T) eventValues.getNonIndexedValues().get($L)", objectName, nonIndexedParameters.get(i).getName(), nonIndexedParameters.get(i).getTypeName(), diff --git a/src/test/java/org/web3j/codegen/SolidityFunctionWrapperTest.java b/src/test/java/org/web3j/codegen/SolidityFunctionWrapperTest.java index 626756cb9..05b1028a9 100644 --- a/src/test/java/org/web3j/codegen/SolidityFunctionWrapperTest.java +++ b/src/test/java/org/web3j/codegen/SolidityFunctionWrapperTest.java @@ -198,18 +198,20 @@ public void testBuildEventConstantMultipleValueReturn() throws Exception { ".ArrayList(valueList.size());\n" + " for(org.web3j.abi.EventValues eventValues : valueList) {\n" + " TransferEventResponse typedResponse = new TransferEventResponse();\n" + - " typedResponse.from = (org.web3j.abi.datatypes.Address)eventValues" + + " typedResponse.from = (org.web3j.abi.datatypes.Address) eventValues" + ".getIndexedValues().get(0);\n" + - " typedResponse.to = (org.web3j.abi.datatypes.Address)eventValues" + + " typedResponse.to = (org.web3j.abi.datatypes.Address) eventValues" + ".getIndexedValues().get(1);\n" + - " typedResponse.value = (org.web3j.abi.datatypes.generated.Uint256)" + + " typedResponse.value = (org.web3j.abi.datatypes.generated.Uint256) " + "eventValues.getNonIndexedValues().get(0);\n" + " responses.add(typedResponse);\n" + " }\n" + " return responses;\n" + " }\n" + "\n" + - " public rx.Observable transferEventObservable() {\n" + + " public rx.Observable transferEventObservable(" + + "org.web3j.protocol.core.DefaultBlockParameter startBlock, " + + "org.web3j.protocol.core.DefaultBlockParameter endBlock) {\n" + " final org.web3j.abi.datatypes.Event event = new org.web3j.abi.datatypes.Event" + "(\"Transfer\", \n" + " java.util.Arrays.>asList(new org.web3j" + @@ -218,9 +220,8 @@ public void testBuildEventConstantMultipleValueReturn() throws Exception { " java.util.Arrays.>asList(new org.web3j" + ".abi.TypeReference() {}));\n" + " org.web3j.protocol.core.methods.request.EthFilter filter = new org.web3j" + - ".protocol.core.methods.request.EthFilter(org.web3j.protocol.core" + - ".DefaultBlockParameterName.EARLIEST,org.web3j.protocol.core" + - ".DefaultBlockParameterName.LATEST, getContractAddress());\n" + + ".protocol.core.methods.request.EthFilter(startBlock, endBlock, " + + "getContractAddress());\n" + " filter.addSingleTopic(org.web3j.abi.EventEncoder.encode(event));\n" + " return web3j.ethLogObservable(filter).map(new rx.functions.Func1() {\n" + @@ -230,12 +231,12 @@ public void testBuildEventConstantMultipleValueReturn() throws Exception { " org.web3j.abi.EventValues eventValues = extractEventParameters(event, " + "log);\n" + " TransferEventResponse typedResponse = new TransferEventResponse();\n" + - " typedResponse.from = (org.web3j.abi.datatypes.Address)eventValues" + + " typedResponse.from = (org.web3j.abi.datatypes.Address) eventValues" + ".getIndexedValues().get(0);\n" + - " typedResponse.to = (org.web3j.abi.datatypes.Address)eventValues" + + " typedResponse.to = (org.web3j.abi.datatypes.Address) eventValues" + ".getIndexedValues().get(1);\n" + " typedResponse.value = (org.web3j.abi.datatypes.generated.Uint256)" + - "eventValues.getNonIndexedValues().get(0);\n" + + " eventValues.getNonIndexedValues().get(0);\n" + " return typedResponse;\n" + " }\n" + " });\n" +