Skip to content

Commit

Permalink
Fix workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Jan 14, 2025
1 parent 0543cde commit 33b9e59
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LCDClient } from "@osmonauts/lcd";
import { QueryDowntimeParamsRequest, QueryDowntimeParamsResponseSDKType, QueryAllDowntimeInfoRequest, QueryAllDowntimeInfoResponseSDKType } from "./query";
import { QueryDowntimeParamsRequest, QueryDowntimeParamsResponseSDKType, QueryAllDowntimeInfoRequest, QueryAllDowntimeInfoResponseSDKType, QuerySynchronyParamsRequest, QuerySynchronyParamsResponseSDKType } from "./query";
export class LCDQueryClient {
req: LCDClient;

Expand All @@ -11,6 +11,7 @@ export class LCDQueryClient {
this.req = requestClient;
this.downtimeParams = this.downtimeParams.bind(this);
this.allDowntimeInfo = this.allDowntimeInfo.bind(this);
this.synchronyParams = this.synchronyParams.bind(this);
}
/* Queries the DowntimeParams. */

Expand All @@ -26,5 +27,12 @@ export class LCDQueryClient {
const endpoint = `dydxprotocol/v4/blocktime/all_downtime_info`;
return await this.req.get<QueryAllDowntimeInfoResponseSDKType>(endpoint);
}
/* Queries the SynchronyParams. */


async synchronyParams(_params: QuerySynchronyParamsRequest = {}): Promise<QuerySynchronyParamsResponseSDKType> {
const endpoint = `dydxprotocol/v4/blocktime/synchrony_params`;
return await this.req.get<QuerySynchronyParamsResponseSDKType>(endpoint);
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
import { QueryDowntimeParamsRequest, QueryDowntimeParamsResponse, QueryPreviousBlockInfoRequest, QueryPreviousBlockInfoResponse, QueryAllDowntimeInfoRequest, QueryAllDowntimeInfoResponse } from "./query";
import { QueryDowntimeParamsRequest, QueryDowntimeParamsResponse, QueryPreviousBlockInfoRequest, QueryPreviousBlockInfoResponse, QueryAllDowntimeInfoRequest, QueryAllDowntimeInfoResponse, QuerySynchronyParamsRequest, QuerySynchronyParamsResponse } from "./query";
/** Query defines the gRPC querier service. */

export interface Query {
Expand All @@ -13,6 +13,9 @@ export interface Query {
/** Queries all recorded downtime info. */

allDowntimeInfo(request?: QueryAllDowntimeInfoRequest): Promise<QueryAllDowntimeInfoResponse>;
/** Queries the SynchronyParams. */

synchronyParams(request?: QuerySynchronyParamsRequest): Promise<QuerySynchronyParamsResponse>;
}
export class QueryClientImpl implements Query {
private readonly rpc: Rpc;
Expand All @@ -22,6 +25,7 @@ export class QueryClientImpl implements Query {
this.downtimeParams = this.downtimeParams.bind(this);
this.previousBlockInfo = this.previousBlockInfo.bind(this);
this.allDowntimeInfo = this.allDowntimeInfo.bind(this);
this.synchronyParams = this.synchronyParams.bind(this);
}

downtimeParams(request: QueryDowntimeParamsRequest = {}): Promise<QueryDowntimeParamsResponse> {
Expand All @@ -42,6 +46,12 @@ export class QueryClientImpl implements Query {
return promise.then(data => QueryAllDowntimeInfoResponse.decode(new _m0.Reader(data)));
}

synchronyParams(request: QuerySynchronyParamsRequest = {}): Promise<QuerySynchronyParamsResponse> {
const data = QuerySynchronyParamsRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.blocktime.Query", "SynchronyParams", data);
return promise.then(data => QuerySynchronyParamsResponse.decode(new _m0.Reader(data)));
}

}
export const createRpcQueryExtension = (base: QueryClient) => {
const rpc = createProtobufRpcClient(base);
Expand All @@ -57,6 +67,10 @@ export const createRpcQueryExtension = (base: QueryClient) => {

allDowntimeInfo(request?: QueryAllDowntimeInfoRequest): Promise<QueryAllDowntimeInfoResponse> {
return queryService.allDowntimeInfo(request);
},

synchronyParams(request?: QuerySynchronyParamsRequest): Promise<QuerySynchronyParamsResponse> {
return queryService.synchronyParams(request);
}

};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import { DowntimeParams, DowntimeParamsSDKType } from "./params";
import { SynchronyParams, SynchronyParamsSDKType, DowntimeParams, DowntimeParamsSDKType } from "./params";
import { BlockInfo, BlockInfoSDKType, AllDowntimeInfo, AllDowntimeInfoSDKType } from "./blocktime";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial } from "../../helpers";
/** QuerySynchronyParamsRequest is a request type for the SynchronyParams */

export interface QuerySynchronyParamsRequest {}
/** QuerySynchronyParamsRequest is a request type for the SynchronyParams */

export interface QuerySynchronyParamsRequestSDKType {}
/** QuerySynchronyParamsResponse is a response type for the SynchronyParams */

export interface QuerySynchronyParamsResponse {
params?: SynchronyParams;
}
/** QuerySynchronyParamsResponse is a response type for the SynchronyParams */

export interface QuerySynchronyParamsResponseSDKType {
params?: SynchronyParamsSDKType;
}
/**
* QueryDowntimeParamsRequest is a request type for the DowntimeParams
* RPC method.
Expand Down Expand Up @@ -103,6 +119,85 @@ export interface QueryAllDowntimeInfoResponseSDKType {
info?: AllDowntimeInfoSDKType;
}

function createBaseQuerySynchronyParamsRequest(): QuerySynchronyParamsRequest {
return {};
}

export const QuerySynchronyParamsRequest = {
encode(_: QuerySynchronyParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): QuerySynchronyParamsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQuerySynchronyParamsRequest();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(_: DeepPartial<QuerySynchronyParamsRequest>): QuerySynchronyParamsRequest {
const message = createBaseQuerySynchronyParamsRequest();
return message;
}

};

function createBaseQuerySynchronyParamsResponse(): QuerySynchronyParamsResponse {
return {
params: undefined
};
}

export const QuerySynchronyParamsResponse = {
encode(message: QuerySynchronyParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.params !== undefined) {
SynchronyParams.encode(message.params, writer.uint32(10).fork()).ldelim();
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): QuerySynchronyParamsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQuerySynchronyParamsResponse();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.params = SynchronyParams.decode(reader, reader.uint32());
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<QuerySynchronyParamsResponse>): QuerySynchronyParamsResponse {
const message = createBaseQuerySynchronyParamsResponse();
message.params = object.params !== undefined && object.params !== null ? SynchronyParams.fromPartial(object.params) : undefined;
return message;
}

};

function createBaseQueryDowntimeParamsRequest(): QueryDowntimeParamsRequest {
return {};
}
Expand Down
3 changes: 2 additions & 1 deletion proto/dydxprotocol/blocktime/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ service Query {
// Queries the SynchronyParams.
rpc SynchronyParams(QuerySynchronyParamsRequest)
returns (QuerySynchronyParamsResponse) {
option (google.api.http).get = "/dydxprotocol/v4/blocktime/synchrony_params";
option (google.api.http).get =
"/dydxprotocol/v4/blocktime/synchrony_params";
}
}

Expand Down
39 changes: 38 additions & 1 deletion protocol/mocks/QueryClient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 33b9e59

Please sign in to comment.