org.fisco.bcos.channel.client.TransactionSucCallback Java Examples

The following examples show how to use org.fisco.bcos.channel.client.TransactionSucCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtendedRawTransactionManager.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
@Override
public SendTransaction sendTransaction(
        String signedTransaction, TransactionSucCallback callback)
        throws IOException, TxHashMismatchException {
    Request<?, SendTransaction> request = web3j.sendRawTransaction(signedTransaction);
    request.setNeedTransCallback(true);
    request.setTransactionSucCallback(callback);

    request.sendOnly();

    return null;

    /*
    if (ethSendTransaction != null && !ethSendTransaction.hasError()) {
        String txHashLocal = Hash.sha3(signedTransaction);
        String txHashRemote = ethSendTransaction.getTransactionHash();
        if (!txHashVerifier.verify(txHashLocal, txHashRemote)) {
            throw new TxHashMismatchException(txHashLocal, txHashRemote);
        }
    }

    return ethSendTransaction;
    */
}
 
Example #2
Source File: CRUD.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public void update(
        String tableName,
        String key,
        String entry,
        String condition,
        String optional,
        TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UPDATE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(tableName),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(key),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(entry),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(condition),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(optional)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #3
Source File: RawTransactionManager.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
@Override
public SendTransaction sendTransaction(
        BigInteger gasPrice,
        BigInteger gasLimit,
        String to,
        String data,
        BigInteger value,
        String extraData,
        TransactionSucCallback callback)
        throws IOException {
    Random r = new SecureRandom();
    BigInteger randomid = new BigInteger(250, r);
    BigInteger blockLimit = getBlockLimit();
    RawTransaction rawTransaction =
            RawTransaction.createTransaction(
                    randomid, gasPrice, gasLimit, blockLimit, to, value, data);

    return signAndSend(rawTransaction, callback);
}
 
Example #4
Source File: CRUD.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public void insert(
        String tableName,
        String key,
        String entry,
        String optional,
        TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_INSERT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(tableName),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(key),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(entry),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(optional)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #5
Source File: EvidenceVerify.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public void insertEvidence(
        String evi,
        String info,
        String id,
        String signAddr,
        byte[] message,
        BigInteger v,
        byte[] r,
        byte[] s,
        TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_INSERTEVIDENCE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(evi),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(info),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(id),
                            new org.fisco.bcos.web3j.abi.datatypes.Address(signAddr),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(message),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint8(v),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #6
Source File: Topic.java    From WeEvent with Apache License 2.0 6 votes vote down vote up
public void flushSnapshot(List<String> topicName, List<BigInteger> lastSequence, List<BigInteger> lastBlock,
                          List<BigInteger> lastTimestamp, List<String> lastSender, TransactionSucCallback callback) {
    final Function function = new Function(
            FUNC_FLUSHSNAPSHOT, 
            Arrays.<Type>asList(topicName.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("string[]"):
                    new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.Utf8String>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(topicName, org.fisco.bcos.web3j.abi.datatypes.Utf8String.class)), 
            lastSequence.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastSequence, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class)), 
            lastBlock.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastBlock, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class)), 
            lastTimestamp.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastTimestamp, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class)), 
            lastSender.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("address[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.Address>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastSender, org.fisco.bcos.web3j.abi.datatypes.Address.class))), 
            Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #7
Source File: TestGroupSig.java    From group-signature-client with GNU General Public License v3.0 6 votes vote down vote up
public void update_group_sig_data(
        String new_sig,
        String new_message,
        String new_gpk_info,
        String new_pbc_param_info,
        TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UPDATE_GROUP_SIG_DATA,
                    Arrays.<Type>asList(
                            new Utf8String(new_sig),
                            new Utf8String(new_message),
                            new Utf8String(new_gpk_info),
                            new Utf8String(new_pbc_param_info)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #8
Source File: CRUD.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public void remove(
        String tableName,
        String key,
        String condition,
        String optional,
        TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_REMOVE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(tableName),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(key),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(condition),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(optional)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #9
Source File: TableFactory.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void createTable(
        String tableName, String key, String valueField, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_CREATETABLE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(tableName),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(key),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(valueField)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #10
Source File: TableTest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void update(
        String name, BigInteger item_id, String item_name, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UPDATE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(name),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Int256(item_id),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(item_name)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #11
Source File: MixContract.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void update(
        String name, BigInteger item_id, String item_name, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UPDATE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(name),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Int256(item_id),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(item_name)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #12
Source File: ParallelOk.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void transfer(String from, String to, BigInteger num, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_TRANSFER,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(from),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(to),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(num)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #13
Source File: ParallelOk.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void enableParallel(TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_ENABLEPARALLEL,
                    Arrays.<Type>asList(),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #14
Source File: ParallelOk.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void disableParallel(TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_DISABLEPARALLEL,
                    Arrays.<Type>asList(),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #15
Source File: ParallelOk.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void transferWithRevert(
        String from, String to, BigInteger num, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_TRANSFERWITHREVERT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(from),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(to),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(num)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #16
Source File: MixContract.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void insert(
        String name, BigInteger item_id, String item_name, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_INSERT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(name),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Int256(item_id),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(item_name)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #17
Source File: TableTest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void remove(String name, BigInteger item_id, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_REMOVE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(name),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Int256(item_id)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #18
Source File: Permission.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void revokeWrite(String contractAddr, String user, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_REVOKEWRITE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(contractAddr),
                            new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #19
Source File: Permission.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void grantWrite(String contractAddr, String user, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_GRANTWRITE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(contractAddr),
                            new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #20
Source File: Permission.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void remove(String table_name, String addr, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_REMOVE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(table_name),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(addr)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #21
Source File: Permission.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void insert(String table_name, String addr, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_INSERT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(table_name),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(addr)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #22
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void revokeOperator(String user, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_REVOKEOPERATOR,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #23
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void freezeAccount(String account, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_FREEZEACCOUNT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(account)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #24
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void grantOperator(String user, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_GRANTOPERATOR,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #25
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void revokeCommitteeMember(String user, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_REVOKECOMMITTEEMEMBER,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #26
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void updateThreshold(BigInteger threshold, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UPDATETHRESHOLD,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Int256(threshold)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #27
Source File: TableTest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void create(TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_CREATE,
                    Arrays.<Type>asList(),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #28
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void grantCommitteeMember(String user, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_GRANTCOMMITTEEMEMBER,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #29
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void updateCommitteeMemberWeight(
        String user, BigInteger weight, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UPDATECOMMITTEEMEMBERWEIGHT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(user),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Int256(weight)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #30
Source File: ContractLifeCyclePrecompiled.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void grantManager(
        String contractAddr, String userAddr, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_GRANTMANAGER,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(contractAddr),
                            new org.fisco.bcos.web3j.abi.datatypes.Address(userAddr)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}