finish ongoing auction info q implementation

master
michael 2022-09-17 21:35:46 +00:00
parent 2078809fe7
commit 909bbafc22
5 changed files with 49 additions and 18 deletions

View File

@ -15,7 +15,18 @@ paths:
type: object
properties:
bids:
type: string
type: array
items:
type: object
properties:
owner:
type: string
amount:
type: string
verifiedProviders:
type: array
items:
type: string
default:
description: An unexpected error response.
schema:
@ -252,16 +263,6 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.
Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/colinearcore/colinearcore/auction/{index}':
@ -30967,7 +30968,18 @@ definitions:
type: object
properties:
bids:
type: string
type: array
items:
type: object
properties:
owner:
type: string
amount:
type: string
verifiedProviders:
type: array
items:
type: string
colinear.colinearcore.QueryGetAuctionResponse:
type: object
properties:

1
go.mod
View File

@ -88,7 +88,6 @@ require (
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect

2
go.sum
View File

@ -734,8 +734,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=

View File

@ -4,6 +4,7 @@ import (
"strconv"
"colinear/x/colinearcore/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

View File

@ -2,8 +2,11 @@ package keeper
import (
"context"
"fmt"
"colinear/x/colinearcore/memdb"
"colinear/x/colinearcore/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@ -16,8 +19,26 @@ func (k Keeper) AuctionInfo(goCtx context.Context, req *types.QueryAuctionInfoRe
ctx := sdk.UnwrapSDKContext(goCtx)
// TODO: Process the query
_ = ctx
if exp, err := k.AuctionIsExpired(ctx, req.AuctionId); err != nil {
return nil, fmt.Errorf("unable to check auction expiry status: %s", err)
} else {
if exp {
return nil, fmt.Errorf("auction %s is finalized", req.AuctionId)
}
}
return &types.QueryAuctionInfoResponse{}, nil
bids, err := memdb.AuctionDB.GetBids(req.AuctionId)
if err != nil {
return nil, fmt.Errorf("unable to get bids for auction %s: %s", req.AuctionId, err)
}
vProviders, err := memdb.AuctionDB.GetVerifiedProviders(req.AuctionId)
if err != nil {
return nil, fmt.Errorf("unable to get verified providers for auction %s: %s", req.AuctionId, err)
}
return &types.QueryAuctionInfoResponse{
Bids: bids,
VerifiedProviders: vProviders,
}, nil
}