diff --git a/src/sdk/query/index.ts b/src/sdk/query/index.ts index 22e95d02..bba5ece6 100644 --- a/src/sdk/query/index.ts +++ b/src/sdk/query/index.ts @@ -7,5 +7,4 @@ export * from "./epochs" export * from "./inflation" export * from "./oracle" export * from "./query" -export * from "./staking" export * from "./sudo" diff --git a/src/sdk/query/staking.test.ts b/src/sdk/query/staking.test.ts deleted file mode 100644 index ba06dc87..00000000 --- a/src/sdk/query/staking.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { QueryClient, coin } from "@cosmjs/stargate" -import * as query from "../../protojs/cosmos/staking/v1beta1/tx" -import { setupStakeExtension } from "." -import Long from "long" - -describe("setupStakingExtension", () => { - const mockBaseQueryClient = {} as QueryClient - - jest.spyOn(query, "MsgClientImpl").mockReturnValue({ - QuerySudoers: jest.fn().mockResolvedValue({ staking: {} }), - } as unknown as query.MsgClientImpl) - - test("should setup sudo extension correctly", () => { - const extension = setupStakeExtension(mockBaseQueryClient) - - expect(extension.staking).toBeDefined() - expect(extension.staking.cancelUnbondingDelegation).toBeInstanceOf(Function) - }) - - describe("sudo.querySudoers", () => { - test("should call QuerySudoersRequest and return the response", async () => { - const querySudoersRequest = jest - .spyOn(query.MsgCancelUnbondingDelegation, "fromPartial") - .mockReturnValue({} as query.MsgCancelUnbondingDelegation) - - const extension = setupStakeExtension(mockBaseQueryClient) - const testArgs = { - validatorAddress: "", - delegatorAddress: "", - amount: coin(1, "unibi"), - creationHeight: new Long(0), - } - const result = await extension.staking.cancelUnbondingDelegation(testArgs) - - expect(querySudoersRequest).toHaveBeenCalledWith(testArgs) - expect(result).toEqual({ staking: {} }) - }) - }) -}) diff --git a/src/sdk/query/staking.ts b/src/sdk/query/staking.ts deleted file mode 100644 index a46e00a1..00000000 --- a/src/sdk/query/staking.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { createProtobufRpcClient, QueryClient } from "@cosmjs/stargate" -import { - MsgCancelUnbondingDelegation, - MsgCancelUnbondingDelegationResponse, - MsgClientImpl, -} from "../../protojs/cosmos/staking/v1beta1/tx" - -export interface StakeExtension { - readonly staking: Readonly<{ - cancelUnbondingDelegation: ( - args: MsgCancelUnbondingDelegation - ) => Promise - }> -} - -export const setupStakeExtension = (base: QueryClient): StakeExtension => { - const rpcClient = createProtobufRpcClient(base) - const queryService = new MsgClientImpl(rpcClient) - - return { - staking: { - cancelUnbondingDelegation: async (args: MsgCancelUnbondingDelegation) => { - const req = MsgCancelUnbondingDelegation.fromPartial(args) - const resp = await queryService.CancelUnbondingDelegation(req) - return resp - }, - }, - } -}