lightninglabs / lightninglabs/taproot-assets
[feature]: allow funding grouped asset sends in `FundVirtualPsbt`
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 525
- Forks
- 150
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
The FundVirtualPsbt RPC method currently only has two ways for instructing the wallet what type of send to fund:
- Using a vPSBT (which is always bound to a single asset ID, even for grouped assets)
- Using a TAP address as a template
When using a V2 TAP address that supports grouped assets, the RPC will potentially return multiple vPSBTs of different asset tranches of that group.
But for interactive cases where no TAP addresses are involved, there currently is no way to tell the wallet assets from all available tranches of a group should be used.
This will be required for interactive cases such as Loop integration (cc @bhandras and @sputn1ck).
We should add a new, third way to the oneof template. This is an example of how the proto file could look like:
message FundingParams {
// The number of assets to select at least. This should correspond to the
// sum of all amounts in the outputs.
uint64 min_amount = 1;
oneof specifier {
/*
The asset ID of the asset to select. If this is set, then only inputs
with this asset ID will be selected.
*/
bytes asset_id = 2;
/*
The group key of the asset to select. If this is set, then only inputs
with this group key will be selected.
*/
bytes script_key = 3;
}
// The type of the script key that should be used for the funding inputs.
taprpc.ScriptKeyTypeQuery script_key_type = 4;
}
message FundingTemplate {
/*
An optional list of inputs to use, constraining the list of inputs available
to the coin selection algorithm. Every input must be an asset UTXO known
to the wallet. The sum of all inputs must be greater than or equal to the
sum of all outputs.
If no inputs are specified, asset coin selection will be performed instead
and inputs of sufficient value will be added to the resulting PSBT.
If the inputs don't contain any assets compatible with the requested funding
input parameters, then the coin selection will fail.
*/
repeated PrevId inputs = 1;
// The parameters that specify the funding inputs to select.
FundingParams funding_params = 2;
// A list of vPSBTs that should be used as the templates for the _outputs_
// of the resulting funded vPSBT(s). Any inputs of the virtual packets will
// be ignored. And the outputs should have all the required fields set,
// including the on-chain anchor output index, internal key, script key,
// amount and proof courier address.
repeated bytes output_vpsbt_templates = 3;
}
message FundVirtualPsbtRequest {
oneof template {
/*
Use an existing PSBT packet as the template for the funded PSBT.
*/
bytes psbt = 1;
/*
Use the asset outputs and optional asset inputs from this raw template.
*/
TxTemplate raw = 2;
/*
Use a funding template to specify the input params and the output
templates to use for the funded PSBT. The funding template allows for
more flexibility in specifying the inputs and supports grouped assets.
*/
FundingTemplate funding_template = 3;
}
/*
Specify the type of coins that should be selected. Defaults to allowing both
script trees and BIP-086 compliant inputs.
*/
CoinSelectType coin_select_type = 3;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the FundingParams, FundingTemplate, and FundVirtualPsbtRequest definitions in taprpc/assetwalletrpc/assetwallet.proto, then trace the FundVirtualPsbt RPC implementation. Verify how the new funding template should support grouped-asset selection for interactive sends without TAP addresses, including output vPSBT templates and optional inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100