Skip to content

Commit

Permalink
chore!: Remove InterfaceApi from sylvia::types
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Use InterfaceMessagesApi from generated `sv` module
instead
  • Loading branch information
kulikthebird committed Aug 9, 2024
1 parent 4c5a678 commit ff3a585
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 212 deletions.
149 changes: 77 additions & 72 deletions examples/interfaces/custom-and-generic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ pub trait CustomAndGeneric {
mod tests {
use cosmwasm_std::testing::mock_dependencies;
use cosmwasm_std::{Addr, CosmosMsg, Empty, QuerierWrapper};
use sylvia::types::InterfaceApi;

use crate::sv::Querier;

Expand Down Expand Up @@ -139,91 +138,97 @@ mod tests {
querier.custom_generic_query_two(SvCustomMsg {}, SvCustomMsg {});

// Construct messages with Interface extension
let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
SvCustomMsg,
> as InterfaceApi>::Query::custom_generic_query_one(
SvCustomMsg {}, SvCustomMsg {}
let _ = <dyn super::CustomAndGeneric<
Error = (),
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
ExecC = SvCustomMsg,
QueryC = SvCustomQuery,
RetT = SvCustomMsg,
> as super::sv::InterfaceMessagesApi>::Query::custom_generic_query_one(
SvCustomMsg {},
SvCustomMsg {},
);

let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
SvCustomMsg,
> as InterfaceApi>::Exec::custom_generic_execute_one(
let _ = <dyn super::CustomAndGeneric<
Error = (),
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
ExecC = SvCustomMsg,
QueryC = SvCustomQuery,
RetT = SvCustomMsg,
> as super::sv::InterfaceMessagesApi>::Exec::custom_generic_execute_one(
vec![CosmosMsg::Custom(SvCustomMsg {})],
vec![CosmosMsg::Custom(SvCustomMsg {})],
);

let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
SvCustomMsg,
> as InterfaceApi>::Exec::custom_generic_execute_two(
let _ = <dyn super::CustomAndGeneric<
Error = (),
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
ExecC = SvCustomMsg,
QueryC = SvCustomQuery,
RetT = SvCustomMsg,
> as super::sv::InterfaceMessagesApi>::Exec::custom_generic_execute_two(
vec![CosmosMsg::Custom(SvCustomMsg {})],
vec![CosmosMsg::Custom(SvCustomMsg {})],
);

let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
SvCustomMsg,
> as InterfaceApi>::Sudo::custom_generic_sudo_one(
let _ = <dyn super::CustomAndGeneric<
Error = (),
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
ExecC = SvCustomMsg,
QueryC = SvCustomQuery,
RetT = SvCustomMsg,
> as super::sv::InterfaceMessagesApi>::Sudo::custom_generic_sudo_one(
CosmosMsg::Custom(SvCustomMsg {}),
CosmosMsg::Custom(SvCustomMsg {}),
);

let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
SvCustomMsg,
> as InterfaceApi>::Sudo::custom_generic_sudo_one(
let _ = <dyn super::CustomAndGeneric<
Error = (),
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
ExecC = SvCustomMsg,
QueryC = SvCustomQuery,
RetT = SvCustomMsg,
> as super::sv::InterfaceMessagesApi>::Sudo::custom_generic_sudo_one(
CosmosMsg::Custom(SvCustomMsg {}),
CosmosMsg::Custom(SvCustomMsg {}),
);
Expand Down
157 changes: 84 additions & 73 deletions examples/interfaces/generic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ pub trait Generic {
mod tests {
use cosmwasm_std::testing::mock_dependencies;
use cosmwasm_std::{Addr, CosmosMsg, Empty, QuerierWrapper};
use sylvia::types::InterfaceApi;

use crate::sv::Querier;

Expand Down Expand Up @@ -129,88 +128,100 @@ mod tests {
let _: Result<SvCustomMsg, _> = querier.generic_query_two(SvCustomMsg {}, SvCustomMsg {});

// Construct messages with Interface extension
let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
_,
_,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
> as InterfaceApi>::Query::generic_query_one(SvCustomMsg {}, SvCustomMsg {});
let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
_,
_,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
> as InterfaceApi>::Query::generic_query_two(SvCustomMsg {}, SvCustomMsg {});
let _ = <super::sv::Api<
_,
_,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
cosmwasm_std::Empty,
> as InterfaceApi>::Exec::generic_exec_one(
let _ = <dyn super::Generic<
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
RetT = SvCustomMsg,
Error = (),
> as super::sv::InterfaceMessagesApi>::Query::generic_query_one(
SvCustomMsg {},
SvCustomMsg {},
);
let _ = <dyn super::Generic<
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
RetT = SvCustomMsg,
Error = (),
> as super::sv::InterfaceMessagesApi>::Query::generic_query_two(
SvCustomMsg {},
SvCustomMsg {},
);
let _ = <dyn super::Generic<
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
RetT = Empty,
Error = (),
> as super::sv::InterfaceMessagesApi>::Exec::generic_exec_one(
vec![CosmosMsg::Custom(SvCustomMsg {})],
vec![CosmosMsg::Custom(SvCustomMsg {})],
);
let _ = <super::sv::Api<
SvCustomMsg,
_,
_,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
cosmwasm_std::Empty,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
> as InterfaceApi>::Exec::generic_exec_two(
let _ = <dyn super::Generic<
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
RetT = Empty,
Error = (),
> as super::sv::InterfaceMessagesApi>::Exec::generic_exec_two(
vec![CosmosMsg::Custom(SvCustomMsg {})],
vec![CosmosMsg::Custom(SvCustomMsg {})],
);

let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
_,
_,
SvCustomMsg,
cosmwasm_std::Empty,
> as InterfaceApi>::Sudo::generic_sudo_one(
let _ = <dyn super::Generic<
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
RetT = Empty,
Error = (),
> as super::sv::InterfaceMessagesApi>::Sudo::generic_sudo_one(
CosmosMsg::Custom(SvCustomMsg {}),
CosmosMsg::Custom(SvCustomMsg {}),
);
let _ = <super::sv::Api<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
cosmwasm_std::Empty,
SvCustomMsg,
SvCustomMsg,
_,
_,
SvCustomMsg,
> as InterfaceApi>::Sudo::generic_sudo_two(
let _ = <dyn super::Generic<
Exec1T = SvCustomMsg,
Exec2T = SvCustomMsg,
Exec3T = SvCustomMsg,
Query1T = SvCustomMsg,
Query2T = SvCustomMsg,
Query3T = SvCustomMsg,
Sudo1T = SvCustomMsg,
Sudo2T = SvCustomMsg,
Sudo3T = SvCustomMsg,
RetT = Empty,
Error = (),
> as super::sv::InterfaceMessagesApi>::Sudo::generic_sudo_two(
CosmosMsg::Custom(SvCustomMsg {}),
CosmosMsg::Custom(SvCustomMsg {}),
);
Expand Down
4 changes: 2 additions & 2 deletions sylvia-derive/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<'a> InterfaceInput<'a> {
let Self {
associated_types,
item,
custom,
..
} = self;
let messages = self.emit_messages();
let associated_names: Vec<_> = associated_types
Expand All @@ -102,7 +102,7 @@ impl<'a> InterfaceInput<'a> {
let querier =
Querier::new(&query_variants, associated_types, &item.ident).emit_querier_trait();

let interface_messages = Api::new(item, associated_types, custom).emit();
let interface_messages = Api::new(item, associated_types).emit();

let multitest_helpers = self.emit_multitest_helpers();

Expand Down
Loading

0 comments on commit ff3a585

Please sign in to comment.