mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 04:44:25 -08:00
scaffold bid type
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { txClient, queryClient, MissingWalletError , registry} from './module'
|
||||
|
||||
import { Auction } from "./module/types/cosmostest/auction"
|
||||
import { Bid } from "./module/types/cosmostest/bid"
|
||||
import { NextAuction } from "./module/types/cosmostest/next_auction"
|
||||
import { Params } from "./module/types/cosmostest/params"
|
||||
|
||||
|
||||
export { Auction, NextAuction, Params };
|
||||
export { Auction, Bid, NextAuction, Params };
|
||||
|
||||
async function initTxClient(vuexGetters) {
|
||||
return await txClient(vuexGetters['common/wallet/signer'], {
|
||||
@@ -50,6 +51,7 @@ const getDefaultState = () => {
|
||||
|
||||
_Structure: {
|
||||
Auction: getStructure(Auction.fromPartial({})),
|
||||
Bid: getStructure(Bid.fromPartial({})),
|
||||
NextAuction: getStructure(NextAuction.fromPartial({})),
|
||||
Params: getStructure(Params.fromPartial({})),
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/* eslint-disable */
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmostest.cosmostest";
|
||||
|
||||
export interface Bid {
|
||||
owner: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
const baseBid: object = { owner: "", amount: "" };
|
||||
|
||||
export const Bid = {
|
||||
encode(message: Bid, writer: Writer = Writer.create()): Writer {
|
||||
if (message.owner !== "") {
|
||||
writer.uint32(10).string(message.owner);
|
||||
}
|
||||
if (message.amount !== "") {
|
||||
writer.uint32(18).string(message.amount);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: Reader | Uint8Array, length?: number): Bid {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseBid } as Bid;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.owner = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.amount = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Bid {
|
||||
const message = { ...baseBid } as Bid;
|
||||
if (object.owner !== undefined && object.owner !== null) {
|
||||
message.owner = String(object.owner);
|
||||
} else {
|
||||
message.owner = "";
|
||||
}
|
||||
if (object.amount !== undefined && object.amount !== null) {
|
||||
message.amount = String(object.amount);
|
||||
} else {
|
||||
message.amount = "";
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
toJSON(message: Bid): unknown {
|
||||
const obj: any = {};
|
||||
message.owner !== undefined && (obj.owner = message.owner);
|
||||
message.amount !== undefined && (obj.amount = message.amount);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial(object: DeepPartial<Bid>): Bid {
|
||||
const message = { ...baseBid } as Bid;
|
||||
if (object.owner !== undefined && object.owner !== null) {
|
||||
message.owner = object.owner;
|
||||
} else {
|
||||
message.owner = "";
|
||||
}
|
||||
if (object.amount !== undefined && object.amount !== null) {
|
||||
message.amount = object.amount;
|
||||
} else {
|
||||
message.amount = "";
|
||||
}
|
||||
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>;
|
||||
Reference in New Issue
Block a user