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§

§authorized_addresses: Map<'static, Addr, Vec<Addr>>

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>

Constructor

source

pub const fn new( name: &'static str, version: &'static str, metadata: Option<&'static str> ) -> Self

source

pub fn state(&self, store: &dyn Storage) -> StdResult<ApiState>

source

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.

source

pub const fn with_dependencies( self, dependencies: &'static [StaticDependency] ) -> Self

add dependencies to the contract

source

pub const fn with_instantiate( self, instantiate_handler: InstantiateHandlerFn<Self, CustomInitMsg, Error> ) -> Self

source

pub const fn with_execute( self, execute_handler: ExecuteHandlerFn<Self, CustomExecMsg, Error> ) -> Self

source

pub const fn with_query( self, query_handler: QueryHandlerFn<Self, CustomQueryMsg, Error> ) -> Self

source

pub const fn with_replies( self, reply_handlers: &'static [(u64, ReplyHandlerFn<Self, Error>)] ) -> Self

source

pub const fn with_sudo( self, sudo_handler: SudoHandlerFn<Self, SudoMsg, Error> ) -> Self

source

pub const fn with_receive( self, receive_handler: ReceiveHandlerFn<Self, ReceiveMsg, Error> ) -> Self

source

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>

source§

fn ans_host(&self, deps: Deps<'_>) -> AbstractSdkResult<AnsHost>

source§

fn name_service<'a>( &'a self, deps: Deps<'a, Empty> ) -> AbstractNameServiceClient<'a, Self>

source§

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>

Get the address of the registry.
source§

impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> AccountIdentification for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>

Retrieve identifying information about the calling Account

source§

fn proxy_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>

source§

fn manager_address(&self, _deps: Deps<'_>) -> AbstractSdkResult<Addr>

source§

fn account_base(&self, _deps: Deps<'_>) -> AbstractSdkResult<AccountBase>

source§

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>

§

type ExecuteMsg = ExecuteMsg<BaseExecuteMsg, ApiRequestMsg<CustomExecMsg>, ReceiveMsg>

source§

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>

§

type Error = Error

§

type CustomInitMsg = InitMsg

Custom init message for the contract
§

type CustomExecMsg = ExecMsg

Custom execute message for the contract
§

type CustomQueryMsg = QueryMsg

Custom query message for the contract
§

type CustomMigrateMsg = Empty

Custom migrate message for the contract
§

type ReceiveMsg = ReceiveMsg

Receive message for the contract
§

type SudoMsg = SudoMsg

Sudo message for the contract
source§

fn contract(&self) -> &AbstractContract<Self, Error>

source§

fn stored_version( &self, store: &dyn Storage ) -> Result<ContractVersion, AbstractSdkError>

source§

fn info(&self) -> (&'static str, &'static str, Option<&'static str>)

source§

fn dependencies(&self) -> &'static [StaticDependency]

source§

fn maybe_execute_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn execute_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomExecMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_instantiate_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn instantiate_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::CustomInitMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_query_handler( &self ) -> Option<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>>

source§

fn query_handler( &self ) -> Result<fn(_: Deps<'_, Empty>, _: Env, _: &Self, _: Self::CustomQueryMsg) -> Result<Binary, Self::Error>, AbstractSdkError>

source§

fn maybe_migrate_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn migrate_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::CustomMigrateMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_sudo_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::SudoMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn sudo_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Self::SudoMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_receive_handler( &self ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>>

source§

fn receive_handler( &self ) -> Result<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: Self::ReceiveMsg) -> Result<Response<Empty>, Self::Error>, AbstractSdkError>

source§

fn maybe_ibc_callback_handler( &self, id: &str ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: MessageInfo, _: Self, _: String, _: StdAck) -> Result<Response<Empty>, Self::Error>>

source§

fn maybe_reply_handler( &self, id: u64 ) -> Option<fn(_: DepsMut<'_, Empty>, _: Env, _: Self, _: Reply) -> Result<Response<Empty>, Self::Error>>

source§

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>

source§

fn ibc_callback( self, deps: DepsMut<'_, Empty>, env: Env, info: MessageInfo, msg: IbcResponseMsg ) -> Result<Response<Empty>, Self::Error>

Handler for the ExecuteMsg::IbcCallback() variant.
source§

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>

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>

Where we dispatch the queries for the ApiContract These ApiQueryMsg declarations can be found in abstract_sdk::core::common_module::app_msg

§

type QueryMsg = QueryMsg<BaseQueryMsg, CustomQueryMsg>

source§

fn query( &self, deps: Deps<'_>, env: Env, msg: Self::QueryMsg ) -> Result<Binary, Error>

Handler for the Query endpoint.
source§

impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> ReceiveEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>

source§

fn receive( self, deps: DepsMut<'_, Empty>, env: Env, info: MessageInfo, msg: Self::ReceiveMsg ) -> Result<Response<Empty>, Self::Error>

Handler for the ExecuteMsg::Receive() variant.
source§

impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> ReplyEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>

source§

fn reply( self, deps: DepsMut<'_, Empty>, env: Env, msg: Reply ) -> Result<Response<Empty>, Self::Error>

Handler for the Reply endpoint.
source§

impl<Error: ContractError, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg> SudoEndpoint for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, ReceiveMsg, SudoMsg>

source§

fn sudo( self, deps: DepsMut<'_, Empty>, env: Env, msg: Self::SudoMsg ) -> Result<Response<Empty>, Self::Error>

Handler for the Sudo endpoint.

Auto Trait Implementations§

§

impl<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg> RefUnwindSafe for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg>

§

impl<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg> Send for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg>

§

impl<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg> Sync for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg>

§

impl<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg> Unpin for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg>

§

impl<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg> UnwindSafe for ApiContract<Error, CustomInitMsg, CustomExecMsg, CustomQueryMsg, Receive, SudoMsg>

Blanket Implementations§

source§

impl<T> AbstractResponse for Twhere T: ModuleIdentification,

source§

fn tag_response( &self, response: Response<Empty>, action: impl Into<String> ) -> Response<Empty>

Respond with an abstract-specific event that contains the contract name and the action.
source§

fn custom_tag_response( &self, response: Response<Empty>, action: impl Into<String>, attributes: impl IntoIterator<Item = impl Into<Attribute>> ) -> Response<Empty>

.tag_response() with additional attributes.
source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ApiInterface for Twhere T: ModuleInterface,

source§

fn apis<'a>(&'a self, deps: Deps<'a, Empty>) -> Api<'a, Self>

source§

impl<T> AppInterface for Twhere T: ModuleInterface,

source§

fn apps<'a>(&'a self, deps: Deps<'a, Empty>) -> App<'a, Self>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Dependencies for Twhere T: Handler,

source§

impl<T> Execution for Twhere T: AccountIdentification + ModuleIdentification,

source§

fn executor<'a>(&'a self, deps: Deps<'a, Empty>) -> Executor<'a, Self>

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> IbcInterface for Twhere T: AccountIdentification,

source§

fn ibc_client<'a>(&'a self, deps: Deps<'a, Empty>) -> IbcClient<'a, Self>

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ModuleIdentification for Twhere T: Handler,

source§

fn module_id(&self) -> &'static str

Get the module identifier.
source§

impl<T> ModuleInterface for Twhere T: AccountIdentification + Dependencies,

source§

fn modules<'a>(&'a self, deps: Deps<'a, Empty>) -> Modules<'a, Self>

source§

impl<T> ModuleRegistryInterface for Twhere T: AbstractRegistryAccess,

source§

fn module_registry<'a>( &'a self, deps: Deps<'a, Empty> ) -> ModuleRegistry<'a, Self>

source§

impl<T> OsVerification for Twhere T: AbstractRegistryAccess,

source§

fn account_registry<'a>(&'a self, deps: Deps<'a, Empty>) -> OsRegistry<'a, Self>

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> TransferInterface for Twhere T: AbstractNameService + Execution,

source§

fn bank<'a>(&'a self, deps: Deps<'a, Empty>) -> Bank<'a, Self>

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> VaultInterface for Twhere T: AbstractNameService + AccountIdentification,

source§

fn vault<'a>(&'a self, deps: Deps<'a, Empty>) -> Vault<'a, Self>