hyperweb-io / hyperweb-io/telescope
`fromPartial` not generating/using interface decoders
- Dominant language
- TypeScript
- Stars
- 154
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
The `fromJSON` and `toJSON` methods do not create a `Cosmos_govv1beta1Content_FromJSON` nor `Cosmos_govv1beta1Content_ToJSON` like the Amino encoders/decoders do.
I'm trying to take a generic proposal object (with type URL and a JSON value with a bunch of custom fields) and encode it. To do so, I was hoping to use something like `Cosmos_govv1beta1Content_FromJSON` to encode any of the detected proposal types automatically, but it's never created.
Instead, both functions use `Any` every time (example from `/cosmos.gov.v1beta1.MsgSubmitProposal`):
```ts
fromJSON(object: any): MsgSubmitProposal {
return {
content: isSet(object.content) ? Any.fromJSON(object.content) : undefined,
initialDeposit: Array.isArray(object?.initialDeposit) ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) : [],
proposer: isSet(object.proposer) ? String(object.proposer) : ""
};
},
toJSON(message: MsgSubmitProposal): unknown {
const obj: any = {};
message.content !== undefined && (obj.content = message.content ? Any.toJSON(message.content) : undefined);
if (message.initialDeposit) {
obj.initialDeposit = message.initialDeposit.map(e => e ? Coin.toJSON(e) : undefined);
} else {
obj.initialDeposit = [];
}
message.proposer !== undefined && (obj.proposer = message.proposer);
return obj;
},
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.