Use JsonObject in 3 more places
This commit is contained in:
parent
5f508c40d0
commit
7435ea8d23
@ -71,7 +71,7 @@ export interface ContractCodeHistoryEntry {
|
||||
/** The source of this history entry */
|
||||
readonly operation: "Genesis" | "Init" | "Migrate";
|
||||
readonly codeId: number;
|
||||
readonly msg: Record<string, unknown>;
|
||||
readonly msg: JsonObject;
|
||||
}
|
||||
|
||||
/** Use for testing only */
|
||||
@ -439,7 +439,7 @@ export class CosmWasmClient {
|
||||
* Promise is rejected for invalid query format.
|
||||
* Promise is rejected for invalid response format.
|
||||
*/
|
||||
public async queryContractSmart(address: string, queryMsg: Record<string, unknown>): Promise<JsonObject> {
|
||||
public async queryContractSmart(address: string, queryMsg: JsonObject): Promise<JsonObject> {
|
||||
try {
|
||||
return await this.forceGetQueryClient().wasm.queryContractSmart(address, queryMsg);
|
||||
} catch (error) {
|
||||
|
||||
@ -35,6 +35,7 @@ import {
|
||||
MsgStoreCodeEncodeObject,
|
||||
wasmTypes,
|
||||
} from "./messages";
|
||||
import { JsonObject } from "./queries";
|
||||
|
||||
const registry = new Registry(wasmTypes);
|
||||
|
||||
@ -100,7 +101,7 @@ async function instantiateContract(
|
||||
async function executeContract(
|
||||
signer: OfflineDirectSigner,
|
||||
contractAddress: string,
|
||||
msg: Record<string, unknown>,
|
||||
msg: JsonObject,
|
||||
): Promise<DeliverTxResponse> {
|
||||
const memo = "Time for action";
|
||||
const theMsg: MsgExecuteContractEncodeObject = {
|
||||
|
||||
@ -61,7 +61,7 @@ export interface WasmExtension {
|
||||
* Makes a smart query on the contract and parses the response as JSON.
|
||||
* Throws error if no such contract exists, the query format is invalid or the response is invalid.
|
||||
*/
|
||||
readonly queryContractSmart: (address: string, query: Record<string, unknown>) => Promise<JsonObject>;
|
||||
readonly queryContractSmart: (address: string, query: JsonObject) => Promise<JsonObject>;
|
||||
};
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ export function setupWasmExtension(base: QueryClient): WasmExtension {
|
||||
return queryService.RawContractState(request);
|
||||
},
|
||||
|
||||
queryContractSmart: async (address: string, query: Record<string, unknown>) => {
|
||||
queryContractSmart: async (address: string, query: JsonObject) => {
|
||||
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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user