cli
cli copied to clipboard
no server response when using ts-client
Describe the bug
When using ts-client, the server response is not present when sending a message.
To reproduce Steps to reproduce the behavior:
- For example, follow the blog tutorial and run
ignite scaffold message createPost title body - Modify tx.proto, adding a value to the response
message MsgCreatePostResponse {
uint64 id = 1;
}
- Return something from
CreatePost, e.g.
func (k msgServer) CreatePost(goCtx context.Context, msg *types.MsgCreatePost) (*types.MsgCreatePostResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
_ = ctx
return &types.MsgCreatePostResponse{Id: 1}, nil
}
- Use the generated code from ts-client to make a call
const client = txClient({
signer: this.wallet,
prefix: "cosmos",
addr: this.rpcEndpoint,
});
let res = await client.sendMsgCreatePost({
value: { title: "A", body: "B", creator: this.account.address },
});
console.log(res);
- The response looks like this (I was expecting it to include the response from the server, i.e. the data from
MsgCreatePostResponse):
{
code: 0,
height: 133,
rawLog: '[{"msg_index":0,"events":[{"type":"message","attributes":[{"key":"action","value":"/evote.evote.MsgCreatePost"}]}]}]',
transactionHash: 'BED69D59E5769C5756BAF3A678D38890B0F1DB948EE74898C2695A1ED49BBDD4',
gasUsed: 53456,
gasWanted: 200000
}
What version are you using?
Ignite CLI version: v0.24.0
Ignite CLI build date: 2022-09-12T14:14:32Z
Ignite CLI source hash: 21c6430cfcc17c69885524990c448d4a3f56461c
Your OS: linux
Your arch: arm64
Your go version: go version go1.19.1 linux/arm64
Your uname -a: Linux 7349bff6f88b 5.10.124-linuxkit #1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022 aarch64 GNU/Linux
Your cwd: /app
Is on Gitpod: false
@mme The ts client relies on cosmjs to broadcast txs and unfortunately while building the response, the tx data is not propagated to the object in cosmjs.
That said, there's a pending PR about that https://github.com/cosmos/cosmjs/pull/1241, the best for now is probably to wait for its merge.
@tbruyelle thanks, I'll wait
@tbruyelle thanks, I'll wait
Your other option is to simply query the chain using the txhash once it's returned and you will receive the full tx response object
Closing due to stale nature, please reopen if otherwise.