diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 0d217127..40cf95db 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -50375,6 +50375,7 @@ paths: dnsRecordType: type: string enum: + - NO_RECORD_TYPE - A - AAAA - CNAME @@ -50384,7 +50385,7 @@ paths: - SOA - SRV - TXT - default: A + default: NO_RECORD_TYPE value: type: string walletRecords: @@ -50395,6 +50396,7 @@ paths: walletRecordType: type: string enum: + - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET - ETHEREUM_MAINNET_MAINNET @@ -50420,10 +50422,10 @@ paths: - SUI_TESTNET_TESTNET - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET + default: NO_NETWORK description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon - BNB_MAINNET_MAINNET: BNB Chain @@ -50432,14 +50434,14 @@ paths: - OPTIMISM_MAINNET_MAINNET: Optimism - ARBITRUM_MAINNET_MAINNET: Arbitrum - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; + SHARDEUM_MAINNET_ = 20015; + SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx + ZETA_MAINNET_MAINNET = 20018; + - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' value: type: string @@ -50591,6 +50593,7 @@ paths: dnsRecordType: type: string enum: + - NO_RECORD_TYPE - A - AAAA - CNAME @@ -50600,7 +50603,7 @@ paths: - SOA - SRV - TXT - default: A + default: NO_RECORD_TYPE value: type: string walletRecords: @@ -50611,6 +50614,7 @@ paths: walletRecordType: type: string enum: + - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET - ETHEREUM_MAINNET_MAINNET @@ -50636,10 +50640,10 @@ paths: - SUI_TESTNET_TESTNET - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET + default: NO_NETWORK description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon - BNB_MAINNET_MAINNET: BNB Chain @@ -50648,14 +50652,14 @@ paths: - OPTIMISM_MAINNET_MAINNET: Optimism - ARBITRUM_MAINNET_MAINNET: Arbitrum - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; + SHARDEUM_MAINNET_ = 20015; + SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx + ZETA_MAINNET_MAINNET = 20018; + - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' value: type: string @@ -80451,6 +80455,7 @@ definitions: dnsRecordType: type: string enum: + - NO_RECORD_TYPE - A - AAAA - CNAME @@ -80460,12 +80465,13 @@ definitions: - SOA - SRV - TXT - default: A + default: NO_RECORD_TYPE value: type: string mycel.registry.DnsRecordType: type: string enum: + - NO_RECORD_TYPE - A - AAAA - CNAME @@ -80475,7 +80481,7 @@ definitions: - SOA - SRV - TXT - default: A + default: NO_RECORD_TYPE mycel.registry.DomainOwnership: type: object properties: @@ -80525,6 +80531,7 @@ definitions: mycel.registry.NetworkName: type: string enum: + - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET - ETHEREUM_MAINNET_MAINNET @@ -80550,10 +80557,10 @@ definitions: - SUI_TESTNET_TESTNET - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET + default: NO_NETWORK description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon - BNB_MAINNET_MAINNET: BNB Chain @@ -80562,14 +80569,14 @@ definitions: - OPTIMISM_MAINNET_MAINNET: Optimism - ARBITRUM_MAINNET_MAINNET: Arbitrum - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; + SHARDEUM_MAINNET_ = 20015; + SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx + ZETA_MAINNET_MAINNET = 20018; + - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' mycel.registry.OwnedDomain: type: object @@ -80651,6 +80658,7 @@ definitions: dnsRecordType: type: string enum: + - NO_RECORD_TYPE - A - AAAA - CNAME @@ -80660,7 +80668,7 @@ definitions: - SOA - SRV - TXT - default: A + default: NO_RECORD_TYPE value: type: string walletRecords: @@ -80671,6 +80679,7 @@ definitions: walletRecordType: type: string enum: + - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET - ETHEREUM_MAINNET_MAINNET @@ -80696,10 +80705,10 @@ definitions: - SUI_TESTNET_TESTNET - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET + default: NO_NETWORK description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon - BNB_MAINNET_MAINNET: BNB Chain @@ -80708,14 +80717,14 @@ definitions: - OPTIMISM_MAINNET_MAINNET: Optimism - ARBITRUM_MAINNET_MAINNET: Arbitrum - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; + SHARDEUM_MAINNET_ = 20015; + SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx + ZETA_MAINNET_MAINNET = 20018; + - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' value: type: string @@ -80938,6 +80947,7 @@ definitions: dnsRecordType: type: string enum: + - NO_RECORD_TYPE - A - AAAA - CNAME @@ -80947,7 +80957,7 @@ definitions: - SOA - SRV - TXT - default: A + default: NO_RECORD_TYPE value: type: string walletRecords: @@ -80958,6 +80968,7 @@ definitions: walletRecordType: type: string enum: + - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET - ETHEREUM_MAINNET_MAINNET @@ -80983,10 +80994,10 @@ definitions: - SUI_TESTNET_TESTNET - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET + default: NO_NETWORK description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon - BNB_MAINNET_MAINNET: BNB Chain @@ -80995,14 +81006,14 @@ definitions: - OPTIMISM_MAINNET_MAINNET: Optimism - ARBITRUM_MAINNET_MAINNET: Arbitrum - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; + SHARDEUM_MAINNET_ = 20015; + SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx + ZETA_MAINNET_MAINNET = 20018; + - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' value: type: string @@ -81150,6 +81161,7 @@ definitions: dnsRecordType: type: string enum: + - NO_RECORD_TYPE - A - AAAA - CNAME @@ -81159,7 +81171,7 @@ definitions: - SOA - SRV - TXT - default: A + default: NO_RECORD_TYPE value: type: string walletRecords: @@ -81170,6 +81182,7 @@ definitions: walletRecordType: type: string enum: + - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET - ETHEREUM_MAINNET_MAINNET @@ -81195,10 +81208,10 @@ definitions: - SUI_TESTNET_TESTNET - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET + default: NO_NETWORK description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon - BNB_MAINNET_MAINNET: BNB Chain @@ -81207,14 +81220,14 @@ definitions: - OPTIMISM_MAINNET_MAINNET: Optimism - ARBITRUM_MAINNET_MAINNET: Arbitrum - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; + SHARDEUM_MAINNET_ = 20015; + SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx + ZETA_MAINNET_MAINNET = 20018; + - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' value: type: string @@ -81456,6 +81469,7 @@ definitions: walletRecordType: type: string enum: + - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET - ETHEREUM_MAINNET_MAINNET @@ -81481,10 +81495,10 @@ definitions: - SUI_TESTNET_TESTNET - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET - default: BITCOIN_MAINNET_MAINNET + default: NO_NETWORK description: |- - - BITCOIN_MAINNET_MAINNET: BTC 0xxx - - ETHEREUM_MAINNET_MAINNET: EVM 1xxxx + - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon - BNB_MAINNET_MAINNET: BNB Chain @@ -81493,14 +81507,14 @@ definitions: - OPTIMISM_MAINNET_MAINNET: Optimism - ARBITRUM_MAINNET_MAINNET: Arbitrum - SHARDEUM_BETANET_SPHINX: Shardeum - SHARDEUM_MAINNET_ = 10015; - SHARDEUM_TESTNET_ = 10016; + SHARDEUM_MAINNET_ = 20015; + SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain - ZETA_MAINNET_MAINNET = 10018; - - APTOS_MAINNET_MAINNET: MOVE 2xxxx + ZETA_MAINNET_MAINNET = 20018; + - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui - - SOLANA_MAINNET_MAINNET: SOLANA 3xxxx + - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx title: 'Rule: CHAINNAME_ENVIROMENT_NETWORK' value: type: string diff --git a/x/epochs/types/epoch_info.go b/x/epochs/types/epoch_info.go index 68a52353..18a730bd 100644 --- a/x/epochs/types/epoch_info.go +++ b/x/epochs/types/epoch_info.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // StartInitialEpoch sets the epoch info fields to their start values @@ -30,10 +30,10 @@ func (ei EpochInfo) Validate() error { return ErrEpochDurationCannotBeZero } if ei.CurrentEpoch < 0 { - return sdkerrors.Wrapf(errors.New(fmt.Sprintf("%d", ei.CurrentEpoch)), ErrCurrentEpochCannotBeNegative.Error()) + return errorsmod.Wrapf(errors.New(fmt.Sprintf("%d", ei.CurrentEpoch)), ErrCurrentEpochCannotBeNegative.Error()) } if ei.CurrentEpochStartHeight < 0 { - return sdkerrors.Wrapf(errors.New(fmt.Sprintf("%d", ei.CurrentEpoch)), ErrCurrentEpochStartHeightCannotBeNegative.Error()) + return errorsmod.Wrapf(errors.New(fmt.Sprintf("%d", ei.CurrentEpoch)), ErrCurrentEpochStartHeightCannotBeNegative.Error()) } return nil } diff --git a/x/epochs/types/errors.go b/x/epochs/types/errors.go index 90391f48..cd9b033d 100644 --- a/x/epochs/types/errors.go +++ b/x/epochs/types/errors.go @@ -3,15 +3,15 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/epochs module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") - ErrEpochIdentifierCannotBeEmpty = sdkerrors.Register(ModuleName, 1101, "epoch identifier cannot be empty") - ErrEpochDurationCannotBeZero = sdkerrors.Register(ModuleName, 1102, "epoch duration cannot be zero") - ErrCurrentEpochCannotBeNegative = sdkerrors.Register(ModuleName, 1103, "current epoch cannot be negative") - ErrCurrentEpochStartHeightCannotBeNegative = sdkerrors.Register(ModuleName, 1104, "current epoch start height cannot be negative") - ErrDuplicatedEpochEntry = sdkerrors.Register(ModuleName, 1105, "duplicated epoch entry") + ErrSample = errorsmod.Register(ModuleName, 1100, "sample error") + ErrEpochIdentifierCannotBeEmpty = errorsmod.Register(ModuleName, 1101, "epoch identifier cannot be empty") + ErrEpochDurationCannotBeZero = errorsmod.Register(ModuleName, 1102, "epoch duration cannot be zero") + ErrCurrentEpochCannotBeNegative = errorsmod.Register(ModuleName, 1103, "current epoch cannot be negative") + ErrCurrentEpochStartHeightCannotBeNegative = errorsmod.Register(ModuleName, 1104, "current epoch start height cannot be negative") + ErrDuplicatedEpochEntry = errorsmod.Register(ModuleName, 1105, "duplicated epoch entry") ) diff --git a/x/epochs/types/genesis.go b/x/epochs/types/genesis.go index ce8c7f99..01347ce1 100644 --- a/x/epochs/types/genesis.go +++ b/x/epochs/types/genesis.go @@ -4,7 +4,7 @@ import ( "errors" "time" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // DefaultIndex is the default global index @@ -38,7 +38,7 @@ func (gs GenesisState) Validate() error { for _, epoch := range gs.Epochs { if epochIdentifiers[epoch.Identifier] { - return sdkerrors.Wrapf(errors.New(epoch.Identifier), ErrDuplicatedEpochEntry.Error()) + return errorsmod.Wrapf(errors.New(epoch.Identifier), ErrDuplicatedEpochEntry.Error()) } if err := epoch.Validate(); err != nil { return err diff --git a/x/registry/keeper/msg_server_register_second_level_domain.go b/x/registry/keeper/msg_server_register_second_level_domain.go index 55cef121..3887d938 100644 --- a/x/registry/keeper/msg_server_register_second_level_domain.go +++ b/x/registry/keeper/msg_server_register_second_level_domain.go @@ -7,15 +7,15 @@ import ( "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) RegisterDomain(goCtx context.Context, msg *types.MsgRegisterDomain) (*types.MsgRegisterDomainResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) if msg.RegistrationPeriodInYear < 1 || msg.RegistrationPeriodInYear > 4 { - return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%d year(s)", msg.RegistrationPeriodInYear)), types.ErrInvalidRegistrationPeriod.Error()) + return nil, errorsmod.Wrapf(errors.New(fmt.Sprintf("%d year(s)", msg.RegistrationPeriodInYear)), types.ErrInvalidRegistrationPeriod.Error()) } creatorAddress, err := sdk.AccAddressFromBech32(msg.Creator) diff --git a/x/registry/keeper/msg_server_register_second_level_domain_test.go b/x/registry/keeper/msg_server_register_second_level_domain_test.go index b3fe8e72..d14aa192 100644 --- a/x/registry/keeper/msg_server_register_second_level_domain_test.go +++ b/x/registry/keeper/msg_server_register_second_level_domain_test.go @@ -7,8 +7,8 @@ import ( "github.com/mycel-domain/mycel/testutil" "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (suite *KeeperTestSuite) TestRegisterSecondLevelDomain() { @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestRegisterSecondLevelDomain() { name: "foo", parent: "cel", registrationPeriodInYear: 1, - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("foo.cel")), types.ErrDomainIsAlreadyTaken.Error()), + expErr: errorsmod.Wrapf(errors.New(fmt.Sprintf("foo.cel")), types.ErrDomainIsAlreadyTaken.Error()), fn: func() { // Register domain once domain := &types.MsgRegisterDomain{ @@ -68,7 +68,7 @@ func (suite *KeeperTestSuite) TestRegisterSecondLevelDomain() { name: "foo", parent: "xxx", registrationPeriodInYear: 1, - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("xxx")), types.ErrParentDomainDoesNotExist.Error()), + expErr: errorsmod.Wrapf(errors.New(fmt.Sprintf("xxx")), types.ErrParentDomainDoesNotExist.Error()), fn: func() { }, }, diff --git a/x/registry/keeper/msg_server_register_top_level_domain.go b/x/registry/keeper/msg_server_register_top_level_domain.go index 4361d9f5..6a11eb6b 100644 --- a/x/registry/keeper/msg_server_register_top_level_domain.go +++ b/x/registry/keeper/msg_server_register_top_level_domain.go @@ -7,15 +7,15 @@ import ( "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) RegisterTopLevelDomain(goCtx context.Context, msg *types.MsgRegisterTopLevelDomain) (*types.MsgRegisterTopLevelDomainResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) if msg.RegistrationPeriodInYear < 1 || msg.RegistrationPeriodInYear > 4 { - return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%d year(s)", msg.RegistrationPeriodInYear)), types.ErrInvalidRegistrationPeriod.Error()) + return nil, errorsmod.Wrapf(errors.New(fmt.Sprintf("%d year(s)", msg.RegistrationPeriodInYear)), types.ErrInvalidRegistrationPeriod.Error()) } creatorAddress, err := sdk.AccAddressFromBech32(msg.Creator) diff --git a/x/registry/keeper/msg_server_register_top_level_domain_test.go b/x/registry/keeper/msg_server_register_top_level_domain_test.go index c7250a72..314c47ab 100644 --- a/x/registry/keeper/msg_server_register_top_level_domain_test.go +++ b/x/registry/keeper/msg_server_register_top_level_domain_test.go @@ -7,8 +7,8 @@ import ( "github.com/mycel-domain/mycel/testutil" "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (suite *KeeperTestSuite) TestRegisterTopLevelDomain() { @@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) TestRegisterTopLevelDomain() { creator: testutil.Alice, name: "cel2", registrationPeriodInYear: 1, - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("cel2")), types.ErrDomainIsAlreadyTaken.Error()), + expErr: errorsmod.Wrapf(errors.New(fmt.Sprintf("cel2")), types.ErrDomainIsAlreadyTaken.Error()), fn: func() { // Register domain once domain := &types.MsgRegisterTopLevelDomain{ diff --git a/x/registry/keeper/msg_server_update_dns_record.go b/x/registry/keeper/msg_server_update_dns_record.go index a822a5ad..9df6170d 100644 --- a/x/registry/keeper/msg_server_update_dns_record.go +++ b/x/registry/keeper/msg_server_update_dns_record.go @@ -7,8 +7,8 @@ import ( "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) UpdateDnsRecord(goCtx context.Context, msg *types.MsgUpdateDnsRecord) (*types.MsgUpdateDnsRecordResponse, error) { @@ -16,7 +16,7 @@ func (k msgServer) UpdateDnsRecord(goCtx context.Context, msg *types.MsgUpdateDn domain, isFound := k.Keeper.GetSecondLevelDomain(ctx, msg.Name, msg.Parent) if !isFound { - return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotFound.Error()) + return nil, errorsmod.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotFound.Error()) } // Check if the domain is owned by the creator diff --git a/x/registry/keeper/msg_server_update_dns_record_test.go b/x/registry/keeper/msg_server_update_dns_record_test.go index 1aee76c4..a6f661a3 100644 --- a/x/registry/keeper/msg_server_update_dns_record_test.go +++ b/x/registry/keeper/msg_server_update_dns_record_test.go @@ -7,8 +7,8 @@ import ( "github.com/mycel-domain/mycel/testutil" "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (suite *KeeperTestSuite) TestUpdateDnsRecord() { @@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) TestUpdateDnsRecord() { parent: "fuga", dnsRecordType: "A", value: "192.168.0.1", - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("hoge.fuga")), types.ErrDomainNotFound.Error()), + expErr: errorsmod.Wrapf(errors.New(fmt.Sprintf("hoge.fuga")), types.ErrDomainNotFound.Error()), fn: func() {}, }, { @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestUpdateDnsRecord() { parent: "cel", dnsRecordType: "A", value: "192.168.0.1", - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf(testutil.Bob)), types.ErrDomainNotEditable.Error()), + expErr: errorsmod.Wrapf(errors.New(fmt.Sprintf(testutil.Bob)), types.ErrDomainNotEditable.Error()), fn: func() {}, }, } diff --git a/x/registry/keeper/msg_server_update_wallet_record.go b/x/registry/keeper/msg_server_update_wallet_record.go index 1eeca326..07e39e8d 100644 --- a/x/registry/keeper/msg_server_update_wallet_record.go +++ b/x/registry/keeper/msg_server_update_wallet_record.go @@ -7,8 +7,8 @@ import ( "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k msgServer) UpdateWalletRecord(goCtx context.Context, msg *types.MsgUpdateWalletRecord) (*types.MsgUpdateWalletRecordResponse, error) { @@ -16,7 +16,7 @@ func (k msgServer) UpdateWalletRecord(goCtx context.Context, msg *types.MsgUpdat domain, isFound := k.Keeper.GetSecondLevelDomain(ctx, msg.Name, msg.Parent) if !isFound { - return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotFound.Error()) + return nil, errorsmod.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotFound.Error()) } // Check if the domain is owned by the creator diff --git a/x/registry/keeper/msg_server_update_wallet_record_test.go b/x/registry/keeper/msg_server_update_wallet_record_test.go index a883fd2a..6e41fcf7 100644 --- a/x/registry/keeper/msg_server_update_wallet_record_test.go +++ b/x/registry/keeper/msg_server_update_wallet_record_test.go @@ -8,8 +8,8 @@ import ( "github.com/mycel-domain/mycel/testutil" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (suite *KeeperTestSuite) TestUpdateWalletRecord() { @@ -73,7 +73,7 @@ func (suite *KeeperTestSuite) TestUpdateWalletRecord() { parent: "fuga", walletRecordType: "ETHEREUM_MAINNET_MAINNET", value: "0x1234567890123456789012345678901234567890", - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("hoge.fuga")), types.ErrDomainNotFound.Error()), + expErr: errorsmod.Wrapf(errors.New(fmt.Sprintf("hoge.fuga")), types.ErrDomainNotFound.Error()), fn: func() {}, }, { @@ -82,7 +82,7 @@ func (suite *KeeperTestSuite) TestUpdateWalletRecord() { parent: "cel", walletRecordType: "ETHEREUM_MAINNET_MAINNET", value: "0x1234567890123456789012345678901234567890", - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf(testutil.Bob)), types.ErrDomainNotEditable.Error()), + expErr: errorsmod.Wrapf(errors.New(fmt.Sprintf(testutil.Bob)), types.ErrDomainNotEditable.Error()), fn: func() {}, }, } diff --git a/x/registry/keeper/register_second_level_domain.go b/x/registry/keeper/register_second_level_domain.go index 1d6244f5..6cb157b9 100644 --- a/x/registry/keeper/register_second_level_domain.go +++ b/x/registry/keeper/register_second_level_domain.go @@ -3,11 +3,12 @@ package keeper import ( "errors" "fmt" - "github.com/mycel-domain/mycel/x/registry/types" "strconv" + "github.com/mycel-domain/mycel/x/registry/types" + + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func (k Keeper) GetParentDomain(ctx sdk.Context, domain types.SecondLevelDomain) (parentDomain types.TopLevelDomain, found bool) { @@ -77,7 +78,7 @@ func (k Keeper) RegisterDomain(ctx sdk.Context, domain types.SecondLevelDomain, // Check if parent domain has subdomain registration config if parentDomain.SubdomainConfig.MaxSubdomainRegistrations <= parentDomain.SubdomainCount { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%d", parentDomain.SubdomainCount)), types.ErrMaxSubdomainCountReached.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%d", parentDomain.SubdomainCount)), types.ErrMaxSubdomainCountReached.Error()) return err } diff --git a/x/registry/keeper/validate_registration.go b/x/registry/keeper/validate_registration.go index 7e54197f..be7d471a 100644 --- a/x/registry/keeper/validate_registration.go +++ b/x/registry/keeper/validate_registration.go @@ -3,10 +3,11 @@ package keeper import ( "errors" "fmt" + "github.com/mycel-domain/mycel/x/registry/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // Get is domain already taken @@ -39,7 +40,7 @@ func (k Keeper) ValidateRegisterTLD(ctx sdk.Context, domain types.TopLevelDomain func (k Keeper) ValidateRegisterSLD(ctx sdk.Context, domain types.SecondLevelDomain) (err error) { isParentDomainExist := k.GetIsParentDomainExist(ctx, domain) if !isParentDomainExist { - err = sdkerrors.Wrapf(errors.New(domain.Parent), + err = errorsmod.Wrapf(errors.New(domain.Parent), types.ErrParentDomainDoesNotExist.Error()) } @@ -50,7 +51,7 @@ func (k Keeper) ValidateRegisterSLD(ctx sdk.Context, domain types.SecondLevelDom func (k Keeper) ValidateRegsiterSubdomain(ctx sdk.Context, domain types.SecondLevelDomain) (err error) { isParentDomainExist := k.GetIsParentDomainExist(ctx, domain) if !isParentDomainExist { - err = sdkerrors.Wrapf(errors.New(domain.Parent), + err = errorsmod.Wrapf(errors.New(domain.Parent), types.ErrParentDomainDoesNotExist.Error()) } return err @@ -66,7 +67,7 @@ func (k Keeper) ValidateSecondLevelDomain(ctx sdk.Context, domain types.SecondLe // Check if domain is already taken isDomainAlreadyTaken := k.GetIsDomainAlreadyTaken(ctx, domain) if isDomainAlreadyTaken { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s.%s", domain.Name, domain.Parent)), + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s.%s", domain.Name, domain.Parent)), types.ErrDomainIsAlreadyTaken.Error()) return err } @@ -98,7 +99,7 @@ func (k Keeper) ValidateTopLevelDomain(ctx sdk.Context, domain types.TopLevelDom // Check if domain is already taken isDomainAlreadyTaken := k.GetIsTopLevelDomainAlreadyTaken(ctx, domain) if isDomainAlreadyTaken { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", domain.Name)), + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s", domain.Name)), types.ErrDomainIsAlreadyTaken.Error()) return err } diff --git a/x/registry/types/errors.go b/x/registry/types/errors.go index bfc9af51..0a4f6459 100644 --- a/x/registry/types/errors.go +++ b/x/registry/types/errors.go @@ -3,24 +3,24 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/mycel module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") - ErrDomainIsAlreadyTaken = sdkerrors.Register(ModuleName, 1101, "domain is already taken") - ErrInvalidDomainName = sdkerrors.Register(ModuleName, 1102, "invalid name") - ErrInvalidDomainParent = sdkerrors.Register(ModuleName, 1103, "invalid parent") - ErrDomainNotFound = sdkerrors.Register(ModuleName, 1104, "domain not found") - ErrInvalidWalletAddress = sdkerrors.Register(ModuleName, 1105, "invalid wallet address") - ErrInvalidWalletRecordType = sdkerrors.Register(ModuleName, 1106, "invalid wallet record type") - ErrInvalidDnsRecordValue = sdkerrors.Register(ModuleName, 1107, "invalid dns record value") - ErrInvalidDnsRecordType = sdkerrors.Register(ModuleName, 1108, "invalid dns record type") - ErrDomainNotEditable = sdkerrors.Register(ModuleName, 1109, "role not pemitted to edit the domain") - ErrParentDomainDoesNotExist = sdkerrors.Register(ModuleName, 1110, "parent domain does not exist") - ErrParentDomainMustBeEmpty = sdkerrors.Register(ModuleName, 1111, "parent domain must be empty") - ErrDomainNotRegistrable = sdkerrors.Register(ModuleName, 1112, "domain is not registrable") - ErrMaxSubdomainCountReached = sdkerrors.Register(ModuleName, 1113, "max subdomain count reached") - ErrInvalidRegistrationPeriod = sdkerrors.Register(ModuleName, 1114, "invalid registration period") + ErrSample = errorsmod.Register(ModuleName, 1100, "sample error") + ErrDomainIsAlreadyTaken = errorsmod.Register(ModuleName, 1101, "domain is already taken") + ErrInvalidDomainName = errorsmod.Register(ModuleName, 1102, "invalid name") + ErrInvalidDomainParent = errorsmod.Register(ModuleName, 1103, "invalid parent") + ErrDomainNotFound = errorsmod.Register(ModuleName, 1104, "domain not found") + ErrInvalidWalletAddress = errorsmod.Register(ModuleName, 1105, "invalid wallet address") + ErrInvalidWalletRecordType = errorsmod.Register(ModuleName, 1106, "invalid wallet record type") + ErrInvalidDnsRecordValue = errorsmod.Register(ModuleName, 1107, "invalid dns record value") + ErrInvalidDnsRecordType = errorsmod.Register(ModuleName, 1108, "invalid dns record type") + ErrDomainNotEditable = errorsmod.Register(ModuleName, 1109, "role not pemitted to edit the domain") + ErrParentDomainDoesNotExist = errorsmod.Register(ModuleName, 1110, "parent domain does not exist") + ErrParentDomainMustBeEmpty = errorsmod.Register(ModuleName, 1111, "parent domain must be empty") + ErrDomainNotRegistrable = errorsmod.Register(ModuleName, 1112, "domain is not registrable") + ErrMaxSubdomainCountReached = errorsmod.Register(ModuleName, 1113, "max subdomain count reached") + ErrInvalidRegistrationPeriod = errorsmod.Register(ModuleName, 1114, "invalid registration period") ) diff --git a/x/registry/types/message_register_domain.go b/x/registry/types/message_register_domain.go index 7149b1f1..f67264cf 100644 --- a/x/registry/types/message_register_domain.go +++ b/x/registry/types/message_register_domain.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -42,7 +43,7 @@ func (msg *MsgRegisterDomain) GetSignBytes() []byte { func (msg *MsgRegisterDomain) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/registry/types/message_register_domain_test.go b/x/registry/types/message_register_domain_test.go index 80d9cb7d..46309245 100644 --- a/x/registry/types/message_register_domain_test.go +++ b/x/registry/types/message_register_domain_test.go @@ -17,18 +17,18 @@ func TestMsgRegisterDomain_ValidateBasic(t *testing.T) { { name: "invalid address", msg: MsgRegisterDomain{ - Creator: "invalid_address", - Name: "foo", - Parent: "cel", + Creator: "invalid_address", + Name: "foo", + Parent: "cel", RegistrationPeriodInYear: 1, }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRegisterDomain{ - Creator: sample.AccAddress(), - Name: "foo", - Parent: "cel", + Creator: sample.AccAddress(), + Name: "foo", + Parent: "cel", RegistrationPeriodInYear: 1, }, }, diff --git a/x/registry/types/message_register_top_level_domain.go b/x/registry/types/message_register_top_level_domain.go index 095a07a9..855c066b 100644 --- a/x/registry/types/message_register_top_level_domain.go +++ b/x/registry/types/message_register_top_level_domain.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -41,7 +42,7 @@ func (msg *MsgRegisterTopLevelDomain) GetSignBytes() []byte { func (msg *MsgRegisterTopLevelDomain) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/registry/types/message_register_top_level_domain_test.go b/x/registry/types/message_register_top_level_domain_test.go index 19614f68..934f7884 100644 --- a/x/registry/types/message_register_top_level_domain_test.go +++ b/x/registry/types/message_register_top_level_domain_test.go @@ -17,16 +17,16 @@ func TestMsgRegisterTopLevelDomain_ValidateBasic(t *testing.T) { { name: "invalid address", msg: MsgRegisterTopLevelDomain{ - Creator: "invalid_address", - Name: "cel", + Creator: "invalid_address", + Name: "cel", RegistrationPeriodInYear: 1, }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgRegisterTopLevelDomain{ - Creator: sample.AccAddress(), - Name: "cel", + Creator: sample.AccAddress(), + Name: "cel", RegistrationPeriodInYear: 1, }, }, diff --git a/x/registry/types/message_update_dns_record.go b/x/registry/types/message_update_dns_record.go index a5a49fd9..1262938a 100644 --- a/x/registry/types/message_update_dns_record.go +++ b/x/registry/types/message_update_dns_record.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -43,7 +44,7 @@ func (msg *MsgUpdateDnsRecord) GetSignBytes() []byte { func (msg *MsgUpdateDnsRecord) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/registry/types/message_update_wallet_record.go b/x/registry/types/message_update_wallet_record.go index 5069193e..24b0cb0e 100644 --- a/x/registry/types/message_update_wallet_record.go +++ b/x/registry/types/message_update_wallet_record.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -43,7 +44,7 @@ func (msg *MsgUpdateWalletRecord) GetSignBytes() []byte { func (msg *MsgUpdateWalletRecord) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/registry/types/subdomain_config.go b/x/registry/types/subdomain_config.go index 58f1d925..f75f783d 100644 --- a/x/registry/types/subdomain_config.go +++ b/x/registry/types/subdomain_config.go @@ -2,9 +2,10 @@ package types import ( "errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" math "math" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) func GetDefaultSubdomainConfig(baseFee int64) SubdomainConfig { @@ -41,7 +42,7 @@ func (config *SubdomainConfig) GetRegistrationFee(name string, registrationPerio if config.SubdomainRegistrationFees.FeeByName[name].IsRegistrable { amount = config.SubdomainRegistrationFees.FeeByName[name].Fee } else { - err = sdkerrors.Wrap(errors.New(name), ErrDomainNotRegistrable.Error()) + err = errorsmod.Wrap(errors.New(name), ErrDomainNotRegistrable.Error()) } } @@ -50,7 +51,7 @@ func (config *SubdomainConfig) GetRegistrationFee(name string, registrationPerio if config.SubdomainRegistrationFees.FeeByLength[uint32(len(name))].IsRegistrable { amount = config.SubdomainRegistrationFees.FeeByLength[uint32(len(name))].Fee } else { - err = sdkerrors.Wrap(errors.New(name), ErrDomainNotRegistrable.Error()) + err = errorsmod.Wrap(errors.New(name), ErrDomainNotRegistrable.Error()) } } diff --git a/x/registry/types/valdiate_second_level_domain.go b/x/registry/types/valdiate_second_level_domain.go index 9a7da75b..e90ebc5c 100644 --- a/x/registry/types/valdiate_second_level_domain.go +++ b/x/registry/types/valdiate_second_level_domain.go @@ -5,7 +5,7 @@ import ( fmt "fmt" "regexp" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) const ( @@ -14,7 +14,7 @@ const ( func (secondLevelDomain SecondLevelDomain) IsRecordEditable(sender string) (isEditable bool, err error) { if secondLevelDomain.AccessControl[sender] == DomainRole_NO_ROLE { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", sender)), ErrDomainNotEditable.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s", sender)), ErrDomainNotEditable.Error()) } isEditable = secondLevelDomain.AccessControl[sender] == DomainRole_EDITOR || secondLevelDomain.AccessControl[sender] == DomainRole_OWNER return isEditable, err @@ -23,7 +23,7 @@ func (secondLevelDomain SecondLevelDomain) IsRecordEditable(sender string) (isEd func (secondLevelDomain SecondLevelDomain) ValidateName() (err error) { regex := regexp.MustCompile(fmt.Sprintf(`(^[%s]+$)`, NamePattern)) if !regex.MatchString(secondLevelDomain.Name) { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", secondLevelDomain.Name)), ErrInvalidDomainName.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s", secondLevelDomain.Name)), ErrInvalidDomainName.Error()) } return err } @@ -31,7 +31,7 @@ func (secondLevelDomain SecondLevelDomain) ValidateName() (err error) { func (secondLevelDomain SecondLevelDomain) ValidateParent() (err error) { regex := regexp.MustCompile(fmt.Sprintf(`(^[%s]+[%[1]s\.]*[%[1]s]$)|^$`, NamePattern)) if !regex.MatchString(secondLevelDomain.Parent) { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", secondLevelDomain.Parent)), ErrInvalidDomainParent.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s", secondLevelDomain.Parent)), ErrInvalidDomainParent.Error()) } return err } @@ -51,7 +51,7 @@ func (secondLevelDomain SecondLevelDomain) Validate() (err error) { func ValidateWalletRecordType(walletRecordType string) (err error) { _, isFound := NetworkName_value[walletRecordType] if !isFound { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", walletRecordType)), ErrInvalidWalletRecordType.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s", walletRecordType)), ErrInvalidWalletRecordType.Error()) } return err } @@ -63,7 +63,7 @@ func ValidateDnsRecordValue(dnsRecordFormat string, address string) (err error) } regex := regexp.MustCompile(dnsRecordRegex) if !regex.MatchString(address) { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s %s", dnsRecordFormat, address)), ErrInvalidDnsRecordValue.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s %s", dnsRecordFormat, address)), ErrInvalidDnsRecordValue.Error()) } return err } @@ -71,7 +71,7 @@ func ValidateDnsRecordValue(dnsRecordFormat string, address string) (err error) func ValidateDnsRecordType(dnsRecordType string) (err error) { _, isFound := DnsRecordType_value[dnsRecordType] if !isFound { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", dnsRecordType)), ErrInvalidDnsRecordType.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s", dnsRecordType)), ErrInvalidDnsRecordType.Error()) } return err } diff --git a/x/registry/types/valdiate_top_level_domain.go b/x/registry/types/valdiate_top_level_domain.go index 28380ff6..f9c984ff 100644 --- a/x/registry/types/valdiate_top_level_domain.go +++ b/x/registry/types/valdiate_top_level_domain.go @@ -5,7 +5,7 @@ import ( fmt "fmt" "regexp" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) const ( @@ -15,7 +15,7 @@ const ( func (topLevelDomain TopLevelDomain) ValidateName() (err error) { regex := regexp.MustCompile(fmt.Sprintf(`(^[%s]+$)`, TLDNamePattern)) if !regex.MatchString(topLevelDomain.Name) { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", topLevelDomain.Name)), ErrInvalidDomainName.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s", topLevelDomain.Name)), ErrInvalidDomainName.Error()) } return err } diff --git a/x/registry/types/wallet_record.go b/x/registry/types/wallet_record.go index d1fff8cd..87468dc0 100644 --- a/x/registry/types/wallet_record.go +++ b/x/registry/types/wallet_record.go @@ -5,9 +5,9 @@ import ( fmt "fmt" "regexp" + errorsmod "cosmossdk.io/errors" "filippo.io/edwards25519" "github.com/btcsuite/btcutil/base58" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func WalletRecordFormats() map[string]string { @@ -67,7 +67,7 @@ func ValidateEd25519PublicKey(walletAddressFormat string, address string) (err e decodedBytes := base58.Decode(address) _, err = new(edwards25519.Point).SetBytes(decodedBytes) if err != nil { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s %s", walletAddressFormat, address)), ErrInvalidWalletAddress.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s %s", walletAddressFormat, address)), ErrInvalidWalletAddress.Error()) } return err @@ -81,7 +81,7 @@ func ValidateWalletAddressWithRegex(walletAddressFormat string, address string) regex := regexp.MustCompile(walletAddressRegex) if !regex.MatchString(address) { - err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s %s", walletAddressFormat, address)), ErrInvalidWalletAddress.Error()) + err = errorsmod.Wrapf(errors.New(fmt.Sprintf("%s %s", walletAddressFormat, address)), ErrInvalidWalletAddress.Error()) } return err