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§
source§impl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg: Serialize + JsonSchema + ApiQueryMsg, ReceiveMsg: Serialize + JsonSchema> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomInitMsg: Serialize + JsonSchema, CustomQueryMsg: Serialize + JsonSchema + ApiQueryMsg, ReceiveMsg: Serialize + JsonSchema> ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
pub fn export_schema(out_dir: &Path)
source§impl<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,
metadata: Option<&'static str>
) -> Self
sourcepub const fn with_dependencies(
self,
dependencies: &'static [StaticDependency]
) -> Self
pub const fn with_dependencies(
self,
dependencies: &'static [StaticDependency]
) -> 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§
source§impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> AbstractNameService for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> AbstractNameService for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
source§impl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema> ExecuteEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema> ExecuteEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
type ExecuteMsg = ExecuteMsg<BaseExecuteMsg, ApiRequestMsg<CustomExecMsg>, ReceiveMsg>
source§fn 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
source§impl<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, Option<&'static str>)
fn dependencies(&self) -> &'static [StaticDependency]
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>
source§impl<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>
source§fn 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.
source§impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> Identification for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg> Identification for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
Retrieve identifying information about the calling OS
source§impl<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>
source§fn 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>
source§impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg: ApiQueryMsg, ReceiveMsg> QueryEndpoint for ApiContract<Error, CustomExecMsg, CustomInitMsg, CustomQueryMsg, ReceiveMsg>
impl<Error: From<StdError> + From<ApiError>, CustomExecMsg, CustomInitMsg, CustomQueryMsg: ApiQueryMsg, 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_sdk::os::common_module::app_msg