soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

feat: add `tx::builder` module and initial classic commands

Open willemneal opened this issue 1 year ago • 1 comments

What

Add a transaction builder and operation builder trait. Also adds the first two stellar classic commands under the subcommand tx new:

  • [x] Create account
  • [x] Payment
  • [x] Set options
  • [x] Bump sequence
  • [x] Account Merge
  • [x] Manage data
  • [x] InvokeFunction
  • [x] Extend footprint ttl
  • [x] Restore footprint
  • [x] Allow trust
  • [x] Change trust
  • [x] Set trustline flags
  • [x] Doc review

Todo:

  • [x] Tests

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]

willemneal avatar Aug 19 '24 17:08 willemneal

@leighmcculloch Updated to reflect feedback. Still need to update tests.

willemneal avatar Sep 25 '24 21:09 willemneal

@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 Asset, which I will open another PR for soon. Also I removed the unneeded Operation trait and just use From for Operation Body, all of which simplified the code a good deal.

willemneal avatar Sep 30 '24 20:09 willemneal

@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.

leighmcculloch avatar Oct 02 '24 05:10 leighmcculloch