eco-stake / restake

Auto-compounder script for Cosmos Validators using REStake
https://restake.app
MIT License
362 stars 313 forks source link

Desmos Failed to broadcast: Unsupported type #334

Closed dvanhove89 closed 2 years ago

dvanhove89 commented 2 years ago

Restake is able to pick up the list of supported validators and my own delegation, however when attempting any action (delegate, manual compound, claim, enable restake), the following error is thrown:

Failed to broadcast: Unsupported type: '/desmos.profiles.v1beta1.Profile'

RiccardoM commented 2 years ago

This is due to the fact that REStake uses CosmWASM to get the account details.

Under the hood, CosmWASM uses StargateClient which calls the following method: https://github.com/cosmos/cosmjs/blob/1e11948c076aa756300691a5c82f897cd6a351a2/packages/stargate/src/stargateclient.ts#L213

As you can see, that method uses the accountFromAny method which is able to deserialize only basic Cosmos accounts: https://github.com/cosmos/cosmjs/blob/1e11948c076aa756300691a5c82f897cd6a351a2/packages/stargate/src/accounts.ts#L44

Desmos has its own custom account implementation: the Desmos Profile. This is not supported by CosmWASM by default, hence why it's returning that error. I am personally taking care of this with cosmos/cosmjs#1099 to make it possible to pass a custom account deserializer function to StargateClient. Once that's done, I will take care of updating REStake code to support Desmos accounts as well.

tombeynon commented 2 years ago

Thanks so much for all your work on this @RiccardoM - I have to admit I'm only just keeping on top of my todo list at the moment so really appreciate you running with this