]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/RawInvoice.ts
Merge pull request #29 from TheBlueMatt/main
[ldk-java] / ts / structs / RawInvoice.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 RawInvoice 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.RawInvoice_free(this.ptr);
19                     }
20                 }
21         public RawDataPart get_data() {
22                 number ret = bindings.RawInvoice_get_data(this.ptr);
23                 const ret_hu_conv: RawDataPart = new RawDataPart(null, ret);
24                 ret_hu_conv.ptrs_to.add(this);
25                 return ret_hu_conv;
26         }
27
28         public void set_data(RawDataPart val) {
29                 bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1);
30                 this.ptrs_to.add(val);
31         }
32
33         public boolean eq(RawInvoice b) {
34                 boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
35                 this.ptrs_to.add(b);
36                 return ret;
37         }
38
39         public RawInvoice clone() {
40                 number ret = bindings.RawInvoice_clone(this.ptr);
41                 const ret_hu_conv: RawInvoice = new RawInvoice(null, ret);
42                 ret_hu_conv.ptrs_to.add(this);
43                 return ret_hu_conv;
44         }
45
46         public Uint8Array hash() {
47                 Uint8Array ret = bindings.RawInvoice_hash(this.ptr);
48                 return ret;
49         }
50
51         public Sha256 payment_hash() {
52                 number ret = bindings.RawInvoice_payment_hash(this.ptr);
53                 const ret_hu_conv: Sha256 = new Sha256(null, ret);
54                 ret_hu_conv.ptrs_to.add(this);
55                 return ret_hu_conv;
56         }
57
58         public Description description() {
59                 number ret = bindings.RawInvoice_description(this.ptr);
60                 const ret_hu_conv: Description = new Description(null, ret);
61                 ret_hu_conv.ptrs_to.add(this);
62                 return ret_hu_conv;
63         }
64
65         public PayeePubKey payee_pub_key() {
66                 number ret = bindings.RawInvoice_payee_pub_key(this.ptr);
67                 const ret_hu_conv: PayeePubKey = new PayeePubKey(null, ret);
68                 ret_hu_conv.ptrs_to.add(this);
69                 return ret_hu_conv;
70         }
71
72         public Sha256 description_hash() {
73                 number ret = bindings.RawInvoice_description_hash(this.ptr);
74                 const ret_hu_conv: Sha256 = new Sha256(null, ret);
75                 ret_hu_conv.ptrs_to.add(this);
76                 return ret_hu_conv;
77         }
78
79         public ExpiryTime expiry_time() {
80                 number ret = bindings.RawInvoice_expiry_time(this.ptr);
81                 const ret_hu_conv: ExpiryTime = new ExpiryTime(null, ret);
82                 ret_hu_conv.ptrs_to.add(this);
83                 return ret_hu_conv;
84         }
85
86         public MinFinalCltvExpiry min_final_cltv_expiry() {
87                 number ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr);
88                 const ret_hu_conv: MinFinalCltvExpiry = new MinFinalCltvExpiry(null, ret);
89                 ret_hu_conv.ptrs_to.add(this);
90                 return ret_hu_conv;
91         }
92
93         public Uint8Array payment_secret() {
94                 Uint8Array ret = bindings.RawInvoice_payment_secret(this.ptr);
95                 return ret;
96         }
97
98         public InvoiceFeatures features() {
99                 number ret = bindings.RawInvoice_features(this.ptr);
100                 const ret_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, ret);
101                 ret_hu_conv.ptrs_to.add(this);
102                 return ret_hu_conv;
103         }
104
105         public PrivateRoute[] private_routes() {
106                 number[] ret = bindings.RawInvoice_private_routes(this.ptr);
107                 PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length];
108                 for (int o = 0; o < ret.length; o++) {
109                         number ret_conv_14 = ret[o];
110                         const ret_conv_14_hu_conv: PrivateRoute = new PrivateRoute(null, ret_conv_14);
111                         ret_conv_14_hu_conv.ptrs_to.add(this);
112                         ret_conv_14_arr[o] = ret_conv_14_hu_conv;
113                 }
114                 return ret_conv_14_arr;
115         }
116
117         public Option_u64Z amount_pico_btc() {
118                 number ret = bindings.RawInvoice_amount_pico_btc(this.ptr);
119                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
120                 ret_hu_conv.ptrs_to.add(this);
121                 return ret_hu_conv;
122         }
123
124         public Currency currency() {
125                 Currency ret = bindings.RawInvoice_currency(this.ptr);
126                 return ret;
127         }
128
129 }