[TS] Update auto-generated TypeScript Bindings
[ldk-java] / ts / structs / ChannelManagerReadArgs.mts
index f1728af4408ddb78d9b62c2b8e5416d054cf2bc2..61e830b125557736c8525d9a3e4f689e69611dd4 100644 (file)
@@ -281,12 +281,51 @@ import CommonBase from './CommonBase.mjs';
 import * as bindings from '../bindings.mjs'
 
 
+/**
+ * Arguments for the creation of a ChannelManager that are not deserialized.
+ * 
+ * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
+ * is:
+ * 1) Deserialize all stored [`ChannelMonitor`]s.
+ * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
+ * `<(BlockHash, ChannelManager)>::read(reader, args)`
+ * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
+ * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
+ * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
+ * same way you would handle a [`chain::Filter`] call using
+ * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
+ * 4) Reconnect blocks on your [`ChannelMonitor`]s.
+ * 5) Disconnect/connect blocks on the [`ChannelManager`].
+ * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
+ * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
+ * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
+ * the next step.
+ * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
+ * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
+ * 
+ * Note that the ordering of #4-7 is not of importance, however all four must occur before you
+ * call any other methods on the newly-deserialized [`ChannelManager`].
+ * 
+ * Note that because some channels may be closed during deserialization, it is critical that you
+ * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
+ * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
+ * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
+ * not force-close the same channels but consider them live), you may end up revoking a state for
+ * which you've already broadcasted the transaction.
+ * 
+ * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
+ */
 export class ChannelManagerReadArgs extends CommonBase {
        /* @internal */
        public constructor(_dummy: object, ptr: number) {
                super(ptr, bindings.ChannelManagerReadArgs_free);
        }
 
+       /**
+        * The keys provider which will give us relevant keys. Some keys will be loaded during
+        * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
+        * signing data.
+        */
        public get_keys_manager(): KeysInterface {
                const ret: number = bindings.ChannelManagerReadArgs_get_keys_manager(this.ptr);
                const ret_hu_conv: KeysInterface = new KeysInterface(null, ret);
@@ -294,11 +333,21 @@ export class ChannelManagerReadArgs extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * The keys provider which will give us relevant keys. Some keys will be loaded during
+        * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
+        * signing data.
+        */
        public set_keys_manager(val: KeysInterface): void {
                bindings.ChannelManagerReadArgs_set_keys_manager(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val));
                CommonBase.add_ref_from(this, val);
        }
 
+       /**
+        * The fee_estimator for use in the ChannelManager in the future.
+        * 
+        * No calls to the FeeEstimator will be made during deserialization.
+        */
        public get_fee_estimator(): FeeEstimator {
                const ret: number = bindings.ChannelManagerReadArgs_get_fee_estimator(this.ptr);
                const ret_hu_conv: FeeEstimator = new FeeEstimator(null, ret);
@@ -306,11 +355,23 @@ export class ChannelManagerReadArgs extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * The fee_estimator for use in the ChannelManager in the future.
+        * 
+        * No calls to the FeeEstimator will be made during deserialization.
+        */
        public set_fee_estimator(val: FeeEstimator): void {
                bindings.ChannelManagerReadArgs_set_fee_estimator(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val));
                CommonBase.add_ref_from(this, val);
        }
 
+       /**
+        * The chain::Watch for use in the ChannelManager in the future.
+        * 
+        * No calls to the chain::Watch will be made during deserialization. It is assumed that
+        * you have deserialized ChannelMonitors separately and will add them to your
+        * chain::Watch after deserializing this ChannelManager.
+        */
        public get_chain_monitor(): Watch {
                const ret: number = bindings.ChannelManagerReadArgs_get_chain_monitor(this.ptr);
                const ret_hu_conv: Watch = new Watch(null, ret);
@@ -318,11 +379,23 @@ export class ChannelManagerReadArgs extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * The chain::Watch for use in the ChannelManager in the future.
+        * 
+        * No calls to the chain::Watch will be made during deserialization. It is assumed that
+        * you have deserialized ChannelMonitors separately and will add them to your
+        * chain::Watch after deserializing this ChannelManager.
+        */
        public set_chain_monitor(val: Watch): void {
                bindings.ChannelManagerReadArgs_set_chain_monitor(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val));
                CommonBase.add_ref_from(this, val);
        }
 
+       /**
+        * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
+        * used to broadcast the latest local commitment transactions of channels which must be
+        * force-closed during deserialization.
+        */
        public get_tx_broadcaster(): BroadcasterInterface {
                const ret: number = bindings.ChannelManagerReadArgs_get_tx_broadcaster(this.ptr);
                const ret_hu_conv: BroadcasterInterface = new BroadcasterInterface(null, ret);
@@ -330,11 +403,20 @@ export class ChannelManagerReadArgs extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
+        * used to broadcast the latest local commitment transactions of channels which must be
+        * force-closed during deserialization.
+        */
        public set_tx_broadcaster(val: BroadcasterInterface): void {
                bindings.ChannelManagerReadArgs_set_tx_broadcaster(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val));
                CommonBase.add_ref_from(this, val);
        }
 
+       /**
+        * The Logger for use in the ChannelManager and which may be used to log information during
+        * deserialization.
+        */
        public get_logger(): Logger {
                const ret: number = bindings.ChannelManagerReadArgs_get_logger(this.ptr);
                const ret_hu_conv: Logger = new Logger(null, ret);
@@ -342,11 +424,19 @@ export class ChannelManagerReadArgs extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * The Logger for use in the ChannelManager and which may be used to log information during
+        * deserialization.
+        */
        public set_logger(val: Logger): void {
                bindings.ChannelManagerReadArgs_set_logger(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val));
                CommonBase.add_ref_from(this, val);
        }
 
+       /**
+        * Default settings used for new channels. Any existing channels will continue to use the
+        * runtime settings which were stored when the ChannelManager was serialized.
+        */
        public get_default_config(): UserConfig {
                const ret: number = bindings.ChannelManagerReadArgs_get_default_config(this.ptr);
                const ret_hu_conv: UserConfig = new UserConfig(null, ret);
@@ -354,10 +444,19 @@ export class ChannelManagerReadArgs extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Default settings used for new channels. Any existing channels will continue to use the
+        * runtime settings which were stored when the ChannelManager was serialized.
+        */
        public set_default_config(val: UserConfig): void {
                bindings.ChannelManagerReadArgs_set_default_config(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val) & ~1);
        }
 
+       /**
+        * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
+        * HashMap for you. This is primarily useful for C bindings where it is not practical to
+        * populate a HashMap directly from C.
+        */
        public static constructor_new(keys_manager: KeysInterface, fee_estimator: FeeEstimator, chain_monitor: Watch, tx_broadcaster: BroadcasterInterface, logger: Logger, default_config: UserConfig, channel_monitors: ChannelMonitor[]): ChannelManagerReadArgs {
                const ret: number = bindings.ChannelManagerReadArgs_new(keys_manager == null ? 0 : CommonBase.get_ptr_of(keys_manager), fee_estimator == null ? 0 : CommonBase.get_ptr_of(fee_estimator), chain_monitor == null ? 0 : CommonBase.get_ptr_of(chain_monitor), tx_broadcaster == null ? 0 : CommonBase.get_ptr_of(tx_broadcaster), logger == null ? 0 : CommonBase.get_ptr_of(logger), default_config == null ? 0 : CommonBase.get_ptr_of(default_config) & ~1, bindings.encodeUint32Array(channel_monitors != null ? channel_monitors.map(channel_monitors_conv_16 => channel_monitors_conv_16 == null ? 0 : CommonBase.get_ptr_of(channel_monitors_conv_16) & ~1) : null));
                const ret_hu_conv: ChannelManagerReadArgs = new ChannelManagerReadArgs(null, ret);