cosmology-tech / telescope

A TypeScript Transpiler for Cosmos Protobufs ⚛️
https://cosmology.zone/products/telescope
Apache License 2.0
146 stars 43 forks source link

Amino transactions failing #641

Open ranlavanet opened 3 months ago

ranlavanet commented 3 months ago

Hi guys, we are having difficulties signing amino transactions. I did some research and would love some clarification.

I noticed all messages contain the following line in their protobufs e.g: option (amino.name) = "mint/MsgUpdateParams";

is it mandatory to add the amino name in order to sign amino transactions? we currently don't have the amino.name assigned to any message.

also are there any changes needed in the code of the modules we added on cosmos or is it just the protobuf changes + recompile?

is there an automated way to create the AMINO_MAP file assuming we want to include all lava network transactions in the lavajs repo?

one last question might be related, I wanted to test around a cosmos native amino tx like /cosmos.bank.v1beta1.MsgSend and got the following error:

Type URL '/cosmos.bank.v1beta1.MsgSend' does not exist in the Amino message type register. If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.

but even after adding it


    aminoType: 'cosmos-sdk/MsgSend'
  }```

 to the amino map file and retranspiling. it still fails with the same message. wondering what am I doing wrong. 
pyramation commented 3 months ago

is it mandatory to add the amino name in order to sign amino transactions?

it's not necessary, but helpful if there is no heuristic to compute the amino name.

is there an automated way to create the AMINO_MAP file assuming we want to include all lava network transactions in the lavajs repo?

You can either manually set the names that are registered in Go for amino in the messages, or in telescope options you can register things like the AMINO_MAP or you can write functions that will convert the proto type name to an amino type with some conversion method. If there is some heuristic or logic you can write, a method is possible to convert any lava protos amino names

also are there any changes needed in the code of the modules we added on cosmos or is it just the protobuf changes + recompile?

Yes if you are updating the protos

As a last resort if for some reason they've incorrectly added a name in the proto or you just want to update the protos, this may be the best option: https://github.com/cosmology-tech/telescope?tab=readme-ov-file#json-patch-protos — you can update the protos before having to upstream any proto file changes to the SDK to test it out.