Skip to content

Commit

Permalink
Merge pull request #577 from axone-protocol/refactor/rationalize-empt…
Browse files Browse the repository at this point in the history
…y-msg-api
  • Loading branch information
amimart authored Jun 12, 2024
2 parents 1eb8c8c + 8a559af commit f54a8f9
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 27 deletions.
19 changes: 19 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ branches:
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
releaseRules:
- type: build
scope: deps
release: patch
- type: build
scope: deps-dev
release: patch
- type: refactor
release: patch
- type: style
release: patch
- type: ci
release: patch
- type: chore
release: patch
- type: docs
release: patch
- breaking: true
release: major
- - "@semantic-release/release-notes-generator"
- preset: conventionalcommits
- - "@semantic-release/changelog"
Expand Down
4 changes: 2 additions & 2 deletions contracts/axone-cognitarium/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub mod execute {
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(deps: Deps<'_>, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
match msg {
QueryMsg::Store => to_json_binary(&query::store(deps)?),
QueryMsg::Store {} => to_json_binary(&query::store(deps)?),
QueryMsg::Select { query } => to_json_binary(&query::select(deps, query)?),
QueryMsg::Describe { query, format } => {
to_json_binary(&query::describe(deps, query, format.unwrap_or_default())?)
Expand Down Expand Up @@ -1249,7 +1249,7 @@ mod tests {
)
.unwrap();

let res = query(deps.as_ref(), mock_env(), QueryMsg::Store);
let res = query(deps.as_ref(), mock_env(), QueryMsg::Store {});
assert!(res.is_ok());
assert_eq!(
from_json::<StoreResponse>(&res.unwrap()).unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion contracts/axone-cognitarium/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub enum QueryMsg {
///
/// Returns information about the triple store.
#[returns(StoreResponse)]
Store,
Store {},

/// # Select
///
Expand Down
14 changes: 7 additions & 7 deletions contracts/axone-law-stone/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn execute(
) -> Result<Response, ContractError> {
nonpayable(&info)?;
match msg {
ExecuteMsg::BreakStone => execute::break_stone(deps, env, info),
ExecuteMsg::BreakStone {} => execute::break_stone(deps, env, info),
}
}

Expand Down Expand Up @@ -125,8 +125,8 @@ pub mod execute {
pub fn query(deps: Deps<'_, LogicCustomQuery>, env: Env, msg: QueryMsg) -> StdResult<Binary> {
match msg {
QueryMsg::Ask { query } => to_json_binary(&query::ask(deps, env, query)?),
QueryMsg::Program => to_json_binary(&query::program(deps)?),
QueryMsg::ProgramCode => to_json_binary(&query::program_code(deps)?),
QueryMsg::Program {} => to_json_binary(&query::program(deps)?),
QueryMsg::ProgramCode {} => to_json_binary(&query::program_code(deps)?),
}
}

Expand Down Expand Up @@ -886,7 +886,7 @@ mod tests {
deps.as_mut(),
env.clone(),
info.clone(),
ExecuteMsg::BreakStone,
ExecuteMsg::BreakStone {},
);
assert!(result.is_err());
assert_eq!(
Expand Down Expand Up @@ -979,7 +979,7 @@ mod tests {
deps.as_mut(),
mock_env(),
info.clone(),
ExecuteMsg::BreakStone,
ExecuteMsg::BreakStone {},
)
.unwrap();

Expand Down Expand Up @@ -1089,7 +1089,7 @@ mod tests {
deps.as_mut(),
mock_env(),
mock_info(case.0, &[]),
ExecuteMsg::BreakStone,
ExecuteMsg::BreakStone {},
);

match case.3 {
Expand Down Expand Up @@ -1141,7 +1141,7 @@ mod tests {
deps.as_mut(),
mock_env(),
mock_info("creator", &[]),
ExecuteMsg::BreakStone,
ExecuteMsg::BreakStone {},
);
assert!(res.is_ok());
assert_eq!(res.ok().unwrap().messages.len(), 0);
Expand Down
6 changes: 3 additions & 3 deletions contracts/axone-law-stone/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum ExecuteMsg {
/// - Forget the main program (i.e. or at least unpin it).
/// Only the contract admin is authorized to break it, if any.
/// If already broken, this is a no-op.
BreakStone,
BreakStone {},
}

/// Query messages
Expand All @@ -44,15 +44,15 @@ pub enum QueryMsg {
/// This includes the contract address of the `objectarium` and the program object ID,
/// where the law program's code can be accessed.
#[returns(ProgramResponse)]
Program,
Program {},

/// # ProgramCode
/// Fetches the raw code of the law program tied to this contract.
///
/// If the law stone is broken, the query may fail if the program is no longer available in the
/// `Objectarium`.
#[returns(Binary)]
ProgramCode,
ProgramCode {},
}

/// # ProgramResponse
Expand Down
8 changes: 4 additions & 4 deletions docs/axone-cognitarium.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ Query messages

Returns information about the triple store.

| literal |
| --------- |
| `"store"` |
| parameter | description |
| --------- | -------------------------- |
| `store` | _(Required.) _ **object**. |

### QueryMsg::Select

Expand Down Expand Up @@ -876,4 +876,4 @@ Represents a condition in a [WhereClause].

---

_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-cognitarium.json` (`ddcfdef446357b86`)_
_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-cognitarium.json` (`72125c91d0c7acd2`)_
20 changes: 10 additions & 10 deletions docs/axone-law-stone.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Execute messages

Break the stone making this contract unusable, by clearing all the related resources: - Unpin all the pinned objects on `axone-objectarium` contracts, if any. - Forget the main program (i.e. or at least unpin it). Only the contract admin is authorized to break it, if any. If already broken, this is a no-op.

| literal |
| --------------- |
| `"break_stone"` |
| parameter | description |
| ------------- | -------------------------- |
| `break_stone` | _(Required.) _ **object**. |

## QueryMsg

Expand All @@ -56,19 +56,19 @@ Retrieves the location metadata of the law program bound to this contract.

This includes the contract address of the `objectarium` and the program object ID, where the law program's code can be accessed.

| literal |
| ----------- |
| `"program"` |
| parameter | description |
| --------- | -------------------------- |
| `program` | _(Required.) _ **object**. |

### QueryMsg::ProgramCode

Fetches the raw code of the law program tied to this contract.

If the law stone is broken, the query may fail if the program is no longer available in the `Objectarium`.

| literal |
| ---------------- |
| `"program_code"` |
| parameter | description |
| -------------- | -------------------------- |
| `program_code` | _(Required.) _ **object**. |

## Responses

Expand Down Expand Up @@ -134,4 +134,4 @@ A string containing Base64-encoded data.

---

_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-law-stone.json` (`96a9a3b253c6a3fc`)_
_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `axone-law-stone.json` (`a0a965a7234a8b34`)_

0 comments on commit f54a8f9

Please sign in to comment.