Update bindings to latest upstream.
[ldk-java] / ts / structs / PaymentSendFailure.ts
index ddaccb9d8279183a67aef38eb2566b00f1ff07fd..2310a2eea6253363e2ae486a24c9a8532fbf556a 100644 (file)
@@ -2,12 +2,47 @@
 import CommonBase from './CommonBase';
 import * as bindings from '../bindings' // TODO: figure out location
 
-public class PaymentSendFailure extends CommonBase {
-       PaymentSendFailure(Object _dummy, long ptr) { super(ptr); }
-       @Override @SuppressWarnings("deprecation")
-       protected void finalize() throws Throwable {
+export default class PaymentSendFailure extends CommonBase {
+       protected constructor(_dummy: object, ptr: number) { super(ptr); }
+       protected finalize() {
                super.finalize();
-               if (ptr != 0) { bindings.PaymentSendFailure_free(ptr); }
+               if (this.ptr != 0) { bindings.PaymentSendFailure_free(this.ptr); }
+       }
+       static constr_from_ptr(ptr: number): PaymentSendFailure {
+               const raw_val: bindings.LDKPaymentSendFailure = bindings.LDKPaymentSendFailure_ref_from_ptr(ptr);
+               if (raw_val instanceof bindings.LDKPaymentSendFailure.ParameterError) {
+                       return new ParameterError(this.ptr, raw_val);
+               }
+               if (raw_val instanceof bindings.LDKPaymentSendFailure.PathParameterError) {
+                       return new PathParameterError(this.ptr, raw_val);
+               }
+               if (raw_val instanceof bindings.LDKPaymentSendFailure.AllFailedRetrySafe) {
+                       return new AllFailedRetrySafe(this.ptr, raw_val);
+               }
+               if (raw_val instanceof bindings.LDKPaymentSendFailure.PartialFailure) {
+                       return new PartialFailure(this.ptr, raw_val);
+               }
+               throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
        }
 
 }
+export class ParameterError extends PaymentSendFailure {
+       private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.ParameterError) {
+               super(null, ptr);
+       }
+}
+export class PathParameterError extends PaymentSendFailure {
+       private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.PathParameterError) {
+               super(null, ptr);
+       }
+}
+export class AllFailedRetrySafe extends PaymentSendFailure {
+       private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.AllFailedRetrySafe) {
+               super(null, ptr);
+       }
+}
+export class PartialFailure extends PaymentSendFailure {
+       private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.PartialFailure) {
+               super(null, ptr);
+       }
+}