| Crates.io | nibiru-ownable-derive |
| lib.rs | nibiru-ownable-derive |
| version | 0.7.0 |
| created_at | 2024-07-08 16:15:55.567363+00 |
| updated_at | 2025-09-11 22:07:17.726453+00 |
| description | Macros for generating code used by the `nibiru-ownable` crate |
| homepage | https://github.com/NibiruChain/nibiru-wasm |
| repository | https://github.com/NibiruChain/nibiru-wasm |
| max_upload_size | |
| id | 1296123 |
| size | 26,345 |
Macros for generating code used by the
nibiru-ownablecrate.
nibiru-ownable-derive provides procedural macros that automatically inject ownership-related message variants into your CosmWasm contract's ExecuteMsg and QueryMsg enums, eliminating boilerplate code.
#[ownable_execute]Adds an UpdateOwnership(nibiru_ownable::Action) variant to your ExecuteMsg enum:
use cosmwasm_schema::cw_serde;
use nibiru_ownable::ownable_execute;
#[ownable_execute] // Must be applied before #[cw_serde]
#[cw_serde]
enum ExecuteMsg {
Foo {},
Bar {},
}
Expands to:
#[cw_serde]
enum ExecuteMsg {
UpdateOwnership(::nibiru_ownable::Action),
Foo {},
Bar {},
}
#[ownable_query]Adds an Ownership {} variant to your QueryMsg enum:
use cosmwasm_schema::{cw_serde, QueryResponses};
use nibiru_ownable::ownable_query;
#[ownable_query] // Must be applied before #[cw_serde]
#[cw_serde]
#[derive(QueryResponses)]
enum QueryMsg {
#[returns(FooResponse)]
Foo {},
}
Expands to:
#[cw_serde]
#[derive(QueryResponses)]
enum QueryMsg {
#[returns(::nibiru_ownable::Ownership<String>)]
Ownership {},
#[returns(FooResponse)]
Foo {},
}
Add both crates to your Cargo.toml:
[dependencies]
nibiru-ownable = "0.6.0"
nibiru-ownable-derive = "0.6.0"
Import the macros from nibiru-ownable (they are re-exported):
use nibiru_ownable::{ownable_execute, ownable_query};
For detailed API documentation, visit docs.rs/nibiru-ownable-derive.
Contents of this crate at or prior to version 0.5.0 are published under GNU Affero General Public License v3 or later; contents after the said version are published under Apache-2.0 license.