-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ibc-union): implement QueryResponses and cw-orch function genera…
…tion
- Loading branch information
Showing
10 changed files
with
2,054 additions
and
1,260 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
use unionlabs_primitives::H256; | ||
|
||
#[derive(serde::Serialize, serde::Deserialize)] | ||
#[derive(serde::Serialize, serde::Deserialize, Debug)] | ||
#[serde(deny_unknown_fields, rename_all = "snake_case")] | ||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] | ||
#[cfg_attr( | ||
feature = "cw-orch-interface", | ||
derive(cosmwasm_schema::QueryResponses, cw_orch::QueryFns) | ||
)] | ||
pub enum QueryMsg { | ||
#[cfg_attr(feature = "cw-orch-interface", returns(u64))] | ||
GetTimestampAtHeight { client_id: u32, height: u64 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(u64))] | ||
GetLatestHeight { client_id: u32 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(cosmwasm_std::Binary))] | ||
GetClientState { client_id: u32 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(cosmwasm_std::Binary))] | ||
GetConsensusState { client_id: u32, height: u64 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(crate::lightclient::Status))] | ||
GetStatus { client_id: u32 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(u64))] | ||
GetClientType { client_id: u32 }, | ||
#[cfg_attr( | ||
feature = "cw-orch-interface", | ||
returns(ibc_union_spec::types::Connection) | ||
)] | ||
GetConnection { connection_id: u32 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(ibc_union_spec::types::Channel))] | ||
GetChannel { channel_id: u32 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(std::collections::BTreeSet<u32>))] | ||
GetChannels { contract: String }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(Option<Vec<u8>>))] | ||
GetBatchPackets { channel_id: u32, batch_hash: H256 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(Option<Vec<u8>>))] | ||
GetBatchReceipts { channel_id: u32, batch_hash: H256 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(cosmwasm_std::Addr))] | ||
GetClientImpl { client_id: u32 }, | ||
#[cfg_attr(feature = "cw-orch-interface", returns(cosmwasm_std::Addr))] | ||
GetRegisteredClientType { client_type: String }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pub const IBC_UNION: &str = "union:ibc-union"; | ||
|
||
#[cw_orch::interface( | ||
ibc_union_msg::msg::InitMsg, | ||
ibc_union_msg::msg::ExecuteMsg, | ||
ibc_union_msg::query::QueryMsg, | ||
crate::contract::IbcUnionMigrateMsg, | ||
id = IBC_UNION | ||
)] | ||
pub struct IbcUnion<Chain>; | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
use cw_orch::prelude::*; | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
impl<Chain: CwEnv> Uploadable for IbcUnion<Chain> { | ||
fn wasm(_chain_info: &ChainInfoOwned) -> WasmPath { | ||
artifacts_dir_from_workspace!() | ||
.find_wasm_path("ibc_union") | ||
.unwrap() | ||
} | ||
fn wrapper() -> <Mock as TxHandler>::ContractSource { | ||
Box::new(ContractWrapper::new( | ||
crate::contract::execute, | ||
crate::contract::instantiate, | ||
crate::contract::query, | ||
)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters