Cosmos SDK 0.47 and wasmd 0.40 support for CosmJS
Published in
2 min readJun 30, 2023
The latest release, 0.31 of CosmJS, allows your app to seamlessly connect to both Cosmos SDK 0.45 and Cosmos SDK 0.47 chains. This is possible by a new auto-detection of the Tendermint/CometBFT version in all clients. But there is more in the release.
Cosmos SDK 0.47
- Add x/group and x/gov v1 message types to registry
- Upgrade cosmjs-types to 0.8.0 to include Cosmos SDK 0.46/0.47 and IBC v7 types.
IndexedTx
andDeliverTxResponse
now have amsgResponses
field which replaces the older data field.
Dev X
- You can now broadcast a transaction without waiting for the inclusion in a block.
StargateClient.broadcastTxSync
andSigningStargateClient.signAndBroadcastSync
resolve right after the CheckTx step in the node and provide the transaction hash. - Remove high-level
searchTx
queries such asSearchByHeightQuery
andSearchBySentFromOrToQuery
since they did not work anymore across different versions of Tendermint. Only raw query strings and key/value pairs are now supported. This gives developers more control over the queries for the chains they care about.
CosmWasm
- Use the convenience method
SigningCosmWasmClient.instantiate2
to instantiate a contract using instantiate2. - Query contracts by creator are possible with the new
CosmWasmClient.getContractsByCreator
. - The new Amino JSON support for
MsgStoreCode.instantiate_permission
allows using this field with Amino signing.
The full list of changes is available in the CHANGELOG.
Migrating
When upgrading an existing application to the latest CosmJS, you need to do the following steps (more or less):
- Update all @cosmjs/* dependencies to ^0.31.0. They must all have the same version.
- If you are using cosmjs-types explicitly in your app, make sure to upgrade to version ^0.8.0.
- Re-write your
searchTx
calls to raw queries or a list of key/value pairs for the search. Please note that in Tendermint/CometBFT 0.37, you can only search for attributes within a single event. E.g. a sender search could be rewritten frommessage.module='bank' AND transfer.sender='${mySender}'
tomessage.action = '/cosmos.bank.v1beta1.MsgSend' AND message.sender = '${mySender}'
.