use of org.fisco.bcos.web3j.abi.datatypes.Type in project web3sdk by FISCO-BCOS.
the class ContractLifeCyclePrecompiled method getUnfreezeInput.
public Tuple1<String> getUnfreezeInput(TransactionReceipt transactionReceipt) {
String data = transactionReceipt.getInput().substring(10);
final Function function = new Function(FUNC_UNFREEZE, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {
}));
List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
;
return new Tuple1<String>((String) results.get(0).getValue());
}
use of org.fisco.bcos.web3j.abi.datatypes.Type in project web3sdk by FISCO-BCOS.
the class Permission method getGrantWriteOutput.
public Tuple1<BigInteger> getGrantWriteOutput(TransactionReceipt transactionReceipt) {
String data = transactionReceipt.getOutput();
final Function function = new Function(FUNC_GRANTWRITE, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {
}));
List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
;
return new Tuple1<BigInteger>((BigInteger) results.get(0).getValue());
}
use of org.fisco.bcos.web3j.abi.datatypes.Type in project web3sdk by FISCO-BCOS.
the class Permission method getRevokeWriteOutput.
public Tuple1<BigInteger> getRevokeWriteOutput(TransactionReceipt transactionReceipt) {
String data = transactionReceipt.getOutput();
final Function function = new Function(FUNC_REVOKEWRITE, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {
}));
List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
;
return new Tuple1<BigInteger>((BigInteger) results.get(0).getValue());
}
use of org.fisco.bcos.web3j.abi.datatypes.Type in project web3sdk by FISCO-BCOS.
the class CallContractTest method testAsyncCallContract.
private static void testAsyncCallContract(CallContract callContract, String address) {
TransactionCallback callback = new TransactionCallback();
TransactionReceipt receipt;
callContract.asyncSendTransaction(callback, gasPrice, gasLimit, address, "setAndget", new Utf8String("hello world"), new Int256(10086));
try {
callback.semaphore.acquire(1);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
System.out.println(e.getLocalizedMessage());
}
receipt = callback.receipt;
List<TypeReference<?>> referencesList = Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Int256>() {
});
List<Type> returnList1 = FunctionReturnDecoder.decode(receipt.getOutput(), Utils.convert(referencesList));
System.out.println("async call setAndget: " + (String) returnList1.get(0).getValue() + ", " + (BigInteger) returnList1.get(1).getValue());
callContract.asyncSendTransaction(callback, address, "setAndget", new Utf8String("hello world"), new Int256(10086));
try {
callback.semaphore.acquire(1);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
System.out.println(e.getLocalizedMessage());
}
receipt = callback.receipt;
referencesList = Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Int256>() {
});
List<Type> returnList2 = FunctionReturnDecoder.decode(receipt.getOutput(), Utils.convert(referencesList));
System.out.println("default async call setAndget: " + (String) returnList2.get(0).getValue() + ", " + (BigInteger) returnList2.get(1).getValue());
}
Aggregations