From cdc1acec3442f39e79da8066774c9639ecc5653b Mon Sep 17 00:00:00 2001 From: Maxime Cyr <2829180+Redm4x@users.noreply.github.com> Date: Thu, 16 Nov 2023 21:23:18 -0500 Subject: [PATCH] Add v1beta4 market protobuf types (#62) * Regenerate protobuf files * Update version in stargate messages --- src/protobuf/akash/market/v1beta4/bid.ts | 888 +++++++++++++ src/protobuf/akash/market/v1beta4/genesis.ts | 171 +++ src/protobuf/akash/market/v1beta4/lease.ts | 857 +++++++++++++ src/protobuf/akash/market/v1beta4/order.ts | 429 +++++++ src/protobuf/akash/market/v1beta4/params.ts | 133 ++ src/protobuf/akash/market/v1beta4/query.ts | 1201 ++++++++++++++++++ src/protobuf/akash/market/v1beta4/service.ts | 111 ++ src/stargate/index.ts | 2 +- 8 files changed, 3791 insertions(+), 1 deletion(-) create mode 100644 src/protobuf/akash/market/v1beta4/bid.ts create mode 100644 src/protobuf/akash/market/v1beta4/genesis.ts create mode 100644 src/protobuf/akash/market/v1beta4/lease.ts create mode 100644 src/protobuf/akash/market/v1beta4/order.ts create mode 100644 src/protobuf/akash/market/v1beta4/params.ts create mode 100644 src/protobuf/akash/market/v1beta4/query.ts create mode 100644 src/protobuf/akash/market/v1beta4/service.ts diff --git a/src/protobuf/akash/market/v1beta4/bid.ts b/src/protobuf/akash/market/v1beta4/bid.ts new file mode 100644 index 0000000..3e593e1 --- /dev/null +++ b/src/protobuf/akash/market/v1beta4/bid.ts @@ -0,0 +1,888 @@ +/* eslint-disable */ +import { messageTypeRegistry } from "../../../typeRegistry"; +import Long from "long"; +import { Resources } from "../../base/v1beta3/resources"; +import { OrderID } from "./order"; +import { DecCoin, Coin } from "../../../cosmos/base/v1beta1/coin"; +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "akash.market.v1beta4"; + +/** + * ResourceOffer describes resources that provider is offering + * for deployment + */ +export interface ResourceOffer { + $type: "akash.market.v1beta4.ResourceOffer"; + resources: Resources | undefined; + count: number; +} + +/** MsgCreateBid defines an SDK message for creating Bid */ +export interface MsgCreateBid { + $type: "akash.market.v1beta4.MsgCreateBid"; + order: OrderID | undefined; + provider: string; + price: DecCoin | undefined; + deposit: Coin | undefined; + resourcesOffer: ResourceOffer[]; +} + +/** MsgCreateBidResponse defines the Msg/CreateBid response type. */ +export interface MsgCreateBidResponse { + $type: "akash.market.v1beta4.MsgCreateBidResponse"; +} + +/** MsgCloseBid defines an SDK message for closing bid */ +export interface MsgCloseBid { + $type: "akash.market.v1beta4.MsgCloseBid"; + bidId: BidID | undefined; +} + +/** MsgCloseBidResponse defines the Msg/CloseBid response type. */ +export interface MsgCloseBidResponse { + $type: "akash.market.v1beta4.MsgCloseBidResponse"; +} + +/** + * BidID stores owner and all other seq numbers + * A successful bid becomes a Lease(ID). + */ +export interface BidID { + $type: "akash.market.v1beta4.BidID"; + owner: string; + dseq: Long; + gseq: number; + oseq: number; + provider: string; +} + +/** Bid stores BidID, state of bid and price */ +export interface Bid { + $type: "akash.market.v1beta4.Bid"; + bidId: BidID | undefined; + state: Bid_State; + price: DecCoin | undefined; + createdAt: Long; + resourcesOffer: ResourceOffer[]; +} + +/** State is an enum which refers to state of bid */ +export enum Bid_State { + /** invalid - Prefix should start with 0 in enum. So declaring dummy state */ + invalid = 0, + /** open - BidOpen denotes state for bid open */ + open = 1, + /** active - BidMatched denotes state for bid open */ + active = 2, + /** lost - BidLost denotes state for bid lost */ + lost = 3, + /** closed - BidClosed denotes state for bid closed */ + closed = 4, + UNRECOGNIZED = -1, +} + +export function bid_StateFromJSON(object: any): Bid_State { + switch (object) { + case 0: + case "invalid": + return Bid_State.invalid; + case 1: + case "open": + return Bid_State.open; + case 2: + case "active": + return Bid_State.active; + case 3: + case "lost": + return Bid_State.lost; + case 4: + case "closed": + return Bid_State.closed; + case -1: + case "UNRECOGNIZED": + default: + return Bid_State.UNRECOGNIZED; + } +} + +export function bid_StateToJSON(object: Bid_State): string { + switch (object) { + case Bid_State.invalid: + return "invalid"; + case Bid_State.open: + return "open"; + case Bid_State.active: + return "active"; + case Bid_State.lost: + return "lost"; + case Bid_State.closed: + return "closed"; + case Bid_State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** BidFilters defines flags for bid list filter */ +export interface BidFilters { + $type: "akash.market.v1beta4.BidFilters"; + owner: string; + dseq: Long; + gseq: number; + oseq: number; + provider: string; + state: string; +} + +function createBaseResourceOffer(): ResourceOffer { + return { + $type: "akash.market.v1beta4.ResourceOffer", + resources: undefined, + count: 0, + }; +} + +export const ResourceOffer = { + $type: "akash.market.v1beta4.ResourceOffer" as const, + + encode( + message: ResourceOffer, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.resources !== undefined) { + Resources.encode(message.resources, writer.uint32(10).fork()).ldelim(); + } + if (message.count !== 0) { + writer.uint32(16).uint32(message.count); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ResourceOffer { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceOffer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resources = Resources.decode(reader, reader.uint32()); + break; + case 2: + message.count = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ResourceOffer { + return { + $type: ResourceOffer.$type, + resources: isSet(object.resources) + ? Resources.fromJSON(object.resources) + : undefined, + count: isSet(object.count) ? Number(object.count) : 0, + }; + }, + + toJSON(message: ResourceOffer): unknown { + const obj: any = {}; + message.resources !== undefined && + (obj.resources = message.resources + ? Resources.toJSON(message.resources) + : undefined); + message.count !== undefined && (obj.count = Math.round(message.count)); + return obj; + }, + + fromPartial, I>>( + object: I + ): ResourceOffer { + const message = createBaseResourceOffer(); + message.resources = + object.resources !== undefined && object.resources !== null + ? Resources.fromPartial(object.resources) + : undefined; + message.count = object.count ?? 0; + return message; + }, +}; + +messageTypeRegistry.set(ResourceOffer.$type, ResourceOffer); + +function createBaseMsgCreateBid(): MsgCreateBid { + return { + $type: "akash.market.v1beta4.MsgCreateBid", + order: undefined, + provider: "", + price: undefined, + deposit: undefined, + resourcesOffer: [], + }; +} + +export const MsgCreateBid = { + $type: "akash.market.v1beta4.MsgCreateBid" as const, + + encode( + message: MsgCreateBid, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.order !== undefined) { + OrderID.encode(message.order, writer.uint32(10).fork()).ldelim(); + } + if (message.provider !== "") { + writer.uint32(18).string(message.provider); + } + if (message.price !== undefined) { + DecCoin.encode(message.price, writer.uint32(26).fork()).ldelim(); + } + if (message.deposit !== undefined) { + Coin.encode(message.deposit, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.resourcesOffer) { + ResourceOffer.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateBid { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateBid(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.order = OrderID.decode(reader, reader.uint32()); + break; + case 2: + message.provider = reader.string(); + break; + case 3: + message.price = DecCoin.decode(reader, reader.uint32()); + break; + case 4: + message.deposit = Coin.decode(reader, reader.uint32()); + break; + case 5: + message.resourcesOffer.push( + ResourceOffer.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateBid { + return { + $type: MsgCreateBid.$type, + order: isSet(object.order) ? OrderID.fromJSON(object.order) : undefined, + provider: isSet(object.provider) ? String(object.provider) : "", + price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, + deposit: isSet(object.deposit) + ? Coin.fromJSON(object.deposit) + : undefined, + resourcesOffer: Array.isArray(object?.resourcesOffer) + ? object.resourcesOffer.map((e: any) => ResourceOffer.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgCreateBid): unknown { + const obj: any = {}; + message.order !== undefined && + (obj.order = message.order ? OrderID.toJSON(message.order) : undefined); + message.provider !== undefined && (obj.provider = message.provider); + message.price !== undefined && + (obj.price = message.price ? DecCoin.toJSON(message.price) : undefined); + message.deposit !== undefined && + (obj.deposit = message.deposit + ? Coin.toJSON(message.deposit) + : undefined); + if (message.resourcesOffer) { + obj.resourcesOffer = message.resourcesOffer.map((e) => + e ? ResourceOffer.toJSON(e) : undefined + ); + } else { + obj.resourcesOffer = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCreateBid { + const message = createBaseMsgCreateBid(); + message.order = + object.order !== undefined && object.order !== null + ? OrderID.fromPartial(object.order) + : undefined; + message.provider = object.provider ?? ""; + message.price = + object.price !== undefined && object.price !== null + ? DecCoin.fromPartial(object.price) + : undefined; + message.deposit = + object.deposit !== undefined && object.deposit !== null + ? Coin.fromPartial(object.deposit) + : undefined; + message.resourcesOffer = + object.resourcesOffer?.map((e) => ResourceOffer.fromPartial(e)) || []; + return message; + }, +}; + +messageTypeRegistry.set(MsgCreateBid.$type, MsgCreateBid); + +function createBaseMsgCreateBidResponse(): MsgCreateBidResponse { + return { $type: "akash.market.v1beta4.MsgCreateBidResponse" }; +} + +export const MsgCreateBidResponse = { + $type: "akash.market.v1beta4.MsgCreateBidResponse" as const, + + encode( + _: MsgCreateBidResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgCreateBidResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateBidResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCreateBidResponse { + return { + $type: MsgCreateBidResponse.$type, + }; + }, + + toJSON(_: MsgCreateBidResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgCreateBidResponse { + const message = createBaseMsgCreateBidResponse(); + return message; + }, +}; + +messageTypeRegistry.set(MsgCreateBidResponse.$type, MsgCreateBidResponse); + +function createBaseMsgCloseBid(): MsgCloseBid { + return { $type: "akash.market.v1beta4.MsgCloseBid", bidId: undefined }; +} + +export const MsgCloseBid = { + $type: "akash.market.v1beta4.MsgCloseBid" as const, + + encode( + message: MsgCloseBid, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bidId !== undefined) { + BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCloseBid { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCloseBid(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bidId = BidID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCloseBid { + return { + $type: MsgCloseBid.$type, + bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined, + }; + }, + + toJSON(message: MsgCloseBid): unknown { + const obj: any = {}; + message.bidId !== undefined && + (obj.bidId = message.bidId ? BidID.toJSON(message.bidId) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCloseBid { + const message = createBaseMsgCloseBid(); + message.bidId = + object.bidId !== undefined && object.bidId !== null + ? BidID.fromPartial(object.bidId) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(MsgCloseBid.$type, MsgCloseBid); + +function createBaseMsgCloseBidResponse(): MsgCloseBidResponse { + return { $type: "akash.market.v1beta4.MsgCloseBidResponse" }; +} + +export const MsgCloseBidResponse = { + $type: "akash.market.v1beta4.MsgCloseBidResponse" as const, + + encode( + _: MsgCloseBidResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCloseBidResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCloseBidResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCloseBidResponse { + return { + $type: MsgCloseBidResponse.$type, + }; + }, + + toJSON(_: MsgCloseBidResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgCloseBidResponse { + const message = createBaseMsgCloseBidResponse(); + return message; + }, +}; + +messageTypeRegistry.set(MsgCloseBidResponse.$type, MsgCloseBidResponse); + +function createBaseBidID(): BidID { + return { + $type: "akash.market.v1beta4.BidID", + owner: "", + dseq: Long.UZERO, + gseq: 0, + oseq: 0, + provider: "", + }; +} + +export const BidID = { + $type: "akash.market.v1beta4.BidID" as const, + + encode(message: BidID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (!message.dseq.isZero()) { + writer.uint32(16).uint64(message.dseq); + } + if (message.gseq !== 0) { + writer.uint32(24).uint32(message.gseq); + } + if (message.oseq !== 0) { + writer.uint32(32).uint32(message.oseq); + } + if (message.provider !== "") { + writer.uint32(42).string(message.provider); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BidID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBidID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.dseq = reader.uint64() as Long; + break; + case 3: + message.gseq = reader.uint32(); + break; + case 4: + message.oseq = reader.uint32(); + break; + case 5: + message.provider = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BidID { + return { + $type: BidID.$type, + owner: isSet(object.owner) ? String(object.owner) : "", + dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO, + gseq: isSet(object.gseq) ? Number(object.gseq) : 0, + oseq: isSet(object.oseq) ? Number(object.oseq) : 0, + provider: isSet(object.provider) ? String(object.provider) : "", + }; + }, + + toJSON(message: BidID): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.dseq !== undefined && + (obj.dseq = (message.dseq || Long.UZERO).toString()); + message.gseq !== undefined && (obj.gseq = Math.round(message.gseq)); + message.oseq !== undefined && (obj.oseq = Math.round(message.oseq)); + message.provider !== undefined && (obj.provider = message.provider); + return obj; + }, + + fromPartial, I>>(object: I): BidID { + const message = createBaseBidID(); + message.owner = object.owner ?? ""; + message.dseq = + object.dseq !== undefined && object.dseq !== null + ? Long.fromValue(object.dseq) + : Long.UZERO; + message.gseq = object.gseq ?? 0; + message.oseq = object.oseq ?? 0; + message.provider = object.provider ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(BidID.$type, BidID); + +function createBaseBid(): Bid { + return { + $type: "akash.market.v1beta4.Bid", + bidId: undefined, + state: 0, + price: undefined, + createdAt: Long.ZERO, + resourcesOffer: [], + }; +} + +export const Bid = { + $type: "akash.market.v1beta4.Bid" as const, + + encode(message: Bid, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.bidId !== undefined) { + BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(16).int32(message.state); + } + if (message.price !== undefined) { + DecCoin.encode(message.price, writer.uint32(26).fork()).ldelim(); + } + if (!message.createdAt.isZero()) { + writer.uint32(32).int64(message.createdAt); + } + for (const v of message.resourcesOffer) { + ResourceOffer.encode(v!, writer.uint32(42).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.bidId = BidID.decode(reader, reader.uint32()); + break; + case 2: + message.state = reader.int32() as any; + break; + case 3: + message.price = DecCoin.decode(reader, reader.uint32()); + break; + case 4: + message.createdAt = reader.int64() as Long; + break; + case 5: + message.resourcesOffer.push( + ResourceOffer.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Bid { + return { + $type: Bid.$type, + bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined, + state: isSet(object.state) ? bid_StateFromJSON(object.state) : 0, + price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, + createdAt: isSet(object.createdAt) + ? Long.fromValue(object.createdAt) + : Long.ZERO, + resourcesOffer: Array.isArray(object?.resourcesOffer) + ? object.resourcesOffer.map((e: any) => ResourceOffer.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Bid): unknown { + const obj: any = {}; + message.bidId !== undefined && + (obj.bidId = message.bidId ? BidID.toJSON(message.bidId) : undefined); + message.state !== undefined && (obj.state = bid_StateToJSON(message.state)); + message.price !== undefined && + (obj.price = message.price ? DecCoin.toJSON(message.price) : undefined); + message.createdAt !== undefined && + (obj.createdAt = (message.createdAt || Long.ZERO).toString()); + if (message.resourcesOffer) { + obj.resourcesOffer = message.resourcesOffer.map((e) => + e ? ResourceOffer.toJSON(e) : undefined + ); + } else { + obj.resourcesOffer = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Bid { + const message = createBaseBid(); + message.bidId = + object.bidId !== undefined && object.bidId !== null + ? BidID.fromPartial(object.bidId) + : undefined; + message.state = object.state ?? 0; + message.price = + object.price !== undefined && object.price !== null + ? DecCoin.fromPartial(object.price) + : undefined; + message.createdAt = + object.createdAt !== undefined && object.createdAt !== null + ? Long.fromValue(object.createdAt) + : Long.ZERO; + message.resourcesOffer = + object.resourcesOffer?.map((e) => ResourceOffer.fromPartial(e)) || []; + return message; + }, +}; + +messageTypeRegistry.set(Bid.$type, Bid); + +function createBaseBidFilters(): BidFilters { + return { + $type: "akash.market.v1beta4.BidFilters", + owner: "", + dseq: Long.UZERO, + gseq: 0, + oseq: 0, + provider: "", + state: "", + }; +} + +export const BidFilters = { + $type: "akash.market.v1beta4.BidFilters" as const, + + encode( + message: BidFilters, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (!message.dseq.isZero()) { + writer.uint32(16).uint64(message.dseq); + } + if (message.gseq !== 0) { + writer.uint32(24).uint32(message.gseq); + } + if (message.oseq !== 0) { + writer.uint32(32).uint32(message.oseq); + } + if (message.provider !== "") { + writer.uint32(42).string(message.provider); + } + if (message.state !== "") { + writer.uint32(50).string(message.state); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BidFilters { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBidFilters(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.dseq = reader.uint64() as Long; + break; + case 3: + message.gseq = reader.uint32(); + break; + case 4: + message.oseq = reader.uint32(); + break; + case 5: + message.provider = reader.string(); + break; + case 6: + message.state = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): BidFilters { + return { + $type: BidFilters.$type, + owner: isSet(object.owner) ? String(object.owner) : "", + dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO, + gseq: isSet(object.gseq) ? Number(object.gseq) : 0, + oseq: isSet(object.oseq) ? Number(object.oseq) : 0, + provider: isSet(object.provider) ? String(object.provider) : "", + state: isSet(object.state) ? String(object.state) : "", + }; + }, + + toJSON(message: BidFilters): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.dseq !== undefined && + (obj.dseq = (message.dseq || Long.UZERO).toString()); + message.gseq !== undefined && (obj.gseq = Math.round(message.gseq)); + message.oseq !== undefined && (obj.oseq = Math.round(message.oseq)); + message.provider !== undefined && (obj.provider = message.provider); + message.state !== undefined && (obj.state = message.state); + return obj; + }, + + fromPartial, I>>( + object: I + ): BidFilters { + const message = createBaseBidFilters(); + message.owner = object.owner ?? ""; + message.dseq = + object.dseq !== undefined && object.dseq !== null + ? Long.fromValue(object.dseq) + : Long.UZERO; + message.gseq = object.gseq ?? 0; + message.oseq = object.oseq ?? 0; + message.provider = object.provider ?? ""; + message.state = object.state ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(BidFilters.$type, BidFilters); + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude | "$type">, + never + >; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protobuf/akash/market/v1beta4/genesis.ts b/src/protobuf/akash/market/v1beta4/genesis.ts new file mode 100644 index 0000000..a2c17f3 --- /dev/null +++ b/src/protobuf/akash/market/v1beta4/genesis.ts @@ -0,0 +1,171 @@ +/* eslint-disable */ +import { messageTypeRegistry } from "../../../typeRegistry"; +import Long from "long"; +import { Params } from "./params"; +import { Order } from "./order"; +import { Lease } from "./lease"; +import { Bid } from "./bid"; +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "akash.market.v1beta4"; + +/** GenesisState defines the basic genesis state used by market module */ +export interface GenesisState { + $type: "akash.market.v1beta4.GenesisState"; + params: Params | undefined; + orders: Order[]; + leases: Lease[]; + bids: Bid[]; +} + +function createBaseGenesisState(): GenesisState { + return { + $type: "akash.market.v1beta4.GenesisState", + params: undefined, + orders: [], + leases: [], + bids: [], + }; +} + +export const GenesisState = { + $type: "akash.market.v1beta4.GenesisState" as const, + + 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.orders) { + Order.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.leases) { + Lease.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.bids) { + Bid.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.orders.push(Order.decode(reader, reader.uint32())); + break; + case 3: + message.leases.push(Lease.decode(reader, reader.uint32())); + break; + case 4: + message.bids.push(Bid.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + $type: GenesisState.$type, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + orders: Array.isArray(object?.orders) + ? object.orders.map((e: any) => Order.fromJSON(e)) + : [], + leases: Array.isArray(object?.leases) + ? object.leases.map((e: any) => Lease.fromJSON(e)) + : [], + bids: Array.isArray(object?.bids) + ? object.bids.map((e: any) => Bid.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + if (message.orders) { + obj.orders = message.orders.map((e) => (e ? Order.toJSON(e) : undefined)); + } else { + obj.orders = []; + } + if (message.leases) { + obj.leases = message.leases.map((e) => (e ? Lease.toJSON(e) : undefined)); + } else { + obj.leases = []; + } + if (message.bids) { + obj.bids = message.bids.map((e) => (e ? Bid.toJSON(e) : undefined)); + } else { + obj.bids = []; + } + return obj; + }, + + fromPartial, I>>( + object: I + ): GenesisState { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.orders = object.orders?.map((e) => Order.fromPartial(e)) || []; + message.leases = object.leases?.map((e) => Lease.fromPartial(e)) || []; + message.bids = object.bids?.map((e) => Bid.fromPartial(e)) || []; + return message; + }, +}; + +messageTypeRegistry.set(GenesisState.$type, GenesisState); + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude | "$type">, + never + >; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protobuf/akash/market/v1beta4/lease.ts b/src/protobuf/akash/market/v1beta4/lease.ts new file mode 100644 index 0000000..bde1925 --- /dev/null +++ b/src/protobuf/akash/market/v1beta4/lease.ts @@ -0,0 +1,857 @@ +/* eslint-disable */ +import { messageTypeRegistry } from "../../../typeRegistry"; +import Long from "long"; +import { DecCoin } from "../../../cosmos/base/v1beta1/coin"; +import { BidID } from "./bid"; +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "akash.market.v1beta4"; + +/** LeaseID stores bid details of lease */ +export interface LeaseID { + $type: "akash.market.v1beta4.LeaseID"; + owner: string; + dseq: Long; + gseq: number; + oseq: number; + provider: string; +} + +/** Lease stores LeaseID, state of lease and price */ +export interface Lease { + $type: "akash.market.v1beta4.Lease"; + leaseId: LeaseID | undefined; + state: Lease_State; + price: DecCoin | undefined; + createdAt: Long; + closedOn: Long; +} + +/** State is an enum which refers to state of lease */ +export enum Lease_State { + /** invalid - Prefix should start with 0 in enum. So declaring dummy state */ + invalid = 0, + /** active - LeaseActive denotes state for lease active */ + active = 1, + /** insufficient_funds - LeaseInsufficientFunds denotes state for lease insufficient_funds */ + insufficient_funds = 2, + /** closed - LeaseClosed denotes state for lease closed */ + closed = 3, + UNRECOGNIZED = -1, +} + +export function lease_StateFromJSON(object: any): Lease_State { + switch (object) { + case 0: + case "invalid": + return Lease_State.invalid; + case 1: + case "active": + return Lease_State.active; + case 2: + case "insufficient_funds": + return Lease_State.insufficient_funds; + case 3: + case "closed": + return Lease_State.closed; + case -1: + case "UNRECOGNIZED": + default: + return Lease_State.UNRECOGNIZED; + } +} + +export function lease_StateToJSON(object: Lease_State): string { + switch (object) { + case Lease_State.invalid: + return "invalid"; + case Lease_State.active: + return "active"; + case Lease_State.insufficient_funds: + return "insufficient_funds"; + case Lease_State.closed: + return "closed"; + case Lease_State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** LeaseFilters defines flags for lease list filter */ +export interface LeaseFilters { + $type: "akash.market.v1beta4.LeaseFilters"; + owner: string; + dseq: Long; + gseq: number; + oseq: number; + provider: string; + state: string; +} + +/** MsgCreateLease is sent to create a lease */ +export interface MsgCreateLease { + $type: "akash.market.v1beta4.MsgCreateLease"; + bidId: BidID | undefined; +} + +/** MsgCreateLeaseResponse is the response from creating a lease */ +export interface MsgCreateLeaseResponse { + $type: "akash.market.v1beta4.MsgCreateLeaseResponse"; +} + +/** MsgWithdrawLease defines an SDK message for closing bid */ +export interface MsgWithdrawLease { + $type: "akash.market.v1beta4.MsgWithdrawLease"; + bidId: LeaseID | undefined; +} + +/** MsgWithdrawLeaseResponse defines the Msg/WithdrawLease response type. */ +export interface MsgWithdrawLeaseResponse { + $type: "akash.market.v1beta4.MsgWithdrawLeaseResponse"; +} + +/** MsgCloseLease defines an SDK message for closing order */ +export interface MsgCloseLease { + $type: "akash.market.v1beta4.MsgCloseLease"; + leaseId: LeaseID | undefined; +} + +/** MsgCloseLeaseResponse defines the Msg/CloseLease response type. */ +export interface MsgCloseLeaseResponse { + $type: "akash.market.v1beta4.MsgCloseLeaseResponse"; +} + +function createBaseLeaseID(): LeaseID { + return { + $type: "akash.market.v1beta4.LeaseID", + owner: "", + dseq: Long.UZERO, + gseq: 0, + oseq: 0, + provider: "", + }; +} + +export const LeaseID = { + $type: "akash.market.v1beta4.LeaseID" as const, + + encode( + message: LeaseID, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (!message.dseq.isZero()) { + writer.uint32(16).uint64(message.dseq); + } + if (message.gseq !== 0) { + writer.uint32(24).uint32(message.gseq); + } + if (message.oseq !== 0) { + writer.uint32(32).uint32(message.oseq); + } + if (message.provider !== "") { + writer.uint32(42).string(message.provider); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LeaseID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeaseID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.dseq = reader.uint64() as Long; + break; + case 3: + message.gseq = reader.uint32(); + break; + case 4: + message.oseq = reader.uint32(); + break; + case 5: + message.provider = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LeaseID { + return { + $type: LeaseID.$type, + owner: isSet(object.owner) ? String(object.owner) : "", + dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO, + gseq: isSet(object.gseq) ? Number(object.gseq) : 0, + oseq: isSet(object.oseq) ? Number(object.oseq) : 0, + provider: isSet(object.provider) ? String(object.provider) : "", + }; + }, + + toJSON(message: LeaseID): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.dseq !== undefined && + (obj.dseq = (message.dseq || Long.UZERO).toString()); + message.gseq !== undefined && (obj.gseq = Math.round(message.gseq)); + message.oseq !== undefined && (obj.oseq = Math.round(message.oseq)); + message.provider !== undefined && (obj.provider = message.provider); + return obj; + }, + + fromPartial, I>>(object: I): LeaseID { + const message = createBaseLeaseID(); + message.owner = object.owner ?? ""; + message.dseq = + object.dseq !== undefined && object.dseq !== null + ? Long.fromValue(object.dseq) + : Long.UZERO; + message.gseq = object.gseq ?? 0; + message.oseq = object.oseq ?? 0; + message.provider = object.provider ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(LeaseID.$type, LeaseID); + +function createBaseLease(): Lease { + return { + $type: "akash.market.v1beta4.Lease", + leaseId: undefined, + state: 0, + price: undefined, + createdAt: Long.ZERO, + closedOn: Long.ZERO, + }; +} + +export const Lease = { + $type: "akash.market.v1beta4.Lease" as const, + + encode(message: Lease, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.leaseId !== undefined) { + LeaseID.encode(message.leaseId, writer.uint32(10).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(16).int32(message.state); + } + if (message.price !== undefined) { + DecCoin.encode(message.price, writer.uint32(26).fork()).ldelim(); + } + if (!message.createdAt.isZero()) { + writer.uint32(32).int64(message.createdAt); + } + if (!message.closedOn.isZero()) { + writer.uint32(40).int64(message.closedOn); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Lease { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leaseId = LeaseID.decode(reader, reader.uint32()); + break; + case 2: + message.state = reader.int32() as any; + break; + case 3: + message.price = DecCoin.decode(reader, reader.uint32()); + break; + case 4: + message.createdAt = reader.int64() as Long; + break; + case 5: + message.closedOn = reader.int64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Lease { + return { + $type: Lease.$type, + leaseId: isSet(object.leaseId) + ? LeaseID.fromJSON(object.leaseId) + : undefined, + state: isSet(object.state) ? lease_StateFromJSON(object.state) : 0, + price: isSet(object.price) ? DecCoin.fromJSON(object.price) : undefined, + createdAt: isSet(object.createdAt) + ? Long.fromValue(object.createdAt) + : Long.ZERO, + closedOn: isSet(object.closedOn) + ? Long.fromValue(object.closedOn) + : Long.ZERO, + }; + }, + + toJSON(message: Lease): unknown { + const obj: any = {}; + message.leaseId !== undefined && + (obj.leaseId = message.leaseId + ? LeaseID.toJSON(message.leaseId) + : undefined); + message.state !== undefined && + (obj.state = lease_StateToJSON(message.state)); + message.price !== undefined && + (obj.price = message.price ? DecCoin.toJSON(message.price) : undefined); + message.createdAt !== undefined && + (obj.createdAt = (message.createdAt || Long.ZERO).toString()); + message.closedOn !== undefined && + (obj.closedOn = (message.closedOn || Long.ZERO).toString()); + return obj; + }, + + fromPartial, I>>(object: I): Lease { + const message = createBaseLease(); + message.leaseId = + object.leaseId !== undefined && object.leaseId !== null + ? LeaseID.fromPartial(object.leaseId) + : undefined; + message.state = object.state ?? 0; + message.price = + object.price !== undefined && object.price !== null + ? DecCoin.fromPartial(object.price) + : undefined; + message.createdAt = + object.createdAt !== undefined && object.createdAt !== null + ? Long.fromValue(object.createdAt) + : Long.ZERO; + message.closedOn = + object.closedOn !== undefined && object.closedOn !== null + ? Long.fromValue(object.closedOn) + : Long.ZERO; + return message; + }, +}; + +messageTypeRegistry.set(Lease.$type, Lease); + +function createBaseLeaseFilters(): LeaseFilters { + return { + $type: "akash.market.v1beta4.LeaseFilters", + owner: "", + dseq: Long.UZERO, + gseq: 0, + oseq: 0, + provider: "", + state: "", + }; +} + +export const LeaseFilters = { + $type: "akash.market.v1beta4.LeaseFilters" as const, + + encode( + message: LeaseFilters, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (!message.dseq.isZero()) { + writer.uint32(16).uint64(message.dseq); + } + if (message.gseq !== 0) { + writer.uint32(24).uint32(message.gseq); + } + if (message.oseq !== 0) { + writer.uint32(32).uint32(message.oseq); + } + if (message.provider !== "") { + writer.uint32(42).string(message.provider); + } + if (message.state !== "") { + writer.uint32(50).string(message.state); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): LeaseFilters { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeaseFilters(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.dseq = reader.uint64() as Long; + break; + case 3: + message.gseq = reader.uint32(); + break; + case 4: + message.oseq = reader.uint32(); + break; + case 5: + message.provider = reader.string(); + break; + case 6: + message.state = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): LeaseFilters { + return { + $type: LeaseFilters.$type, + owner: isSet(object.owner) ? String(object.owner) : "", + dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO, + gseq: isSet(object.gseq) ? Number(object.gseq) : 0, + oseq: isSet(object.oseq) ? Number(object.oseq) : 0, + provider: isSet(object.provider) ? String(object.provider) : "", + state: isSet(object.state) ? String(object.state) : "", + }; + }, + + toJSON(message: LeaseFilters): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.dseq !== undefined && + (obj.dseq = (message.dseq || Long.UZERO).toString()); + message.gseq !== undefined && (obj.gseq = Math.round(message.gseq)); + message.oseq !== undefined && (obj.oseq = Math.round(message.oseq)); + message.provider !== undefined && (obj.provider = message.provider); + message.state !== undefined && (obj.state = message.state); + return obj; + }, + + fromPartial, I>>( + object: I + ): LeaseFilters { + const message = createBaseLeaseFilters(); + message.owner = object.owner ?? ""; + message.dseq = + object.dseq !== undefined && object.dseq !== null + ? Long.fromValue(object.dseq) + : Long.UZERO; + message.gseq = object.gseq ?? 0; + message.oseq = object.oseq ?? 0; + message.provider = object.provider ?? ""; + message.state = object.state ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(LeaseFilters.$type, LeaseFilters); + +function createBaseMsgCreateLease(): MsgCreateLease { + return { $type: "akash.market.v1beta4.MsgCreateLease", bidId: undefined }; +} + +export const MsgCreateLease = { + $type: "akash.market.v1beta4.MsgCreateLease" as const, + + encode( + message: MsgCreateLease, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bidId !== undefined) { + BidID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateLease { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bidId = BidID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCreateLease { + return { + $type: MsgCreateLease.$type, + bidId: isSet(object.bidId) ? BidID.fromJSON(object.bidId) : undefined, + }; + }, + + toJSON(message: MsgCreateLease): unknown { + const obj: any = {}; + message.bidId !== undefined && + (obj.bidId = message.bidId ? BidID.toJSON(message.bidId) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCreateLease { + const message = createBaseMsgCreateLease(); + message.bidId = + object.bidId !== undefined && object.bidId !== null + ? BidID.fromPartial(object.bidId) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(MsgCreateLease.$type, MsgCreateLease); + +function createBaseMsgCreateLeaseResponse(): MsgCreateLeaseResponse { + return { $type: "akash.market.v1beta4.MsgCreateLeaseResponse" }; +} + +export const MsgCreateLeaseResponse = { + $type: "akash.market.v1beta4.MsgCreateLeaseResponse" as const, + + encode( + _: MsgCreateLeaseResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgCreateLeaseResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateLeaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCreateLeaseResponse { + return { + $type: MsgCreateLeaseResponse.$type, + }; + }, + + toJSON(_: MsgCreateLeaseResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgCreateLeaseResponse { + const message = createBaseMsgCreateLeaseResponse(); + return message; + }, +}; + +messageTypeRegistry.set(MsgCreateLeaseResponse.$type, MsgCreateLeaseResponse); + +function createBaseMsgWithdrawLease(): MsgWithdrawLease { + return { $type: "akash.market.v1beta4.MsgWithdrawLease", bidId: undefined }; +} + +export const MsgWithdrawLease = { + $type: "akash.market.v1beta4.MsgWithdrawLease" as const, + + encode( + message: MsgWithdrawLease, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bidId !== undefined) { + LeaseID.encode(message.bidId, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawLease { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawLease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bidId = LeaseID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgWithdrawLease { + return { + $type: MsgWithdrawLease.$type, + bidId: isSet(object.bidId) ? LeaseID.fromJSON(object.bidId) : undefined, + }; + }, + + toJSON(message: MsgWithdrawLease): unknown { + const obj: any = {}; + message.bidId !== undefined && + (obj.bidId = message.bidId ? LeaseID.toJSON(message.bidId) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgWithdrawLease { + const message = createBaseMsgWithdrawLease(); + message.bidId = + object.bidId !== undefined && object.bidId !== null + ? LeaseID.fromPartial(object.bidId) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(MsgWithdrawLease.$type, MsgWithdrawLease); + +function createBaseMsgWithdrawLeaseResponse(): MsgWithdrawLeaseResponse { + return { $type: "akash.market.v1beta4.MsgWithdrawLeaseResponse" }; +} + +export const MsgWithdrawLeaseResponse = { + $type: "akash.market.v1beta4.MsgWithdrawLeaseResponse" as const, + + encode( + _: MsgWithdrawLeaseResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgWithdrawLeaseResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawLeaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgWithdrawLeaseResponse { + return { + $type: MsgWithdrawLeaseResponse.$type, + }; + }, + + toJSON(_: MsgWithdrawLeaseResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgWithdrawLeaseResponse { + const message = createBaseMsgWithdrawLeaseResponse(); + return message; + }, +}; + +messageTypeRegistry.set( + MsgWithdrawLeaseResponse.$type, + MsgWithdrawLeaseResponse +); + +function createBaseMsgCloseLease(): MsgCloseLease { + return { $type: "akash.market.v1beta4.MsgCloseLease", leaseId: undefined }; +} + +export const MsgCloseLease = { + $type: "akash.market.v1beta4.MsgCloseLease" as const, + + encode( + message: MsgCloseLease, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.leaseId !== undefined) { + LeaseID.encode(message.leaseId, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCloseLease { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCloseLease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leaseId = LeaseID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MsgCloseLease { + return { + $type: MsgCloseLease.$type, + leaseId: isSet(object.leaseId) + ? LeaseID.fromJSON(object.leaseId) + : undefined, + }; + }, + + toJSON(message: MsgCloseLease): unknown { + const obj: any = {}; + message.leaseId !== undefined && + (obj.leaseId = message.leaseId + ? LeaseID.toJSON(message.leaseId) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): MsgCloseLease { + const message = createBaseMsgCloseLease(); + message.leaseId = + object.leaseId !== undefined && object.leaseId !== null + ? LeaseID.fromPartial(object.leaseId) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(MsgCloseLease.$type, MsgCloseLease); + +function createBaseMsgCloseLeaseResponse(): MsgCloseLeaseResponse { + return { $type: "akash.market.v1beta4.MsgCloseLeaseResponse" }; +} + +export const MsgCloseLeaseResponse = { + $type: "akash.market.v1beta4.MsgCloseLeaseResponse" as const, + + encode( + _: MsgCloseLeaseResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgCloseLeaseResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCloseLeaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): MsgCloseLeaseResponse { + return { + $type: MsgCloseLeaseResponse.$type, + }; + }, + + toJSON(_: MsgCloseLeaseResponse): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>( + _: I + ): MsgCloseLeaseResponse { + const message = createBaseMsgCloseLeaseResponse(); + return message; + }, +}; + +messageTypeRegistry.set(MsgCloseLeaseResponse.$type, MsgCloseLeaseResponse); + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude | "$type">, + never + >; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protobuf/akash/market/v1beta4/order.ts b/src/protobuf/akash/market/v1beta4/order.ts new file mode 100644 index 0000000..0d3138e --- /dev/null +++ b/src/protobuf/akash/market/v1beta4/order.ts @@ -0,0 +1,429 @@ +/* eslint-disable */ +import { messageTypeRegistry } from "../../../typeRegistry"; +import Long from "long"; +import { GroupSpec } from "../../deployment/v1beta3/groupspec"; +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "akash.market.v1beta4"; + +/** OrderID stores owner and all other seq numbers */ +export interface OrderID { + $type: "akash.market.v1beta4.OrderID"; + owner: string; + dseq: Long; + gseq: number; + oseq: number; +} + +/** Order stores orderID, state of order and other details */ +export interface Order { + $type: "akash.market.v1beta4.Order"; + orderId: OrderID | undefined; + state: Order_State; + spec: GroupSpec | undefined; + createdAt: Long; +} + +/** State is an enum which refers to state of order */ +export enum Order_State { + /** invalid - Prefix should start with 0 in enum. So declaring dummy state */ + invalid = 0, + /** open - OrderOpen denotes state for order open */ + open = 1, + /** active - OrderMatched denotes state for order matched */ + active = 2, + /** closed - OrderClosed denotes state for order lost */ + closed = 3, + UNRECOGNIZED = -1, +} + +export function order_StateFromJSON(object: any): Order_State { + switch (object) { + case 0: + case "invalid": + return Order_State.invalid; + case 1: + case "open": + return Order_State.open; + case 2: + case "active": + return Order_State.active; + case 3: + case "closed": + return Order_State.closed; + case -1: + case "UNRECOGNIZED": + default: + return Order_State.UNRECOGNIZED; + } +} + +export function order_StateToJSON(object: Order_State): string { + switch (object) { + case Order_State.invalid: + return "invalid"; + case Order_State.open: + return "open"; + case Order_State.active: + return "active"; + case Order_State.closed: + return "closed"; + case Order_State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** OrderFilters defines flags for order list filter */ +export interface OrderFilters { + $type: "akash.market.v1beta4.OrderFilters"; + owner: string; + dseq: Long; + gseq: number; + oseq: number; + state: string; +} + +function createBaseOrderID(): OrderID { + return { + $type: "akash.market.v1beta4.OrderID", + owner: "", + dseq: Long.UZERO, + gseq: 0, + oseq: 0, + }; +} + +export const OrderID = { + $type: "akash.market.v1beta4.OrderID" as const, + + encode( + message: OrderID, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (!message.dseq.isZero()) { + writer.uint32(16).uint64(message.dseq); + } + if (message.gseq !== 0) { + writer.uint32(24).uint32(message.gseq); + } + if (message.oseq !== 0) { + writer.uint32(32).uint32(message.oseq); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OrderID { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.dseq = reader.uint64() as Long; + break; + case 3: + message.gseq = reader.uint32(); + break; + case 4: + message.oseq = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): OrderID { + return { + $type: OrderID.$type, + owner: isSet(object.owner) ? String(object.owner) : "", + dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO, + gseq: isSet(object.gseq) ? Number(object.gseq) : 0, + oseq: isSet(object.oseq) ? Number(object.oseq) : 0, + }; + }, + + toJSON(message: OrderID): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.dseq !== undefined && + (obj.dseq = (message.dseq || Long.UZERO).toString()); + message.gseq !== undefined && (obj.gseq = Math.round(message.gseq)); + message.oseq !== undefined && (obj.oseq = Math.round(message.oseq)); + return obj; + }, + + fromPartial, I>>(object: I): OrderID { + const message = createBaseOrderID(); + message.owner = object.owner ?? ""; + message.dseq = + object.dseq !== undefined && object.dseq !== null + ? Long.fromValue(object.dseq) + : Long.UZERO; + message.gseq = object.gseq ?? 0; + message.oseq = object.oseq ?? 0; + return message; + }, +}; + +messageTypeRegistry.set(OrderID.$type, OrderID); + +function createBaseOrder(): Order { + return { + $type: "akash.market.v1beta4.Order", + orderId: undefined, + state: 0, + spec: undefined, + createdAt: Long.ZERO, + }; +} + +export const Order = { + $type: "akash.market.v1beta4.Order" as const, + + encode(message: Order, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.orderId !== undefined) { + OrderID.encode(message.orderId, writer.uint32(10).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(16).int32(message.state); + } + if (message.spec !== undefined) { + GroupSpec.encode(message.spec, writer.uint32(26).fork()).ldelim(); + } + if (!message.createdAt.isZero()) { + writer.uint32(32).int64(message.createdAt); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Order { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.orderId = OrderID.decode(reader, reader.uint32()); + break; + case 2: + message.state = reader.int32() as any; + break; + case 3: + message.spec = GroupSpec.decode(reader, reader.uint32()); + break; + case 4: + message.createdAt = reader.int64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Order { + return { + $type: Order.$type, + orderId: isSet(object.orderId) + ? OrderID.fromJSON(object.orderId) + : undefined, + state: isSet(object.state) ? order_StateFromJSON(object.state) : 0, + spec: isSet(object.spec) ? GroupSpec.fromJSON(object.spec) : undefined, + createdAt: isSet(object.createdAt) + ? Long.fromValue(object.createdAt) + : Long.ZERO, + }; + }, + + toJSON(message: Order): unknown { + const obj: any = {}; + message.orderId !== undefined && + (obj.orderId = message.orderId + ? OrderID.toJSON(message.orderId) + : undefined); + message.state !== undefined && + (obj.state = order_StateToJSON(message.state)); + message.spec !== undefined && + (obj.spec = message.spec ? GroupSpec.toJSON(message.spec) : undefined); + message.createdAt !== undefined && + (obj.createdAt = (message.createdAt || Long.ZERO).toString()); + return obj; + }, + + fromPartial, I>>(object: I): Order { + const message = createBaseOrder(); + message.orderId = + object.orderId !== undefined && object.orderId !== null + ? OrderID.fromPartial(object.orderId) + : undefined; + message.state = object.state ?? 0; + message.spec = + object.spec !== undefined && object.spec !== null + ? GroupSpec.fromPartial(object.spec) + : undefined; + message.createdAt = + object.createdAt !== undefined && object.createdAt !== null + ? Long.fromValue(object.createdAt) + : Long.ZERO; + return message; + }, +}; + +messageTypeRegistry.set(Order.$type, Order); + +function createBaseOrderFilters(): OrderFilters { + return { + $type: "akash.market.v1beta4.OrderFilters", + owner: "", + dseq: Long.UZERO, + gseq: 0, + oseq: 0, + state: "", + }; +} + +export const OrderFilters = { + $type: "akash.market.v1beta4.OrderFilters" as const, + + encode( + message: OrderFilters, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (!message.dseq.isZero()) { + writer.uint32(16).uint64(message.dseq); + } + if (message.gseq !== 0) { + writer.uint32(24).uint32(message.gseq); + } + if (message.oseq !== 0) { + writer.uint32(32).uint32(message.oseq); + } + if (message.state !== "") { + writer.uint32(42).string(message.state); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OrderFilters { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderFilters(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.dseq = reader.uint64() as Long; + break; + case 3: + message.gseq = reader.uint32(); + break; + case 4: + message.oseq = reader.uint32(); + break; + case 5: + message.state = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): OrderFilters { + return { + $type: OrderFilters.$type, + owner: isSet(object.owner) ? String(object.owner) : "", + dseq: isSet(object.dseq) ? Long.fromValue(object.dseq) : Long.UZERO, + gseq: isSet(object.gseq) ? Number(object.gseq) : 0, + oseq: isSet(object.oseq) ? Number(object.oseq) : 0, + state: isSet(object.state) ? String(object.state) : "", + }; + }, + + toJSON(message: OrderFilters): unknown { + const obj: any = {}; + message.owner !== undefined && (obj.owner = message.owner); + message.dseq !== undefined && + (obj.dseq = (message.dseq || Long.UZERO).toString()); + message.gseq !== undefined && (obj.gseq = Math.round(message.gseq)); + message.oseq !== undefined && (obj.oseq = Math.round(message.oseq)); + message.state !== undefined && (obj.state = message.state); + return obj; + }, + + fromPartial, I>>( + object: I + ): OrderFilters { + const message = createBaseOrderFilters(); + message.owner = object.owner ?? ""; + message.dseq = + object.dseq !== undefined && object.dseq !== null + ? Long.fromValue(object.dseq) + : Long.UZERO; + message.gseq = object.gseq ?? 0; + message.oseq = object.oseq ?? 0; + message.state = object.state ?? ""; + return message; + }, +}; + +messageTypeRegistry.set(OrderFilters.$type, OrderFilters); + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude | "$type">, + never + >; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protobuf/akash/market/v1beta4/params.ts b/src/protobuf/akash/market/v1beta4/params.ts new file mode 100644 index 0000000..38beacb --- /dev/null +++ b/src/protobuf/akash/market/v1beta4/params.ts @@ -0,0 +1,133 @@ +/* eslint-disable */ +import { messageTypeRegistry } from "../../../typeRegistry"; +import Long from "long"; +import { Coin } from "../../../cosmos/base/v1beta1/coin"; +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "akash.market.v1beta4"; + +/** Params is the params for the x/market module */ +export interface Params { + $type: "akash.market.v1beta4.Params"; + bidMinDeposit: Coin | undefined; + orderMaxBids: number; +} + +function createBaseParams(): Params { + return { + $type: "akash.market.v1beta4.Params", + bidMinDeposit: undefined, + orderMaxBids: 0, + }; +} + +export const Params = { + $type: "akash.market.v1beta4.Params" as const, + + encode( + message: Params, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bidMinDeposit !== undefined) { + Coin.encode(message.bidMinDeposit, writer.uint32(10).fork()).ldelim(); + } + if (message.orderMaxBids !== 0) { + writer.uint32(16).uint32(message.orderMaxBids); + } + 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.bidMinDeposit = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.orderMaxBids = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + $type: Params.$type, + bidMinDeposit: isSet(object.bidMinDeposit) + ? Coin.fromJSON(object.bidMinDeposit) + : undefined, + orderMaxBids: isSet(object.orderMaxBids) + ? Number(object.orderMaxBids) + : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.bidMinDeposit !== undefined && + (obj.bidMinDeposit = message.bidMinDeposit + ? Coin.toJSON(message.bidMinDeposit) + : undefined); + message.orderMaxBids !== undefined && + (obj.orderMaxBids = Math.round(message.orderMaxBids)); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.bidMinDeposit = + object.bidMinDeposit !== undefined && object.bidMinDeposit !== null + ? Coin.fromPartial(object.bidMinDeposit) + : undefined; + message.orderMaxBids = object.orderMaxBids ?? 0; + return message; + }, +}; + +messageTypeRegistry.set(Params.$type, Params); + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude | "$type">, + never + >; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protobuf/akash/market/v1beta4/query.ts b/src/protobuf/akash/market/v1beta4/query.ts new file mode 100644 index 0000000..f636960 --- /dev/null +++ b/src/protobuf/akash/market/v1beta4/query.ts @@ -0,0 +1,1201 @@ +/* eslint-disable */ +import { messageTypeRegistry } from "../../../typeRegistry"; +import Long from "long"; +import { OrderFilters, Order, OrderID } from "./order"; +import { + PageRequest, + PageResponse, +} from "../../../cosmos/base/query/v1beta1/pagination"; +import { BidFilters, BidID, Bid } from "./bid"; +import { Account, FractionalPayment } from "../../escrow/v1beta3/types"; +import { LeaseFilters, LeaseID, Lease } from "./lease"; +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "akash.market.v1beta4"; + +/** QueryOrdersRequest is request type for the Query/Orders RPC method */ +export interface QueryOrdersRequest { + $type: "akash.market.v1beta4.QueryOrdersRequest"; + filters: OrderFilters | undefined; + pagination: PageRequest | undefined; +} + +/** QueryOrdersResponse is response type for the Query/Orders RPC method */ +export interface QueryOrdersResponse { + $type: "akash.market.v1beta4.QueryOrdersResponse"; + orders: Order[]; + pagination: PageResponse | undefined; +} + +/** QueryOrderRequest is request type for the Query/Order RPC method */ +export interface QueryOrderRequest { + $type: "akash.market.v1beta4.QueryOrderRequest"; + id: OrderID | undefined; +} + +/** QueryOrderResponse is response type for the Query/Order RPC method */ +export interface QueryOrderResponse { + $type: "akash.market.v1beta4.QueryOrderResponse"; + order: Order | undefined; +} + +/** QueryBidsRequest is request type for the Query/Bids RPC method */ +export interface QueryBidsRequest { + $type: "akash.market.v1beta4.QueryBidsRequest"; + filters: BidFilters | undefined; + pagination: PageRequest | undefined; +} + +/** QueryBidsResponse is response type for the Query/Bids RPC method */ +export interface QueryBidsResponse { + $type: "akash.market.v1beta4.QueryBidsResponse"; + bids: QueryBidResponse[]; + pagination: PageResponse | undefined; +} + +/** QueryBidRequest is request type for the Query/Bid RPC method */ +export interface QueryBidRequest { + $type: "akash.market.v1beta4.QueryBidRequest"; + id: BidID | undefined; +} + +/** QueryBidResponse is response type for the Query/Bid RPC method */ +export interface QueryBidResponse { + $type: "akash.market.v1beta4.QueryBidResponse"; + bid: Bid | undefined; + escrowAccount: Account | undefined; +} + +/** QueryLeasesRequest is request type for the Query/Leases RPC method */ +export interface QueryLeasesRequest { + $type: "akash.market.v1beta4.QueryLeasesRequest"; + filters: LeaseFilters | undefined; + pagination: PageRequest | undefined; +} + +/** QueryLeasesResponse is response type for the Query/Leases RPC method */ +export interface QueryLeasesResponse { + $type: "akash.market.v1beta4.QueryLeasesResponse"; + leases: QueryLeaseResponse[]; + pagination: PageResponse | undefined; +} + +/** QueryLeaseRequest is request type for the Query/Lease RPC method */ +export interface QueryLeaseRequest { + $type: "akash.market.v1beta4.QueryLeaseRequest"; + id: LeaseID | undefined; +} + +/** QueryLeaseResponse is response type for the Query/Lease RPC method */ +export interface QueryLeaseResponse { + $type: "akash.market.v1beta4.QueryLeaseResponse"; + lease: Lease | undefined; + escrowPayment: FractionalPayment | undefined; +} + +function createBaseQueryOrdersRequest(): QueryOrdersRequest { + return { + $type: "akash.market.v1beta4.QueryOrdersRequest", + filters: undefined, + pagination: undefined, + }; +} + +export const QueryOrdersRequest = { + $type: "akash.market.v1beta4.QueryOrdersRequest" as const, + + encode( + message: QueryOrdersRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.filters !== undefined) { + OrderFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryOrdersRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrdersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filters = OrderFilters.decode(reader, reader.uint32()); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryOrdersRequest { + return { + $type: QueryOrdersRequest.$type, + filters: isSet(object.filters) + ? OrderFilters.fromJSON(object.filters) + : undefined, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryOrdersRequest): unknown { + const obj: any = {}; + message.filters !== undefined && + (obj.filters = message.filters + ? OrderFilters.toJSON(message.filters) + : undefined); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryOrdersRequest { + const message = createBaseQueryOrdersRequest(); + message.filters = + object.filters !== undefined && object.filters !== null + ? OrderFilters.fromPartial(object.filters) + : undefined; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryOrdersRequest.$type, QueryOrdersRequest); + +function createBaseQueryOrdersResponse(): QueryOrdersResponse { + return { + $type: "akash.market.v1beta4.QueryOrdersResponse", + orders: [], + pagination: undefined, + }; +} + +export const QueryOrdersResponse = { + $type: "akash.market.v1beta4.QueryOrdersResponse" as const, + + encode( + message: QueryOrdersResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.orders) { + Order.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): QueryOrdersResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrdersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.orders.push(Order.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): QueryOrdersResponse { + return { + $type: QueryOrdersResponse.$type, + orders: Array.isArray(object?.orders) + ? object.orders.map((e: any) => Order.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryOrdersResponse): unknown { + const obj: any = {}; + if (message.orders) { + obj.orders = message.orders.map((e) => (e ? Order.toJSON(e) : undefined)); + } else { + obj.orders = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryOrdersResponse { + const message = createBaseQueryOrdersResponse(); + message.orders = object.orders?.map((e) => Order.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryOrdersResponse.$type, QueryOrdersResponse); + +function createBaseQueryOrderRequest(): QueryOrderRequest { + return { $type: "akash.market.v1beta4.QueryOrderRequest", id: undefined }; +} + +export const QueryOrderRequest = { + $type: "akash.market.v1beta4.QueryOrderRequest" as const, + + encode( + message: QueryOrderRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== undefined) { + OrderID.encode(message.id, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryOrderRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = OrderID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryOrderRequest { + return { + $type: QueryOrderRequest.$type, + id: isSet(object.id) ? OrderID.fromJSON(object.id) : undefined, + }; + }, + + toJSON(message: QueryOrderRequest): unknown { + const obj: any = {}; + message.id !== undefined && + (obj.id = message.id ? OrderID.toJSON(message.id) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryOrderRequest { + const message = createBaseQueryOrderRequest(); + message.id = + object.id !== undefined && object.id !== null + ? OrderID.fromPartial(object.id) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryOrderRequest.$type, QueryOrderRequest); + +function createBaseQueryOrderResponse(): QueryOrderResponse { + return { $type: "akash.market.v1beta4.QueryOrderResponse", order: undefined }; +} + +export const QueryOrderResponse = { + $type: "akash.market.v1beta4.QueryOrderResponse" as const, + + encode( + message: QueryOrderResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.order !== undefined) { + Order.encode(message.order, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryOrderResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.order = Order.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryOrderResponse { + return { + $type: QueryOrderResponse.$type, + order: isSet(object.order) ? Order.fromJSON(object.order) : undefined, + }; + }, + + toJSON(message: QueryOrderResponse): unknown { + const obj: any = {}; + message.order !== undefined && + (obj.order = message.order ? Order.toJSON(message.order) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryOrderResponse { + const message = createBaseQueryOrderResponse(); + message.order = + object.order !== undefined && object.order !== null + ? Order.fromPartial(object.order) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryOrderResponse.$type, QueryOrderResponse); + +function createBaseQueryBidsRequest(): QueryBidsRequest { + return { + $type: "akash.market.v1beta4.QueryBidsRequest", + filters: undefined, + pagination: undefined, + }; +} + +export const QueryBidsRequest = { + $type: "akash.market.v1beta4.QueryBidsRequest" as const, + + encode( + message: QueryBidsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.filters !== undefined) { + BidFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBidsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filters = BidFilters.decode(reader, reader.uint32()); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBidsRequest { + return { + $type: QueryBidsRequest.$type, + filters: isSet(object.filters) + ? BidFilters.fromJSON(object.filters) + : undefined, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryBidsRequest): unknown { + const obj: any = {}; + message.filters !== undefined && + (obj.filters = message.filters + ? BidFilters.toJSON(message.filters) + : undefined); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidsRequest { + const message = createBaseQueryBidsRequest(); + message.filters = + object.filters !== undefined && object.filters !== null + ? BidFilters.fromPartial(object.filters) + : undefined; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryBidsRequest.$type, QueryBidsRequest); + +function createBaseQueryBidsResponse(): QueryBidsResponse { + return { + $type: "akash.market.v1beta4.QueryBidsResponse", + bids: [], + pagination: undefined, + }; +} + +export const QueryBidsResponse = { + $type: "akash.market.v1beta4.QueryBidsResponse" as const, + + encode( + message: QueryBidsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.bids) { + QueryBidResponse.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): QueryBidsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bids.push(QueryBidResponse.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): QueryBidsResponse { + return { + $type: QueryBidsResponse.$type, + bids: Array.isArray(object?.bids) + ? object.bids.map((e: any) => QueryBidResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryBidsResponse): unknown { + const obj: any = {}; + if (message.bids) { + obj.bids = message.bids.map((e) => + e ? QueryBidResponse.toJSON(e) : undefined + ); + } else { + obj.bids = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidsResponse { + const message = createBaseQueryBidsResponse(); + message.bids = + object.bids?.map((e) => QueryBidResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryBidsResponse.$type, QueryBidsResponse); + +function createBaseQueryBidRequest(): QueryBidRequest { + return { $type: "akash.market.v1beta4.QueryBidRequest", id: undefined }; +} + +export const QueryBidRequest = { + $type: "akash.market.v1beta4.QueryBidRequest" as const, + + encode( + message: QueryBidRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== undefined) { + BidID.encode(message.id, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBidRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = BidID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBidRequest { + return { + $type: QueryBidRequest.$type, + id: isSet(object.id) ? BidID.fromJSON(object.id) : undefined, + }; + }, + + toJSON(message: QueryBidRequest): unknown { + const obj: any = {}; + message.id !== undefined && + (obj.id = message.id ? BidID.toJSON(message.id) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidRequest { + const message = createBaseQueryBidRequest(); + message.id = + object.id !== undefined && object.id !== null + ? BidID.fromPartial(object.id) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryBidRequest.$type, QueryBidRequest); + +function createBaseQueryBidResponse(): QueryBidResponse { + return { + $type: "akash.market.v1beta4.QueryBidResponse", + bid: undefined, + escrowAccount: undefined, + }; +} + +export const QueryBidResponse = { + $type: "akash.market.v1beta4.QueryBidResponse" as const, + + encode( + message: QueryBidResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.bid !== undefined) { + Bid.encode(message.bid, writer.uint32(10).fork()).ldelim(); + } + if (message.escrowAccount !== undefined) { + Account.encode(message.escrowAccount, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryBidResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBidResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bid = Bid.decode(reader, reader.uint32()); + break; + case 2: + message.escrowAccount = Account.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryBidResponse { + return { + $type: QueryBidResponse.$type, + bid: isSet(object.bid) ? Bid.fromJSON(object.bid) : undefined, + escrowAccount: isSet(object.escrowAccount) + ? Account.fromJSON(object.escrowAccount) + : undefined, + }; + }, + + toJSON(message: QueryBidResponse): unknown { + const obj: any = {}; + message.bid !== undefined && + (obj.bid = message.bid ? Bid.toJSON(message.bid) : undefined); + message.escrowAccount !== undefined && + (obj.escrowAccount = message.escrowAccount + ? Account.toJSON(message.escrowAccount) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryBidResponse { + const message = createBaseQueryBidResponse(); + message.bid = + object.bid !== undefined && object.bid !== null + ? Bid.fromPartial(object.bid) + : undefined; + message.escrowAccount = + object.escrowAccount !== undefined && object.escrowAccount !== null + ? Account.fromPartial(object.escrowAccount) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryBidResponse.$type, QueryBidResponse); + +function createBaseQueryLeasesRequest(): QueryLeasesRequest { + return { + $type: "akash.market.v1beta4.QueryLeasesRequest", + filters: undefined, + pagination: undefined, + }; +} + +export const QueryLeasesRequest = { + $type: "akash.market.v1beta4.QueryLeasesRequest" as const, + + encode( + message: QueryLeasesRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.filters !== undefined) { + LeaseFilters.encode(message.filters, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryLeasesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLeasesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filters = LeaseFilters.decode(reader, reader.uint32()); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryLeasesRequest { + return { + $type: QueryLeasesRequest.$type, + filters: isSet(object.filters) + ? LeaseFilters.fromJSON(object.filters) + : undefined, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryLeasesRequest): unknown { + const obj: any = {}; + message.filters !== undefined && + (obj.filters = message.filters + ? LeaseFilters.toJSON(message.filters) + : undefined); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryLeasesRequest { + const message = createBaseQueryLeasesRequest(); + message.filters = + object.filters !== undefined && object.filters !== null + ? LeaseFilters.fromPartial(object.filters) + : undefined; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryLeasesRequest.$type, QueryLeasesRequest); + +function createBaseQueryLeasesResponse(): QueryLeasesResponse { + return { + $type: "akash.market.v1beta4.QueryLeasesResponse", + leases: [], + pagination: undefined, + }; +} + +export const QueryLeasesResponse = { + $type: "akash.market.v1beta4.QueryLeasesResponse" as const, + + encode( + message: QueryLeasesResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.leases) { + QueryLeaseResponse.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): QueryLeasesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLeasesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leases.push( + QueryLeaseResponse.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): QueryLeasesResponse { + return { + $type: QueryLeasesResponse.$type, + leases: Array.isArray(object?.leases) + ? object.leases.map((e: any) => QueryLeaseResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + + toJSON(message: QueryLeasesResponse): unknown { + const obj: any = {}; + if (message.leases) { + obj.leases = message.leases.map((e) => + e ? QueryLeaseResponse.toJSON(e) : undefined + ); + } else { + obj.leases = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryLeasesResponse { + const message = createBaseQueryLeasesResponse(); + message.leases = + object.leases?.map((e) => QueryLeaseResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryLeasesResponse.$type, QueryLeasesResponse); + +function createBaseQueryLeaseRequest(): QueryLeaseRequest { + return { $type: "akash.market.v1beta4.QueryLeaseRequest", id: undefined }; +} + +export const QueryLeaseRequest = { + $type: "akash.market.v1beta4.QueryLeaseRequest" as const, + + encode( + message: QueryLeaseRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.id !== undefined) { + LeaseID.encode(message.id, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryLeaseRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLeaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = LeaseID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryLeaseRequest { + return { + $type: QueryLeaseRequest.$type, + id: isSet(object.id) ? LeaseID.fromJSON(object.id) : undefined, + }; + }, + + toJSON(message: QueryLeaseRequest): unknown { + const obj: any = {}; + message.id !== undefined && + (obj.id = message.id ? LeaseID.toJSON(message.id) : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryLeaseRequest { + const message = createBaseQueryLeaseRequest(); + message.id = + object.id !== undefined && object.id !== null + ? LeaseID.fromPartial(object.id) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryLeaseRequest.$type, QueryLeaseRequest); + +function createBaseQueryLeaseResponse(): QueryLeaseResponse { + return { + $type: "akash.market.v1beta4.QueryLeaseResponse", + lease: undefined, + escrowPayment: undefined, + }; +} + +export const QueryLeaseResponse = { + $type: "akash.market.v1beta4.QueryLeaseResponse" as const, + + encode( + message: QueryLeaseResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.lease !== undefined) { + Lease.encode(message.lease, writer.uint32(10).fork()).ldelim(); + } + if (message.escrowPayment !== undefined) { + FractionalPayment.encode( + message.escrowPayment, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryLeaseResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryLeaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lease = Lease.decode(reader, reader.uint32()); + break; + case 2: + message.escrowPayment = FractionalPayment.decode( + reader, + reader.uint32() + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryLeaseResponse { + return { + $type: QueryLeaseResponse.$type, + lease: isSet(object.lease) ? Lease.fromJSON(object.lease) : undefined, + escrowPayment: isSet(object.escrowPayment) + ? FractionalPayment.fromJSON(object.escrowPayment) + : undefined, + }; + }, + + toJSON(message: QueryLeaseResponse): unknown { + const obj: any = {}; + message.lease !== undefined && + (obj.lease = message.lease ? Lease.toJSON(message.lease) : undefined); + message.escrowPayment !== undefined && + (obj.escrowPayment = message.escrowPayment + ? FractionalPayment.toJSON(message.escrowPayment) + : undefined); + return obj; + }, + + fromPartial, I>>( + object: I + ): QueryLeaseResponse { + const message = createBaseQueryLeaseResponse(); + message.lease = + object.lease !== undefined && object.lease !== null + ? Lease.fromPartial(object.lease) + : undefined; + message.escrowPayment = + object.escrowPayment !== undefined && object.escrowPayment !== null + ? FractionalPayment.fromPartial(object.escrowPayment) + : undefined; + return message; + }, +}; + +messageTypeRegistry.set(QueryLeaseResponse.$type, QueryLeaseResponse); + +/** Query defines the gRPC querier service */ +export interface Query { + /** Orders queries orders with filters */ + Orders(request: QueryOrdersRequest): Promise; + /** Order queries order details */ + Order(request: QueryOrderRequest): Promise; + /** Bids queries bids with filters */ + Bids(request: QueryBidsRequest): Promise; + /** Bid queries bid details */ + Bid(request: QueryBidRequest): Promise; + /** Leases queries leases with filters */ + Leases(request: QueryLeasesRequest): Promise; + /** Lease queries lease details */ + Lease(request: QueryLeaseRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Orders = this.Orders.bind(this); + this.Order = this.Order.bind(this); + this.Bids = this.Bids.bind(this); + this.Bid = this.Bid.bind(this); + this.Leases = this.Leases.bind(this); + this.Lease = this.Lease.bind(this); + } + Orders(request: QueryOrdersRequest): Promise { + const data = QueryOrdersRequest.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Query", + "Orders", + data + ); + return promise.then((data) => + QueryOrdersResponse.decode(new _m0.Reader(data)) + ); + } + + Order(request: QueryOrderRequest): Promise { + const data = QueryOrderRequest.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Query", + "Order", + data + ); + return promise.then((data) => + QueryOrderResponse.decode(new _m0.Reader(data)) + ); + } + + Bids(request: QueryBidsRequest): Promise { + const data = QueryBidsRequest.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Query", + "Bids", + data + ); + return promise.then((data) => + QueryBidsResponse.decode(new _m0.Reader(data)) + ); + } + + Bid(request: QueryBidRequest): Promise { + const data = QueryBidRequest.encode(request).finish(); + const promise = this.rpc.request("akash.market.v1beta4.Query", "Bid", data); + return promise.then((data) => + QueryBidResponse.decode(new _m0.Reader(data)) + ); + } + + Leases(request: QueryLeasesRequest): Promise { + const data = QueryLeasesRequest.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Query", + "Leases", + data + ); + return promise.then((data) => + QueryLeasesResponse.decode(new _m0.Reader(data)) + ); + } + + Lease(request: QueryLeaseRequest): Promise { + const data = QueryLeaseRequest.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Query", + "Lease", + data + ); + return promise.then((data) => + QueryLeaseResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in Exclude]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude | "$type">, + never + >; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/protobuf/akash/market/v1beta4/service.ts b/src/protobuf/akash/market/v1beta4/service.ts new file mode 100644 index 0000000..96db0f6 --- /dev/null +++ b/src/protobuf/akash/market/v1beta4/service.ts @@ -0,0 +1,111 @@ +/* eslint-disable */ +import { + MsgCreateBidResponse, + MsgCloseBidResponse, + MsgCreateBid, + MsgCloseBid, +} from "./bid"; +import { + MsgWithdrawLeaseResponse, + MsgCreateLeaseResponse, + MsgCloseLeaseResponse, + MsgWithdrawLease, + MsgCreateLease, + MsgCloseLease, +} from "./lease"; +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "akash.market.v1beta4"; + +/** Msg defines the market Msg service */ +export interface Msg { + /** CreateBid defines a method to create a bid given proper inputs. */ + CreateBid(request: MsgCreateBid): Promise; + /** CloseBid defines a method to close a bid given proper inputs. */ + CloseBid(request: MsgCloseBid): Promise; + /** WithdrawLease withdraws accrued funds from the lease payment */ + WithdrawLease(request: MsgWithdrawLease): Promise; + /** CreateLease creates a new lease */ + CreateLease(request: MsgCreateLease): Promise; + /** CloseLease defines a method to close an order given proper inputs. */ + CloseLease(request: MsgCloseLease): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.CreateBid = this.CreateBid.bind(this); + this.CloseBid = this.CloseBid.bind(this); + this.WithdrawLease = this.WithdrawLease.bind(this); + this.CreateLease = this.CreateLease.bind(this); + this.CloseLease = this.CloseLease.bind(this); + } + CreateBid(request: MsgCreateBid): Promise { + const data = MsgCreateBid.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Msg", + "CreateBid", + data + ); + return promise.then((data) => + MsgCreateBidResponse.decode(new _m0.Reader(data)) + ); + } + + CloseBid(request: MsgCloseBid): Promise { + const data = MsgCloseBid.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Msg", + "CloseBid", + data + ); + return promise.then((data) => + MsgCloseBidResponse.decode(new _m0.Reader(data)) + ); + } + + WithdrawLease(request: MsgWithdrawLease): Promise { + const data = MsgWithdrawLease.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Msg", + "WithdrawLease", + data + ); + return promise.then((data) => + MsgWithdrawLeaseResponse.decode(new _m0.Reader(data)) + ); + } + + CreateLease(request: MsgCreateLease): Promise { + const data = MsgCreateLease.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Msg", + "CreateLease", + data + ); + return promise.then((data) => + MsgCreateLeaseResponse.decode(new _m0.Reader(data)) + ); + } + + CloseLease(request: MsgCloseLease): Promise { + const data = MsgCloseLease.encode(request).finish(); + const promise = this.rpc.request( + "akash.market.v1beta4.Msg", + "CloseLease", + data + ); + return promise.then((data) => + MsgCloseLeaseResponse.decode(new _m0.Reader(data)) + ); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} diff --git a/src/stargate/index.ts b/src/stargate/index.ts index 7e44484..4f54f86 100644 --- a/src/stargate/index.ts +++ b/src/stargate/index.ts @@ -24,5 +24,5 @@ export enum messages { MsgCloseGroup = "/akash.deployment.v1beta3.MsgCloseGroup", MsgPauseGroup = "/akash.deployment.v1beta3.MsgPauseGroup", MsgStartGroup = "/akash.deployment.v1beta3.MsgStartGroup", - MsgCreateLease = "/akash.market.v1beta3.MsgCreateLease", + MsgCreateLease = "/akash.market.v1beta4.MsgCreateLease", }