Support passing trait instance references from C to Java without clone or double...
[ldk-java] / ts / structs / PaymentId.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 PaymentId 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.PaymentId_free(this.ptr);
19                     }
20                 }
21         public number hash() {
22                 number ret = bindings.PaymentId_hash(this.ptr);
23                 return ret;
24         }
25
26         public PaymentId clone() {
27                 number ret = bindings.PaymentId_clone(this.ptr);
28                 const ret_hu_conv: PaymentId = new PaymentId(null, ret);
29                 ret_hu_conv.ptrs_to.add(this);
30                 return ret_hu_conv;
31         }
32
33         public boolean eq(PaymentId b) {
34                 boolean ret = bindings.PaymentId_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
35                 this.ptrs_to.add(b);
36                 return ret;
37         }
38
39         public Uint8Array write() {
40                 Uint8Array ret = bindings.PaymentId_write(this.ptr);
41                 return ret;
42         }
43
44         public static Result_PaymentIdDecodeErrorZ constructor_read(Uint8Array ser) {
45                 number ret = bindings.PaymentId_read(ser);
46                 Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret);
47                 return ret_hu_conv;
48         }
49
50 }