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 CommitmentTransaction constructor_read(Uint8Array ser) {
34 number ret = bindings.CommitmentTransaction_read(ser);
35 const ret_hu_conv: CommitmentTransaction = new CommitmentTransaction(null, ret);
36 ret_hu_conv.ptrs_to.add(ret_hu_conv);
40 public number commitment_number() {
41 number ret = bindings.CommitmentTransaction_commitment_number(this.ptr);
45 public number to_broadcaster_value_sat() {
46 number ret = bindings.CommitmentTransaction_to_broadcaster_value_sat(this.ptr);
50 public number to_countersignatory_value_sat() {
51 number ret = bindings.CommitmentTransaction_to_countersignatory_value_sat(this.ptr);
55 public number feerate_per_kw() {
56 number ret = bindings.CommitmentTransaction_feerate_per_kw(this.ptr);
60 public TrustedCommitmentTransaction trust() {
61 number ret = bindings.CommitmentTransaction_trust(this.ptr);
62 const ret_hu_conv: TrustedCommitmentTransaction = new TrustedCommitmentTransaction(null, ret);
63 ret_hu_conv.ptrs_to.add(this);
67 public Result_TrustedCommitmentTransactionNoneZ verify(DirectedChannelTransactionParameters channel_parameters, ChannelPublicKeys broadcaster_keys, ChannelPublicKeys countersignatory_keys) {
68 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);
69 Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret);
70 this.ptrs_to.add(channel_parameters);
71 this.ptrs_to.add(broadcaster_keys);
72 this.ptrs_to.add(countersignatory_keys);