Update auto-generated bindings to 0.0.103
[ldk-java] / ts / structs / Route.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 Route 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.Route_free(this.ptr);
19                     }
20                 }
21         public RouteHop[][] get_paths() {
22                 number[][] ret = bindings.Route_get_paths(this.ptr);
23                 RouteHop[][] ret_conv_12_arr = new RouteHop[ret.length][];
24                 for (int m = 0; m < ret.length; m++) {
25                         number[] ret_conv_12 = ret[m];
26                         RouteHop[] ret_conv_12_conv_10_arr = new RouteHop[ret_conv_12.length];
27                         for (int k = 0; k < ret_conv_12.length; k++) {
28                                 number ret_conv_12_conv_10 = ret_conv_12[k];
29                                 const ret_conv_12_conv_10_hu_conv: RouteHop = new RouteHop(null, ret_conv_12_conv_10);
30                                 ret_conv_12_conv_10_hu_conv.ptrs_to.add(this);
31                                 ret_conv_12_conv_10_arr[k] = ret_conv_12_conv_10_hu_conv;
32                         }
33                         ret_conv_12_arr[m] = ret_conv_12_conv_10_arr;
34                 }
35                 return ret_conv_12_arr;
36         }
37
38         public void set_paths(RouteHop[][] val) {
39                 bindings.Route_set_paths(this.ptr, val != null ? Arrays.stream(val).map(val_conv_12 -> val_conv_12 != null ? Arrays.stream(val_conv_12).map(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray(number[]::new) : null).toArray(number[][]::new) : null);
40         }
41
42         public Payee get_payee() {
43                 number ret = bindings.Route_get_payee(this.ptr);
44                 const ret_hu_conv: Payee = new Payee(null, ret);
45                 ret_hu_conv.ptrs_to.add(this);
46                 return ret_hu_conv;
47         }
48
49         public void set_payee(Payee val) {
50                 bindings.Route_set_payee(this.ptr, val == null ? 0 : val.ptr & ~1);
51         }
52
53         public static Route constructor_new(RouteHop[][] paths_arg, Payee payee_arg) {
54                 number ret = bindings.Route_new(paths_arg != null ? Arrays.stream(paths_arg).map(paths_arg_conv_12 -> paths_arg_conv_12 != null ? Arrays.stream(paths_arg_conv_12).map(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray(number[]::new) : null).toArray(number[][]::new) : null, payee_arg == null ? 0 : payee_arg.ptr & ~1);
55                 const ret_hu_conv: Route = new Route(null, ret);
56                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
57                 return ret_hu_conv;
58         }
59
60         public Route clone() {
61                 number ret = bindings.Route_clone(this.ptr);
62                 const ret_hu_conv: Route = new Route(null, ret);
63                 ret_hu_conv.ptrs_to.add(this);
64                 return ret_hu_conv;
65         }
66
67         public number hash() {
68                 number ret = bindings.Route_hash(this.ptr);
69                 return ret;
70         }
71
72         public boolean eq(Route b) {
73                 boolean ret = bindings.Route_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
74                 this.ptrs_to.add(b);
75                 return ret;
76         }
77
78         public number get_total_fees() {
79                 number ret = bindings.Route_get_total_fees(this.ptr);
80                 return ret;
81         }
82
83         public number get_total_amount() {
84                 number ret = bindings.Route_get_total_amount(this.ptr);
85                 return ret;
86         }
87
88         public Uint8Array write() {
89                 Uint8Array ret = bindings.Route_write(this.ptr);
90                 return ret;
91         }
92
93         public static Result_RouteDecodeErrorZ constructor_read(Uint8Array ser) {
94                 number ret = bindings.Route_read(ser);
95                 Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret);
96                 return ret_hu_conv;
97         }
98
99 }