AbstractSDK / cw-orchestrator

All-in-one Rust-based CosmWasm testing, scripting, and deployment tool.
https://orchestrator.abstract.money
GNU General Public License v3.0
75 stars 17 forks source link

Helpers to querying raw state outside contracts #402

Closed Kayanski closed 2 months ago

Kayanski commented 2 months ago

This PR aims at adding a simple helper to query raw state from outside contracts. Types are derived automatically.

You can use the following syntax :

const TEST_ITEM: Item<TestItem> = Item::new("test-item");
const TEST_MAP: Map<String, TestItem> = Map::new("test-map");

let contract = Contract::new(chain);
contract.item_query(TEST_ITEM);
contract.map_query(MAP_ITEM, map_key);

Do you think we should use this instead :

TEST_ITEM.cw_orch_query(&contract)?;
MAP_ITEM.cw_orch_query(&contract, map_key)?;
cloudflare-pages[bot] commented 2 months ago

Deploying cw-orchestrator with  Cloudflare Pages  Cloudflare Pages

Latest commit: a7c994b
Status:⚡️  Build in progress...

View logs

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (main@a066f9e). Learn more about missing BASE report.

:exclamation: Current head 4598e69 differs from pull request most recent head a7c994b

Please upload reports for the commit a7c994b to get more accurate results.

Additional details and impacted files | [Files](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/402?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK) | Coverage Δ | | |---|---|---| | [contracts/mock\_contract/src/lib.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/402?src=pr&el=tree&filepath=contracts%2Fmock_contract%2Fsrc%2Flib.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-Y29udHJhY3RzL21vY2tfY29udHJhY3Qvc3JjL2xpYi5ycw==) | `97.9% <100.0%> (ø)` | | | [...ages/cw-orch-core/src/contract/interface\_traits.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/402?src=pr&el=tree&filepath=packages%2Fcw-orch-core%2Fsrc%2Fcontract%2Finterface_traits.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1jb3JlL3NyYy9jb250cmFjdC9pbnRlcmZhY2VfdHJhaXRzLnJz) | `78.6% <100.0%> (ø)` | | | [...ages/cw-orch-core/src/environment/queriers/wasm.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/402?src=pr&el=tree&filepath=packages%2Fcw-orch-core%2Fsrc%2Fenvironment%2Fqueriers%2Fwasm.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1jb3JlL3NyYy9lbnZpcm9ubWVudC9xdWVyaWVycy93YXNtLnJz) | `100.0% <100.0%> (ø)` | |