cosmos-sdk/client
Austin Chandra f8b55ff8ee
feat: add capability to reformat Transactions before broadcasting (#12936)
## Description
Increase customized signing capabilities by:
- Adding a hook to preprocess transactions before broadcasting

This PR introduces the ability to preprocess transactions before broadcasting, a feature that provides the ability to add extensions, or otherwise customize the payload to satisfy a chain's requirements. For adaptability, the parameters include the keytype to allow differentiation between formatting transactions for Ledger vs. software keys.

## PR
This PR introduces a hook to preprocess transactions, chiefly to add extensions, from a higher-level chain. Key changes and relevant files:

- Add `PreprocessTxFn` type and fields to both `Context` and `Factory`
- Instantiate the `Factory` with the `PreprocessTxFn` provided by the `Context`
- Call `PreprocessTx` with the appropriate parameters after signing

Closes: #XXXX



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
2022-08-30 01:16:12 +00:00
..
config fix: tx commands are no need to specify --chain-id (#12092) 2022-05-31 13:27:52 +00:00
debug chore: Db linting (#12141) 2022-06-08 19:02:01 +02:00
docs fix: add nft query to swagger.yaml (#12968) 2022-08-20 00:00:05 +02:00
flags docs(cli): improve --gas flag description (#12913) 2022-08-18 22:48:08 +02:00
grpc chore: downgrade to tendermint v0.34.x (#12958) 2022-08-20 02:33:07 +02:00
input chore: gofumpt (#11839) 2022-05-19 10:55:27 +02:00
keys chore: fix linting issues exposed by fixing golangci-lint (#12895) 2022-08-11 22:00:24 +02:00
rpc chore: downgrade to tendermint v0.34.x (#12958) 2022-08-20 02:33:07 +02:00
testutil refactor: remove dependency on simapp from client tests (#12545) 2022-07-12 18:43:02 -05:00
tx feat: add capability to reformat Transactions before broadcasting (#12936) 2022-08-30 01:16:12 +00:00
v2 build(deps): Bump google.golang.org/grpc in /client/v2 (#13021) 2022-08-24 21:47:14 +02:00
account_retriever.go chore!: Refactor x/bank CLI Tests (#12706) 2022-08-03 12:08:41 -04:00
broadcast_test.go chore: downgrade to tendermint v0.34.x (#12958) 2022-08-20 02:33:07 +02:00
broadcast.go chore: downgrade to tendermint v0.34.x (#12958) 2022-08-20 02:33:07 +02:00
cmd_test.go fix(cli): home flag gets ignored when running help (#11645) 2022-04-21 09:27:31 -04:00
cmd.go chore: sdk.Int to math.Int (#12132) 2022-06-03 12:17:02 +00:00
context_test.go refactor: remove simapp from client/server tests (#12676) 2022-07-21 22:01:23 +02:00
context.go feat: add capability to reformat Transactions before broadcasting (#12936) 2022-08-30 01:16:12 +00:00
grpc_query_test.go refactor: remove simapp from client/server tests (#12676) 2022-07-21 22:01:23 +02:00
grpc_query.go fix(codec): MarshalInterface should err when UnmarshalInterface will fail (#12964) 2022-08-19 18:42:55 +00:00
internal_client_test.go fix(codec): MarshalInterface should err when UnmarshalInterface will fail (#12964) 2022-08-19 18:42:55 +00:00
query.go chore!: Refactor x/bank CLI Tests (#12706) 2022-08-03 12:08:41 -04:00
tendermint.go chore: downgrade to tendermint v0.34.x (#12958) 2022-08-20 02:33:07 +02:00
test_helpers.go Replace tmcrypto.PubKey by our own cryptotypes.PubKey (#7419) 2020-11-09 16:01:43 +00:00
tx_config.go feat: add cli for tips transactions (#10311) 2021-12-07 18:02:21 +00:00
utils_test.go client: fix Paginate's arguments validation (#6205) 2020-05-13 13:14:43 +00:00
utils.go chore: downgrade to tendermint v0.34.x (#12958) 2022-08-20 02:33:07 +02:00