Repository: public-awesome/launchpad
Pull request #362 (2022-08-27 20:43:20)

Refactor sg4 interface


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 8c3540ad..3f96e3d8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -59,7 +59,7 @@ dependencies = [
 
 [[package]]
 name = "base-minter"
-version = "0.14.0"
+version = "0.14.1"
 dependencies = [
  "base-factory 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cosmwasm-schema",
@@ -76,7 +76,7 @@ dependencies = [
  "sg-std 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "sg1 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "sg2 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "sg4 0.11.0",
+ "sg4 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "sg721 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "sg721-nt 0.13.1",
  "thiserror",
@@ -1033,7 +1033,19 @@ dependencies = [
 
 [[package]]
 name = "sg4"
-version = "0.12.0"
+version = "0.12.1"
+dependencies = [
+ "cosmwasm-std",
+ "schemars",
+ "serde",
+ "thiserror",
+]
+
+[[package]]
+name = "sg4"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "738decc5fac73dfd6328b89658c2c54751f628cbf34cc8ba4ee946690c87c65a"
 dependencies = [
  "cosmwasm-std",
  "schemars",
diff --git a/contracts/base-minter/Cargo.toml b/contracts/base-minter/Cargo.toml
index 5652fa40..982b8ad6 100644
--- a/contracts/base-minter/Cargo.toml
+++ b/contracts/base-minter/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "base-minter"
-version = "0.14.0"
+version = "0.14.1"
 authors = ["Shane Vitarana <s@noreply.publicawesome.com>"]
 edition = "2018"
 description = "Stargaze NFT basic 1/1 minter contract"
@@ -46,7 +46,7 @@ sg1 = "0.14.1"
 sg721 = "0.14.0"
 base-factory = "0.1.0"
 sg2 = "0.1.0"
-sg4 = "0.11.0"
+sg4 = "0.12.1"
 
 [dev-dependencies]
 cosmwasm-schema = { version = "1.0.0" }
diff --git a/contracts/base-minter/examples/schema.rs b/contracts/base-minter/examples/schema.rs
index 61f1973c..342d49b1 100644
--- a/contracts/base-minter/examples/schema.rs
+++ b/contracts/base-minter/examples/schema.rs
@@ -3,8 +3,9 @@ use std::fs::create_dir_all;
 
 use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
 
-use base_minter::msg::{ConfigResponse, ExecuteMsg, InstantiateMsg, QueryMsg};
+use base_minter::msg::{ConfigResponse, ExecuteMsg, InstantiateMsg};
 use base_minter::state::Config;
+use sg4::QueryMsg;
 
 fn main() {
     let mut out_dir = current_dir().unwrap();
diff --git a/contracts/base-minter/schema/query_msg.json b/contracts/base-minter/schema/query_msg.json
index cc86a34c..cb182767 100644
--- a/contracts/base-minter/schema/query_msg.json
+++ b/contracts/base-minter/schema/query_msg.json
@@ -3,6 +3,7 @@
   "title": "QueryMsg",
   "oneOf": [
     {
+      "description": "Returns `MinterConfigResponse<T>`",
       "type": "object",
       "required": [
         "config"
@@ -15,6 +16,7 @@
       "additionalProperties": false
     },
     {
+      "description": "Returns `StatusResponse`",
       "type": "object",
       "required": [
         "status"
diff --git a/contracts/base-minter/src/contract.rs b/contracts/base-minter/src/contract.rs
index aba5a7bd..e8fd57f3 100644
--- a/contracts/base-minter/src/contract.rs
+++ b/contracts/base-minter/src/contract.rs
@@ -1,5 +1,5 @@
 use crate::error::ContractError;
-use crate::msg::{ConfigResponse, ExecuteMsg, QueryMsg, SudoMsg};
+use crate::msg::{ConfigResponse, ExecuteMsg};
 use crate::state::{increment_token_index, Config, COLLECTION_ADDRESS, CONFIG, STATUS};
 
 use base_factory::msg::{BaseMinterCreateMsg, Extension, ParamsResponse};
@@ -17,7 +17,7 @@ use cw_utils::{must_pay, parse_reply_instantiate_data};
 
 use sg1::checked_fair_burn;
 use sg2::query::Sg2QueryMsg;
-use sg4::{Status, StatusResponse};
+use sg4::{QueryMsg, Status, StatusResponse, SudoMsg};
 use sg721::{ExecuteMsg as Sg721ExecuteMsg, InstantiateMsg as Sg721InstantiateMsg};
 use sg_std::math::U64Ext;
 use sg_std::{Response, SubMsg, NATIVE_DENOM};
diff --git a/contracts/base-minter/src/msg.rs b/contracts/base-minter/src/msg.rs
index 11ee55b7..e8ad4231 100644
--- a/contracts/base-minter/src/msg.rs
+++ b/contracts/base-minter/src/msg.rs
@@ -16,21 +16,4 @@ pub enum ExecuteMsg {
     Mint { token_uri: String },
 }
 
-#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
-#[serde(rename_all = "snake_case")]
-pub enum QueryMsg {
-    Config {},
-    Status {},
-}
-
 pub type ConfigResponse = MinterConfigResponse<Empty>;
-
-#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
-#[serde(rename_all = "snake_case")]
-pub enum SudoMsg {
-    UpdateStatus {
-        is_verified: bool,
-        is_blocked: bool,
-        is_explicit: bool,
-    },
-}
diff --git a/packages/sg4/Cargo.toml b/packages/sg4/Cargo.toml
index 7f0867ea..b9079264 100644
--- a/packages/sg4/Cargo.toml
+++ b/packages/sg4/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "sg4"
-version = "0.12.0"
+version = "0.12.1"
 edition = "2021"
 authors = ["Shane Vitarana <s@noreply.publicawesome.com>"]
 description = "Definition and types for the SG4 interface"
diff --git a/packages/sg4/src/lib.rs b/packages/sg4/src/lib.rs
index 7a183cf9..f8a0c097 100644
--- a/packages/sg4/src/lib.rs
+++ b/packages/sg4/src/lib.rs
@@ -31,7 +31,7 @@ pub struct StatusResponse {
 
 #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
 #[serde(rename_all = "snake_case")]
-pub enum Sg4QueryMsg {
+pub enum QueryMsg {
     /// Returns `MinterConfigResponse<T>`
     Config {},
     /// Returns `StatusResponse`


Test patch:
diff --git a/contracts/base-minter/src/integration_tests.rs b/contracts/base-minter/src/integration_tests.rs
index f6474891..3ac62b74 100644
--- a/contracts/base-minter/src/integration_tests.rs
+++ b/contracts/base-minter/src/integration_tests.rs
@@ -1,4 +1,4 @@
-use crate::msg::{ConfigResponse, ExecuteMsg, QueryMsg};
+use crate::msg::{ConfigResponse, ExecuteMsg};
 use base_factory::msg::BaseMinterCreateMsg;
 use base_factory::state::BaseMinterParams;
 use cosmwasm_std::{coin, coins, Addr};
@@ -6,6 +6,7 @@ use cw721::{Cw721ExecuteMsg, Cw721QueryMsg, OwnerOfResponse};
 use cw_multi_test::{BankSudo, Contract, ContractWrapper, Executor, SudoMsg};
 use sg2::msg::Sg2ExecuteMsg;
 use sg2::tests::mock_collection_params;
+use sg4::QueryMsg;
 use sg_multi_test::StargazeApp;
 use sg_std::{StargazeMsgWrapper, NATIVE_DENOM};