3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class CommitmentTransaction extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.CommitmentTransaction_free(this.ptr);
21 public CommitmentTransaction clone() {
22 number ret = bindings.CommitmentTransaction_clone(this.ptr);
23 const ret_hu_conv: CommitmentTransaction = new CommitmentTransaction(null, ret);
24 ret_hu_conv.ptrs_to.add(this);
28 public Uint8Array write() {
29 Uint8Array ret = bindings.CommitmentTransaction_write(this.ptr);
33 public static Result_CommitmentTransactionDecodeErrorZ constructor_read(Uint8Array ser) {
34 number ret = bindings.CommitmentTransaction_read(ser);
35 Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret);
39 public number commitment_number() {
40 number ret = bindings.CommitmentTransaction_commitment_number(this.ptr);
44 public number to_broadcaster_value_sat() {
45 number ret = bindings.CommitmentTransaction_to_broadcaster_value_sat(this.ptr);
49 public number to_countersignatory_value_sat() {
50 number ret = bindings.CommitmentTransaction_to_countersignatory_value_sat(this.ptr);
54 public number feerate_per_kw() {
55 number ret = bindings.CommitmentTransaction_feerate_per_kw(this.ptr);
59 public TrustedCommitmentTransaction trust() {
60 number ret = bindings.CommitmentTransaction_trust(this.ptr);
61 const ret_hu_conv: TrustedCommitmentTransaction = new TrustedCommitmentTransaction(null, ret);
62 ret_hu_conv.ptrs_to.add(this);
66 public Result_TrustedCommitmentTransactionNoneZ verify(DirectedChannelTransactionParameters channel_parameters, ChannelPublicKeys broadcaster_keys, ChannelPublicKeys countersignatory_keys) {
67 number ret = bindings.CommitmentTransaction_verify(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1, broadcaster_keys == null ? 0 : broadcaster_keys.ptr & ~1, countersignatory_keys == null ? 0 : countersignatory_keys.ptr & ~1);
68 Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret);
69 this.ptrs_to.add(channel_parameters);
70 this.ptrs_to.add(broadcaster_keys);
71 this.ptrs_to.add(countersignatory_keys);