]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/CommitmentUpdate.ts
Support new cloned upstream API instead of clone
[ldk-java] / ts / structs / CommitmentUpdate.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 CommitmentUpdate 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.CommitmentUpdate_free(this.ptr);
19                     }
20                 }
21         public void set_update_add_htlcs(UpdateAddHTLC[] val) {
22                 bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, Arrays.stream(val).map(val_conv_15 -> val_conv_15 == null ? 0 : val_conv_15.ptr & ~1).toArray(number[]::new));
23                 /* TODO 2 UpdateAddHTLC  */;
24         }
25
26         public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) {
27                 bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, Arrays.stream(val).map(val_conv_19 -> val_conv_19 == null ? 0 : val_conv_19.ptr & ~1).toArray(number[]::new));
28                 /* TODO 2 UpdateFulfillHTLC  */;
29         }
30
31         public void set_update_fail_htlcs(UpdateFailHTLC[] val) {
32                 bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, Arrays.stream(val).map(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr & ~1).toArray(number[]::new));
33                 /* TODO 2 UpdateFailHTLC  */;
34         }
35
36         public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) {
37                 bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, Arrays.stream(val).map(val_conv_25 -> val_conv_25 == null ? 0 : val_conv_25.ptr & ~1).toArray(number[]::new));
38                 /* TODO 2 UpdateFailMalformedHTLC  */;
39         }
40
41         public UpdateFee get_update_fee() {
42                 number ret = bindings.CommitmentUpdate_get_update_fee(this.ptr);
43                 const ret_hu_conv: UpdateFee = new UpdateFee(null, ret);
44                 ret_hu_conv.ptrs_to.add(this);
45                 return ret_hu_conv;
46         }
47
48         public void set_update_fee(UpdateFee val) {
49                 bindings.CommitmentUpdate_set_update_fee(this.ptr, val == null ? 0 : val.ptr & ~1);
50                 this.ptrs_to.add(val);
51         }
52
53         public CommitmentSigned get_commitment_signed() {
54                 number ret = bindings.CommitmentUpdate_get_commitment_signed(this.ptr);
55                 const ret_hu_conv: CommitmentSigned = new CommitmentSigned(null, ret);
56                 ret_hu_conv.ptrs_to.add(this);
57                 return ret_hu_conv;
58         }
59
60         public void set_commitment_signed(CommitmentSigned val) {
61                 bindings.CommitmentUpdate_set_commitment_signed(this.ptr, val == null ? 0 : val.ptr & ~1);
62                 this.ptrs_to.add(val);
63         }
64
65         public static CommitmentUpdate constructor_new(UpdateAddHTLC[] update_add_htlcs_arg, UpdateFulfillHTLC[] update_fulfill_htlcs_arg, UpdateFailHTLC[] update_fail_htlcs_arg, UpdateFailMalformedHTLC[] update_fail_malformed_htlcs_arg, UpdateFee update_fee_arg, CommitmentSigned commitment_signed_arg) {
66                 number ret = bindings.CommitmentUpdate_new(Arrays.stream(update_add_htlcs_arg).map(update_add_htlcs_arg_conv_15 -> update_add_htlcs_arg_conv_15 == null ? 0 : update_add_htlcs_arg_conv_15.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fulfill_htlcs_arg).map(update_fulfill_htlcs_arg_conv_19 -> update_fulfill_htlcs_arg_conv_19 == null ? 0 : update_fulfill_htlcs_arg_conv_19.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fail_htlcs_arg).map(update_fail_htlcs_arg_conv_16 -> update_fail_htlcs_arg_conv_16 == null ? 0 : update_fail_htlcs_arg_conv_16.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fail_malformed_htlcs_arg).map(update_fail_malformed_htlcs_arg_conv_25 -> update_fail_malformed_htlcs_arg_conv_25 == null ? 0 : update_fail_malformed_htlcs_arg_conv_25.ptr & ~1).toArray(number[]::new), update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1);
67                 const ret_hu_conv: CommitmentUpdate = new CommitmentUpdate(null, ret);
68                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
69                 /* TODO 2 UpdateAddHTLC  */;
70                 /* TODO 2 UpdateFulfillHTLC  */;
71                 /* TODO 2 UpdateFailHTLC  */;
72                 /* TODO 2 UpdateFailMalformedHTLC  */;
73                 ret_hu_conv.ptrs_to.add(update_fee_arg);
74                 ret_hu_conv.ptrs_to.add(commitment_signed_arg);
75                 return ret_hu_conv;
76         }
77
78         public CommitmentUpdate clone() {
79                 number ret = bindings.CommitmentUpdate_clone(this.ptr);
80                 const ret_hu_conv: CommitmentUpdate = new CommitmentUpdate(null, ret);
81                 ret_hu_conv.ptrs_to.add(this);
82                 return ret_hu_conv;
83         }
84
85 }