sui icon indicating copy to clipboard operation
sui copied to clipboard

[cli][refactor] Move all the commands logic into a macro to reduce code duplication

Open stefan-mysten opened this issue 1 year ago • 1 comments
trafficstars

Description

Moved all the transaction-execution commands' logic into a macro to reduce code duplication. With this change, a few other changes happened

  • moved the displays module outside of the client_ptb module,
  • moved the pretty pretting for DryRunTransactionBlockResponse to its own display module. We should probably move more of those to their own display module, but for now this is fine.
  • each tx call returns a SuiTransactionBlockResponse, and thus changed the very specific results for Call,SplitCoins,MergeCoins,Transfer*,Pay* to use the SuiClientCommandsResult::TransactionBlock type, which simplifies a lot the code.

Test plan

Existing tests.


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • [ ] Protocol:
  • [ ] Nodes (Validators and Full nodes):
  • [ ] Indexer:
  • [ ] JSON-RPC:
  • [ ] GraphQL:
  • [ ] CLI:
  • [ ] Rust SDK:

stefan-mysten avatar May 01 '24 02:05 stefan-mysten

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 0:45am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 0:45am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 0:45am
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview May 10, 2024 0:45am

vercel[bot] avatar May 01 '24 02:05 vercel[bot]

@stefan-mysten is attempting to deploy a commit to the Mysten Labs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 10 '24 00:05 vercel[bot]

Some small clean-ups here and there but this is really much nicer than what was there before, thanks @stefan-mysten !

Thanks for all the excellent suggestions! Fixed everything except the internal error question, as I think that'd be indeed an internal error (or network error, which probably will error before getting there?)

stefan-mysten avatar May 10 '24 01:05 stefan-mysten