add bid arr in auction type

This commit is contained in:
2022-08-28 02:32:06 +00:00
parent 4246f768a1
commit fcc85ec520
6 changed files with 166 additions and 52 deletions

View File

@@ -13,14 +13,17 @@ export interface CosmostestAuction {
index?: string;
name?: string;
description?: string;
/** @format int64 */
bids?: number;
bids?: CosmostestBid[];
/** @format int64 */
highestBid?: number;
}
export interface CosmostestBid {
owner?: string;
amount?: string;
}
export interface CosmostestMsgNewAuctionResponse {
auctionId?: string;
}
@@ -114,6 +117,13 @@ export interface V1Beta1PageRequest {
* 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;
}
/**
@@ -343,6 +353,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>

View File

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

View File

@@ -1,4 +1,5 @@
/* eslint-disable */
import { Bid } from "../cosmostest/bid";
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmostest.cosmostest";
@@ -7,7 +8,8 @@ export interface Auction {
index: string;
name: string;
description: string;
bids: number;
bids: Bid[];
/** INDEX of highest bid */
highestBid: number;
}
@@ -15,7 +17,6 @@ const baseAuction: object = {
index: "",
name: "",
description: "",
bids: 0,
highestBid: 0,
};
@@ -30,8 +31,8 @@ export const Auction = {
if (message.description !== "") {
writer.uint32(26).string(message.description);
}
if (message.bids !== 0) {
writer.uint32(32).uint32(message.bids);
for (const v of message.bids) {
Bid.encode(v!, writer.uint32(34).fork()).ldelim();
}
if (message.highestBid !== 0) {
writer.uint32(40).uint32(message.highestBid);
@@ -43,6 +44,7 @@ export const Auction = {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseAuction } as Auction;
message.bids = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -56,7 +58,7 @@ export const Auction = {
message.description = reader.string();
break;
case 4:
message.bids = reader.uint32();
message.bids.push(Bid.decode(reader, reader.uint32()));
break;
case 5:
message.highestBid = reader.uint32();
@@ -71,6 +73,7 @@ export const Auction = {
fromJSON(object: any): Auction {
const message = { ...baseAuction } as Auction;
message.bids = [];
if (object.index !== undefined && object.index !== null) {
message.index = String(object.index);
} else {
@@ -87,9 +90,9 @@ export const Auction = {
message.description = "";
}
if (object.bids !== undefined && object.bids !== null) {
message.bids = Number(object.bids);
} else {
message.bids = 0;
for (const e of object.bids) {
message.bids.push(Bid.fromJSON(e));
}
}
if (object.highestBid !== undefined && object.highestBid !== null) {
message.highestBid = Number(object.highestBid);
@@ -105,13 +108,18 @@ export const Auction = {
message.name !== undefined && (obj.name = message.name);
message.description !== undefined &&
(obj.description = message.description);
message.bids !== undefined && (obj.bids = message.bids);
if (message.bids) {
obj.bids = message.bids.map((e) => (e ? Bid.toJSON(e) : undefined));
} else {
obj.bids = [];
}
message.highestBid !== undefined && (obj.highestBid = message.highestBid);
return obj;
},
fromPartial(object: DeepPartial<Auction>): Auction {
const message = { ...baseAuction } as Auction;
message.bids = [];
if (object.index !== undefined && object.index !== null) {
message.index = object.index;
} else {
@@ -128,9 +136,9 @@ export const Auction = {
message.description = "";
}
if (object.bids !== undefined && object.bids !== null) {
message.bids = object.bids;
} else {
message.bids = 0;
for (const e of object.bids) {
message.bids.push(Bid.fromPartial(e));
}
}
if (object.highestBid !== undefined && object.highestBid !== null) {
message.highestBid = object.highestBid;