You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the code above the generics from sv::messages are passed to the Api structure in the contract main impl block by #[contract] macro.
Proposal
A new trait should be implemented by the #[inteface] macro:
mod some_interface {mod sv {// #[sylvia::interface] generates the new trait:pubtraitInterfaceApi{typeSudo;typeExec;typeQuery;}// #[sylvia::interface] implements the above trait for every contract// that impelments given interface, in this example `SomeInterface`//impl<Contract:SomeInterface>InterfaceApiforContract{typeSudo = SudoMsg<SomeInterface::SomeGeneric>// type Exec = ExecMsg<SomeInterface::SomeGenericForExec>// type Query = QueryMsg<SomeInterface::SomeGenericForQuery>}}}
Now, the above example Sudo message could be transformed to something like the following:
pubenumContractSudoMsg<Contract>whereContract: interface_assoc::sv::InterfaceApi,// etc. for all other sv::messages{SomeInterface(
<Contractas some_interface::sv::InterfaceApi>::Sudo,),ContractGeneric(SudoMsg),}
Summary:
sylvia::types::InterfaceApi and some_interface::sv::Api should be removed.
A trait InterfaceApi should be generated per interface in sv module.
A new InterfaceApi is implemented for every contract that implements the given interface SomeInterface.
The text was updated successfully, but these errors were encountered:
Let's take Sudo message generation as example:
In the code above the generics from
sv::messages
are passed to theApi
structure in the contract main impl block by#[contract]
macro.Proposal
A new trait should be implemented by the
#[inteface]
macro:Now, the above example Sudo message could be transformed to something like the following:
Summary:
sylvia::types::InterfaceApi
andsome_interface::sv::Api
should be removed.InterfaceApi
should be generated per interface insv
module.InterfaceApi
is implemented for every contract that implements the given interfaceSomeInterface
.The text was updated successfully, but these errors were encountered: