Skip to content

Conversation

ouiliame
Copy link
Contributor

We add a new property debugMsgs: string[] to VMInstance, to which contract calls to deps.api.debug(...) will append. Previously, we simply printed the string out to console (which matches the behavior of cosmwasm-vm-js); however this is harder to work with for consuming applications like CWSimulate.

The old implementation for BasicQuerier was temporary and designed to only handle 1 case (in the tests), this adds generic support for query_chain. You must now subclass BasicQuerier and supply your own handleQuery() function, which will get passed the decoded query request. BasicQuerier.query_raw() will delegate and handle the proper encoding of BasicQuerier.handleQuery(), which is toUint8Array({ ok: { ok: toBase64(response) } }), where response is a JSON object containing the query response.

In the future, we will need to provide support for Rust errors, because the Ok(Ok(response)) corresponds to SystemResult<ContractResult<Binary>> (Binary is a CosmWasm Rust type that encodes a struct to Base64 strings in JSON).

@lukedawilson lukedawilson merged commit 3cf396f into main Oct 31, 2022
@lukedawilson lukedawilson deleted the feat/debug-msgs branch October 31, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants