[TS] Update auto-generated TS bindings
[ldk-java] / ts / structs / PaymentParameters.mts
index 787e257f8dc65f5d17f41b0bba1c6a5b190070ee..20da218fa1a0cfc348c8f9f08260bf565391a096 100644 (file)
@@ -66,6 +66,9 @@ import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurp
 import { ClosureReason } from '../structs/ClosureReason.mjs';
 import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs';
 import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs';
+import { HTLCDestination } from '../structs/HTLCDestination.mjs';
+import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs';
+import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs';
 import { ChannelUpdate } from '../structs/ChannelUpdate.mjs';
 import { NetworkUpdate } from '../structs/NetworkUpdate.mjs';
 import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs';
@@ -103,10 +106,13 @@ import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransaction
 import { Result_NoneChannelMonitorUpdateErrZ } from '../structs/Result_NoneChannelMonitorUpdateErrZ.mjs';
 import { HTLCUpdate } from '../structs/HTLCUpdate.mjs';
 import { MonitorEvent } from '../structs/MonitorEvent.mjs';
-import { TwoTuple_OutPointCVec_MonitorEventZZ } from '../structs/TwoTuple_OutPointCVec_MonitorEventZZ.mjs';
+import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs';
 import { Option_C2Tuple_usizeTransactionZZ } from '../structs/Option_C2Tuple_usizeTransactionZZ.mjs';
 import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs';
 import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs';
+import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs';
+import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs';
+import { NodeId } from '../structs/NodeId.mjs';
 import { Record } from '../structs/Record.mjs';
 import { Logger, LoggerInterface } from '../structs/Logger.mjs';
 import { NetworkGraph } from '../structs/NetworkGraph.mjs';
@@ -121,7 +127,6 @@ import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesD
 import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs';
 import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs';
 import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs';
-import { NodeId } from '../structs/NodeId.mjs';
 import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs';
 import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs';
 import { Access, AccessInterface } from '../structs/Access.mjs';
@@ -135,9 +140,12 @@ import { ChannelInfo } from '../structs/ChannelInfo.mjs';
 import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs';
 import { RoutingFees } from '../structs/RoutingFees.mjs';
 import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs';
+import { Hostname } from '../structs/Hostname.mjs';
 import { NetAddress } from '../structs/NetAddress.mjs';
 import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs';
 import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs';
+import { NodeAlias } from '../structs/NodeAlias.mjs';
+import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs';
 import { NodeInfo } from '../structs/NodeInfo.mjs';
 import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs';
 import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs';
@@ -353,7 +361,7 @@ import * as bindings from '../bindings.mjs'
  */
 export class PaymentParameters extends CommonBase {
        /* @internal */
-       public constructor(_dummy: object, ptr: number) {
+       public constructor(_dummy: object, ptr: bigint) {
                super(ptr, bindings.PaymentParameters_free);
        }
 
@@ -384,7 +392,7 @@ export class PaymentParameters extends CommonBase {
         * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
        public get_features(): InvoiceFeatures {
-               const ret: number = bindings.PaymentParameters_get_features(this.ptr);
+               const ret: bigint = bindings.PaymentParameters_get_features(this.ptr);
                const ret_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, this);
                return ret_hu_conv;
@@ -401,7 +409,8 @@ export class PaymentParameters extends CommonBase {
         * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
        public set_features(val: InvoiceFeatures): void {
-               bindings.PaymentParameters_set_features(this.ptr, val == null ? 0 : CommonBase.get_ptr_of(val) & ~1);
+               bindings.PaymentParameters_set_features(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val));
+               CommonBase.add_ref_from(this, val);
        }
 
        /**
@@ -412,7 +421,7 @@ export class PaymentParameters extends CommonBase {
                const ret_conv_11_len: number = bindings.getArrayLength(ret);
                const ret_conv_11_arr: RouteHint[] = new Array(ret_conv_11_len).fill(null);
                for (var l = 0; l < ret_conv_11_len; l++) {
-                       const ret_conv_11: number = bindings.getU32ArrayElem(ret, l);
+                       const ret_conv_11: bigint = bindings.getU64ArrayElem(ret, l);
                        const ret_conv_11_hu_conv: RouteHint = new RouteHint(null, ret_conv_11);
                        CommonBase.add_ref_from(ret_conv_11_hu_conv, this);
                        ret_conv_11_arr[l] = ret_conv_11_hu_conv;
@@ -425,14 +434,15 @@ export class PaymentParameters extends CommonBase {
         * Hints for routing to the payee, containing channels connecting the payee to public nodes.
         */
        public set_route_hints(val: RouteHint[]): void {
-               bindings.PaymentParameters_set_route_hints(this.ptr, bindings.encodeUint32Array(val != null ? val.map(val_conv_11 => val_conv_11 == null ? 0 : CommonBase.get_ptr_of(val_conv_11) & ~1) : null));
+               bindings.PaymentParameters_set_route_hints(this.ptr, bindings.encodeUint64Array(val != null ? val.map(val_conv_11 => val_conv_11 == null ? 0n : CommonBase.get_ptr_of(val_conv_11)) : null));
+               val.forEach((val_conv_11: RouteHint) => { CommonBase.add_ref_from(this, val_conv_11); });
        }
 
        /**
         * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
         */
        public get_expiry_time(): Option_u64Z {
-               const ret: number = bindings.PaymentParameters_get_expiry_time(this.ptr);
+               const ret: bigint = bindings.PaymentParameters_get_expiry_time(this.ptr);
                const ret_hu_conv: Option_u64Z = Option_u64Z.constr_from_ptr(ret);
                CommonBase.add_ref_from(ret_hu_conv, this);
                return ret_hu_conv;
@@ -447,6 +457,7 @@ export class PaymentParameters extends CommonBase {
 
        /**
         * The maximum total CLTV delta we accept for the route.
+        * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
         */
        public get_max_total_cltv_expiry_delta(): number {
                const ret: number = bindings.PaymentParameters_get_max_total_cltv_expiry_delta(this.ptr);
@@ -455,23 +466,104 @@ export class PaymentParameters extends CommonBase {
 
        /**
         * The maximum total CLTV delta we accept for the route.
+        * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
         */
        public set_max_total_cltv_expiry_delta(val: number): void {
                bindings.PaymentParameters_set_max_total_cltv_expiry_delta(this.ptr, val);
        }
 
+       /**
+        * The maximum number of paths that may be used by (MPP) payments.
+        * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
+        */
+       public get_max_path_count(): number {
+               const ret: number = bindings.PaymentParameters_get_max_path_count(this.ptr);
+               return ret;
+       }
+
+       /**
+        * The maximum number of paths that may be used by (MPP) payments.
+        * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
+        */
+       public set_max_path_count(val: number): void {
+               bindings.PaymentParameters_set_max_path_count(this.ptr, val);
+       }
+
+       /**
+        * Selects the maximum share of a channel's total capacity which will be sent over a channel,
+        * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
+        * a lower value prefers to send larger MPP parts, potentially saturating channels and
+        * increasing failure probability for those paths.
+        * 
+        * Note that this restriction will be relaxed during pathfinding after paths which meet this
+        * restriction have been found. While paths which meet this criteria will be searched for, it
+        * is ultimately up to the scorer to select them over other paths.
+        * 
+        * A value of 0 will allow payments up to and including a channel's total announced usable
+        * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
+        * 
+        * Default value: 2
+        */
+       public get_max_channel_saturation_power_of_half(): number {
+               const ret: number = bindings.PaymentParameters_get_max_channel_saturation_power_of_half(this.ptr);
+               return ret;
+       }
+
+       /**
+        * Selects the maximum share of a channel's total capacity which will be sent over a channel,
+        * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
+        * a lower value prefers to send larger MPP parts, potentially saturating channels and
+        * increasing failure probability for those paths.
+        * 
+        * Note that this restriction will be relaxed during pathfinding after paths which meet this
+        * restriction have been found. While paths which meet this criteria will be searched for, it
+        * is ultimately up to the scorer to select them over other paths.
+        * 
+        * A value of 0 will allow payments up to and including a channel's total announced usable
+        * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
+        * 
+        * Default value: 2
+        */
+       public set_max_channel_saturation_power_of_half(val: number): void {
+               bindings.PaymentParameters_set_max_channel_saturation_power_of_half(this.ptr, val);
+       }
+
+       /**
+        * A list of SCIDs which this payment was previously attempted over and which caused the
+        * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
+        * these SCIDs.
+        * 
+        * Returns a copy of the field.
+        */
+       public get_previously_failed_channels(): bigint[] {
+               const ret: number = bindings.PaymentParameters_get_previously_failed_channels(this.ptr);
+               const ret_conv: bigint[] = bindings.decodeUint64Array(ret);
+               return ret_conv;
+       }
+
+       /**
+        * A list of SCIDs which this payment was previously attempted over and which caused the
+        * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
+        * these SCIDs.
+        */
+       public set_previously_failed_channels(val: bigint[]): void {
+               bindings.PaymentParameters_set_previously_failed_channels(this.ptr, bindings.encodeUint64Array(val));
+       }
+
        /**
         * Constructs a new PaymentParameters given each field
         */
-       public static constructor_new(payee_pubkey_arg: Uint8Array, features_arg: InvoiceFeatures, route_hints_arg: RouteHint[], expiry_time_arg: Option_u64Z, max_total_cltv_expiry_delta_arg: number): PaymentParameters {
-               const ret: number = bindings.PaymentParameters_new(bindings.encodeUint8Array(bindings.check_arr_len(payee_pubkey_arg, 33)), features_arg == null ? 0 : CommonBase.get_ptr_of(features_arg) & ~1, bindings.encodeUint32Array(route_hints_arg != null ? route_hints_arg.map(route_hints_arg_conv_11 => route_hints_arg_conv_11 == null ? 0 : CommonBase.get_ptr_of(route_hints_arg_conv_11) & ~1) : null), CommonBase.get_ptr_of(expiry_time_arg), max_total_cltv_expiry_delta_arg);
+       public static constructor_new(payee_pubkey_arg: Uint8Array, features_arg: InvoiceFeatures, route_hints_arg: RouteHint[], expiry_time_arg: Option_u64Z, max_total_cltv_expiry_delta_arg: number, max_path_count_arg: number, max_channel_saturation_power_of_half_arg: number, previously_failed_channels_arg: bigint[]): PaymentParameters {
+               const ret: bigint = bindings.PaymentParameters_new(bindings.encodeUint8Array(bindings.check_arr_len(payee_pubkey_arg, 33)), features_arg == null ? 0n : CommonBase.get_ptr_of(features_arg), bindings.encodeUint64Array(route_hints_arg != null ? route_hints_arg.map(route_hints_arg_conv_11 => route_hints_arg_conv_11 == null ? 0n : CommonBase.get_ptr_of(route_hints_arg_conv_11)) : null), CommonBase.get_ptr_of(expiry_time_arg), max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, bindings.encodeUint64Array(previously_failed_channels_arg));
                const ret_hu_conv: PaymentParameters = new PaymentParameters(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
+               CommonBase.add_ref_from(ret_hu_conv, features_arg);
+               route_hints_arg.forEach((route_hints_arg_conv_11: RouteHint) => { CommonBase.add_ref_from(ret_hu_conv, route_hints_arg_conv_11); });
                return ret_hu_conv;
        }
 
-       public clone_ptr(): number {
-               const ret: number = bindings.PaymentParameters_clone_ptr(this.ptr);
+       public clone_ptr(): bigint {
+               const ret: bigint = bindings.PaymentParameters_clone_ptr(this.ptr);
                return ret;
        }
 
@@ -479,7 +571,7 @@ export class PaymentParameters extends CommonBase {
         * Creates a copy of the PaymentParameters
         */
        public clone(): PaymentParameters {
-               const ret: number = bindings.PaymentParameters_clone(this.ptr);
+               const ret: bigint = bindings.PaymentParameters_clone(this.ptr);
                const ret_hu_conv: PaymentParameters = new PaymentParameters(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, this);
                return ret_hu_conv;
@@ -499,7 +591,7 @@ export class PaymentParameters extends CommonBase {
         * Two objects with NULL inner values will be considered "equal" here.
         */
        public eq(b: PaymentParameters): boolean {
-               const ret: boolean = bindings.PaymentParameters_eq(this.ptr, b == null ? 0 : CommonBase.get_ptr_of(b) & ~1);
+               const ret: boolean = bindings.PaymentParameters_eq(this.ptr, b == null ? 0n : CommonBase.get_ptr_of(b));
                CommonBase.add_ref_from(this, b);
                return ret;
        }
@@ -517,7 +609,7 @@ export class PaymentParameters extends CommonBase {
         * Read a PaymentParameters from a byte array, created by PaymentParameters_write
         */
        public static constructor_read(ser: Uint8Array): Result_PaymentParametersDecodeErrorZ {
-               const ret: number = bindings.PaymentParameters_read(bindings.encodeUint8Array(ser));
+               const ret: bigint = bindings.PaymentParameters_read(bindings.encodeUint8Array(ser));
                const ret_hu_conv: Result_PaymentParametersDecodeErrorZ = Result_PaymentParametersDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
@@ -526,7 +618,7 @@ export class PaymentParameters extends CommonBase {
         * Creates a payee with the node id of the given `pubkey`.
         */
        public static constructor_from_node_id(payee_pubkey: Uint8Array): PaymentParameters {
-               const ret: number = bindings.PaymentParameters_from_node_id(bindings.encodeUint8Array(bindings.check_arr_len(payee_pubkey, 33)));
+               const ret: bigint = bindings.PaymentParameters_from_node_id(bindings.encodeUint8Array(bindings.check_arr_len(payee_pubkey, 33)));
                const ret_hu_conv: PaymentParameters = new PaymentParameters(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
                return ret_hu_conv;
@@ -536,7 +628,7 @@ export class PaymentParameters extends CommonBase {
         * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
         */
        public static constructor_for_keysend(payee_pubkey: Uint8Array): PaymentParameters {
-               const ret: number = bindings.PaymentParameters_for_keysend(bindings.encodeUint8Array(bindings.check_arr_len(payee_pubkey, 33)));
+               const ret: bigint = bindings.PaymentParameters_for_keysend(bindings.encodeUint8Array(bindings.check_arr_len(payee_pubkey, 33)));
                const ret_hu_conv: PaymentParameters = new PaymentParameters(null, ret);
                CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
                return ret_hu_conv;