Accept non-ASCII inputs in query requests of queryContractSmart

This commit is contained in:
Simon Warta 2022-09-15 09:58:31 +02:00
parent e1ad942805
commit c9ca6ca721
2 changed files with 5 additions and 2 deletions

View File

@ -57,12 +57,15 @@ and this project adheres to
- @cosmjs/tendermint-rpc: Fix decoding events without attributes ([#1198]).
- @cosmjs/amino, @cosmjs/proto-signing: Support amounts larger than the uint64
range in `parseCoins` ([#1268]).
- @cosmjs/cosmwasm-stargate: Accept non-ASCII inputs in query requests of
`{CosmWasmClient,WasmExtension}.queryContractSmart` ([#1269]).
[#1170]: https://github.com/cosmos/cosmjs/issues/1170
[#1177]: https://github.com/cosmos/cosmjs/issues/1177
[#1188]: https://github.com/cosmos/cosmjs/pull/1188
[#1198]: https://github.com/cosmos/cosmjs/pull/1198
[#1268]: https://github.com/cosmos/cosmjs/issues/1268
[#1269]: https://github.com/cosmos/cosmjs/issues/1269
### Changed

View File

@ -1,4 +1,4 @@
import { fromUtf8, toAscii } from "@cosmjs/encoding";
import { fromUtf8, toUtf8 } from "@cosmjs/encoding";
import { createPagination, createProtobufRpcClient, QueryClient } from "@cosmjs/stargate";
import {
QueryAllContractStateResponse,
@ -117,7 +117,7 @@ export function setupWasmExtension(base: QueryClient): WasmExtension {
},
queryContractSmart: async (address: string, query: Record<string, unknown>) => {
const request = { address: address, queryData: toAscii(JSON.stringify(query)) };
const request = { address: address, queryData: toUtf8(JSON.stringify(query)) };
const { data } = await queryService.SmartContractState(request);
// By convention, smart queries must return a valid JSON document (see https://github.com/CosmWasm/cosmwasm/issues/144)
let responseText: string;