]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/SignOrCreationError.ts
Support new cloned upstream API instead of clone
[ldk-java] / ts / structs / SignOrCreationError.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class SignOrCreationError extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.SignOrCreationError_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): SignOrCreationError {
12                 const raw_val: bindings.LDKSignOrCreationError = bindings.LDKSignOrCreationError_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKSignOrCreationError.SignError) {
14                         return new SignError(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKSignOrCreationError.CreationError) {
17                         return new CreationError(this.ptr, raw_val);
18                 }
19                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
20         }
21
22 }
23 export class SignError extends SignOrCreationError {
24         private constructor(ptr: number, obj: bindings.LDKSignOrCreationError.SignError) {
25                 super(null, ptr);
26         }
27 }
28 export class CreationError extends SignOrCreationError {
29         public creation_error: CreationError;
30         private constructor(ptr: number, obj: bindings.LDKSignOrCreationError.CreationError) {
31                 super(null, ptr);
32                 this.creation_error = obj.creation_error;
33         }
34 }
35         public SignOrCreationError clone() {
36                 number ret = bindings.SignOrCreationError_clone(this.ptr);
37                 SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret);
38                 ret_hu_conv.ptrs_to.add(this);
39                 return ret_hu_conv;
40         }
41
42         public boolean eq(SignOrCreationError b) {
43                 boolean ret = bindings.SignOrCreationError_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
44                 this.ptrs_to.add(b);
45                 return ret;
46         }
47
48         public String to_str() {
49                 String ret = bindings.SignOrCreationError_to_str(this.ptr);
50                 return ret;
51         }
52
53 }