-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add tx::builder
module and initial classic commands
#1551
Conversation
Currently all transactions are built by hand and require a lot of knowledge around the internal types. Furthermore, there is a lot of redundant code around creating, submitting transaction. This PR adds the two new operation builders (create account and payment) and their corresponding commands. This example should make it easy to have a quick design discussion before adding the rest of the operations.
tx::builder
and initial classic cmds createAccount/paymenttx::builder
module and initial classic commands create account & payment
Users can use `builders::MuxedAccount` to create the account if needed, but most cases won't need it
tx::builder
module and initial classic commands create account & paymenttx::builder
module and initial classic commands
ec7014e
to
b0274b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to do a full pass but a cursory look and this is very elegant. I appreciate that we're consolidating the building of some existing txs in the CLI along the way. Some questions and thoughts inline, specifically to avoid recreating another Stellar SDK-like layer, but that might be necessary at this point.
I've got this in my review queue to do a full review, just ran out of time to go deep today.
Co-authored-by: Leigh McCulloch <[email protected]>
@leighmcculloch Updated to reflect feedback. Still need to update tests. |
Also use `From<&Cmd> for xdr::OperationBody` instead of creating a new type. Then use this to simplify each command by moving the `tx.handle_and_print` to the parent subcommand so that each command only needs to implement the trait.
@leighmcculloch, I've removed all of the builder types that I could. One that still needs to be added to the xdr crate is the FromStr for |
Co-authored-by: Leigh McCulloch <[email protected]>
a673c66
to
c5afff8
Compare
a65121c
to
27b34fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏻
@janewang @stellar/devx There's a large amount of functionality being introduced with this PR. We should plan to do some dog fooding of it for ergonomics in the next couple weeks, maybe get some others to dog food it too. |
What
Add a transaction builder and operation builder trait. Also adds the first two stellar classic commands under the subcommand
tx new
:Todo:
Why
Currently all transactions are built by hand and require a lot of knowledge around the internal types. Furthermore, there is a lot of redundant code around creating, submitting transaction.
These examples should make it easy to have a quick design discussion before adding the rest of the operations.
Known limitations
[TODO or N/A]