3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export class FeeEstimator extends CommonBase {
10 bindings_instance?: bindings.LDKFeeEstimator;
12 constructor(ptr?: number, arg?: bindings.LDKFeeEstimator) {
13 if (Number.isFinite(ptr)) {
15 this.bindings_instance = null;
17 // TODO: private constructor instantiation
18 super(bindings.LDKFeeEstimator_new(arg));
19 this.ptrs_to.push(arg);
24 protected finalize() {
26 bindings.FeeEstimator_free(this.ptr);
31 static new_impl(arg: FeeEstimatorInterface): FeeEstimator {
32 const impl_holder: LDKFeeEstimatorHolder = new LDKFeeEstimatorHolder();
33 let structImplementation = <bindings.LDKFeeEstimator>{
34 // todo: in-line interface filling
35 get_est_sat_per_1000_weight (confirmation_target: LDKConfirmationTarget): number {
36 number ret = arg.get_est_sat_per_1000_weight(confirmation_target);
42 impl_holder.held = new FeeEstimator (null, structImplementation);
46 export interface FeeEstimatorInterface {
47 get_est_sat_per_1000_weight(confirmation_target: LDKConfirmationTarget): number;
51 class LDKFeeEstimatorHolder {
54 public number get_est_sat_per_1000_weight(LDKConfirmationTarget confirmation_target) {
55 number ret = bindings.FeeEstimator_get_est_sat_per_1000_weight(this.ptr, confirmation_target);