2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
5 export default class SignOrCreationError extends CommonBase {
6 protected constructor(_dummy: object, ptr: number) { super(ptr); }
9 if (this.ptr != 0) { bindings.SignOrCreationError_free(this.ptr); }
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);
16 if (raw_val instanceof bindings.LDKSignOrCreationError.CreationError) {
17 return new CreationError(this.ptr, raw_val);
19 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
23 export class SignError extends SignOrCreationError {
24 private constructor(ptr: number, obj: bindings.LDKSignOrCreationError.SignError) {
28 export class CreationError extends SignOrCreationError {
29 public creation_error: CreationError;
30 private constructor(ptr: number, obj: bindings.LDKSignOrCreationError.CreationError) {
32 this.creation_error = obj.creation_error;
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);
42 public boolean eq(SignOrCreationError b) {
43 boolean ret = bindings.SignOrCreationError_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
48 public String to_str() {
49 String ret = bindings.SignOrCreationError_to_str(this.ptr);