Skip to content

Commit

Permalink
refactor: rename nft to cosmosssdk.io/x/nft (#14725)
Browse files Browse the repository at this point in the history
Co-authored-by: Marko <marbar3778@yahoo.com>
  • Loading branch information
julienrbrt and tac0turtle committed Jan 23, 2023
1 parent 6081491 commit 6b029a6
Show file tree
Hide file tree
Showing 55 changed files with 250 additions and 165 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking Changes

* (x/nft) [#14725](https://github.com/cosmos/cosmos-sdk/pull/14725) Extract NFT in its own go.mod and rename the package to `cosmossdk.io/x/nft`.
* (tx) [#14634](https://github.com/cosmos/cosmos-sdk/pull/14634) Move the `tx` go module to `x/tx`.
* (snapshots) [#14597](https://github.com/cosmos/cosmos-sdk/pull/14597) Move `snapshots` to `store/snapshots`, rename and bump proto package to v1.
* (crypto/keyring) [#14151](https://github.com/cosmos/cosmos-sdk/pull/14151) Move keys presentation from `crypto/keyring` to `client/keys`
Expand Down
7 changes: 3 additions & 4 deletions api/cosmos/nft/module/v1/module.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion api/cosmos/tx/signing/v1beta1/signing.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.work.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use (
./errors
./math
./orm
./tx
./simapp
./tests
./tools/rosetta
./tools/cosmovisor
./tools/confix
./x/tx
./x/nft
./x/circuit
)
2 changes: 1 addition & 1 deletion proto/cosmos/nft/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import "cosmos/app/v1alpha1/module.proto";
// Module is the config object of the nft module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/x/nft"
go_import: "cosmossdk.io/x/nft"
};
}
2 changes: 1 addition & 1 deletion proto/cosmos/nft/v1beta1/event.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package cosmos.nft.v1beta1;

option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
option go_package = "cosmossdk.io/x/nft";

// EventSend is emitted on Msg/Send
message EventSend {
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/nft/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cosmos.nft.v1beta1;

import "cosmos/nft/v1beta1/nft.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
option go_package = "cosmossdk.io/x/nft";

// GenesisState defines the nft module's genesis state.
message GenesisState {
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/nft/v1beta1/nft.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cosmos.nft.v1beta1;

import "google/protobuf/any.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
option go_package = "cosmossdk.io/x/nft";

// Class defines the class of the nft type.
message Class {
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/nft/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
import "cosmos/nft/v1beta1/nft.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
option go_package = "cosmossdk.io/x/nft";

// Query defines the gRPC querier service.
service Query {
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/nft/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package cosmos.nft.v1beta1;

option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
option go_package = "cosmossdk.io/x/nft";

import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
Expand Down
3 changes: 2 additions & 1 deletion scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ cd ..

# move proto files to the right places
cp -r github.com/cosmos/cosmos-sdk/* ./
rm -rf github.com
cp -r cosmossdk.io/** ./
rm -rf github.com cosmossdk.io

go mod tidy

Expand Down
6 changes: 3 additions & 3 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (
"github.com/tendermint/tendermint/libs/log"

simappparams "cosmossdk.io/simapp/params"
"cosmossdk.io/x/nft"
nftkeeper "cosmossdk.io/x/nft/keeper"
nftmodule "cosmossdk.io/x/nft/module"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -85,9 +88,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/nft"
nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper"
nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
Expand Down
2 changes: 1 addition & 1 deletion simapp/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"cosmossdk.io/core/appconfig"
"google.golang.org/protobuf/types/known/durationpb"

"cosmossdk.io/x/nft"
"github.com/cosmos/cosmos-sdk/runtime"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
Expand All @@ -43,7 +44,6 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/group"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/nft"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down
4 changes: 2 additions & 2 deletions simapp/app_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/depinject"
nftkeeper "cosmossdk.io/x/nft/keeper"
nftmodule "cosmossdk.io/x/nft/module"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -57,8 +59,6 @@ import (
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper"
nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
Expand Down
12 changes: 5 additions & 7 deletions simapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ require (
cosmossdk.io/core v0.4.1
cosmossdk.io/depinject v1.0.0-alpha.3
cosmossdk.io/math v1.0.0-beta.4
cosmossdk.io/tools/confix v0.0.0-20230110102841-9742029158ad
cosmossdk.io/tools/confix v0.0.0-20230120150717-4f6f6c00021f
cosmossdk.io/tools/rosetta v0.2.0
cosmossdk.io/x/nft v0.0.0-20230113085233-fae3332d62fc
github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32
// this version is not used as it is always replaced by the latest cosmos-sdk version
github.com/cosmos/cosmos-sdk v0.47.0-rc1
github.com/cosmos/cosmos-sdk/x/nft v0.0.0-20230113085233-fae3332d62fc
github.com/golang/mock v1.6.0
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
github.com/tendermint/tendermint v0.37.0-rc2
google.golang.org/protobuf v1.28.1
)

require github.com/spf13/pflag v1.0.5

require (
cloud.google.com/go v0.105.0 // indirect
cloud.google.com/go/compute v1.14.0 // indirect
Expand Down Expand Up @@ -184,13 +183,12 @@ require (
)

replace (
// TODO delete after release of confix
cosmossdk.io/tools/confix => ../tools/confix
// TODO tag all extracted modules after SDK refactor
cosmossdk.io/x/nft => ../x/nft
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// Simapp always use the latest version of the cosmos-sdk
github.com/cosmos/cosmos-sdk => ../.
github.com/cosmos/cosmos-sdk/x/nft => ../x/nft
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1
Expand Down
2 changes: 2 additions & 0 deletions simapp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w
cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE=
cosmossdk.io/math v1.0.0-beta.4 h1:JtKedVLGzA0vv84xjYmZ75RKG35Kf2WwcFu8IjRkIIw=
cosmossdk.io/math v1.0.0-beta.4/go.mod h1:An0MllWJY6PxibUpnwGk8jOm+a/qIxlKmL5Zyp9NnaM=
cosmossdk.io/tools/confix v0.0.0-20230120150717-4f6f6c00021f h1:LMXqH69KBG/R8w18sooHtoUZ0+5hcc99m6OjBiooDAo=
cosmossdk.io/tools/confix v0.0.0-20230120150717-4f6f6c00021f/go.mod h1:/apC5+JHM2A72kUY3z+55FWdIn/2ai2mTAYtSBDY4Lo=
cosmossdk.io/tools/rosetta v0.2.0 h1:Ae499UiZ9yPNCXvjOBO/R9I1pksCJfxoqWauEZgA/gs=
cosmossdk.io/tools/rosetta v0.2.0/go.mod h1:3mn8QuE2wLUdTi77/gbDXdFqXZdBdiBJhgAWUTSXPv8=
cosmossdk.io/x/tx v0.1.0 h1:uyyYVjG22B+jf54N803Z99Y1uPvfuNP3K1YShoCHYL8=
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/nft/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package nft
import (
"fmt"

"cosmossdk.io/x/nft"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/x/nft"
)

func (s *E2ETestSuite) TestQueryBalanceGRPC() {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/nft/query.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nft

import (
"github.com/cosmos/cosmos-sdk/x/nft"
"cosmossdk.io/x/nft"
)

func (s *E2ETestSuite) TestQueryClass() {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/nft/test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package nft
import (
"fmt"

"cosmossdk.io/x/nft/client/cli"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/testutil"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
"github.com/cosmos/cosmos-sdk/x/nft/client/cli"
)

func ExecSend(val *network.Validator, args []string) (testutil.BufferWriter, error) {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/nft/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (

"github.com/stretchr/testify/suite"

"cosmossdk.io/x/nft"
"github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/nft"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ require (
cosmossdk.io/depinject v1.0.0-alpha.3
cosmossdk.io/math v1.0.0-beta.4
cosmossdk.io/simapp v0.0.0-00010101000000-000000000000
cosmossdk.io/x/nft v0.0.0-20230113085233-fae3332d62fc
github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32
// this version is not used as it is always replaced by the latest cosmos-sdk version
github.com/cosmos/cosmos-sdk v0.47.0-rc1
github.com/cosmos/cosmos-sdk/x/nft v0.0.0-20230113085233-fae3332d62fc
github.com/cosmos/gogoproto v1.4.3
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
Expand Down Expand Up @@ -179,10 +179,11 @@ require (
replace (
// We always want to test against the latest version of the simapp.
cosmossdk.io/simapp => ../simapp
// TODO tag all extracted modules after SDK refactor
cosmossdk.io/x/nft => ../x/nft
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// We always want to test against the latest version of the SDK.
github.com/cosmos/cosmos-sdk => ../.
github.com/cosmos/cosmos-sdk/x/nft => ../x/nft
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1
Expand Down
4 changes: 3 additions & 1 deletion types/tx/signing/signing.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/nft/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (

"github.com/spf13/cobra"

"cosmossdk.io/x/nft"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/nft"
)

// Flag names and values
Expand Down
4 changes: 2 additions & 2 deletions x/nft/client/cli/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"io"

"cosmossdk.io/x/nft"
"cosmossdk.io/x/nft/client/cli"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/cosmos/cosmos-sdk/testutil"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/x/nft"
"github.com/cosmos/cosmos-sdk/x/nft/client/cli"
)

func (s *CLITestSuite) TestQueryClass() {
Expand Down
2 changes: 1 addition & 1 deletion x/nft/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (

"github.com/spf13/cobra"

"cosmossdk.io/x/nft"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/nft"
)

// GetTxCmd returns the transaction commands for this module
Expand Down
8 changes: 4 additions & 4 deletions x/nft/client/cli/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
testutilmod "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/nft"
nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module"

"github.com/cosmos/cosmos-sdk/x/nft/client/cli"
nfttestutil "github.com/cosmos/cosmos-sdk/x/nft/testutil"
"cosmossdk.io/x/nft"
"cosmossdk.io/x/nft/client/cli"
nftmodule "cosmossdk.io/x/nft/module"
nfttestutil "cosmossdk.io/x/nft/testutil"
)

const (
Expand Down
11 changes: 5 additions & 6 deletions x/nft/event.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6b029a6

Please sign in to comment.