Update proto files and ts bindings

This commit is contained in:
IshaVenikar 2024-09-23 18:01:24 +05:30
parent 63e627caf6
commit ff9712f31d
4 changed files with 203 additions and 0 deletions

View File

@ -94,6 +94,10 @@ message Auction {
// Number of desired providers (num of auction winners)
// Only applicable in provider auctions
int32 num_providers = 15;
bool funds_released = 16 [
(gogoproto.moretags) =
"json:\"funds_released\" yaml:\"funds_released\"" ];
}
// Auctions represent all the auctions in the module

View File

@ -34,6 +34,11 @@ service Msg {
// UpdateParams defines an operation for updating the x/staking module
// parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// ReleaseFunds is the command for paying the winners of provider auctions
rpc ReleaseFunds(MsgReleaseFunds) returns (MsgReleaseFundsResponse) {
option (google.api.http).post = "/cerc/auction/v1/release_funds";
};
}
// MsgCreateAuction defines a create auction message
@ -172,3 +177,26 @@ message MsgUpdateParams {
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {};
// ReleaseFunds defines the message to pay the winners of provider auctions
message MsgReleaseFunds {
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// Auction id
string auction_id = 1
[ (gogoproto.moretags) = "json:\"auction_id\" yaml:\"auction_id\"" ];
// Address of the signer
string signer = 2
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
}
// MsgReleaseFundsResponse returns the state of the auction after releasing the funds
message MsgReleaseFundsResponse {
option (gogoproto.goproto_getters) = false;
// Auction details
Auction auction = 1
[ (gogoproto.moretags) = "json:\"auction\" yaml:\"auction\"" ];
}

View File

@ -59,6 +59,7 @@ export interface Auction {
* Only applicable in provider auctions
*/
numProviders: number;
fundsReleased: boolean;
}
/** Auctions represent all the auctions in the module */
@ -135,6 +136,7 @@ function createBaseAuction(): Auction {
winningPrice: undefined,
maxPrice: undefined,
numProviders: 0,
fundsReleased: false,
};
}
@ -197,6 +199,9 @@ export const Auction = {
if (message.numProviders !== 0) {
writer.uint32(120).int32(message.numProviders);
}
if (message.fundsReleased === true) {
writer.uint32(128).bool(message.fundsReleased);
}
return writer;
},
@ -258,6 +263,9 @@ export const Auction = {
case 15:
message.numProviders = reader.int32();
break;
case 16:
message.fundsReleased = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
@ -307,6 +315,9 @@ export const Auction = {
numProviders: isSet(object.numProviders)
? Number(object.numProviders)
: 0,
fundsReleased: isSet(object.fundsReleased)
? Boolean(object.fundsReleased)
: false,
};
},
@ -357,6 +368,8 @@ export const Auction = {
: undefined);
message.numProviders !== undefined &&
(obj.numProviders = Math.round(message.numProviders));
message.fundsReleased !== undefined &&
(obj.fundsReleased = message.fundsReleased);
return obj;
},
@ -393,6 +406,7 @@ export const Auction = {
? Coin.fromPartial(object.maxPrice)
: undefined;
message.numProviders = object.numProviders ?? 0;
message.fundsReleased = object.fundsReleased ?? false;
return message;
},
};

View File

@ -97,6 +97,20 @@ export interface MsgUpdateParams {
*/
export interface MsgUpdateParamsResponse {}
/** ReleaseFunds defines the message to pay the winners of provider auctions */
export interface MsgReleaseFunds {
/** Auction id */
auctionId: string;
/** Address of the signer */
signer: string;
}
/** MsgReleaseFundsResponse returns the state of the auction after releasing the funds */
export interface MsgReleaseFundsResponse {
/** Auction details */
auction?: Auction;
}
function createBaseMsgCreateAuction(): MsgCreateAuction {
return {
signer: "",
@ -739,6 +753,134 @@ export const MsgUpdateParamsResponse = {
},
};
function createBaseMsgReleaseFunds(): MsgReleaseFunds {
return { auctionId: "", signer: "" };
}
export const MsgReleaseFunds = {
encode(
message: MsgReleaseFunds,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.auctionId !== "") {
writer.uint32(10).string(message.auctionId);
}
if (message.signer !== "") {
writer.uint32(18).string(message.signer);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): MsgReleaseFunds {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgReleaseFunds();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.auctionId = reader.string();
break;
case 2:
message.signer = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgReleaseFunds {
return {
auctionId: isSet(object.auctionId) ? String(object.auctionId) : "",
signer: isSet(object.signer) ? String(object.signer) : "",
};
},
toJSON(message: MsgReleaseFunds): unknown {
const obj: any = {};
message.auctionId !== undefined && (obj.auctionId = message.auctionId);
message.signer !== undefined && (obj.signer = message.signer);
return obj;
},
fromPartial<I extends Exact<DeepPartial<MsgReleaseFunds>, I>>(
object: I
): MsgReleaseFunds {
const message = createBaseMsgReleaseFunds();
message.auctionId = object.auctionId ?? "";
message.signer = object.signer ?? "";
return message;
},
};
function createBaseMsgReleaseFundsResponse(): MsgReleaseFundsResponse {
return { auction: undefined };
}
export const MsgReleaseFundsResponse = {
encode(
message: MsgReleaseFundsResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.auction !== undefined) {
Auction.encode(message.auction, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(
input: _m0.Reader | Uint8Array,
length?: number
): MsgReleaseFundsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgReleaseFundsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.auction = Auction.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgReleaseFundsResponse {
return {
auction: isSet(object.auction)
? Auction.fromJSON(object.auction)
: undefined,
};
},
toJSON(message: MsgReleaseFundsResponse): unknown {
const obj: any = {};
message.auction !== undefined &&
(obj.auction = message.auction
? Auction.toJSON(message.auction)
: undefined);
return obj;
},
fromPartial<I extends Exact<DeepPartial<MsgReleaseFundsResponse>, I>>(
object: I
): MsgReleaseFundsResponse {
const message = createBaseMsgReleaseFundsResponse();
message.auction =
object.auction !== undefined && object.auction !== null
? Auction.fromPartial(object.auction)
: undefined;
return message;
},
};
/** Tx defines the gRPC tx interface */
export interface Msg {
/** CreateAuction is the command for creating an auction */
@ -752,6 +894,8 @@ export interface Msg {
* parameters.
*/
UpdateParams(request: MsgUpdateParams): Promise<MsgUpdateParamsResponse>;
/** ReleaseFunds is the command for paying the winners of provider auctions */
ReleaseFunds(request: MsgReleaseFunds): Promise<MsgReleaseFundsResponse>;
}
export class MsgClientImpl implements Msg {
@ -762,6 +906,7 @@ export class MsgClientImpl implements Msg {
this.CommitBid = this.CommitBid.bind(this);
this.RevealBid = this.RevealBid.bind(this);
this.UpdateParams = this.UpdateParams.bind(this);
this.ReleaseFunds = this.ReleaseFunds.bind(this);
}
CreateAuction(request: MsgCreateAuction): Promise<MsgCreateAuctionResponse> {
const data = MsgCreateAuction.encode(request).finish();
@ -802,6 +947,18 @@ export class MsgClientImpl implements Msg {
MsgUpdateParamsResponse.decode(new _m0.Reader(data))
);
}
ReleaseFunds(request: MsgReleaseFunds): Promise<MsgReleaseFundsResponse> {
const data = MsgReleaseFunds.encode(request).finish();
const promise = this.rpc.request(
"cerc.auction.v1.Msg",
"ReleaseFunds",
data
);
return promise.then((data) =>
MsgReleaseFundsResponse.decode(new _m0.Reader(data))
);
}
}
interface Rpc {