import * as bindings from '../bindings.mjs'
+/**
+ * One counterparty's public keys which do not change over the life of a channel.
+ */
export class ChannelPublicKeys extends CommonBase {
/* @internal */
public constructor(_dummy: object, ptr: number) {
super(ptr, bindings.ChannelPublicKeys_free);
}
+ /**
+ * The public key which is used to sign all commitment transactions, as it appears in the
+ * on-chain channel lock-in 2-of-2 multisig output.
+ */
public get_funding_pubkey(): Uint8Array {
const ret: number = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr);
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
+ /**
+ * The public key which is used to sign all commitment transactions, as it appears in the
+ * on-chain channel lock-in 2-of-2 multisig output.
+ */
public set_funding_pubkey(val: Uint8Array): void {
bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
}
+ /**
+ * The base point which is used (with derive_public_revocation_key) to derive per-commitment
+ * revocation keys. This is combined with the per-commitment-secret generated by the
+ * counterparty to create a secret which the counterparty can reveal to revoke previous
+ * states.
+ */
public get_revocation_basepoint(): Uint8Array {
const ret: number = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
+ /**
+ * The base point which is used (with derive_public_revocation_key) to derive per-commitment
+ * revocation keys. This is combined with the per-commitment-secret generated by the
+ * counterparty to create a secret which the counterparty can reveal to revoke previous
+ * states.
+ */
public set_revocation_basepoint(val: Uint8Array): void {
bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
}
+ /**
+ * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
+ * spendable primary channel balance on the broadcaster's commitment transaction. This key is
+ * static across every commitment transaction.
+ */
public get_payment_point(): Uint8Array {
const ret: number = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
+ /**
+ * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
+ * spendable primary channel balance on the broadcaster's commitment transaction. This key is
+ * static across every commitment transaction.
+ */
public set_payment_point(val: Uint8Array): void {
bindings.ChannelPublicKeys_set_payment_point(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
}
+ /**
+ * The base point which is used (with derive_public_key) to derive a per-commitment payment
+ * public key which receives non-HTLC-encumbered funds which are only available for spending
+ * after some delay (or can be claimed via the revocation path).
+ */
public get_delayed_payment_basepoint(): Uint8Array {
const ret: number = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
+ /**
+ * The base point which is used (with derive_public_key) to derive a per-commitment payment
+ * public key which receives non-HTLC-encumbered funds which are only available for spending
+ * after some delay (or can be claimed via the revocation path).
+ */
public set_delayed_payment_basepoint(val: Uint8Array): void {
bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
}
+ /**
+ * The base point which is used (with derive_public_key) to derive a per-commitment public key
+ * which is used to encumber HTLC-in-flight outputs.
+ */
public get_htlc_basepoint(): Uint8Array {
const ret: number = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
+ /**
+ * The base point which is used (with derive_public_key) to derive a per-commitment public key
+ * which is used to encumber HTLC-in-flight outputs.
+ */
public set_htlc_basepoint(val: Uint8Array): void {
bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
}
+ /**
+ * Constructs a new ChannelPublicKeys given each field
+ */
public static constructor_new(funding_pubkey_arg: Uint8Array, revocation_basepoint_arg: Uint8Array, payment_point_arg: Uint8Array, delayed_payment_basepoint_arg: Uint8Array, htlc_basepoint_arg: Uint8Array): ChannelPublicKeys {
const ret: number = bindings.ChannelPublicKeys_new(bindings.encodeUint8Array(bindings.check_arr_len(funding_pubkey_arg, 33)), bindings.encodeUint8Array(bindings.check_arr_len(revocation_basepoint_arg, 33)), bindings.encodeUint8Array(bindings.check_arr_len(payment_point_arg, 33)), bindings.encodeUint8Array(bindings.check_arr_len(delayed_payment_basepoint_arg, 33)), bindings.encodeUint8Array(bindings.check_arr_len(htlc_basepoint_arg, 33)));
const ret_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, ret);
return ret;
}
+ /**
+ * Creates a copy of the ChannelPublicKeys
+ */
public clone(): ChannelPublicKeys {
const ret: number = bindings.ChannelPublicKeys_clone(this.ptr);
const ret_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, ret);
return ret_hu_conv;
}
+ /**
+ * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
+ */
public write(): Uint8Array {
const ret: number = bindings.ChannelPublicKeys_write(this.ptr);
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
return ret_conv;
}
+ /**
+ * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
+ */
public static constructor_read(ser: Uint8Array): Result_ChannelPublicKeysDecodeErrorZ {
const ret: number = bindings.ChannelPublicKeys_read(bindings.encodeUint8Array(ser));
const ret_hu_conv: Result_ChannelPublicKeysDecodeErrorZ = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);