UNPKG

lightningdevkit

Version:
95 lines 3.66 kB
import { Result_CommitmentSignedBatchDecodeErrorZ } from '../structs/Result_CommitmentSignedBatchDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs'; /** * Optional batch parameters for `commitment_signed` message. */ export class CommitmentSignedBatch extends CommonBase { /* @internal */ constructor(_dummy, ptr) { super(ptr, bindings.CommitmentSignedBatch_free); } /** * Batch size N: all N `commitment_signed` messages must be received before being processed */ get_batch_size() { const ret = bindings.CommitmentSignedBatch_get_batch_size(this.ptr); return ret; } /** * Batch size N: all N `commitment_signed` messages must be received before being processed */ set_batch_size(val) { bindings.CommitmentSignedBatch_set_batch_size(this.ptr, val); } /** * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) */ get_funding_txid() { const ret = bindings.CommitmentSignedBatch_get_funding_txid(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) */ set_funding_txid(val) { bindings.CommitmentSignedBatch_set_funding_txid(this.ptr, bindings.encodeUint8Array(val)); } /** * Constructs a new CommitmentSignedBatch given each field */ static constructor_new(batch_size_arg, funding_txid_arg) { const ret = bindings.CommitmentSignedBatch_new(batch_size_arg, bindings.encodeUint8Array(funding_txid_arg)); const ret_hu_conv = new CommitmentSignedBatch(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); return ret_hu_conv; } clone_ptr() { const ret = bindings.CommitmentSignedBatch_clone_ptr(this.ptr); return ret; } /** * Creates a copy of the CommitmentSignedBatch */ clone() { const ret = bindings.CommitmentSignedBatch_clone(this.ptr); const ret_hu_conv = new CommitmentSignedBatch(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; } /** * Generates a non-cryptographic 64-bit hash of the CommitmentSignedBatch. */ hash() { const ret = bindings.CommitmentSignedBatch_hash(this.ptr); return ret; } /** * Checks if two CommitmentSignedBatchs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ eq(b) { const ret = bindings.CommitmentSignedBatch_eq(this.ptr, CommonBase.get_ptr_of(b)); CommonBase.add_ref_from(this, b); return ret; } /** * Serialize the CommitmentSignedBatch object into a byte array which can be read by CommitmentSignedBatch_read */ write() { const ret = bindings.CommitmentSignedBatch_write(this.ptr); const ret_conv = bindings.decodeUint8Array(ret); return ret_conv; } /** * Read a CommitmentSignedBatch from a byte array, created by CommitmentSignedBatch_write */ static constructor_read(ser) { const ret = bindings.CommitmentSignedBatch_read(bindings.encodeUint8Array(ser)); const ret_hu_conv = Result_CommitmentSignedBatchDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } } //# sourceMappingURL=CommitmentSignedBatch.mjs.map