pub fn shield_transparent_funds<DbT, ParamsT, InputsT, ChangeT>(
wallet_db: &mut DbT,
params: &ParamsT,
clock: &impl Clock,
rng: &mut impl CryptoRng,
spend_prover: &impl SpendProver,
output_prover: &impl OutputProver,
input_selector: &InputsT,
change_strategy: &ChangeT,
shielding_threshold: Zatoshis,
spending_keys: &SpendingKeys,
from_addrs: &[TransparentAddress],
to_account: <DbT as InputSource>::AccountId,
confirmations_policy: ConfirmationsPolicy,
) -> Result<NonEmpty<TxId>, ShieldErrT<DbT, InputsT, ChangeT>>where
ParamsT: Parameters,
DbT: WalletWrite + WalletCommitmentTrees + InputSource<Error = <DbT as WalletRead>::Error>,
InputsT: ShieldingSelector<InputSource = DbT>,
ChangeT: ChangeStrategy<MetaSource = DbT>,Available on crate feature
transparent-inputs only.Expand description
Constructs a transaction that consumes available transparent UTXOs belonging to the specified secret key, and sends them to the most-preferred receiver of the default internal address for the provided Unified Spending Key.
This procedure will not attempt to shield transparent funds if the total amount being shielded is less than the default fee to send the transaction. Fees will be paid only from the transparent UTXOs being consumed.
Parameters:
wallet_db: A read/write reference to the wallet databaseparams: Consensus parametersrng: The source of randomness used to construct, prove, and sign the transaction.spend_prover: Thesapling::SpendProverto use in constructing the shielded transaction.output_prover: Thesapling::OutputProverto use in constructing the shielded transaction.input_selector: TheInputSelectorto for note selection and change and fee determinationusk: The unified spending key that will be used to detect and spend transparent UTXOs, and that will provide the shielded address to which funds will be sent. Funds will be shielded to the internal (change) address associated with the most preferred shielded receiver corresponding to this account, or if no shielded receiver can be used for this account, this function will return an error. This procedure will return an error if the USK does not correspond to an account known to the wallet.from_addrs: The list of transparent addresses that will be used to filter transaparent UTXOs received by the wallet. Only UTXOs received at one of the provided addresses will be selected to be shielded.min_confirmations: The minimum number of confirmations that a previously received note must have in the blockchain in order to be considered for being spent. A value of 10 confirmations is recommended and 0-conf transactions are not supported.