X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FSpendableOutputDescriptor.java;h=2f0c0e87ccd36f7d36098f69a45a18bb56c03976;hb=46bbb80f28ce77aaca1a3ebbf79c3c768c40f25b;hp=3dabd15a9532bed36cdb1ae1983af6625ce46a91;hpb=276893d3b8bd3fcb2bb10e3cab73a69d34831909;p=ldk-java diff --git a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java index 3dabd15a..2f0c0e87 100644 --- a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java @@ -5,6 +5,14 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * When on-chain outputs are created by rust-lightning (which our counterparty is not able to + * claim at any point in the future) an event is generated which you must track and be able to + * spend on-chain. The information needed to do this is provided in this enum, including the + * outpoint describing which txid and output index is available, the full output which exists at + * that txid/index, and any keys or other information required to sign. + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class SpendableOutputDescriptor extends CommonBase { private SpendableOutputDescriptor(Object _dummy, long ptr) { super(ptr); } @@ -42,13 +50,50 @@ public class SpendableOutputDescriptor extends CommonBase { } } public final static class DelayedPaymentOutput extends SpendableOutputDescriptor { + public final DelayedPaymentOutputDescriptor delayed_payment_output; private DelayedPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput obj) { super(null, ptr); + long delayed_payment_output = obj.delayed_payment_output; + DelayedPaymentOutputDescriptor delayed_payment_output_hu_conv = new DelayedPaymentOutputDescriptor(null, delayed_payment_output); + delayed_payment_output_hu_conv.ptrs_to.add(this); + this.delayed_payment_output = delayed_payment_output_hu_conv; } } public final static class StaticPaymentOutput extends SpendableOutputDescriptor { + public final StaticPaymentOutputDescriptor static_payment_output; private StaticPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput obj) { super(null, ptr); + long static_payment_output = obj.static_payment_output; + StaticPaymentOutputDescriptor static_payment_output_hu_conv = new StaticPaymentOutputDescriptor(null, static_payment_output); + static_payment_output_hu_conv.ptrs_to.add(this); + this.static_payment_output = static_payment_output_hu_conv; } } + /** + * Creates a copy of the SpendableOutputDescriptor + */ + public SpendableOutputDescriptor clone() { + long ret = bindings.SpendableOutputDescriptor_clone(this.ptr); + SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read + */ + public byte[] write() { + byte[] ret = bindings.SpendableOutputDescriptor_write(this.ptr); + return ret; + } + + /** + * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write + */ + public static Result_SpendableOutputDescriptorDecodeErrorZ read(byte[] ser) { + long ret = bindings.SpendableOutputDescriptor_read(ser); + Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + }