]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/CommitmentTransaction.ts
bindings updates
[ldk-java] / ts / structs / CommitmentTransaction.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export default class CommitmentTransaction extends CommonBase {
9                 constructor(_dummy: object, ptr: number) {
10                     super(ptr);
11                 }
12
13                 
14                 protected finalize() {
15                     super.finalize();
16
17                     if (this.ptr != 0) {
18                         bindings.CommitmentTransaction_free(this.ptr);
19                     }
20                 }
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);
25                 return ret_hu_conv;
26         }
27
28         public Uint8Array write() {
29                 Uint8Array ret = bindings.CommitmentTransaction_write(this.ptr);
30                 return ret;
31         }
32
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);
37                 return ret_hu_conv;
38         }
39
40         public number commitment_number() {
41                 number ret = bindings.CommitmentTransaction_commitment_number(this.ptr);
42                 return ret;
43         }
44
45         public number to_broadcaster_value_sat() {
46                 number ret = bindings.CommitmentTransaction_to_broadcaster_value_sat(this.ptr);
47                 return ret;
48         }
49
50         public number to_countersignatory_value_sat() {
51                 number ret = bindings.CommitmentTransaction_to_countersignatory_value_sat(this.ptr);
52                 return ret;
53         }
54
55         public number feerate_per_kw() {
56                 number ret = bindings.CommitmentTransaction_feerate_per_kw(this.ptr);
57                 return ret;
58         }
59
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);
64                 return ret_hu_conv;
65         }
66
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);
73                 return ret_hu_conv;
74         }
75
76 }