X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FPaymentSendFailure.ts;fp=ts%2Fstructs%2FPaymentSendFailure.ts;h=2310a2eea6253363e2ae486a24c9a8532fbf556a;hb=246459dcbc3be28c38b4951140a5933f4b3aa024;hp=32bef844f5468cd54fae47e522e27a73771382e7;hpb=b52dde859c138f9257499496749d1eb89f9f6f43;p=ldk-java diff --git a/ts/structs/PaymentSendFailure.ts b/ts/structs/PaymentSendFailure.ts index 32bef844..2310a2ee 100644 --- a/ts/structs/PaymentSendFailure.ts +++ b/ts/structs/PaymentSendFailure.ts @@ -1,28 +1,48 @@ - import CommonBase from './CommonBase'; import * as bindings from '../bindings' // TODO: figure out location - - - export default class PaymentSendFailure extends CommonBase { - constructor(_dummy: object, ptr: number) { - super(ptr); - } - - - protected finalize() { - super.finalize(); - - if (this.ptr != 0) { - bindings.PaymentSendFailure_free(this.ptr); - } - } - public PaymentSendFailure clone() { - number ret = bindings.PaymentSendFailure_clone(this.ptr); - const ret_hu_conv: PaymentSendFailure = new PaymentSendFailure(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; +export default class PaymentSendFailure extends CommonBase { + protected constructor(_dummy: object, ptr: number) { super(ptr); } + protected finalize() { + super.finalize(); + 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); + } +}