scaffold base auction & nextAuction types

master
michael 2022-08-25 18:49:35 -07:00
parent c829ab63fc
commit 6ff5b7fb7f
37 changed files with 4747 additions and 38 deletions

View File

@ -20122,6 +20122,219 @@ paths:
format: int64 format: int64
tags: tags:
- Query - 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: /cosmos-test/cosmostest/params:
get: get:
summary: Parameters queries the parameters of the module. summary: Parameters queries the parameters of the module.
@ -47178,9 +47391,96 @@ definitions:
description: >- description: >-
MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount
response type. 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: cosmostest.cosmostest.Params:
type: object type: object
description: Params defines the parameters for the module. 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: cosmostest.cosmostest.QueryParamsResponse:
type: object type: object
properties: properties:

View File

@ -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;
}

View File

@ -3,6 +3,8 @@ package cosmostest.cosmostest;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
import "cosmostest/params.proto"; import "cosmostest/params.proto";
import "cosmostest/next_auction.proto";
import "cosmostest/auction.proto";
// this line is used by starport scaffolding # genesis/proto/import // this line is used by starport scaffolding # genesis/proto/import
option go_package = "cosmos-test/x/cosmostest/types"; 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. // GenesisState defines the cosmostest module's genesis state.
message GenesisState { message GenesisState {
Params params = 1 [(gogoproto.nullable) = false]; 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 // this line is used by starport scaffolding # genesis/proto/state
} }

View File

@ -0,0 +1,9 @@
syntax = "proto3";
package cosmostest.cosmostest;
option go_package = "cosmos-test/x/cosmostest/types";
message NextAuction {
uint64 auctionId = 1;
}

View File

@ -5,6 +5,8 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmostest/params.proto"; import "cosmostest/params.proto";
import "cosmostest/next_auction.proto";
import "cosmostest/auction.proto";
// this line is used by starport scaffolding # 1 // this line is used by starport scaffolding # 1
option go_package = "cosmos-test/x/cosmostest/types"; option go_package = "cosmos-test/x/cosmostest/types";
@ -15,7 +17,21 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos-test/cosmostest/params"; 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. // QueryParamsRequest is request type for the Query/Params RPC method.
@ -27,4 +43,27 @@ message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false]; 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 // this line is used by starport scaffolding # 3

View File

@ -1,9 +1,11 @@
import { txClient, queryClient, MissingWalletError , registry} from './module' 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" import { Params } from "./module/types/cosmostest/params"
export { Params }; export { Auction, NextAuction, Params };
async function initTxClient(vuexGetters) { async function initTxClient(vuexGetters) {
return await txClient(vuexGetters['common/wallet/signer'], { return await txClient(vuexGetters['common/wallet/signer'], {
@ -42,8 +44,13 @@ function getStructure(template) {
const getDefaultState = () => { const getDefaultState = () => {
return { return {
Params: {}, Params: {},
NextAuction: {},
Auction: {},
AuctionAll: {},
_Structure: { _Structure: {
Auction: getStructure(Auction.fromPartial({})),
NextAuction: getStructure(NextAuction.fromPartial({})),
Params: getStructure(Params.fromPartial({})), Params: getStructure(Params.fromPartial({})),
}, },
@ -79,6 +86,24 @@ export default {
} }
return state.Params[JSON.stringify(params)] ?? {} return state.Params[JSON.stringify(params)] ?? {}
}, },
getNextAuction: (state) => (params = { params: {}}) => {
if (!(<any> params).query) {
(<any> params).query=null
}
return state.NextAuction[JSON.stringify(params)] ?? {}
},
getAuction: (state) => (params = { params: {}}) => {
if (!(<any> params).query) {
(<any> params).query=null
}
return state.Auction[JSON.stringify(params)] ?? {}
},
getAuctionAll: (state) => (params = { params: {}}) => {
if (!(<any> params).query) {
(<any> params).query=null
}
return state.AuctionAll[JSON.stringify(params)] ?? {}
},
getTypeStructure: (state) => (type) => { getTypeStructure: (state) => (type) => {
return state._Structure[type].fields 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 && (<any> value).pagination && (<any> value).pagination.next_key!=null) {
let next_values=(await queryClient.queryAuctionAll({...query, 'pagination.key':(<any> 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)
}
},
} }
} }

View File

@ -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. * Params defines the parameters for the module.
*/ */
export type CosmostestParams = object; 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. * QueryParamsResponse is response type for the Query/Params RPC method.
*/ */
@ -33,6 +69,69 @@ export interface RpcStatus {
details?: ProtobufAny[]; 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<string | number, any>; export type QueryParamsType = Record<string | number, any>;
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">; export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
@ -225,10 +324,68 @@ export class HttpClient<SecurityDataType = unknown> {
} }
/** /**
* @title cosmostest/genesis.proto * @title cosmostest/auction.proto
* @version version not set * @version version not set
*/ */
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> { export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
/**
* 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<CosmostestQueryAllAuctionResponse, RpcStatus>({
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<CosmostestQueryGetAuctionResponse, RpcStatus>({
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<CosmostestQueryGetNextAuctionResponse, RpcStatus>({
path: `/cosmos-test/cosmostest/next_auction`,
method: "GET",
format: "json",
...params,
});
/** /**
* No description * No description
* *

View File

@ -38,6 +38,12 @@ export interface PageRequest {
* is set. * is set.
*/ */
count_total: boolean; 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; 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 = { export const PageRequest = {
encode(message: PageRequest, writer: Writer = Writer.create()): Writer { encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
@ -78,6 +89,9 @@ export const PageRequest = {
if (message.count_total === true) { if (message.count_total === true) {
writer.uint32(32).bool(message.count_total); writer.uint32(32).bool(message.count_total);
} }
if (message.reverse === true) {
writer.uint32(40).bool(message.reverse);
}
return writer; return writer;
}, },
@ -100,6 +114,9 @@ export const PageRequest = {
case 4: case 4:
message.count_total = reader.bool(); message.count_total = reader.bool();
break; break;
case 5:
message.reverse = reader.bool();
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;
@ -128,6 +145,11 @@ export const PageRequest = {
} else { } else {
message.count_total = false; message.count_total = false;
} }
if (object.reverse !== undefined && object.reverse !== null) {
message.reverse = Boolean(object.reverse);
} else {
message.reverse = false;
}
return message; return message;
}, },
@ -141,6 +163,7 @@ export const PageRequest = {
message.limit !== undefined && (obj.limit = message.limit); message.limit !== undefined && (obj.limit = message.limit);
message.count_total !== undefined && message.count_total !== undefined &&
(obj.count_total = message.count_total); (obj.count_total = message.count_total);
message.reverse !== undefined && (obj.reverse = message.reverse);
return obj; return obj;
}, },
@ -166,6 +189,11 @@ export const PageRequest = {
} else { } else {
message.count_total = false; message.count_total = false;
} }
if (object.reverse !== undefined && object.reverse !== null) {
message.reverse = object.reverse;
} else {
message.reverse = false;
}
return message; return message;
}, },
}; };

View File

@ -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>): 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> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -1,13 +1,17 @@
/* eslint-disable */ /* eslint-disable */
import { Params } from "../cosmostest/params"; import { Params } from "../cosmostest/params";
import { NextAuction } from "../cosmostest/next_auction";
import { Auction } from "../cosmostest/auction";
import { Writer, Reader } from "protobufjs/minimal"; import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmostest.cosmostest"; export const protobufPackage = "cosmostest.cosmostest";
/** GenesisState defines the cosmostest module's genesis state. */ /** GenesisState defines the cosmostest module's genesis state. */
export interface GenesisState { export interface GenesisState {
/** this line is used by starport scaffolding # genesis/proto/state */
params: Params | undefined; params: Params | undefined;
nextAuction: NextAuction | undefined;
/** this line is used by starport scaffolding # genesis/proto/state */
auctionList: Auction[];
} }
const baseGenesisState: object = {}; const baseGenesisState: object = {};
@ -17,6 +21,15 @@ export const GenesisState = {
if (message.params !== undefined) { if (message.params !== undefined) {
Params.encode(message.params, writer.uint32(10).fork()).ldelim(); 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; return writer;
}, },
@ -24,12 +37,19 @@ export const GenesisState = {
const reader = input instanceof Uint8Array ? new Reader(input) : input; const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGenesisState } as GenesisState; const message = { ...baseGenesisState } as GenesisState;
message.auctionList = [];
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
switch (tag >>> 3) { switch (tag >>> 3) {
case 1: case 1:
message.params = Params.decode(reader, reader.uint32()); message.params = Params.decode(reader, reader.uint32());
break; break;
case 2:
message.nextAuction = NextAuction.decode(reader, reader.uint32());
break;
case 3:
message.auctionList.push(Auction.decode(reader, reader.uint32()));
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;
@ -40,11 +60,22 @@ export const GenesisState = {
fromJSON(object: any): GenesisState { fromJSON(object: any): GenesisState {
const message = { ...baseGenesisState } as GenesisState; const message = { ...baseGenesisState } as GenesisState;
message.auctionList = [];
if (object.params !== undefined && object.params !== null) { if (object.params !== undefined && object.params !== null) {
message.params = Params.fromJSON(object.params); message.params = Params.fromJSON(object.params);
} else { } else {
message.params = undefined; 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; return message;
}, },
@ -52,16 +83,38 @@ export const GenesisState = {
const obj: any = {}; const obj: any = {};
message.params !== undefined && message.params !== undefined &&
(obj.params = message.params ? Params.toJSON(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; return obj;
}, },
fromPartial(object: DeepPartial<GenesisState>): GenesisState { fromPartial(object: DeepPartial<GenesisState>): GenesisState {
const message = { ...baseGenesisState } as GenesisState; const message = { ...baseGenesisState } as GenesisState;
message.auctionList = [];
if (object.params !== undefined && object.params !== null) { if (object.params !== undefined && object.params !== null) {
message.params = Params.fromPartial(object.params); message.params = Params.fromPartial(object.params);
} else { } else {
message.params = undefined; 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; return message;
}, },
}; };

View File

@ -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>): 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> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
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();
}

View File

@ -1,6 +1,12 @@
/* eslint-disable */ /* eslint-disable */
import { Reader, Writer } from "protobufjs/minimal"; import { Reader, Writer } from "protobufjs/minimal";
import { Params } from "../cosmostest/params"; 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"; export const protobufPackage = "cosmostest.cosmostest";
@ -13,6 +19,29 @@ export interface QueryParamsResponse {
params: Params | undefined; 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 = {}; const baseQueryParamsRequest: object = {};
export const QueryParamsRequest = { 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>
): 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>
): 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>
): 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>
): 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>
): 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>
): 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. */ /** Query defines the gRPC querier service. */
export interface Query { export interface Query {
/** Parameters queries the parameters of the module. */ /** Parameters queries the parameters of the module. */
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>; Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
/** Queries a NextAuction by index. */
NextAuction(
request: QueryGetNextAuctionRequest
): Promise<QueryGetNextAuctionResponse>;
/** Queries a Auction by index. */
Auction(request: QueryGetAuctionRequest): Promise<QueryGetAuctionResponse>;
/** Queries a list of Auction items. */
AuctionAll(request: QueryAllAuctionRequest): Promise<QueryAllAuctionResponse>;
} }
export class QueryClientImpl implements Query { export class QueryClientImpl implements Query {
@ -130,6 +584,46 @@ export class QueryClientImpl implements Query {
); );
return promise.then((data) => QueryParamsResponse.decode(new Reader(data))); return promise.then((data) => QueryParamsResponse.decode(new Reader(data)));
} }
NextAuction(
request: QueryGetNextAuctionRequest
): Promise<QueryGetNextAuctionResponse> {
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<QueryGetAuctionResponse> {
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<QueryAllAuctionResponse> {
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 { interface Rpc {

View File

@ -25,6 +25,9 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
} }
cmd.AddCommand(CmdQueryParams()) cmd.AddCommand(CmdQueryParams())
cmd.AddCommand(CmdShowNextAuction())
cmd.AddCommand(CmdListAuction())
cmd.AddCommand(CmdShowAuction())
// this line is used by starport scaffolding # 1 // this line is used by starport scaffolding # 1
return cmd return cmd

View File

@ -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
}

View File

@ -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),
)
})
}

View File

@ -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
}

View File

@ -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),
)
}
})
}
}

View File

@ -9,6 +9,14 @@ import (
// InitGenesis initializes the capability module's state from a provided genesis // InitGenesis initializes the capability module's state from a provided genesis
// state. // state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { 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 // this line is used by starport scaffolding # genesis/module/init
k.SetParams(ctx, genState.Params) k.SetParams(ctx, genState.Params)
} }
@ -18,6 +26,12 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
genesis := types.DefaultGenesis() genesis := types.DefaultGenesis()
genesis.Params = k.GetParams(ctx) 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 // this line is used by starport scaffolding # genesis/module/export
return genesis return genesis

View File

@ -15,6 +15,17 @@ func TestGenesis(t *testing.T) {
genesisState := types.GenesisState{ genesisState := types.GenesisState{
Params: types.DefaultParams(), 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 // this line is used by starport scaffolding # genesis/test/state
} }
@ -26,5 +37,7 @@ func TestGenesis(t *testing.T) {
nullify.Fill(&genesisState) nullify.Fill(&genesisState)
nullify.Fill(got) 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 // this line is used by starport scaffolding # genesis/test/assert
} }

View File

@ -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
}

View File

@ -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)),
)
}

View File

@ -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
}

View File

@ -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"))
})
}

View File

@ -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
}

View File

@ -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),
)
}
})
}
}

View File

@ -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})
}

View File

@ -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)
}

View File

@ -1,9 +1,9 @@
package cosmostest package cosmostest
import ( import (
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
// this line is used by starport scaffolding # 1
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime" "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. // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { 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. // GetTxCmd returns the capability module's root tx command.

View File

@ -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")
)

View File

@ -1,7 +1,7 @@
package types package types
import ( import (
// this line is used by starport scaffolding # genesis/types/import "fmt"
) )
// DefaultIndex is the default capability global index // DefaultIndex is the default capability global index
@ -10,6 +10,8 @@ const DefaultIndex uint64 = 1
// DefaultGenesis returns the default Capability genesis state // DefaultGenesis returns the default Capability genesis state
func DefaultGenesis() *GenesisState { func DefaultGenesis() *GenesisState {
return &GenesisState{ return &GenesisState{
NextAuction: nil,
AuctionList: []Auction{},
// this line is used by starport scaffolding # genesis/types/default // this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(), Params: DefaultParams(),
} }
@ -18,6 +20,16 @@ func DefaultGenesis() *GenesisState {
// Validate performs basic genesis state validation returning an error upon any // Validate performs basic genesis state validation returning an error upon any
// failure. // failure.
func (gs GenesisState) Validate() error { 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 // this line is used by starport scaffolding # genesis/types/validate
return gs.Params.Validate() return gs.Params.Validate()

View File

@ -25,7 +25,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the cosmostest module's genesis state. // GenesisState defines the cosmostest module's genesis state.
type GenesisState struct { 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{} } func (m *GenesisState) Reset() { *m = GenesisState{} }
@ -68,6 +70,20 @@ func (m *GenesisState) GetParams() Params {
return 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() { func init() {
proto.RegisterType((*GenesisState)(nil), "cosmostest.cosmostest.GenesisState") proto.RegisterType((*GenesisState)(nil), "cosmostest.cosmostest.GenesisState")
} }
@ -75,18 +91,23 @@ func init() {
func init() { proto.RegisterFile("cosmostest/genesis.proto", fileDescriptor_78c0d8c25fe3d9a9) } func init() { proto.RegisterFile("cosmostest/genesis.proto", fileDescriptor_78c0d8c25fe3d9a9) }
var fileDescriptor_78c0d8c25fe3d9a9 = []byte{ 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, 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, 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, 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, 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, 0xb9, 0x50, 0x53, 0xa4, 0x64, 0x91, 0x24, 0xf2, 0x52, 0x2b, 0x4a, 0xe2, 0x13, 0x4b, 0x93, 0x4b,
0x59, 0x73, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x64, 0xf5, 0xb0, 0x5a, 0x32, 0xf3, 0xf3, 0xa0, 0xd2, 0xc8, 0xd6, 0xa3, 0xc8, 0x28, 0xdd, 0x64, 0xe4, 0xe2, 0x71, 0x87,
0xa3, 0x17, 0x00, 0x56, 0xe4, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54, 0x8b, 0x93, 0xc5, 0x38, 0x28, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0xc8, 0x9a, 0x8b, 0x0d, 0x62, 0xb2, 0x04, 0xa3, 0x02,
0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xa3, 0x06, 0xb7, 0x91, 0xac, 0x1e, 0x56, 0x07, 0xea, 0x05, 0x80, 0x15, 0x39, 0xb1, 0x9c, 0xb8,
0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xc9, 0x41, 0xb4, 0xea, 0x82, 0x1d, 0x27, 0xcf, 0x10, 0x04, 0xd5, 0x22, 0xe4, 0xc2, 0xc5, 0x0d, 0xb2, 0xdd, 0x11, 0x62, 0x85, 0x04,
0x50, 0xa1, 0x8f, 0xe4, 0x9a, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x6b, 0x8c, 0x01, 0x13, 0xd8, 0x04, 0x25, 0x1c, 0x26, 0xf8, 0x21, 0x54, 0x06, 0x21, 0x6b, 0x13, 0x72, 0xe3, 0xe2,
0x01, 0x00, 0x00, 0xff, 0xff, 0x74, 0xa7, 0xf1, 0xb2, 0xef, 0x00, 0x00, 0x00, 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) { func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@ -109,6 +130,32 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = 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]) size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -141,6 +188,16 @@ func (m *GenesisState) Size() (n int) {
_ = l _ = l
l = m.Params.Size() l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l)) 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 return n
} }
@ -212,6 +269,76 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex 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: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:]) skippy, err := skipGenesis(dAtA[iNdEx:])

View File

@ -19,13 +19,38 @@ func TestGenesisState_Validate(t *testing.T) {
valid: true, valid: true,
}, },
{ {
desc: "valid genesis state", desc: "valid genesis state",
genState: &types.GenesisState{ 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 // this line is used by starport scaffolding # types/genesis/validField
}, },
valid: true, 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 // this line is used by starport scaffolding # types/genesis/testcase
} { } {
t.Run(tc.desc, func(t *testing.T) { t.Run(tc.desc, func(t *testing.T) {

View File

@ -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
}

View File

@ -20,3 +20,7 @@ const (
func KeyPrefix(p string) []byte { func KeyPrefix(p string) []byte {
return []byte(p) return []byte(p)
} }
const (
NextAuctionKey = "NextAuction-value-"
)

View File

@ -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")
)

File diff suppressed because it is too large Load Diff

View File

@ -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". // RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly. // UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // 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 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 return nil
} }
var ( 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_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 ( var (
forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_NextAuction_0 = runtime.ForwardResponseMessage
forward_Query_Auction_0 = runtime.ForwardResponseMessage
forward_Query_AuctionAll_0 = runtime.ForwardResponseMessage
) )