Skip to content

Instantly share code, notes, and snippets.

@ageyev
Created July 19, 2017 09:51
Show Gist options
  • Save ageyev/2124dff71c4f1ae2160c0e46eb0b4d6d to your computer and use it in GitHub Desktop.
Save ageyev/2124dff71c4f1ae2160c0e46eb0b4d6d to your computer and use it in GitHub Desktop.
package net.cryptonomica.web3j;
import org.web3j.abi.FunctionEncoder;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Function;
import org.web3j.abi.datatypes.Type;
import org.web3j.abi.datatypes.Utf8String;
import org.web3j.abi.datatypes.generated.Uint256;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.protocol.exceptions.TransactionTimeoutException;
import org.web3j.tx.Contract;
import java.io.IOException;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.Future;
/**
*
*/
public class SmartContractWrapperManually extends Contract {
public Future<TransactionReceipt> uploadSignedString(Uint256 verificationId,
Utf8String signedString) {
Function function = new Function(
"uploadSignedString",
Arrays.<Type>asList(
verificationId,
signedString
),
Collections.<TypeReference<?>>emptyList());
return executeTransactionAsync(function);
}
public TransactionReceipt uploadSignedStringPayable(Uint256 verificationId,
Utf8String signedString,
BigInteger weiValue)
throws InterruptedException, TransactionTimeoutException, IOException {
Function function = new Function(
"uploadSignedString",
Arrays.<Type>asList(
verificationId,
signedString
),
Collections.<TypeReference<?>>emptyList());
return executeTransaction(FunctionEncoder.encode(function), weiValue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment