import CommonBase from './CommonBase.mjs';
import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
static new_impl(arg: ChannelMessageHandlerInterface, messageSendEventsProvider_impl: MessageSendEventsProviderInterface): ChannelMessageHandler {
const impl_holder: LDKChannelMessageHandlerHolder = new LDKChannelMessageHandlerHolder();
let structImplementation = {
- handle_open_channel (their_node_id: Uint8Array, their_features: number, msg: number): void {
+ handle_open_channel (their_node_id: number, their_features: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const their_features_hu_conv: InitFeatures = new InitFeatures(null, their_features);
CommonBase.add_ref_from(their_features_hu_conv, this);
const msg_hu_conv: OpenChannel = new OpenChannel(null, msg);
- arg.handle_open_channel(their_node_id, their_features_hu_conv, msg_hu_conv);
+ arg.handle_open_channel(their_node_id_conv, their_features_hu_conv, msg_hu_conv);
},
- handle_accept_channel (their_node_id: Uint8Array, their_features: number, msg: number): void {
+ handle_accept_channel (their_node_id: number, their_features: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const their_features_hu_conv: InitFeatures = new InitFeatures(null, their_features);
CommonBase.add_ref_from(their_features_hu_conv, this);
const msg_hu_conv: AcceptChannel = new AcceptChannel(null, msg);
- arg.handle_accept_channel(their_node_id, their_features_hu_conv, msg_hu_conv);
+ arg.handle_accept_channel(their_node_id_conv, their_features_hu_conv, msg_hu_conv);
},
- handle_funding_created (their_node_id: Uint8Array, msg: number): void {
+ handle_funding_created (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: FundingCreated = new FundingCreated(null, msg);
- arg.handle_funding_created(their_node_id, msg_hu_conv);
+ arg.handle_funding_created(their_node_id_conv, msg_hu_conv);
},
- handle_funding_signed (their_node_id: Uint8Array, msg: number): void {
+ handle_funding_signed (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: FundingSigned = new FundingSigned(null, msg);
- arg.handle_funding_signed(their_node_id, msg_hu_conv);
+ arg.handle_funding_signed(their_node_id_conv, msg_hu_conv);
},
- handle_funding_locked (their_node_id: Uint8Array, msg: number): void {
+ handle_funding_locked (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: FundingLocked = new FundingLocked(null, msg);
- arg.handle_funding_locked(their_node_id, msg_hu_conv);
+ arg.handle_funding_locked(their_node_id_conv, msg_hu_conv);
},
- handle_shutdown (their_node_id: Uint8Array, their_features: number, msg: number): void {
+ handle_shutdown (their_node_id: number, their_features: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const their_features_hu_conv: InitFeatures = new InitFeatures(null, their_features);
const msg_hu_conv: Shutdown = new Shutdown(null, msg);
- arg.handle_shutdown(their_node_id, their_features_hu_conv, msg_hu_conv);
+ arg.handle_shutdown(their_node_id_conv, their_features_hu_conv, msg_hu_conv);
},
- handle_closing_signed (their_node_id: Uint8Array, msg: number): void {
+ handle_closing_signed (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: ClosingSigned = new ClosingSigned(null, msg);
- arg.handle_closing_signed(their_node_id, msg_hu_conv);
+ arg.handle_closing_signed(their_node_id_conv, msg_hu_conv);
},
- handle_update_add_htlc (their_node_id: Uint8Array, msg: number): void {
+ handle_update_add_htlc (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: UpdateAddHTLC = new UpdateAddHTLC(null, msg);
- arg.handle_update_add_htlc(their_node_id, msg_hu_conv);
+ arg.handle_update_add_htlc(their_node_id_conv, msg_hu_conv);
},
- handle_update_fulfill_htlc (their_node_id: Uint8Array, msg: number): void {
+ handle_update_fulfill_htlc (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: UpdateFulfillHTLC = new UpdateFulfillHTLC(null, msg);
- arg.handle_update_fulfill_htlc(their_node_id, msg_hu_conv);
+ arg.handle_update_fulfill_htlc(their_node_id_conv, msg_hu_conv);
},
- handle_update_fail_htlc (their_node_id: Uint8Array, msg: number): void {
+ handle_update_fail_htlc (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: UpdateFailHTLC = new UpdateFailHTLC(null, msg);
- arg.handle_update_fail_htlc(their_node_id, msg_hu_conv);
+ arg.handle_update_fail_htlc(their_node_id_conv, msg_hu_conv);
},
- handle_update_fail_malformed_htlc (their_node_id: Uint8Array, msg: number): void {
+ handle_update_fail_malformed_htlc (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: UpdateFailMalformedHTLC = new UpdateFailMalformedHTLC(null, msg);
- arg.handle_update_fail_malformed_htlc(their_node_id, msg_hu_conv);
+ arg.handle_update_fail_malformed_htlc(their_node_id_conv, msg_hu_conv);
},
- handle_commitment_signed (their_node_id: Uint8Array, msg: number): void {
+ handle_commitment_signed (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: CommitmentSigned = new CommitmentSigned(null, msg);
- arg.handle_commitment_signed(their_node_id, msg_hu_conv);
+ arg.handle_commitment_signed(their_node_id_conv, msg_hu_conv);
},
- handle_revoke_and_ack (their_node_id: Uint8Array, msg: number): void {
+ handle_revoke_and_ack (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: RevokeAndACK = new RevokeAndACK(null, msg);
- arg.handle_revoke_and_ack(their_node_id, msg_hu_conv);
+ arg.handle_revoke_and_ack(their_node_id_conv, msg_hu_conv);
},
- handle_update_fee (their_node_id: Uint8Array, msg: number): void {
+ handle_update_fee (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: UpdateFee = new UpdateFee(null, msg);
- arg.handle_update_fee(their_node_id, msg_hu_conv);
+ arg.handle_update_fee(their_node_id_conv, msg_hu_conv);
},
- handle_announcement_signatures (their_node_id: Uint8Array, msg: number): void {
+ handle_announcement_signatures (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: AnnouncementSignatures = new AnnouncementSignatures(null, msg);
- arg.handle_announcement_signatures(their_node_id, msg_hu_conv);
+ arg.handle_announcement_signatures(their_node_id_conv, msg_hu_conv);
},
- peer_disconnected (their_node_id: Uint8Array, no_connection_possible: boolean): void {
- arg.peer_disconnected(their_node_id, no_connection_possible);
+ peer_disconnected (their_node_id: number, no_connection_possible: boolean): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
+ arg.peer_disconnected(their_node_id_conv, no_connection_possible);
},
- peer_connected (their_node_id: Uint8Array, msg: number): void {
+ peer_connected (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: Init = new Init(null, msg);
- arg.peer_connected(their_node_id, msg_hu_conv);
+ arg.peer_connected(their_node_id_conv, msg_hu_conv);
},
- handle_channel_reestablish (their_node_id: Uint8Array, msg: number): void {
+ handle_channel_reestablish (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: ChannelReestablish = new ChannelReestablish(null, msg);
- arg.handle_channel_reestablish(their_node_id, msg_hu_conv);
+ arg.handle_channel_reestablish(their_node_id_conv, msg_hu_conv);
},
- handle_channel_update (their_node_id: Uint8Array, msg: number): void {
+ handle_channel_update (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, msg);
- arg.handle_channel_update(their_node_id, msg_hu_conv);
+ arg.handle_channel_update(their_node_id_conv, msg_hu_conv);
},
- handle_error (their_node_id: Uint8Array, msg: number): void {
+ handle_error (their_node_id: number, msg: number): void {
+ const their_node_id_conv: Uint8Array = bindings.decodeUint8Array(their_node_id);
const msg_hu_conv: ErrorMessage = new ErrorMessage(null, msg);
- arg.handle_error(their_node_id, msg_hu_conv);
+ arg.handle_error(their_node_id_conv, msg_hu_conv);
},
} as bindings.LDKChannelMessageHandler;
const messageSendEventsProvider = MessageSendEventsProvider.new_impl(messageSendEventsProvider_impl, );
return impl_holder.held;
}
public handle_open_channel(their_node_id: Uint8Array, their_features: InitFeatures, msg: OpenChannel): void {
- bindings.ChannelMessageHandler_handle_open_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : CommonBase.get_ptr_of(their_features) & ~1, msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_open_channel(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), their_features == null ? 0 : CommonBase.get_ptr_of(their_features) & ~1, msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_accept_channel(their_node_id: Uint8Array, their_features: InitFeatures, msg: AcceptChannel): void {
- bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : CommonBase.get_ptr_of(their_features) & ~1, msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), their_features == null ? 0 : CommonBase.get_ptr_of(their_features) & ~1, msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_funding_created(their_node_id: Uint8Array, msg: FundingCreated): void {
- bindings.ChannelMessageHandler_handle_funding_created(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_funding_created(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_funding_signed(their_node_id: Uint8Array, msg: FundingSigned): void {
- bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_funding_locked(their_node_id: Uint8Array, msg: FundingLocked): void {
- bindings.ChannelMessageHandler_handle_funding_locked(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_funding_locked(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_shutdown(their_node_id: Uint8Array, their_features: InitFeatures, msg: Shutdown): void {
- bindings.ChannelMessageHandler_handle_shutdown(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : CommonBase.get_ptr_of(their_features) & ~1, msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_shutdown(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), their_features == null ? 0 : CommonBase.get_ptr_of(their_features) & ~1, msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, their_features);
CommonBase.add_ref_from(this, msg);
}
public handle_closing_signed(their_node_id: Uint8Array, msg: ClosingSigned): void {
- bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_update_add_htlc(their_node_id: Uint8Array, msg: UpdateAddHTLC): void {
- bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_update_fulfill_htlc(their_node_id: Uint8Array, msg: UpdateFulfillHTLC): void {
- bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_update_fail_htlc(their_node_id: Uint8Array, msg: UpdateFailHTLC): void {
- bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_update_fail_malformed_htlc(their_node_id: Uint8Array, msg: UpdateFailMalformedHTLC): void {
- bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_commitment_signed(their_node_id: Uint8Array, msg: CommitmentSigned): void {
- bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_revoke_and_ack(their_node_id: Uint8Array, msg: RevokeAndACK): void {
- bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_update_fee(their_node_id: Uint8Array, msg: UpdateFee): void {
- bindings.ChannelMessageHandler_handle_update_fee(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_update_fee(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_announcement_signatures(their_node_id: Uint8Array, msg: AnnouncementSignatures): void {
- bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public peer_disconnected(their_node_id: Uint8Array, no_connection_possible: boolean): void {
- bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), no_connection_possible);
+ bindings.ChannelMessageHandler_peer_disconnected(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), no_connection_possible);
}
public peer_connected(their_node_id: Uint8Array, msg: Init): void {
- bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_peer_connected(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_channel_reestablish(their_node_id: Uint8Array, msg: ChannelReestablish): void {
- bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_channel_update(their_node_id: Uint8Array, msg: ChannelUpdate): void {
- bindings.ChannelMessageHandler_handle_channel_update(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_channel_update(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}
public handle_error(their_node_id: Uint8Array, msg: ErrorMessage): void {
- bindings.ChannelMessageHandler_handle_error(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
+ bindings.ChannelMessageHandler_handle_error(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), msg == null ? 0 : CommonBase.get_ptr_of(msg) & ~1);
CommonBase.add_ref_from(this, msg);
}