docs: add documentation for nft module (#13871)

This commit is contained in:
Julien Robert 2022-11-15 15:45:19 +01:00 committed by GitHub
parent 5f4350d418
commit f82775ba1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 5 deletions

View File

@ -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.

View File

@ -4,6 +4,8 @@ This guide provides instructions for upgrading to specific versions of Cosmos SD
## [Unreleased]
## [v0.47.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0)
### Simulation
Remove `RandomizedParams` from `AppModuleSimulation` interface. Previously, it used to generate random parameter changes during simulations, however, it does so through ParamChangeProposal which is now legacy. Since all modules were migrated, we can now safely remove this from `AppModuleSimulation` interface.
@ -36,6 +38,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 +160,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.

View File

@ -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 {

View File

@ -67,7 +67,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
@ -75,9 +80,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