Exploring bdk-tx for Wallet type#15
Closed
thunderbiscuit wants to merge 1 commit intobitcoindevkit:masterfrom
Closed
Exploring bdk-tx for Wallet type#15thunderbiscuit wants to merge 1 commit intobitcoindevkit:masterfrom
thunderbiscuit wants to merge 1 commit intobitcoindevkit:masterfrom
Conversation
Member
Author
|
The API for building transactions using bdk-tx doesn't have to be any different than what we currently have with the TxBuilder, but it could also be. Here are some rough sketches. Builder patternlet mut tx_builder = wallet.create_transaction_builder();
tx_builder
.add_output(address.script_pubkey(), SEND_AMOUNT)
.fee_rate(FeeRate::from_sat_per_vb(4).unwrap());
let mut psbt = tx_builder.finish()?;Single method// pseudocode
let mut psbt = wallet.create_transaction(
outputs,
target_feerate,
must_spend,
// ...
// 12 other arguments that basically mimic the current TxBuilder methods
);Note that this method could also take a single argument let transaction_params = TransactionParams {
outputs: vec![(address.script_pubkey(), SEND_AMOUNT)],
target_feerate: FeeRate::from_sat_per_vb(4).unwrap(),
must_spend: Vec::new(),
};
let mut psbt = wallet.create_transaction(transaction_params);2 methods (one for simple common cases)The first one for simple cases often used and one that takes the full TransactionParams argument. // For simple transactions
let mut psbt = wallet.create_simple_transaction(
outputs, // (Script, Amount)
target_feerate, // FeeRate
);
// For transactions that require more customization
let mut psbt = wallet.create_complex_transaction(transaction_params); |
21fd10b to
8e9a006
Compare
8e9a006 to
58a69dc
Compare
5 tasks
Pull Request Test Coverage Report for Build 14316252517Details
💛 - Coveralls |
Member
Author
|
The API for this is being built for production in #297. Note that the method chosen in that PR is the "single method" mentioned above with a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is just me hacking away at leveraging the bdk-tx crate to build transactions.