-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 TxEncoder to client TxBuilder #2926
Comments
Im confused as to why a TxBuilder needs to "unbuild/unpack" a tx? Its sole intended purpose was to be used for easily building txs (including serializing them) which later get broadcasted via |
@alexanderbez TxBuilder don't need to "unbuild/unpack" tx. My issue is about custom encoding/serializing tx in TxBuilder. |
I see. Yes, in that case I think we may be able to remove the codec entirely and provide a |
Cool, I can implement this and open a PR. |
@alexanderbez I've got a proposal. What if add |
I think we'll have to with something like option (2) you mentioned. Reason being is maybe we want different types of encoders...I can't imagine such a case, but still. (2) is also more flexible. |
So pass |
@arturalbov let me go through the CLI flows and see what solutions we can come up with. |
Ok, so I think the path of least resistance here and also somewhat clean, is the following:
How does this sound? |
Sounds great! I'll implement this |
…er to TxBuilder.TxEncoder
Summary
Hello,
In
BaseApp
we have possibility to set transaction decoder in order to convert bytes toStdTx
.On the other hand in client we're using
TxBuilder
that have strict logic of tx marshaling:Problem Definition
The problem is when I need some custom decoder on the node side I have to extend
TxBuilder
or rewrite some of its methods. That results in a lot of redundant code.Proposal
I propose to add field named
TxEncoder
intoTxBuilder
of typetype TxDecoder func(tx Tx) ([]byte, Error)
which will called everywhere we need to get transaction bytes. And move old behavior to "default" encoder.I could make a PR for you.
For Admin Use
The text was updated successfully, but these errors were encountered: