Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer-zq committed Jun 4, 2024
1 parent d11a641 commit 5976fd4
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 31 deletions.
3 changes: 2 additions & 1 deletion client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"fmt"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra"

"github.com/bianjieai/nft-transfer/types"
)
Expand Down
3 changes: 2 additions & 1 deletion client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"strings"
"time"

"github.com/spf13/cobra"

"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/spf13/cobra"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
channelutils "github.com/cosmos/ibc-go/v8/modules/core/04-channel/client/utils"
Expand Down
9 changes: 5 additions & 4 deletions ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"strings"

errorsmod "cosmossdk.io/errors"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

"github.com/bianjieai/nft-transfer/keeper"
"github.com/bianjieai/nft-transfer/types"
Expand Down Expand Up @@ -182,9 +183,9 @@ func (im IBCModule) OnRecvPacket(
relayer sdk.AccAddress,
) ibcexported.Acknowledgement {
var (
ack = channeltypes.NewResultAcknowledgement([]byte{byte(1)})
data types.NonFungibleTokenPacketData
ackErr error
ack = channeltypes.NewResultAcknowledgement([]byte{byte(1)})
data types.NonFungibleTokenPacketData
ackErr error
)

if err := types.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err != nil {
Expand Down
1 change: 1 addition & 0 deletions keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

errorsmod "cosmossdk.io/errors"
"cosmossdk.io/store/prefix"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"

Expand Down
5 changes: 3 additions & 2 deletions keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package keeper
import (
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"

porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
"github.com/cosmos/ibc-go/v8/modules/core/exported"
Expand Down
3 changes: 2 additions & 1 deletion keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"strings"

errorsmod "cosmossdk.io/errors"
"github.com/hashicorp/go-metrics"

"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/hashicorp/go-metrics"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
Expand Down
1 change: 1 addition & 0 deletions keeper/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/store/prefix"
storetypes "cosmossdk.io/store/types"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/bianjieai/nft-transfer/types"
Expand Down
6 changes: 3 additions & 3 deletions module.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
)

var (
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ porttypes.IBCModule = (*IBCModule)(nil)
_ module.AppModule = (*AppModule)(nil)
_ module.AppModuleBasic = (*AppModuleBasic)(nil)
_ porttypes.IBCModule = (*IBCModule)(nil)
)

// AppModuleBasic is the IBC nft-transfer AppModuleBasic
Expand Down
2 changes: 1 addition & 1 deletion simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func RadomEnabled(r *rand.Rand) bool {
// RandomizedGenState generates a random GenesisState for nft-transfer.
func RandomizedGenState(simState *module.SimulationState) {
var portID string
simState.AppParams.GetOrGenerate(
simState.AppParams.GetOrGenerate(
port, &portID, simState.Rand,
func(r *rand.Rand) { portID = strings.ToLower(simtypes.RandStringOfLength(r, 20)) },
)
Expand Down
3 changes: 2 additions & 1 deletion simulation/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"testing"

sdkmath "cosmossdk.io/math"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/stretchr/testify/require"

"github.com/bianjieai/nft-transfer/simulation"
"github.com/bianjieai/nft-transfer/types"
Expand Down
4 changes: 2 additions & 2 deletions testing/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
abci "github.com/cometbft/cometbft/abci/types"
tmtypes "github.com/cometbft/cometbft/types"

capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
"github.com/cosmos/ibc-go/v8/modules/core/keeper"
"github.com/bianjieai/nft-transfer/testing/simapp"
ibctestingtypes "github.com/bianjieai/nft-transfer/testing/types"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
"github.com/cosmos/ibc-go/v8/modules/core/keeper"
)

var DefaultTestingAppInit = SetupTestingApp
Expand Down
2 changes: 1 addition & 1 deletion testing/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
cmttypes "github.com/cometbft/cometbft/types"
cmtversion "github.com/cometbft/cometbft/version"

"github.com/bianjieai/nft-transfer/testing/simapp"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
Expand All @@ -35,7 +36,6 @@ import (
"github.com/cosmos/ibc-go/v8/modules/core/exported"
"github.com/cosmos/ibc-go/v8/modules/core/types"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
"github.com/bianjieai/nft-transfer/testing/simapp"
)

var MaxAccounts = 10
Expand Down
2 changes: 1 addition & 1 deletion testing/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package ibctesting
import (
"time"

"github.com/bianjieai/nft-transfer/testing/mock"
connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
"github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
"github.com/bianjieai/nft-transfer/testing/mock"
)

type ClientConfig interface {
Expand Down
2 changes: 1 addition & 1 deletion testing/mock/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (

"github.com/stretchr/testify/require"

"github.com/bianjieai/nft-transfer/testing/mock"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
"github.com/bianjieai/nft-transfer/testing/mock"
)

func TestCreateCapabilityName(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion testing/mock/mock_extension_cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package mock
import (
"encoding/base64"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
proto "github.com/gogo/protobuf/proto"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"

"github.com/bianjieai/nft-transfer/types"
)

Expand Down
1 change: 1 addition & 0 deletions testing/mock/mock_nft_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package mock
import (
"cosmossdk.io/x/nft"
nftkeeper "cosmossdk.io/x/nft/keeper"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down
4 changes: 2 additions & 2 deletions testing/simapp/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"

capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
ibcmock "github.com/bianjieai/nft-transfer/testing/mock"
"github.com/bianjieai/nft-transfer/testing/simapp/upgrades"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
)

// registerUpgradeHandlers registers all supported upgrade handlers
Expand Down
4 changes: 2 additions & 2 deletions testing/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/bianjieai/nft-transfer/testing/mock"
"github.com/bianjieai/nft-transfer/testing/simapp"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
"github.com/bianjieai/nft-transfer/testing/mock"
"github.com/bianjieai/nft-transfer/testing/simapp"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package types
import (
"bytes"

"github.com/cosmos/gogoproto/jsonpb"
"github.com/cosmos/gogoproto/proto"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
"github.com/cosmos/gogoproto/jsonpb"
"github.com/cosmos/gogoproto/proto"
)

// RegisterLegacyAminoCodec registers the necessary nft-transfer interfaces and concrete types
Expand Down
3 changes: 2 additions & 1 deletion types/expected_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package types
import (
context "context"

sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

sdk "github.com/cosmos/cosmos-sdk/types"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
)
Expand Down
1 change: 1 addition & 0 deletions types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"strings"

errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

Expand Down
3 changes: 2 additions & 1 deletion types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package types
import (
"testing"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
)

var (
Expand Down
1 change: 1 addition & 0 deletions types/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion types/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestNonFungibleTokenPacketData_ValidateBasic(t *testing.T) {
},
{
name: "invalid packet with repeated tokenIds",
packet: NonFungibleTokenPacketData{"cryptoCat", "uri", "", []string{"kitty","kitty"}, []string{"kitty_uri","kitty_uri"}, tokenData, sender, receiver, "memo"},
packet: NonFungibleTokenPacketData{"cryptoCat", "uri", "", []string{"kitty", "kitty"}, []string{"kitty_uri", "kitty_uri"}, tokenData, sender, receiver, "memo"},
wantErr: true,
},
{
Expand Down
4 changes: 2 additions & 2 deletions types/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func ParseClassTrace(rawClassID string) ClassTrace {

path, baseClassId := extractPathAndBaseFromFullClassID(classSplit)
return ClassTrace{
Path: path,
Path: path,
BaseClassId: baseClassId,
}
}
Expand Down Expand Up @@ -187,7 +187,7 @@ func (t Traces) Sort() Traces {
// the elements that constitute the complete classID.
func extractPathAndBaseFromFullClassID(fullClassIdItems []string) (string, string) {
var (
pathSlice []string
pathSlice []string
baseClassIdSlice []string
)

Expand Down

0 comments on commit 5976fd4

Please sign in to comment.