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


Java WrappedRequest類代碼示例

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


WrappedRequest類屬於de.petendi.ethereum.android.service.model包,在下文中一共展示了WrappedRequest類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: sendAsync

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入依賴的package包/類
public int sendAsync(WrappedRequest request) {

        if (callback == null) {
            throw new IllegalStateException("no callback set");
        }

        try {
            Intent intent = new Intent(EthereumAndroidFactory.SERVICE_ACTION);
            intent.setPackage(EthereumAndroidFactory.PACKAGENAME);
            int id = messageId.incrementAndGet();
            intent.putExtra(ID, id);
            intent.putExtra(EXTRA_DATA, objectMapper.writeValueAsString(request));
            intent.putExtra(EXTRA_PACKAGE, packageName);
            context.startService(intent);
            return id;
        } catch (JsonProcessingException e) {
            throw new IllegalStateException(e);
        }
    }
 
開發者ID:p-acs,項目名稱:ethereum-android-lib,代碼行數:20,代碼來源:EthereumAndroid.java

示例4: 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

示例5: 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

示例6: send

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入依賴的package包/類
public WrappedResponse send(WrappedRequest request) {
    if (!hasServiceConnection()) {
        throw new IllegalStateException("not (yet) connected to service");
    }
    try {
        String response = binder.dispatch(objectMapper.writeValueAsString(request));
        return objectMapper.readValue(response, WrappedResponse.class);
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
 
開發者ID:p-acs,項目名稱:ethereum-android-lib,代碼行數:12,代碼來源:EthereumAndroid.java

示例7: 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

示例8: 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

示例9: 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

示例10: MyAsyncTask

import de.petendi.ethereum.android.service.model.WrappedRequest; //導入依賴的package包/類
private MyAsyncTask(WrappedRequest request) {
    this.request = request;
}
 
開發者ID:zhirunn,項目名稱:CompassDemo,代碼行數:4,代碼來源:AccountBalanceActivity.java


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