|
| 1 | +package com.baeldung.web3j.contracts; |
| 2 | + |
| 3 | +import java.math.BigInteger; |
| 4 | +import java.util.Arrays; |
| 5 | +import java.util.Collections; |
| 6 | +import org.web3j.abi.FunctionEncoder; |
| 7 | +import org.web3j.abi.TypeReference; |
| 8 | +import org.web3j.abi.datatypes.Function; |
| 9 | +import org.web3j.abi.datatypes.Type; |
| 10 | +import org.web3j.abi.datatypes.Utf8String; |
| 11 | +import org.web3j.crypto.Credentials; |
| 12 | +import org.web3j.protocol.Web3j; |
| 13 | +import org.web3j.protocol.core.RemoteCall; |
| 14 | +import org.web3j.protocol.core.methods.response.TransactionReceipt; |
| 15 | +import org.web3j.tx.Contract; |
| 16 | +import org.web3j.tx.TransactionManager; |
| 17 | + |
| 18 | +/** |
| 19 | + * <p>Auto generated code. |
| 20 | + * <p><strong>Do not modify!</strong> |
| 21 | + * <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>, |
| 22 | + * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the |
| 23 | + * <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update. |
| 24 | + * |
| 25 | + * <p>Generated with web3j version 3.3.1. |
| 26 | + */ |
| 27 | +public class Greeting extends Contract { |
| 28 | + private static final String BINARY = "6060604052341561000f57600080fd5b6040516103cc3803806103cc833981016040528080519091019050600181805161003d92916020019061005f565b505060008054600160a060020a03191633600160a060020a03161790556100fa565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a057805160ff19168380011785556100cd565b828001600101855582156100cd579182015b828111156100cd5782518255916020019190600101906100b2565b506100d99291506100dd565b5090565b6100f791905b808211156100d957600081556001016100e3565b90565b6102c3806101096000396000f30060606040526004361061004b5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663a41368628114610050578063cfae3217146100a3575b600080fd5b341561005b57600080fd5b6100a160046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061012d95505050505050565b005b34156100ae57600080fd5b6100b6610144565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156100f25780820151838201526020016100da565b50505050905090810190601f16801561011f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60018180516101409291602001906101ed565b5050565b61014c61026b565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061022e57805160ff191683800117855561025b565b8280016001018555821561025b579182015b8281111561025b578251825591602001919060010190610240565b5061026792915061027d565b5090565b60206040519081016040526000815290565b6101ea91905b8082111561026757600081556001016102835600a165627a7a723058206cfb726ed213c2fe842a4c886c8089e918b6de9c6cdfb372fa459eca4840c5740029"; |
| 29 | + |
| 30 | + protected Greeting(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { |
| 31 | + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); |
| 32 | + } |
| 33 | + |
| 34 | + protected Greeting(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { |
| 35 | + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); |
| 36 | + } |
| 37 | + |
| 38 | + public RemoteCall<TransactionReceipt> setGreeting(String _message) { |
| 39 | + final Function function = new Function( |
| 40 | + "setGreeting", |
| 41 | + Arrays.<Type>asList(new org.web3j.abi.datatypes.Utf8String(_message)), |
| 42 | + Collections.<TypeReference<?>>emptyList()); |
| 43 | + return executeRemoteCallTransaction(function); |
| 44 | + } |
| 45 | + |
| 46 | + public RemoteCall<String> greet() { |
| 47 | + final Function function = new Function("greet", |
| 48 | + Arrays.<Type>asList(), |
| 49 | + Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {})); |
| 50 | + return executeRemoteCallSingleValueReturn(function, String.class); |
| 51 | + } |
| 52 | + |
| 53 | + public static RemoteCall<Greeting> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String _message) { |
| 54 | + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Utf8String(_message))); |
| 55 | + return deployRemoteCall(Greeting.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); |
| 56 | + } |
| 57 | + |
| 58 | + public static RemoteCall<Greeting> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String _message) { |
| 59 | + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.web3j.abi.datatypes.Utf8String(_message))); |
| 60 | + return deployRemoteCall(Greeting.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); |
| 61 | + } |
| 62 | + |
| 63 | + public static Greeting load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { |
| 64 | + return new Greeting(contractAddress, web3j, credentials, gasPrice, gasLimit); |
| 65 | + } |
| 66 | + |
| 67 | + public static Greeting load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { |
| 68 | + return new Greeting(contractAddress, web3j, transactionManager, gasPrice, gasLimit); |
| 69 | + } |
| 70 | +} |
| 71 | + |
0 commit comments