cosmology-tech / telescope

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

Don't encode strings if empty OR undefined #665

Closed Zetazzz closed 2 weeks ago

Zetazzz commented 1 month ago

don't encode strings(numbers and bigint too) if empty OR undefined (so change the if statement in the encode function to just if (message.denom0))

Cases need to be handled: string, number, bigint

e.g.:

  encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    if (message.address !== "") {

Should be:

  encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
    if (message.address && message.address !== "") {