use of run.wallet.iota.api.responses.GetBalanceAndFormatResponse in project run-wallet-android by runplay.
the class GetBalanceAndFormatRequestHandler method handle.
@Override
public ApiResponse handle(ApiRequest request) {
int notificationId = Utils.createNewID();
ApiResponse response;
try {
StopWatch stopWatch = new StopWatch();
// stopWatch.
// Log.e("BALF","Getting balances and format");
response = new GetBalanceAndFormatResponse(apiProxy.getBalanceAndFormat(((GetBalanceAndFormatRequest) request).addresses, 0L, 0, stopWatch, 0));
List<Input> inputs = ((GetBalanceAndFormatResponse) response).getInputs();
} catch (ArgumentException e) {
NetworkError error = new NetworkError();
if (e instanceof ArgumentException) {
if (e.getMessage().contains("Sending to a used address.") || e.getMessage().contains("Private key reuse detect!")) {
final Activity activity = (Activity) context;
Bundle bundle = new Bundle();
bundle.putString("error", e.getMessage());
KeyReuseDetectedDialog dialog = new KeyReuseDetectedDialog();
dialog.setArguments(bundle);
dialog.show(activity.getFragmentManager(), null);
error.setErrorType(NetworkErrorType.KEY_REUSE_ERROR);
}
}
if (error.getErrorType() != NetworkErrorType.KEY_REUSE_ERROR) {
error.setErrorType(NetworkErrorType.NETWORK_ERROR);
}
response = error;
}
return response;
}
Aggregations