mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-27 15:53:41 +00:00
added global errormsg module
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
1ef5b9265d
commit
4dcf32a86b
@ -2,4 +2,5 @@ package errormsg
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
ErrorInvalidCreator = "invalid creator address (%s)"
|
ErrorInvalidCreator = "invalid creator address (%s)"
|
||||||
|
InvalidRequest = "invalid request"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -51,10 +51,13 @@ type PopSelectionE2ETestSuite struct {
|
|||||||
distributionOffset int64
|
distributionOffset int64
|
||||||
claimDenom string
|
claimDenom string
|
||||||
feeDenom string
|
feeDenom string
|
||||||
|
errormsg string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPopSelectionE2ETestSuite(cfg network.Config) *PopSelectionE2ETestSuite {
|
func NewPopSelectionE2ETestSuite(cfg network.Config) *PopSelectionE2ETestSuite {
|
||||||
return &PopSelectionE2ETestSuite{cfg: cfg}
|
testsuite := &PopSelectionE2ETestSuite{cfg: cfg}
|
||||||
|
testsuite.errormsg = "--%s=%s"
|
||||||
|
return testsuite
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
||||||
@ -183,7 +186,7 @@ func (s *PopSelectionE2ETestSuite) VerifyTokens(token string) {
|
|||||||
val := s.network.Validators[0]
|
val := s.network.Validators[0]
|
||||||
// check balance for crddl
|
// check balance for crddl
|
||||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetCmdQueryTotalSupply(), []string{
|
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetCmdQueryTotalSupply(), []string{
|
||||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, token),
|
fmt.Sprintf(s.errormsg, bank.FlagDenom, token),
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
assert.Contains(s.T(), out.String(), token)
|
assert.Contains(s.T(), out.String(), token)
|
||||||
@ -191,7 +194,7 @@ func (s *PopSelectionE2ETestSuite) VerifyTokens(token string) {
|
|||||||
|
|
||||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||||
machines[0].address,
|
machines[0].address,
|
||||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, token),
|
fmt.Sprintf(s.errormsg, bank.FlagDenom, token),
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
assert.Contains(s.T(), out.String(), token)
|
assert.Contains(s.T(), out.String(), token)
|
||||||
@ -199,7 +202,7 @@ func (s *PopSelectionE2ETestSuite) VerifyTokens(token string) {
|
|||||||
|
|
||||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||||
machines[1].address,
|
machines[1].address,
|
||||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, token),
|
fmt.Sprintf(s.errormsg, bank.FlagDenom, token),
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
assert.Contains(s.T(), out.String(), token)
|
assert.Contains(s.T(), out.String(), token)
|
||||||
@ -267,7 +270,7 @@ func (s *PopSelectionE2ETestSuite) TestTokenRedeemClaim() {
|
|||||||
// Claim burned on CreateRedeemClaim
|
// Claim burned on CreateRedeemClaim
|
||||||
balanceOut, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
balanceOut, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||||
addr.String(),
|
addr.String(),
|
||||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, s.claimDenom),
|
fmt.Sprintf(s.errormsg, bank.FlagDenom, s.claimDenom),
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
assert.Equal(s.T(), "amount: \"5993140682\"\ndenom: crddl\n", balanceOut.String()) // 3 * 1997716894 - 10000 = 5993140682
|
assert.Equal(s.T(), "amount: \"5993140682\"\ndenom: crddl\n", balanceOut.String()) // 3 * 1997716894 - 10000 = 5993140682
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import (
|
|||||||
"gotest.tools/assert"
|
"gotest.tools/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var rddlTokenAmount string = "998.85844748"
|
||||||
|
|
||||||
func Test2FloatConvertion(t *testing.T) {
|
func Test2FloatConvertion(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
var expectedValue uint64 = 99885844748
|
var expectedValue uint64 = 99885844748
|
||||||
@ -23,7 +25,7 @@ func Test2UintConvertion(t *testing.T) {
|
|||||||
func TestStringToFloat(t *testing.T) {
|
func TestStringToFloat(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
expectedValue := 998.85844748
|
expectedValue := 998.85844748
|
||||||
value, err := RDDLTokenStringToFloat("998.85844748")
|
value, err := RDDLTokenStringToFloat(rddlTokenAmount)
|
||||||
assert.Equal(t, expectedValue, value)
|
assert.Equal(t, expectedValue, value)
|
||||||
assert.Equal(t, nil, err)
|
assert.Equal(t, nil, err)
|
||||||
}
|
}
|
||||||
@ -31,7 +33,7 @@ func TestStringToFloat(t *testing.T) {
|
|||||||
func TestStringToUint(t *testing.T) {
|
func TestStringToUint(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
var expectedValue uint64 = 99885844748
|
var expectedValue uint64 = 99885844748
|
||||||
value, err := RDDLTokenStringToUint("998.85844748")
|
value, err := RDDLTokenStringToUint(rddlTokenAmount)
|
||||||
assert.Equal(t, expectedValue, value)
|
assert.Equal(t, expectedValue, value)
|
||||||
assert.Equal(t, nil, err)
|
assert.Equal(t, nil, err)
|
||||||
}
|
}
|
||||||
@ -40,7 +42,7 @@ func TestAddPrecisionLongerThan8(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
var input uint64 = 99885844748
|
var input uint64 = 99885844748
|
||||||
expectedValue := "998.85844748"
|
expectedValue := rddlTokenAmount
|
||||||
rddlTokenString := UintValueToRDDLTokenString(input)
|
rddlTokenString := UintValueToRDDLTokenString(input)
|
||||||
assert.Equal(t, expectedValue, rddlTokenString)
|
assert.Equal(t, expectedValue, rddlTokenString)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/asset/types"
|
"github.com/planetmint/planetmint-go/x/asset/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetCIDsByAddress(goCtx context.Context, req *types.QueryGetCIDsByAddressRequest) (*types.QueryGetCIDsByAddressResponse, error) {
|
func (k Keeper) GetCIDsByAddress(goCtx context.Context, req *types.QueryGetCIDsByAddressRequest) (*types.QueryGetCIDsByAddressResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/asset/types"
|
"github.com/planetmint/planetmint-go/x/asset/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetNotarizedAsset(goCtx context.Context, req *types.QueryGetNotarizedAssetRequest) (*types.QueryGetNotarizedAssetResponse, error) {
|
func (k Keeper) GetNotarizedAsset(goCtx context.Context, req *types.QueryGetNotarizedAssetRequest) (*types.QueryGetNotarizedAssetResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/asset/types"
|
"github.com/planetmint/planetmint-go/x/asset/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
|
|||||||
@ -69,4 +69,5 @@ func isDistributionHeight(ctx sdk.Context, k keeper.Keeper, height int64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func EndBlocker(_ sdk.Context, _ abci.RequestEndBlock, _ keeper.Keeper) {
|
func EndBlocker(_ sdk.Context, _ abci.RequestEndBlock, _ keeper.Keeper) {
|
||||||
|
// EndBlocker is currently not implemented and used by planetmint
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/query"
|
"github.com/cosmos/cosmos-sdk/types/query"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -13,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) Challenges(goCtx context.Context, req *types.QueryChallengesRequest) (*types.QueryChallengesResponse, error) {
|
func (k Keeper) Challenges(goCtx context.Context, req *types.QueryChallengesRequest) (*types.QueryChallengesResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetChallenge(goCtx context.Context, req *types.QueryGetChallengeRequest) (*types.QueryGetChallengeResponse, error) {
|
func (k Keeper) GetChallenge(goCtx context.Context, req *types.QueryGetChallengeRequest) (*types.QueryGetChallengeResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetDistribution(goCtx context.Context, req *types.QueryGetDistributionRequest) (*types.QueryGetDistributionResponse, error) {
|
func (k Keeper) GetDistribution(goCtx context.Context, req *types.QueryGetDistributionRequest) (*types.QueryGetDistributionResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetMintRequestsByHash(goCtx context.Context, req *types.QueryGetMintRequestsByHashRequest) (*types.QueryGetMintRequestsByHashResponse, error) {
|
func (k Keeper) GetMintRequestsByHash(goCtx context.Context, req *types.QueryGetMintRequestsByHashRequest) (*types.QueryGetMintRequestsByHashResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetReissuance(goCtx context.Context, req *types.QueryGetReissuanceRequest) (*types.QueryGetReissuanceResponse, error) {
|
func (k Keeper) GetReissuance(goCtx context.Context, req *types.QueryGetReissuanceRequest) (*types.QueryGetReissuanceResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) MintRequestsByAddress(goCtx context.Context, req *types.QueryMintRequestsByAddressRequest) (*types.QueryMintRequestsByAddressResponse, error) {
|
func (k Keeper) MintRequestsByAddress(goCtx context.Context, req *types.QueryMintRequestsByAddressRequest) (*types.QueryMintRequestsByAddressResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/query"
|
"github.com/cosmos/cosmos-sdk/types/query"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -13,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) RedeemClaimAll(goCtx context.Context, req *types.QueryAllRedeemClaimRequest) (*types.QueryAllRedeemClaimResponse, error) {
|
func (k Keeper) RedeemClaimAll(goCtx context.Context, req *types.QueryAllRedeemClaimRequest) (*types.QueryAllRedeemClaimResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
var redeemClaims []types.RedeemClaim
|
var redeemClaims []types.RedeemClaim
|
||||||
@ -42,7 +43,7 @@ func (k Keeper) RedeemClaimAll(goCtx context.Context, req *types.QueryAllRedeemC
|
|||||||
|
|
||||||
func (k Keeper) RedeemClaim(goCtx context.Context, req *types.QueryGetRedeemClaimRequest) (*types.QueryGetRedeemClaimResponse, error) {
|
func (k Keeper) RedeemClaim(goCtx context.Context, req *types.QueryGetRedeemClaimRequest) (*types.QueryGetRedeemClaimResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ func (k Keeper) RedeemClaim(goCtx context.Context, req *types.QueryGetRedeemClai
|
|||||||
|
|
||||||
func (k Keeper) RedeemClaimByLiquidTxHash(goCtx context.Context, req *types.QueryRedeemClaimByLiquidTxHashRequest) (*types.QueryRedeemClaimByLiquidTxHashResponse, error) {
|
func (k Keeper) RedeemClaimByLiquidTxHash(goCtx context.Context, req *types.QueryRedeemClaimByLiquidTxHashRequest) (*types.QueryRedeemClaimByLiquidTxHashResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import (
|
|||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
||||||
"github.com/planetmint/planetmint-go/testutil/nullify"
|
"github.com/planetmint/planetmint-go/testutil/nullify"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
@ -54,7 +55,7 @@ func TestRedeemClaimQuerySingle(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "InvalidRequest",
|
desc: "InvalidRequest",
|
||||||
err: status.Error(codes.InvalidArgument, "invalid request"),
|
err: status.Error(codes.InvalidArgument, errormsg.InvalidRequest),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
@ -125,6 +126,6 @@ func TestRedeemClaimQueryPaginated(t *testing.T) {
|
|||||||
})
|
})
|
||||||
t.Run("InvalidRequest", func(t *testing.T) {
|
t.Run("InvalidRequest", func(t *testing.T) {
|
||||||
_, err := keeper.RedeemClaimAll(wctx, nil)
|
_, err := keeper.RedeemClaimAll(wctx, nil)
|
||||||
require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request"))
|
require.ErrorIs(t, err, status.Error(codes.InvalidArgument, errormsg.InvalidRequest))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/query"
|
"github.com/cosmos/cosmos-sdk/types/query"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -13,7 +14,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) Reissuances(goCtx context.Context, req *types.QueryReissuancesRequest) (*types.QueryReissuancesResponse, error) {
|
func (k Keeper) Reissuances(goCtx context.Context, req *types.QueryReissuancesRequest) (*types.QueryReissuancesResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -72,7 +72,9 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RegisterStoreDecoder registers a decoder.
|
// RegisterStoreDecoder registers a decoder.
|
||||||
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {}
|
func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {
|
||||||
|
// Implement if needed
|
||||||
|
}
|
||||||
|
|
||||||
// ProposalContents doesn't return any content functions for governance proposals.
|
// ProposalContents doesn't return any content functions for governance proposals.
|
||||||
func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg {
|
func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetLiquidAssetsByMachineid(goCtx context.Context, req *types.QueryGetLiquidAssetsByMachineidRequest) (*types.QueryGetLiquidAssetsByMachineidResponse, error) {
|
func (k Keeper) GetLiquidAssetsByMachineid(goCtx context.Context, req *types.QueryGetLiquidAssetsByMachineidRequest) (*types.QueryGetLiquidAssetsByMachineidResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package keeper
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
@ -12,7 +13,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetMachineByAddress(goCtx context.Context, req *types.QueryGetMachineByAddressRequest) (*types.QueryGetMachineByAddressResponse, error) {
|
func (k Keeper) GetMachineByAddress(goCtx context.Context, req *types.QueryGetMachineByAddressRequest) (*types.QueryGetMachineByAddressResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package keeper
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
@ -12,7 +13,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetMachineByPublicKey(goCtx context.Context, req *types.QueryGetMachineByPublicKeyRequest) (*types.QueryGetMachineByPublicKeyResponse, error) {
|
func (k Keeper) GetMachineByPublicKey(goCtx context.Context, req *types.QueryGetMachineByPublicKeyRequest) (*types.QueryGetMachineByPublicKeyResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package keeper
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
@ -12,7 +13,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) GetTrustAnchorStatus(goCtx context.Context, req *types.QueryGetTrustAnchorStatusRequest) (*types.QueryGetTrustAnchorStatusResponse, error) {
|
func (k Keeper) GetTrustAnchorStatus(goCtx context.Context, req *types.QueryGetTrustAnchorStatusRequest) (*types.QueryGetTrustAnchorStatusResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/planetmint/planetmint-go/errormsg"
|
||||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
@ -11,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
return nil, status.Error(codes.InvalidArgument, errormsg.InvalidRequest)
|
||||||
}
|
}
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user