private void checkSendRequest(SendRequest request) throws WalletAccountException { if (!(request instanceof NxtSendRequest)) { throw new WalletAccountException("Incompatible request " + request.getClass().getName() + ", expected " + NxtSendRequest.class.getName()); } }
log.info("Could not create transaction: {}", e.getMessage()); error = Error.GENERIC_ERROR;
public void completeTransaction(NxtSendRequest request) throws WalletAccountException { checkArgument(!request.isCompleted(), "Given SendRequest has already been completed."); if (request.type.getTransactionVersion() > 0) { request.nxtTxBuilder.ecBlockHeight(lastEcBlockHeight); request.nxtTxBuilder.ecBlockId(lastEcBlockId); } // TODO check if the destination public key was announced and if so, remove it from the tx: // request.nxtTxBuilder.publicKeyAnnouncement(null); try { request.tx = new NxtTransaction(type, request.nxtTxBuilder.build()); request.setCompleted(true); } catch (NxtException.NotValidException e) { throw new WalletAccount.WalletAccountException(e); } if (request.signTransaction) { signTransaction(request); } }
/** * Given a spend request containing an incomplete transaction, makes it valid by adding outputs and signed inputs * according to the instructions in the request. The transaction in the request is modified by this method. * * @param req a BitSendRequest that contains the incomplete transaction and details for how to make it valid. * @throws WalletAccountException if the request could not be completed due to not enough balance. * @throws IllegalArgumentException if you try and complete the same SendRequest twice */ public void completeTransaction(BitSendRequest req) throws WalletAccountException { lock.lock(); try { transactionCreator.completeTx(req); } catch (InsufficientMoneyException e) { throw new WalletAccountException(e); } finally { lock.unlock(); } }
/** * {@link #sendCoinsOffline(NxtAddress, Value)} */ public NxtSendRequest sendCoinsOffline(NxtAddress address, Value amount, @Nullable KeyParameter aesKey) throws WalletAccountException { NxtSendRequest request; try { request = NxtSendRequest.to(this, address, amount); } catch (Exception e) { throw new WalletAccountException(e); } request.aesKey = aesKey; return request; }
private void checkAddress(AbstractAddress destination) throws WalletAccountException { if (!(destination instanceof BitAddress)) { throw new WalletAccountException("Incompatible address" + destination.getClass().getName() + ", expected " + BitAddress.class.getName()); } }
private void checkSendRequest(SendRequest request) throws WalletAccountException { if (!(request instanceof BitSendRequest)) { throw new WalletAccountException("Incompatible request " + request.getClass().getName() + ", expected " + BitSendRequest.class.getName()); } }
private void checkAddress(AbstractAddress destination) throws WalletAccountException { if (!(destination instanceof NxtAddress)) { throw new WalletAccountException("Incompatible address" + destination.getClass().getName() + ", expected " + NxtAddress.class.getName()); } }