registry_execute

Attribute Macro registry_execute 

Source
#[registry_execute]
Expand description

Procedural macro to extend an enum with a standardized CreateAccount execute variant for registry-based smart accounts.

This macro injects a CreateAccount(...) variant into your execute enum, where the inner value is CreateAccountMsg<T>, a message that allows creating a smart account with optional registration metadata.

You can optionally specify a single type argument to customize the metadata payload (T). If omitted, the type defaults to Binary.

§Examples

use cw83::registry_execute;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::Binary;

#[registry_execute]
#[cw_serde]
pub enum ExecuteMsg {
//
//    // user-defined variants
//
}

// Generated:
//
// pub struct CreateAccountMsg {
//     pub code_id      :  u64,
//     pub chain_id     :  String,
//     pub account_data :  Binary
// }
 
// pub enum ExecuteMsg {
//
//    // user-defined variants
//
//
//     CreateAccount(CreateAccountMsg),
// }


// With a custom metadata type:

// types taken from 
// pub use smart_account_auth::{CredentialData, Credential};
 
// mock type
pub struct Credential;
 
pub struct CredentialData {
     pub credentials     :   Vec<Credential>,
     pub with_native     :   Option<bool>,
     pub primary_index   :   Option<u8>,
}

#[registry_execute(CredentialData)]
#[cw_serde]
pub enum ExecuteMsgData {
//
//    // user-defined variants
//
}

// Generated:
 
// pub struct CreateAccountMsgData {
//     pub code_id      :  u64,
//     pub chain_id     :  String,
//     pub account_data :  CredentialData
// }
//
// pub enum ExecuteMsgData {
//
//     // user-defined variants
//
//
//     CreateAccount(CreateAccountMsgData),
// }

This macro is part of the CW83 spec for account registries.