Struct abstract_api::state::ApiContract
source · pub struct ApiContract<Error: ContractError, CustomInitMsg: 'static, CustomExecMsg: 'static, CustomQueryMsg: 'static, Receive: 'static = Empty, SudoMsg: 'static = Empty>where
Self: Handler,{
pub authorized_addresses: Map<'static, Addr, Vec<Addr>>,
pub target_account: Option<AccountBase>,
/* private fields */
}
Expand description
The state variables for our ApiContract.
Fields§
Map ProxyAddr -> AuthorizedAddrs
target_account: Option<AccountBase>
The Account on which commands are executed. Set each time in the abstract_core::api::ExecuteMsg::Base
handler.
Implementations§
source§impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
Constructor
pub const fn new( name: &'static str, version: &'static str, metadata: Option<&'static str> ) -> Self
pub fn state(&self, store: &dyn Storage) -> StdResult<ApiState>
sourcepub fn target(&self) -> Result<&Addr, ApiError>
pub fn target(&self) -> Result<&Addr, ApiError>
Return the address of the proxy for the Account associated with this API.
Set each time in the abstract_core::api::ExecuteMsg::Base
handler.
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_instantiate( self, instantiate_handler: InstantiateHandlerFn<Self, CustomInitMsg, 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, Error> ) -> Self
pub const fn with_replies( self, reply_handlers: &'static [(u64, ReplyHandlerFn<Self, Error>)] ) -> Self
pub const fn with_sudo( self, sudo_handler: SudoHandlerFn<Self, SudoMsg, Error> ) -> Self
pub const fn with_receive( self, receive_handler: ReceiveHandlerFn<Self, ReceiveMsg, 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
Trait Implementations§
source§impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> AbstractNameService for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> AbstractNameService for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
source§impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> AbstractRegistryAccess for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> AbstractRegistryAccess for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
Get the version control contract
source§fn abstract_registry(&self, deps: Deps<'_>) -> AbstractSdkResult<Addr>
fn abstract_registry(&self, deps: Deps<'_>) -> AbstractSdkResult<Addr>
Get the address of the registry.
source§impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> AccountIdentification for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> AccountIdentification for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
Retrieve identifying information about the calling Account
fn proxy_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>
fn manager_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>
fn account_base(&self, _deps: Deps<'_>) -> AbstractSdkResult<AccountBase>
source§fn account_id(&self, deps: Deps<'_, Empty>) -> Result<u32, AbstractSdkError>
fn account_id(&self, deps: Deps<'_, Empty>) -> Result<u32, AbstractSdkError>
Get the Account id for the current context.
source§impl<Error: ContractError, CustomInitMsg, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema, SudoMsg> ExecuteEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg, CustomExecMsg: Serialize + JsonSchema + ApiExecuteMsg, CustomQueryMsg, ReceiveMsg: Serialize + JsonSchema, SudoMsg> ExecuteEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
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>
Handler for the Execute endpoint.
source§impl<Error: ContractError, InitMsg, ExecMsg, QueryMsg, ReceiveMsg, SudoMsg> Handler for ApiContract<Error, InitMsg, ExecMsg, QueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, InitMsg, ExecMsg, QueryMsg, ReceiveMsg, SudoMsg> Handler for ApiContract<Error, InitMsg, ExecMsg, QueryMsg, ReceiveMsg, SudoMsg>
type Error = Error
§type CustomInitMsg = InitMsg
type CustomInitMsg = InitMsg
Custom init message for the contract
§type CustomExecMsg = ExecMsg
type CustomExecMsg = ExecMsg
Custom execute message for the contract
§type CustomQueryMsg = QueryMsg
type CustomQueryMsg = QueryMsg
Custom query message for the contract
§type CustomMigrateMsg = Empty
type CustomMigrateMsg = Empty
Custom migrate message for the contract
§type ReceiveMsg = ReceiveMsg
type ReceiveMsg = ReceiveMsg
Receive message for the contract
fn contract(&self) -> &AbstractContract<Self, Error>
fn stored_version( &self, store: &dyn Storage ) -> Result<ContractVersion, AbstractSdkError>
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>, AbstractSdkError>
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>, AbstractSdkError>
fn maybe_query_handler( &self ) -> Option<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>>
fn query_handler( &self ) -> Result<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>, AbstractSdkError>
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>, AbstractSdkError>
fn maybe_sudo_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::SudoMsg) -> Result<Response<Empty>, Self::Error>>
fn sudo_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::SudoMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>
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>, AbstractSdkError>
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>, AbstractSdkError>
source§impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> IbcCallbackEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> IbcCallbackEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
source§impl<Error: ContractError, CustomInitMsg: Serialize + JsonSchema, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> InstantiateEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg: Serialize + JsonSchema, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> InstantiateEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
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: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg: ApiQueryMsg, ReceiveMsg, SudoMsg> QueryEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg: ApiQueryMsg, ReceiveMsg, SudoMsg> QueryEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>
Where we dispatch the queries for the ApiContract
These ApiQueryMsg declarations can be found in abstract_sdk::core::common_module::app_msg