X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FChainParameters.mts;h=89e859e01dce69a896c2a70053230ec69cf82a61;hp=5051f2959fa29df0ecc1edb2198c8d536a864803;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hpb=d1d0121c000b713c10fd0bedd249eb8dda2e4db7 diff --git a/ts/structs/ChainParameters.mts b/ts/structs/ChainParameters.mts index 5051f295..89e859e0 100644 --- a/ts/structs/ChainParameters.mts +++ b/ts/structs/ChainParameters.mts @@ -281,21 +281,39 @@ import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' +/** + * Chain-related parameters used to construct a new `ChannelManager`. + * + * Typically, the block-specific parameters are derived from the best block hash for the network, + * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters + * are not needed when deserializing a previously constructed `ChannelManager`. + */ export class ChainParameters extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { super(ptr, bindings.ChainParameters_free); } + /** + * The network for determining the `chain_hash` in Lightning messages. + */ public get_network(): Network { const ret: Network = bindings.ChainParameters_get_network(this.ptr); return ret; } + /** + * The network for determining the `chain_hash` in Lightning messages. + */ public set_network(val: Network): void { bindings.ChainParameters_set_network(this.ptr, val); } + /** + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + */ public get_best_block(): BestBlock { const ret: number = bindings.ChainParameters_get_best_block(this.ptr); const ret_hu_conv: BestBlock = new BestBlock(null, ret); @@ -303,10 +321,18 @@ export class ChainParameters extends CommonBase { return ret_hu_conv; } + /** + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + */ public set_best_block(val: BestBlock): void { bindings.ChainParameters_set_best_block(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val) & ~1); } + /** + * Constructs a new ChainParameters given each field + */ public static constructor_new(network_arg: Network, best_block_arg: BestBlock): ChainParameters { const ret: number = bindings.ChainParameters_new(network_arg, best_block_arg == null ? 0 : CommonBase.get_ptr_of(best_block_arg) & ~1); const ret_hu_conv: ChainParameters = new ChainParameters(null, ret); @@ -319,6 +345,9 @@ export class ChainParameters extends CommonBase { return ret; } + /** + * Creates a copy of the ChainParameters + */ public clone(): ChainParameters { const ret: number = bindings.ChainParameters_clone(this.ptr); const ret_hu_conv: ChainParameters = new ChainParameters(null, ret);