[TS] Update auto-generated TypeScript Bindings
[ldk-java] / ts / structs / ClosingTransaction.mts
index cf75b7fdffbb240244efa5e3d573469e4f3ed466..cd5ff8462655763703e5dd2217922664422a80ff 100644 (file)
@@ -279,9 +279,15 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor
 
 import CommonBase from './CommonBase.mjs';
 import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
 
 
+/**
+ * This class tracks the per-transaction information needed to build a closing transaction and will
+ * actually build it and sign.
+ * 
+ * This class can be used inside a signer implementation to generate a signature given the relevant
+ * secret key.
+ */
 export class ClosingTransaction extends CommonBase {
        /* @internal */
        public constructor(_dummy: object, ptr: number) {
@@ -293,6 +299,9 @@ export class ClosingTransaction extends CommonBase {
                return ret;
        }
 
+       /**
+        * Creates a copy of the ClosingTransaction
+        */
        public clone(): ClosingTransaction {
                const ret: number = bindings.ClosingTransaction_clone(this.ptr);
                const ret_hu_conv: ClosingTransaction = new ClosingTransaction(null, ret);
@@ -300,18 +309,32 @@ export class ClosingTransaction extends CommonBase {
                return ret_hu_conv;
        }
 
-       public hash(): number {
-               const ret: number = bindings.ClosingTransaction_hash(this.ptr);
+       /**
+        * Checks if two ClosingTransactions contain equal inner contents.
+        */
+       public hash(): bigint {
+               const ret: bigint = bindings.ClosingTransaction_hash(this.ptr);
                return ret;
        }
 
-       public static constructor_new(to_holder_value_sat: number, to_counterparty_value_sat: number, to_holder_script: Uint8Array, to_counterparty_script: Uint8Array, funding_outpoint: OutPoint): ClosingTransaction {
-               const ret: number = bindings.ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : CommonBase.get_ptr_of(funding_outpoint) & ~1);
+       /**
+        * Construct an object of the class
+        */
+       public static constructor_new(to_holder_value_sat: bigint, to_counterparty_value_sat: bigint, to_holder_script: Uint8Array, to_counterparty_script: Uint8Array, funding_outpoint: OutPoint): ClosingTransaction {
+               const ret: number = bindings.ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, bindings.encodeUint8Array(to_holder_script), bindings.encodeUint8Array(to_counterparty_script), funding_outpoint == null ? 0 : CommonBase.get_ptr_of(funding_outpoint) & ~1);
                const ret_hu_conv: ClosingTransaction = new ClosingTransaction(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
                return ret_hu_conv;
        }
 
+       /**
+        * Trust our pre-built transaction.
+        * 
+        * Applies a wrapper which allows access to the transaction.
+        * 
+        * This should only be used if you fully trust the builder of this object. It should not
+        * be used by an external signer - instead use the verify function.
+        */
        public trust(): TrustedClosingTransaction {
                const ret: number = bindings.ClosingTransaction_trust(this.ptr);
                const ret_hu_conv: TrustedClosingTransaction = new TrustedClosingTransaction(null, ret);
@@ -319,30 +342,52 @@ export class ClosingTransaction extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Verify our pre-built transaction.
+        * 
+        * Applies a wrapper which allows access to the transaction.
+        * 
+        * An external validating signer must call this method before signing
+        * or using the built transaction.
+        */
        public verify(funding_outpoint: OutPoint): Result_TrustedClosingTransactionNoneZ {
                const ret: number = bindings.ClosingTransaction_verify(this.ptr, funding_outpoint == null ? 0 : CommonBase.get_ptr_of(funding_outpoint) & ~1);
                const ret_hu_conv: Result_TrustedClosingTransactionNoneZ = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
 
-       public to_holder_value_sat(): number {
-               const ret: number = bindings.ClosingTransaction_to_holder_value_sat(this.ptr);
+       /**
+        * The value to be sent to the holder, or zero if the output will be omitted
+        */
+       public to_holder_value_sat(): bigint {
+               const ret: bigint = bindings.ClosingTransaction_to_holder_value_sat(this.ptr);
                return ret;
        }
 
-       public to_counterparty_value_sat(): number {
-               const ret: number = bindings.ClosingTransaction_to_counterparty_value_sat(this.ptr);
+       /**
+        * The value to be sent to the counterparty, or zero if the output will be omitted
+        */
+       public to_counterparty_value_sat(): bigint {
+               const ret: bigint = bindings.ClosingTransaction_to_counterparty_value_sat(this.ptr);
                return ret;
        }
 
+       /**
+        * The destination of the holder's output
+        */
        public to_holder_script(): Uint8Array {
-               const ret: Uint8Array = bindings.ClosingTransaction_to_holder_script(this.ptr);
-               return ret;
+               const ret: number = bindings.ClosingTransaction_to_holder_script(this.ptr);
+               const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+               return ret_conv;
        }
 
+       /**
+        * The destination of the counterparty's output
+        */
        public to_counterparty_script(): Uint8Array {
-               const ret: Uint8Array = bindings.ClosingTransaction_to_counterparty_script(this.ptr);
-               return ret;
+               const ret: number = bindings.ClosingTransaction_to_counterparty_script(this.ptr);
+               const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
+               return ret_conv;
        }
 
 }