Let queryContractSmart return a string
This commit is contained in:
parent
669905b11e
commit
6e83bd6459
@ -324,14 +324,14 @@ export class RestClient {
|
||||
|
||||
// Makes a "smart query" on the contract, returns response verbatim (json.RawMessage)
|
||||
// Throws error if no such contract or invalid query format
|
||||
public async queryContractSmart(address: string, query: object): Promise<unknown> {
|
||||
public async queryContractSmart(address: string, query: object): Promise<string> {
|
||||
const encoded = toHex(toUtf8(JSON.stringify(query)));
|
||||
const path = `/wasm/contract/${address}/smart/${encoded}?encoding=hex`;
|
||||
const responseData = (await this.get(path)) as WasmResponse;
|
||||
if (isWasmError(responseData)) {
|
||||
throw new Error(responseData.error);
|
||||
}
|
||||
// no extra parse here
|
||||
// no extra parse here for now, see https://github.com/confio/cosmwasm/issues/144
|
||||
return responseData.result;
|
||||
}
|
||||
}
|
||||
|
||||
2
packages/sdk/types/restclient.d.ts
vendored
2
packages/sdk/types/restclient.d.ts
vendored
@ -104,6 +104,6 @@ export declare class RestClient {
|
||||
getContractInfo(address: string): Promise<ContractInfo>;
|
||||
getAllContractState(address: string): Promise<readonly WasmData[]>;
|
||||
queryContractRaw(address: string, key: Uint8Array): Promise<unknown | null>;
|
||||
queryContractSmart(address: string, query: object): Promise<unknown>;
|
||||
queryContractSmart(address: string, query: object): Promise<string>;
|
||||
}
|
||||
export {};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user