@Override public void completeTransaction(SendRequest request) throws WalletAccountException { checkSendRequest(request); completeTransaction((BitSendRequest) request); }
@Override public boolean isPubKeyHashMine(byte[] pubkeyHash) { return findKeyFromPubHash(pubkeyHash) != null; }
@Override public boolean isPubKeyMine(byte[] pubkey) { return findKeyFromPubKey(pubkey) != null; }
@Override public void signTransaction(SendRequest request) throws WalletAccountException { checkSendRequest(request); signTransaction((BitSendRequest) request); }
/** * {@link #sendCoinsOffline(BitAddress, Value)} */ public BitSendRequest sendCoinsOffline(BitAddress address, Value amount, @Nullable String password) throws WalletAccountException { KeyParameter key = null; if (password != null) { checkState(isEncrypted()); key = checkNotNull(getKeyCrypter()).deriveKey(password); } return sendCoinsOffline(address, amount, key); }
@Override public boolean isAddressMine(AbstractAddress address) { return address != null && address.getType().equals(type) && (isP2SHAddress(address) ? isPayToScriptHashMine(getHash160(address)) : isPubKeyHashMine(getHash160(address))); }
@Override public SendRequest getEmptyWalletRequest(AbstractAddress destination) throws WalletAccountException { checkAddress(destination); return BitSendRequest.emptyWallet((BitAddress) destination); }
/** * Sends coins to the given address but does not broadcast the resulting pending transaction. */ public BitSendRequest sendCoinsOffline(BitAddress address, Value amount) throws WalletAccountException { return sendCoinsOffline(address, amount, (KeyParameter) null); }
@Override public SendRequest getSendToRequest(AbstractAddress destination, Value amount) throws WalletAccountException { checkAddress(destination); return BitSendRequest.to((BitAddress) destination, amount); }
@Override public void signMessage(SignedMessage unsignedMessage, @Nullable KeyParameter aesKey) { String message = unsignedMessage.message; lock.lock(); try { ECKey key; try { BitAddress address = BitAddress.from(type, unsignedMessage.getAddress()); key = findKeyFromPubHash(address.getHash160()); } catch (AddressMalformedException e) { unsignedMessage.status = SignedMessage.Status.AddressMalformed; return; } if (key == null) { unsignedMessage.status = SignedMessage.Status.MissingPrivateKey; return; } try { unsignedMessage.signature = key.signMessage(type.getSignedMessageHeader(), message, aesKey); unsignedMessage.status = SignedMessage.Status.SignedOK; } catch (ECKey.KeyIsEncryptedException e) { unsignedMessage.status = SignedMessage.Status.KeyIsEncrypted; } catch (ECKey.MissingPrivateKeyException e) { unsignedMessage.status = SignedMessage.Status.MissingPrivateKey; } } finally { lock.unlock(); } }