diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 51619e8..b1c5590 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -20122,6 +20122,219 @@ paths: format: int64 tags: - Query + /cosmos-test/cosmostest/auction: + get: + summary: Queries a list of Auction items. + operationId: CosmostestCosmostestAuctionAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + auction: + type: array + items: + type: object + properties: + index: + type: string + name: + type: string + description: + type: string + bids: + type: string + highestBid: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + 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 + '/cosmos-test/cosmostest/auction/{index}': + get: + summary: Queries a Auction by index. + operationId: CosmostestCosmostestAuction + responses: + '200': + description: A successful response. + schema: + type: object + properties: + auction: + type: object + properties: + index: + type: string + name: + type: string + description: + type: string + bids: + type: string + highestBid: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: index + in: path + required: true + type: string + tags: + - Query + /cosmos-test/cosmostest/next_auction: + get: + summary: Queries a NextAuction by index. + operationId: CosmostestCosmostestNextAuction + responses: + '200': + description: A successful response. + schema: + type: object + properties: + NextAuction: + type: object + properties: + auctionId: + type: string + format: uint64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query /cosmos-test/cosmostest/params: get: summary: Parameters queries the parameters of the module. @@ -47178,9 +47391,96 @@ definitions: description: >- MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. + cosmostest.cosmostest.Auction: + type: object + properties: + index: + type: string + name: + type: string + description: + type: string + bids: + type: string + highestBid: + type: string + cosmostest.cosmostest.NextAuction: + type: object + properties: + auctionId: + type: string + format: uint64 cosmostest.cosmostest.Params: type: object description: Params defines the parameters for the module. + cosmostest.cosmostest.QueryAllAuctionResponse: + type: object + properties: + auction: + type: array + items: + type: object + properties: + index: + type: string + name: + type: string + description: + type: string + bids: + type: string + highestBid: + type: string + pagination: + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + cosmostest.cosmostest.QueryGetAuctionResponse: + type: object + properties: + auction: + type: object + properties: + index: + type: string + name: + type: string + description: + type: string + bids: + type: string + highestBid: + type: string + cosmostest.cosmostest.QueryGetNextAuctionResponse: + type: object + properties: + NextAuction: + type: object + properties: + auctionId: + type: string + format: uint64 cosmostest.cosmostest.QueryParamsResponse: type: object properties: diff --git a/proto/cosmostest/auction.proto b/proto/cosmostest/auction.proto new file mode 100644 index 0000000..f7feaf9 --- /dev/null +++ b/proto/cosmostest/auction.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package cosmostest.cosmostest; + +option go_package = "cosmos-test/x/cosmostest/types"; + +message Auction { + string index = 1; + string name = 2; + string description = 3; + string bids = 4; + string highestBid = 5; + +} + diff --git a/proto/cosmostest/genesis.proto b/proto/cosmostest/genesis.proto index 9786fd8..3675e5b 100644 --- a/proto/cosmostest/genesis.proto +++ b/proto/cosmostest/genesis.proto @@ -3,6 +3,8 @@ package cosmostest.cosmostest; import "gogoproto/gogo.proto"; import "cosmostest/params.proto"; +import "cosmostest/next_auction.proto"; +import "cosmostest/auction.proto"; // this line is used by starport scaffolding # genesis/proto/import option go_package = "cosmos-test/x/cosmostest/types"; @@ -10,5 +12,7 @@ option go_package = "cosmos-test/x/cosmostest/types"; // GenesisState defines the cosmostest module's genesis state. message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; + NextAuction nextAuction = 2; + repeated Auction auctionList = 3 [(gogoproto.nullable) = false]; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/cosmostest/next_auction.proto b/proto/cosmostest/next_auction.proto new file mode 100644 index 0000000..ce25167 --- /dev/null +++ b/proto/cosmostest/next_auction.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package cosmostest.cosmostest; + +option go_package = "cosmos-test/x/cosmostest/types"; + +message NextAuction { + uint64 auctionId = 1; + +} diff --git a/proto/cosmostest/query.proto b/proto/cosmostest/query.proto index 2b3360d..9231298 100644 --- a/proto/cosmostest/query.proto +++ b/proto/cosmostest/query.proto @@ -5,6 +5,8 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmostest/params.proto"; +import "cosmostest/next_auction.proto"; +import "cosmostest/auction.proto"; // this line is used by starport scaffolding # 1 option go_package = "cosmos-test/x/cosmostest/types"; @@ -15,7 +17,21 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/cosmos-test/cosmostest/params"; } - // this line is used by starport scaffolding # 2 + // Queries a NextAuction by index. + rpc NextAuction(QueryGetNextAuctionRequest) returns (QueryGetNextAuctionResponse) { + option (google.api.http).get = "/cosmos-test/cosmostest/next_auction"; + } +// Queries a Auction by index. + rpc Auction(QueryGetAuctionRequest) returns (QueryGetAuctionResponse) { + option (google.api.http).get = "/cosmos-test/cosmostest/auction/{index}"; + } + + // Queries a list of Auction items. + rpc AuctionAll(QueryAllAuctionRequest) returns (QueryAllAuctionResponse) { + option (google.api.http).get = "/cosmos-test/cosmostest/auction"; + } + +// this line is used by starport scaffolding # 2 } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -27,4 +43,27 @@ message QueryParamsResponse { Params params = 1 [(gogoproto.nullable) = false]; } +message QueryGetNextAuctionRequest {} + +message QueryGetNextAuctionResponse { + NextAuction NextAuction = 1 [(gogoproto.nullable) = false]; +} +message QueryGetAuctionRequest { + string index = 1; + +} + +message QueryGetAuctionResponse { + Auction auction = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllAuctionRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllAuctionResponse { + repeated Auction auction = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + // this line is used by starport scaffolding # 3 diff --git a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/index.ts b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/index.ts index 8e73634..34392e7 100755 --- a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/index.ts +++ b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/index.ts @@ -1,9 +1,11 @@ import { txClient, queryClient, MissingWalletError , registry} from './module' +import { Auction } from "./module/types/cosmostest/auction" +import { NextAuction } from "./module/types/cosmostest/next_auction" import { Params } from "./module/types/cosmostest/params" -export { Params }; +export { Auction, NextAuction, Params }; async function initTxClient(vuexGetters) { return await txClient(vuexGetters['common/wallet/signer'], { @@ -42,8 +44,13 @@ function getStructure(template) { const getDefaultState = () => { return { Params: {}, + NextAuction: {}, + Auction: {}, + AuctionAll: {}, _Structure: { + Auction: getStructure(Auction.fromPartial({})), + NextAuction: getStructure(NextAuction.fromPartial({})), Params: getStructure(Params.fromPartial({})), }, @@ -79,6 +86,24 @@ export default { } return state.Params[JSON.stringify(params)] ?? {} }, + getNextAuction: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.NextAuction[JSON.stringify(params)] ?? {} + }, + getAuction: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Auction[JSON.stringify(params)] ?? {} + }, + getAuctionAll: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.AuctionAll[JSON.stringify(params)] ?? {} + }, getTypeStructure: (state) => (type) => { return state._Structure[type].fields @@ -137,5 +162,75 @@ export default { + + + + async QueryNextAuction({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const queryClient=await initQueryClient(rootGetters) + let value= (await queryClient.queryNextAuction()).data + + + commit('QUERY', { query: 'NextAuction', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryNextAuction', payload: { options: { all }, params: {...key},query }}) + return getters['getNextAuction']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryNextAuction API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAuction({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const queryClient=await initQueryClient(rootGetters) + let value= (await queryClient.queryAuction( key.index)).data + + + commit('QUERY', { query: 'Auction', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAuction', payload: { options: { all }, params: {...key},query }}) + return getters['getAuction']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAuction API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + + + + async QueryAuctionAll({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const queryClient=await initQueryClient(rootGetters) + let value= (await queryClient.queryAuctionAll(query)).data + + + while (all && ( value).pagination && ( value).pagination.next_key!=null) { + let next_values=(await queryClient.queryAuctionAll({...query, 'pagination.key':( value).pagination.next_key})).data + value = mergeResults(value, next_values); + } + commit('QUERY', { query: 'AuctionAll', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryAuctionAll', payload: { options: { all }, params: {...key},query }}) + return getters['getAuctionAll']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryAuctionAll API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + } } diff --git a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/rest.ts b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/rest.ts index 778690a..7e17000 100644 --- a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/rest.ts +++ b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/rest.ts @@ -9,11 +9,47 @@ * --------------------------------------------------------------- */ +export interface CosmostestAuction { + index?: string; + name?: string; + description?: string; + bids?: string; + highestBid?: string; +} + +export interface CosmostestNextAuction { + /** @format uint64 */ + auctionId?: string; +} + /** * Params defines the parameters for the module. */ export type CosmostestParams = object; +export interface CosmostestQueryAllAuctionResponse { + auction?: CosmostestAuction[]; + + /** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ + pagination?: V1Beta1PageResponse; +} + +export interface CosmostestQueryGetAuctionResponse { + auction?: CosmostestAuction; +} + +export interface CosmostestQueryGetNextAuctionResponse { + NextAuction?: CosmostestNextAuction; +} + /** * QueryParamsResponse is response type for the Query/Params RPC method. */ @@ -33,6 +69,69 @@ export interface RpcStatus { details?: ProtobufAny[]; } +/** +* message SomeRequest { + Foo some_parameter = 1; + PageRequest pagination = 2; + } +*/ +export interface V1Beta1PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + * @format byte + */ + key?: string; + + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + * @format uint64 + */ + offset?: string; + + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + * @format uint64 + */ + limit?: string; + + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + count_total?: boolean; + + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse?: boolean; +} + +/** +* PageResponse is to be embedded in gRPC response messages where the +corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } +*/ +export interface V1Beta1PageResponse { + /** @format byte */ + next_key?: string; + + /** @format uint64 */ + total?: string; +} + export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; @@ -225,10 +324,68 @@ export class HttpClient { } /** - * @title cosmostest/genesis.proto + * @title cosmostest/auction.proto * @version version not set */ export class Api extends HttpClient { + /** + * No description + * + * @tags Query + * @name QueryAuctionAll + * @summary Queries a list of Auction items. + * @request GET:/cosmos-test/cosmostest/auction + */ + queryAuctionAll = ( + query?: { + "pagination.key"?: string; + "pagination.offset"?: string; + "pagination.limit"?: string; + "pagination.count_total"?: boolean; + "pagination.reverse"?: boolean; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/cosmos-test/cosmostest/auction`, + method: "GET", + query: query, + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryAuction + * @summary Queries a Auction by index. + * @request GET:/cosmos-test/cosmostest/auction/{index} + */ + queryAuction = (index: string, params: RequestParams = {}) => + this.request({ + path: `/cosmos-test/cosmostest/auction/${index}`, + method: "GET", + format: "json", + ...params, + }); + + /** + * No description + * + * @tags Query + * @name QueryNextAuction + * @summary Queries a NextAuction by index. + * @request GET:/cosmos-test/cosmostest/next_auction + */ + queryNextAuction = (params: RequestParams = {}) => + this.request({ + path: `/cosmos-test/cosmostest/next_auction`, + method: "GET", + format: "json", + ...params, + }); + /** * No description * diff --git a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmos/base/query/v1beta1/pagination.ts b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmos/base/query/v1beta1/pagination.ts index 0bc568f..9c87ac0 100644 --- a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmos/base/query/v1beta1/pagination.ts +++ b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmos/base/query/v1beta1/pagination.ts @@ -38,6 +38,12 @@ export interface PageRequest { * is set. */ count_total: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; } /** @@ -62,7 +68,12 @@ export interface PageResponse { total: number; } -const basePageRequest: object = { offset: 0, limit: 0, count_total: false }; +const basePageRequest: object = { + offset: 0, + limit: 0, + count_total: false, + reverse: false, +}; export const PageRequest = { encode(message: PageRequest, writer: Writer = Writer.create()): Writer { @@ -78,6 +89,9 @@ export const PageRequest = { if (message.count_total === true) { writer.uint32(32).bool(message.count_total); } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } return writer; }, @@ -100,6 +114,9 @@ export const PageRequest = { case 4: message.count_total = reader.bool(); break; + case 5: + message.reverse = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -128,6 +145,11 @@ export const PageRequest = { } else { message.count_total = false; } + if (object.reverse !== undefined && object.reverse !== null) { + message.reverse = Boolean(object.reverse); + } else { + message.reverse = false; + } return message; }, @@ -141,6 +163,7 @@ export const PageRequest = { message.limit !== undefined && (obj.limit = message.limit); message.count_total !== undefined && (obj.count_total = message.count_total); + message.reverse !== undefined && (obj.reverse = message.reverse); return obj; }, @@ -166,6 +189,11 @@ export const PageRequest = { } else { message.count_total = false; } + if (object.reverse !== undefined && object.reverse !== null) { + message.reverse = object.reverse; + } else { + message.reverse = false; + } return message; }, }; diff --git a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/auction.ts b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/auction.ts new file mode 100644 index 0000000..b014a1c --- /dev/null +++ b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/auction.ts @@ -0,0 +1,153 @@ +/* eslint-disable */ +import { Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "cosmostest.cosmostest"; + +export interface Auction { + index: string; + name: string; + description: string; + bids: string; + highestBid: string; +} + +const baseAuction: object = { + index: "", + name: "", + description: "", + bids: "", + highestBid: "", +}; + +export const Auction = { + encode(message: Auction, writer: Writer = Writer.create()): Writer { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.description !== "") { + writer.uint32(26).string(message.description); + } + if (message.bids !== "") { + writer.uint32(34).string(message.bids); + } + if (message.highestBid !== "") { + writer.uint32(42).string(message.highestBid); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): Auction { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseAuction } as Auction; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.string(); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.bids = reader.string(); + break; + case 5: + message.highestBid = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Auction { + const message = { ...baseAuction } as Auction; + if (object.index !== undefined && object.index !== null) { + message.index = String(object.index); + } else { + message.index = ""; + } + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.description !== undefined && object.description !== null) { + message.description = String(object.description); + } else { + message.description = ""; + } + if (object.bids !== undefined && object.bids !== null) { + message.bids = String(object.bids); + } else { + message.bids = ""; + } + if (object.highestBid !== undefined && object.highestBid !== null) { + message.highestBid = String(object.highestBid); + } else { + message.highestBid = ""; + } + return message; + }, + + toJSON(message: Auction): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && + (obj.description = message.description); + message.bids !== undefined && (obj.bids = message.bids); + message.highestBid !== undefined && (obj.highestBid = message.highestBid); + return obj; + }, + + fromPartial(object: DeepPartial): Auction { + const message = { ...baseAuction } as Auction; + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } else { + message.index = ""; + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } else { + message.description = ""; + } + if (object.bids !== undefined && object.bids !== null) { + message.bids = object.bids; + } else { + message.bids = ""; + } + if (object.highestBid !== undefined && object.highestBid !== null) { + message.highestBid = object.highestBid; + } else { + message.highestBid = ""; + } + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/genesis.ts b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/genesis.ts index ecea01d..b3af0e6 100644 --- a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/genesis.ts +++ b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/genesis.ts @@ -1,13 +1,17 @@ /* eslint-disable */ import { Params } from "../cosmostest/params"; +import { NextAuction } from "../cosmostest/next_auction"; +import { Auction } from "../cosmostest/auction"; import { Writer, Reader } from "protobufjs/minimal"; export const protobufPackage = "cosmostest.cosmostest"; /** GenesisState defines the cosmostest module's genesis state. */ export interface GenesisState { - /** this line is used by starport scaffolding # genesis/proto/state */ params: Params | undefined; + nextAuction: NextAuction | undefined; + /** this line is used by starport scaffolding # genesis/proto/state */ + auctionList: Auction[]; } const baseGenesisState: object = {}; @@ -17,6 +21,15 @@ export const GenesisState = { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } + if (message.nextAuction !== undefined) { + NextAuction.encode( + message.nextAuction, + writer.uint32(18).fork() + ).ldelim(); + } + for (const v of message.auctionList) { + Auction.encode(v!, writer.uint32(26).fork()).ldelim(); + } return writer; }, @@ -24,12 +37,19 @@ export const GenesisState = { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseGenesisState } as GenesisState; + message.auctionList = []; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; + case 2: + message.nextAuction = NextAuction.decode(reader, reader.uint32()); + break; + case 3: + message.auctionList.push(Auction.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -40,11 +60,22 @@ export const GenesisState = { fromJSON(object: any): GenesisState { const message = { ...baseGenesisState } as GenesisState; + message.auctionList = []; if (object.params !== undefined && object.params !== null) { message.params = Params.fromJSON(object.params); } else { message.params = undefined; } + if (object.nextAuction !== undefined && object.nextAuction !== null) { + message.nextAuction = NextAuction.fromJSON(object.nextAuction); + } else { + message.nextAuction = undefined; + } + if (object.auctionList !== undefined && object.auctionList !== null) { + for (const e of object.auctionList) { + message.auctionList.push(Auction.fromJSON(e)); + } + } return message; }, @@ -52,16 +83,38 @@ export const GenesisState = { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.nextAuction !== undefined && + (obj.nextAuction = message.nextAuction + ? NextAuction.toJSON(message.nextAuction) + : undefined); + if (message.auctionList) { + obj.auctionList = message.auctionList.map((e) => + e ? Auction.toJSON(e) : undefined + ); + } else { + obj.auctionList = []; + } return obj; }, fromPartial(object: DeepPartial): GenesisState { const message = { ...baseGenesisState } as GenesisState; + message.auctionList = []; if (object.params !== undefined && object.params !== null) { message.params = Params.fromPartial(object.params); } else { message.params = undefined; } + if (object.nextAuction !== undefined && object.nextAuction !== null) { + message.nextAuction = NextAuction.fromPartial(object.nextAuction); + } else { + message.nextAuction = undefined; + } + if (object.auctionList !== undefined && object.auctionList !== null) { + for (const e of object.auctionList) { + message.auctionList.push(Auction.fromPartial(e)); + } + } return message; }, }; diff --git a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/next_auction.ts b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/next_auction.ts new file mode 100644 index 0000000..dbf4ea2 --- /dev/null +++ b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/next_auction.ts @@ -0,0 +1,97 @@ +/* eslint-disable */ +import * as Long from "long"; +import { util, configure, Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "cosmostest.cosmostest"; + +export interface NextAuction { + auctionId: number; +} + +const baseNextAuction: object = { auctionId: 0 }; + +export const NextAuction = { + encode(message: NextAuction, writer: Writer = Writer.create()): Writer { + if (message.auctionId !== 0) { + writer.uint32(8).uint64(message.auctionId); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): NextAuction { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseNextAuction } as NextAuction; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auctionId = longToNumber(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): NextAuction { + const message = { ...baseNextAuction } as NextAuction; + if (object.auctionId !== undefined && object.auctionId !== null) { + message.auctionId = Number(object.auctionId); + } else { + message.auctionId = 0; + } + return message; + }, + + toJSON(message: NextAuction): unknown { + const obj: any = {}; + message.auctionId !== undefined && (obj.auctionId = message.auctionId); + return obj; + }, + + fromPartial(object: DeepPartial): NextAuction { + const message = { ...baseNextAuction } as NextAuction; + if (object.auctionId !== undefined && object.auctionId !== null) { + message.auctionId = object.auctionId; + } else { + message.auctionId = 0; + } + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (util.Long !== Long) { + util.Long = Long as any; + configure(); +} diff --git a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/query.ts b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/query.ts index 293a357..cf6e8d7 100644 --- a/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/query.ts +++ b/vue/src/store/generated/cosmos-test/cosmostest.cosmostest/module/types/cosmostest/query.ts @@ -1,6 +1,12 @@ /* eslint-disable */ import { Reader, Writer } from "protobufjs/minimal"; import { Params } from "../cosmostest/params"; +import { NextAuction } from "../cosmostest/next_auction"; +import { Auction } from "../cosmostest/auction"; +import { + PageRequest, + PageResponse, +} from "../cosmos/base/query/v1beta1/pagination"; export const protobufPackage = "cosmostest.cosmostest"; @@ -13,6 +19,29 @@ export interface QueryParamsResponse { params: Params | undefined; } +export interface QueryGetNextAuctionRequest {} + +export interface QueryGetNextAuctionResponse { + NextAuction: NextAuction | undefined; +} + +export interface QueryGetAuctionRequest { + index: string; +} + +export interface QueryGetAuctionResponse { + auction: Auction | undefined; +} + +export interface QueryAllAuctionRequest { + pagination: PageRequest | undefined; +} + +export interface QueryAllAuctionResponse { + auction: Auction[]; + pagination: PageResponse | undefined; +} + const baseQueryParamsRequest: object = {}; export const QueryParamsRequest = { @@ -110,10 +139,435 @@ export const QueryParamsResponse = { }, }; +const baseQueryGetNextAuctionRequest: object = {}; + +export const QueryGetNextAuctionRequest = { + encode( + _: QueryGetNextAuctionRequest, + writer: Writer = Writer.create() + ): Writer { + return writer; + }, + + decode( + input: Reader | Uint8Array, + length?: number + ): QueryGetNextAuctionRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseQueryGetNextAuctionRequest, + } as QueryGetNextAuctionRequest; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryGetNextAuctionRequest { + const message = { + ...baseQueryGetNextAuctionRequest, + } as QueryGetNextAuctionRequest; + return message; + }, + + toJSON(_: QueryGetNextAuctionRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial( + _: DeepPartial + ): QueryGetNextAuctionRequest { + const message = { + ...baseQueryGetNextAuctionRequest, + } as QueryGetNextAuctionRequest; + return message; + }, +}; + +const baseQueryGetNextAuctionResponse: object = {}; + +export const QueryGetNextAuctionResponse = { + encode( + message: QueryGetNextAuctionResponse, + writer: Writer = Writer.create() + ): Writer { + if (message.NextAuction !== undefined) { + NextAuction.encode( + message.NextAuction, + writer.uint32(10).fork() + ).ldelim(); + } + return writer; + }, + + decode( + input: Reader | Uint8Array, + length?: number + ): QueryGetNextAuctionResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseQueryGetNextAuctionResponse, + } as QueryGetNextAuctionResponse; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.NextAuction = NextAuction.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetNextAuctionResponse { + const message = { + ...baseQueryGetNextAuctionResponse, + } as QueryGetNextAuctionResponse; + if (object.NextAuction !== undefined && object.NextAuction !== null) { + message.NextAuction = NextAuction.fromJSON(object.NextAuction); + } else { + message.NextAuction = undefined; + } + return message; + }, + + toJSON(message: QueryGetNextAuctionResponse): unknown { + const obj: any = {}; + message.NextAuction !== undefined && + (obj.NextAuction = message.NextAuction + ? NextAuction.toJSON(message.NextAuction) + : undefined); + return obj; + }, + + fromPartial( + object: DeepPartial + ): QueryGetNextAuctionResponse { + const message = { + ...baseQueryGetNextAuctionResponse, + } as QueryGetNextAuctionResponse; + if (object.NextAuction !== undefined && object.NextAuction !== null) { + message.NextAuction = NextAuction.fromPartial(object.NextAuction); + } else { + message.NextAuction = undefined; + } + return message; + }, +}; + +const baseQueryGetAuctionRequest: object = { index: "" }; + +export const QueryGetAuctionRequest = { + encode( + message: QueryGetAuctionRequest, + writer: Writer = Writer.create() + ): Writer { + if (message.index !== "") { + writer.uint32(10).string(message.index); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): QueryGetAuctionRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseQueryGetAuctionRequest } as QueryGetAuctionRequest; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetAuctionRequest { + const message = { ...baseQueryGetAuctionRequest } as QueryGetAuctionRequest; + if (object.index !== undefined && object.index !== null) { + message.index = String(object.index); + } else { + message.index = ""; + } + return message; + }, + + toJSON(message: QueryGetAuctionRequest): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + return obj; + }, + + fromPartial( + object: DeepPartial + ): QueryGetAuctionRequest { + const message = { ...baseQueryGetAuctionRequest } as QueryGetAuctionRequest; + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } else { + message.index = ""; + } + return message; + }, +}; + +const baseQueryGetAuctionResponse: object = {}; + +export const QueryGetAuctionResponse = { + encode( + message: QueryGetAuctionResponse, + writer: Writer = Writer.create() + ): Writer { + if (message.auction !== undefined) { + Auction.encode(message.auction, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): QueryGetAuctionResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseQueryGetAuctionResponse, + } as QueryGetAuctionResponse; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auction = Auction.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryGetAuctionResponse { + const message = { + ...baseQueryGetAuctionResponse, + } as QueryGetAuctionResponse; + if (object.auction !== undefined && object.auction !== null) { + message.auction = Auction.fromJSON(object.auction); + } else { + message.auction = undefined; + } + return message; + }, + + toJSON(message: QueryGetAuctionResponse): unknown { + const obj: any = {}; + message.auction !== undefined && + (obj.auction = message.auction + ? Auction.toJSON(message.auction) + : undefined); + return obj; + }, + + fromPartial( + object: DeepPartial + ): QueryGetAuctionResponse { + const message = { + ...baseQueryGetAuctionResponse, + } as QueryGetAuctionResponse; + if (object.auction !== undefined && object.auction !== null) { + message.auction = Auction.fromPartial(object.auction); + } else { + message.auction = undefined; + } + return message; + }, +}; + +const baseQueryAllAuctionRequest: object = {}; + +export const QueryAllAuctionRequest = { + encode( + message: QueryAllAuctionRequest, + writer: Writer = Writer.create() + ): Writer { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): QueryAllAuctionRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseQueryAllAuctionRequest } as QueryAllAuctionRequest; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllAuctionRequest { + const message = { ...baseQueryAllAuctionRequest } as QueryAllAuctionRequest; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromJSON(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, + + toJSON(message: QueryAllAuctionRequest): unknown { + const obj: any = {}; + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial( + object: DeepPartial + ): QueryAllAuctionRequest { + const message = { ...baseQueryAllAuctionRequest } as QueryAllAuctionRequest; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, +}; + +const baseQueryAllAuctionResponse: object = {}; + +export const QueryAllAuctionResponse = { + encode( + message: QueryAllAuctionResponse, + writer: Writer = Writer.create() + ): Writer { + for (const v of message.auction) { + Auction.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): QueryAllAuctionResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseQueryAllAuctionResponse, + } as QueryAllAuctionResponse; + message.auction = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.auction.push(Auction.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryAllAuctionResponse { + const message = { + ...baseQueryAllAuctionResponse, + } as QueryAllAuctionResponse; + message.auction = []; + if (object.auction !== undefined && object.auction !== null) { + for (const e of object.auction) { + message.auction.push(Auction.fromJSON(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromJSON(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, + + toJSON(message: QueryAllAuctionResponse): unknown { + const obj: any = {}; + if (message.auction) { + obj.auction = message.auction.map((e) => + e ? Auction.toJSON(e) : undefined + ); + } else { + obj.auction = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial( + object: DeepPartial + ): QueryAllAuctionResponse { + const message = { + ...baseQueryAllAuctionResponse, + } as QueryAllAuctionResponse; + message.auction = []; + if (object.auction !== undefined && object.auction !== null) { + for (const e of object.auction) { + message.auction.push(Auction.fromPartial(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, +}; + /** Query defines the gRPC querier service. */ export interface Query { /** Parameters queries the parameters of the module. */ Params(request: QueryParamsRequest): Promise; + /** Queries a NextAuction by index. */ + NextAuction( + request: QueryGetNextAuctionRequest + ): Promise; + /** Queries a Auction by index. */ + Auction(request: QueryGetAuctionRequest): Promise; + /** Queries a list of Auction items. */ + AuctionAll(request: QueryAllAuctionRequest): Promise; } export class QueryClientImpl implements Query { @@ -130,6 +584,46 @@ export class QueryClientImpl implements Query { ); return promise.then((data) => QueryParamsResponse.decode(new Reader(data))); } + + NextAuction( + request: QueryGetNextAuctionRequest + ): Promise { + const data = QueryGetNextAuctionRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmostest.cosmostest.Query", + "NextAuction", + data + ); + return promise.then((data) => + QueryGetNextAuctionResponse.decode(new Reader(data)) + ); + } + + Auction(request: QueryGetAuctionRequest): Promise { + const data = QueryGetAuctionRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmostest.cosmostest.Query", + "Auction", + data + ); + return promise.then((data) => + QueryGetAuctionResponse.decode(new Reader(data)) + ); + } + + AuctionAll( + request: QueryAllAuctionRequest + ): Promise { + const data = QueryAllAuctionRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmostest.cosmostest.Query", + "AuctionAll", + data + ); + return promise.then((data) => + QueryAllAuctionResponse.decode(new Reader(data)) + ); + } } interface Rpc { diff --git a/x/cosmostest/client/cli/query.go b/x/cosmostest/client/cli/query.go index fc123c5..4222d68 100644 --- a/x/cosmostest/client/cli/query.go +++ b/x/cosmostest/client/cli/query.go @@ -25,6 +25,9 @@ func GetQueryCmd(queryRoute string) *cobra.Command { } cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdShowNextAuction()) + cmd.AddCommand(CmdListAuction()) + cmd.AddCommand(CmdShowAuction()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/cosmostest/client/cli/query_auction.go b/x/cosmostest/client/cli/query_auction.go new file mode 100644 index 0000000..4cd4481 --- /dev/null +++ b/x/cosmostest/client/cli/query_auction.go @@ -0,0 +1,73 @@ +package cli + +import ( + "context" + + "cosmos-test/x/cosmostest/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdListAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-auction", + Short: "list all auction", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllAuctionRequest{ + Pagination: pageReq, + } + + res, err := queryClient.AuctionAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-auction [index]", + Short: "shows a auction", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argIndex := args[0] + + params := &types.QueryGetAuctionRequest{ + Index: argIndex, + } + + res, err := queryClient.Auction(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/cosmostest/client/cli/query_auction_test.go b/x/cosmostest/client/cli/query_auction_test.go new file mode 100644 index 0000000..3262da1 --- /dev/null +++ b/x/cosmostest/client/cli/query_auction_test.go @@ -0,0 +1,161 @@ +package cli_test + +import ( + "fmt" + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + tmcli "github.com/tendermint/tendermint/libs/cli" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "cosmos-test/testutil/network" + "cosmos-test/testutil/nullify" + "cosmos-test/x/cosmostest/client/cli" + "cosmos-test/x/cosmostest/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func networkWithAuctionObjects(t *testing.T, n int) (*network.Network, []types.Auction) { + t.Helper() + cfg := network.DefaultConfig() + state := types.GenesisState{} + require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) + + for i := 0; i < n; i++ { + auction := types.Auction{ + Index: strconv.Itoa(i), + } + nullify.Fill(&auction) + state.AuctionList = append(state.AuctionList, auction) + } + buf, err := cfg.Codec.MarshalJSON(&state) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), state.AuctionList +} + +func TestShowAuction(t *testing.T) { + net, objs := networkWithAuctionObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + for _, tc := range []struct { + desc string + idIndex string + + args []string + err error + obj types.Auction + }{ + { + desc: "found", + idIndex: objs[0].Index, + + args: common, + obj: objs[0], + }, + { + desc: "not found", + idIndex: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idIndex, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowAuction(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetAuctionResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.Auction) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.Auction), + ) + } + }) + } +} + +func TestListAuction(t *testing.T) { + net, objs := networkWithAuctionObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(objs); i += step { + args := request(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListAuction(), args) + require.NoError(t, err) + var resp types.QueryAllAuctionResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Auction), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Auction), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(objs); i += step { + args := request(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListAuction(), args) + require.NoError(t, err) + var resp types.QueryAllAuctionResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Auction), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Auction), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(objs)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListAuction(), args) + require.NoError(t, err) + var resp types.QueryAllAuctionResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(objs), + nullify.Fill(resp.Auction), + ) + }) +} diff --git a/x/cosmostest/client/cli/query_next_auction.go b/x/cosmostest/client/cli/query_next_auction.go new file mode 100644 index 0000000..dfd489c --- /dev/null +++ b/x/cosmostest/client/cli/query_next_auction.go @@ -0,0 +1,36 @@ +package cli + +import ( + "context" + + "cosmos-test/x/cosmostest/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdShowNextAuction() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-next-auction", + Short: "shows nextAuction", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetNextAuctionRequest{} + + res, err := queryClient.NextAuction(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/cosmostest/client/cli/query_next_auction_test.go b/x/cosmostest/client/cli/query_next_auction_test.go new file mode 100644 index 0000000..3efad36 --- /dev/null +++ b/x/cosmostest/client/cli/query_next_auction_test.go @@ -0,0 +1,72 @@ +package cli_test + +import ( + "fmt" + "testing" + + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + tmcli "github.com/tendermint/tendermint/libs/cli" + "google.golang.org/grpc/status" + + "cosmos-test/testutil/network" + "cosmos-test/testutil/nullify" + "cosmos-test/x/cosmostest/client/cli" + "cosmos-test/x/cosmostest/types" +) + +func networkWithNextAuctionObjects(t *testing.T) (*network.Network, types.NextAuction) { + t.Helper() + cfg := network.DefaultConfig() + state := types.GenesisState{} + require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) + + nextAuction := &types.NextAuction{} + nullify.Fill(&nextAuction) + state.NextAuction = nextAuction + buf, err := cfg.Codec.MarshalJSON(&state) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), *state.NextAuction +} + +func TestShowNextAuction(t *testing.T) { + net, obj := networkWithNextAuctionObjects(t) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + for _, tc := range []struct { + desc string + args []string + err error + obj types.NextAuction + }{ + { + desc: "get", + args: common, + obj: obj, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + var args []string + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowNextAuction(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetNextAuctionResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.NextAuction) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.NextAuction), + ) + } + }) + } +} diff --git a/x/cosmostest/genesis.go b/x/cosmostest/genesis.go index 1c7ed8c..89af165 100644 --- a/x/cosmostest/genesis.go +++ b/x/cosmostest/genesis.go @@ -9,6 +9,14 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // Set if defined + if genState.NextAuction != nil { + k.SetNextAuction(ctx, *genState.NextAuction) + } + // Set all the auction + for _, elem := range genState.AuctionList { + k.SetAuction(ctx, elem) + } // this line is used by starport scaffolding # genesis/module/init k.SetParams(ctx, genState.Params) } @@ -18,6 +26,12 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) + // Get all nextAuction + nextAuction, found := k.GetNextAuction(ctx) + if found { + genesis.NextAuction = &nextAuction + } + genesis.AuctionList = k.GetAllAuction(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/cosmostest/genesis_test.go b/x/cosmostest/genesis_test.go index e5b74d4..16aa285 100644 --- a/x/cosmostest/genesis_test.go +++ b/x/cosmostest/genesis_test.go @@ -15,6 +15,17 @@ func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), + NextAuction: &types.NextAuction{ + AuctionId: 43, + }, + AuctionList: []types.Auction{ + { + Index: "0", + }, + { + Index: "1", + }, + }, // this line is used by starport scaffolding # genesis/test/state } @@ -26,5 +37,7 @@ func TestGenesis(t *testing.T) { nullify.Fill(&genesisState) nullify.Fill(got) + require.Equal(t, genesisState.NextAuction, got.NextAuction) + require.ElementsMatch(t, genesisState.AuctionList, got.AuctionList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/cosmostest/keeper/auction.go b/x/cosmostest/keeper/auction.go new file mode 100644 index 0000000..92c30e3 --- /dev/null +++ b/x/cosmostest/keeper/auction.go @@ -0,0 +1,63 @@ +package keeper + +import ( + "cosmos-test/x/cosmostest/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetAuction set a specific auction in the store from its index +func (k Keeper) SetAuction(ctx sdk.Context, auction types.Auction) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKeyPrefix)) + b := k.cdc.MustMarshal(&auction) + store.Set(types.AuctionKey( + auction.Index, + ), b) +} + +// GetAuction returns a auction from its index +func (k Keeper) GetAuction( + ctx sdk.Context, + index string, + +) (val types.Auction, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKeyPrefix)) + + b := store.Get(types.AuctionKey( + index, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveAuction removes a auction from the store +func (k Keeper) RemoveAuction( + ctx sdk.Context, + index string, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKeyPrefix)) + store.Delete(types.AuctionKey( + index, + )) +} + +// GetAllAuction returns all auction +func (k Keeper) GetAllAuction(ctx sdk.Context) (list []types.Auction) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AuctionKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Auction + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/cosmostest/keeper/auction_test.go b/x/cosmostest/keeper/auction_test.go new file mode 100644 index 0000000..3c53a79 --- /dev/null +++ b/x/cosmostest/keeper/auction_test.go @@ -0,0 +1,63 @@ +package keeper_test + +import ( + "strconv" + "testing" + + keepertest "cosmos-test/testutil/keeper" + "cosmos-test/testutil/nullify" + "cosmos-test/x/cosmostest/keeper" + "cosmos-test/x/cosmostest/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNAuction(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Auction { + items := make([]types.Auction, n) + for i := range items { + items[i].Index = strconv.Itoa(i) + + keeper.SetAuction(ctx, items[i]) + } + return items +} + +func TestAuctionGet(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + items := createNAuction(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetAuction(ctx, + item.Index, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestAuctionRemove(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + items := createNAuction(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveAuction(ctx, + item.Index, + ) + _, found := keeper.GetAuction(ctx, + item.Index, + ) + require.False(t, found) + } +} + +func TestAuctionGetAll(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + items := createNAuction(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllAuction(ctx)), + ) +} diff --git a/x/cosmostest/keeper/grpc_query_auction.go b/x/cosmostest/keeper/grpc_query_auction.go new file mode 100644 index 0000000..60c0c73 --- /dev/null +++ b/x/cosmostest/keeper/grpc_query_auction.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "context" + + "cosmos-test/x/cosmostest/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) AuctionAll(c context.Context, req *types.QueryAllAuctionRequest) (*types.QueryAllAuctionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var auctions []types.Auction + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + auctionStore := prefix.NewStore(store, types.KeyPrefix(types.AuctionKeyPrefix)) + + pageRes, err := query.Paginate(auctionStore, req.Pagination, func(key []byte, value []byte) error { + var auction types.Auction + if err := k.cdc.Unmarshal(value, &auction); err != nil { + return err + } + + auctions = append(auctions, auction) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllAuctionResponse{Auction: auctions, Pagination: pageRes}, nil +} + +func (k Keeper) Auction(c context.Context, req *types.QueryGetAuctionRequest) (*types.QueryGetAuctionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetAuction( + ctx, + req.Index, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetAuctionResponse{Auction: val}, nil +} diff --git a/x/cosmostest/keeper/grpc_query_auction_test.go b/x/cosmostest/keeper/grpc_query_auction_test.go new file mode 100644 index 0000000..4e86ed4 --- /dev/null +++ b/x/cosmostest/keeper/grpc_query_auction_test.go @@ -0,0 +1,126 @@ +package keeper_test + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "cosmos-test/testutil/keeper" + "cosmos-test/testutil/nullify" + "cosmos-test/x/cosmostest/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestAuctionQuerySingle(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNAuction(keeper, ctx, 2) + for _, tc := range []struct { + desc string + request *types.QueryGetAuctionRequest + response *types.QueryGetAuctionResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetAuctionRequest{ + Index: msgs[0].Index, + }, + response: &types.QueryGetAuctionResponse{Auction: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetAuctionRequest{ + Index: msgs[1].Index, + }, + response: &types.QueryGetAuctionResponse{Auction: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetAuctionRequest{ + Index: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Auction(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestAuctionQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + msgs := createNAuction(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllAuctionRequest { + return &types.QueryAllAuctionRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.AuctionAll(wctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Auction), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Auction), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.AuctionAll(wctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Auction), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Auction), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.AuctionAll(wctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Auction), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.AuctionAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/cosmostest/keeper/grpc_query_next_auction.go b/x/cosmostest/keeper/grpc_query_next_auction.go new file mode 100644 index 0000000..ba739a3 --- /dev/null +++ b/x/cosmostest/keeper/grpc_query_next_auction.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + "cosmos-test/x/cosmostest/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) NextAuction(c context.Context, req *types.QueryGetNextAuctionRequest) (*types.QueryGetNextAuctionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetNextAuction(ctx) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetNextAuctionResponse{NextAuction: val}, nil +} diff --git a/x/cosmostest/keeper/grpc_query_next_auction_test.go b/x/cosmostest/keeper/grpc_query_next_auction_test.go new file mode 100644 index 0000000..ee36d30 --- /dev/null +++ b/x/cosmostest/keeper/grpc_query_next_auction_test.go @@ -0,0 +1,49 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "cosmos-test/testutil/keeper" + "cosmos-test/testutil/nullify" + "cosmos-test/x/cosmostest/types" +) + +func TestNextAuctionQuery(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + item := createTestNextAuction(keeper, ctx) + for _, tc := range []struct { + desc string + request *types.QueryGetNextAuctionRequest + response *types.QueryGetNextAuctionResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetNextAuctionRequest{}, + response: &types.QueryGetNextAuctionResponse{NextAuction: item}, + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.NextAuction(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} diff --git a/x/cosmostest/keeper/next_auction.go b/x/cosmostest/keeper/next_auction.go new file mode 100644 index 0000000..c21c153 --- /dev/null +++ b/x/cosmostest/keeper/next_auction.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "cosmos-test/x/cosmostest/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetNextAuction set nextAuction in the store +func (k Keeper) SetNextAuction(ctx sdk.Context, nextAuction types.NextAuction) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionKey)) + b := k.cdc.MustMarshal(&nextAuction) + store.Set([]byte{0}, b) +} + +// GetNextAuction returns nextAuction +func (k Keeper) GetNextAuction(ctx sdk.Context) (val types.NextAuction, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionKey)) + + b := store.Get([]byte{0}) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveNextAuction removes nextAuction from the store +func (k Keeper) RemoveNextAuction(ctx sdk.Context) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NextAuctionKey)) + store.Delete([]byte{0}) +} diff --git a/x/cosmostest/keeper/next_auction_test.go b/x/cosmostest/keeper/next_auction_test.go new file mode 100644 index 0000000..f31ba96 --- /dev/null +++ b/x/cosmostest/keeper/next_auction_test.go @@ -0,0 +1,38 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "cosmos-test/testutil/keeper" + "cosmos-test/testutil/nullify" + "cosmos-test/x/cosmostest/keeper" + "cosmos-test/x/cosmostest/types" +) + +func createTestNextAuction(keeper *keeper.Keeper, ctx sdk.Context) types.NextAuction { + item := types.NextAuction{} + keeper.SetNextAuction(ctx, item) + return item +} + +func TestNextAuctionGet(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + item := createTestNextAuction(keeper, ctx) + rst, found := keeper.GetNextAuction(ctx) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) +} + +func TestNextAuctionRemove(t *testing.T) { + keeper, ctx := keepertest.CosmostestKeeper(t) + createTestNextAuction(keeper, ctx) + keeper.RemoveNextAuction(ctx) + _, found := keeper.GetNextAuction(ctx) + require.False(t, found) +} diff --git a/x/cosmostest/module.go b/x/cosmostest/module.go index a647471..63f41e4 100644 --- a/x/cosmostest/module.go +++ b/x/cosmostest/module.go @@ -1,9 +1,9 @@ package cosmostest import ( + "context" "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -77,7 +77,7 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - // this line is used by starport scaffolding # 2 + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) } // GetTxCmd returns the capability module's root tx command. diff --git a/x/cosmostest/types/auction.pb.go b/x/cosmostest/types/auction.pb.go new file mode 100644 index 0000000..3bfd54d --- /dev/null +++ b/x/cosmostest/types/auction.pb.go @@ -0,0 +1,521 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmostest/auction.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Auction struct { + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Bids string `protobuf:"bytes,4,opt,name=bids,proto3" json:"bids,omitempty"` + HighestBid string `protobuf:"bytes,5,opt,name=highestBid,proto3" json:"highestBid,omitempty"` +} + +func (m *Auction) Reset() { *m = Auction{} } +func (m *Auction) String() string { return proto.CompactTextString(m) } +func (*Auction) ProtoMessage() {} +func (*Auction) Descriptor() ([]byte, []int) { + return fileDescriptor_631f6f59914101d9, []int{0} +} +func (m *Auction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Auction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Auction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Auction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Auction.Merge(m, src) +} +func (m *Auction) XXX_Size() int { + return m.Size() +} +func (m *Auction) XXX_DiscardUnknown() { + xxx_messageInfo_Auction.DiscardUnknown(m) +} + +var xxx_messageInfo_Auction proto.InternalMessageInfo + +func (m *Auction) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *Auction) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Auction) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Auction) GetBids() string { + if m != nil { + return m.Bids + } + return "" +} + +func (m *Auction) GetHighestBid() string { + if m != nil { + return m.HighestBid + } + return "" +} + +func init() { + proto.RegisterType((*Auction)(nil), "cosmostest.cosmostest.Auction") +} + +func init() { proto.RegisterFile("cosmostest/auction.proto", fileDescriptor_631f6f59914101d9) } + +var fileDescriptor_631f6f59914101d9 = []byte{ + // 196 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0x2e, 0x49, 0x2d, 0x2e, 0xd1, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, + 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x45, 0xc8, 0xe8, 0x21, 0x98, 0x4a, 0x9d, 0x8c, 0x5c, 0xec, + 0x8e, 0x10, 0x85, 0x42, 0x22, 0x5c, 0xac, 0x99, 0x79, 0x29, 0xa9, 0x15, 0x12, 0x8c, 0x0a, 0x8c, + 0x1a, 0x9c, 0x41, 0x10, 0x8e, 0x90, 0x10, 0x17, 0x4b, 0x5e, 0x62, 0x6e, 0xaa, 0x04, 0x13, 0x58, + 0x10, 0xcc, 0x16, 0x52, 0xe0, 0xe2, 0x4e, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x00, 0x69, 0x94, + 0x60, 0x06, 0x4b, 0x21, 0x0b, 0x81, 0x74, 0x25, 0x65, 0xa6, 0x14, 0x4b, 0xb0, 0x40, 0x74, 0x81, + 0xd8, 0x42, 0x72, 0x5c, 0x5c, 0x19, 0x99, 0xe9, 0x19, 0xa9, 0xc5, 0x25, 0x4e, 0x99, 0x29, 0x12, + 0xac, 0x60, 0x19, 0x24, 0x11, 0x27, 0x8b, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, + 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, + 0x88, 0x92, 0x83, 0xb8, 0x58, 0x17, 0xec, 0xaf, 0x0a, 0x7d, 0x24, 0x4f, 0x96, 0x54, 0x16, 0xa4, + 0x16, 0x27, 0xb1, 0x81, 0xfd, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xce, 0x1a, 0xcd, 0xf3, + 0xff, 0x00, 0x00, 0x00, +} + +func (m *Auction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Auction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.HighestBid) > 0 { + i -= len(m.HighestBid) + copy(dAtA[i:], m.HighestBid) + i = encodeVarintAuction(dAtA, i, uint64(len(m.HighestBid))) + i-- + dAtA[i] = 0x2a + } + if len(m.Bids) > 0 { + i -= len(m.Bids) + copy(dAtA[i:], m.Bids) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Bids))) + i-- + dAtA[i] = 0x22 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintAuction(dAtA []byte, offset int, v uint64) int { + offset -= sovAuction(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Auction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Index) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = len(m.Bids) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + l = len(m.HighestBid) + if l > 0 { + n += 1 + l + sovAuction(uint64(l)) + } + return n +} + +func sovAuction(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAuction(x uint64) (n int) { + return sovAuction(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Auction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Auction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Auction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bids = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HighestBid", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HighestBid = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAuction(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthAuction + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAuction + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAuction + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAuction = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAuction = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAuction = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/cosmostest/types/genesis.go b/x/cosmostest/types/genesis.go index 8df94ba..c6d005b 100644 --- a/x/cosmostest/types/genesis.go +++ b/x/cosmostest/types/genesis.go @@ -1,7 +1,7 @@ package types import ( -// this line is used by starport scaffolding # genesis/types/import + "fmt" ) // DefaultIndex is the default capability global index @@ -10,6 +10,8 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ + NextAuction: nil, + AuctionList: []Auction{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -18,6 +20,16 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { + // Check for duplicated index in auction + auctionIndexMap := make(map[string]struct{}) + + for _, elem := range gs.AuctionList { + index := string(AuctionKey(elem.Index)) + if _, ok := auctionIndexMap[index]; ok { + return fmt.Errorf("duplicated index for auction") + } + auctionIndexMap[index] = struct{}{} + } // this line is used by starport scaffolding # genesis/types/validate return gs.Params.Validate() diff --git a/x/cosmostest/types/genesis.pb.go b/x/cosmostest/types/genesis.pb.go index 4706d37..12c765e 100644 --- a/x/cosmostest/types/genesis.pb.go +++ b/x/cosmostest/types/genesis.pb.go @@ -25,7 +25,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the cosmostest module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + NextAuction *NextAuction `protobuf:"bytes,2,opt,name=nextAuction,proto3" json:"nextAuction,omitempty"` + AuctionList []Auction `protobuf:"bytes,3,rep,name=auctionList,proto3" json:"auctionList"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -68,6 +70,20 @@ func (m *GenesisState) GetParams() Params { return Params{} } +func (m *GenesisState) GetNextAuction() *NextAuction { + if m != nil { + return m.NextAuction + } + return nil +} + +func (m *GenesisState) GetAuctionList() []Auction { + if m != nil { + return m.AuctionList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "cosmostest.cosmostest.GenesisState") } @@ -75,18 +91,23 @@ func init() { func init() { proto.RegisterFile("cosmostest/genesis.proto", fileDescriptor_78c0d8c25fe3d9a9) } var fileDescriptor_78c0d8c25fe3d9a9 = []byte{ - // 173 bytes of a gzipped FileDescriptorProto + // 247 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x2e, 0x49, 0x2d, 0x2e, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x45, 0xc8, 0xe8, 0x21, 0x98, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x15, 0xfa, 0x20, 0x16, 0x44, 0xb1, 0x94, 0x38, 0x92, 0x31, 0x05, 0x89, 0x45, 0x89, - 0xb9, 0x50, 0x53, 0x94, 0xbc, 0xb9, 0x78, 0xdc, 0x21, 0xc6, 0x06, 0x97, 0x24, 0x96, 0xa4, 0x0a, - 0x59, 0x73, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x64, 0xf5, 0xb0, 0x5a, - 0xa3, 0x17, 0x00, 0x56, 0xe4, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54, 0x8b, 0x93, 0xc5, - 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, - 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xc9, 0x41, 0xb4, 0xea, 0x82, 0x1d, - 0x50, 0xa1, 0x8f, 0xe4, 0x9a, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x6b, 0x8c, 0x01, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x74, 0xa7, 0xf1, 0xb2, 0xef, 0x00, 0x00, 0x00, + 0xb9, 0x50, 0x53, 0xa4, 0x64, 0x91, 0x24, 0xf2, 0x52, 0x2b, 0x4a, 0xe2, 0x13, 0x4b, 0x93, 0x4b, + 0x32, 0xf3, 0xf3, 0xa0, 0xd2, 0xc8, 0xd6, 0xa3, 0xc8, 0x28, 0xdd, 0x64, 0xe4, 0xe2, 0x71, 0x87, + 0x38, 0x28, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x9a, 0x8b, 0x0d, 0x62, 0xb2, 0x04, 0xa3, 0x02, + 0xa3, 0x06, 0xb7, 0x91, 0xac, 0x1e, 0x56, 0x07, 0xea, 0x05, 0x80, 0x15, 0x39, 0xb1, 0x9c, 0xb8, + 0x27, 0xcf, 0x10, 0x04, 0xd5, 0x22, 0xe4, 0xc2, 0xc5, 0x0d, 0xb2, 0xdd, 0x11, 0x62, 0x85, 0x04, + 0x13, 0xd8, 0x04, 0x25, 0x1c, 0x26, 0xf8, 0x21, 0x54, 0x06, 0x21, 0x6b, 0x13, 0x72, 0xe3, 0xe2, + 0x86, 0x3a, 0xd2, 0x27, 0xb3, 0xb8, 0x44, 0x82, 0x59, 0x81, 0x59, 0x83, 0xdb, 0x48, 0x0e, 0x87, + 0x29, 0x50, 0x4d, 0x50, 0x87, 0x20, 0x6b, 0x74, 0xb2, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, + 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, + 0x63, 0x39, 0x86, 0x28, 0x39, 0x88, 0x01, 0xba, 0xe0, 0x00, 0xa9, 0xd0, 0x47, 0x0a, 0x9d, 0x92, + 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xe0, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3c, + 0x94, 0xf7, 0x48, 0xb7, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -109,6 +130,32 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AuctionList) > 0 { + for iNdEx := len(m.AuctionList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AuctionList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.NextAuction != nil { + { + size, err := m.NextAuction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -141,6 +188,16 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) + if m.NextAuction != nil { + l = m.NextAuction.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.AuctionList) > 0 { + for _, e := range m.AuctionList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -212,6 +269,76 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextAuction", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NextAuction == nil { + m.NextAuction = &NextAuction{} + } + if err := m.NextAuction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuctionList = append(m.AuctionList, Auction{}) + if err := m.AuctionList[len(m.AuctionList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/cosmostest/types/genesis_test.go b/x/cosmostest/types/genesis_test.go index c275f25..4695ee0 100644 --- a/x/cosmostest/types/genesis_test.go +++ b/x/cosmostest/types/genesis_test.go @@ -19,13 +19,38 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "valid genesis state", + desc: "valid genesis state", genState: &types.GenesisState{ + NextAuction: &types.NextAuction{ + AuctionId: 54, + }, + AuctionList: []types.Auction{ + { + Index: "0", + }, + { + Index: "1", + }, + }, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, }, + { + desc: "duplicated auction", + genState: &types.GenesisState{ + AuctionList: []types.Auction{ + { + Index: "0", + }, + { + Index: "0", + }, + }, + }, + valid: false, + }, // this line is used by starport scaffolding # types/genesis/testcase } { t.Run(tc.desc, func(t *testing.T) { diff --git a/x/cosmostest/types/key_auction.go b/x/cosmostest/types/key_auction.go new file mode 100644 index 0000000..cd97ed4 --- /dev/null +++ b/x/cosmostest/types/key_auction.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // AuctionKeyPrefix is the prefix to retrieve all Auction + AuctionKeyPrefix = "Auction/value/" +) + +// AuctionKey returns the store key to retrieve a Auction from the index fields +func AuctionKey( + index string, +) []byte { + var key []byte + + indexBytes := []byte(index) + key = append(key, indexBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/cosmostest/types/keys.go b/x/cosmostest/types/keys.go index ab1edd1..c8bcc19 100644 --- a/x/cosmostest/types/keys.go +++ b/x/cosmostest/types/keys.go @@ -20,3 +20,7 @@ const ( func KeyPrefix(p string) []byte { return []byte(p) } + +const ( + NextAuctionKey = "NextAuction-value-" +) diff --git a/x/cosmostest/types/next_auction.pb.go b/x/cosmostest/types/next_auction.pb.go new file mode 100644 index 0000000..d2161be --- /dev/null +++ b/x/cosmostest/types/next_auction.pb.go @@ -0,0 +1,297 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmostest/next_auction.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type NextAuction struct { + AuctionId uint64 `protobuf:"varint,1,opt,name=auctionId,proto3" json:"auctionId,omitempty"` +} + +func (m *NextAuction) Reset() { *m = NextAuction{} } +func (m *NextAuction) String() string { return proto.CompactTextString(m) } +func (*NextAuction) ProtoMessage() {} +func (*NextAuction) Descriptor() ([]byte, []int) { + return fileDescriptor_403ab8ae798c785d, []int{0} +} +func (m *NextAuction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NextAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NextAuction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NextAuction) XXX_Merge(src proto.Message) { + xxx_messageInfo_NextAuction.Merge(m, src) +} +func (m *NextAuction) XXX_Size() int { + return m.Size() +} +func (m *NextAuction) XXX_DiscardUnknown() { + xxx_messageInfo_NextAuction.DiscardUnknown(m) +} + +var xxx_messageInfo_NextAuction proto.InternalMessageInfo + +func (m *NextAuction) GetAuctionId() uint64 { + if m != nil { + return m.AuctionId + } + return 0 +} + +func init() { + proto.RegisterType((*NextAuction)(nil), "cosmostest.cosmostest.NextAuction") +} + +func init() { proto.RegisterFile("cosmostest/next_auction.proto", fileDescriptor_403ab8ae798c785d) } + +var fileDescriptor_403ab8ae798c785d = []byte{ + // 139 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0x2e, 0x49, 0x2d, 0x2e, 0xd1, 0xcf, 0x4b, 0xad, 0x28, 0x89, 0x4f, 0x2c, 0x4d, 0x2e, + 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x45, 0x48, 0xeb, 0x21, 0x98, + 0x4a, 0xda, 0x5c, 0xdc, 0x7e, 0xa9, 0x15, 0x25, 0x8e, 0x10, 0xb5, 0x42, 0x32, 0x5c, 0x9c, 0x50, + 0x6d, 0x9e, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x2c, 0x41, 0x08, 0x01, 0x27, 0x8b, 0x13, 0x8f, + 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, + 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0x83, 0x18, 0xa9, 0x0b, 0xb6, 0xbd, 0x42, + 0x1f, 0xc9, 0x29, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x47, 0x18, 0x03, 0x02, 0x00, + 0x00, 0xff, 0xff, 0xb1, 0x7c, 0xed, 0xa0, 0xa5, 0x00, 0x00, 0x00, +} + +func (m *NextAuction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NextAuction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NextAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AuctionId != 0 { + i = encodeVarintNextAuction(dAtA, i, uint64(m.AuctionId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintNextAuction(dAtA []byte, offset int, v uint64) int { + offset -= sovNextAuction(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *NextAuction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AuctionId != 0 { + n += 1 + sovNextAuction(uint64(m.AuctionId)) + } + return n +} + +func sovNextAuction(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNextAuction(x uint64) (n int) { + return sovNextAuction(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NextAuction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNextAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NextAuction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NextAuction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) + } + m.AuctionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNextAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipNextAuction(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNextAuction + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNextAuction(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNextAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNextAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNextAuction + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthNextAuction + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNextAuction + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNextAuction + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNextAuction = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNextAuction = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNextAuction = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/cosmostest/types/query.pb.go b/x/cosmostest/types/query.pb.go index 79af9be..1de0452 100644 --- a/x/cosmostest/types/query.pb.go +++ b/x/cosmostest/types/query.pb.go @@ -6,7 +6,7 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -113,33 +113,319 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +type QueryGetNextAuctionRequest struct { +} + +func (m *QueryGetNextAuctionRequest) Reset() { *m = QueryGetNextAuctionRequest{} } +func (m *QueryGetNextAuctionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetNextAuctionRequest) ProtoMessage() {} +func (*QueryGetNextAuctionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_540d26b2788a5d10, []int{2} +} +func (m *QueryGetNextAuctionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNextAuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNextAuctionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNextAuctionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNextAuctionRequest.Merge(m, src) +} +func (m *QueryGetNextAuctionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNextAuctionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNextAuctionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNextAuctionRequest proto.InternalMessageInfo + +type QueryGetNextAuctionResponse struct { + NextAuction NextAuction `protobuf:"bytes,1,opt,name=NextAuction,proto3" json:"NextAuction"` +} + +func (m *QueryGetNextAuctionResponse) Reset() { *m = QueryGetNextAuctionResponse{} } +func (m *QueryGetNextAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetNextAuctionResponse) ProtoMessage() {} +func (*QueryGetNextAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_540d26b2788a5d10, []int{3} +} +func (m *QueryGetNextAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetNextAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetNextAuctionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetNextAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNextAuctionResponse.Merge(m, src) +} +func (m *QueryGetNextAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetNextAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNextAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetNextAuctionResponse proto.InternalMessageInfo + +func (m *QueryGetNextAuctionResponse) GetNextAuction() NextAuction { + if m != nil { + return m.NextAuction + } + return NextAuction{} +} + +type QueryGetAuctionRequest struct { + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` +} + +func (m *QueryGetAuctionRequest) Reset() { *m = QueryGetAuctionRequest{} } +func (m *QueryGetAuctionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetAuctionRequest) ProtoMessage() {} +func (*QueryGetAuctionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_540d26b2788a5d10, []int{4} +} +func (m *QueryGetAuctionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAuctionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetAuctionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAuctionRequest.Merge(m, src) +} +func (m *QueryGetAuctionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAuctionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAuctionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAuctionRequest proto.InternalMessageInfo + +func (m *QueryGetAuctionRequest) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +type QueryGetAuctionResponse struct { + Auction Auction `protobuf:"bytes,1,opt,name=auction,proto3" json:"auction"` +} + +func (m *QueryGetAuctionResponse) Reset() { *m = QueryGetAuctionResponse{} } +func (m *QueryGetAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetAuctionResponse) ProtoMessage() {} +func (*QueryGetAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_540d26b2788a5d10, []int{5} +} +func (m *QueryGetAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetAuctionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGetAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetAuctionResponse.Merge(m, src) +} +func (m *QueryGetAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetAuctionResponse proto.InternalMessageInfo + +func (m *QueryGetAuctionResponse) GetAuction() Auction { + if m != nil { + return m.Auction + } + return Auction{} +} + +type QueryAllAuctionRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllAuctionRequest) Reset() { *m = QueryAllAuctionRequest{} } +func (m *QueryAllAuctionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllAuctionRequest) ProtoMessage() {} +func (*QueryAllAuctionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_540d26b2788a5d10, []int{6} +} +func (m *QueryAllAuctionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllAuctionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllAuctionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllAuctionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllAuctionRequest.Merge(m, src) +} +func (m *QueryAllAuctionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllAuctionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllAuctionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllAuctionRequest proto.InternalMessageInfo + +func (m *QueryAllAuctionRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllAuctionResponse struct { + Auction []Auction `protobuf:"bytes,1,rep,name=auction,proto3" json:"auction"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllAuctionResponse) Reset() { *m = QueryAllAuctionResponse{} } +func (m *QueryAllAuctionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllAuctionResponse) ProtoMessage() {} +func (*QueryAllAuctionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_540d26b2788a5d10, []int{7} +} +func (m *QueryAllAuctionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllAuctionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllAuctionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllAuctionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllAuctionResponse.Merge(m, src) +} +func (m *QueryAllAuctionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllAuctionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllAuctionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllAuctionResponse proto.InternalMessageInfo + +func (m *QueryAllAuctionResponse) GetAuction() []Auction { + if m != nil { + return m.Auction + } + return nil +} + +func (m *QueryAllAuctionResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "cosmostest.cosmostest.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "cosmostest.cosmostest.QueryParamsResponse") + proto.RegisterType((*QueryGetNextAuctionRequest)(nil), "cosmostest.cosmostest.QueryGetNextAuctionRequest") + proto.RegisterType((*QueryGetNextAuctionResponse)(nil), "cosmostest.cosmostest.QueryGetNextAuctionResponse") + proto.RegisterType((*QueryGetAuctionRequest)(nil), "cosmostest.cosmostest.QueryGetAuctionRequest") + proto.RegisterType((*QueryGetAuctionResponse)(nil), "cosmostest.cosmostest.QueryGetAuctionResponse") + proto.RegisterType((*QueryAllAuctionRequest)(nil), "cosmostest.cosmostest.QueryAllAuctionRequest") + proto.RegisterType((*QueryAllAuctionResponse)(nil), "cosmostest.cosmostest.QueryAllAuctionResponse") } func init() { proto.RegisterFile("cosmostest/query.proto", fileDescriptor_540d26b2788a5d10) } var fileDescriptor_540d26b2788a5d10 = []byte{ - // 282 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0x2e, 0x49, 0x2d, 0x2e, 0xd1, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0x12, 0x45, 0x88, 0xeb, 0x21, 0x98, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, - 0x15, 0xfa, 0x20, 0x16, 0x44, 0xb1, 0x94, 0x4c, 0x7a, 0x7e, 0x7e, 0x7a, 0x4e, 0xaa, 0x7e, 0x62, - 0x41, 0xa6, 0x7e, 0x62, 0x5e, 0x5e, 0x7e, 0x49, 0x62, 0x49, 0x66, 0x7e, 0x5e, 0x31, 0x54, 0x56, - 0x0b, 0xa2, 0x5f, 0x3f, 0x29, 0xb1, 0x38, 0x15, 0x62, 0x87, 0x7e, 0x99, 0x61, 0x52, 0x6a, 0x49, - 0xa2, 0xa1, 0x7e, 0x41, 0x62, 0x7a, 0x66, 0x1e, 0x58, 0x31, 0x54, 0xad, 0x38, 0x92, 0x73, 0x0a, - 0x12, 0x8b, 0x12, 0x73, 0xa1, 0x86, 0x28, 0x89, 0x70, 0x09, 0x05, 0x82, 0xb4, 0x06, 0x80, 0x05, - 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x82, 0xb8, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, - 0xf3, 0x8a, 0x53, 0x85, 0xac, 0xb9, 0xd8, 0x20, 0x9a, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, - 0x64, 0xf5, 0xb0, 0xfa, 0x46, 0x0f, 0xa2, 0xcd, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, - 0x16, 0xa3, 0x89, 0x8c, 0x5c, 0xac, 0x60, 0x43, 0x85, 0xda, 0x19, 0xb9, 0xd8, 0x20, 0x4a, 0x84, - 0x34, 0x71, 0x98, 0x80, 0xe9, 0x26, 0x29, 0x2d, 0x62, 0x94, 0x42, 0x1c, 0xaa, 0xa4, 0xd6, 0x74, - 0xf9, 0xc9, 0x64, 0x26, 0x05, 0x21, 0x39, 0x7d, 0x88, 0x42, 0x5d, 0xb0, 0xc7, 0x31, 0xc2, 0xc0, - 0xc9, 0xe2, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, - 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xe4, 0x90, 0x35, 0x56, - 0x20, 0x6b, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x07, 0x9f, 0x31, 0x20, 0x00, 0x00, - 0xff, 0xff, 0xf4, 0x1c, 0x44, 0x48, 0xe8, 0x01, 0x00, 0x00, + // 536 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x3f, 0x6f, 0x13, 0x31, + 0x18, 0xc6, 0xe3, 0xd2, 0x3f, 0xe2, 0xed, 0x66, 0x42, 0x5b, 0x1d, 0xed, 0xb5, 0x58, 0x28, 0xa1, + 0x15, 0x3d, 0x2b, 0x61, 0x41, 0x42, 0x42, 0x4a, 0x07, 0x2a, 0x31, 0xa0, 0x72, 0x1b, 0x2c, 0xe0, + 0x14, 0xeb, 0x74, 0xd2, 0xf5, 0x7c, 0x8d, 0x1d, 0x94, 0x0a, 0xb1, 0xb0, 0xb0, 0x22, 0xc1, 0xc2, + 0xda, 0x4f, 0xd3, 0xb1, 0x12, 0x0b, 0x13, 0x42, 0x09, 0x0b, 0xdf, 0x02, 0xc5, 0xf6, 0x29, 0xbe, + 0x5e, 0x2e, 0x69, 0x37, 0xc7, 0xef, 0xf3, 0xbc, 0xcf, 0x4f, 0xc9, 0xe3, 0xc0, 0xda, 0xb1, 0x90, + 0x27, 0x42, 0x2a, 0x2e, 0x15, 0x3d, 0xed, 0xf3, 0xde, 0x59, 0x90, 0xf5, 0x84, 0x12, 0xf8, 0xee, + 0xe4, 0x3e, 0x98, 0x1c, 0xbd, 0x7a, 0x24, 0x22, 0xa1, 0x15, 0x74, 0x7c, 0x32, 0x62, 0x6f, 0x33, + 0x12, 0x22, 0x4a, 0x38, 0x65, 0x59, 0x4c, 0x59, 0x9a, 0x0a, 0xc5, 0x54, 0x2c, 0x52, 0x69, 0xa7, + 0x7b, 0xc6, 0x4f, 0xbb, 0x4c, 0x72, 0x93, 0x41, 0x3f, 0xb4, 0xba, 0x5c, 0xb1, 0x16, 0xcd, 0x58, + 0x14, 0xa7, 0x5a, 0x6c, 0xb5, 0xeb, 0x0e, 0x4e, 0xc6, 0x7a, 0xec, 0x24, 0x5f, 0xb2, 0xe5, 0x0c, + 0x52, 0x3e, 0x50, 0x6f, 0x59, 0xff, 0xd8, 0xf1, 0x6d, 0x38, 0xe3, 0xc2, 0x84, 0xd4, 0x01, 0xbf, + 0x1a, 0x67, 0x1e, 0xe9, 0x6d, 0x21, 0x3f, 0xed, 0x73, 0xa9, 0x48, 0x08, 0x77, 0x0a, 0xb7, 0x32, + 0x13, 0xa9, 0xe4, 0xf8, 0x29, 0x2c, 0x9b, 0xd4, 0x0d, 0xb4, 0x83, 0x1e, 0xae, 0xb6, 0xb7, 0x82, + 0xa9, 0x5f, 0x43, 0x60, 0x6c, 0x07, 0x8b, 0x17, 0xbf, 0xb7, 0x6b, 0xa1, 0xb5, 0x90, 0x4d, 0xf0, + 0xf4, 0xce, 0x43, 0xae, 0x5e, 0xf2, 0x81, 0xea, 0x18, 0x8c, 0x3c, 0x31, 0x86, 0x7b, 0x53, 0xa7, + 0x36, 0xf9, 0x05, 0xac, 0x3a, 0xd7, 0x36, 0x9e, 0x54, 0xc4, 0x3b, 0x4a, 0xcb, 0xe0, 0x9a, 0x49, + 0x00, 0x6b, 0x79, 0x54, 0x11, 0x02, 0xd7, 0x61, 0x29, 0x4e, 0xdf, 0xf3, 0x81, 0xde, 0x7f, 0x3b, + 0x34, 0x1f, 0xc8, 0x6b, 0x58, 0x2f, 0xe9, 0x2d, 0xd6, 0x33, 0x58, 0x61, 0x05, 0x24, 0xbf, 0x02, + 0xa9, 0x88, 0x93, 0x9b, 0xc8, 0x3b, 0x8b, 0xd2, 0x49, 0x92, 0x2b, 0x28, 0xcf, 0x01, 0x26, 0xbf, + 0xbe, 0x5d, 0xde, 0xb0, 0x1b, 0x83, 0x71, 0x55, 0x02, 0x53, 0x47, 0x5b, 0x95, 0xe0, 0x88, 0x45, + 0xdc, 0x7a, 0x43, 0xc7, 0x49, 0xce, 0x91, 0xa5, 0x77, 0x23, 0xa6, 0xd1, 0xdf, 0xba, 0x31, 0x3d, + 0x3e, 0x2c, 0x30, 0x2e, 0x68, 0xc6, 0xe6, 0x5c, 0x46, 0x13, 0xee, 0x42, 0xb6, 0xff, 0x2d, 0xc2, + 0x92, 0x86, 0xc4, 0x5f, 0x10, 0x2c, 0x9b, 0xf6, 0xe0, 0xdd, 0x0a, 0x98, 0x72, 0x5d, 0xbd, 0xbd, + 0xeb, 0x48, 0x4d, 0x2e, 0x69, 0x7c, 0xfe, 0xf9, 0xf7, 0xdb, 0xc2, 0x0e, 0xf6, 0xa9, 0x11, 0xee, + 0xeb, 0x47, 0x51, 0x7a, 0x57, 0xf8, 0x1c, 0x15, 0x2a, 0x87, 0x5b, 0xb3, 0x32, 0xa6, 0x76, 0xda, + 0x6b, 0xdf, 0xc4, 0x62, 0xf1, 0x1e, 0x69, 0xbc, 0x06, 0x7e, 0x50, 0x85, 0xe7, 0xbe, 0x6e, 0xfc, + 0x03, 0xc1, 0x4a, 0x0e, 0xb8, 0x3f, 0x27, 0xed, 0x0a, 0x5c, 0x70, 0x5d, 0xb9, 0x05, 0xa3, 0x1a, + 0x6c, 0x17, 0x37, 0xab, 0xc0, 0x2c, 0x13, 0xfd, 0xa8, 0x5f, 0xcd, 0x27, 0xfc, 0x1d, 0x01, 0xd8, + 0x25, 0x9d, 0x24, 0x99, 0x8d, 0x57, 0xea, 0xff, 0x6c, 0xbc, 0x72, 0x97, 0x49, 0x53, 0xe3, 0xdd, + 0xc7, 0xdb, 0x73, 0xf0, 0x0e, 0x9e, 0x5c, 0x0c, 0x7d, 0x74, 0x39, 0xf4, 0xd1, 0x9f, 0xa1, 0x8f, + 0xbe, 0x8e, 0xfc, 0xda, 0xe5, 0xc8, 0xaf, 0xfd, 0x1a, 0xf9, 0xb5, 0x37, 0xbe, 0xeb, 0x1c, 0xb8, + 0x5e, 0x75, 0x96, 0x71, 0xd9, 0x5d, 0xd6, 0xff, 0x98, 0x8f, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, + 0xf7, 0x94, 0x2a, 0x39, 0x14, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -156,6 +442,12 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a NextAuction by index. + NextAuction(ctx context.Context, in *QueryGetNextAuctionRequest, opts ...grpc.CallOption) (*QueryGetNextAuctionResponse, error) + // Queries a Auction by index. + Auction(ctx context.Context, in *QueryGetAuctionRequest, opts ...grpc.CallOption) (*QueryGetAuctionResponse, error) + // Queries a list of Auction items. + AuctionAll(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) } type queryClient struct { @@ -175,10 +467,43 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) NextAuction(ctx context.Context, in *QueryGetNextAuctionRequest, opts ...grpc.CallOption) (*QueryGetNextAuctionResponse, error) { + out := new(QueryGetNextAuctionResponse) + err := c.cc.Invoke(ctx, "/cosmostest.cosmostest.Query/NextAuction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Auction(ctx context.Context, in *QueryGetAuctionRequest, opts ...grpc.CallOption) (*QueryGetAuctionResponse, error) { + out := new(QueryGetAuctionResponse) + err := c.cc.Invoke(ctx, "/cosmostest.cosmostest.Query/Auction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AuctionAll(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) { + out := new(QueryAllAuctionResponse) + err := c.cc.Invoke(ctx, "/cosmostest.cosmostest.Query/AuctionAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a NextAuction by index. + NextAuction(context.Context, *QueryGetNextAuctionRequest) (*QueryGetNextAuctionResponse, error) + // Queries a Auction by index. + Auction(context.Context, *QueryGetAuctionRequest) (*QueryGetAuctionResponse, error) + // Queries a list of Auction items. + AuctionAll(context.Context, *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -188,6 +513,15 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) NextAuction(ctx context.Context, req *QueryGetNextAuctionRequest) (*QueryGetNextAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NextAuction not implemented") +} +func (*UnimplementedQueryServer) Auction(ctx context.Context, req *QueryGetAuctionRequest) (*QueryGetAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Auction not implemented") +} +func (*UnimplementedQueryServer) AuctionAll(ctx context.Context, req *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuctionAll not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -211,6 +545,60 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_NextAuction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNextAuctionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NextAuction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmostest.cosmostest.Query/NextAuction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NextAuction(ctx, req.(*QueryGetNextAuctionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Auction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetAuctionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Auction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmostest.cosmostest.Query/Auction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Auction(ctx, req.(*QueryGetAuctionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AuctionAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllAuctionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AuctionAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmostest.cosmostest.Query/AuctionAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuctionAll(ctx, req.(*QueryAllAuctionRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmostest.cosmostest.Query", HandlerType: (*QueryServer)(nil), @@ -219,6 +607,18 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "NextAuction", + Handler: _Query_NextAuction_Handler, + }, + { + MethodName: "Auction", + Handler: _Query_Auction_Handler, + }, + { + MethodName: "AuctionAll", + Handler: _Query_AuctionAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmostest/query.proto", @@ -280,6 +680,209 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryGetNextAuctionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetNextAuctionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNextAuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetNextAuctionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetNextAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNextAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.NextAuction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetAuctionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetAuctionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetAuctionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Auction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllAuctionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllAuctionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllAuctionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllAuctionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllAuctionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Auction) > 0 { + for iNdEx := len(m.Auction) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Auction[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -311,6 +914,82 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *QueryGetNextAuctionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetNextAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NextAuction.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetAuctionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Index) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Auction.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllAuctionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllAuctionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Auction) > 0 { + for _, e := range m.Auction { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -450,6 +1129,510 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGetNextAuctionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNextAuctionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNextAuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetNextAuctionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetNextAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetNextAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextAuction", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NextAuction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetAuctionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetAuctionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetAuctionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auction", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Auction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllAuctionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllAuctionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllAuctionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllAuctionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllAuctionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllAuctionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Auction", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Auction = append(m.Auction, Auction{}) + if err := m.Auction[len(m.Auction)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/cosmostest/types/query.pb.gw.go b/x/cosmostest/types/query.pb.gw.go index 9698c0c..4902bba 100644 --- a/x/cosmostest/types/query.pb.gw.go +++ b/x/cosmostest/types/query.pb.gw.go @@ -51,6 +51,114 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_NextAuction_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNextAuctionRequest + var metadata runtime.ServerMetadata + + msg, err := client.NextAuction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NextAuction_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetNextAuctionRequest + var metadata runtime.ServerMetadata + + msg, err := server.NextAuction(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Auction_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + msg, err := client.Auction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Auction_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetAuctionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + msg, err := server.Auction(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AuctionAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AuctionAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllAuctionRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AuctionAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AuctionAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AuctionAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllAuctionRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AuctionAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AuctionAll(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -80,6 +188,75 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_NextAuction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NextAuction_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NextAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Auction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Auction_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Auction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AuctionAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AuctionAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -141,13 +318,85 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_NextAuction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NextAuction_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NextAuction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Auction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Auction_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Auction_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AuctionAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AuctionAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AuctionAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"cosmos-test", "cosmostest", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_NextAuction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"cosmos-test", "cosmostest", "next_auction"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Auction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"cosmos-test", "cosmostest", "auction", "index"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_AuctionAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"cosmos-test", "cosmostest", "auction"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_NextAuction_0 = runtime.ForwardResponseMessage + + forward_Query_Auction_0 = runtime.ForwardResponseMessage + + forward_Query_AuctionAll_0 = runtime.ForwardResponseMessage )