From 2172bf041c0a8c283bbcee5ac8f5ab61ecf7da6f Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 16:48:28 -0400 Subject: [PATCH 1/8] Update to v0.16 --- .circleci/config.yml | 2 +- Cargo.lock | 49 ++++++++++++++++++++++---------------------- Cargo.toml | 18 ++++++++-------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e136e6684..01ab5d67a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -261,7 +261,7 @@ jobs: - run: name: Build development contracts command: | - docker run --volumes-from with_code cosmwasm/workspace-optimizer:0.12.7 + docker run --volumes-from with_code cosmwasm/workspace-optimizer:0.12.9 docker cp with_code:/code/artifacts ./artifacts - run: name: Show data diff --git a/Cargo.lock b/Cargo.lock index df47ff461..8a600ad47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,9 +70,9 @@ checksum = "722e23542a15cea1f65d4a1419c4cfd7a26706c70871a13a04238ca3f40f1661" [[package]] name = "cosmwasm-crypto" -version = "1.1.0" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c50d753d44148c7ff3279ac44b87b5b91e790f4c70db0e3900df211310a2bf" +checksum = "28376836c7677e1ea6d6656a754582e88b91e544ce22fae42956d5fe5549a958" dependencies = [ "digest 0.10.3", "ed25519-zebra", @@ -83,18 +83,18 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.1.0" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9053ebe2ad85831e9f9e2124fa2b22807528a78b25cc447483ce2a4aadfba394" +checksum = "8eb69f4f7a8a4bce68c8fbd3646238fede1e77056e4ea31c5b6bfc37b709eec3" dependencies = [ "syn", ] [[package]] name = "cosmwasm-schema" -version = "1.1.0" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c742fc698a88cf02ea304cc2b5bc18ef975c5bb9eff93c3e44d2cd565e1d458" +checksum = "a227cfeb9a7152b26a354b1c990e930e962f75fd68f57ab5ae2ef888c8524292" dependencies = [ "cosmwasm-schema-derive", "schemars", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.1.0" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a7c4c07be11add09dd3af3064c4f4cbc2dc99c6859129bdaf820131730e996" +checksum = "3626cb42eef870de67f791e873711255325224d86f281bf628c42abd295f3a14" dependencies = [ "proc-macro2", "quote", @@ -116,15 +116,16 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.1.0" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb8da0ae28693d892af2944319b48adc23c42725dc0fe7271b8baa38c10865da" +checksum = "46bf9157d060abbc55152aeadcace799d03dc630575daa66604079a1206cb060" dependencies = [ "base64", "cosmwasm-crypto", "cosmwasm-derive", "derivative", "forward_ref", + "hex", "schemars", "serde", "serde-json-wasm", @@ -184,9 +185,9 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ba3fb5fad2dce94263d070848b2befc46b5c8e4929adfb9a3595267823d6ec" +checksum = "d9b6f91c0b94481a3e9ef1ceb183c37d00764f8751e39b45fc09f4d9b970d469" dependencies = [ "cosmwasm-std", "schemars", @@ -195,9 +196,9 @@ dependencies = [ [[package]] name = "cw-utils" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a67007ff056f4cd034f361c8ed69780c0180959b9c8037c84f3caa78120faf5" +checksum = "d6a84c6c1c0acc3616398eba50783934bd6c964bad6974241eaee3460c8f5b26" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -210,9 +211,9 @@ dependencies = [ [[package]] name = "cw2" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a1924a28607bf7cb9fd6681a64feea3e5fa9a8cb71fb4d24cf33635b21065a" +checksum = "91398113b806f4d2a8d5f8d05684704a20ffd5968bf87e3473e1973710b884ad" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -223,9 +224,9 @@ dependencies = [ [[package]] name = "cw20" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56a48e4a85c0a31484e053a3eea15abfc3ed24fafc1a1a3e91181a0bd3a8ee91" +checksum = "a45a8794a5dd33b66af34caee52a7beceb690856adcc1682b6e3db88b2cdee62" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -236,7 +237,7 @@ dependencies = [ [[package]] name = "cw2981-royalties" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -249,7 +250,7 @@ dependencies = [ [[package]] name = "cw721" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -260,7 +261,7 @@ dependencies = [ [[package]] name = "cw721-base" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -275,7 +276,7 @@ dependencies = [ [[package]] name = "cw721-fixed-price" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -292,7 +293,7 @@ dependencies = [ [[package]] name = "cw721-metadata-onchain" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -305,7 +306,7 @@ dependencies = [ [[package]] name = "cw721-non-transferable" -version = "0.15.0" +version = "0.16.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", diff --git a/Cargo.toml b/Cargo.toml index c24f89369..124313d48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ members = ["packages/*", "contracts/*"] [workspace.package] -version = "0.15.0" +version = "0.16.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/CosmWasm/cw-nfts" @@ -10,14 +10,14 @@ homepage = "https://cosmwasm.com" documentation = "https://docs.cosmwasm.com" [workspace.dependencies] -cosmwasm-schema = "1.1.0" -cosmwasm-std = "1.1.0" -cw2 = "0.15.0" -cw20 = "0.15.0" -cw721 = { version = "0.15.0", path = "./packages/cw721" } -cw721-base = { version = "0.15.0", path = "./contracts/cw721-base" } -cw-storage-plus = "0.15.0" -cw-utils = "0.15.0" +cosmwasm-schema = "1.1.5" +cosmwasm-std = "1.1.5" +cw2 = "0.16.0" +cw20 = "0.16.0" +cw721 = { version = "0.16.0", path = "./packages/cw721" } +cw721-base = { version = "0.16.0", path = "./contracts/cw721-base" } +cw-storage-plus = "0.16.0" +cw-utils = "0.16.0" schemars = "0.8.10" serde = { version = "1.0.140", default-features = false, features = ["derive"] } thiserror = "1.0.31" From 4ced127cd0ba50552bf73ef36fcf9f7d45709874 Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 17:02:01 -0400 Subject: [PATCH 2/8] Add script to generate schema --- scripts/schema.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 scripts/schema.sh diff --git a/scripts/schema.sh b/scripts/schema.sh new file mode 100755 index 000000000..068835e1f --- /dev/null +++ b/scripts/schema.sh @@ -0,0 +1,7 @@ +for d in contracts/*; do + if [ -d "$d" ]; then + cd $d + cargo schema + cd ../.. + fi +done From f85155b1e7b980dd647f50a27d1f6fe9cd83b1a0 Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 17:02:47 -0400 Subject: [PATCH 3/8] Update schemas --- contracts/cw2981-royalties/schema/all_nft_info_response.json | 3 ++- contracts/cw2981-royalties/schema/execute_msg.json | 5 +++-- contracts/cw2981-royalties/schema/operators_response.json | 3 ++- contracts/cw2981-royalties/schema/owner_of_response.json | 3 ++- contracts/cw721-base/schema/execute_msg.json | 2 +- contracts/cw721-fixed-price/schema/execute_msg.json | 2 +- contracts/cw721-metadata-onchain/schema/execute_msg.json | 2 +- .../cw721-non-transferable/schema/cw721_execute_msg.json | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/contracts/cw2981-royalties/schema/all_nft_info_response.json b/contracts/cw2981-royalties/schema/all_nft_info_response.json index eb23abb52..d263321e2 100644 --- a/contracts/cw2981-royalties/schema/all_nft_info_response.json +++ b/contracts/cw2981-royalties/schema/all_nft_info_response.json @@ -91,7 +91,8 @@ ], "properties": { "never": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/cw2981-royalties/schema/execute_msg.json b/contracts/cw2981-royalties/schema/execute_msg.json index ca78751b5..c79dc5e98 100644 --- a/contracts/cw2981-royalties/schema/execute_msg.json +++ b/contracts/cw2981-royalties/schema/execute_msg.json @@ -235,7 +235,7 @@ ], "definitions": { "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, "Empty": { @@ -281,7 +281,8 @@ ], "properties": { "never": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/cw2981-royalties/schema/operators_response.json b/contracts/cw2981-royalties/schema/operators_response.json index 14c0e2265..533a096dd 100644 --- a/contracts/cw2981-royalties/schema/operators_response.json +++ b/contracts/cw2981-royalties/schema/operators_response.json @@ -76,7 +76,8 @@ ], "properties": { "never": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/cw2981-royalties/schema/owner_of_response.json b/contracts/cw2981-royalties/schema/owner_of_response.json index 5c82729d5..abb9006d8 100644 --- a/contracts/cw2981-royalties/schema/owner_of_response.json +++ b/contracts/cw2981-royalties/schema/owner_of_response.json @@ -82,7 +82,8 @@ ], "properties": { "never": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/cw721-base/schema/execute_msg.json b/contracts/cw721-base/schema/execute_msg.json index 858e2bc09..c79dc5e98 100644 --- a/contracts/cw721-base/schema/execute_msg.json +++ b/contracts/cw721-base/schema/execute_msg.json @@ -235,7 +235,7 @@ ], "definitions": { "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, "Empty": { diff --git a/contracts/cw721-fixed-price/schema/execute_msg.json b/contracts/cw721-fixed-price/schema/execute_msg.json index 08d874b4e..b9a6acead 100644 --- a/contracts/cw721-fixed-price/schema/execute_msg.json +++ b/contracts/cw721-fixed-price/schema/execute_msg.json @@ -17,7 +17,7 @@ ], "definitions": { "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, "Cw20ReceiveMsg": { diff --git a/contracts/cw721-metadata-onchain/schema/execute_msg.json b/contracts/cw721-metadata-onchain/schema/execute_msg.json index 30b2da5f6..1755aba18 100644 --- a/contracts/cw721-metadata-onchain/schema/execute_msg.json +++ b/contracts/cw721-metadata-onchain/schema/execute_msg.json @@ -235,7 +235,7 @@ ], "definitions": { "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, "Empty": { diff --git a/contracts/cw721-non-transferable/schema/cw721_execute_msg.json b/contracts/cw721-non-transferable/schema/cw721_execute_msg.json index eb09359fb..228b5c249 100644 --- a/contracts/cw721-non-transferable/schema/cw721_execute_msg.json +++ b/contracts/cw721-non-transferable/schema/cw721_execute_msg.json @@ -199,7 +199,7 @@ ], "definitions": { "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, "Expiration": { From 04d4b0cd4c4d2c770489ba3ac34e8cd036855c53 Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 17:04:24 -0400 Subject: [PATCH 4/8] Add simple Makefile --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..a1754df11 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONY: lint schema + +lint: + cargo clippy --all-targets -- -D warnings + +schema: + sh scripts/schema.sh \ No newline at end of file From 0246dd77a5ed278a126d423efaf05f871cc1d709 Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 17:07:50 -0400 Subject: [PATCH 5/8] Move build script into scripts folder --- Makefile | 5 ++++- build.sh => scripts/build.sh | 0 2 files changed, 4 insertions(+), 1 deletion(-) rename build.sh => scripts/build.sh (100%) diff --git a/Makefile b/Makefile index a1754df11..94e84fc03 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ -.PHONY: lint schema +.PHONY: build lint schema + +build: + sh scripts/build.sh lint: cargo clippy --all-targets -- -D warnings diff --git a/build.sh b/scripts/build.sh similarity index 100% rename from build.sh rename to scripts/build.sh From aedcabb2bd2cb5c1e117366c2cc3e0dba83c65d7 Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 17:09:24 -0400 Subject: [PATCH 6/8] No need for set version script with workspaces --- scripts/set_version.sh | 54 ------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100755 scripts/set_version.sh diff --git a/scripts/set_version.sh b/scripts/set_version.sh deleted file mode 100755 index 419b09980..000000000 --- a/scripts/set_version.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" - -function print_usage() { - echo "Usage: $0 NEW_VERSION" - echo "" - echo "e.g. $0 0.8.0" -} - -if [ "$#" -ne 1 ]; then - print_usage - exit 1 -fi - -# Check repo -SCRIPT_DIR="$(realpath "$(dirname "$0")")" -if [[ "$(realpath "$SCRIPT_DIR/..")" != "$(pwd)" ]]; then - echo "Script must be called from the repo root" - exit 2 -fi - -# Ensure repo is not dirty -CHANGES_IN_REPO=$(git status --porcelain) -if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 3 -fi - -NEW="$1" -OLD=$(sed -n -e 's/^version[[:space:]]*=[[:space:]]*"\(.*\)"/\1/p' packages/cw721/Cargo.toml) -echo "Updating old version $OLD to new version $NEW ..." - -FILES_MODIFIED=() - -for package_dir in packages/*/; do - CARGO_TOML="$package_dir/Cargo.toml" - sed -i -e "s/version[[:space:]]*=[[:space:]]*\"$OLD\"/version = \"$NEW\"/" "$CARGO_TOML" - FILES_MODIFIED+=("$CARGO_TOML") -done - -for contract_dir in contracts/*/; do - CARGO_TOML="$contract_dir/Cargo.toml" - sed -i -e "s/version[[:space:]]*=[[:space:]]*\"$OLD\"/version = \"$NEW\"/" "$CARGO_TOML" - FILES_MODIFIED+=("$CARGO_TOML") -done - -cargo build -FILES_MODIFIED+=("Cargo.lock") - -echo "Staging ${FILES_MODIFIED[*]} ..." -git add "${FILES_MODIFIED[@]}" -git commit -m "Set version: $NEW" From c68d77ec00c5b5730e59c8debe2bd9c21f4658e9 Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 17:10:51 -0400 Subject: [PATCH 7/8] Also generate schema for packages --- packages/cw721/schema/cw721_execute_msg.json | 2 +- packages/cw721/schema/cw721_receive_msg.json | 2 +- scripts/schema.sh | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/cw721/schema/cw721_execute_msg.json b/packages/cw721/schema/cw721_execute_msg.json index eb09359fb..228b5c249 100644 --- a/packages/cw721/schema/cw721_execute_msg.json +++ b/packages/cw721/schema/cw721_execute_msg.json @@ -199,7 +199,7 @@ ], "definitions": { "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" }, "Expiration": { diff --git a/packages/cw721/schema/cw721_receive_msg.json b/packages/cw721/schema/cw721_receive_msg.json index 2eada9ced..5340ef957 100644 --- a/packages/cw721/schema/cw721_receive_msg.json +++ b/packages/cw721/schema/cw721_receive_msg.json @@ -22,7 +22,7 @@ "additionalProperties": false, "definitions": { "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", "type": "string" } } diff --git a/scripts/schema.sh b/scripts/schema.sh index 068835e1f..6a42d1ecb 100755 --- a/scripts/schema.sh +++ b/scripts/schema.sh @@ -1,3 +1,11 @@ +for d in packages/*; do + if [ -d "$d" ]; then + cd $d + cargo schema + cd ../.. + fi +done + for d in contracts/*; do if [ -d "$d" ]; then cd $d From ec14001716fc18cb861e42b3d1860a898cabf624 Mon Sep 17 00:00:00 2001 From: Shane Vitarana Date: Tue, 25 Oct 2022 17:37:18 -0400 Subject: [PATCH 8/8] Added line at end --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 94e84fc03..e118b9a04 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,4 @@ lint: cargo clippy --all-targets -- -D warnings schema: - sh scripts/schema.sh \ No newline at end of file + sh scripts/schema.sh