X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FChannelPublicKeys.mts;h=ccbfb8596c2ed5e6dd9c0989c46ba294c80b60f2;hp=b8bfccbdaed9ead526e1e65762c70852ba7e48db;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hpb=d1d0121c000b713c10fd0bedd249eb8dda2e4db7 diff --git a/ts/structs/ChannelPublicKeys.mts b/ts/structs/ChannelPublicKeys.mts index b8bfccbd..ccbfb859 100644 --- a/ts/structs/ChannelPublicKeys.mts +++ b/ts/structs/ChannelPublicKeys.mts @@ -281,62 +281,116 @@ import CommonBase from './CommonBase.mjs'; 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); @@ -349,6 +403,9 @@ export class ChannelPublicKeys extends CommonBase { 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); @@ -356,12 +413,18 @@ export class ChannelPublicKeys extends CommonBase { 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);