Skip to content

Commit

Permalink
indexer codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Nov 25, 2024
1 parent 2b0ce64 commit 5cfa661
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ export interface DowntimeParamsSDKType {
*/
durations: DurationSDKType[];
}
/** SynchronyParams defines the parameters for block synchrony. */

export interface SynchronyParams {
/**
* next_block_delay replaces the locally configured timeout_commit in
* CometBFT. It determines the amount of time the CometBFT waits after the If
* the application sends next_block_delay = 0 to the consensus engine, the
* latter defaults back to using timeout_commit.
*/
nextBlockDelay?: Duration;
}
/** SynchronyParams defines the parameters for block synchrony. */

export interface SynchronyParamsSDKType {
/**
* next_block_delay replaces the locally configured timeout_commit in
* CometBFT. It determines the amount of time the CometBFT waits after the If
* the application sends next_block_delay = 0 to the consensus engine, the
* latter defaults back to using timeout_commit.
*/
next_block_delay?: DurationSDKType;
}

function createBaseDowntimeParams(): DowntimeParams {
return {
Expand Down Expand Up @@ -63,4 +85,49 @@ export const DowntimeParams = {
return message;
}

};

function createBaseSynchronyParams(): SynchronyParams {
return {
nextBlockDelay: undefined
};
}

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

return writer;
},

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

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

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

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

return message;
},

fromPartial(object: DeepPartial<SynchronyParams>): SynchronyParams {
const message = createBaseSynchronyParams();
message.nextBlockDelay = object.nextBlockDelay !== undefined && object.nextBlockDelay !== null ? Duration.fromPartial(object.nextBlockDelay) : undefined;
return message;
}

};
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { MsgUpdateDowntimeParams, MsgUpdateDowntimeParamsResponse } from "./tx";
import { MsgUpdateDowntimeParams, MsgUpdateDowntimeParamsResponse, MsgUpdateSynchronyParams, MsgUpdateSynchronyParamsResponse } from "./tx";
/** Msg defines the Msg service. */

export interface Msg {
/** UpdateDowntimeParams updates the DowntimeParams in state. */
updateDowntimeParams(request: MsgUpdateDowntimeParams): Promise<MsgUpdateDowntimeParamsResponse>;
/** UpdateSynchronyParams updates the SynchronyParams in state. */

updateSynchronyParams(request: MsgUpdateSynchronyParams): Promise<MsgUpdateSynchronyParamsResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;

constructor(rpc: Rpc) {
this.rpc = rpc;
this.updateDowntimeParams = this.updateDowntimeParams.bind(this);
this.updateSynchronyParams = this.updateSynchronyParams.bind(this);
}

updateDowntimeParams(request: MsgUpdateDowntimeParams): Promise<MsgUpdateDowntimeParamsResponse> {
Expand All @@ -21,4 +25,10 @@ export class MsgClientImpl implements Msg {
return promise.then(data => MsgUpdateDowntimeParamsResponse.decode(new _m0.Reader(data)));
}

updateSynchronyParams(request: MsgUpdateSynchronyParams): Promise<MsgUpdateSynchronyParamsResponse> {
const data = MsgUpdateSynchronyParams.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.blocktime.Msg", "UpdateSynchronyParams", data);
return promise.then(data => MsgUpdateSynchronyParamsResponse.decode(new _m0.Reader(data)));
}

}
119 changes: 118 additions & 1 deletion indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DowntimeParams, DowntimeParamsSDKType } from "./params";
import { DowntimeParams, DowntimeParamsSDKType, SynchronyParams, SynchronyParamsSDKType } from "./params";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial } from "../../helpers";
/** MsgUpdateDowntimeParams is the Msg/UpdateDowntimeParams request type. */
Expand Down Expand Up @@ -29,6 +29,34 @@ export interface MsgUpdateDowntimeParamsResponse {}
*/

export interface MsgUpdateDowntimeParamsResponseSDKType {}
/** MsgUpdateSynchronyParams is the Msg/UpdateSynchronyParams request type. */

export interface MsgUpdateSynchronyParams {
authority: string;
/** Defines the parameters to update. All parameters must be supplied. */

params?: SynchronyParams;
}
/** MsgUpdateSynchronyParams is the Msg/UpdateSynchronyParams request type. */

export interface MsgUpdateSynchronyParamsSDKType {
authority: string;
/** Defines the parameters to update. All parameters must be supplied. */

params?: SynchronyParamsSDKType;
}
/**
* MsgUpdateSynchronyParamsResponse is the Msg/UpdateSynchronyParams response
* type.
*/

export interface MsgUpdateSynchronyParamsResponse {}
/**
* MsgUpdateSynchronyParamsResponse is the Msg/UpdateSynchronyParams response
* type.
*/

export interface MsgUpdateSynchronyParamsResponseSDKType {}

function createBaseMsgUpdateDowntimeParams(): MsgUpdateDowntimeParams {
return {
Expand Down Expand Up @@ -117,4 +145,93 @@ export const MsgUpdateDowntimeParamsResponse = {
return message;
}

};

function createBaseMsgUpdateSynchronyParams(): MsgUpdateSynchronyParams {
return {
authority: "",
params: undefined
};
}

export const MsgUpdateSynchronyParams = {
encode(message: MsgUpdateSynchronyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.authority !== "") {
writer.uint32(10).string(message.authority);
}

if (message.params !== undefined) {
SynchronyParams.encode(message.params, writer.uint32(18).fork()).ldelim();
}

return writer;
},

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

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

switch (tag >>> 3) {
case 1:
message.authority = reader.string();
break;

case 2:
message.params = SynchronyParams.decode(reader, reader.uint32());
break;

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

return message;
},

fromPartial(object: DeepPartial<MsgUpdateSynchronyParams>): MsgUpdateSynchronyParams {
const message = createBaseMsgUpdateSynchronyParams();
message.authority = object.authority ?? "";
message.params = object.params !== undefined && object.params !== null ? SynchronyParams.fromPartial(object.params) : undefined;
return message;
}

};

function createBaseMsgUpdateSynchronyParamsResponse(): MsgUpdateSynchronyParamsResponse {
return {};
}

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

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

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

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

return message;
},

fromPartial(_: DeepPartial<MsgUpdateSynchronyParamsResponse>): MsgUpdateSynchronyParamsResponse {
const message = createBaseMsgUpdateSynchronyParamsResponse();
return message;
}

};

0 comments on commit 5cfa661

Please sign in to comment.