@Override public SendRequest getEmptyWalletRequest(AbstractAddress destination) throws WalletAccountException { checkAddress(destination); return BitSendRequest.emptyWallet((BitAddress) destination); }
@Override public SendRequest getSendToRequest(AbstractAddress destination, Value amount) throws WalletAccountException { checkAddress(destination); return BitSendRequest.to((BitAddress) destination, amount); }
public static BitSendRequest emptyWallet(BitAddress destination) { checkNotNull(destination.getType(), "Address is for an unknown network"); checkTypeCompatibility(destination.getType()); BitSendRequest req = new BitSendRequest(destination.getType()); Transaction tx = new Transaction(req.type); tx.addOutput(Coin.ZERO, destination); req.tx = new BitTransaction(tx); req.emptyWallet = true; return req; }
try { checkArgument(req.type.equals(coinType), "Given SendRequest has an invalid coin type."); checkArgument(!req.isCompleted(), "Given SendRequest has already been completed."); Transaction tx = req.tx.getRawTransaction(); req.setCompleted(true); req.fee = calculatedFee; log.info(" completed: {}", req.tx);
/** * <p>Creates a new SendRequest to the given address for the given value.</p> * * <p>Be very careful when value is smaller than {@link Transaction#MIN_NONDUST_OUTPUT} as the transaction will * likely be rejected by the network in this case.</p> */ public static BitSendRequest to(BitAddress destination, Value amount) { checkNotNull(destination.getType(), "Address is for an unknown network"); checkState(TypeUtils.is(destination.getType(), amount.type), "Incompatible sending amount type"); checkTypeCompatibility(destination.getType()); BitSendRequest req = new BitSendRequest(destination.getType()); Transaction tx = new Transaction(req.type); tx.addOutput(amount.toCoin(), destination); req.tx = new BitTransaction(tx); return req; }
/** * {@link #sendCoinsOffline(BitAddress, Value)} */ public BitSendRequest sendCoinsOffline(BitAddress address, Value amount, @Nullable KeyParameter aesKey) throws WalletAccountException { checkState(address.getParameters() instanceof CoinType); BitSendRequest request = BitSendRequest.to(address, amount); request.aesKey = aesKey; return request; }