forked from cerc-io/registry-sdk
Update proto files and regenerate ts bindings (#1)
* Update proto files * Update script to generate typescript definitions * Generate typescript definitions from protobuf files * Cleanup unnecessary proto files --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
1 parent
73bef00dd3
commit
ce3cfbd457
70 files changed
+17932
-1724
No files matched your search
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
export const protobufPackage = "amino";
|
||||
@@ -0,0 +1,83 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.auction.module.v1";
|
||||
|
||||
/**
|
||||
* Module is the app config object of the module.
|
||||
* Learn more: https://docs.cosmos.network/main/building-modules/depinject
|
||||
*/
|
||||
export interface Module {}
|
||||
|
||||
function createBaseModule(): Module {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const Module = {
|
||||
encode(_: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Module {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseModule();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Module {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: Module): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Module>, I>>(_: I): Module {
|
||||
const message = createBaseModule();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
@@ -0,0 +1,739 @@
|
||||
/* eslint-disable */
|
||||
import { Duration } from "../../../google/protobuf/duration";
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Timestamp } from "../../../google/protobuf/timestamp";
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.auction.v1";
|
||||
|
||||
/** Params defines the auction module parameters */
|
||||
export interface Params {
|
||||
/** Duration of the commits phase in seconds */
|
||||
commitsDuration?: Duration;
|
||||
/** Duration of the reveals phase in seconds */
|
||||
revealsDuration?: Duration;
|
||||
/** Commit fees */
|
||||
commitFee?: Coin;
|
||||
/** Reveal fees */
|
||||
revealFee?: Coin;
|
||||
/** Minimum acceptable bid amount */
|
||||
minimumBid?: Coin;
|
||||
}
|
||||
|
||||
/** Auction represents a sealed-bid on-chain auction */
|
||||
export interface Auction {
|
||||
id: string;
|
||||
status: string;
|
||||
/** Address of the creator of the auction */
|
||||
ownerAddress: string;
|
||||
/** Timestamp at which the auction was created */
|
||||
createTime?: Date;
|
||||
/** Timestamp at which the commits phase concluded */
|
||||
commitsEndTime?: Date;
|
||||
/** Timestamp at which the reveals phase concluded */
|
||||
revealsEndTime?: Date;
|
||||
/**
|
||||
* Commit and reveal fees must both be paid when committing a bid
|
||||
* Reveal fee is returned only if the bid is revealed
|
||||
*/
|
||||
commitFee?: Coin;
|
||||
revealFee?: Coin;
|
||||
/** Minimum acceptable bid amount for a valid commit */
|
||||
minimumBid?: Coin;
|
||||
/** Address of the winner */
|
||||
winnerAddress: string;
|
||||
/** Winning bid, i.e., the highest bid */
|
||||
winningBid?: Coin;
|
||||
/** Amount the winner pays, i.e. the second highest auction */
|
||||
winningPrice?: Coin;
|
||||
}
|
||||
|
||||
export interface Auctions {
|
||||
auctions: Auction[];
|
||||
}
|
||||
|
||||
/** Bid represents a sealed bid (commit) made during the auction */
|
||||
export interface Bid {
|
||||
auctionId: string;
|
||||
bidderAddress: string;
|
||||
status: string;
|
||||
commitHash: string;
|
||||
commitTime?: Date;
|
||||
commitFee?: Coin;
|
||||
revealTime?: Date;
|
||||
revealFee?: Coin;
|
||||
bidAmount?: Coin;
|
||||
}
|
||||
|
||||
function createBaseParams(): Params {
|
||||
return {
|
||||
commitsDuration: undefined,
|
||||
revealsDuration: undefined,
|
||||
commitFee: undefined,
|
||||
revealFee: undefined,
|
||||
minimumBid: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Params = {
|
||||
encode(
|
||||
message: Params,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.commitsDuration !== undefined) {
|
||||
Duration.encode(
|
||||
message.commitsDuration,
|
||||
writer.uint32(10).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.revealsDuration !== undefined) {
|
||||
Duration.encode(
|
||||
message.revealsDuration,
|
||||
writer.uint32(18).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.commitFee !== undefined) {
|
||||
Coin.encode(message.commitFee, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
if (message.revealFee !== undefined) {
|
||||
Coin.encode(message.revealFee, writer.uint32(34).fork()).ldelim();
|
||||
}
|
||||
if (message.minimumBid !== undefined) {
|
||||
Coin.encode(message.minimumBid, writer.uint32(42).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Params {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseParams();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.commitsDuration = Duration.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.revealsDuration = Duration.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 3:
|
||||
message.commitFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 4:
|
||||
message.revealFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 5:
|
||||
message.minimumBid = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Params {
|
||||
return {
|
||||
commitsDuration: isSet(object.commitsDuration)
|
||||
? Duration.fromJSON(object.commitsDuration)
|
||||
: undefined,
|
||||
revealsDuration: isSet(object.revealsDuration)
|
||||
? Duration.fromJSON(object.revealsDuration)
|
||||
: undefined,
|
||||
commitFee: isSet(object.commitFee)
|
||||
? Coin.fromJSON(object.commitFee)
|
||||
: undefined,
|
||||
revealFee: isSet(object.revealFee)
|
||||
? Coin.fromJSON(object.revealFee)
|
||||
: undefined,
|
||||
minimumBid: isSet(object.minimumBid)
|
||||
? Coin.fromJSON(object.minimumBid)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Params): unknown {
|
||||
const obj: any = {};
|
||||
message.commitsDuration !== undefined &&
|
||||
(obj.commitsDuration = message.commitsDuration
|
||||
? Duration.toJSON(message.commitsDuration)
|
||||
: undefined);
|
||||
message.revealsDuration !== undefined &&
|
||||
(obj.revealsDuration = message.revealsDuration
|
||||
? Duration.toJSON(message.revealsDuration)
|
||||
: undefined);
|
||||
message.commitFee !== undefined &&
|
||||
(obj.commitFee = message.commitFee
|
||||
? Coin.toJSON(message.commitFee)
|
||||
: undefined);
|
||||
message.revealFee !== undefined &&
|
||||
(obj.revealFee = message.revealFee
|
||||
? Coin.toJSON(message.revealFee)
|
||||
: undefined);
|
||||
message.minimumBid !== undefined &&
|
||||
(obj.minimumBid = message.minimumBid
|
||||
? Coin.toJSON(message.minimumBid)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Params>, I>>(object: I): Params {
|
||||
const message = createBaseParams();
|
||||
message.commitsDuration =
|
||||
object.commitsDuration !== undefined && object.commitsDuration !== null
|
||||
? Duration.fromPartial(object.commitsDuration)
|
||||
: undefined;
|
||||
message.revealsDuration =
|
||||
object.revealsDuration !== undefined && object.revealsDuration !== null
|
||||
? Duration.fromPartial(object.revealsDuration)
|
||||
: undefined;
|
||||
message.commitFee =
|
||||
object.commitFee !== undefined && object.commitFee !== null
|
||||
? Coin.fromPartial(object.commitFee)
|
||||
: undefined;
|
||||
message.revealFee =
|
||||
object.revealFee !== undefined && object.revealFee !== null
|
||||
? Coin.fromPartial(object.revealFee)
|
||||
: undefined;
|
||||
message.minimumBid =
|
||||
object.minimumBid !== undefined && object.minimumBid !== null
|
||||
? Coin.fromPartial(object.minimumBid)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseAuction(): Auction {
|
||||
return {
|
||||
id: "",
|
||||
status: "",
|
||||
ownerAddress: "",
|
||||
createTime: undefined,
|
||||
commitsEndTime: undefined,
|
||||
revealsEndTime: undefined,
|
||||
commitFee: undefined,
|
||||
revealFee: undefined,
|
||||
minimumBid: undefined,
|
||||
winnerAddress: "",
|
||||
winningBid: undefined,
|
||||
winningPrice: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Auction = {
|
||||
encode(
|
||||
message: Auction,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.status !== "") {
|
||||
writer.uint32(18).string(message.status);
|
||||
}
|
||||
if (message.ownerAddress !== "") {
|
||||
writer.uint32(26).string(message.ownerAddress);
|
||||
}
|
||||
if (message.createTime !== undefined) {
|
||||
Timestamp.encode(
|
||||
toTimestamp(message.createTime),
|
||||
writer.uint32(34).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.commitsEndTime !== undefined) {
|
||||
Timestamp.encode(
|
||||
toTimestamp(message.commitsEndTime),
|
||||
writer.uint32(42).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.revealsEndTime !== undefined) {
|
||||
Timestamp.encode(
|
||||
toTimestamp(message.revealsEndTime),
|
||||
writer.uint32(50).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.commitFee !== undefined) {
|
||||
Coin.encode(message.commitFee, writer.uint32(58).fork()).ldelim();
|
||||
}
|
||||
if (message.revealFee !== undefined) {
|
||||
Coin.encode(message.revealFee, writer.uint32(66).fork()).ldelim();
|
||||
}
|
||||
if (message.minimumBid !== undefined) {
|
||||
Coin.encode(message.minimumBid, writer.uint32(74).fork()).ldelim();
|
||||
}
|
||||
if (message.winnerAddress !== "") {
|
||||
writer.uint32(82).string(message.winnerAddress);
|
||||
}
|
||||
if (message.winningBid !== undefined) {
|
||||
Coin.encode(message.winningBid, writer.uint32(90).fork()).ldelim();
|
||||
}
|
||||
if (message.winningPrice !== undefined) {
|
||||
Coin.encode(message.winningPrice, writer.uint32(98).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Auction {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAuction();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.id = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.status = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.ownerAddress = reader.string();
|
||||
break;
|
||||
case 4:
|
||||
message.createTime = fromTimestamp(
|
||||
Timestamp.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
case 5:
|
||||
message.commitsEndTime = fromTimestamp(
|
||||
Timestamp.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
case 6:
|
||||
message.revealsEndTime = fromTimestamp(
|
||||
Timestamp.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
case 7:
|
||||
message.commitFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 8:
|
||||
message.revealFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 9:
|
||||
message.minimumBid = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 10:
|
||||
message.winnerAddress = reader.string();
|
||||
break;
|
||||
case 11:
|
||||
message.winningBid = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 12:
|
||||
message.winningPrice = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Auction {
|
||||
return {
|
||||
id: isSet(object.id) ? String(object.id) : "",
|
||||
status: isSet(object.status) ? String(object.status) : "",
|
||||
ownerAddress: isSet(object.ownerAddress)
|
||||
? String(object.ownerAddress)
|
||||
: "",
|
||||
createTime: isSet(object.createTime)
|
||||
? fromJsonTimestamp(object.createTime)
|
||||
: undefined,
|
||||
commitsEndTime: isSet(object.commitsEndTime)
|
||||
? fromJsonTimestamp(object.commitsEndTime)
|
||||
: undefined,
|
||||
revealsEndTime: isSet(object.revealsEndTime)
|
||||
? fromJsonTimestamp(object.revealsEndTime)
|
||||
: undefined,
|
||||
commitFee: isSet(object.commitFee)
|
||||
? Coin.fromJSON(object.commitFee)
|
||||
: undefined,
|
||||
revealFee: isSet(object.revealFee)
|
||||
? Coin.fromJSON(object.revealFee)
|
||||
: undefined,
|
||||
minimumBid: isSet(object.minimumBid)
|
||||
? Coin.fromJSON(object.minimumBid)
|
||||
: undefined,
|
||||
winnerAddress: isSet(object.winnerAddress)
|
||||
? String(object.winnerAddress)
|
||||
: "",
|
||||
winningBid: isSet(object.winningBid)
|
||||
? Coin.fromJSON(object.winningBid)
|
||||
: undefined,
|
||||
winningPrice: isSet(object.winningPrice)
|
||||
? Coin.fromJSON(object.winningPrice)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Auction): unknown {
|
||||
const obj: any = {};
|
||||
message.id !== undefined && (obj.id = message.id);
|
||||
message.status !== undefined && (obj.status = message.status);
|
||||
message.ownerAddress !== undefined &&
|
||||
(obj.ownerAddress = message.ownerAddress);
|
||||
message.createTime !== undefined &&
|
||||
(obj.createTime = message.createTime.toISOString());
|
||||
message.commitsEndTime !== undefined &&
|
||||
(obj.commitsEndTime = message.commitsEndTime.toISOString());
|
||||
message.revealsEndTime !== undefined &&
|
||||
(obj.revealsEndTime = message.revealsEndTime.toISOString());
|
||||
message.commitFee !== undefined &&
|
||||
(obj.commitFee = message.commitFee
|
||||
? Coin.toJSON(message.commitFee)
|
||||
: undefined);
|
||||
message.revealFee !== undefined &&
|
||||
(obj.revealFee = message.revealFee
|
||||
? Coin.toJSON(message.revealFee)
|
||||
: undefined);
|
||||
message.minimumBid !== undefined &&
|
||||
(obj.minimumBid = message.minimumBid
|
||||
? Coin.toJSON(message.minimumBid)
|
||||
: undefined);
|
||||
message.winnerAddress !== undefined &&
|
||||
(obj.winnerAddress = message.winnerAddress);
|
||||
message.winningBid !== undefined &&
|
||||
(obj.winningBid = message.winningBid
|
||||
? Coin.toJSON(message.winningBid)
|
||||
: undefined);
|
||||
message.winningPrice !== undefined &&
|
||||
(obj.winningPrice = message.winningPrice
|
||||
? Coin.toJSON(message.winningPrice)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Auction>, I>>(object: I): Auction {
|
||||
const message = createBaseAuction();
|
||||
message.id = object.id ?? "";
|
||||
message.status = object.status ?? "";
|
||||
message.ownerAddress = object.ownerAddress ?? "";
|
||||
message.createTime = object.createTime ?? undefined;
|
||||
message.commitsEndTime = object.commitsEndTime ?? undefined;
|
||||
message.revealsEndTime = object.revealsEndTime ?? undefined;
|
||||
message.commitFee =
|
||||
object.commitFee !== undefined && object.commitFee !== null
|
||||
? Coin.fromPartial(object.commitFee)
|
||||
: undefined;
|
||||
message.revealFee =
|
||||
object.revealFee !== undefined && object.revealFee !== null
|
||||
? Coin.fromPartial(object.revealFee)
|
||||
: undefined;
|
||||
message.minimumBid =
|
||||
object.minimumBid !== undefined && object.minimumBid !== null
|
||||
? Coin.fromPartial(object.minimumBid)
|
||||
: undefined;
|
||||
message.winnerAddress = object.winnerAddress ?? "";
|
||||
message.winningBid =
|
||||
object.winningBid !== undefined && object.winningBid !== null
|
||||
? Coin.fromPartial(object.winningBid)
|
||||
: undefined;
|
||||
message.winningPrice =
|
||||
object.winningPrice !== undefined && object.winningPrice !== null
|
||||
? Coin.fromPartial(object.winningPrice)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseAuctions(): Auctions {
|
||||
return { auctions: [] };
|
||||
}
|
||||
|
||||
export const Auctions = {
|
||||
encode(
|
||||
message: Auctions,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
for (const v of message.auctions) {
|
||||
Auction.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Auctions {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAuctions();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.auctions.push(Auction.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Auctions {
|
||||
return {
|
||||
auctions: Array.isArray(object?.auctions)
|
||||
? object.auctions.map((e: any) => Auction.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Auctions): unknown {
|
||||
const obj: any = {};
|
||||
if (message.auctions) {
|
||||
obj.auctions = message.auctions.map((e) =>
|
||||
e ? Auction.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.auctions = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Auctions>, I>>(object: I): Auctions {
|
||||
const message = createBaseAuctions();
|
||||
message.auctions =
|
||||
object.auctions?.map((e) => Auction.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseBid(): Bid {
|
||||
return {
|
||||
auctionId: "",
|
||||
bidderAddress: "",
|
||||
status: "",
|
||||
commitHash: "",
|
||||
commitTime: undefined,
|
||||
commitFee: undefined,
|
||||
revealTime: undefined,
|
||||
revealFee: undefined,
|
||||
bidAmount: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Bid = {
|
||||
encode(message: Bid, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
if (message.auctionId !== "") {
|
||||
writer.uint32(10).string(message.auctionId);
|
||||
}
|
||||
if (message.bidderAddress !== "") {
|
||||
writer.uint32(18).string(message.bidderAddress);
|
||||
}
|
||||
if (message.status !== "") {
|
||||
writer.uint32(26).string(message.status);
|
||||
}
|
||||
if (message.commitHash !== "") {
|
||||
writer.uint32(34).string(message.commitHash);
|
||||
}
|
||||
if (message.commitTime !== undefined) {
|
||||
Timestamp.encode(
|
||||
toTimestamp(message.commitTime),
|
||||
writer.uint32(42).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.commitFee !== undefined) {
|
||||
Coin.encode(message.commitFee, writer.uint32(50).fork()).ldelim();
|
||||
}
|
||||
if (message.revealTime !== undefined) {
|
||||
Timestamp.encode(
|
||||
toTimestamp(message.revealTime),
|
||||
writer.uint32(58).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.revealFee !== undefined) {
|
||||
Coin.encode(message.revealFee, writer.uint32(66).fork()).ldelim();
|
||||
}
|
||||
if (message.bidAmount !== undefined) {
|
||||
Coin.encode(message.bidAmount, writer.uint32(74).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Bid {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseBid();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.auctionId = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.bidderAddress = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.status = reader.string();
|
||||
break;
|
||||
case 4:
|
||||
message.commitHash = reader.string();
|
||||
break;
|
||||
case 5:
|
||||
message.commitTime = fromTimestamp(
|
||||
Timestamp.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
case 6:
|
||||
message.commitFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 7:
|
||||
message.revealTime = fromTimestamp(
|
||||
Timestamp.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
case 8:
|
||||
message.revealFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 9:
|
||||
message.bidAmount = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Bid {
|
||||
return {
|
||||
auctionId: isSet(object.auctionId) ? String(object.auctionId) : "",
|
||||
bidderAddress: isSet(object.bidderAddress)
|
||||
? String(object.bidderAddress)
|
||||
: "",
|
||||
status: isSet(object.status) ? String(object.status) : "",
|
||||
commitHash: isSet(object.commitHash) ? String(object.commitHash) : "",
|
||||
commitTime: isSet(object.commitTime)
|
||||
? fromJsonTimestamp(object.commitTime)
|
||||
: undefined,
|
||||
commitFee: isSet(object.commitFee)
|
||||
? Coin.fromJSON(object.commitFee)
|
||||
: undefined,
|
||||
revealTime: isSet(object.revealTime)
|
||||
? fromJsonTimestamp(object.revealTime)
|
||||
: undefined,
|
||||
revealFee: isSet(object.revealFee)
|
||||
? Coin.fromJSON(object.revealFee)
|
||||
: undefined,
|
||||
bidAmount: isSet(object.bidAmount)
|
||||
? Coin.fromJSON(object.bidAmount)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Bid): unknown {
|
||||
const obj: any = {};
|
||||
message.auctionId !== undefined && (obj.auctionId = message.auctionId);
|
||||
message.bidderAddress !== undefined &&
|
||||
(obj.bidderAddress = message.bidderAddress);
|
||||
message.status !== undefined && (obj.status = message.status);
|
||||
message.commitHash !== undefined && (obj.commitHash = message.commitHash);
|
||||
message.commitTime !== undefined &&
|
||||
(obj.commitTime = message.commitTime.toISOString());
|
||||
message.commitFee !== undefined &&
|
||||
(obj.commitFee = message.commitFee
|
||||
? Coin.toJSON(message.commitFee)
|
||||
: undefined);
|
||||
message.revealTime !== undefined &&
|
||||
(obj.revealTime = message.revealTime.toISOString());
|
||||
message.revealFee !== undefined &&
|
||||
(obj.revealFee = message.revealFee
|
||||
? Coin.toJSON(message.revealFee)
|
||||
: undefined);
|
||||
message.bidAmount !== undefined &&
|
||||
(obj.bidAmount = message.bidAmount
|
||||
? Coin.toJSON(message.bidAmount)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Bid>, I>>(object: I): Bid {
|
||||
const message = createBaseBid();
|
||||
message.auctionId = object.auctionId ?? "";
|
||||
message.bidderAddress = object.bidderAddress ?? "";
|
||||
message.status = object.status ?? "";
|
||||
message.commitHash = object.commitHash ?? "";
|
||||
message.commitTime = object.commitTime ?? undefined;
|
||||
message.commitFee =
|
||||
object.commitFee !== undefined && object.commitFee !== null
|
||||
? Coin.fromPartial(object.commitFee)
|
||||
: undefined;
|
||||
message.revealTime = object.revealTime ?? undefined;
|
||||
message.revealFee =
|
||||
object.revealFee !== undefined && object.revealFee !== null
|
||||
? Coin.fromPartial(object.revealFee)
|
||||
: undefined;
|
||||
message.bidAmount =
|
||||
object.bidAmount !== undefined && object.bidAmount !== null
|
||||
? Coin.fromPartial(object.bidAmount)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
function toTimestamp(date: Date): Timestamp {
|
||||
const seconds = numberToLong(date.getTime() / 1_000);
|
||||
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
||||
return { seconds, nanos };
|
||||
}
|
||||
|
||||
function fromTimestamp(t: Timestamp): Date {
|
||||
let millis = t.seconds.toNumber() * 1_000;
|
||||
millis += t.nanos / 1_000_000;
|
||||
return new Date(millis);
|
||||
}
|
||||
|
||||
function fromJsonTimestamp(o: any): Date {
|
||||
if (o instanceof Date) {
|
||||
return o;
|
||||
} else if (typeof o === "string") {
|
||||
return new Date(o);
|
||||
} else {
|
||||
return fromTimestamp(Timestamp.fromJSON(o));
|
||||
}
|
||||
}
|
||||
|
||||
function numberToLong(number: number) {
|
||||
return Long.fromNumber(number);
|
||||
}
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/* eslint-disable */
|
||||
import { Params, Auctions } from "./auction";
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.auction.v1";
|
||||
|
||||
/** GenesisState defines the genesis state of the auction module */
|
||||
export interface GenesisState {
|
||||
params?: Params;
|
||||
auctions?: Auctions;
|
||||
}
|
||||
|
||||
function createBaseGenesisState(): GenesisState {
|
||||
return { params: undefined, auctions: undefined };
|
||||
}
|
||||
|
||||
export const GenesisState = {
|
||||
encode(
|
||||
message: GenesisState,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.params !== undefined) {
|
||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.auctions !== undefined) {
|
||||
Auctions.encode(message.auctions, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGenesisState();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.params = Params.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.auctions = Auctions.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): GenesisState {
|
||||
return {
|
||||
params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
|
||||
auctions: isSet(object.auctions)
|
||||
? Auctions.fromJSON(object.auctions)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GenesisState): unknown {
|
||||
const obj: any = {};
|
||||
message.params !== undefined &&
|
||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
||||
message.auctions !== undefined &&
|
||||
(obj.auctions = message.auctions
|
||||
? Auctions.toJSON(message.auctions)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<GenesisState>, I>>(
|
||||
object: I
|
||||
): GenesisState {
|
||||
const message = createBaseGenesisState();
|
||||
message.params =
|
||||
object.params !== undefined && object.params !== null
|
||||
? Params.fromPartial(object.params)
|
||||
: undefined;
|
||||
message.auctions =
|
||||
object.auctions !== undefined && object.auctions !== null
|
||||
? Auctions.fromPartial(object.auctions)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,641 @@
|
||||
/* eslint-disable */
|
||||
import { Duration } from "../../../google/protobuf/duration";
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Auction, Bid } from "./auction";
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.auction.v1";
|
||||
|
||||
/** MsgCreateAuction defines a create auction message */
|
||||
export interface MsgCreateAuction {
|
||||
/** Duration of the commits phase in seconds */
|
||||
commitsDuration?: Duration;
|
||||
/** Duration of the reveals phase in seconds */
|
||||
revealsDuration?: Duration;
|
||||
/** Commit fees */
|
||||
commitFee?: Coin;
|
||||
/** Reveal fees */
|
||||
revealFee?: Coin;
|
||||
/** Minimum acceptable bid amount */
|
||||
minimumBid?: Coin;
|
||||
/** Address of the signer */
|
||||
signer: string;
|
||||
}
|
||||
|
||||
/** MsgCreateAuctionResponse returns the details of the created auction */
|
||||
export interface MsgCreateAuctionResponse {
|
||||
/** Auction details */
|
||||
auction?: Auction;
|
||||
}
|
||||
|
||||
/** CommitBid defines the message to commit a bid */
|
||||
export interface MsgCommitBid {
|
||||
/** Auction id */
|
||||
auctionId: string;
|
||||
/** Commit Hash */
|
||||
commitHash: string;
|
||||
/** Address of the signer */
|
||||
signer: string;
|
||||
}
|
||||
|
||||
/** MsgCommitBidResponse returns the state of the auction after the bid creation */
|
||||
export interface MsgCommitBidResponse {
|
||||
/** Auction details */
|
||||
bid?: Bid;
|
||||
}
|
||||
|
||||
/** RevealBid defines the message to reveal a bid */
|
||||
export interface MsgRevealBid {
|
||||
/** Auction id */
|
||||
auctionId: string;
|
||||
/** Commit Hash */
|
||||
reveal: string;
|
||||
/** Address of the signer */
|
||||
signer: string;
|
||||
}
|
||||
|
||||
/** MsgRevealBidResponse returns the state of the auction after the bid reveal */
|
||||
export interface MsgRevealBidResponse {
|
||||
/** Auction details */
|
||||
auction?: Auction;
|
||||
}
|
||||
|
||||
function createBaseMsgCreateAuction(): MsgCreateAuction {
|
||||
return {
|
||||
commitsDuration: undefined,
|
||||
revealsDuration: undefined,
|
||||
commitFee: undefined,
|
||||
revealFee: undefined,
|
||||
minimumBid: undefined,
|
||||
signer: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const MsgCreateAuction = {
|
||||
encode(
|
||||
message: MsgCreateAuction,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.commitsDuration !== undefined) {
|
||||
Duration.encode(
|
||||
message.commitsDuration,
|
||||
writer.uint32(10).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.revealsDuration !== undefined) {
|
||||
Duration.encode(
|
||||
message.revealsDuration,
|
||||
writer.uint32(18).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.commitFee !== undefined) {
|
||||
Coin.encode(message.commitFee, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
if (message.revealFee !== undefined) {
|
||||
Coin.encode(message.revealFee, writer.uint32(34).fork()).ldelim();
|
||||
}
|
||||
if (message.minimumBid !== undefined) {
|
||||
Coin.encode(message.minimumBid, writer.uint32(42).fork()).ldelim();
|
||||
}
|
||||
if (message.signer !== "") {
|
||||
writer.uint32(50).string(message.signer);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAuction {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCreateAuction();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.commitsDuration = Duration.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.revealsDuration = Duration.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 3:
|
||||
message.commitFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 4:
|
||||
message.revealFee = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 5:
|
||||
message.minimumBid = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 6:
|
||||
message.signer = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgCreateAuction {
|
||||
return {
|
||||
commitsDuration: isSet(object.commitsDuration)
|
||||
? Duration.fromJSON(object.commitsDuration)
|
||||
: undefined,
|
||||
revealsDuration: isSet(object.revealsDuration)
|
||||
? Duration.fromJSON(object.revealsDuration)
|
||||
: undefined,
|
||||
commitFee: isSet(object.commitFee)
|
||||
? Coin.fromJSON(object.commitFee)
|
||||
: undefined,
|
||||
revealFee: isSet(object.revealFee)
|
||||
? Coin.fromJSON(object.revealFee)
|
||||
: undefined,
|
||||
minimumBid: isSet(object.minimumBid)
|
||||
? Coin.fromJSON(object.minimumBid)
|
||||
: undefined,
|
||||
signer: isSet(object.signer) ? String(object.signer) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgCreateAuction): unknown {
|
||||
const obj: any = {};
|
||||
message.commitsDuration !== undefined &&
|
||||
(obj.commitsDuration = message.commitsDuration
|
||||
? Duration.toJSON(message.commitsDuration)
|
||||
: undefined);
|
||||
message.revealsDuration !== undefined &&
|
||||
(obj.revealsDuration = message.revealsDuration
|
||||
? Duration.toJSON(message.revealsDuration)
|
||||
: undefined);
|
||||
message.commitFee !== undefined &&
|
||||
(obj.commitFee = message.commitFee
|
||||
? Coin.toJSON(message.commitFee)
|
||||
: undefined);
|
||||
message.revealFee !== undefined &&
|
||||
(obj.revealFee = message.revealFee
|
||||
? Coin.toJSON(message.revealFee)
|
||||
: undefined);
|
||||
message.minimumBid !== undefined &&
|
||||
(obj.minimumBid = message.minimumBid
|
||||
? Coin.toJSON(message.minimumBid)
|
||||
: undefined);
|
||||
message.signer !== undefined && (obj.signer = message.signer);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCreateAuction>, I>>(
|
||||
object: I
|
||||
): MsgCreateAuction {
|
||||
const message = createBaseMsgCreateAuction();
|
||||
message.commitsDuration =
|
||||
object.commitsDuration !== undefined && object.commitsDuration !== null
|
||||
? Duration.fromPartial(object.commitsDuration)
|
||||
: undefined;
|
||||
message.revealsDuration =
|
||||
object.revealsDuration !== undefined && object.revealsDuration !== null
|
||||
? Duration.fromPartial(object.revealsDuration)
|
||||
: undefined;
|
||||
message.commitFee =
|
||||
object.commitFee !== undefined && object.commitFee !== null
|
||||
? Coin.fromPartial(object.commitFee)
|
||||
: undefined;
|
||||
message.revealFee =
|
||||
object.revealFee !== undefined && object.revealFee !== null
|
||||
? Coin.fromPartial(object.revealFee)
|
||||
: undefined;
|
||||
message.minimumBid =
|
||||
object.minimumBid !== undefined && object.minimumBid !== null
|
||||
? Coin.fromPartial(object.minimumBid)
|
||||
: undefined;
|
||||
message.signer = object.signer ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgCreateAuctionResponse(): MsgCreateAuctionResponse {
|
||||
return { auction: undefined };
|
||||
}
|
||||
|
||||
export const MsgCreateAuctionResponse = {
|
||||
encode(
|
||||
message: MsgCreateAuctionResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.auction !== undefined) {
|
||||
Auction.encode(message.auction, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgCreateAuctionResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCreateAuctionResponse();
|
||||
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): MsgCreateAuctionResponse {
|
||||
return {
|
||||
auction: isSet(object.auction)
|
||||
? Auction.fromJSON(object.auction)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgCreateAuctionResponse): unknown {
|
||||
const obj: any = {};
|
||||
message.auction !== undefined &&
|
||||
(obj.auction = message.auction
|
||||
? Auction.toJSON(message.auction)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCreateAuctionResponse>, I>>(
|
||||
object: I
|
||||
): MsgCreateAuctionResponse {
|
||||
const message = createBaseMsgCreateAuctionResponse();
|
||||
message.auction =
|
||||
object.auction !== undefined && object.auction !== null
|
||||
? Auction.fromPartial(object.auction)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgCommitBid(): MsgCommitBid {
|
||||
return { auctionId: "", commitHash: "", signer: "" };
|
||||
}
|
||||
|
||||
export const MsgCommitBid = {
|
||||
encode(
|
||||
message: MsgCommitBid,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.auctionId !== "") {
|
||||
writer.uint32(10).string(message.auctionId);
|
||||
}
|
||||
if (message.commitHash !== "") {
|
||||
writer.uint32(18).string(message.commitHash);
|
||||
}
|
||||
if (message.signer !== "") {
|
||||
writer.uint32(26).string(message.signer);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCommitBid {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCommitBid();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.auctionId = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.commitHash = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.signer = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgCommitBid {
|
||||
return {
|
||||
auctionId: isSet(object.auctionId) ? String(object.auctionId) : "",
|
||||
commitHash: isSet(object.commitHash) ? String(object.commitHash) : "",
|
||||
signer: isSet(object.signer) ? String(object.signer) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgCommitBid): unknown {
|
||||
const obj: any = {};
|
||||
message.auctionId !== undefined && (obj.auctionId = message.auctionId);
|
||||
message.commitHash !== undefined && (obj.commitHash = message.commitHash);
|
||||
message.signer !== undefined && (obj.signer = message.signer);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCommitBid>, I>>(
|
||||
object: I
|
||||
): MsgCommitBid {
|
||||
const message = createBaseMsgCommitBid();
|
||||
message.auctionId = object.auctionId ?? "";
|
||||
message.commitHash = object.commitHash ?? "";
|
||||
message.signer = object.signer ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgCommitBidResponse(): MsgCommitBidResponse {
|
||||
return { bid: undefined };
|
||||
}
|
||||
|
||||
export const MsgCommitBidResponse = {
|
||||
encode(
|
||||
message: MsgCommitBidResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.bid !== undefined) {
|
||||
Bid.encode(message.bid, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgCommitBidResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCommitBidResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.bid = Bid.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgCommitBidResponse {
|
||||
return {
|
||||
bid: isSet(object.bid) ? Bid.fromJSON(object.bid) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgCommitBidResponse): unknown {
|
||||
const obj: any = {};
|
||||
message.bid !== undefined &&
|
||||
(obj.bid = message.bid ? Bid.toJSON(message.bid) : undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCommitBidResponse>, I>>(
|
||||
object: I
|
||||
): MsgCommitBidResponse {
|
||||
const message = createBaseMsgCommitBidResponse();
|
||||
message.bid =
|
||||
object.bid !== undefined && object.bid !== null
|
||||
? Bid.fromPartial(object.bid)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgRevealBid(): MsgRevealBid {
|
||||
return { auctionId: "", reveal: "", signer: "" };
|
||||
}
|
||||
|
||||
export const MsgRevealBid = {
|
||||
encode(
|
||||
message: MsgRevealBid,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.auctionId !== "") {
|
||||
writer.uint32(10).string(message.auctionId);
|
||||
}
|
||||
if (message.reveal !== "") {
|
||||
writer.uint32(18).string(message.reveal);
|
||||
}
|
||||
if (message.signer !== "") {
|
||||
writer.uint32(26).string(message.signer);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevealBid {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgRevealBid();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.auctionId = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.reveal = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.signer = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgRevealBid {
|
||||
return {
|
||||
auctionId: isSet(object.auctionId) ? String(object.auctionId) : "",
|
||||
reveal: isSet(object.reveal) ? String(object.reveal) : "",
|
||||
signer: isSet(object.signer) ? String(object.signer) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgRevealBid): unknown {
|
||||
const obj: any = {};
|
||||
message.auctionId !== undefined && (obj.auctionId = message.auctionId);
|
||||
message.reveal !== undefined && (obj.reveal = message.reveal);
|
||||
message.signer !== undefined && (obj.signer = message.signer);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgRevealBid>, I>>(
|
||||
object: I
|
||||
): MsgRevealBid {
|
||||
const message = createBaseMsgRevealBid();
|
||||
message.auctionId = object.auctionId ?? "";
|
||||
message.reveal = object.reveal ?? "";
|
||||
message.signer = object.signer ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgRevealBidResponse(): MsgRevealBidResponse {
|
||||
return { auction: undefined };
|
||||
}
|
||||
|
||||
export const MsgRevealBidResponse = {
|
||||
encode(
|
||||
message: MsgRevealBidResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.auction !== undefined) {
|
||||
Auction.encode(message.auction, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgRevealBidResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgRevealBidResponse();
|
||||
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): MsgRevealBidResponse {
|
||||
return {
|
||||
auction: isSet(object.auction)
|
||||
? Auction.fromJSON(object.auction)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgRevealBidResponse): unknown {
|
||||
const obj: any = {};
|
||||
message.auction !== undefined &&
|
||||
(obj.auction = message.auction
|
||||
? Auction.toJSON(message.auction)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgRevealBidResponse>, I>>(
|
||||
object: I
|
||||
): MsgRevealBidResponse {
|
||||
const message = createBaseMsgRevealBidResponse();
|
||||
message.auction =
|
||||
object.auction !== undefined && object.auction !== null
|
||||
? Auction.fromPartial(object.auction)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
/** Tx defines the gRPC tx interface */
|
||||
export interface Msg {
|
||||
/** CreateAuction is the command for creating an auction */
|
||||
CreateAuction(request: MsgCreateAuction): Promise<MsgCreateAuctionResponse>;
|
||||
/** CommitBid is the command for committing a bid */
|
||||
CommitBid(request: MsgCommitBid): Promise<MsgCommitBidResponse>;
|
||||
/** RevealBid is the command for revealing a bid */
|
||||
RevealBid(request: MsgRevealBid): Promise<MsgRevealBidResponse>;
|
||||
}
|
||||
|
||||
export class MsgClientImpl implements Msg {
|
||||
private readonly rpc: Rpc;
|
||||
constructor(rpc: Rpc) {
|
||||
this.rpc = rpc;
|
||||
this.CreateAuction = this.CreateAuction.bind(this);
|
||||
this.CommitBid = this.CommitBid.bind(this);
|
||||
this.RevealBid = this.RevealBid.bind(this);
|
||||
}
|
||||
CreateAuction(request: MsgCreateAuction): Promise<MsgCreateAuctionResponse> {
|
||||
const data = MsgCreateAuction.encode(request).finish();
|
||||
const promise = this.rpc.request(
|
||||
"cerc.auction.v1.Msg",
|
||||
"CreateAuction",
|
||||
data
|
||||
);
|
||||
return promise.then((data) =>
|
||||
MsgCreateAuctionResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
CommitBid(request: MsgCommitBid): Promise<MsgCommitBidResponse> {
|
||||
const data = MsgCommitBid.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.auction.v1.Msg", "CommitBid", data);
|
||||
return promise.then((data) =>
|
||||
MsgCommitBidResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
RevealBid(request: MsgRevealBid): Promise<MsgRevealBidResponse> {
|
||||
const data = MsgRevealBid.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.auction.v1.Msg", "RevealBid", data);
|
||||
return promise.then((data) =>
|
||||
MsgRevealBidResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
interface Rpc {
|
||||
request(
|
||||
service: string,
|
||||
method: string,
|
||||
data: Uint8Array
|
||||
): Promise<Uint8Array>;
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.bond.module.v1";
|
||||
|
||||
/**
|
||||
* Module is the app config object of the module.
|
||||
* Learn more: https://docs.cosmos.network/main/building-modules/depinject
|
||||
*/
|
||||
export interface Module {}
|
||||
|
||||
function createBaseModule(): Module {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const Module = {
|
||||
encode(_: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Module {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseModule();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Module {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: Module): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Module>, I>>(_: I): Module {
|
||||
const message = createBaseModule();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
/* eslint-disable */
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.bond.v1";
|
||||
|
||||
/** Params defines the parameters of the bond module. */
|
||||
export interface Params {
|
||||
/** max_bond_amount is maximum amount to bond */
|
||||
maxBondAmount?: Coin;
|
||||
}
|
||||
|
||||
/** Bond represents funds deposited by an account for record rent payments. */
|
||||
export interface Bond {
|
||||
/** id is unique identifier of the bond */
|
||||
id: string;
|
||||
/** owner of the bond */
|
||||
owner: string;
|
||||
/** balance of the bond */
|
||||
balance: Coin[];
|
||||
}
|
||||
|
||||
function createBaseParams(): Params {
|
||||
return { maxBondAmount: undefined };
|
||||
}
|
||||
|
||||
export const Params = {
|
||||
encode(
|
||||
message: Params,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.maxBondAmount !== undefined) {
|
||||
Coin.encode(message.maxBondAmount, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Params {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseParams();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.maxBondAmount = Coin.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Params {
|
||||
return {
|
||||
maxBondAmount: isSet(object.maxBondAmount)
|
||||
? Coin.fromJSON(object.maxBondAmount)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Params): unknown {
|
||||
const obj: any = {};
|
||||
message.maxBondAmount !== undefined &&
|
||||
(obj.maxBondAmount = message.maxBondAmount
|
||||
? Coin.toJSON(message.maxBondAmount)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Params>, I>>(object: I): Params {
|
||||
const message = createBaseParams();
|
||||
message.maxBondAmount =
|
||||
object.maxBondAmount !== undefined && object.maxBondAmount !== null
|
||||
? Coin.fromPartial(object.maxBondAmount)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseBond(): Bond {
|
||||
return { id: "", owner: "", balance: [] };
|
||||
}
|
||||
|
||||
export const Bond = {
|
||||
encode(message: Bond, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.owner !== "") {
|
||||
writer.uint32(18).string(message.owner);
|
||||
}
|
||||
for (const v of message.balance) {
|
||||
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Bond {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseBond();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.id = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.owner = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.balance.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Bond {
|
||||
return {
|
||||
id: isSet(object.id) ? String(object.id) : "",
|
||||
owner: isSet(object.owner) ? String(object.owner) : "",
|
||||
balance: Array.isArray(object?.balance)
|
||||
? object.balance.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Bond): unknown {
|
||||
const obj: any = {};
|
||||
message.id !== undefined && (obj.id = message.id);
|
||||
message.owner !== undefined && (obj.owner = message.owner);
|
||||
if (message.balance) {
|
||||
obj.balance = message.balance.map((e) =>
|
||||
e ? Coin.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.balance = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Bond>, I>>(object: I): Bond {
|
||||
const message = createBaseBond();
|
||||
message.id = object.id ?? "";
|
||||
message.owner = object.owner ?? "";
|
||||
message.balance = object.balance?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/* eslint-disable */
|
||||
import { Params, Bond } from "./bond";
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.bond.v1";
|
||||
|
||||
/** GenesisState defines the bond module's genesis state. */
|
||||
export interface GenesisState {
|
||||
/** params defines all the parameters of the module. */
|
||||
params?: Params;
|
||||
/** bonds defines all the bonds */
|
||||
bonds: Bond[];
|
||||
}
|
||||
|
||||
function createBaseGenesisState(): GenesisState {
|
||||
return { params: undefined, bonds: [] };
|
||||
}
|
||||
|
||||
export const GenesisState = {
|
||||
encode(
|
||||
message: GenesisState,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.params !== undefined) {
|
||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.bonds) {
|
||||
Bond.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGenesisState();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.params = Params.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.bonds.push(Bond.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): GenesisState {
|
||||
return {
|
||||
params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
|
||||
bonds: Array.isArray(object?.bonds)
|
||||
? object.bonds.map((e: any) => Bond.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GenesisState): unknown {
|
||||
const obj: any = {};
|
||||
message.params !== undefined &&
|
||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
||||
if (message.bonds) {
|
||||
obj.bonds = message.bonds.map((e) => (e ? Bond.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.bonds = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<GenesisState>, I>>(
|
||||
object: I
|
||||
): GenesisState {
|
||||
const message = createBaseGenesisState();
|
||||
message.params =
|
||||
object.params !== undefined && object.params !== null
|
||||
? Params.fromPartial(object.params)
|
||||
: undefined;
|
||||
message.bonds = object.bonds?.map((e) => Bond.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,834 @@
|
||||
/* eslint-disable */
|
||||
import { Params, Bond } from "./bond";
|
||||
import {
|
||||
PageRequest,
|
||||
PageResponse,
|
||||
} from "../../../cosmos/base/query/v1beta1/pagination";
|
||||
import Long from "long";
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.bond.v1";
|
||||
|
||||
/** QueryParamsRequest is request for query the bond module params */
|
||||
export interface QueryParamsRequest {}
|
||||
|
||||
/** QueryParamsResponse returns response type of bond module params */
|
||||
export interface QueryParamsResponse {
|
||||
params?: Params;
|
||||
}
|
||||
|
||||
/** QueryGetBondById queries a bonds. */
|
||||
export interface QueryGetBondsRequest {
|
||||
/** pagination defines an optional pagination for the request. */
|
||||
pagination?: PageRequest;
|
||||
}
|
||||
|
||||
/** QueryGetBondsResponse is response type for get the bonds by bond-id */
|
||||
export interface QueryGetBondsResponse {
|
||||
bonds: Bond[];
|
||||
/** pagination defines the pagination in the response. */
|
||||
pagination?: PageResponse;
|
||||
}
|
||||
|
||||
/** QueryGetBondById */
|
||||
export interface QueryGetBondByIdRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
/** QueryGetBondByIdResponse returns QueryGetBondById query response */
|
||||
export interface QueryGetBondByIdResponse {
|
||||
bond?: Bond;
|
||||
}
|
||||
|
||||
/** QueryGetBondsByOwnerRequest is request type for Query/GetBondsByOwner RPC Method */
|
||||
export interface QueryGetBondsByOwnerRequest {
|
||||
owner: string;
|
||||
/** pagination defines the pagination in the response. */
|
||||
pagination?: PageResponse;
|
||||
}
|
||||
|
||||
/** QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method */
|
||||
export interface QueryGetBondsByOwnerResponse {
|
||||
bonds: Bond[];
|
||||
/** pagination defines the pagination in the response. */
|
||||
pagination?: PageResponse;
|
||||
}
|
||||
|
||||
/** QueryGetBondModuleBalanceRequest is request type for bond module balance rpc method */
|
||||
export interface QueryGetBondModuleBalanceRequest {}
|
||||
|
||||
/** QueryGetBondModuleBalanceResponse is the response type for bond module balance rpc method */
|
||||
export interface QueryGetBondModuleBalanceResponse {
|
||||
balance: Coin[];
|
||||
}
|
||||
|
||||
function createBaseQueryParamsRequest(): QueryParamsRequest {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const QueryParamsRequest = {
|
||||
encode(
|
||||
_: QueryParamsRequest,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryParamsRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): QueryParamsRequest {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: QueryParamsRequest): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryParamsRequest>, I>>(
|
||||
_: I
|
||||
): QueryParamsRequest {
|
||||
const message = createBaseQueryParamsRequest();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryParamsResponse(): QueryParamsResponse {
|
||||
return { params: undefined };
|
||||
}
|
||||
|
||||
export const QueryParamsResponse = {
|
||||
encode(
|
||||
message: QueryParamsResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.params !== undefined) {
|
||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryParamsResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.params = Params.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): QueryParamsResponse {
|
||||
return {
|
||||
params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryParamsResponse): unknown {
|
||||
const obj: any = {};
|
||||
message.params !== undefined &&
|
||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryParamsResponse>, I>>(
|
||||
object: I
|
||||
): QueryParamsResponse {
|
||||
const message = createBaseQueryParamsResponse();
|
||||
message.params =
|
||||
object.params !== undefined && object.params !== null
|
||||
? Params.fromPartial(object.params)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondsRequest(): QueryGetBondsRequest {
|
||||
return { pagination: undefined };
|
||||
}
|
||||
|
||||
export const QueryGetBondsRequest = {
|
||||
encode(
|
||||
message: QueryGetBondsRequest,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.pagination !== undefined) {
|
||||
PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondsRequest {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondsRequest();
|
||||
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): QueryGetBondsRequest {
|
||||
return {
|
||||
pagination: isSet(object.pagination)
|
||||
? PageRequest.fromJSON(object.pagination)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryGetBondsRequest): unknown {
|
||||
const obj: any = {};
|
||||
message.pagination !== undefined &&
|
||||
(obj.pagination = message.pagination
|
||||
? PageRequest.toJSON(message.pagination)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryGetBondsRequest>, I>>(
|
||||
object: I
|
||||
): QueryGetBondsRequest {
|
||||
const message = createBaseQueryGetBondsRequest();
|
||||
message.pagination =
|
||||
object.pagination !== undefined && object.pagination !== null
|
||||
? PageRequest.fromPartial(object.pagination)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondsResponse(): QueryGetBondsResponse {
|
||||
return { bonds: [], pagination: undefined };
|
||||
}
|
||||
|
||||
export const QueryGetBondsResponse = {
|
||||
encode(
|
||||
message: QueryGetBondsResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
for (const v of message.bonds) {
|
||||
Bond.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.pagination !== undefined) {
|
||||
PageResponse.encode(
|
||||
message.pagination,
|
||||
writer.uint32(18).fork()
|
||||
).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondsResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondsResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.bonds.push(Bond.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): QueryGetBondsResponse {
|
||||
return {
|
||||
bonds: Array.isArray(object?.bonds)
|
||||
? object.bonds.map((e: any) => Bond.fromJSON(e))
|
||||
: [],
|
||||
pagination: isSet(object.pagination)
|
||||
? PageResponse.fromJSON(object.pagination)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryGetBondsResponse): unknown {
|
||||
const obj: any = {};
|
||||
if (message.bonds) {
|
||||
obj.bonds = message.bonds.map((e) => (e ? Bond.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.bonds = [];
|
||||
}
|
||||
message.pagination !== undefined &&
|
||||
(obj.pagination = message.pagination
|
||||
? PageResponse.toJSON(message.pagination)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryGetBondsResponse>, I>>(
|
||||
object: I
|
||||
): QueryGetBondsResponse {
|
||||
const message = createBaseQueryGetBondsResponse();
|
||||
message.bonds = object.bonds?.map((e) => Bond.fromPartial(e)) || [];
|
||||
message.pagination =
|
||||
object.pagination !== undefined && object.pagination !== null
|
||||
? PageResponse.fromPartial(object.pagination)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondByIdRequest(): QueryGetBondByIdRequest {
|
||||
return { id: "" };
|
||||
}
|
||||
|
||||
export const QueryGetBondByIdRequest = {
|
||||
encode(
|
||||
message: QueryGetBondByIdRequest,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondByIdRequest {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondByIdRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.id = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): QueryGetBondByIdRequest {
|
||||
return {
|
||||
id: isSet(object.id) ? String(object.id) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryGetBondByIdRequest): unknown {
|
||||
const obj: any = {};
|
||||
message.id !== undefined && (obj.id = message.id);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryGetBondByIdRequest>, I>>(
|
||||
object: I
|
||||
): QueryGetBondByIdRequest {
|
||||
const message = createBaseQueryGetBondByIdRequest();
|
||||
message.id = object.id ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondByIdResponse(): QueryGetBondByIdResponse {
|
||||
return { bond: undefined };
|
||||
}
|
||||
|
||||
export const QueryGetBondByIdResponse = {
|
||||
encode(
|
||||
message: QueryGetBondByIdResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.bond !== undefined) {
|
||||
Bond.encode(message.bond, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondByIdResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondByIdResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.bond = Bond.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): QueryGetBondByIdResponse {
|
||||
return {
|
||||
bond: isSet(object.bond) ? Bond.fromJSON(object.bond) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryGetBondByIdResponse): unknown {
|
||||
const obj: any = {};
|
||||
message.bond !== undefined &&
|
||||
(obj.bond = message.bond ? Bond.toJSON(message.bond) : undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryGetBondByIdResponse>, I>>(
|
||||
object: I
|
||||
): QueryGetBondByIdResponse {
|
||||
const message = createBaseQueryGetBondByIdResponse();
|
||||
message.bond =
|
||||
object.bond !== undefined && object.bond !== null
|
||||
? Bond.fromPartial(object.bond)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondsByOwnerRequest(): QueryGetBondsByOwnerRequest {
|
||||
return { owner: "", pagination: undefined };
|
||||
}
|
||||
|
||||
export const QueryGetBondsByOwnerRequest = {
|
||||
encode(
|
||||
message: QueryGetBondsByOwnerRequest,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.owner !== "") {
|
||||
writer.uint32(10).string(message.owner);
|
||||
}
|
||||
if (message.pagination !== undefined) {
|
||||
PageResponse.encode(
|
||||
message.pagination,
|
||||
writer.uint32(18).fork()
|
||||
).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondsByOwnerRequest {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondsByOwnerRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.owner = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.pagination = PageResponse.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): QueryGetBondsByOwnerRequest {
|
||||
return {
|
||||
owner: isSet(object.owner) ? String(object.owner) : "",
|
||||
pagination: isSet(object.pagination)
|
||||
? PageResponse.fromJSON(object.pagination)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryGetBondsByOwnerRequest): unknown {
|
||||
const obj: any = {};
|
||||
message.owner !== undefined && (obj.owner = message.owner);
|
||||
message.pagination !== undefined &&
|
||||
(obj.pagination = message.pagination
|
||||
? PageResponse.toJSON(message.pagination)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryGetBondsByOwnerRequest>, I>>(
|
||||
object: I
|
||||
): QueryGetBondsByOwnerRequest {
|
||||
const message = createBaseQueryGetBondsByOwnerRequest();
|
||||
message.owner = object.owner ?? "";
|
||||
message.pagination =
|
||||
object.pagination !== undefined && object.pagination !== null
|
||||
? PageResponse.fromPartial(object.pagination)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondsByOwnerResponse(): QueryGetBondsByOwnerResponse {
|
||||
return { bonds: [], pagination: undefined };
|
||||
}
|
||||
|
||||
export const QueryGetBondsByOwnerResponse = {
|
||||
encode(
|
||||
message: QueryGetBondsByOwnerResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
for (const v of message.bonds) {
|
||||
Bond.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.pagination !== undefined) {
|
||||
PageResponse.encode(
|
||||
message.pagination,
|
||||
writer.uint32(18).fork()
|
||||
).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondsByOwnerResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondsByOwnerResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.bonds.push(Bond.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): QueryGetBondsByOwnerResponse {
|
||||
return {
|
||||
bonds: Array.isArray(object?.bonds)
|
||||
? object.bonds.map((e: any) => Bond.fromJSON(e))
|
||||
: [],
|
||||
pagination: isSet(object.pagination)
|
||||
? PageResponse.fromJSON(object.pagination)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryGetBondsByOwnerResponse): unknown {
|
||||
const obj: any = {};
|
||||
if (message.bonds) {
|
||||
obj.bonds = message.bonds.map((e) => (e ? Bond.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.bonds = [];
|
||||
}
|
||||
message.pagination !== undefined &&
|
||||
(obj.pagination = message.pagination
|
||||
? PageResponse.toJSON(message.pagination)
|
||||
: undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<QueryGetBondsByOwnerResponse>, I>>(
|
||||
object: I
|
||||
): QueryGetBondsByOwnerResponse {
|
||||
const message = createBaseQueryGetBondsByOwnerResponse();
|
||||
message.bonds = object.bonds?.map((e) => Bond.fromPartial(e)) || [];
|
||||
message.pagination =
|
||||
object.pagination !== undefined && object.pagination !== null
|
||||
? PageResponse.fromPartial(object.pagination)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondModuleBalanceRequest(): QueryGetBondModuleBalanceRequest {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const QueryGetBondModuleBalanceRequest = {
|
||||
encode(
|
||||
_: QueryGetBondModuleBalanceRequest,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondModuleBalanceRequest {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondModuleBalanceRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): QueryGetBondModuleBalanceRequest {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: QueryGetBondModuleBalanceRequest): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<
|
||||
I extends Exact<DeepPartial<QueryGetBondModuleBalanceRequest>, I>
|
||||
>(_: I): QueryGetBondModuleBalanceRequest {
|
||||
const message = createBaseQueryGetBondModuleBalanceRequest();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseQueryGetBondModuleBalanceResponse(): QueryGetBondModuleBalanceResponse {
|
||||
return { balance: [] };
|
||||
}
|
||||
|
||||
export const QueryGetBondModuleBalanceResponse = {
|
||||
encode(
|
||||
message: QueryGetBondModuleBalanceResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
for (const v of message.balance) {
|
||||
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): QueryGetBondModuleBalanceResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseQueryGetBondModuleBalanceResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.balance.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): QueryGetBondModuleBalanceResponse {
|
||||
return {
|
||||
balance: Array.isArray(object?.balance)
|
||||
? object.balance.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: QueryGetBondModuleBalanceResponse): unknown {
|
||||
const obj: any = {};
|
||||
if (message.balance) {
|
||||
obj.balance = message.balance.map((e) =>
|
||||
e ? Coin.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.balance = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<
|
||||
I extends Exact<DeepPartial<QueryGetBondModuleBalanceResponse>, I>
|
||||
>(object: I): QueryGetBondModuleBalanceResponse {
|
||||
const message = createBaseQueryGetBondModuleBalanceResponse();
|
||||
message.balance = object.balance?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
/** Query defines the gRPC querier service for bond module */
|
||||
export interface Query {
|
||||
/** Params queries bonds module params. */
|
||||
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
|
||||
/** Bonds queries bonds list */
|
||||
Bonds(request: QueryGetBondsRequest): Promise<QueryGetBondsResponse>;
|
||||
/** GetBondById */
|
||||
GetBondById(
|
||||
request: QueryGetBondByIdRequest
|
||||
): Promise<QueryGetBondByIdResponse>;
|
||||
/** Get Bonds list by Owner */
|
||||
GetBondsByOwner(
|
||||
request: QueryGetBondsByOwnerRequest
|
||||
): Promise<QueryGetBondsByOwnerResponse>;
|
||||
/** Get Bond module balance */
|
||||
GetBondsModuleBalance(
|
||||
request: QueryGetBondModuleBalanceRequest
|
||||
): Promise<QueryGetBondModuleBalanceResponse>;
|
||||
}
|
||||
|
||||
export class QueryClientImpl implements Query {
|
||||
private readonly rpc: Rpc;
|
||||
constructor(rpc: Rpc) {
|
||||
this.rpc = rpc;
|
||||
this.Params = this.Params.bind(this);
|
||||
this.Bonds = this.Bonds.bind(this);
|
||||
this.GetBondById = this.GetBondById.bind(this);
|
||||
this.GetBondsByOwner = this.GetBondsByOwner.bind(this);
|
||||
this.GetBondsModuleBalance = this.GetBondsModuleBalance.bind(this);
|
||||
}
|
||||
Params(request: QueryParamsRequest): Promise<QueryParamsResponse> {
|
||||
const data = QueryParamsRequest.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.bond.v1.Query", "Params", data);
|
||||
return promise.then((data) =>
|
||||
QueryParamsResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
Bonds(request: QueryGetBondsRequest): Promise<QueryGetBondsResponse> {
|
||||
const data = QueryGetBondsRequest.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.bond.v1.Query", "Bonds", data);
|
||||
return promise.then((data) =>
|
||||
QueryGetBondsResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
GetBondById(
|
||||
request: QueryGetBondByIdRequest
|
||||
): Promise<QueryGetBondByIdResponse> {
|
||||
const data = QueryGetBondByIdRequest.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.bond.v1.Query", "GetBondById", data);
|
||||
return promise.then((data) =>
|
||||
QueryGetBondByIdResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
GetBondsByOwner(
|
||||
request: QueryGetBondsByOwnerRequest
|
||||
): Promise<QueryGetBondsByOwnerResponse> {
|
||||
const data = QueryGetBondsByOwnerRequest.encode(request).finish();
|
||||
const promise = this.rpc.request(
|
||||
"cerc.bond.v1.Query",
|
||||
"GetBondsByOwner",
|
||||
data
|
||||
);
|
||||
return promise.then((data) =>
|
||||
QueryGetBondsByOwnerResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
GetBondsModuleBalance(
|
||||
request: QueryGetBondModuleBalanceRequest
|
||||
): Promise<QueryGetBondModuleBalanceResponse> {
|
||||
const data = QueryGetBondModuleBalanceRequest.encode(request).finish();
|
||||
const promise = this.rpc.request(
|
||||
"cerc.bond.v1.Query",
|
||||
"GetBondsModuleBalance",
|
||||
data
|
||||
);
|
||||
return promise.then((data) =>
|
||||
QueryGetBondModuleBalanceResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
interface Rpc {
|
||||
request(
|
||||
service: string,
|
||||
method: string,
|
||||
data: Uint8Array
|
||||
): Promise<Uint8Array>;
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,631 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.bond.v1";
|
||||
|
||||
/** MsgCreateBond defines a SDK message for creating a new bond. */
|
||||
export interface MsgCreateBond {
|
||||
signer: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
|
||||
/** MsgCreateBondResponse defines the Msg/CreateBond response type. */
|
||||
export interface MsgCreateBondResponse {
|
||||
id: string;
|
||||
}
|
||||
|
||||
/** MsgRefillBond defines a SDK message for refill the amount for bond. */
|
||||
export interface MsgRefillBond {
|
||||
id: string;
|
||||
signer: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
|
||||
/** MsgRefillBondResponse defines the Msg/RefillBond response type. */
|
||||
export interface MsgRefillBondResponse {}
|
||||
|
||||
/** MsgWithdrawBond defines a SDK message for withdrawing amount from bond. */
|
||||
export interface MsgWithdrawBond {
|
||||
id: string;
|
||||
signer: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
|
||||
/** MsgWithdrawBondResponse defines the Msg/WithdrawBond response type. */
|
||||
export interface MsgWithdrawBondResponse {}
|
||||
|
||||
/** MsgCancelBond defines a SDK message for the cancel the bond. */
|
||||
export interface MsgCancelBond {
|
||||
id: string;
|
||||
signer: string;
|
||||
}
|
||||
|
||||
/** MsgCancelBondResponse defines the Msg/CancelBond response type. */
|
||||
export interface MsgCancelBondResponse {}
|
||||
|
||||
function createBaseMsgCreateBond(): MsgCreateBond {
|
||||
return { signer: "", coins: [] };
|
||||
}
|
||||
|
||||
export const MsgCreateBond = {
|
||||
encode(
|
||||
message: MsgCreateBond,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.signer !== "") {
|
||||
writer.uint32(10).string(message.signer);
|
||||
}
|
||||
for (const v of message.coins) {
|
||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateBond {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCreateBond();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.signer = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgCreateBond {
|
||||
return {
|
||||
signer: isSet(object.signer) ? String(object.signer) : "",
|
||||
coins: Array.isArray(object?.coins)
|
||||
? object.coins.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgCreateBond): unknown {
|
||||
const obj: any = {};
|
||||
message.signer !== undefined && (obj.signer = message.signer);
|
||||
if (message.coins) {
|
||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.coins = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCreateBond>, I>>(
|
||||
object: I
|
||||
): MsgCreateBond {
|
||||
const message = createBaseMsgCreateBond();
|
||||
message.signer = object.signer ?? "";
|
||||
message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgCreateBondResponse(): MsgCreateBondResponse {
|
||||
return { id: "" };
|
||||
}
|
||||
|
||||
export const MsgCreateBondResponse = {
|
||||
encode(
|
||||
message: MsgCreateBondResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgCreateBondResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCreateBondResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.id = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgCreateBondResponse {
|
||||
return {
|
||||
id: isSet(object.id) ? String(object.id) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgCreateBondResponse): unknown {
|
||||
const obj: any = {};
|
||||
message.id !== undefined && (obj.id = message.id);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCreateBondResponse>, I>>(
|
||||
object: I
|
||||
): MsgCreateBondResponse {
|
||||
const message = createBaseMsgCreateBondResponse();
|
||||
message.id = object.id ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgRefillBond(): MsgRefillBond {
|
||||
return { id: "", signer: "", coins: [] };
|
||||
}
|
||||
|
||||
export const MsgRefillBond = {
|
||||
encode(
|
||||
message: MsgRefillBond,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.signer !== "") {
|
||||
writer.uint32(18).string(message.signer);
|
||||
}
|
||||
for (const v of message.coins) {
|
||||
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgRefillBond {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgRefillBond();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.id = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.signer = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgRefillBond {
|
||||
return {
|
||||
id: isSet(object.id) ? String(object.id) : "",
|
||||
signer: isSet(object.signer) ? String(object.signer) : "",
|
||||
coins: Array.isArray(object?.coins)
|
||||
? object.coins.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgRefillBond): unknown {
|
||||
const obj: any = {};
|
||||
message.id !== undefined && (obj.id = message.id);
|
||||
message.signer !== undefined && (obj.signer = message.signer);
|
||||
if (message.coins) {
|
||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.coins = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgRefillBond>, I>>(
|
||||
object: I
|
||||
): MsgRefillBond {
|
||||
const message = createBaseMsgRefillBond();
|
||||
message.id = object.id ?? "";
|
||||
message.signer = object.signer ?? "";
|
||||
message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgRefillBondResponse(): MsgRefillBondResponse {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const MsgRefillBondResponse = {
|
||||
encode(
|
||||
_: MsgRefillBondResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgRefillBondResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgRefillBondResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): MsgRefillBondResponse {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: MsgRefillBondResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgRefillBondResponse>, I>>(
|
||||
_: I
|
||||
): MsgRefillBondResponse {
|
||||
const message = createBaseMsgRefillBondResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgWithdrawBond(): MsgWithdrawBond {
|
||||
return { id: "", signer: "", coins: [] };
|
||||
}
|
||||
|
||||
export const MsgWithdrawBond = {
|
||||
encode(
|
||||
message: MsgWithdrawBond,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.signer !== "") {
|
||||
writer.uint32(18).string(message.signer);
|
||||
}
|
||||
for (const v of message.coins) {
|
||||
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawBond {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgWithdrawBond();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.id = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.signer = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgWithdrawBond {
|
||||
return {
|
||||
id: isSet(object.id) ? String(object.id) : "",
|
||||
signer: isSet(object.signer) ? String(object.signer) : "",
|
||||
coins: Array.isArray(object?.coins)
|
||||
? object.coins.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgWithdrawBond): unknown {
|
||||
const obj: any = {};
|
||||
message.id !== undefined && (obj.id = message.id);
|
||||
message.signer !== undefined && (obj.signer = message.signer);
|
||||
if (message.coins) {
|
||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.coins = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgWithdrawBond>, I>>(
|
||||
object: I
|
||||
): MsgWithdrawBond {
|
||||
const message = createBaseMsgWithdrawBond();
|
||||
message.id = object.id ?? "";
|
||||
message.signer = object.signer ?? "";
|
||||
message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgWithdrawBondResponse(): MsgWithdrawBondResponse {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const MsgWithdrawBondResponse = {
|
||||
encode(
|
||||
_: MsgWithdrawBondResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgWithdrawBondResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgWithdrawBondResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): MsgWithdrawBondResponse {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: MsgWithdrawBondResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgWithdrawBondResponse>, I>>(
|
||||
_: I
|
||||
): MsgWithdrawBondResponse {
|
||||
const message = createBaseMsgWithdrawBondResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgCancelBond(): MsgCancelBond {
|
||||
return { id: "", signer: "" };
|
||||
}
|
||||
|
||||
export const MsgCancelBond = {
|
||||
encode(
|
||||
message: MsgCancelBond,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.signer !== "") {
|
||||
writer.uint32(18).string(message.signer);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelBond {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCancelBond();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.id = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.signer = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgCancelBond {
|
||||
return {
|
||||
id: isSet(object.id) ? String(object.id) : "",
|
||||
signer: isSet(object.signer) ? String(object.signer) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgCancelBond): unknown {
|
||||
const obj: any = {};
|
||||
message.id !== undefined && (obj.id = message.id);
|
||||
message.signer !== undefined && (obj.signer = message.signer);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCancelBond>, I>>(
|
||||
object: I
|
||||
): MsgCancelBond {
|
||||
const message = createBaseMsgCancelBond();
|
||||
message.id = object.id ?? "";
|
||||
message.signer = object.signer ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgCancelBondResponse(): MsgCancelBondResponse {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const MsgCancelBondResponse = {
|
||||
encode(
|
||||
_: MsgCancelBondResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgCancelBondResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgCancelBondResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): MsgCancelBondResponse {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: MsgCancelBondResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgCancelBondResponse>, I>>(
|
||||
_: I
|
||||
): MsgCancelBondResponse {
|
||||
const message = createBaseMsgCancelBondResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
/** Msg defines the bond Msg service. */
|
||||
export interface Msg {
|
||||
/** CreateBond defines a method for creating a new bond. */
|
||||
CreateBond(request: MsgCreateBond): Promise<MsgCreateBondResponse>;
|
||||
/** RefillBond defines a method for refilling amount for bond. */
|
||||
RefillBond(request: MsgRefillBond): Promise<MsgRefillBondResponse>;
|
||||
/** WithdrawBond defines a method for withdrawing amount from bond. */
|
||||
WithdrawBond(request: MsgWithdrawBond): Promise<MsgWithdrawBondResponse>;
|
||||
/** CancelBond defines a method for cancelling a bond. */
|
||||
CancelBond(request: MsgCancelBond): Promise<MsgCancelBondResponse>;
|
||||
}
|
||||
|
||||
export class MsgClientImpl implements Msg {
|
||||
private readonly rpc: Rpc;
|
||||
constructor(rpc: Rpc) {
|
||||
this.rpc = rpc;
|
||||
this.CreateBond = this.CreateBond.bind(this);
|
||||
this.RefillBond = this.RefillBond.bind(this);
|
||||
this.WithdrawBond = this.WithdrawBond.bind(this);
|
||||
this.CancelBond = this.CancelBond.bind(this);
|
||||
}
|
||||
CreateBond(request: MsgCreateBond): Promise<MsgCreateBondResponse> {
|
||||
const data = MsgCreateBond.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.bond.v1.Msg", "CreateBond", data);
|
||||
return promise.then((data) =>
|
||||
MsgCreateBondResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
RefillBond(request: MsgRefillBond): Promise<MsgRefillBondResponse> {
|
||||
const data = MsgRefillBond.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.bond.v1.Msg", "RefillBond", data);
|
||||
return promise.then((data) =>
|
||||
MsgRefillBondResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
WithdrawBond(request: MsgWithdrawBond): Promise<MsgWithdrawBondResponse> {
|
||||
const data = MsgWithdrawBond.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.bond.v1.Msg", "WithdrawBond", data);
|
||||
return promise.then((data) =>
|
||||
MsgWithdrawBondResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
CancelBond(request: MsgCancelBond): Promise<MsgCancelBondResponse> {
|
||||
const data = MsgCancelBond.encode(request).finish();
|
||||
const promise = this.rpc.request("cerc.bond.v1.Msg", "CancelBond", data);
|
||||
return promise.then((data) =>
|
||||
MsgCancelBondResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
interface Rpc {
|
||||
request(
|
||||
service: string,
|
||||
method: string,
|
||||
data: Uint8Array
|
||||
): Promise<Uint8Array>;
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.registry.module.v1";
|
||||
|
||||
/**
|
||||
* Module is the app config object of the module.
|
||||
* Learn more: https://docs.cosmos.network/main/building-modules/depinject
|
||||
*/
|
||||
export interface Module {}
|
||||
|
||||
function createBaseModule(): Module {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const Module = {
|
||||
encode(_: Module, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Module {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseModule();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Module {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: Module): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Module>, I>>(_: I): Module {
|
||||
const message = createBaseModule();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
/* eslint-disable */
|
||||
import { Params, Record, AuthorityEntry, NameEntry } from "./registry";
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cerc.registry.v1";
|
||||
|
||||
/** GenesisState defines the registry module's genesis state. */
|
||||
export interface GenesisState {
|
||||
/** params defines all the params of registry module. */
|
||||
params?: Params;
|
||||
/** records */
|
||||
records: Record[];
|
||||
/** authorities */
|
||||
authorities: AuthorityEntry[];
|
||||
/** names */
|
||||
names: NameEntry[];
|
||||
}
|
||||
|
||||
function createBaseGenesisState(): GenesisState {
|
||||
return { params: undefined, records: [], authorities: [], names: [] };
|
||||
}
|
||||
|
||||
export const GenesisState = {
|
||||
encode(
|
||||
message: GenesisState,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.params !== undefined) {
|
||||
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.records) {
|
||||
Record.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.authorities) {
|
||||
AuthorityEntry.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.names) {
|
||||
NameEntry.encode(v!, writer.uint32(34).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGenesisState();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.params = Params.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.records.push(Record.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 3:
|
||||
message.authorities.push(
|
||||
AuthorityEntry.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
case 4:
|
||||
message.names.push(NameEntry.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): GenesisState {
|
||||
return {
|
||||
params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
|
||||
records: Array.isArray(object?.records)
|
||||
? object.records.map((e: any) => Record.fromJSON(e))
|
||||
: [],
|
||||
authorities: Array.isArray(object?.authorities)
|
||||
? object.authorities.map((e: any) => AuthorityEntry.fromJSON(e))
|
||||
: [],
|
||||
names: Array.isArray(object?.names)
|
||||
? object.names.map((e: any) => NameEntry.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GenesisState): unknown {
|
||||
const obj: any = {};
|
||||
message.params !== undefined &&
|
||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
||||
if (message.records) {
|
||||
obj.records = message.records.map((e) =>
|
||||
e ? Record.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.records = [];
|
||||
}
|
||||
if (message.authorities) {
|
||||
obj.authorities = message.authorities.map((e) =>
|
||||
e ? AuthorityEntry.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.authorities = [];
|
||||
}
|
||||
if (message.names) {
|
||||
obj.names = message.names.map((e) =>
|
||||
e ? NameEntry.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.names = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<GenesisState>, I>>(
|
||||
object: I
|
||||
): GenesisState {
|
||||
const message = createBaseGenesisState();
|
||||
message.params =
|
||||
object.params !== undefined && object.params !== null
|
||||
? Params.fromPartial(object.params)
|
||||
: undefined;
|
||||
message.records = object.records?.map((e) => Record.fromPartial(e)) || [];
|
||||
message.authorities =
|
||||
object.authorities?.map((e) => AuthorityEntry.fromPartial(e)) || [];
|
||||
message.names = object.names?.map((e) => NameEntry.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,337 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmos.app.v1alpha1";
|
||||
|
||||
/** ModuleDescriptor describes an app module. */
|
||||
export interface ModuleDescriptor {
|
||||
/**
|
||||
* go_import names the package that should be imported by an app to load the
|
||||
* module in the runtime module registry. It is required to make debugging
|
||||
* of configuration errors easier for users.
|
||||
*/
|
||||
goImport: string;
|
||||
/**
|
||||
* use_package refers to a protobuf package that this module
|
||||
* uses and exposes to the world. In an app, only one module should "use"
|
||||
* or own a single protobuf package. It is assumed that the module uses
|
||||
* all of the .proto files in a single package.
|
||||
*/
|
||||
usePackage: PackageReference[];
|
||||
/**
|
||||
* can_migrate_from defines which module versions this module can migrate
|
||||
* state from. The framework will check that one module version is able to
|
||||
* migrate from a previous module version before attempting to update its
|
||||
* config. It is assumed that modules can transitively migrate from earlier
|
||||
* versions. For instance if v3 declares it can migrate from v2, and v2
|
||||
* declares it can migrate from v1, the framework knows how to migrate
|
||||
* from v1 to v3, assuming all 3 module versions are registered at runtime.
|
||||
*/
|
||||
canMigrateFrom: MigrateFromInfo[];
|
||||
}
|
||||
|
||||
/** PackageReference is a reference to a protobuf package used by a module. */
|
||||
export interface PackageReference {
|
||||
/** name is the fully-qualified name of the package. */
|
||||
name: string;
|
||||
/**
|
||||
* revision is the optional revision of the package that is being used.
|
||||
* Protobuf packages used in Cosmos should generally have a major version
|
||||
* as the last part of the package name, ex. foo.bar.baz.v1.
|
||||
* The revision of a package can be thought of as the minor version of a
|
||||
* package which has additional backwards compatible definitions that weren't
|
||||
* present in a previous version.
|
||||
*
|
||||
* A package should indicate its revision with a source code comment
|
||||
* above the package declaration in one of its files containing the
|
||||
* text "Revision N" where N is an integer revision. All packages start
|
||||
* at revision 0 the first time they are released in a module.
|
||||
*
|
||||
* When a new version of a module is released and items are added to existing
|
||||
* .proto files, these definitions should contain comments of the form
|
||||
* "Since: Revision N" where N is an integer revision.
|
||||
*
|
||||
* When the module runtime starts up, it will check the pinned proto
|
||||
* image and panic if there are runtime protobuf definitions that are not
|
||||
* in the pinned descriptor which do not have
|
||||
* a "Since Revision N" comment or have a "Since Revision N" comment where
|
||||
* N is <= to the revision specified here. This indicates that the protobuf
|
||||
* files have been updated, but the pinned file descriptor hasn't.
|
||||
*
|
||||
* If there are items in the pinned file descriptor with a revision
|
||||
* greater than the value indicated here, this will also cause a panic
|
||||
* as it may mean that the pinned descriptor for a legacy module has been
|
||||
* improperly updated or that there is some other versioning discrepancy.
|
||||
* Runtime protobuf definitions will also be checked for compatibility
|
||||
* with pinned file descriptors to make sure there are no incompatible changes.
|
||||
*
|
||||
* This behavior ensures that:
|
||||
* * pinned proto images are up-to-date
|
||||
* * protobuf files are carefully annotated with revision comments which
|
||||
* are important good client UX
|
||||
* * protobuf files are changed in backwards and forwards compatible ways
|
||||
*/
|
||||
revision: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* MigrateFromInfo is information on a module version that a newer module
|
||||
* can migrate from.
|
||||
*/
|
||||
export interface MigrateFromInfo {
|
||||
/**
|
||||
* module is the fully-qualified protobuf name of the module config object
|
||||
* for the previous module version, ex: "cosmos.group.module.v1.Module".
|
||||
*/
|
||||
module: string;
|
||||
}
|
||||
|
||||
function createBaseModuleDescriptor(): ModuleDescriptor {
|
||||
return { goImport: "", usePackage: [], canMigrateFrom: [] };
|
||||
}
|
||||
|
||||
export const ModuleDescriptor = {
|
||||
encode(
|
||||
message: ModuleDescriptor,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.goImport !== "") {
|
||||
writer.uint32(10).string(message.goImport);
|
||||
}
|
||||
for (const v of message.usePackage) {
|
||||
PackageReference.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.canMigrateFrom) {
|
||||
MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseModuleDescriptor();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.goImport = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.usePackage.push(
|
||||
PackageReference.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
message.canMigrateFrom.push(
|
||||
MigrateFromInfo.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ModuleDescriptor {
|
||||
return {
|
||||
goImport: isSet(object.goImport) ? String(object.goImport) : "",
|
||||
usePackage: Array.isArray(object?.usePackage)
|
||||
? object.usePackage.map((e: any) => PackageReference.fromJSON(e))
|
||||
: [],
|
||||
canMigrateFrom: Array.isArray(object?.canMigrateFrom)
|
||||
? object.canMigrateFrom.map((e: any) => MigrateFromInfo.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ModuleDescriptor): unknown {
|
||||
const obj: any = {};
|
||||
message.goImport !== undefined && (obj.goImport = message.goImport);
|
||||
if (message.usePackage) {
|
||||
obj.usePackage = message.usePackage.map((e) =>
|
||||
e ? PackageReference.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.usePackage = [];
|
||||
}
|
||||
if (message.canMigrateFrom) {
|
||||
obj.canMigrateFrom = message.canMigrateFrom.map((e) =>
|
||||
e ? MigrateFromInfo.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.canMigrateFrom = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<ModuleDescriptor>, I>>(
|
||||
object: I
|
||||
): ModuleDescriptor {
|
||||
const message = createBaseModuleDescriptor();
|
||||
message.goImport = object.goImport ?? "";
|
||||
message.usePackage =
|
||||
object.usePackage?.map((e) => PackageReference.fromPartial(e)) || [];
|
||||
message.canMigrateFrom =
|
||||
object.canMigrateFrom?.map((e) => MigrateFromInfo.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBasePackageReference(): PackageReference {
|
||||
return { name: "", revision: 0 };
|
||||
}
|
||||
|
||||
export const PackageReference = {
|
||||
encode(
|
||||
message: PackageReference,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.revision !== 0) {
|
||||
writer.uint32(16).uint32(message.revision);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePackageReference();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.name = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.revision = reader.uint32();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): PackageReference {
|
||||
return {
|
||||
name: isSet(object.name) ? String(object.name) : "",
|
||||
revision: isSet(object.revision) ? Number(object.revision) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: PackageReference): unknown {
|
||||
const obj: any = {};
|
||||
message.name !== undefined && (obj.name = message.name);
|
||||
message.revision !== undefined &&
|
||||
(obj.revision = Math.round(message.revision));
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<PackageReference>, I>>(
|
||||
object: I
|
||||
): PackageReference {
|
||||
const message = createBasePackageReference();
|
||||
message.name = object.name ?? "";
|
||||
message.revision = object.revision ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMigrateFromInfo(): MigrateFromInfo {
|
||||
return { module: "" };
|
||||
}
|
||||
|
||||
export const MigrateFromInfo = {
|
||||
encode(
|
||||
message: MigrateFromInfo,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.module !== "") {
|
||||
writer.uint32(10).string(message.module);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MigrateFromInfo {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMigrateFromInfo();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.module = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MigrateFromInfo {
|
||||
return {
|
||||
module: isSet(object.module) ? String(object.module) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MigrateFromInfo): unknown {
|
||||
const obj: any = {};
|
||||
message.module !== undefined && (obj.module = message.module);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MigrateFromInfo>, I>>(
|
||||
object: I
|
||||
): MigrateFromInfo {
|
||||
const message = createBaseMigrateFromInfo();
|
||||
message.module = object.module ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmos.base.query.v1beta1";
|
||||
|
||||
/**
|
||||
* PageRequest is to be embedded in gRPC request messages for efficient
|
||||
* pagination. Ex:
|
||||
*
|
||||
* message SomeRequest {
|
||||
* Foo some_parameter = 1;
|
||||
* PageRequest pagination = 2;
|
||||
* }
|
||||
*/
|
||||
export interface PageRequest {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
key: Uint8Array;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
offset: Long;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
limit: Long;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
countTotal: 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 PageResponse {
|
||||
/**
|
||||
* next_key is the key to be passed to PageRequest.key to
|
||||
* query the next page most efficiently. It will be empty if
|
||||
* there are no more results.
|
||||
*/
|
||||
nextKey: Uint8Array;
|
||||
/**
|
||||
* total is total number of results available if PageRequest.count_total
|
||||
* was set, its value is undefined otherwise
|
||||
*/
|
||||
total: Long;
|
||||
}
|
||||
|
||||
function createBasePageRequest(): PageRequest {
|
||||
return {
|
||||
key: new Uint8Array(),
|
||||
offset: Long.UZERO,
|
||||
limit: Long.UZERO,
|
||||
countTotal: false,
|
||||
reverse: false,
|
||||
};
|
||||
}
|
||||
|
||||
export const PageRequest = {
|
||||
encode(
|
||||
message: PageRequest,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.key.length !== 0) {
|
||||
writer.uint32(10).bytes(message.key);
|
||||
}
|
||||
if (!message.offset.isZero()) {
|
||||
writer.uint32(16).uint64(message.offset);
|
||||
}
|
||||
if (!message.limit.isZero()) {
|
||||
writer.uint32(24).uint64(message.limit);
|
||||
}
|
||||
if (message.countTotal === true) {
|
||||
writer.uint32(32).bool(message.countTotal);
|
||||
}
|
||||
if (message.reverse === true) {
|
||||
writer.uint32(40).bool(message.reverse);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePageRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.key = reader.bytes();
|
||||
break;
|
||||
case 2:
|
||||
message.offset = reader.uint64() as Long;
|
||||
break;
|
||||
case 3:
|
||||
message.limit = reader.uint64() as Long;
|
||||
break;
|
||||
case 4:
|
||||
message.countTotal = reader.bool();
|
||||
break;
|
||||
case 5:
|
||||
message.reverse = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): PageRequest {
|
||||
return {
|
||||
key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(),
|
||||
offset: isSet(object.offset) ? Long.fromValue(object.offset) : Long.UZERO,
|
||||
limit: isSet(object.limit) ? Long.fromValue(object.limit) : Long.UZERO,
|
||||
countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false,
|
||||
reverse: isSet(object.reverse) ? Boolean(object.reverse) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: PageRequest): unknown {
|
||||
const obj: any = {};
|
||||
message.key !== undefined &&
|
||||
(obj.key = base64FromBytes(
|
||||
message.key !== undefined ? message.key : new Uint8Array()
|
||||
));
|
||||
message.offset !== undefined &&
|
||||
(obj.offset = (message.offset || Long.UZERO).toString());
|
||||
message.limit !== undefined &&
|
||||
(obj.limit = (message.limit || Long.UZERO).toString());
|
||||
message.countTotal !== undefined && (obj.countTotal = message.countTotal);
|
||||
message.reverse !== undefined && (obj.reverse = message.reverse);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<PageRequest>, I>>(
|
||||
object: I
|
||||
): PageRequest {
|
||||
const message = createBasePageRequest();
|
||||
message.key = object.key ?? new Uint8Array();
|
||||
message.offset =
|
||||
object.offset !== undefined && object.offset !== null
|
||||
? Long.fromValue(object.offset)
|
||||
: Long.UZERO;
|
||||
message.limit =
|
||||
object.limit !== undefined && object.limit !== null
|
||||
? Long.fromValue(object.limit)
|
||||
: Long.UZERO;
|
||||
message.countTotal = object.countTotal ?? false;
|
||||
message.reverse = object.reverse ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBasePageResponse(): PageResponse {
|
||||
return { nextKey: new Uint8Array(), total: Long.UZERO };
|
||||
}
|
||||
|
||||
export const PageResponse = {
|
||||
encode(
|
||||
message: PageResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.nextKey.length !== 0) {
|
||||
writer.uint32(10).bytes(message.nextKey);
|
||||
}
|
||||
if (!message.total.isZero()) {
|
||||
writer.uint32(16).uint64(message.total);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePageResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.nextKey = reader.bytes();
|
||||
break;
|
||||
case 2:
|
||||
message.total = reader.uint64() as Long;
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): PageResponse {
|
||||
return {
|
||||
nextKey: isSet(object.nextKey)
|
||||
? bytesFromBase64(object.nextKey)
|
||||
: new Uint8Array(),
|
||||
total: isSet(object.total) ? Long.fromValue(object.total) : Long.UZERO,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: PageResponse): unknown {
|
||||
const obj: any = {};
|
||||
message.nextKey !== undefined &&
|
||||
(obj.nextKey = base64FromBytes(
|
||||
message.nextKey !== undefined ? message.nextKey : new Uint8Array()
|
||||
));
|
||||
message.total !== undefined &&
|
||||
(obj.total = (message.total || Long.UZERO).toString());
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<PageResponse>, I>>(
|
||||
object: I
|
||||
): PageResponse {
|
||||
const message = createBasePageResponse();
|
||||
message.nextKey = object.nextKey ?? new Uint8Array();
|
||||
message.total =
|
||||
object.total !== undefined && object.total !== null
|
||||
? Long.fromValue(object.total)
|
||||
: Long.UZERO;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
declare var self: any | undefined;
|
||||
declare var window: any | undefined;
|
||||
declare var global: 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";
|
||||
})();
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
if (globalThis.Buffer) {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
const bin = globalThis.atob(b64);
|
||||
const arr = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; ++i) {
|
||||
arr[i] = bin.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
if (globalThis.Buffer) {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
} else {
|
||||
const bin: string[] = [];
|
||||
arr.forEach((byte) => {
|
||||
bin.push(String.fromCharCode(byte));
|
||||
});
|
||||
return globalThis.btoa(bin.join(""));
|
||||
}
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmos.base.v1beta1";
|
||||
|
||||
/**
|
||||
* Coin defines a token with a denomination and an amount.
|
||||
*
|
||||
* NOTE: The amount field is an Int which implements the custom method
|
||||
* signatures required by gogoproto.
|
||||
*/
|
||||
export interface Coin {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* DecCoin defines a token with a denomination and a decimal amount.
|
||||
*
|
||||
* NOTE: The amount field is an Dec which implements the custom method
|
||||
* signatures required by gogoproto.
|
||||
*/
|
||||
export interface DecCoin {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* IntProto defines a Protobuf wrapper around an Int object.
|
||||
* Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal.
|
||||
*/
|
||||
export interface IntProto {
|
||||
int: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* DecProto defines a Protobuf wrapper around a Dec object.
|
||||
* Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal.
|
||||
*/
|
||||
export interface DecProto {
|
||||
dec: string;
|
||||
}
|
||||
|
||||
function createBaseCoin(): Coin {
|
||||
return { denom: "", amount: "" };
|
||||
}
|
||||
|
||||
export const Coin = {
|
||||
encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
if (message.denom !== "") {
|
||||
writer.uint32(10).string(message.denom);
|
||||
}
|
||||
if (message.amount !== "") {
|
||||
writer.uint32(18).string(message.amount);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Coin {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseCoin();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.denom = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.amount = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Coin {
|
||||
return {
|
||||
denom: isSet(object.denom) ? String(object.denom) : "",
|
||||
amount: isSet(object.amount) ? String(object.amount) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Coin): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.amount !== undefined && (obj.amount = message.amount);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Coin>, I>>(object: I): Coin {
|
||||
const message = createBaseCoin();
|
||||
message.denom = object.denom ?? "";
|
||||
message.amount = object.amount ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseDecCoin(): DecCoin {
|
||||
return { denom: "", amount: "" };
|
||||
}
|
||||
|
||||
export const DecCoin = {
|
||||
encode(
|
||||
message: DecCoin,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.denom !== "") {
|
||||
writer.uint32(10).string(message.denom);
|
||||
}
|
||||
if (message.amount !== "") {
|
||||
writer.uint32(18).string(message.amount);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDecCoin();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.denom = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.amount = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DecCoin {
|
||||
return {
|
||||
denom: isSet(object.denom) ? String(object.denom) : "",
|
||||
amount: isSet(object.amount) ? String(object.amount) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: DecCoin): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.amount !== undefined && (obj.amount = message.amount);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<DecCoin>, I>>(object: I): DecCoin {
|
||||
const message = createBaseDecCoin();
|
||||
message.denom = object.denom ?? "";
|
||||
message.amount = object.amount ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseIntProto(): IntProto {
|
||||
return { int: "" };
|
||||
}
|
||||
|
||||
export const IntProto = {
|
||||
encode(
|
||||
message: IntProto,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.int !== "") {
|
||||
writer.uint32(10).string(message.int);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): IntProto {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseIntProto();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.int = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): IntProto {
|
||||
return {
|
||||
int: isSet(object.int) ? String(object.int) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: IntProto): unknown {
|
||||
const obj: any = {};
|
||||
message.int !== undefined && (obj.int = message.int);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<IntProto>, I>>(object: I): IntProto {
|
||||
const message = createBaseIntProto();
|
||||
message.int = object.int ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseDecProto(): DecProto {
|
||||
return { dec: "" };
|
||||
}
|
||||
|
||||
export const DecProto = {
|
||||
encode(
|
||||
message: DecProto,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.dec !== "") {
|
||||
writer.uint32(10).string(message.dec);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): DecProto {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDecProto();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.dec = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DecProto {
|
||||
return {
|
||||
dec: isSet(object.dec) ? String(object.dec) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: DecProto): unknown {
|
||||
const obj: any = {};
|
||||
message.dec !== undefined && (obj.dec = message.dec);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<DecProto>, I>>(object: I): DecProto {
|
||||
const message = createBaseDecProto();
|
||||
message.dec = object.dec ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
export const protobufPackage = "cosmos.msg.v1";
|
||||
@@ -0,0 +1,284 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmos_proto";
|
||||
|
||||
export enum ScalarType {
|
||||
SCALAR_TYPE_UNSPECIFIED = 0,
|
||||
SCALAR_TYPE_STRING = 1,
|
||||
SCALAR_TYPE_BYTES = 2,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function scalarTypeFromJSON(object: any): ScalarType {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "SCALAR_TYPE_UNSPECIFIED":
|
||||
return ScalarType.SCALAR_TYPE_UNSPECIFIED;
|
||||
case 1:
|
||||
case "SCALAR_TYPE_STRING":
|
||||
return ScalarType.SCALAR_TYPE_STRING;
|
||||
case 2:
|
||||
case "SCALAR_TYPE_BYTES":
|
||||
return ScalarType.SCALAR_TYPE_BYTES;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return ScalarType.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function scalarTypeToJSON(object: ScalarType): string {
|
||||
switch (object) {
|
||||
case ScalarType.SCALAR_TYPE_UNSPECIFIED:
|
||||
return "SCALAR_TYPE_UNSPECIFIED";
|
||||
case ScalarType.SCALAR_TYPE_STRING:
|
||||
return "SCALAR_TYPE_STRING";
|
||||
case ScalarType.SCALAR_TYPE_BYTES:
|
||||
return "SCALAR_TYPE_BYTES";
|
||||
case ScalarType.UNRECOGNIZED:
|
||||
default:
|
||||
return "UNRECOGNIZED";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* InterfaceDescriptor describes an interface type to be used with
|
||||
* accepts_interface and implements_interface and declared by declare_interface.
|
||||
*/
|
||||
export interface InterfaceDescriptor {
|
||||
/**
|
||||
* name is the name of the interface. It should be a short-name (without
|
||||
* a period) such that the fully qualified name of the interface will be
|
||||
* package.name, ex. for the package a.b and interface named C, the
|
||||
* fully-qualified name will be a.b.C.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* description is a human-readable description of the interface and its
|
||||
* purpose.
|
||||
*/
|
||||
description: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ScalarDescriptor describes an scalar type to be used with
|
||||
* the scalar field option and declared by declare_scalar.
|
||||
* Scalars extend simple protobuf built-in types with additional
|
||||
* syntax and semantics, for instance to represent big integers.
|
||||
* Scalars should ideally define an encoding such that there is only one
|
||||
* valid syntactical representation for a given semantic meaning,
|
||||
* i.e. the encoding should be deterministic.
|
||||
*/
|
||||
export interface ScalarDescriptor {
|
||||
/**
|
||||
* name is the name of the scalar. It should be a short-name (without
|
||||
* a period) such that the fully qualified name of the scalar will be
|
||||
* package.name, ex. for the package a.b and scalar named C, the
|
||||
* fully-qualified name will be a.b.C.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* description is a human-readable description of the scalar and its
|
||||
* encoding format. For instance a big integer or decimal scalar should
|
||||
* specify precisely the expected encoding format.
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* field_type is the type of field with which this scalar can be used.
|
||||
* Scalars can be used with one and only one type of field so that
|
||||
* encoding standards and simple and clear. Currently only string and
|
||||
* bytes fields are supported for scalars.
|
||||
*/
|
||||
fieldType: ScalarType[];
|
||||
}
|
||||
|
||||
function createBaseInterfaceDescriptor(): InterfaceDescriptor {
|
||||
return { name: "", description: "" };
|
||||
}
|
||||
|
||||
export const InterfaceDescriptor = {
|
||||
encode(
|
||||
message: InterfaceDescriptor,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.description !== "") {
|
||||
writer.uint32(18).string(message.description);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseInterfaceDescriptor();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.name = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.description = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): InterfaceDescriptor {
|
||||
return {
|
||||
name: isSet(object.name) ? String(object.name) : "",
|
||||
description: isSet(object.description) ? String(object.description) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: InterfaceDescriptor): unknown {
|
||||
const obj: any = {};
|
||||
message.name !== undefined && (obj.name = message.name);
|
||||
message.description !== undefined &&
|
||||
(obj.description = message.description);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<InterfaceDescriptor>, I>>(
|
||||
object: I
|
||||
): InterfaceDescriptor {
|
||||
const message = createBaseInterfaceDescriptor();
|
||||
message.name = object.name ?? "";
|
||||
message.description = object.description ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseScalarDescriptor(): ScalarDescriptor {
|
||||
return { name: "", description: "", fieldType: [] };
|
||||
}
|
||||
|
||||
export const ScalarDescriptor = {
|
||||
encode(
|
||||
message: ScalarDescriptor,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.description !== "") {
|
||||
writer.uint32(18).string(message.description);
|
||||
}
|
||||
writer.uint32(26).fork();
|
||||
for (const v of message.fieldType) {
|
||||
writer.int32(v);
|
||||
}
|
||||
writer.ldelim();
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseScalarDescriptor();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.name = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.description = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
if ((tag & 7) === 2) {
|
||||
const end2 = reader.uint32() + reader.pos;
|
||||
while (reader.pos < end2) {
|
||||
message.fieldType.push(reader.int32() as any);
|
||||
}
|
||||
} else {
|
||||
message.fieldType.push(reader.int32() as any);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ScalarDescriptor {
|
||||
return {
|
||||
name: isSet(object.name) ? String(object.name) : "",
|
||||
description: isSet(object.description) ? String(object.description) : "",
|
||||
fieldType: Array.isArray(object?.fieldType)
|
||||
? object.fieldType.map((e: any) => scalarTypeFromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: ScalarDescriptor): unknown {
|
||||
const obj: any = {};
|
||||
message.name !== undefined && (obj.name = message.name);
|
||||
message.description !== undefined &&
|
||||
(obj.description = message.description);
|
||||
if (message.fieldType) {
|
||||
obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e));
|
||||
} else {
|
||||
obj.fieldType = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<ScalarDescriptor>, I>>(
|
||||
object: I
|
||||
): ScalarDescriptor {
|
||||
const message = createBaseScalarDescriptor();
|
||||
message.name = object.name ?? "";
|
||||
message.description = object.description ?? "";
|
||||
message.fieldType = object.fieldType?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
export const protobufPackage = "gogoproto";
|
||||
@@ -0,0 +1,2 @@
|
||||
/* eslint-disable */
|
||||
export const protobufPackage = "google.api";
|
||||
@@ -0,0 +1,647 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "google.api";
|
||||
|
||||
/**
|
||||
* Defines the HTTP configuration for an API service. It contains a list of
|
||||
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
||||
* to one or more HTTP REST API methods.
|
||||
*/
|
||||
export interface Http {
|
||||
/**
|
||||
* A list of HTTP configuration rules that apply to individual API methods.
|
||||
*
|
||||
* **NOTE:** All service configuration rules follow "last one wins" order.
|
||||
*/
|
||||
rules: HttpRule[];
|
||||
/**
|
||||
* When set to true, URL path parmeters will be fully URI-decoded except in
|
||||
* cases of single segment matches in reserved expansion, where "%2F" will be
|
||||
* left encoded.
|
||||
*
|
||||
* The default behavior is to not decode RFC 6570 reserved characters in multi
|
||||
* segment matches.
|
||||
*/
|
||||
fullyDecodeReservedExpansion: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
|
||||
* REST API methods. The mapping specifies how different portions of the RPC
|
||||
* request message are mapped to URL path, URL query parameters, and
|
||||
* HTTP request body. The mapping is typically specified as an
|
||||
* `google.api.http` annotation on the RPC method,
|
||||
* see "google/api/annotations.proto" for details.
|
||||
*
|
||||
* The mapping consists of a field specifying the path template and
|
||||
* method kind. The path template can refer to fields in the request
|
||||
* message, as in the example below which describes a REST GET
|
||||
* operation on a resource collection of messages:
|
||||
*
|
||||
*
|
||||
* service Messaging {
|
||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
* option (google.api.http).get =
|
||||
* "/v1/messages/{message_id}/{sub.subfield}";
|
||||
* }
|
||||
* }
|
||||
* message GetMessageRequest {
|
||||
* message SubMessage {
|
||||
* string subfield = 1;
|
||||
* }
|
||||
* string message_id = 1; // mapped to the URL
|
||||
* SubMessage sub = 2; // `sub.subfield` is url-mapped
|
||||
* }
|
||||
* message Message {
|
||||
* string text = 1; // content of the resource
|
||||
* }
|
||||
*
|
||||
* The same http annotation can alternatively be expressed inside the
|
||||
* `GRPC API Configuration` YAML file.
|
||||
*
|
||||
* http:
|
||||
* rules:
|
||||
* - selector: <proto_package_name>.Messaging.GetMessage
|
||||
* get: /v1/messages/{message_id}/{sub.subfield}
|
||||
*
|
||||
* This definition enables an automatic, bidrectional mapping of HTTP
|
||||
* JSON to RPC. Example:
|
||||
*
|
||||
* HTTP | RPC
|
||||
* -----|-----
|
||||
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub:
|
||||
* SubMessage(subfield: "foo"))`
|
||||
*
|
||||
* In general, not only fields but also field paths can be referenced
|
||||
* from a path pattern. Fields mapped to the path pattern cannot be
|
||||
* repeated and must have a primitive (non-message) type.
|
||||
*
|
||||
* Any fields in the request message which are not bound by the path
|
||||
* pattern automatically become (optional) HTTP query
|
||||
* parameters. Assume the following definition of the request message:
|
||||
*
|
||||
*
|
||||
* service Messaging {
|
||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
* option (google.api.http).get = "/v1/messages/{message_id}";
|
||||
* }
|
||||
* }
|
||||
* message GetMessageRequest {
|
||||
* message SubMessage {
|
||||
* string subfield = 1;
|
||||
* }
|
||||
* string message_id = 1; // mapped to the URL
|
||||
* int64 revision = 2; // becomes a parameter
|
||||
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
|
||||
* }
|
||||
*
|
||||
*
|
||||
* This enables a HTTP JSON to RPC mapping as below:
|
||||
*
|
||||
* HTTP | RPC
|
||||
* -----|-----
|
||||
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
|
||||
* `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
|
||||
* "foo"))`
|
||||
*
|
||||
* Note that fields which are mapped to HTTP parameters must have a
|
||||
* primitive type or a repeated primitive type. Message types are not
|
||||
* allowed. In the case of a repeated type, the parameter can be
|
||||
* repeated in the URL, as in `...?param=A¶m=B`.
|
||||
*
|
||||
* For HTTP method kinds which allow a request body, the `body` field
|
||||
* specifies the mapping. Consider a REST update method on the
|
||||
* message resource collection:
|
||||
*
|
||||
*
|
||||
* service Messaging {
|
||||
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
||||
* option (google.api.http) = {
|
||||
* put: "/v1/messages/{message_id}"
|
||||
* body: "message"
|
||||
* };
|
||||
* }
|
||||
* }
|
||||
* message UpdateMessageRequest {
|
||||
* string message_id = 1; // mapped to the URL
|
||||
* Message message = 2; // mapped to the body
|
||||
* }
|
||||
*
|
||||
*
|
||||
* The following HTTP JSON to RPC mapping is enabled, where the
|
||||
* representation of the JSON in the request body is determined by
|
||||
* protos JSON encoding:
|
||||
*
|
||||
* HTTP | RPC
|
||||
* -----|-----
|
||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||
* "123456" message { text: "Hi!" })`
|
||||
*
|
||||
* The special name `*` can be used in the body mapping to define that
|
||||
* every field not bound by the path template should be mapped to the
|
||||
* request body. This enables the following alternative definition of
|
||||
* the update method:
|
||||
*
|
||||
* service Messaging {
|
||||
* rpc UpdateMessage(Message) returns (Message) {
|
||||
* option (google.api.http) = {
|
||||
* put: "/v1/messages/{message_id}"
|
||||
* body: "*"
|
||||
* };
|
||||
* }
|
||||
* }
|
||||
* message Message {
|
||||
* string message_id = 1;
|
||||
* string text = 2;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* The following HTTP JSON to RPC mapping is enabled:
|
||||
*
|
||||
* HTTP | RPC
|
||||
* -----|-----
|
||||
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||
* "123456" text: "Hi!")`
|
||||
*
|
||||
* Note that when using `*` in the body mapping, it is not possible to
|
||||
* have HTTP parameters, as all fields not bound by the path end in
|
||||
* the body. This makes this option more rarely used in practice of
|
||||
* defining REST APIs. The common usage of `*` is in custom methods
|
||||
* which don't use the URL at all for transferring data.
|
||||
*
|
||||
* It is possible to define multiple HTTP methods for one RPC by using
|
||||
* the `additional_bindings` option. Example:
|
||||
*
|
||||
* service Messaging {
|
||||
* rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||
* option (google.api.http) = {
|
||||
* get: "/v1/messages/{message_id}"
|
||||
* additional_bindings {
|
||||
* get: "/v1/users/{user_id}/messages/{message_id}"
|
||||
* }
|
||||
* };
|
||||
* }
|
||||
* }
|
||||
* message GetMessageRequest {
|
||||
* string message_id = 1;
|
||||
* string user_id = 2;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* This enables the following two alternative HTTP JSON to RPC
|
||||
* mappings:
|
||||
*
|
||||
* HTTP | RPC
|
||||
* -----|-----
|
||||
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
||||
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
|
||||
* "123456")`
|
||||
*
|
||||
* # Rules for HTTP mapping
|
||||
*
|
||||
* The rules for mapping HTTP path, query parameters, and body fields
|
||||
* to the request message are as follows:
|
||||
*
|
||||
* 1. The `body` field specifies either `*` or a field path, or is
|
||||
* omitted. If omitted, it indicates there is no HTTP request body.
|
||||
* 2. Leaf fields (recursive expansion of nested messages in the
|
||||
* request) can be classified into three types:
|
||||
* (a) Matched in the URL template.
|
||||
* (b) Covered by body (if body is `*`, everything except (a) fields;
|
||||
* else everything under the body field)
|
||||
* (c) All other fields.
|
||||
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
|
||||
* 4. Any body sent with an HTTP request can contain only (b) fields.
|
||||
*
|
||||
* The syntax of the path template is as follows:
|
||||
*
|
||||
* Template = "/" Segments [ Verb ] ;
|
||||
* Segments = Segment { "/" Segment } ;
|
||||
* Segment = "*" | "**" | LITERAL | Variable ;
|
||||
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
||||
* FieldPath = IDENT { "." IDENT } ;
|
||||
* Verb = ":" LITERAL ;
|
||||
*
|
||||
* The syntax `*` matches a single path segment. The syntax `**` matches zero
|
||||
* or more path segments, which must be the last part of the path except the
|
||||
* `Verb`. The syntax `LITERAL` matches literal text in the path.
|
||||
*
|
||||
* The syntax `Variable` matches part of the URL path as specified by its
|
||||
* template. A variable template must not contain other variables. If a variable
|
||||
* matches a single path segment, its template may be omitted, e.g. `{var}`
|
||||
* is equivalent to `{var=*}`.
|
||||
*
|
||||
* If a variable contains exactly one path segment, such as `"{var}"` or
|
||||
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
|
||||
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
|
||||
* Discovery Document as `{var}`.
|
||||
*
|
||||
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
|
||||
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
|
||||
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
|
||||
* show up in the Discovery Document as `{+var}`.
|
||||
*
|
||||
* NOTE: While the single segment variable matches the semantics of
|
||||
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
|
||||
* Simple String Expansion, the multi segment variable **does not** match
|
||||
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
|
||||
* does not expand special characters like `?` and `#`, which would lead
|
||||
* to invalid URLs.
|
||||
*
|
||||
* NOTE: the field paths in variables and in the `body` must not refer to
|
||||
* repeated fields or map fields.
|
||||
*/
|
||||
export interface HttpRule {
|
||||
/**
|
||||
* Selects methods to which this rule applies.
|
||||
*
|
||||
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
|
||||
* details.
|
||||
*/
|
||||
selector: string;
|
||||
/** Used for listing and getting information about resources. */
|
||||
get: string | undefined;
|
||||
/** Used for updating a resource. */
|
||||
put: string | undefined;
|
||||
/** Used for creating a resource. */
|
||||
post: string | undefined;
|
||||
/** Used for deleting a resource. */
|
||||
delete: string | undefined;
|
||||
/** Used for updating a resource. */
|
||||
patch: string | undefined;
|
||||
/**
|
||||
* The custom pattern is used for specifying an HTTP method that is not
|
||||
* included in the `pattern` field, such as HEAD, or "*" to leave the
|
||||
* HTTP method unspecified for this rule. The wild-card rule is useful
|
||||
* for services that provide content to Web (HTML) clients.
|
||||
*/
|
||||
custom?: CustomHttpPattern | undefined;
|
||||
/**
|
||||
* The name of the request field whose value is mapped to the HTTP body, or
|
||||
* `*` for mapping all fields not captured by the path pattern to the HTTP
|
||||
* body. NOTE: the referred field must not be a repeated field and must be
|
||||
* present at the top-level of request message type.
|
||||
*/
|
||||
body: string;
|
||||
/**
|
||||
* Optional. The name of the response field whose value is mapped to the HTTP
|
||||
* body of response. Other response fields are ignored. When
|
||||
* not set, the response message will be used as HTTP body of response.
|
||||
*/
|
||||
responseBody: string;
|
||||
/**
|
||||
* Additional HTTP bindings for the selector. Nested bindings must
|
||||
* not contain an `additional_bindings` field themselves (that is,
|
||||
* the nesting may only be one level deep).
|
||||
*/
|
||||
additionalBindings: HttpRule[];
|
||||
}
|
||||
|
||||
/** A custom pattern is used for defining custom HTTP verb. */
|
||||
export interface CustomHttpPattern {
|
||||
/** The name of this custom HTTP verb. */
|
||||
kind: string;
|
||||
/** The path matched by this custom verb. */
|
||||
path: string;
|
||||
}
|
||||
|
||||
function createBaseHttp(): Http {
|
||||
return { rules: [], fullyDecodeReservedExpansion: false };
|
||||
}
|
||||
|
||||
export const Http = {
|
||||
encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
for (const v of message.rules) {
|
||||
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.fullyDecodeReservedExpansion === true) {
|
||||
writer.uint32(16).bool(message.fullyDecodeReservedExpansion);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Http {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHttp();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.rules.push(HttpRule.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 2:
|
||||
message.fullyDecodeReservedExpansion = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Http {
|
||||
return {
|
||||
rules: Array.isArray(object?.rules)
|
||||
? object.rules.map((e: any) => HttpRule.fromJSON(e))
|
||||
: [],
|
||||
fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion)
|
||||
? Boolean(object.fullyDecodeReservedExpansion)
|
||||
: false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Http): unknown {
|
||||
const obj: any = {};
|
||||
if (message.rules) {
|
||||
obj.rules = message.rules.map((e) =>
|
||||
e ? HttpRule.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.rules = [];
|
||||
}
|
||||
message.fullyDecodeReservedExpansion !== undefined &&
|
||||
(obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Http>, I>>(object: I): Http {
|
||||
const message = createBaseHttp();
|
||||
message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || [];
|
||||
message.fullyDecodeReservedExpansion =
|
||||
object.fullyDecodeReservedExpansion ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseHttpRule(): HttpRule {
|
||||
return {
|
||||
selector: "",
|
||||
get: undefined,
|
||||
put: undefined,
|
||||
post: undefined,
|
||||
delete: undefined,
|
||||
patch: undefined,
|
||||
custom: undefined,
|
||||
body: "",
|
||||
responseBody: "",
|
||||
additionalBindings: [],
|
||||
};
|
||||
}
|
||||
|
||||
export const HttpRule = {
|
||||
encode(
|
||||
message: HttpRule,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.selector !== "") {
|
||||
writer.uint32(10).string(message.selector);
|
||||
}
|
||||
if (message.get !== undefined) {
|
||||
writer.uint32(18).string(message.get);
|
||||
}
|
||||
if (message.put !== undefined) {
|
||||
writer.uint32(26).string(message.put);
|
||||
}
|
||||
if (message.post !== undefined) {
|
||||
writer.uint32(34).string(message.post);
|
||||
}
|
||||
if (message.delete !== undefined) {
|
||||
writer.uint32(42).string(message.delete);
|
||||
}
|
||||
if (message.patch !== undefined) {
|
||||
writer.uint32(50).string(message.patch);
|
||||
}
|
||||
if (message.custom !== undefined) {
|
||||
CustomHttpPattern.encode(
|
||||
message.custom,
|
||||
writer.uint32(66).fork()
|
||||
).ldelim();
|
||||
}
|
||||
if (message.body !== "") {
|
||||
writer.uint32(58).string(message.body);
|
||||
}
|
||||
if (message.responseBody !== "") {
|
||||
writer.uint32(98).string(message.responseBody);
|
||||
}
|
||||
for (const v of message.additionalBindings) {
|
||||
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHttpRule();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.selector = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.get = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.put = reader.string();
|
||||
break;
|
||||
case 4:
|
||||
message.post = reader.string();
|
||||
break;
|
||||
case 5:
|
||||
message.delete = reader.string();
|
||||
break;
|
||||
case 6:
|
||||
message.patch = reader.string();
|
||||
break;
|
||||
case 8:
|
||||
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 7:
|
||||
message.body = reader.string();
|
||||
break;
|
||||
case 12:
|
||||
message.responseBody = reader.string();
|
||||
break;
|
||||
case 11:
|
||||
message.additionalBindings.push(
|
||||
HttpRule.decode(reader, reader.uint32())
|
||||
);
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): HttpRule {
|
||||
return {
|
||||
selector: isSet(object.selector) ? String(object.selector) : "",
|
||||
get: isSet(object.get) ? String(object.get) : undefined,
|
||||
put: isSet(object.put) ? String(object.put) : undefined,
|
||||
post: isSet(object.post) ? String(object.post) : undefined,
|
||||
delete: isSet(object.delete) ? String(object.delete) : undefined,
|
||||
patch: isSet(object.patch) ? String(object.patch) : undefined,
|
||||
custom: isSet(object.custom)
|
||||
? CustomHttpPattern.fromJSON(object.custom)
|
||||
: undefined,
|
||||
body: isSet(object.body) ? String(object.body) : "",
|
||||
responseBody: isSet(object.responseBody)
|
||||
? String(object.responseBody)
|
||||
: "",
|
||||
additionalBindings: Array.isArray(object?.additionalBindings)
|
||||
? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: HttpRule): unknown {
|
||||
const obj: any = {};
|
||||
message.selector !== undefined && (obj.selector = message.selector);
|
||||
message.get !== undefined && (obj.get = message.get);
|
||||
message.put !== undefined && (obj.put = message.put);
|
||||
message.post !== undefined && (obj.post = message.post);
|
||||
message.delete !== undefined && (obj.delete = message.delete);
|
||||
message.patch !== undefined && (obj.patch = message.patch);
|
||||
message.custom !== undefined &&
|
||||
(obj.custom = message.custom
|
||||
? CustomHttpPattern.toJSON(message.custom)
|
||||
: undefined);
|
||||
message.body !== undefined && (obj.body = message.body);
|
||||
message.responseBody !== undefined &&
|
||||
(obj.responseBody = message.responseBody);
|
||||
if (message.additionalBindings) {
|
||||
obj.additionalBindings = message.additionalBindings.map((e) =>
|
||||
e ? HttpRule.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.additionalBindings = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<HttpRule>, I>>(object: I): HttpRule {
|
||||
const message = createBaseHttpRule();
|
||||
message.selector = object.selector ?? "";
|
||||
message.get = object.get ?? undefined;
|
||||
message.put = object.put ?? undefined;
|
||||
message.post = object.post ?? undefined;
|
||||
message.delete = object.delete ?? undefined;
|
||||
message.patch = object.patch ?? undefined;
|
||||
message.custom =
|
||||
object.custom !== undefined && object.custom !== null
|
||||
? CustomHttpPattern.fromPartial(object.custom)
|
||||
: undefined;
|
||||
message.body = object.body ?? "";
|
||||
message.responseBody = object.responseBody ?? "";
|
||||
message.additionalBindings =
|
||||
object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseCustomHttpPattern(): CustomHttpPattern {
|
||||
return { kind: "", path: "" };
|
||||
}
|
||||
|
||||
export const CustomHttpPattern = {
|
||||
encode(
|
||||
message: CustomHttpPattern,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.kind !== "") {
|
||||
writer.uint32(10).string(message.kind);
|
||||
}
|
||||
if (message.path !== "") {
|
||||
writer.uint32(18).string(message.path);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseCustomHttpPattern();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.kind = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.path = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): CustomHttpPattern {
|
||||
return {
|
||||
kind: isSet(object.kind) ? String(object.kind) : "",
|
||||
path: isSet(object.path) ? String(object.path) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: CustomHttpPattern): unknown {
|
||||
const obj: any = {};
|
||||
message.kind !== undefined && (obj.kind = message.kind);
|
||||
message.path !== undefined && (obj.path = message.path);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<CustomHttpPattern>, I>>(
|
||||
object: I
|
||||
): CustomHttpPattern {
|
||||
const message = createBaseCustomHttpPattern();
|
||||
message.kind = object.kind ?? "";
|
||||
message.path = object.path ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,187 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* A Duration represents a signed, fixed-length span of time represented
|
||||
* as a count of seconds and fractions of seconds at nanosecond
|
||||
* resolution. It is independent of any calendar and concepts like "day"
|
||||
* or "month". It is related to Timestamp in that the difference between
|
||||
* two Timestamp values is a Duration and it can be added or subtracted
|
||||
* from a Timestamp. Range is approximately +-10,000 years.
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* Example 1: Compute Duration from two Timestamps in pseudo code.
|
||||
*
|
||||
* Timestamp start = ...;
|
||||
* Timestamp end = ...;
|
||||
* Duration duration = ...;
|
||||
*
|
||||
* duration.seconds = end.seconds - start.seconds;
|
||||
* duration.nanos = end.nanos - start.nanos;
|
||||
*
|
||||
* if (duration.seconds < 0 && duration.nanos > 0) {
|
||||
* duration.seconds += 1;
|
||||
* duration.nanos -= 1000000000;
|
||||
* } else if (duration.seconds > 0 && duration.nanos < 0) {
|
||||
* duration.seconds -= 1;
|
||||
* duration.nanos += 1000000000;
|
||||
* }
|
||||
*
|
||||
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
||||
*
|
||||
* Timestamp start = ...;
|
||||
* Duration duration = ...;
|
||||
* Timestamp end = ...;
|
||||
*
|
||||
* end.seconds = start.seconds + duration.seconds;
|
||||
* end.nanos = start.nanos + duration.nanos;
|
||||
*
|
||||
* if (end.nanos < 0) {
|
||||
* end.seconds -= 1;
|
||||
* end.nanos += 1000000000;
|
||||
* } else if (end.nanos >= 1000000000) {
|
||||
* end.seconds += 1;
|
||||
* end.nanos -= 1000000000;
|
||||
* }
|
||||
*
|
||||
* Example 3: Compute Duration from datetime.timedelta in Python.
|
||||
*
|
||||
* td = datetime.timedelta(days=3, minutes=10)
|
||||
* duration = Duration()
|
||||
* duration.FromTimedelta(td)
|
||||
*
|
||||
* # JSON Mapping
|
||||
*
|
||||
* In JSON format, the Duration type is encoded as a string rather than an
|
||||
* object, where the string ends in the suffix "s" (indicating seconds) and
|
||||
* is preceded by the number of seconds, with nanoseconds expressed as
|
||||
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
||||
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
||||
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
||||
* microsecond should be expressed in JSON format as "3.000001s".
|
||||
*/
|
||||
export interface Duration {
|
||||
/**
|
||||
* Signed seconds of the span of time. Must be from -315,576,000,000
|
||||
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
||||
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
||||
*/
|
||||
seconds: Long;
|
||||
/**
|
||||
* Signed fractions of a second at nanosecond resolution of the span
|
||||
* of time. Durations less than one second are represented with a 0
|
||||
* `seconds` field and a positive or negative `nanos` field. For durations
|
||||
* of one second or more, a non-zero value for the `nanos` field must be
|
||||
* of the same sign as the `seconds` field. Must be from -999,999,999
|
||||
* to +999,999,999 inclusive.
|
||||
*/
|
||||
nanos: number;
|
||||
}
|
||||
|
||||
function createBaseDuration(): Duration {
|
||||
return { seconds: Long.ZERO, nanos: 0 };
|
||||
}
|
||||
|
||||
export const Duration = {
|
||||
encode(
|
||||
message: Duration,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (!message.seconds.isZero()) {
|
||||
writer.uint32(8).int64(message.seconds);
|
||||
}
|
||||
if (message.nanos !== 0) {
|
||||
writer.uint32(16).int32(message.nanos);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Duration {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDuration();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.seconds = reader.int64() as Long;
|
||||
break;
|
||||
case 2:
|
||||
message.nanos = reader.int32();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Duration {
|
||||
return {
|
||||
seconds: isSet(object.seconds)
|
||||
? Long.fromValue(object.seconds)
|
||||
: Long.ZERO,
|
||||
nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Duration): unknown {
|
||||
const obj: any = {};
|
||||
message.seconds !== undefined &&
|
||||
(obj.seconds = (message.seconds || Long.ZERO).toString());
|
||||
message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Duration>, I>>(object: I): Duration {
|
||||
const message = createBaseDuration();
|
||||
message.seconds =
|
||||
object.seconds !== undefined && object.seconds !== null
|
||||
? Long.fromValue(object.seconds)
|
||||
: Long.ZERO;
|
||||
message.nanos = object.nanos ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* A Timestamp represents a point in time independent of any time zone or local
|
||||
* calendar, encoded as a count of seconds and fractions of seconds at
|
||||
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||
* Gregorian calendar backwards to year one.
|
||||
*
|
||||
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||
* second table is needed for interpretation, using a [24-hour linear
|
||||
* smear](https://developers.google.com/time/smear).
|
||||
*
|
||||
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||
* restricting to that range, we ensure that we can convert to and from [RFC
|
||||
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* Example 1: Compute Timestamp from POSIX `time()`.
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(time(NULL));
|
||||
* timestamp.set_nanos(0);
|
||||
*
|
||||
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
*
|
||||
* struct timeval tv;
|
||||
* gettimeofday(&tv, NULL);
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(tv.tv_sec);
|
||||
* timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
*
|
||||
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
*
|
||||
* FILETIME ft;
|
||||
* GetSystemTimeAsFileTime(&ft);
|
||||
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
*
|
||||
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
*
|
||||
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
*
|
||||
* long millis = System.currentTimeMillis();
|
||||
*
|
||||
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
*
|
||||
*
|
||||
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||
*
|
||||
* Instant now = Instant.now();
|
||||
*
|
||||
* Timestamp timestamp =
|
||||
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||
* .setNanos(now.getNano()).build();
|
||||
*
|
||||
*
|
||||
* Example 6: Compute Timestamp from current time in Python.
|
||||
*
|
||||
* timestamp = Timestamp()
|
||||
* timestamp.GetCurrentTime()
|
||||
*
|
||||
* # JSON Mapping
|
||||
*
|
||||
* In JSON format, the Timestamp type is encoded as a string in the
|
||||
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||
* where {year} is always expressed using four digits while {month}, {day},
|
||||
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||
* able to accept both UTC and other timezones (as indicated by an offset).
|
||||
*
|
||||
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||
* 01:30 UTC on January 15, 2017.
|
||||
*
|
||||
* In JavaScript, one can convert a Date object to this format using the
|
||||
* standard
|
||||
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
* method. In Python, a standard `datetime.datetime` object can be converted
|
||||
* to this format using
|
||||
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
||||
* ) to obtain a formatter capable of generating timestamps in this format.
|
||||
*/
|
||||
export interface Timestamp {
|
||||
/**
|
||||
* Represents seconds of UTC time since Unix epoch
|
||||
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
* 9999-12-31T23:59:59Z inclusive.
|
||||
*/
|
||||
seconds: Long;
|
||||
/**
|
||||
* Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
* second values with fractions must still have non-negative nanos values
|
||||
* that count forward in time. Must be from 0 to 999,999,999
|
||||
* inclusive.
|
||||
*/
|
||||
nanos: number;
|
||||
}
|
||||
|
||||
function createBaseTimestamp(): Timestamp {
|
||||
return { seconds: Long.ZERO, nanos: 0 };
|
||||
}
|
||||
|
||||
export const Timestamp = {
|
||||
encode(
|
||||
message: Timestamp,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (!message.seconds.isZero()) {
|
||||
writer.uint32(8).int64(message.seconds);
|
||||
}
|
||||
if (message.nanos !== 0) {
|
||||
writer.uint32(16).int32(message.nanos);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTimestamp();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.seconds = reader.int64() as Long;
|
||||
break;
|
||||
case 2:
|
||||
message.nanos = reader.int32();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Timestamp {
|
||||
return {
|
||||
seconds: isSet(object.seconds)
|
||||
? Long.fromValue(object.seconds)
|
||||
: Long.ZERO,
|
||||
nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Timestamp): unknown {
|
||||
const obj: any = {};
|
||||
message.seconds !== undefined &&
|
||||
(obj.seconds = (message.seconds || Long.ZERO).toString());
|
||||
message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(
|
||||
object: I
|
||||
): Timestamp {
|
||||
const message = createBaseTimestamp();
|
||||
message.seconds =
|
||||
object.seconds !== undefined && object.seconds !== null
|
||||
? Long.fromValue(object.seconds)
|
||||
: Long.ZERO;
|
||||
message.nanos = object.nanos ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
Reference in new issue
Block a user