From 8d7c7e1d9b10f9d1bfe7d273778e0e778d60a4e4 Mon Sep 17 00:00:00 2001 From: Crystal Lemire Date: Thu, 19 Oct 2023 14:30:43 -0700 Subject: [PATCH] Re-codegenning for indexer. --- .../codegen/dydxprotocol/rewards/query.lcd.ts | 10 +- .../dydxprotocol/rewards/query.rpc.Query.ts | 16 ++- .../src/codegen/dydxprotocol/rewards/query.ts | 111 ++++++++++++++++++ 3 files changed, 135 insertions(+), 2 deletions(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.lcd.ts index 9fa4b63572..58b9d0ac52 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.lcd.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.lcd.ts @@ -1,5 +1,5 @@ import { LCDClient } from "@osmonauts/lcd"; -import { QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; +import { QueryParamsRequest, QueryParamsResponseSDKType, QueryRewardShareRequest, QueryRewardShareResponseSDKType } from "./query"; export class LCDQueryClient { req: LCDClient; @@ -10,6 +10,7 @@ export class LCDQueryClient { }) { this.req = requestClient; this.params = this.params.bind(this); + this.rewardShare = this.rewardShare.bind(this); } /* Queries the Params. */ @@ -18,5 +19,12 @@ export class LCDQueryClient { const endpoint = `dydxprotocol/v4/rewards/params`; return await this.req.get(endpoint); } + /* Queries a reward share by address. */ + + + async rewardShare(params: QueryRewardShareRequest): Promise { + const endpoint = `dydxprotocol/v4/rewards/shares/${params.address}`; + return await this.req.get(endpoint); + } } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.rpc.Query.ts index 5b697e31ac..dd266a5dcc 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.rpc.Query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.rpc.Query.ts @@ -1,12 +1,15 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { QueryParamsRequest, QueryParamsResponse } from "./query"; +import { QueryParamsRequest, QueryParamsResponse, QueryRewardShareRequest, QueryRewardShareResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { /** Queries the Params. */ params(request?: QueryParamsRequest): Promise; + /** Queries a reward share by address. */ + + rewardShare(request: QueryRewardShareRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -14,6 +17,7 @@ export class QueryClientImpl implements Query { constructor(rpc: Rpc) { this.rpc = rpc; this.params = this.params.bind(this); + this.rewardShare = this.rewardShare.bind(this); } params(request: QueryParamsRequest = {}): Promise { @@ -22,6 +26,12 @@ export class QueryClientImpl implements Query { return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); } + rewardShare(request: QueryRewardShareRequest): Promise { + const data = QueryRewardShareRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.rewards.Query", "RewardShare", data); + return promise.then(data => QueryRewardShareResponse.decode(new _m0.Reader(data))); + } + } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -29,6 +39,10 @@ export const createRpcQueryExtension = (base: QueryClient) => { return { params(request?: QueryParamsRequest): Promise { return queryService.params(request); + }, + + rewardShare(request: QueryRewardShareRequest): Promise { + return queryService.rewardShare(request); } }; diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.ts index 095ba9f2be..8e37e87dcd 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rewards/query.ts @@ -1,4 +1,5 @@ import { Params, ParamsSDKType } from "./params"; +import { RewardShare, RewardShareSDKType } from "./reward_share"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** QueryParamsRequest is a request type for the Params RPC method. */ @@ -17,6 +18,26 @@ export interface QueryParamsResponse { export interface QueryParamsResponseSDKType { params?: ParamsSDKType; } +/** QueryRewardShareRequest is a request type for the RewardShare RPC method. */ + +export interface QueryRewardShareRequest { + address: string; +} +/** QueryRewardShareRequest is a request type for the RewardShare RPC method. */ + +export interface QueryRewardShareRequestSDKType { + address: string; +} +/** QueryRewardShareResponse is a response type for the RewardsShare RPC method. */ + +export interface QueryRewardShareResponse { + rewardShare?: RewardShare; +} +/** QueryRewardShareResponse is a response type for the RewardsShare RPC method. */ + +export interface QueryRewardShareResponseSDKType { + reward_share?: RewardShareSDKType; +} function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; @@ -95,4 +116,94 @@ export const QueryParamsResponse = { return message; } +}; + +function createBaseQueryRewardShareRequest(): QueryRewardShareRequest { + return { + address: "" + }; +} + +export const QueryRewardShareRequest = { + encode(message: QueryRewardShareRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryRewardShareRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRewardShareRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryRewardShareRequest { + const message = createBaseQueryRewardShareRequest(); + message.address = object.address ?? ""; + return message; + } + +}; + +function createBaseQueryRewardShareResponse(): QueryRewardShareResponse { + return { + rewardShare: undefined + }; +} + +export const QueryRewardShareResponse = { + encode(message: QueryRewardShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.rewardShare !== undefined) { + RewardShare.encode(message.rewardShare, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryRewardShareResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRewardShareResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.rewardShare = RewardShare.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): QueryRewardShareResponse { + const message = createBaseQueryRewardShareResponse(); + message.rewardShare = object.rewardShare !== undefined && object.rewardShare !== null ? RewardShare.fromPartial(object.rewardShare) : undefined; + return message; + } + }; \ No newline at end of file