Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / FeeEstimator.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8 /**
9  * A trait which should be implemented to provide feerate information on a number of time
10  * horizons.
11  * 
12  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
13  * called from inside the library in response to chain events, P2P events, or timer events).
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class FeeEstimator extends CommonBase {
17         final bindings.LDKFeeEstimator bindings_instance;
18         FeeEstimator(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
19         private FeeEstimator(bindings.LDKFeeEstimator arg) {
20                 super(bindings.LDKFeeEstimator_new(arg));
21                 this.ptrs_to.add(arg);
22                 this.bindings_instance = arg;
23         }
24         @Override @SuppressWarnings("deprecation")
25         protected void finalize() throws Throwable {
26                 if (ptr != 0) { bindings.FeeEstimator_free(ptr); } super.finalize();
27         }
28
29         public static interface FeeEstimatorInterface {
30                 /**
31                  * Gets estimated satoshis of fee required per 1000 Weight-Units.
32                  * 
33                  * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
34                  * don't put us below 1 satoshi-per-byte).
35                  * 
36                  * This translates to:
37                  * satoshis-per-byte * 250
38                  * ceil(satoshis-per-kbyte / 4)
39                  */
40                 int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target);
41         }
42         private static class LDKFeeEstimatorHolder { FeeEstimator held; }
43         public static FeeEstimator new_impl(FeeEstimatorInterface arg) {
44                 final LDKFeeEstimatorHolder impl_holder = new LDKFeeEstimatorHolder();
45                 impl_holder.held = new FeeEstimator(new bindings.LDKFeeEstimator() {
46                         @Override public int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target) {
47                                 int ret = arg.get_est_sat_per_1000_weight(confirmation_target);
48                                 return ret;
49                         }
50                 });
51                 return impl_holder.held;
52         }
53         /**
54          * Gets estimated satoshis of fee required per 1000 Weight-Units.
55          * 
56          * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
57          * don't put us below 1 satoshi-per-byte).
58          * 
59          * This translates to:
60          * satoshis-per-byte * 250
61          * ceil(satoshis-per-kbyte / 4)
62          */
63         public int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target) {
64                 int ret = bindings.FeeEstimator_get_est_sat_per_1000_weight(this.ptr, confirmation_target);
65                 return ret;
66         }
67
68 }