From af702f7aa458b8cf6575c7aaf429f4bae7b3761b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20Kn=C3=A1b?= Date: Wed, 24 Apr 2024 09:11:47 +0200 Subject: [PATCH 1/2] Add utxo_selection types --- lnd_methods/onchain/fund_psbt.d.ts | 5 +++++ lnd_methods/onchain/get_chain_fee_estimate.d.ts | 5 +++++ lnd_methods/onchain/send_to_chain_address.d.ts | 4 ++++ lnd_methods/onchain/send_to_chain_addresses.d.ts | 4 ++++ lnd_methods/onchain/send_to_chain_output_scripts.d.ts | 4 ++++ typescript/shared.d.ts | 2 ++ 6 files changed, 24 insertions(+) diff --git a/lnd_methods/onchain/fund_psbt.d.ts b/lnd_methods/onchain/fund_psbt.d.ts index fb8dc6f0..1d6fee48 100644 --- a/lnd_methods/onchain/fund_psbt.d.ts +++ b/lnd_methods/onchain/fund_psbt.d.ts @@ -1,6 +1,7 @@ import { AuthenticatedLightningArgs, AuthenticatedLightningMethod, + UtxoSelection, } from '../../typescript'; import {MergeExclusive} from 'type-fest'; @@ -57,6 +58,8 @@ export type FundPsbtResult = { }[]; /** Unsigned PSBT Hex */ psbt: string; + /** Select UTXOs Using Method String */ + utxo_selection?: UtxoSelection; }; /** @@ -73,6 +76,8 @@ export type FundPsbtResult = { * This method is not supported in LND 0.11.1 and below * * Specifying 0 for `min_confirmations` is not supported in LND 0.13.0 and below + * + * `utxo_selection` is not supported in LND 0.17.5 and below */ export const fundPsbt: AuthenticatedLightningMethod< FundPsbtArgs, diff --git a/lnd_methods/onchain/get_chain_fee_estimate.d.ts b/lnd_methods/onchain/get_chain_fee_estimate.d.ts index 53f3e0d0..6dbed1b6 100644 --- a/lnd_methods/onchain/get_chain_fee_estimate.d.ts +++ b/lnd_methods/onchain/get_chain_fee_estimate.d.ts @@ -1,6 +1,7 @@ import { AuthenticatedLightningArgs, AuthenticatedLightningMethod, + UtxoSelection, } from '../../typescript'; export type GetChainFeeEstimateArgs = AuthenticatedLightningArgs<{ @@ -14,6 +15,8 @@ export type GetChainFeeEstimateArgs = AuthenticatedLightningArgs<{ target_confirmations?: number; /** Minimum Confirmations for UTXO Selection */ utxo_confirmations?: number; + /** Select UTXOs Using Method String */ + utxo_selection?: UtxoSelection; }>; export type GetChainFeeEstimateResult = { @@ -27,6 +30,8 @@ export type GetChainFeeEstimateResult = { * Get a chain fee estimate for a prospective chain send * * Requires `onchain:read` permission + * + * `utxo_selection` is not supported in LND 0.17.5 and below */ export const getChainFeeEstimate: AuthenticatedLightningMethod< GetChainFeeEstimateArgs, diff --git a/lnd_methods/onchain/send_to_chain_address.d.ts b/lnd_methods/onchain/send_to_chain_address.d.ts index 075a38b8..b4bbec04 100644 --- a/lnd_methods/onchain/send_to_chain_address.d.ts +++ b/lnd_methods/onchain/send_to_chain_address.d.ts @@ -38,6 +38,8 @@ export type SendToChainAddressArgs = AuthenticatedLightningArgs< target_confirmations?: number; /** Minimum Confirmations for UTXO Selection */ utxo_confirmations?: number; + /** Select UTXOs Using Method String */ + utxo_selection?: UtxoSelection; } & ExpectedNoTokensSpecifiedWhenSendingAllFunds & ExpectedLogFunctionForChainSendSocketAnnounce >; @@ -61,6 +63,8 @@ export type SendToChainAddressResult = { * Requires `onchain:write` permission * * `utxo_confirmations` is not supported on LND 0.11.1 or below + * + * `utxo_selection` is not supported in LND 0.17.5 and below */ export const sendToChainAddress: AuthenticatedLightningMethod< SendToChainAddressArgs, diff --git a/lnd_methods/onchain/send_to_chain_addresses.d.ts b/lnd_methods/onchain/send_to_chain_addresses.d.ts index c70605c7..a77a15c8 100644 --- a/lnd_methods/onchain/send_to_chain_addresses.d.ts +++ b/lnd_methods/onchain/send_to_chain_addresses.d.ts @@ -32,6 +32,8 @@ export type SendToChainAddressesArgs = AuthenticatedLightningArgs< target_confirmations?: number; /** Minimum Confirmations for UTXO Selection */ utxo_confirmations?: number; + /** Select UTXOs Using Method String */ + utxo_selection?: UtxoSelection; } & ExpectedLogForChainSendWebSocketAnnouncement >; @@ -54,6 +56,8 @@ export type SendToChainAddressesResult = { * Requires `onchain:write` permission * * `utxo_confirmations` is not supported on LND 0.11.1 or below + * + * `utxo_selection` is not supported in LND 0.17.5 and below */ export const sendToChainAddresses: AuthenticatedLightningMethod< SendToChainAddressesArgs, diff --git a/lnd_methods/onchain/send_to_chain_output_scripts.d.ts b/lnd_methods/onchain/send_to_chain_output_scripts.d.ts index 4f32d5ec..1a024a4a 100644 --- a/lnd_methods/onchain/send_to_chain_output_scripts.d.ts +++ b/lnd_methods/onchain/send_to_chain_output_scripts.d.ts @@ -17,6 +17,8 @@ export type SendToChainOutputScriptsArgs = AuthenticatedLightningArgs<{ }[]; /** Minimum Confirmations for UTXO Selection Number */ utxo_confirmations?: number; + /** Select UTXOs Using Method String */ + utxo_selection?: UtxoSelection; }>; export type SendToChainOutputScriptsResult = { @@ -40,6 +42,8 @@ export type SendToChainOutputScriptsResult = { * Requires `onchain:write` permission * * Requires LND compiled with `walletrpc` build tag + * + * `utxo_selection` is not supported in LND 0.17.5 and below */ export const sendToChainOutputScripts: AuthenticatedLightningMethod< SendToChainOutputScriptsArgs, diff --git a/typescript/shared.d.ts b/typescript/shared.d.ts index 0260aa55..42a33cdc 100644 --- a/typescript/shared.d.ts +++ b/typescript/shared.d.ts @@ -118,3 +118,5 @@ export type RouteNode = { export type Route = RouteNode[] export type Routes = Route[] + +export type UtxoSelection = "largest" | "random"; From 115662fcd7868025b92851be895dab9132d83e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20Kn=C3=A1b?= Date: Wed, 24 Apr 2024 09:19:50 +0200 Subject: [PATCH 2/2] Fix missing imports --- lnd_methods/onchain/send_to_chain_address.d.ts | 1 + lnd_methods/onchain/send_to_chain_addresses.d.ts | 1 + lnd_methods/onchain/send_to_chain_output_scripts.d.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/lnd_methods/onchain/send_to_chain_address.d.ts b/lnd_methods/onchain/send_to_chain_address.d.ts index b4bbec04..7b578d70 100644 --- a/lnd_methods/onchain/send_to_chain_address.d.ts +++ b/lnd_methods/onchain/send_to_chain_address.d.ts @@ -3,6 +3,7 @@ import { AuthenticatedLightningArgs, AuthenticatedLightningMethod, LightningError, + UtxoSelection, } from '../../typescript'; import {MergeExclusive} from 'type-fest'; diff --git a/lnd_methods/onchain/send_to_chain_addresses.d.ts b/lnd_methods/onchain/send_to_chain_addresses.d.ts index a77a15c8..7890638e 100644 --- a/lnd_methods/onchain/send_to_chain_addresses.d.ts +++ b/lnd_methods/onchain/send_to_chain_addresses.d.ts @@ -3,6 +3,7 @@ import { AuthenticatedLightningArgs, AuthenticatedLightningMethod, LightningError, + UtxoSelection, } from '../../typescript'; import {MergeExclusive} from 'type-fest'; diff --git a/lnd_methods/onchain/send_to_chain_output_scripts.d.ts b/lnd_methods/onchain/send_to_chain_output_scripts.d.ts index 1a024a4a..b9e9e194 100644 --- a/lnd_methods/onchain/send_to_chain_output_scripts.d.ts +++ b/lnd_methods/onchain/send_to_chain_output_scripts.d.ts @@ -1,6 +1,7 @@ import { AuthenticatedLightningArgs, AuthenticatedLightningMethod, + UtxoSelection, } from '../../typescript'; import {MergeExclusive} from 'type-fest';