question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`getAccount()` method fails on the latest version of cosmos-sdk

See original GitHub issue

https://github.com/CosmWasm/cosmjs/blob/master/packages/sdk38/src/cosmosclient.ts#L222

In the current implementation, getAccount() method expects that the public key is delivered as bech32. I’m not sure which version of the cosmos-sdk the changes were made, but accounts on the newer versions of the SDK return as follows:

{"height":"2724145","result":{"type":"cosmos-sdk/Account","value":{"address":"cosmos1ntck6f6534u630q87jpamettes6shwgddag769","coins":[{"denom":"uatom","amount":"489300"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"Aqb4yDyanddEzrLjbTzhBsowmh6uC6InWAMRmCISoYt5"},"account_number":"58220","sequence":"6"}}}

Thus, bech32 decoding will fail and getAccount() method doesn’t work. And, because the above public key type is the same as https://github.com/CosmWasm/cosmjs/blob/master/packages/sdk38/src/types.ts#L39, it is not needed to parse them.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ethanfreycommented, Jul 24, 2020

So, 0.39 and 0.37 have the same encoding, and 0.38 was just some broken version (with bech32 addresses > 90 chars)

0reactions
webmaster128commented, Jul 25, 2020

In #314 you see a solution to support 0.37-0.39 with one client. I think this make everyone’s life easier and only took 2 hours (fixing a bug in Uint64 along the way).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function `getAccount` in SigningCosmWasmClient doesn't ...
I suspect cosmos-sdk/Account is an interface and cosmos-sdk/BaseAccount is an implementation of that interface. You are using @cosmjs/launchpad, ...
Read more >
types
EnsureExists returns an error if no account exists for the given address else nil. func (AccountRetriever) GetAccount ¶. func (ar AccountRetriever) GetAccount( ...
Read more >
Accounts - Cosmos SDK Documentation
In the Cosmos SDK, an account designates a pair of public key PubKey and private key PrivKey . The PubKey can be derived...
Read more >
Azure CosmosDB C# Function worked up to a few days ago
The function worked fine until a few days ago (last checked on Nov. ... Host: Error indexing method 'GetAccount'. ... AddTimers(), etc.).
Read more >
Basic API
getAccounts (); // Initialize the gaia api with the offline signer that is injected by Keplr extension. const cosmJS = new SigningCosmosClient( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found