Skip to content

Commit

Permalink
feat: add epochs to stargate
Browse files Browse the repository at this point in the history
  • Loading branch information
snobbee committed Dec 23, 2023
1 parent 1f650f6 commit aa9cc54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/stargate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sifchain/stargate",
"version": "1.2.0",
"version": "1.3.0",
"description": "@cosmjs/stargate client for sifnode",
"main": "build/commonjs/index.js",
"exports": {
Expand Down
8 changes: 6 additions & 2 deletions packages/stargate/src/queryClient.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/restrict-plus-operands */
import {
createProtobufRpcClient,
QueryClient,
Expand All @@ -12,6 +14,7 @@ import { QueryClientImpl as DispensationQueryClient } from "@sifchain/proto-type
import { QueryClientImpl as EthBridgeQueryClient } from "@sifchain/proto-types/sifnode/ethbridge/v1/query";
import { QueryClientImpl as TokenRegistryQueryClient } from "@sifchain/proto-types/sifnode/tokenregistry/v1/query";
import { QueryClientImpl as MarginQueryClient } from "@sifchain/proto-types/sifnode/margin/v1/query";
import { QueryClientImpl as EpochsQueryClient } from "@sifchain/proto-types/sifnode/epochs/v1/query";
import type { Rpc, StringLiteral } from "./types";

const setupBareExtension =
Expand All @@ -23,8 +26,8 @@ const setupBareExtension =
const clientWithUncapitalizedMethods = Object.fromEntries(
Object.getOwnPropertyNames(Object.getPrototypeOf(baseClient))
.filter((x) => x !== "constructor")
.filter((x) => typeof (baseClient as any)[x] === "function")
.map((x) => [x[0]?.toLowerCase() + x.slice(1), ((baseClient as any)[x] as Function).bind(baseClient)]),
.filter((x) => typeof (baseClient as never)[x] === "function")
.map((x) => [x[0]?.toLowerCase() + x.slice(1), ((baseClient as never)[x] as Function).bind(baseClient)]),
) as {
[P in keyof TClient as P extends string ? Uncapitalize<P> : P]: TClient[P];
};
Expand All @@ -48,6 +51,7 @@ const createQueryClientFromTmClient = (tmClient: Tendermint34Client) =>
setupBareExtension("ethBridge", EthBridgeQueryClient),
setupBareExtension("tokenRegistry", TokenRegistryQueryClient),
setupBareExtension("margin", MarginQueryClient),
setupBareExtension("epochs", EpochsQueryClient),
);

const createQueryClientFromEndpoint = async (endpoint: string | HttpEndpoint) =>
Expand Down
4 changes: 4 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit aa9cc54

Please sign in to comment.