UNPKG

lightningdevkit

Version:
858 lines 51 kB
import { Option_u64Z } from '../structs/Option_u64Z.mjs'; import { Option_ThirtyTwoBytesZ } from '../structs/Option_ThirtyTwoBytesZ.mjs'; import { RecipientOnionFields } from '../structs/RecipientOnionFields.mjs'; import { Bolt12Invoice } from '../structs/Bolt12Invoice.mjs'; import { OutPoint } from '../structs/OutPoint.mjs'; import { SpendableOutputDescriptor } from '../structs/SpendableOutputDescriptor.mjs'; import { Option_u32Z } from '../structs/Option_u32Z.mjs'; import { Path } from '../structs/Path.mjs'; import { ClosureReason } from '../structs/ClosureReason.mjs'; import { ChannelId } from '../structs/ChannelId.mjs'; import { SocketAddress } from '../structs/SocketAddress.mjs'; import { Option_OffersContextZ } from '../structs/Option_OffersContextZ.mjs'; import { OnionMessage } from '../structs/OnionMessage.mjs'; import { FundingInfo } from '../structs/FundingInfo.mjs'; import { PaymentPurpose } from '../structs/PaymentPurpose.mjs'; import { ClaimedHTLC } from '../structs/ClaimedHTLC.mjs'; import { PathFailure } from '../structs/PathFailure.mjs'; import { HTLCDestination } from '../structs/HTLCDestination.mjs'; import { Option_PaymentFailureReasonZ } from '../structs/Option_PaymentFailureReasonZ.mjs'; import { Option_U128Z } from '../structs/Option_U128Z.mjs'; import { Responder } from '../structs/Responder.mjs'; import { ChannelTypeFeatures } from '../structs/ChannelTypeFeatures.mjs'; import { InboundChannelFunds } from '../structs/InboundChannelFunds.mjs'; import { ChannelParameters } from '../structs/ChannelParameters.mjs'; import { BumpTransactionEvent } from '../structs/BumpTransactionEvent.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * An Event which you should probably take some action in response to. * * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use * them directly as they don't round-trip exactly (for example FundingGenerationReady is never * written as it makes no sense to respond to it after reconnecting to peers). */ export class Event extends CommonBase { constructor(_dummy, ptr) { super(ptr, bindings.Event_free); } /* @internal */ static constr_from_ptr(ptr) { const raw_ty = bindings.LDKEvent_ty_from_ptr(ptr); switch (raw_ty) { case 0: return new Event_FundingGenerationReady(ptr); case 1: return new Event_FundingTxBroadcastSafe(ptr); case 2: return new Event_PaymentClaimable(ptr); case 3: return new Event_PaymentClaimed(ptr); case 4: return new Event_ConnectionNeeded(ptr); case 5: return new Event_InvoiceReceived(ptr); case 6: return new Event_PaymentSent(ptr); case 7: return new Event_PaymentFailed(ptr); case 8: return new Event_PaymentPathSuccessful(ptr); case 9: return new Event_PaymentPathFailed(ptr); case 10: return new Event_ProbeSuccessful(ptr); case 11: return new Event_ProbeFailed(ptr); case 12: return new Event_PendingHTLCsForwardable(ptr); case 13: return new Event_HTLCIntercepted(ptr); case 14: return new Event_SpendableOutputs(ptr); case 15: return new Event_PaymentForwarded(ptr); case 16: return new Event_ChannelPending(ptr); case 17: return new Event_ChannelReady(ptr); case 18: return new Event_ChannelClosed(ptr); case 19: return new Event_DiscardFunding(ptr); case 20: return new Event_OpenChannelRequest(ptr); case 21: return new Event_HTLCHandlingFailed(ptr); case 22: return new Event_BumpTransaction(ptr); case 23: return new Event_OnionMessageIntercepted(ptr); case 24: return new Event_OnionMessagePeerConnected(ptr); default: throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } } clone_ptr() { const ret = bindings.Event_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the Event */ clone() { const ret = bindings.Event_clone(this.ptr); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Utility method to constructs a new FundingGenerationReady-variant Event */ static constructor_funding_generation_ready(temporary_channel_id, counterparty_node_id, channel_value_satoshis, output_script, user_channel_id) { const ret = bindings.Event_funding_generation_ready(CommonBase.get_ptr_of(temporary_channel_id), bindings.encodeUint8Array(counterparty_node_id), channel_value_satoshis, bindings.encodeUint8Array(output_script), bindings.encodeUint128(user_channel_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new FundingTxBroadcastSafe-variant Event */ static constructor_funding_tx_broadcast_safe(channel_id, user_channel_id, funding_txo, counterparty_node_id, former_temporary_channel_id) { const ret = bindings.Event_funding_tx_broadcast_safe(CommonBase.get_ptr_of(channel_id), bindings.encodeUint128(user_channel_id), CommonBase.get_ptr_of(funding_txo), bindings.encodeUint8Array(counterparty_node_id), CommonBase.get_ptr_of(former_temporary_channel_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PaymentClaimable-variant Event */ static constructor_payment_claimable(receiver_node_id, payment_hash, onion_fields, amount_msat, counterparty_skimmed_fee_msat, purpose, via_channel_id, via_user_channel_id, claim_deadline, payment_id) { const ret = bindings.Event_payment_claimable(bindings.encodeUint8Array(receiver_node_id), bindings.encodeUint8Array(payment_hash), CommonBase.get_ptr_of(onion_fields), amount_msat, counterparty_skimmed_fee_msat, CommonBase.get_ptr_of(purpose), CommonBase.get_ptr_of(via_channel_id), CommonBase.get_ptr_of(via_user_channel_id), CommonBase.get_ptr_of(claim_deadline), CommonBase.get_ptr_of(payment_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PaymentClaimed-variant Event */ static constructor_payment_claimed(receiver_node_id, payment_hash, amount_msat, purpose, htlcs, sender_intended_total_msat, onion_fields, payment_id) { const ret = bindings.Event_payment_claimed(bindings.encodeUint8Array(receiver_node_id), bindings.encodeUint8Array(payment_hash), amount_msat, CommonBase.get_ptr_of(purpose), bindings.encodeUint64Array(htlcs.map(htlcs_conv_13 => CommonBase.get_ptr_of(htlcs_conv_13))), CommonBase.get_ptr_of(sender_intended_total_msat), CommonBase.get_ptr_of(onion_fields), CommonBase.get_ptr_of(payment_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new ConnectionNeeded-variant Event */ static constructor_connection_needed(node_id, addresses) { const ret = bindings.Event_connection_needed(bindings.encodeUint8Array(node_id), bindings.encodeUint64Array(addresses.map(addresses_conv_15 => CommonBase.get_ptr_of(addresses_conv_15)))); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new InvoiceReceived-variant Event */ static constructor_invoice_received(payment_id, invoice, context, responder) { const ret = bindings.Event_invoice_received(bindings.encodeUint8Array(payment_id), CommonBase.get_ptr_of(invoice), CommonBase.get_ptr_of(context), CommonBase.get_ptr_of(responder)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PaymentSent-variant Event */ static constructor_payment_sent(payment_id, payment_preimage, payment_hash, fee_paid_msat) { const ret = bindings.Event_payment_sent(CommonBase.get_ptr_of(payment_id), bindings.encodeUint8Array(payment_preimage), bindings.encodeUint8Array(payment_hash), CommonBase.get_ptr_of(fee_paid_msat)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PaymentFailed-variant Event */ static constructor_payment_failed(payment_id, payment_hash, reason) { const ret = bindings.Event_payment_failed(bindings.encodeUint8Array(payment_id), CommonBase.get_ptr_of(payment_hash), CommonBase.get_ptr_of(reason)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PaymentPathSuccessful-variant Event */ static constructor_payment_path_successful(payment_id, payment_hash, path) { const ret = bindings.Event_payment_path_successful(bindings.encodeUint8Array(payment_id), CommonBase.get_ptr_of(payment_hash), CommonBase.get_ptr_of(path)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PaymentPathFailed-variant Event */ static constructor_payment_path_failed(payment_id, payment_hash, payment_failed_permanently, failure, path, short_channel_id) { const ret = bindings.Event_payment_path_failed(CommonBase.get_ptr_of(payment_id), bindings.encodeUint8Array(payment_hash), payment_failed_permanently, CommonBase.get_ptr_of(failure), CommonBase.get_ptr_of(path), CommonBase.get_ptr_of(short_channel_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new ProbeSuccessful-variant Event */ static constructor_probe_successful(payment_id, payment_hash, path) { const ret = bindings.Event_probe_successful(bindings.encodeUint8Array(payment_id), bindings.encodeUint8Array(payment_hash), CommonBase.get_ptr_of(path)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new ProbeFailed-variant Event */ static constructor_probe_failed(payment_id, payment_hash, path, short_channel_id) { const ret = bindings.Event_probe_failed(bindings.encodeUint8Array(payment_id), bindings.encodeUint8Array(payment_hash), CommonBase.get_ptr_of(path), CommonBase.get_ptr_of(short_channel_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PendingHTLCsForwardable-variant Event */ static constructor_pending_htlcs_forwardable(time_forwardable) { const ret = bindings.Event_pending_htlcs_forwardable(time_forwardable); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new HTLCIntercepted-variant Event */ static constructor_htlcintercepted(intercept_id, requested_next_hop_scid, payment_hash, inbound_amount_msat, expected_outbound_amount_msat) { const ret = bindings.Event_htlcintercepted(bindings.encodeUint8Array(intercept_id), requested_next_hop_scid, bindings.encodeUint8Array(payment_hash), inbound_amount_msat, expected_outbound_amount_msat); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new SpendableOutputs-variant Event */ static constructor_spendable_outputs(outputs, channel_id) { const ret = bindings.Event_spendable_outputs(bindings.encodeUint64Array(outputs.map(outputs_conv_27 => CommonBase.get_ptr_of(outputs_conv_27))), CommonBase.get_ptr_of(channel_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new PaymentForwarded-variant Event */ static constructor_payment_forwarded(prev_channel_id, next_channel_id, prev_user_channel_id, next_user_channel_id, prev_node_id, next_node_id, total_fee_earned_msat, skimmed_fee_msat, claim_from_onchain_tx, outbound_amount_forwarded_msat) { const ret = bindings.Event_payment_forwarded(CommonBase.get_ptr_of(prev_channel_id), CommonBase.get_ptr_of(next_channel_id), CommonBase.get_ptr_of(prev_user_channel_id), CommonBase.get_ptr_of(next_user_channel_id), bindings.encodeUint8Array(prev_node_id), bindings.encodeUint8Array(next_node_id), CommonBase.get_ptr_of(total_fee_earned_msat), CommonBase.get_ptr_of(skimmed_fee_msat), claim_from_onchain_tx, CommonBase.get_ptr_of(outbound_amount_forwarded_msat)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new ChannelPending-variant Event */ static constructor_channel_pending(channel_id, user_channel_id, former_temporary_channel_id, counterparty_node_id, funding_txo, channel_type) { const ret = bindings.Event_channel_pending(CommonBase.get_ptr_of(channel_id), bindings.encodeUint128(user_channel_id), CommonBase.get_ptr_of(former_temporary_channel_id), bindings.encodeUint8Array(counterparty_node_id), CommonBase.get_ptr_of(funding_txo), CommonBase.get_ptr_of(channel_type)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new ChannelReady-variant Event */ static constructor_channel_ready(channel_id, user_channel_id, counterparty_node_id, channel_type) { const ret = bindings.Event_channel_ready(CommonBase.get_ptr_of(channel_id), bindings.encodeUint128(user_channel_id), bindings.encodeUint8Array(counterparty_node_id), CommonBase.get_ptr_of(channel_type)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new ChannelClosed-variant Event */ static constructor_channel_closed(channel_id, user_channel_id, reason, counterparty_node_id, channel_capacity_sats, channel_funding_txo, last_local_balance_msat) { const ret = bindings.Event_channel_closed(CommonBase.get_ptr_of(channel_id), bindings.encodeUint128(user_channel_id), CommonBase.get_ptr_of(reason), bindings.encodeUint8Array(counterparty_node_id), CommonBase.get_ptr_of(channel_capacity_sats), CommonBase.get_ptr_of(channel_funding_txo), CommonBase.get_ptr_of(last_local_balance_msat)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new DiscardFunding-variant Event */ static constructor_discard_funding(channel_id, funding_info) { const ret = bindings.Event_discard_funding(CommonBase.get_ptr_of(channel_id), CommonBase.get_ptr_of(funding_info)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new OpenChannelRequest-variant Event */ static constructor_open_channel_request(temporary_channel_id, counterparty_node_id, funding_satoshis, channel_negotiation_type, channel_type, is_announced, params) { const ret = bindings.Event_open_channel_request(CommonBase.get_ptr_of(temporary_channel_id), bindings.encodeUint8Array(counterparty_node_id), funding_satoshis, CommonBase.get_ptr_of(channel_negotiation_type), CommonBase.get_ptr_of(channel_type), is_announced, CommonBase.get_ptr_of(params)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new HTLCHandlingFailed-variant Event */ static constructor_htlchandling_failed(prev_channel_id, failed_next_destination) { const ret = bindings.Event_htlchandling_failed(CommonBase.get_ptr_of(prev_channel_id), CommonBase.get_ptr_of(failed_next_destination)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new BumpTransaction-variant Event */ static constructor_bump_transaction(a) { const ret = bindings.Event_bump_transaction(CommonBase.get_ptr_of(a)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new OnionMessageIntercepted-variant Event */ static constructor_onion_message_intercepted(peer_node_id, message) { const ret = bindings.Event_onion_message_intercepted(bindings.encodeUint8Array(peer_node_id), CommonBase.get_ptr_of(message)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Utility method to constructs a new OnionMessagePeerConnected-variant Event */ static constructor_onion_message_peer_connected(peer_node_id) { const ret = bindings.Event_onion_message_peer_connected(bindings.encodeUint8Array(peer_node_id)); const ret_hu_conv = Event.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } /** * Checks if two Events contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. */ eq(b) { const ret = bindings.Event_eq(this.ptr, CommonBase.get_ptr_of(b)); return ret; } /** * Serialize the Event object into a byte array which can be read by Event_read */ write() { const ret = bindings.Event_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } } /** A Event of type FundingGenerationReady */ export class Event_FundingGenerationReady extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const temporary_channel_id = bindings.LDKEvent_FundingGenerationReady_get_temporary_channel_id(ptr); const temporary_channel_id_hu_conv = new ChannelId(null, temporary_channel_id); CommonBase.add_ref_from(temporary_channel_id_hu_conv, this); this.temporary_channel_id = temporary_channel_id_hu_conv; const counterparty_node_id = bindings.LDKEvent_FundingGenerationReady_get_counterparty_node_id(ptr); const counterparty_node_id_conv = bindings.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; this.channel_value_satoshis = bindings.LDKEvent_FundingGenerationReady_get_channel_value_satoshis(ptr); const output_script = bindings.LDKEvent_FundingGenerationReady_get_output_script(ptr); const output_script_conv = bindings.decodeUint8Array(output_script); this.output_script = output_script_conv; const user_channel_id = bindings.LDKEvent_FundingGenerationReady_get_user_channel_id(ptr); const user_channel_id_conv = bindings.decodeUint128(user_channel_id); this.user_channel_id = user_channel_id_conv; } } /** A Event of type FundingTxBroadcastSafe */ export class Event_FundingTxBroadcastSafe extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const channel_id = bindings.LDKEvent_FundingTxBroadcastSafe_get_channel_id(ptr); const channel_id_hu_conv = new ChannelId(null, channel_id); CommonBase.add_ref_from(channel_id_hu_conv, this); this.channel_id = channel_id_hu_conv; const user_channel_id = bindings.LDKEvent_FundingTxBroadcastSafe_get_user_channel_id(ptr); const user_channel_id_conv = bindings.decodeUint128(user_channel_id); this.user_channel_id = user_channel_id_conv; const funding_txo = bindings.LDKEvent_FundingTxBroadcastSafe_get_funding_txo(ptr); const funding_txo_hu_conv = new OutPoint(null, funding_txo); CommonBase.add_ref_from(funding_txo_hu_conv, this); this.funding_txo = funding_txo_hu_conv; const counterparty_node_id = bindings.LDKEvent_FundingTxBroadcastSafe_get_counterparty_node_id(ptr); const counterparty_node_id_conv = bindings.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; const former_temporary_channel_id = bindings.LDKEvent_FundingTxBroadcastSafe_get_former_temporary_channel_id(ptr); const former_temporary_channel_id_hu_conv = new ChannelId(null, former_temporary_channel_id); CommonBase.add_ref_from(former_temporary_channel_id_hu_conv, this); this.former_temporary_channel_id = former_temporary_channel_id_hu_conv; } } /** A Event of type PaymentClaimable */ export class Event_PaymentClaimable extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const receiver_node_id = bindings.LDKEvent_PaymentClaimable_get_receiver_node_id(ptr); const receiver_node_id_conv = bindings.decodeUint8Array(receiver_node_id); this.receiver_node_id = receiver_node_id_conv; const payment_hash = bindings.LDKEvent_PaymentClaimable_get_payment_hash(ptr); const payment_hash_conv = bindings.decodeUint8Array(payment_hash); this.payment_hash = payment_hash_conv; const onion_fields = bindings.LDKEvent_PaymentClaimable_get_onion_fields(ptr); const onion_fields_hu_conv = new RecipientOnionFields(null, onion_fields); CommonBase.add_ref_from(onion_fields_hu_conv, this); this.onion_fields = onion_fields_hu_conv; this.amount_msat = bindings.LDKEvent_PaymentClaimable_get_amount_msat(ptr); this.counterparty_skimmed_fee_msat = bindings.LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(ptr); const purpose = bindings.LDKEvent_PaymentClaimable_get_purpose(ptr); const purpose_hu_conv = PaymentPurpose.constr_from_ptr(purpose); CommonBase.add_ref_from(purpose_hu_conv, this); this.purpose = purpose_hu_conv; const via_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_channel_id(ptr); const via_channel_id_hu_conv = new ChannelId(null, via_channel_id); CommonBase.add_ref_from(via_channel_id_hu_conv, this); this.via_channel_id = via_channel_id_hu_conv; const via_user_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_user_channel_id(ptr); const via_user_channel_id_hu_conv = Option_U128Z.constr_from_ptr(via_user_channel_id); CommonBase.add_ref_from(via_user_channel_id_hu_conv, this); this.via_user_channel_id = via_user_channel_id_hu_conv; const claim_deadline = bindings.LDKEvent_PaymentClaimable_get_claim_deadline(ptr); const claim_deadline_hu_conv = Option_u32Z.constr_from_ptr(claim_deadline); CommonBase.add_ref_from(claim_deadline_hu_conv, this); this.claim_deadline = claim_deadline_hu_conv; const payment_id = bindings.LDKEvent_PaymentClaimable_get_payment_id(ptr); const payment_id_hu_conv = Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id); CommonBase.add_ref_from(payment_id_hu_conv, this); this.payment_id = payment_id_hu_conv; } } /** A Event of type PaymentClaimed */ export class Event_PaymentClaimed extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const receiver_node_id = bindings.LDKEvent_PaymentClaimed_get_receiver_node_id(ptr); const receiver_node_id_conv = bindings.decodeUint8Array(receiver_node_id); this.receiver_node_id = receiver_node_id_conv; const payment_hash = bindings.LDKEvent_PaymentClaimed_get_payment_hash(ptr); const payment_hash_conv = bindings.decodeUint8Array(payment_hash); this.payment_hash = payment_hash_conv; this.amount_msat = bindings.LDKEvent_PaymentClaimed_get_amount_msat(ptr); const purpose = bindings.LDKEvent_PaymentClaimed_get_purpose(ptr); const purpose_hu_conv = PaymentPurpose.constr_from_ptr(purpose); CommonBase.add_ref_from(purpose_hu_conv, this); this.purpose = purpose_hu_conv; const htlcs = bindings.LDKEvent_PaymentClaimed_get_htlcs(ptr); const htlcs_conv_13_len = bindings.getArrayLength(htlcs); const htlcs_conv_13_arr = new Array(htlcs_conv_13_len).fill(null); for (var n = 0; n < htlcs_conv_13_len; n++) { const htlcs_conv_13 = bindings.getU64ArrayElem(htlcs, n); const htlcs_conv_13_hu_conv = new ClaimedHTLC(null, htlcs_conv_13); CommonBase.add_ref_from(htlcs_conv_13_hu_conv, this); htlcs_conv_13_arr[n] = htlcs_conv_13_hu_conv; } bindings.freeWasmMemory(htlcs); this.htlcs = htlcs_conv_13_arr; const sender_intended_total_msat = bindings.LDKEvent_PaymentClaimed_get_sender_intended_total_msat(ptr); const sender_intended_total_msat_hu_conv = Option_u64Z.constr_from_ptr(sender_intended_total_msat); CommonBase.add_ref_from(sender_intended_total_msat_hu_conv, this); this.sender_intended_total_msat = sender_intended_total_msat_hu_conv; const onion_fields = bindings.LDKEvent_PaymentClaimed_get_onion_fields(ptr); const onion_fields_hu_conv = new RecipientOnionFields(null, onion_fields); CommonBase.add_ref_from(onion_fields_hu_conv, this); this.onion_fields = onion_fields_hu_conv; const payment_id = bindings.LDKEvent_PaymentClaimed_get_payment_id(ptr); const payment_id_hu_conv = Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id); CommonBase.add_ref_from(payment_id_hu_conv, this); this.payment_id = payment_id_hu_conv; } } /** A Event of type ConnectionNeeded */ export class Event_ConnectionNeeded extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const node_id = bindings.LDKEvent_ConnectionNeeded_get_node_id(ptr); const node_id_conv = bindings.decodeUint8Array(node_id); this.node_id = node_id_conv; const addresses = bindings.LDKEvent_ConnectionNeeded_get_addresses(ptr); const addresses_conv_15_len = bindings.getArrayLength(addresses); const addresses_conv_15_arr = new Array(addresses_conv_15_len).fill(null); for (var p = 0; p < addresses_conv_15_len; p++) { const addresses_conv_15 = bindings.getU64ArrayElem(addresses, p); const addresses_conv_15_hu_conv = SocketAddress.constr_from_ptr(addresses_conv_15); CommonBase.add_ref_from(addresses_conv_15_hu_conv, this); addresses_conv_15_arr[p] = addresses_conv_15_hu_conv; } bindings.freeWasmMemory(addresses); this.addresses = addresses_conv_15_arr; } } /** A Event of type InvoiceReceived */ export class Event_InvoiceReceived extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const payment_id = bindings.LDKEvent_InvoiceReceived_get_payment_id(ptr); const payment_id_conv = bindings.decodeUint8Array(payment_id); this.payment_id = payment_id_conv; const invoice = bindings.LDKEvent_InvoiceReceived_get_invoice(ptr); const invoice_hu_conv = new Bolt12Invoice(null, invoice); CommonBase.add_ref_from(invoice_hu_conv, this); this.invoice = invoice_hu_conv; const context = bindings.LDKEvent_InvoiceReceived_get_context(ptr); const context_hu_conv = Option_OffersContextZ.constr_from_ptr(context); CommonBase.add_ref_from(context_hu_conv, this); this.context = context_hu_conv; const responder = bindings.LDKEvent_InvoiceReceived_get_responder(ptr); const responder_hu_conv = new Responder(null, responder); CommonBase.add_ref_from(responder_hu_conv, this); this.responder = responder_hu_conv; } } /** A Event of type PaymentSent */ export class Event_PaymentSent extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const payment_id = bindings.LDKEvent_PaymentSent_get_payment_id(ptr); const payment_id_hu_conv = Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id); CommonBase.add_ref_from(payment_id_hu_conv, this); this.payment_id = payment_id_hu_conv; const payment_preimage = bindings.LDKEvent_PaymentSent_get_payment_preimage(ptr); const payment_preimage_conv = bindings.decodeUint8Array(payment_preimage); this.payment_preimage = payment_preimage_conv; const payment_hash = bindings.LDKEvent_PaymentSent_get_payment_hash(ptr); const payment_hash_conv = bindings.decodeUint8Array(payment_hash); this.payment_hash = payment_hash_conv; const fee_paid_msat = bindings.LDKEvent_PaymentSent_get_fee_paid_msat(ptr); const fee_paid_msat_hu_conv = Option_u64Z.constr_from_ptr(fee_paid_msat); CommonBase.add_ref_from(fee_paid_msat_hu_conv, this); this.fee_paid_msat = fee_paid_msat_hu_conv; } } /** A Event of type PaymentFailed */ export class Event_PaymentFailed extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const payment_id = bindings.LDKEvent_PaymentFailed_get_payment_id(ptr); const payment_id_conv = bindings.decodeUint8Array(payment_id); this.payment_id = payment_id_conv; const payment_hash = bindings.LDKEvent_PaymentFailed_get_payment_hash(ptr); const payment_hash_hu_conv = Option_ThirtyTwoBytesZ.constr_from_ptr(payment_hash); CommonBase.add_ref_from(payment_hash_hu_conv, this); this.payment_hash = payment_hash_hu_conv; const reason = bindings.LDKEvent_PaymentFailed_get_reason(ptr); const reason_hu_conv = Option_PaymentFailureReasonZ.constr_from_ptr(reason); CommonBase.add_ref_from(reason_hu_conv, this); this.reason = reason_hu_conv; } } /** A Event of type PaymentPathSuccessful */ export class Event_PaymentPathSuccessful extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const payment_id = bindings.LDKEvent_PaymentPathSuccessful_get_payment_id(ptr); const payment_id_conv = bindings.decodeUint8Array(payment_id); this.payment_id = payment_id_conv; const payment_hash = bindings.LDKEvent_PaymentPathSuccessful_get_payment_hash(ptr); const payment_hash_hu_conv = Option_ThirtyTwoBytesZ.constr_from_ptr(payment_hash); CommonBase.add_ref_from(payment_hash_hu_conv, this); this.payment_hash = payment_hash_hu_conv; const path = bindings.LDKEvent_PaymentPathSuccessful_get_path(ptr); const path_hu_conv = new Path(null, path); CommonBase.add_ref_from(path_hu_conv, this); this.path = path_hu_conv; } } /** A Event of type PaymentPathFailed */ export class Event_PaymentPathFailed extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const payment_id = bindings.LDKEvent_PaymentPathFailed_get_payment_id(ptr); const payment_id_hu_conv = Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id); CommonBase.add_ref_from(payment_id_hu_conv, this); this.payment_id = payment_id_hu_conv; const payment_hash = bindings.LDKEvent_PaymentPathFailed_get_payment_hash(ptr); const payment_hash_conv = bindings.decodeUint8Array(payment_hash); this.payment_hash = payment_hash_conv; this.payment_failed_permanently = bindings.LDKEvent_PaymentPathFailed_get_payment_failed_permanently(ptr); const failure = bindings.LDKEvent_PaymentPathFailed_get_failure(ptr); const failure_hu_conv = PathFailure.constr_from_ptr(failure); CommonBase.add_ref_from(failure_hu_conv, this); this.failure = failure_hu_conv; const path = bindings.LDKEvent_PaymentPathFailed_get_path(ptr); const path_hu_conv = new Path(null, path); CommonBase.add_ref_from(path_hu_conv, this); this.path = path_hu_conv; const short_channel_id = bindings.LDKEvent_PaymentPathFailed_get_short_channel_id(ptr); const short_channel_id_hu_conv = Option_u64Z.constr_from_ptr(short_channel_id); CommonBase.add_ref_from(short_channel_id_hu_conv, this); this.short_channel_id = short_channel_id_hu_conv; } } /** A Event of type ProbeSuccessful */ export class Event_ProbeSuccessful extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const payment_id = bindings.LDKEvent_ProbeSuccessful_get_payment_id(ptr); const payment_id_conv = bindings.decodeUint8Array(payment_id); this.payment_id = payment_id_conv; const payment_hash = bindings.LDKEvent_ProbeSuccessful_get_payment_hash(ptr); const payment_hash_conv = bindings.decodeUint8Array(payment_hash); this.payment_hash = payment_hash_conv; const path = bindings.LDKEvent_ProbeSuccessful_get_path(ptr); const path_hu_conv = new Path(null, path); CommonBase.add_ref_from(path_hu_conv, this); this.path = path_hu_conv; } } /** A Event of type ProbeFailed */ export class Event_ProbeFailed extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const payment_id = bindings.LDKEvent_ProbeFailed_get_payment_id(ptr); const payment_id_conv = bindings.decodeUint8Array(payment_id); this.payment_id = payment_id_conv; const payment_hash = bindings.LDKEvent_ProbeFailed_get_payment_hash(ptr); const payment_hash_conv = bindings.decodeUint8Array(payment_hash); this.payment_hash = payment_hash_conv; const path = bindings.LDKEvent_ProbeFailed_get_path(ptr); const path_hu_conv = new Path(null, path); CommonBase.add_ref_from(path_hu_conv, this); this.path = path_hu_conv; const short_channel_id = bindings.LDKEvent_ProbeFailed_get_short_channel_id(ptr); const short_channel_id_hu_conv = Option_u64Z.constr_from_ptr(short_channel_id); CommonBase.add_ref_from(short_channel_id_hu_conv, this); this.short_channel_id = short_channel_id_hu_conv; } } /** A Event of type PendingHTLCsForwardable */ export class Event_PendingHTLCsForwardable extends Event { /* @internal */ constructor(ptr) { super(null, ptr); this.time_forwardable = bindings.LDKEvent_PendingHTLCsForwardable_get_time_forwardable(ptr); } } /** A Event of type HTLCIntercepted */ export class Event_HTLCIntercepted extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const intercept_id = bindings.LDKEvent_HTLCIntercepted_get_intercept_id(ptr); const intercept_id_conv = bindings.decodeUint8Array(intercept_id); this.intercept_id = intercept_id_conv; this.requested_next_hop_scid = bindings.LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(ptr); const payment_hash = bindings.LDKEvent_HTLCIntercepted_get_payment_hash(ptr); const payment_hash_conv = bindings.decodeUint8Array(payment_hash); this.payment_hash = payment_hash_conv; this.inbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_inbound_amount_msat(ptr); this.expected_outbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(ptr); } } /** A Event of type SpendableOutputs */ export class Event_SpendableOutputs extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const outputs = bindings.LDKEvent_SpendableOutputs_get_outputs(ptr); const outputs_conv_27_len = bindings.getArrayLength(outputs); const outputs_conv_27_arr = new Array(outputs_conv_27_len).fill(null); for (var b = 0; b < outputs_conv_27_len; b++) { const outputs_conv_27 = bindings.getU64ArrayElem(outputs, b); const outputs_conv_27_hu_conv = SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27); CommonBase.add_ref_from(outputs_conv_27_hu_conv, this); outputs_conv_27_arr[b] = outputs_conv_27_hu_conv; } bindings.freeWasmMemory(outputs); this.outputs = outputs_conv_27_arr; const channel_id = bindings.LDKEvent_SpendableOutputs_get_channel_id(ptr); const channel_id_hu_conv = new ChannelId(null, channel_id); CommonBase.add_ref_from(channel_id_hu_conv, this); this.channel_id = channel_id_hu_conv; } } /** A Event of type PaymentForwarded */ export class Event_PaymentForwarded extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const prev_channel_id = bindings.LDKEvent_PaymentForwarded_get_prev_channel_id(ptr); const prev_channel_id_hu_conv = new ChannelId(null, prev_channel_id); CommonBase.add_ref_from(prev_channel_id_hu_conv, this); this.prev_channel_id = prev_channel_id_hu_conv; const next_channel_id = bindings.LDKEvent_PaymentForwarded_get_next_channel_id(ptr); const next_channel_id_hu_conv = new ChannelId(null, next_channel_id); CommonBase.add_ref_from(next_channel_id_hu_conv, this); this.next_channel_id = next_channel_id_hu_conv; const prev_user_channel_id = bindings.LDKEvent_PaymentForwarded_get_prev_user_channel_id(ptr); const prev_user_channel_id_hu_conv = Option_U128Z.constr_from_ptr(prev_user_channel_id); CommonBase.add_ref_from(prev_user_channel_id_hu_conv, this); this.prev_user_channel_id = prev_user_channel_id_hu_conv; const next_user_channel_id = bindings.LDKEvent_PaymentForwarded_get_next_user_channel_id(ptr); const next_user_channel_id_hu_conv = Option_U128Z.constr_from_ptr(next_user_channel_id); CommonBase.add_ref_from(next_user_channel_id_hu_conv, this); this.next_user_channel_id = next_user_channel_id_hu_conv; const prev_node_id = bindings.LDKEvent_PaymentForwarded_get_prev_node_id(ptr); const prev_node_id_conv = bindings.decodeUint8Array(prev_node_id); this.prev_node_id = prev_node_id_conv; const next_node_id = bindings.LDKEvent_PaymentForwarded_get_next_node_id(ptr); const next_node_id_conv = bindings.decodeUint8Array(next_node_id); this.next_node_id = next_node_id_conv; const total_fee_earned_msat = bindings.LDKEvent_PaymentForwarded_get_total_fee_earned_msat(ptr); const total_fee_earned_msat_hu_conv = Option_u64Z.constr_from_ptr(total_fee_earned_msat); CommonBase.add_ref_from(total_fee_earned_msat_hu_conv, this); this.total_fee_earned_msat = total_fee_earned_msat_hu_conv; const skimmed_fee_msat = bindings.LDKEvent_PaymentForwarded_get_skimmed_fee_msat(ptr); const skimmed_fee_msat_hu_conv = Option_u64Z.constr_from_ptr(skimmed_fee_msat); CommonBase.add_ref_from(skimmed_fee_msat_hu_conv, this); this.skimmed_fee_msat = skimmed_fee_msat_hu_conv; this.claim_from_onchain_tx = bindings.LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(ptr); const outbound_amount_forwarded_msat = bindings.LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(ptr); const outbound_amount_forwarded_msat_hu_conv = Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat); CommonBase.add_ref_from(outbound_amount_forwarded_msat_hu_conv, this); this.outbound_amount_forwarded_msat = outbound_amount_forwarded_msat_hu_conv; } } /** A Event of type ChannelPending */ export class Event_ChannelPending extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const channel_id = bindings.LDKEvent_ChannelPending_get_channel_id(ptr); const channel_id_hu_conv = new ChannelId(null, channel_id); CommonBase.add_ref_from(channel_id_hu_conv, this); this.channel_id = channel_id_hu_conv; const user_channel_id = bindings.LDKEvent_ChannelPending_get_user_channel_id(ptr); const user_channel_id_conv = bindings.decodeUint128(user_channel_id); this.user_channel_id = user_channel_id_conv; const former_temporary_channel_id = bindings.LDKEvent_ChannelPending_get_former_temporary_channel_id(ptr); const former_temporary_channel_id_hu_conv = new ChannelId(null, former_temporary_channel_id); CommonBase.add_ref_from(former_temporary_channel_id_hu_conv, this); this.former_temporary_channel_id = former_temporary_channel_id_hu_conv; const counterparty_node_id = bindings.LDKEvent_ChannelPending_get_counterparty_node_id(ptr); const counterparty_node_id_conv = bindings.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; const funding_txo = bindings.LDKEvent_ChannelPending_get_funding_txo(ptr); const funding_txo_hu_conv = new OutPoint(null, funding_txo); CommonBase.add_ref_from(funding_txo_hu_conv, this); this.funding_txo = funding_txo_hu_conv; const channel_type = bindings.LDKEvent_ChannelPending_get_channel_type(ptr); const channel_type_hu_conv = new ChannelTypeFeatures(null, channel_type); CommonBase.add_ref_from(channel_type_hu_conv, this); this.channel_type = channel_type_hu_conv; } } /** A Event of type ChannelReady */ export class Event_ChannelReady extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const channel_id = bindings.LDKEvent_ChannelReady_get_channel_id(ptr); const channel_id_hu_conv = new ChannelId(null, channel_id); CommonBase.add_ref_from(channel_id_hu_conv, this); this.channel_id = channel_id_hu_conv; const user_channel_id = bindings.LDKEvent_ChannelReady_get_user_channel_id(ptr); const user_channel_id_conv = bindings.decodeUint128(user_channel_id); this.user_channel_id = user_channel_id_conv; const counterparty_node_id = bindings.LDKEvent_ChannelReady_get_counterparty_node_id(ptr); const counterparty_node_id_conv = bindings.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; const channel_type = bindings.LDKEvent_ChannelReady_get_channel_type(ptr); const channel_type_hu_conv = new ChannelTypeFeatures(null, channel_type); CommonBase.add_ref_from(channel_type_hu_conv, this); this.channel_type = channel_type_hu_conv; } } /** A Event of type ChannelClosed */ export class Event_ChannelClosed extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const channel_id = bindings.LDKEvent_ChannelClosed_get_channel_id(ptr); const channel_id_hu_conv = new ChannelId(null, channel_id); CommonBase.add_ref_from(channel_id_hu_conv, this); this.channel_id = channel_id_hu_conv; const user_channel_id = bindings.LDKEvent_ChannelClosed_get_user_channel_id(ptr); const user_channel_id_conv = bindings.decodeUint128(user_channel_id); this.user_channel_id = user_channel_id_conv; const reason = bindings.LDKEvent_ChannelClosed_get_reason(ptr); const reason_hu_conv = ClosureReason.constr_from_ptr(reason); CommonBase.add_ref_from(reason_hu_conv, this); this.reason = reason_hu_conv; const counterparty_node_id = bindings.LDKEvent_ChannelClosed_get_counterparty_node_id(ptr); const counterparty_node_id_conv = bindings.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; const channel_capacity_sats = bindings.LDKEvent_ChannelClosed_get_channel_capacity_sats(ptr); const channel_capacity_sats_hu_conv = Option_u64Z.constr_from_ptr(channel_capacity_sats); CommonBase.add_ref_from(channel_capacity_sats_hu_conv, this); this.channel_capacity_sats = channel_capacity_sats_hu_conv; const channel_funding_txo = bindings.LDKEvent_ChannelClosed_get_channel_funding_txo(ptr); const channel_funding_txo_hu_conv = new OutPoint(null, channel_funding_txo); CommonBase.add_ref_from(channel_funding_txo_hu_conv, this); this.channel_funding_txo = channel_funding_txo_hu_conv; const last_local_balance_msat = bindings.LDKEvent_ChannelClosed_get_last_local_balance_msat(ptr); const last_local_balance_msat_hu_conv = Option_u64Z.constr_from_ptr(last_local_balance_msat); CommonBase.add_ref_from(last_local_balance_msat_hu_conv, this); this.last_local_balance_msat = last_local_balance_msat_hu_conv; } } /** A Event of type DiscardFunding */ export class Event_DiscardFunding extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const channel_id = bindings.LDKEvent_DiscardFunding_get_channel_id(ptr); const channel_id_hu_conv = new ChannelId(null, channel_id); CommonBase.add_ref_from(channel_id_hu_conv, this); this.channel_id = channel_id_hu_conv; const funding_info = bindings.LDKEvent_DiscardFunding_get_funding_info(ptr); const funding_info_hu_conv = FundingInfo.constr_from_ptr(funding_info); CommonBase.add_ref_from(funding_info_hu_conv, this); this.funding_info = funding_info_hu_conv; } } /** A Event of type OpenChannelRequest */ export class Event_OpenChannelRequest extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const temporary_channel_id = bindings.LDKEvent_OpenChannelRequest_get_temporary_channel_id(ptr); const temporary_channel_id_hu_conv = new ChannelId(null, temporary_channel_id); CommonBase.add_ref_from(temporary_channel_id_hu_conv, this); this.temporary_channel_id = temporary_channel_id_hu_conv; const counterparty_node_id = bindings.LDKEvent_OpenChannelRequest_get_counterparty_node_id(ptr); const counterparty_node_id_conv = bindings.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; this.funding_satoshis = bindings.LDKEvent_OpenChannelRequest_get_funding_satoshis(ptr); const channel_negotiation_type = bindings.LDKEvent_OpenChannelRequest_get_channel_negotiation_type(ptr); const channel_negotiation_type_hu_conv = InboundChannelFunds.constr_from_ptr(channel_negotiation_type); CommonBase.add_ref_from(channel_negotiation_type_hu_conv, this); this.channel_negotiation_type = channel_negotiation_type_hu_conv; const channel_type = bindings.LDKEvent_OpenChannelRequest_get_channel_type(ptr); const channel_type_hu_conv = new ChannelTypeFeatures(null, channel_type); CommonBase.add_ref_from(channel_type_hu_conv, this); this.channel_type = channel_type_hu_conv; this.is_announced = bindings.LDKEvent_OpenChannelRequest_get_is_announced(ptr); const params = bindings.LDKEvent_OpenChannelRequest_get_params(ptr); const params_hu_conv = new ChannelParameters(null, params); CommonBase.add_ref_from(params_hu_conv, this); this.params = params_hu_conv; } } /** A Event of type HTLCHandlingFailed */ export class Event_HTLCHandlingFailed extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const prev_channel_id = bindings.LDKEvent_HTLCHandlingFailed_get_prev_channel_id(ptr); const prev_channel_id_hu_conv = new ChannelId(null, prev_channel_id); CommonBase.add_ref_from(prev_channel_id_hu_conv, this); this.prev_channel_id = prev_channel_id_hu_conv; const failed_next_destination = bindings.LDKEvent_HTLCHandlingFailed_get_failed_next_destination(ptr); const failed_next_destination_hu_conv = HTLCDestination.constr_from_ptr(failed_next_destination); CommonBase.add_ref_from(failed_next_destination_hu_conv, this); this.failed_next_destination = failed_next_destination_hu_conv; } } /** A Event of type BumpTransaction */ export class Event_BumpTransaction extends Event { /* @internal */ constructor(ptr) { super(null, ptr); const bump_transaction = bindings.LDKEvent_BumpTransaction_get_bump_transaction(ptr); const bump_transaction_hu_conv = BumpTransactionEvent.constr_from_ptr(bump_transaction); CommonBase.add_ref_from(bump_transaction_hu_conv, this); this.bump_transaction = bump_transaction_hu_conv; } } /** A Event of type OnionMessageIntercepted */ export class Event_OnionMessageIntercepted extends Event { /* @i