]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/HolderCommitmentTransaction.ts
Handle `uintptr_t`s better in JNI bindings
[ldk-java] / ts / structs / HolderCommitmentTransaction.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 HolderCommitmentTransaction 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.HolderCommitmentTransaction_free(this.ptr);
19                     }
20                 }
21         public HolderCommitmentTransaction clone() {
22                 number ret = bindings.HolderCommitmentTransaction_clone(this.ptr);
23                 const ret_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, ret);
24                 ret_hu_conv.ptrs_to.add(this);
25                 return ret_hu_conv;
26         }
27
28         public Uint8Array get_counterparty_sig() {
29                 Uint8Array ret = bindings.HolderCommitmentTransaction_get_counterparty_sig(this.ptr);
30                 return ret;
31         }
32
33         public void set_counterparty_sig(Uint8Array val) {
34                 bindings.HolderCommitmentTransaction_set_counterparty_sig(this.ptr, val);
35         }
36
37         public void set_counterparty_htlc_sigs(Uint8Array[] val) {
38                 bindings.HolderCommitmentTransaction_set_counterparty_htlc_sigs(this.ptr, val);
39         }
40
41         public Uint8Array write() {
42                 Uint8Array ret = bindings.HolderCommitmentTransaction_write(this.ptr);
43                 return ret;
44         }
45
46         public static HolderCommitmentTransaction constructor_read(Uint8Array ser) {
47                 number ret = bindings.HolderCommitmentTransaction_read(ser);
48                 const ret_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, ret);
49                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
50                 return ret_hu_conv;
51         }
52
53         public static HolderCommitmentTransaction constructor_new(CommitmentTransaction commitment_tx, Uint8Array counterparty_sig, Uint8Array[] counterparty_htlc_sigs, Uint8Array holder_funding_key, Uint8Array counterparty_funding_key) {
54                 number ret = bindings.HolderCommitmentTransaction_new(commitment_tx == null ? 0 : commitment_tx.ptr & ~1, counterparty_sig, counterparty_htlc_sigs, holder_funding_key, counterparty_funding_key);
55                 const ret_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, ret);
56                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
57                 ret_hu_conv.ptrs_to.add(commitment_tx);
58                 return ret_hu_conv;
59         }
60
61 }