lightningdevkit
Version:
Lightning Development Kit
75 lines • 3.07 kB
JavaScript
import { PendingHTLCInfo } from '../structs/PendingHTLCInfo.mjs';
import { InboundHTLCErr } from '../structs/InboundHTLCErr.mjs';
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
export class Result_PendingHTLCInfoInboundHTLCErrZ extends CommonBase {
constructor(_dummy, ptr) {
super(ptr, bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_free);
}
/* @internal */
static constr_from_ptr(ptr) {
if (bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(ptr)) {
return new Result_PendingHTLCInfoInboundHTLCErrZ_OK(null, ptr);
}
else {
return new Result_PendingHTLCInfoInboundHTLCErrZ_Err(null, ptr);
}
}
/**
* Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
*/
static constructor_ok(o) {
const ret = bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_ok(CommonBase.get_ptr_of(o));
const ret_hu_conv = Result_PendingHTLCInfoInboundHTLCErrZ.constr_from_ptr(ret);
return ret_hu_conv;
}
/**
* Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
*/
static constructor_err(e) {
const ret = bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_err(CommonBase.get_ptr_of(e));
const ret_hu_conv = Result_PendingHTLCInfoInboundHTLCErrZ.constr_from_ptr(ret);
return ret_hu_conv;
}
/**
* Checks if the given object is currently in the success state
*/
is_ok() {
const ret = bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(this.ptr);
return ret;
}
clone_ptr() {
const ret = bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
clone() {
const ret = bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_clone(this.ptr);
const ret_hu_conv = Result_PendingHTLCInfoInboundHTLCErrZ.constr_from_ptr(ret);
return ret_hu_conv;
}
}
export class Result_PendingHTLCInfoInboundHTLCErrZ_OK extends Result_PendingHTLCInfoInboundHTLCErrZ {
/* @internal */
constructor(_dummy, ptr) {
super(_dummy, ptr);
const res = bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(ptr);
const res_hu_conv = new PendingHTLCInfo(null, res);
CommonBase.add_ref_from(res_hu_conv, this);
this.res = res_hu_conv;
}
}
export class Result_PendingHTLCInfoInboundHTLCErrZ_Err extends Result_PendingHTLCInfoInboundHTLCErrZ {
/* @internal */
constructor(_dummy, ptr) {
super(_dummy, ptr);
const err = bindings.CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(ptr);
const err_hu_conv = new InboundHTLCErr(null, err);
CommonBase.add_ref_from(err_hu_conv, this);
this.err = err_hu_conv;
}
}
//# sourceMappingURL=Result_PendingHTLCInfoInboundHTLCErrZ.mjs.map