Update auto-generated bindings
[ldk-java] / ts / structs / Balance.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class Balance extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.Balance_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): Balance {
12                 const raw_val: bindings.LDKBalance = bindings.LDKBalance_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKBalance.ClaimableOnChannelClose) {
14                         return new ClaimableOnChannelClose(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKBalance.ClaimableAwaitingConfirmations) {
17                         return new ClaimableAwaitingConfirmations(this.ptr, raw_val);
18                 }
19                 if (raw_val instanceof bindings.LDKBalance.ContentiousClaimable) {
20                         return new ContentiousClaimable(this.ptr, raw_val);
21                 }
22                 if (raw_val instanceof bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout) {
23                         return new MaybeClaimableHTLCAwaitingTimeout(this.ptr, raw_val);
24                 }
25                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
26         }
27
28 }
29 export class ClaimableOnChannelClose extends Balance {
30         public claimable_amount_satoshis: number;
31         private constructor(ptr: number, obj: bindings.LDKBalance.ClaimableOnChannelClose) {
32                 super(null, ptr);
33                 this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
34         }
35 }
36 export class ClaimableAwaitingConfirmations extends Balance {
37         public claimable_amount_satoshis: number;
38         public confirmation_height: number;
39         private constructor(ptr: number, obj: bindings.LDKBalance.ClaimableAwaitingConfirmations) {
40                 super(null, ptr);
41                 this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
42                 this.confirmation_height = obj.confirmation_height;
43         }
44 }
45 export class ContentiousClaimable extends Balance {
46         public claimable_amount_satoshis: number;
47         public timeout_height: number;
48         private constructor(ptr: number, obj: bindings.LDKBalance.ContentiousClaimable) {
49                 super(null, ptr);
50                 this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
51                 this.timeout_height = obj.timeout_height;
52         }
53 }
54 export class MaybeClaimableHTLCAwaitingTimeout extends Balance {
55         public claimable_amount_satoshis: number;
56         public claimable_height: number;
57         private constructor(ptr: number, obj: bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout) {
58                 super(null, ptr);
59                 this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
60                 this.claimable_height = obj.claimable_height;
61         }
62 }
63         public number clone_ptr() {
64                 number ret = bindings.Balance_clone_ptr(this.ptr);
65                 return ret;
66         }
67
68         public Balance clone() {
69                 number ret = bindings.Balance_clone(this.ptr);
70                 Balance ret_hu_conv = Balance.constr_from_ptr(ret);
71                 ret_hu_conv.ptrs_to.add(this);
72                 return ret_hu_conv;
73         }
74
75         public static Balance constructor_claimable_on_channel_close(number claimable_amount_satoshis) {
76                 number ret = bindings.Balance_claimable_on_channel_close(claimable_amount_satoshis);
77                 Balance ret_hu_conv = Balance.constr_from_ptr(ret);
78                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
79                 return ret_hu_conv;
80         }
81
82         public static Balance constructor_claimable_awaiting_confirmations(number claimable_amount_satoshis, number confirmation_height) {
83                 number ret = bindings.Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
84                 Balance ret_hu_conv = Balance.constr_from_ptr(ret);
85                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
86                 return ret_hu_conv;
87         }
88
89         public static Balance constructor_contentious_claimable(number claimable_amount_satoshis, number timeout_height) {
90                 number ret = bindings.Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
91                 Balance ret_hu_conv = Balance.constr_from_ptr(ret);
92                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
93                 return ret_hu_conv;
94         }
95
96         public static Balance constructor_maybe_claimable_htlcawaiting_timeout(number claimable_amount_satoshis, number claimable_height) {
97                 number ret = bindings.Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
98                 Balance ret_hu_conv = Balance.constr_from_ptr(ret);
99                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
100                 return ret_hu_conv;
101         }
102
103         public boolean eq(Balance b) {
104                 boolean ret = bindings.Balance_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
105                 return ret;
106         }
107
108 }