terra-money / fcd-classic

Terra ETL + RestFul API Server
https://fcd.terra.dev/swagger
MIT License
63 stars 40 forks source link

encode a staking tx in protobuf #171

Closed roccomuso closed 2 years ago

roccomuso commented 2 years ago

Hei,

I saw that this endpoint /txs/encode allows to encode an Amino JSON tx to an Amino binary tx.

For "amino binary tx" do you mean protobuf?

The endpoint works great for MsgSend transactions but it gives this error "error": "json: cannot unmarshal array into Go value of type map[string]json.RawMessage" when trying to encode a staking/MsgDelegate tx.

What am I missing?

hanjukim commented 2 years ago

This issue is not related to fcd project. You should look into terra.js for encoding protobuf directly without using the legacy endpoint

roccomuso commented 2 years ago

@hanjukim I'm not able to broadcast a staking tx using the legacy fcd /txs endpoint. That's why I asked here.

I'm getting this error:

"this transaction cannot be broadcasted via legacy REST endpoints, because it does not support Amino serialization. Please either use CLI, gRPC, gRPC-gateway, or directly query the Tendermint RPC endpoint to broadcast this transaction. The new REST endpoint (via gRPC-gateway) is POST /cosmos/tx/v1beta1/txs. Please also see the REST endpoints migration guide at https://docs.cosmos.network/master/migrations/rest.html for more info"