]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/CommitmentTransaction.ts
Merge pull request #46 from TheBlueMatt/main
[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 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);
36                 return ret_hu_conv;
37         }
38
39         public number commitment_number() {
40                 number ret = bindings.CommitmentTransaction_commitment_number(this.ptr);
41                 return ret;
42         }
43
44         public number to_broadcaster_value_sat() {
45                 number ret = bindings.CommitmentTransaction_to_broadcaster_value_sat(this.ptr);
46                 return ret;
47         }
48
49         public number to_countersignatory_value_sat() {
50                 number ret = bindings.CommitmentTransaction_to_countersignatory_value_sat(this.ptr);
51                 return ret;
52         }
53
54         public number feerate_per_kw() {
55                 number ret = bindings.CommitmentTransaction_feerate_per_kw(this.ptr);
56                 return ret;
57         }
58
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);
63                 return ret_hu_conv;
64         }
65
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);
72                 return ret_hu_conv;
73         }
74
75 }