X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPhantomKeysManager.java;h=bb34752f75c116eb7dbb1d4139f39f3596469fb1;hb=8fa2bcb208a51fa352d04981f1387d8bceced107;hp=cb9994158c9aa937fa8cdf218827289836805b36;hpb=47341beaeecf907f422f126500baf586d54a0d41;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PhantomKeysManager.java b/src/main/java/org/ldk/structs/PhantomKeysManager.java index cb999415..bb34752f 100644 --- a/src/main/java/org/ldk/structs/PhantomKeysManager.java +++ b/src/main/java/org/ldk/structs/PhantomKeysManager.java @@ -35,21 +35,48 @@ public class PhantomKeysManager extends CommonBase { } /** - * Constructs a new KeysInterface which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is */ - public KeysInterface as_KeysInterface() { - long ret = bindings.PhantomKeysManager_as_KeysInterface(this.ptr); + public EntropySource as_EntropySource() { + long ret = bindings.PhantomKeysManager_as_EntropySource(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - KeysInterface ret_hu_conv = new KeysInterface(null, ret); - ret_hu_conv.ptrs_to.add(this); + EntropySource ret_hu_conv = new EntropySource(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** - * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed` - * that is shared across all nodes that intend to participate in [phantom node payments] together. + * Constructs a new NodeSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is + */ + public NodeSigner as_NodeSigner() { + long ret = bindings.PhantomKeysManager_as_NodeSigner(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + NodeSigner ret_hu_conv = new NodeSigner(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Constructs a new SignerProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is + */ + public SignerProvider as_SignerProvider() { + long ret = bindings.PhantomKeysManager_as_SignerProvider(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + SignerProvider ret_hu_conv = new SignerProvider(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed` + * that is shared across all nodes that intend to participate in [phantom node payments] + * together. * * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and * `starting_time_nanos`. @@ -67,22 +94,25 @@ public class PhantomKeysManager extends CommonBase { Reference.reachabilityFence(cross_node_seed); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PhantomKeysManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PhantomKeysManager(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } /** * See [`KeysManager::spend_spendable_outputs`] for documentation on this method. */ - public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight) { - long ret = bindings.PhantomKeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight); + public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_PackedLockTimeZ locktime) { + long ret = bindings.PhantomKeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight, locktime.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(descriptors); Reference.reachabilityFence(outputs); Reference.reachabilityFence(change_destination_script); Reference.reachabilityFence(feerate_sat_per_1000_weight); + Reference.reachabilityFence(locktime); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); + for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (this != null) { this.ptrs_to.add(descriptors_conv_27); }; }; + if (this != null) { this.ptrs_to.add(locktime); }; return ret_hu_conv; } @@ -96,8 +126,27 @@ public class PhantomKeysManager extends CommonBase { Reference.reachabilityFence(params); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InMemorySigner(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + */ + public byte[] get_node_secret_key() { + byte[] ret = bindings.PhantomKeysManager_get_node_secret_key(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the + * last-hop onion data, etc. + */ + public byte[] get_phantom_node_secret_key() { + byte[] ret = bindings.PhantomKeysManager_get_phantom_node_secret_key(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + }