Add support for saving debugging messages, generic queriers #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We add a new property
debugMsgs: string[]
toVMInstance
, to which contract calls todeps.api.debug(...)
will append. Previously, we simply printed the string out to console (which matches the behavior ofcosmwasm-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 forquery_chain
. You must now subclassBasicQuerier
and supply your ownhandleQuery()
function, which will get passed the decoded query request.BasicQuerier.query_raw()
will delegate and handle the proper encoding ofBasicQuerier.handleQuery()
, which istoUint8Array({ ok: { ok: toBase64(response) } })
, whereresponse
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 toSystemResult<ContractResult<Binary>>
(Binary
is a CosmWasm Rust type that encodes a struct to Base64 strings in JSON).