3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class RawInvoice extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.RawInvoice_free(this.ptr);
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);
28 public void set_data(RawDataPart val) {
29 bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1);
32 public boolean eq(RawInvoice b) {
33 boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
38 public RawInvoice clone() {
39 number ret = bindings.RawInvoice_clone(this.ptr);
40 const ret_hu_conv: RawInvoice = new RawInvoice(null, ret);
41 ret_hu_conv.ptrs_to.add(this);
45 public Uint8Array hash() {
46 Uint8Array ret = bindings.RawInvoice_hash(this.ptr);
50 public Sha256 payment_hash() {
51 number ret = bindings.RawInvoice_payment_hash(this.ptr);
52 const ret_hu_conv: Sha256 = new Sha256(null, ret);
53 ret_hu_conv.ptrs_to.add(this);
57 public Description description() {
58 number ret = bindings.RawInvoice_description(this.ptr);
59 const ret_hu_conv: Description = new Description(null, ret);
60 ret_hu_conv.ptrs_to.add(this);
64 public PayeePubKey payee_pub_key() {
65 number ret = bindings.RawInvoice_payee_pub_key(this.ptr);
66 const ret_hu_conv: PayeePubKey = new PayeePubKey(null, ret);
67 ret_hu_conv.ptrs_to.add(this);
71 public Sha256 description_hash() {
72 number ret = bindings.RawInvoice_description_hash(this.ptr);
73 const ret_hu_conv: Sha256 = new Sha256(null, ret);
74 ret_hu_conv.ptrs_to.add(this);
78 public ExpiryTime expiry_time() {
79 number ret = bindings.RawInvoice_expiry_time(this.ptr);
80 const ret_hu_conv: ExpiryTime = new ExpiryTime(null, ret);
81 ret_hu_conv.ptrs_to.add(this);
85 public MinFinalCltvExpiry min_final_cltv_expiry() {
86 number ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr);
87 const ret_hu_conv: MinFinalCltvExpiry = new MinFinalCltvExpiry(null, ret);
88 ret_hu_conv.ptrs_to.add(this);
92 public Uint8Array payment_secret() {
93 Uint8Array ret = bindings.RawInvoice_payment_secret(this.ptr);
97 public InvoiceFeatures features() {
98 number ret = bindings.RawInvoice_features(this.ptr);
99 const ret_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, ret);
100 ret_hu_conv.ptrs_to.add(this);
104 public PrivateRoute[] private_routes() {
105 number[] ret = bindings.RawInvoice_private_routes(this.ptr);
106 PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length];
107 for (int o = 0; o < ret.length; o++) {
108 number ret_conv_14 = ret[o];
109 const ret_conv_14_hu_conv: PrivateRoute = new PrivateRoute(null, ret_conv_14);
110 ret_conv_14_hu_conv.ptrs_to.add(this);
111 ret_conv_14_arr[o] = ret_conv_14_hu_conv;
113 return ret_conv_14_arr;
116 public Option_u64Z amount_pico_btc() {
117 number ret = bindings.RawInvoice_amount_pico_btc(this.ptr);
118 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
119 ret_hu_conv.ptrs_to.add(this);
123 public Currency currency() {
124 Currency ret = bindings.RawInvoice_currency(this.ptr);