/** * Returns the value of this output. This is the amount of currency that the destination address * receives. */ public Coin getValue() { maybeParse(); try { return Coin.valueOf(value); } catch (IllegalArgumentException e) { throw new IllegalStateException(e.getMessage(), e); } }
/** Returns a human readable debug string. */ @Override public String toString() { try { Script script = getScriptPubKey(); StringBuilder buf = new StringBuilder("TxOut of "); buf.append(Coin.valueOf(value).toFriendlyString()); if (script.isSentToAddress() || script.isPayToScriptHash()) buf.append(" to ").append(script.getToAddress(params)); else if (script.isSentToRawPubKey()) buf.append(" to pubkey ").append(Utils.HEX.encode(script.getPubKey())); else if (script.isSentToMultiSig()) buf.append(" to multisig"); else buf.append(" (unknown type)"); buf.append(" script:"); buf.append(script); return buf.toString(); } catch (ScriptException e) { throw new RuntimeException(e); } }
/** Returns a copy of the output detached from its containing transaction, if need be. */ public TransactionOutput duplicateDetached() { return new TransactionOutput( params, null, Coin.valueOf(value), org.spongycastle.util.Arrays.clone(scriptBytes)); }