X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FTxOut.java;h=b036b39c1bff98e67603d983b8a15c6f6132754b;hb=d87886bb194886ef86d3597a5cdc142b6ccc89e9;hp=438c92a0d87e06cbd853e542064931887b523d99;hpb=110f2f104ba8fc34caa7e34e04737f36f064b050;p=ldk-java diff --git a/src/main/java/org/ldk/structs/TxOut.java b/src/main/java/org/ldk/structs/TxOut.java index 438c92a0..b036b39c 100644 --- a/src/main/java/org/ldk/structs/TxOut.java +++ b/src/main/java/org/ldk/structs/TxOut.java @@ -4,8 +4,29 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class TxOut extends CommonBase{ - TxOut(java.lang.Object _dummy, long ptr) { super(ptr); } +public class TxOut extends CommonBase { + /** The script_pubkey in this output */ + public final byte[] script_pubkey; + /** The value, in satoshis, of this output */ + public final long value; + + TxOut(java.lang.Object _dummy, long ptr) { + super(ptr); + this.script_pubkey = bindings.TxOut_get_script_pubkey(ptr); + this.value = bindings.TxOut_get_value(ptr); + } + public TxOut(long value, byte[] script_pubkey) { + super(bindings.TxOut_new(script_pubkey, value)); + this.script_pubkey = bindings.TxOut_get_script_pubkey(ptr); + this.value = bindings.TxOut_get_value(ptr); + } + + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.TxOut_free(ptr); } + } } \ No newline at end of file