3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class Payee extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.Payee_free(this.ptr);
21 public Uint8Array get_pubkey() {
22 Uint8Array ret = bindings.Payee_get_pubkey(this.ptr);
26 public void set_pubkey(Uint8Array val) {
27 bindings.Payee_set_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
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);
37 public void set_features(InvoiceFeatures val) {
38 bindings.Payee_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
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;
50 return ret_conv_11_arr;
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);
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);
64 public void set_expiry_time(Option_u64Z val) {
65 bindings.Payee_set_expiry_time(this.ptr, val.ptr);
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);
75 public number clone_ptr() {
76 number ret = bindings.Payee_clone_ptr(this.ptr);
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);
87 public number hash() {
88 number ret = bindings.Payee_hash(this.ptr);
92 public boolean eq(Payee b) {
93 boolean ret = bindings.Payee_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
98 public Uint8Array write() {
99 Uint8Array ret = bindings.Payee_write(this.ptr);
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);
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);
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);