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, val);
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(pubkey_arg, 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 Payee clone() {
76 number ret = bindings.Payee_clone(this.ptr);
77 const ret_hu_conv: Payee = new Payee(null, ret);
78 ret_hu_conv.ptrs_to.add(this);
82 public number hash() {
83 number ret = bindings.Payee_hash(this.ptr);
87 public boolean eq(Payee b) {
88 boolean ret = bindings.Payee_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
93 public Uint8Array write() {
94 Uint8Array ret = bindings.Payee_write(this.ptr);
98 public static Result_PayeeDecodeErrorZ constructor_read(Uint8Array ser) {
99 number ret = bindings.Payee_read(ser);
100 Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret);
104 public static Payee constructor_from_node_id(Uint8Array pubkey) {
105 number ret = bindings.Payee_from_node_id(pubkey);
106 const ret_hu_conv: Payee = new Payee(null, ret);
107 ret_hu_conv.ptrs_to.add(ret_hu_conv);
111 public static Payee constructor_for_keysend(Uint8Array pubkey) {
112 number ret = bindings.Payee_for_keysend(pubkey);
113 const ret_hu_conv: Payee = new Payee(null, ret);
114 ret_hu_conv.ptrs_to.add(ret_hu_conv);