X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FUtilMethods.ts;h=13b2ab6369af18a591a0483ffb6acd616ff89dc6;hb=b3302d48f4dec85e9d23d9b6324d33b7c8619770;hp=fa0c2d44248b6b670b5a6c0c32430535b2d783dc;hpb=ba1af51214a8ea2de62b84cd23b6145173c71752;p=ldk-java diff --git a/ts/structs/UtilMethods.ts b/ts/structs/UtilMethods.ts index fa0c2d44..13b2ab63 100644 --- a/ts/structs/UtilMethods.ts +++ b/ts/structs/UtilMethods.ts @@ -31,7 +31,7 @@ ret_hu_conv.ptrs_to.add(arg_tx_broadcaster); ret_hu_conv.ptrs_to.add(arg_logger); ret_hu_conv.ptrs_to.add(arg_default_config); - /* TODO 2 ChannelMonitor */; + for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); }; return ret_hu_conv; } @@ -40,6 +40,12 @@ return ret; } + public static Uint8Array constructor_uild_closing_transaction(number to_holder_value_sat, number to_counterparty_value_sat, Uint8Array to_holder_script, Uint8Array to_counterparty_script, OutPoint funding_outpoint) { + Uint8Array ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1); + // this.ptrs_to.add(funding_outpoint); + return ret; + } + public static Result_SecretKeyErrorZ constructor_erive_private_key(Uint8Array per_commitment_point, Uint8Array base_secret) { number ret = bindings.derive_private_key(per_commitment_point, base_secret); Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); @@ -92,13 +98,23 @@ return ret; } + public static Result_RouteLightningErrorZ constructor_et_keysend_route(Uint8Array our_node_id, NetworkGraph network, Uint8Array payee, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger) { + number ret = bindings.get_keysend_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr); + Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(network); + for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; + for (RouteHint last_hops_conv_11: last_hops) { ret_hu_conv.ptrs_to.add(last_hops_conv_11); }; + ret_hu_conv.ptrs_to.add(logger); + return ret_hu_conv; + } + public static Result_RouteLightningErrorZ constructor_et_route(Uint8Array our_node_id, NetworkGraph network, Uint8Array payee, InvoiceFeatures payee_features, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger) { number ret = bindings.get_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, payee_features == null ? 0 : payee_features.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr); Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(network); ret_hu_conv.ptrs_to.add(payee_features); - /* TODO 2 ChannelDetails */; - /* TODO 2 RouteHint */; + for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; + for (RouteHint last_hops_conv_11: last_hops) { ret_hu_conv.ptrs_to.add(last_hops_conv_11); }; ret_hu_conv.ptrs_to.add(logger); return ret_hu_conv; }