]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/ClosureReason.ts
Update auto-generated bindings to 0.0.103
[ldk-java] / ts / structs / ClosureReason.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class ClosureReason extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.ClosureReason_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): ClosureReason {
12                 const raw_val: bindings.LDKClosureReason = bindings.LDKClosureReason_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKClosureReason.CounterpartyForceClosed) {
14                         return new CounterpartyForceClosed(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKClosureReason.HolderForceClosed) {
17                         return new HolderForceClosed(this.ptr, raw_val);
18                 }
19                 if (raw_val instanceof bindings.LDKClosureReason.CooperativeClosure) {
20                         return new CooperativeClosure(this.ptr, raw_val);
21                 }
22                 if (raw_val instanceof bindings.LDKClosureReason.CommitmentTxConfirmed) {
23                         return new CommitmentTxConfirmed(this.ptr, raw_val);
24                 }
25                 if (raw_val instanceof bindings.LDKClosureReason.ProcessingError) {
26                         return new ProcessingError(this.ptr, raw_val);
27                 }
28                 if (raw_val instanceof bindings.LDKClosureReason.DisconnectedPeer) {
29                         return new DisconnectedPeer(this.ptr, raw_val);
30                 }
31                 if (raw_val instanceof bindings.LDKClosureReason.OutdatedChannelManager) {
32                         return new OutdatedChannelManager(this.ptr, raw_val);
33                 }
34                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
35         }
36
37 }
38 export class CounterpartyForceClosed extends ClosureReason {
39         public peer_msg: String;
40         private constructor(ptr: number, obj: bindings.LDKClosureReason.CounterpartyForceClosed) {
41                 super(null, ptr);
42                 this.peer_msg = obj.peer_msg;
43         }
44 }
45 export class HolderForceClosed extends ClosureReason {
46         private constructor(ptr: number, obj: bindings.LDKClosureReason.HolderForceClosed) {
47                 super(null, ptr);
48         }
49 }
50 export class CooperativeClosure extends ClosureReason {
51         private constructor(ptr: number, obj: bindings.LDKClosureReason.CooperativeClosure) {
52                 super(null, ptr);
53         }
54 }
55 export class CommitmentTxConfirmed extends ClosureReason {
56         private constructor(ptr: number, obj: bindings.LDKClosureReason.CommitmentTxConfirmed) {
57                 super(null, ptr);
58         }
59 }
60 export class ProcessingError extends ClosureReason {
61         public err: String;
62         private constructor(ptr: number, obj: bindings.LDKClosureReason.ProcessingError) {
63                 super(null, ptr);
64                 this.err = obj.err;
65         }
66 }
67 export class DisconnectedPeer extends ClosureReason {
68         private constructor(ptr: number, obj: bindings.LDKClosureReason.DisconnectedPeer) {
69                 super(null, ptr);
70         }
71 }
72 export class OutdatedChannelManager extends ClosureReason {
73         private constructor(ptr: number, obj: bindings.LDKClosureReason.OutdatedChannelManager) {
74                 super(null, ptr);
75         }
76 }
77         public ClosureReason clone() {
78                 number ret = bindings.ClosureReason_clone(this.ptr);
79                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
80                 ret_hu_conv.ptrs_to.add(this);
81                 return ret_hu_conv;
82         }
83
84         public static ClosureReason constructor_counterparty_force_closed(String peer_msg) {
85                 number ret = bindings.ClosureReason_counterparty_force_closed(peer_msg);
86                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
87                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
88                 return ret_hu_conv;
89         }
90
91         public static ClosureReason constructor_holder_force_closed() {
92                 number ret = bindings.ClosureReason_holder_force_closed();
93                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
94                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
95                 return ret_hu_conv;
96         }
97
98         public static ClosureReason constructor_cooperative_closure() {
99                 number ret = bindings.ClosureReason_cooperative_closure();
100                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
101                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
102                 return ret_hu_conv;
103         }
104
105         public static ClosureReason constructor_commitment_tx_confirmed() {
106                 number ret = bindings.ClosureReason_commitment_tx_confirmed();
107                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
108                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
109                 return ret_hu_conv;
110         }
111
112         public static ClosureReason constructor_processing_error(String err) {
113                 number ret = bindings.ClosureReason_processing_error(err);
114                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
115                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
116                 return ret_hu_conv;
117         }
118
119         public static ClosureReason constructor_disconnected_peer() {
120                 number ret = bindings.ClosureReason_disconnected_peer();
121                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
122                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
123                 return ret_hu_conv;
124         }
125
126         public static ClosureReason constructor_outdated_channel_manager() {
127                 number ret = bindings.ClosureReason_outdated_channel_manager();
128                 ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
129                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
130                 return ret_hu_conv;
131         }
132
133         public Uint8Array write() {
134                 Uint8Array ret = bindings.ClosureReason_write(this.ptr);
135                 return ret;
136         }
137
138 }