]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/Payee.ts
Merge pull request #69 from TheBlueMatt/main
[ldk-java] / ts / structs / Payee.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 Payee 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.Payee_free(this.ptr);
19                     }
20                 }
21         public Uint8Array get_pubkey() {
22                 Uint8Array ret = bindings.Payee_get_pubkey(this.ptr);
23                 return ret;
24         }
25
26         public void set_pubkey(Uint8Array val) {
27                 bindings.Payee_set_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
28         }
29
30         public InvoiceFeatures get_features() {
31                 number ret = bindings.Payee_get_features(this.ptr);
32                 const ret_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, ret);
33                 ret_hu_conv.ptrs_to.add(this);
34                 return ret_hu_conv;
35         }
36
37         public void set_features(InvoiceFeatures val) {
38                 bindings.Payee_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
39         }
40
41         public RouteHint[] get_route_hints() {
42                 number[] ret = bindings.Payee_get_route_hints(this.ptr);
43                 RouteHint[] ret_conv_11_arr = new RouteHint[ret.length];
44                 for (int l = 0; l < ret.length; l++) {
45                         number ret_conv_11 = ret[l];
46                         const ret_conv_11_hu_conv: RouteHint = new RouteHint(null, ret_conv_11);
47                         ret_conv_11_hu_conv.ptrs_to.add(this);
48                         ret_conv_11_arr[l] = ret_conv_11_hu_conv;
49                 }
50                 return ret_conv_11_arr;
51         }
52
53         public void set_route_hints(RouteHint[] val) {
54                 bindings.Payee_set_route_hints(this.ptr, val != null ? Arrays.stream(val).map(val_conv_11 -> val_conv_11 == null ? 0 : val_conv_11.ptr & ~1).toArray(number[]::new) : null);
55         }
56
57         public Option_u64Z get_expiry_time() {
58                 number ret = bindings.Payee_get_expiry_time(this.ptr);
59                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
60                 ret_hu_conv.ptrs_to.add(this);
61                 return ret_hu_conv;
62         }
63
64         public void set_expiry_time(Option_u64Z val) {
65                 bindings.Payee_set_expiry_time(this.ptr, val.ptr);
66         }
67
68         public static Payee constructor_new(Uint8Array pubkey_arg, InvoiceFeatures features_arg, RouteHint[] route_hints_arg, Option_u64Z expiry_time_arg) {
69                 number ret = bindings.Payee_new(InternalUtils.check_arr_len(pubkey_arg, 33), features_arg == null ? 0 : features_arg.ptr & ~1, route_hints_arg != null ? Arrays.stream(route_hints_arg).map(route_hints_arg_conv_11 -> route_hints_arg_conv_11 == null ? 0 : route_hints_arg_conv_11.ptr & ~1).toArray(number[]::new) : null, expiry_time_arg.ptr);
70                 const ret_hu_conv: Payee = new Payee(null, ret);
71                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
72                 return ret_hu_conv;
73         }
74
75         public number clone_ptr() {
76                 number ret = bindings.Payee_clone_ptr(this.ptr);
77                 return ret;
78         }
79
80         public Payee clone() {
81                 number ret = bindings.Payee_clone(this.ptr);
82                 const ret_hu_conv: Payee = new Payee(null, ret);
83                 ret_hu_conv.ptrs_to.add(this);
84                 return ret_hu_conv;
85         }
86
87         public number hash() {
88                 number ret = bindings.Payee_hash(this.ptr);
89                 return ret;
90         }
91
92         public boolean eq(Payee b) {
93                 boolean ret = bindings.Payee_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
94                 this.ptrs_to.add(b);
95                 return ret;
96         }
97
98         public Uint8Array write() {
99                 Uint8Array ret = bindings.Payee_write(this.ptr);
100                 return ret;
101         }
102
103         public static Result_PayeeDecodeErrorZ constructor_read(Uint8Array ser) {
104                 number ret = bindings.Payee_read(ser);
105                 Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret);
106                 return ret_hu_conv;
107         }
108
109         public static Payee constructor_from_node_id(Uint8Array pubkey) {
110                 number ret = bindings.Payee_from_node_id(InternalUtils.check_arr_len(pubkey, 33));
111                 const ret_hu_conv: Payee = new Payee(null, ret);
112                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
113                 return ret_hu_conv;
114         }
115
116         public static Payee constructor_for_keysend(Uint8Array pubkey) {
117                 number ret = bindings.Payee_for_keysend(InternalUtils.check_arr_len(pubkey, 33));
118                 const ret_hu_conv: Payee = new Payee(null, ret);
119                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
120                 return ret_hu_conv;
121         }
122
123 }