-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add traits for a leaner transaction creation API #169
Comments
This doesn't work, because the accounts are usually not known when creating the transaction. It could be added to |
Correct, With the current solution, I find ordered params and build invocations clumsy. let t = TxnBuilder::with(
¶ms,
Pay::new(from.address(), to.address(), MicroAlgos(123_456)).build(),
)
.build()?; |
Well, you mentioned intuitiveness. For a fair comparison: let txn = TxnBuilder::with(
¶ms,
alice.pay(&bob, MicroAlgos(123_456))
).build()?; vs. let txn = TxnBuilder::with(
¶ms,
Pay::new(alice, bob, MicroAlgos(123_456)).build(),
).build()?; Not a fan of the second (current) one, but the first one has something more awkward. The supposedly "nice" api is still embedded in the low-level builder. Further, you removed the builder from the transaction types, so we'd have to parametrize the "nice" api with potentially a lot of not used optionals. And honestly, I find the recurrent discussion around the builder API misplaced currently, given that we're standing on shaky foundations: There's very little test coverage, we've not feature parity with the official SDKs, no process to sync with the node's APIs, etc. These cosmetic discussions have their place, but currently are taking focus away from urgent issues. |
For the record, this had some additional context that was not mentioned here (mainly a conversation in which we seemed to agree about next steps). We talked about this now, and I want to add that I by no means want to discourage from submitting ideas, whatever they might be. I'll be closing this, because in its current presentation it seems not something we want to pursue. Feel free to reopen or create a new issue if it's evolved or there's need for further discussion. |
Addin traits like this:
we could have a more intuitive process when building transactions. For instance, this is how our
payment.rs
example would look like:Notice that the new trait will need to be in scope for this to work. Maybe this would require the creation of a prelude?
The text was updated successfully, but these errors were encountered: