mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 05:44:26 -08:00
scaffold base auction & nextAuction types
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
||||
|
||||
import { Auction } from "./module/types/cosmostest/auction"
|
||||
import { NextAuction } from "./module/types/cosmostest/next_auction"
|
||||
import { Params } from "./module/types/cosmostest/params"
|
||||
|
||||
|
||||
export { Params };
|
||||
export { Auction, NextAuction, Params };
|
||||
|
||||
async function initTxClient(vuexGetters) {
|
||||
return await txClient(vuexGetters['common/wallet/signer'], {
|
||||
@@ -42,8 +44,13 @@ function getStructure(template) {
|
||||
const getDefaultState = () => {
|
||||
return {
|
||||
Params: {},
|
||||
NextAuction: {},
|
||||
Auction: {},
|
||||
AuctionAll: {},
|
||||
|
||||
_Structure: {
|
||||
Auction: getStructure(Auction.fromPartial({})),
|
||||
NextAuction: getStructure(NextAuction.fromPartial({})),
|
||||
Params: getStructure(Params.fromPartial({})),
|
||||
|
||||
},
|
||||
@@ -79,6 +86,24 @@ export default {
|
||||
}
|
||||
return state.Params[JSON.stringify(params)] ?? {}
|
||||
},
|
||||
getNextAuction: (state) => (params = { params: {}}) => {
|
||||
if (!(<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) => {
|
||||
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)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,47 @@
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
export interface CosmostestAuction {
|
||||
index?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
bids?: string;
|
||||
highestBid?: string;
|
||||
}
|
||||
|
||||
export interface CosmostestNextAuction {
|
||||
/** @format uint64 */
|
||||
auctionId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Params defines the parameters for the module.
|
||||
*/
|
||||
export type CosmostestParams = object;
|
||||
|
||||
export interface CosmostestQueryAllAuctionResponse {
|
||||
auction?: CosmostestAuction[];
|
||||
|
||||
/**
|
||||
* PageResponse is to be embedded in gRPC response messages where the
|
||||
* corresponding request message has used PageRequest.
|
||||
*
|
||||
* message SomeResponse {
|
||||
* repeated Bar results = 1;
|
||||
* PageResponse page = 2;
|
||||
* }
|
||||
*/
|
||||
pagination?: V1Beta1PageResponse;
|
||||
}
|
||||
|
||||
export interface CosmostestQueryGetAuctionResponse {
|
||||
auction?: CosmostestAuction;
|
||||
}
|
||||
|
||||
export interface CosmostestQueryGetNextAuctionResponse {
|
||||
NextAuction?: CosmostestNextAuction;
|
||||
}
|
||||
|
||||
/**
|
||||
* QueryParamsResponse is response type for the Query/Params RPC method.
|
||||
*/
|
||||
@@ -33,6 +69,69 @@ export interface RpcStatus {
|
||||
details?: ProtobufAny[];
|
||||
}
|
||||
|
||||
/**
|
||||
* message SomeRequest {
|
||||
Foo some_parameter = 1;
|
||||
PageRequest pagination = 2;
|
||||
}
|
||||
*/
|
||||
export interface V1Beta1PageRequest {
|
||||
/**
|
||||
* key is a value returned in PageResponse.next_key to begin
|
||||
* querying the next page most efficiently. Only one of offset or key
|
||||
* should be set.
|
||||
* @format byte
|
||||
*/
|
||||
key?: string;
|
||||
|
||||
/**
|
||||
* offset is a numeric offset that can be used when key is unavailable.
|
||||
* It is less efficient than using key. Only one of offset or key should
|
||||
* be set.
|
||||
* @format uint64
|
||||
*/
|
||||
offset?: string;
|
||||
|
||||
/**
|
||||
* limit is the total number of results to be returned in the result page.
|
||||
* If left empty it will default to a value to be set by each app.
|
||||
* @format uint64
|
||||
*/
|
||||
limit?: string;
|
||||
|
||||
/**
|
||||
* count_total is set to true to indicate that the result set should include
|
||||
* a count of the total number of items available for pagination in UIs.
|
||||
* count_total is only respected when offset is used. It is ignored when key
|
||||
* is set.
|
||||
*/
|
||||
count_total?: boolean;
|
||||
|
||||
/**
|
||||
* reverse is set to true if results are to be returned in the descending order.
|
||||
*
|
||||
* Since: cosmos-sdk 0.43
|
||||
*/
|
||||
reverse?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* PageResponse is to be embedded in gRPC response messages where the
|
||||
corresponding request message has used PageRequest.
|
||||
|
||||
message SomeResponse {
|
||||
repeated Bar results = 1;
|
||||
PageResponse page = 2;
|
||||
}
|
||||
*/
|
||||
export interface V1Beta1PageResponse {
|
||||
/** @format byte */
|
||||
next_key?: string;
|
||||
|
||||
/** @format uint64 */
|
||||
total?: string;
|
||||
}
|
||||
|
||||
export type QueryParamsType = Record<string | number, any>;
|
||||
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
|
||||
*/
|
||||
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
|
||||
*
|
||||
|
||||
@@ -38,6 +38,12 @@ export interface PageRequest {
|
||||
* is set.
|
||||
*/
|
||||
count_total: boolean;
|
||||
/**
|
||||
* reverse is set to true if results are to be returned in the descending order.
|
||||
*
|
||||
* Since: cosmos-sdk 0.43
|
||||
*/
|
||||
reverse: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +68,12 @@ export interface PageResponse {
|
||||
total: number;
|
||||
}
|
||||
|
||||
const basePageRequest: object = { offset: 0, limit: 0, count_total: false };
|
||||
const basePageRequest: object = {
|
||||
offset: 0,
|
||||
limit: 0,
|
||||
count_total: false,
|
||||
reverse: false,
|
||||
};
|
||||
|
||||
export const PageRequest = {
|
||||
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
|
||||
@@ -78,6 +89,9 @@ export const PageRequest = {
|
||||
if (message.count_total === true) {
|
||||
writer.uint32(32).bool(message.count_total);
|
||||
}
|
||||
if (message.reverse === true) {
|
||||
writer.uint32(40).bool(message.reverse);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
@@ -100,6 +114,9 @@ export const PageRequest = {
|
||||
case 4:
|
||||
message.count_total = reader.bool();
|
||||
break;
|
||||
case 5:
|
||||
message.reverse = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
@@ -128,6 +145,11 @@ export const PageRequest = {
|
||||
} else {
|
||||
message.count_total = false;
|
||||
}
|
||||
if (object.reverse !== undefined && object.reverse !== null) {
|
||||
message.reverse = Boolean(object.reverse);
|
||||
} else {
|
||||
message.reverse = false;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
@@ -141,6 +163,7 @@ export const PageRequest = {
|
||||
message.limit !== undefined && (obj.limit = message.limit);
|
||||
message.count_total !== undefined &&
|
||||
(obj.count_total = message.count_total);
|
||||
message.reverse !== undefined && (obj.reverse = message.reverse);
|
||||
return obj;
|
||||
},
|
||||
|
||||
@@ -166,6 +189,11 @@ export const PageRequest = {
|
||||
} else {
|
||||
message.count_total = false;
|
||||
}
|
||||
if (object.reverse !== undefined && object.reverse !== null) {
|
||||
message.reverse = object.reverse;
|
||||
} else {
|
||||
message.reverse = false;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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>;
|
||||
@@ -1,13 +1,17 @@
|
||||
/* eslint-disable */
|
||||
import { Params } from "../cosmostest/params";
|
||||
import { NextAuction } from "../cosmostest/next_auction";
|
||||
import { Auction } from "../cosmostest/auction";
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmostest.cosmostest";
|
||||
|
||||
/** GenesisState defines the cosmostest module's genesis state. */
|
||||
export interface GenesisState {
|
||||
/** this line is used by starport scaffolding # genesis/proto/state */
|
||||
params: Params | undefined;
|
||||
nextAuction: NextAuction | undefined;
|
||||
/** this line is used by starport scaffolding # genesis/proto/state */
|
||||
auctionList: Auction[];
|
||||
}
|
||||
|
||||
const baseGenesisState: object = {};
|
||||
@@ -17,6 +21,15 @@ export const GenesisState = {
|
||||
if (message.params !== undefined) {
|
||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.nextAuction !== undefined) {
|
||||
NextAuction.encode(
|
||||
message.nextAuction,
|
||||
writer.uint32(18).fork()
|
||||
).ldelim();
|
||||
}
|
||||
for (const v of message.auctionList) {
|
||||
Auction.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
@@ -24,12 +37,19 @@ export const GenesisState = {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseGenesisState } as GenesisState;
|
||||
message.auctionList = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.params = Params.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.nextAuction = NextAuction.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 3:
|
||||
message.auctionList.push(Auction.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
@@ -40,11 +60,22 @@ export const GenesisState = {
|
||||
|
||||
fromJSON(object: any): GenesisState {
|
||||
const message = { ...baseGenesisState } as GenesisState;
|
||||
message.auctionList = [];
|
||||
if (object.params !== undefined && object.params !== null) {
|
||||
message.params = Params.fromJSON(object.params);
|
||||
} else {
|
||||
message.params = undefined;
|
||||
}
|
||||
if (object.nextAuction !== undefined && object.nextAuction !== null) {
|
||||
message.nextAuction = NextAuction.fromJSON(object.nextAuction);
|
||||
} else {
|
||||
message.nextAuction = undefined;
|
||||
}
|
||||
if (object.auctionList !== undefined && object.auctionList !== null) {
|
||||
for (const e of object.auctionList) {
|
||||
message.auctionList.push(Auction.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
@@ -52,16 +83,38 @@ export const GenesisState = {
|
||||
const obj: any = {};
|
||||
message.params !== undefined &&
|
||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
||||
message.nextAuction !== undefined &&
|
||||
(obj.nextAuction = message.nextAuction
|
||||
? NextAuction.toJSON(message.nextAuction)
|
||||
: undefined);
|
||||
if (message.auctionList) {
|
||||
obj.auctionList = message.auctionList.map((e) =>
|
||||
e ? Auction.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.auctionList = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial(object: DeepPartial<GenesisState>): GenesisState {
|
||||
const message = { ...baseGenesisState } as GenesisState;
|
||||
message.auctionList = [];
|
||||
if (object.params !== undefined && object.params !== null) {
|
||||
message.params = Params.fromPartial(object.params);
|
||||
} else {
|
||||
message.params = undefined;
|
||||
}
|
||||
if (object.nextAuction !== undefined && object.nextAuction !== null) {
|
||||
message.nextAuction = NextAuction.fromPartial(object.nextAuction);
|
||||
} else {
|
||||
message.nextAuction = undefined;
|
||||
}
|
||||
if (object.auctionList !== undefined && object.auctionList !== null) {
|
||||
for (const e of object.auctionList) {
|
||||
message.auctionList.push(Auction.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -1,6 +1,12 @@
|
||||
/* eslint-disable */
|
||||
import { Reader, Writer } from "protobufjs/minimal";
|
||||
import { Params } from "../cosmostest/params";
|
||||
import { NextAuction } from "../cosmostest/next_auction";
|
||||
import { Auction } from "../cosmostest/auction";
|
||||
import {
|
||||
PageRequest,
|
||||
PageResponse,
|
||||
} from "../cosmos/base/query/v1beta1/pagination";
|
||||
|
||||
export const protobufPackage = "cosmostest.cosmostest";
|
||||
|
||||
@@ -13,6 +19,29 @@ export interface QueryParamsResponse {
|
||||
params: Params | undefined;
|
||||
}
|
||||
|
||||
export interface QueryGetNextAuctionRequest {}
|
||||
|
||||
export interface QueryGetNextAuctionResponse {
|
||||
NextAuction: NextAuction | undefined;
|
||||
}
|
||||
|
||||
export interface QueryGetAuctionRequest {
|
||||
index: string;
|
||||
}
|
||||
|
||||
export interface QueryGetAuctionResponse {
|
||||
auction: Auction | undefined;
|
||||
}
|
||||
|
||||
export interface QueryAllAuctionRequest {
|
||||
pagination: PageRequest | undefined;
|
||||
}
|
||||
|
||||
export interface QueryAllAuctionResponse {
|
||||
auction: Auction[];
|
||||
pagination: PageResponse | undefined;
|
||||
}
|
||||
|
||||
const baseQueryParamsRequest: object = {};
|
||||
|
||||
export const QueryParamsRequest = {
|
||||
@@ -110,10 +139,435 @@ export const QueryParamsResponse = {
|
||||
},
|
||||
};
|
||||
|
||||
const baseQueryGetNextAuctionRequest: object = {};
|
||||
|
||||
export const QueryGetNextAuctionRequest = {
|
||||
encode(
|
||||
_: QueryGetNextAuctionRequest,
|
||||
writer: Writer = Writer.create()
|
||||
): Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetNextAuctionRequest {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = {
|
||||
...baseQueryGetNextAuctionRequest,
|
||||
} as QueryGetNextAuctionRequest;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): QueryGetNextAuctionRequest {
|
||||
const message = {
|
||||
...baseQueryGetNextAuctionRequest,
|
||||
} as QueryGetNextAuctionRequest;
|
||||
return message;
|
||||
},
|
||||
|
||||
toJSON(_: QueryGetNextAuctionRequest): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial(
|
||||
_: DeepPartial<QueryGetNextAuctionRequest>
|
||||
): 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. */
|
||||
export interface Query {
|
||||
/** Parameters queries the parameters of the module. */
|
||||
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 {
|
||||
@@ -130,6 +584,46 @@ export class QueryClientImpl implements Query {
|
||||
);
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user