Skip to content

Conversation

@Kayanski
Copy link
Contributor

@Kayanski Kayanski commented May 22, 2024

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-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 22, 2024

Deploying cw-orchestrator with  Cloudflare Pages  Cloudflare Pages

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

View logs

@codecov
Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

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 Coverage Δ
contracts/mock_contract/src/lib.rs 97.9% <100.0%> (ø)
...ages/cw-orch-core/src/contract/interface_traits.rs 78.6% <100.0%> (ø)
...ages/cw-orch-core/src/environment/queriers/wasm.rs 100.0% <100.0%> (ø)

@Kayanski Kayanski requested a review from Buckram123 June 3, 2024 09:33
@Kayanski Kayanski requested a review from CyberHoward June 3, 2024 09:53
Copy link
Contributor

@Buckram123 Buckram123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice syntax! Item and Map are the most common state objects, but it could be nice to have queries of any raw key as well. Easy to implement as well

@Kayanski Kayanski merged commit 2145024 into main Jun 3, 2024
@Kayanski Kayanski deleted the nicolas/orc-138-helpers-to-querying-raw-state-outside-contracts branch June 3, 2024 16:07
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.

3 participants