From 27e3e3e1aaeeef9b042d2ef399baf2a91f411170 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 15 Nov 2022 19:22:36 +0100 Subject: [PATCH] docs: add documentation for nft module (backport #13871) (#13873) * docs: add documentation for nft module (#13871) (cherry picked from commit f82775ba1f042aebdff8fea73dd9ad62ffce3cba) * updates Co-authored-by: Julien Robert --- CHANGELOG.md | 3 ++- UPGRADING.md | 8 +++++++- tests/e2e/nft/grpc.go | 12 ++++++++++++ x/nft/README.md | 13 +++++++++---- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8fa184d69f0..817a82908812 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,7 +58,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* [13789](https://github.com/cosmos/cosmos-sdk/pull/13789) Add tx `encode` and `decode` endpoints to tx service. +* (x/nft) [#13836](https://github.com/cosmos/cosmos-sdk/pull/13836) Remove the validation for `classID` and `nftID` from the NFT module. +* [#13789](https://github.com/cosmos/cosmos-sdk/pull/13789) Add tx `encode` and `decode` endpoints to tx service. > Note: This endpoint will only encode proto messages, Amino encoding is not supported. * [#13826](https://github.com/cosmos/cosmos-sdk/pull/13826) Support custom `GasConfig` configuration for applications. * [#13619](https://github.com/cosmos/cosmos-sdk/pull/13619) Add new function called LogDeferred to report errors in defers. Use the function in x/bank files. diff --git a/UPGRADING.md b/UPGRADING.md index 955d67b8854e..e7b698cbfa97 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -2,7 +2,7 @@ This guide provides instructions for upgrading to specific versions of Cosmos SDK. -## [Unreleased] +## [v0.47.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0) ### Simulation @@ -36,6 +36,7 @@ SimApp's `app.go` is now using [App Wiring](https://docs.cosmos.network/main/bui This means that modules are injected directly into SimApp thanks to a [configuration file](https://github.com/cosmos/cosmos-sdk/blob/main/simapp/app_config.go). The old behavior is preserved and can still be used, without the dependency injection framework, as shows [`app_legacy.go`](https://github.com/cosmos/cosmos-sdk/blob/main/simapp/app_legacy.go). If you are using a legacy `app.go` without dependency injection, add the following lines to your `app.go` in order to provide newer gRPC services: + ```go autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules)) @@ -157,6 +158,11 @@ app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[upgrad bApp.SetParamStore(&app.ConsensusParamsKeeper) ``` +#### `x/nft` + +The SDK does not validate anymore the `classID` and `nftID` of an NFT, for extra flexibility in your NFT implementation. +This means chain developers need to validate the `classID` and `nftID` of an NFT. + ### Ledger Ledger support has been generalized to enable use of different apps and keytypes that use `secp256k1`. The Ledger interface remains the same, but it can now be provided through the Keyring `Options`, allowing higher-level chains to connect to different Ledger apps or use custom implementations. In addition, higher-level chains can provide custom key implementations around the Ledger public key, to enable greater flexibility with address generation and signing. diff --git a/tests/e2e/nft/grpc.go b/tests/e2e/nft/grpc.go index 3175069e71d1..1929e48e3ad0 100644 --- a/tests/e2e/nft/grpc.go +++ b/tests/e2e/nft/grpc.go @@ -322,6 +322,18 @@ func (s *IntegrationTestSuite) TestQueryNFTGRPC() { }, expectErr: false, }, + { + name: "class id does not exist", + args: struct { + ClassID string + ID string + }{ + ClassID: "class", + ID: ExpNFT.Id, + }, + expectErr: true, + errorMsg: "not found nft", + }, } nftURL := val.APIAddress + "/cosmos/nft/v1beta1/nfts/%s/%s" for _, tc := range testCases { diff --git a/x/nft/README.md b/x/nft/README.md index a084b28f9009..b06e0eb5194a 100644 --- a/x/nft/README.md +++ b/x/nft/README.md @@ -62,7 +62,12 @@ TotalSupply is responsible for tracking the number of all nfts under a certain c ## Messages -In this section we describe the processing of messages for the nft module. +In this section we describe the processing of messages for the NFT module. + +:::warning +The validation of `ClassID` and `NftID` is left to the app developer. +The SDK does not provide any validation for these fields. +::: ### MsgSend @@ -70,9 +75,9 @@ You can use the `MsgSend` message to transfer the ownership of nft. This is a fu The message handling should fail if: -* provided `ClassID` is not exist. -* provided `Id` is not exist. -* provided `Sender` is not the owner of nft. +* provided `ClassID` does not exist. +* provided `Id` does not exist. +* provided `Sender` does not the owner of nft. ## Events