Struct abstract_api::state::ApiContract
source · pub struct ApiContract<Error: From<StdError> + From<ApiError> + 'static, CustomExecMsg: 'static = Empty, CustomInitMsg: 'static = Empty, CustomQueryMsg: 'static = Empty, Receive: 'static = Empty> {
pub traders: Map<'static, Addr, HashSet<Addr>>,
pub target_os: Option<Core>,
/* private fields */
}
Expand description
The state variables for our ApiContract.
Fields
traders: Map<'static, Addr, HashSet<Addr>>
target_os: Option<Core>
Stores the API version
Implementations
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg: Serialize + JsonSchema, ReceiveMsg: Serialize + JsonSchema> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg: Serialize + JsonSchema, ReceiveMsg: Serialize + JsonSchema> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
pub fn export_schema(out_dir: &Path)
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Constructor
pub const fn new(name: &'static str, version: &'static str) -> Self
sourcepub const fn with_dependencies(
self,
dependencies: &'static [&'static str]
) -> Self
pub const fn with_dependencies(
self,
dependencies: &'static [&'static str]
) -> Self
add dependencies to the contract
pub const fn with_replies(
self,
reply_handlers: &'static [(u64, ReplyHandlerFn<Self, Error>)]
) -> Self
sourcepub const fn with_ibc_callbacks(
self,
callbacks: &'static [(&'static str, IbcCallbackHandlerFn<Self, Error>)]
) -> Self
pub const fn with_ibc_callbacks(
self,
callbacks: &'static [(&'static str, IbcCallbackHandlerFn<Self, Error>)]
) -> Self
add IBC callback handler to contract
pub const fn with_instantiate(
self,
instantiate_handler: InstantiateHandlerFn<Self, CustomInitMsg, Error>
) -> Self
pub const fn with_receive(
self,
receive_handler: ReceiveHandlerFn<Self, ReceiveMsg, Error>
) -> Self
pub const fn with_execute(
self,
execute_handler: ExecuteHandlerFn<Self, CustomExecMsg, Error>
) -> Self
pub const fn with_query(
self,
query_handler: QueryHandlerFn<Self, CustomQueryMsg>
) -> Self
pub fn state(&self, store: &dyn Storage) -> StdResult<ApiState>
pub fn target(&self) -> Result<&Addr, ApiError>
Trait Implementations
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> Dependency for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> Dependency for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Implement the dependency functions for an API contract
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema, CustomInitMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema> ExecuteEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema, CustomInitMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema> ExecuteEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
type ExecuteMsg = ExecuteMsg<BaseExecuteMsg, ApiRequestMsg<CustomExecMsg>, ReceiveMsg>
sourcefn execute(
self,
deps: DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: Self::ExecuteMsg
) -> Result<Response, Error>
fn execute(
self,
deps: DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: Self::ExecuteMsg
) -> Result<Response, Error>
Entry point for contract execution
sourceimpl<Error: From<StdError> + From<ApiError>, ExecMsg, InitMsg, QueryMsg, Receive> Handler for ApiContract<Error, ExecMsg, InitMsg, QueryMsg, Receive>
impl<Error: From<StdError> + From<ApiError>, ExecMsg, InitMsg, QueryMsg, Receive> Handler for ApiContract<Error, ExecMsg, InitMsg, QueryMsg, Receive>
fn contract(
&self
) -> &AbstractContract<Self, Error, ExecMsg, InitMsg, QueryMsg, Empty, Receive>
type Error = Error
type CustomExecMsg = ExecMsg
type CustomInitMsg = InitMsg
type CustomQueryMsg = QueryMsg
type CustomMigrateMsg = Empty
type ReceiveMsg = Receive
fn stored_version(
&self,
store: &dyn Storage
) -> Result<ContractVersion, StdError>
fn info(&self) -> (&'static str, &'static str)
fn dependencies(&self) -> &'static [&'static str]
fn maybe_execute_handler(
&self
) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>>
fn execute_handler(
&self
) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>, StdError>
fn maybe_instantiate_handler(
&self
) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>>
fn instantiate_handler(
&self
) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>, StdError>
fn maybe_query_handler(
&self
) -> Option<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, StdError>>
fn query_handler(
&self
) -> Result<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, StdError>, StdError>
fn maybe_migrate_handler(
&self
) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>>
fn migrate_handler(
&self
) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>, StdError>
fn maybe_receive_handler(
&self
) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>>
fn receive_handler(
&self
) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>, StdError>
fn maybe_ibc_callback_handler(
&self,
id: &str
) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: String, _: StdAck) -> Result<Response<Empty>, Self::Error>>
fn maybe_reply_handler(
&self,
id: u64
) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Reply) -> Result<Response<Empty>, Self::Error>>
fn reply_handler(
&self,
id: u64
) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Reply) -> Result<Response<Empty>, Self::Error>, StdError>
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> IbcCallbackEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> IbcCallbackEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
sourcefn handle_ibc_callback(
self,
deps: DepsMut<'_, Empty>,
env: Env,
info: MessageInfo,
msg: IbcResponseMsg
) -> Result<Response<Empty>, Self::Error>
fn handle_ibc_callback(
self,
deps: DepsMut<'_, Empty>,
env: Env,
info: MessageInfo,
msg: IbcResponseMsg
) -> Result<Response<Empty>, Self::Error>
Takes request, sets destination and executes request handler
This fn is the only way to get an ApiContract instance which ensures the destination address is set correctly. Read more
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg, ReceiveMsg> InstantiateEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg, ReceiveMsg> InstantiateEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
sourcefn instantiate(
self,
deps: DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: Self::InstantiateMsg
) -> Result<Response, Error>
fn instantiate(
self,
deps: DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: Self::InstantiateMsg
) -> Result<Response, Error>
Instantiate the API
type InstantiateMsg = InstantiateMsg<BaseInstantiateMsg, CustomInitMsg>
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> MemoryOperation for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> MemoryOperation for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
sourcefn load_memory(&self, store: &dyn Storage) -> StdResult<Memory>
fn load_memory(&self, store: &dyn Storage) -> StdResult<Memory>
Load the Memory object
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> OsExecute for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> OsExecute for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Execute a set of CosmosMsgs on the proxy contract of an OS.
fn os_execute(
&self,
_deps: Deps<'_>,
msgs: Vec<CosmosMsg>
) -> Result<SubMsg, StdError>
fn os_ibc_execute(
&self,
_deps: Deps<'_>,
msgs: Vec<ExecuteMsg>
) -> Result<SubMsg, StdError>
fn os_execute_with_reply(
&self,
deps: Deps<'_, Empty>,
msgs: Vec<CosmosMsg<Empty>, Global>,
reply_on: ReplyOn,
id: u64
) -> Result<SubMsg<Empty>, StdError>
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> QueryEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> QueryEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Where we dispatch the queries for the ApiContract
These ApiQueryMsg declarations can be found in abstract_os::common_module::add_on_msg
sourceimpl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ReceiveEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> ReceiveEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
fn handle_receive(
self,
deps: DepsMut<'_, Empty>,
env: Env,
info: MessageInfo,
msg: Self::ReceiveMsg
) -> Result<Response<Empty>, Self::Error>
Auto Trait Implementations
impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> RefUnwindSafe for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>
impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> Send for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>
impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> Sync for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>
impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> Unpin for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>
impl<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive> UnwindSafe for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, Receive>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more