cosmos / cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
https://cosmos.github.io/cosmjs/
Apache License 2.0
645 stars 330 forks source link

Error: Invalid string. Length must be a multiple of 4 #1482

Closed dillu24 closed 11 months ago

dillu24 commented 11 months ago

Hi,

I am currently using telescope version v0.102.0 to generate a client with an underlying v0.31.1 of CosmJS for a custom chain running on Cosmos SDK version for a v0.47. At the moment, when I am submitting a custom TX I am getting the following error returned by signAndBroadcast:

Error: Invalid string. Length must be a multiple of 4, however, the TX is still going through.`

code generating the error:

const broadcast = await this._client.signAndBroadcast(
        depositor,
        [msg],
        1.5 // To use fee on auto mode: prefix and gas price needs to be defined before
      );

Any idea of what might be the issue?

dillu24 commented 11 months ago

Actually I think I found the issue. Tendermint version is hidden inside the node RPC, so, it cannot connect with Tendermint37Client

webmaster128 commented 11 months ago

Why/how is the version hidden?

You can create the Tendermint37Client client manually and pass it to SigningStargateClient/SigningCosmWasmClient to bypass auto-detection if needed.