當前位置: 首頁>>代碼示例>>Java>>正文


Java WrappedRequest.setCommand方法代碼示例

本文整理匯總了Java中de.petendi.ethereum.android.service.model.WrappedRequest.setCommand方法的典型用法代碼示例。如果您正苦於以下問題:Java WrappedRequest.setCommand方法的具體用法?Java WrappedRequest.setCommand怎麽用?Java WrappedRequest.setCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在de.petendi.ethereum.android.service.model.WrappedRequest的用法示例。


在下文中一共展示了WrappedRequest.setCommand方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: request

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入方法依賴的package包/類
private void request() {

        accountInput.setError(null);
        String accountAddress = accountInput.getText().toString();
        boolean cancel = false;
        View focusView = null;
        if (TextUtils.isEmpty(accountAddress)) {
            accountInput.setError(getString(R.string.error_field_required));
            focusView = accountInput;
            cancel = true;
        }
        if (cancel) {
            focusView.requestFocus();
        } else {
            showProgress(true);
            WrappedRequest wrappedRequest = new WrappedRequest();
            wrappedRequest.setCommand(RpcCommand.eth_getBalance.toString());
            wrappedRequest.setParameters(new String[]{accountAddress, "latest"});
            ethereumAndroid.sendAsync(wrappedRequest);
        }
    }
 
開發者ID:zhirunn,項目名稱:CompassDemo,代碼行數:22,代碼來源:AccountBalanceActivity.java

示例2: requestSync

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入方法依賴的package包/類
private void requestSync() {

        accountInput.setError(null);
        String accountAddress = accountInput.getText().toString();
        boolean cancel = false;
        View focusView = null;
        if (TextUtils.isEmpty(accountAddress)) {
            accountInput.setError(getString(R.string.error_field_required));
            focusView = accountInput;
            cancel = true;
        }
        if (cancel) {
            focusView.requestFocus();
        } else {
            showProgress(true);
            WrappedRequest wrappedRequest = new WrappedRequest();
            wrappedRequest.setCommand(RpcCommand.eth_getBalance.toString());
            wrappedRequest.setParameters(new String[]{accountAddress, "latest"});
            new MyAsyncTask(wrappedRequest).execute();
        }
    }
 
開發者ID:zhirunn,項目名稱:CompassDemo,代碼行數:22,代碼來源:AccountBalanceActivity.java

示例3: encode

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入方法依賴的package包/類
public String encode(String abi, String functionName, Object... args) {
    WrappedRequest wrappedRequest = new WrappedRequest();
    wrappedRequest.setCommand(ContractCommand.contract_encode.toString());
    Object[] parameters;
    if (args == null) {
        parameters = new Object[2];
    } else {
        parameters = new Object[2 + args.length];
    }
    parameters[0] = abi;
    parameters[1] = functionName;
    if (args != null) {
        System.arraycopy(args, 0, parameters, 2, args.length);
    }
    wrappedRequest.setParameters(parameters);
    WrappedResponse response = ethereumAndroid.send(wrappedRequest);
    if (response.isSuccess()) {
        return (String) response.getResponse();
    } else {
        throw new ResponseNotOKException(response.getErrorMessage());
    }
}
 
開發者ID:p-acs,項目名稱:ethereum-android-lib,代碼行數:23,代碼來源:ContractController.java

示例4: generateContractCreation

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入方法依賴的package包/類
public String generateContractCreation(String contractBytecode, String contractAbi, Object... constructorParams) {
    WrappedRequest wrappedRequest = new WrappedRequest();
    wrappedRequest.setCommand(ContractCommand.contract_creation.toString());
    Object[] parameters;
    if (constructorParams == null) {
        parameters = new Object[2];
    } else {
        parameters = new Object[2 + constructorParams.length];
    }
    parameters[0] = contractBytecode;
    parameters[1] = contractAbi;
    if (constructorParams != null) {
        System.arraycopy(constructorParams, 0, parameters, 2, constructorParams.length);
    }
    wrappedRequest.setParameters(parameters);
    WrappedResponse response = ethereumAndroid.send(wrappedRequest);
    if (response.isSuccess()) {
        return (String) response.getResponse();
    } else {
        throw new ResponseNotOKException(response.getErrorMessage());
    }
}
 
開發者ID:p-acs,項目名稱:ethereum-android-lib,代碼行數:23,代碼來源:ContractController.java

示例5: generateContractInteraction

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入方法依賴的package包/類
public String generateContractInteraction(String address, BigInteger value, String encoded) {
    WrappedRequest wrappedRequest = new WrappedRequest();
    wrappedRequest.setCommand(ContractCommand.contract_interaction.toString());
    Object[] parameters = new Object[3];
    parameters[0] = address;
    parameters[1] = value;
    parameters[2] = encoded;
    wrappedRequest.setParameters(parameters);
    WrappedResponse response = ethereumAndroid.send(wrappedRequest);
    if (response.isSuccess()) {
        return (String) response.getResponse();
    } else {
        throw new ResponseNotOKException(response.getErrorMessage());
    }
}
 
開發者ID:p-acs,項目名稱:ethereum-android-lib,代碼行數:16,代碼來源:ContractController.java

示例6: decodeResult

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入方法依賴的package包/類
public Object[] decodeResult(String abi, String functionName, String arg) {
    WrappedRequest wrappedRequest = new WrappedRequest();
    wrappedRequest.setCommand(ContractCommand.contract_decode.toString());
    Object[] parameters = new Object[3];
    parameters[0] = abi;
    parameters[1] = functionName;
    parameters[2] = arg;
    wrappedRequest.setParameters(parameters);
    WrappedResponse response = ethereumAndroid.send(wrappedRequest);
    if (response.isSuccess()) {
        return ((ArrayList) response.getResponse()).toArray();
    } else {
        throw new ResponseNotOKException(response.getErrorMessage());
    }
}
 
開發者ID:p-acs,項目名稱:ethereum-android-lib,代碼行數:16,代碼來源:ContractController.java

示例7: call

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入方法依賴的package包/類
public String call(String address, BigInteger wei, String encoded) {
    WrappedRequest wrappedRequest = new WrappedRequest();
    wrappedRequest.setCommand(ContractCommand.contract_call.toString());
    Object[] parameters = new Object[3];
    parameters[0] = address;
    parameters[1] = wei;
    parameters[2] = encoded;
    wrappedRequest.setParameters(parameters);
    WrappedResponse response = ethereumAndroid.send(wrappedRequest);
    if (response.isSuccess()) {
        return (String) response.getResponse();
    } else {
        throw new ResponseNotOKException(response.getErrorMessage());
    }
}
 
開發者ID:p-acs,項目名稱:ethereum-android-lib,代碼行數:16,代碼來源:ContractController.java


注:本文中的de.petendi.ethereum.android.service.model.WrappedRequest.setCommand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。