diff --git a/__fixtures__/misc/enforce-null-check-true/helpers.ts b/__fixtures__/misc/enforce-null-check-true/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/enforce-null-check-true/helpers.ts +++ b/__fixtures__/misc/enforce-null-check-true/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-base64/helpers.ts b/__fixtures__/misc/output-base64/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-base64/helpers.ts +++ b/__fixtures__/misc/output-base64/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-decimals/helpers.ts b/__fixtures__/misc/output-decimals/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-decimals/helpers.ts +++ b/__fixtures__/misc/output-decimals/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts b/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts index cde3e8ad2..07fccf9e2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts @@ -200,6 +200,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts b/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output-scalar-default-nullable-true/helpers.ts b/__fixtures__/misc/output-scalar-default-nullable-true/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output-scalar-default-nullable-true/helpers.ts +++ b/__fixtures__/misc/output-scalar-default-nullable-true/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/misc/output/helpers.ts b/__fixtures__/misc/output/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/misc/output/helpers.ts +++ b/__fixtures__/misc/output/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.func.ts index ce32a5bd1..34024ade6 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -4,8 +4,8 @@ import { buildTx, ISigningClient, SigningClientResolver } from "../../../helper- import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; -export const createSend = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSend = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSend.typeUrl, encoders: toEncoders(MsgSend), converters: toConverters(MsgSend) @@ -13,8 +13,8 @@ export const createSend = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createSend }); -export const createMultiSend = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createMultiSend = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgMultiSend.typeUrl, encoders: toEncoders(MsgMultiSend), converters: toConverters(MsgMultiSend) diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/query.rpc.func.ts index 679cda906..bd25554ac 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/query.rpc.func.ts @@ -3,89 +3,89 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryProposalRequest, QueryProposalRequestSDKType, QueryProposalResponse, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsRequestSDKType, QueryProposalsResponse, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteRequestSDKType, QueryVoteResponse, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesRequestSDKType, QueryVotesResponse, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsRequestSDKType, QueryParamsResponse, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositRequestSDKType, QueryDepositResponse, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsRequestSDKType, QueryDepositsResponse, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultRequestSDKType, QueryTallyResultResponse, QueryTallyResultResponseSDKType } from "./query"; -export const createGetProposal = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposal = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalRequest.encode, decode: QueryProposalResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Proposal", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposal = buildUseQuery({ builderQueryFn: createGetProposal, queryKeyPrefix: "ProposalQuery" }); -export const createGetProposals = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposals = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalsRequest.encode, decode: QueryProposalsResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Proposals", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposals = buildUseQuery({ builderQueryFn: createGetProposals, queryKeyPrefix: "ProposalsQuery" }); -export const buildHelperVote = (getRpcInstance: RpcResolver) => buildQuery({ +export const buildHelperVote = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVoteRequest.encode, decode: QueryVoteResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Vote", - getRpcInstance: getRpcInstance + clientResolver }); export const useHelperVote = buildUseQuery({ builderQueryFn: buildHelperVote, queryKeyPrefix: "VoteQuery" }); -export const buildHelperVotes = (getRpcInstance: RpcResolver) => buildQuery({ +export const buildHelperVotes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVotesRequest.encode, decode: QueryVotesResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Votes", - getRpcInstance: getRpcInstance + clientResolver }); export const useHelperVotes = buildUseQuery({ builderQueryFn: buildHelperVotes, queryKeyPrefix: "VotesQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createCheckDeposit = (getRpcInstance: RpcResolver) => buildQuery({ +export const createCheckDeposit = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDepositRequest.encode, decode: QueryDepositResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Deposit", - getRpcInstance: getRpcInstance + clientResolver }); export const useCheckDeposit = buildUseQuery({ builderQueryFn: createCheckDeposit, queryKeyPrefix: "DepositQuery" }); -export const createGoOverDeposits = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGoOverDeposits = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDepositsRequest.encode, decode: QueryDepositsResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Deposits", - getRpcInstance: getRpcInstance + clientResolver }); export const useGoOverDeposits = buildUseQuery({ builderQueryFn: createGoOverDeposits, queryKeyPrefix: "DepositsQuery" }); -export const createGetTallyResult = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTallyResult = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTallyResultRequest.encode, decode: QueryTallyResultResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "TallyResult", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTallyResult = buildUseQuery({ builderQueryFn: createGetTallyResult, diff --git a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.func.ts index f26c0d02a..da68273a4 100644 --- a/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputhelperfunc/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -5,8 +5,8 @@ import { buildTx, ISigningClient, SigningClientResolver } from "../../../helper- import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; -export const createSubmitProposal = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSubmitProposal = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSubmitProposal.typeUrl, encoders: toEncoders(MsgSubmitProposal), converters: toConverters(MsgSubmitProposal) @@ -14,8 +14,8 @@ export const createSubmitProposal = (getSigningClient: SigningClientResolver) => export const useSubmitProposal = buildUseMutation({ builderMutationFn: createSubmitProposal }); -export const buildHelperVote = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const buildHelperVote = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVote.typeUrl, encoders: toEncoders(MsgVote), converters: toConverters(MsgVote) @@ -23,8 +23,8 @@ export const buildHelperVote = (getSigningClient: SigningClientResolver) => buil export const useHelperVote = buildUseMutation({ builderMutationFn: buildHelperVote }); -export const constructLetsVoteWeighted = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const constructLetsVoteWeighted = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVoteWeighted.typeUrl, encoders: toEncoders(MsgVoteWeighted), converters: toConverters(MsgVoteWeighted) @@ -32,8 +32,8 @@ export const constructLetsVoteWeighted = (getSigningClient: SigningClientResolve export const useTxLetsVoteWeighted = buildUseMutation({ builderMutationFn: constructLetsVoteWeighted }); -export const createToDeposit = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createToDeposit = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDeposit.typeUrl, encoders: toEncoders(MsgDeposit), converters: toConverters(MsgDeposit) diff --git a/__fixtures__/v-next/outputhelperfunc/helper-func-types.ts b/__fixtures__/v-next/outputhelperfunc/helper-func-types.ts index bd44fa62d..ec1132b5a 100644 --- a/__fixtures__/v-next/outputhelperfunc/helper-func-types.ts +++ b/__fixtures__/v-next/outputhelperfunc/helper-func-types.ts @@ -5,20 +5,28 @@ */ +import { HttpEndpoint } from "@interchainjs/types"; import { BinaryReader, BinaryWriter } from "./binary"; -import { Rpc } from "./helpers"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; export interface QueryBuilderOptions { encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter decode: (input: BinaryReader | Uint8Array, length?: number) => TRes service: string, method: string, - getRpcInstance: () => Rpc | undefined + clientResolver: RpcResolver } export function buildQuery(opts: QueryBuilderOptions) { return async (request: TReq) => { - const rpc = opts.getRpcInstance(); + let rpc: Rpc | undefined; + + if(isRpc(opts.clientResolver)) { + rpc = opts.clientResolver; + } else { + rpc = await getRpcClient(opts.clientResolver); + } if (!rpc) throw new Error("Query Rpc is not initialized"); @@ -35,6 +43,13 @@ export interface ITxArgs { memo: string; } +export function isISigningClient(client: unknown): client is ISigningClient { + return client !== null && client !== undefined + && typeof (client as ISigningClient).signAndBroadcast === 'function' + && typeof (client as ISigningClient).addConverters === 'function' + && typeof (client as ISigningClient).addEncoders === 'function'; +} + export interface ISigningClient { /** * register converters @@ -54,7 +69,7 @@ export interface ISigningClient { } export interface TxBuilderOptions { - getSigningClient: () => ISigningClient | undefined, + clientResolver: SigningClientResolver, typeUrl: string, encoders?: Encoder[], converters?: AminoConverter[], @@ -67,7 +82,12 @@ export function buildTx(opts: TxBuilderOptions) { fee: StdFee | 'auto', memo: string ): Promise => { - const client = opts.getSigningClient(); + let client: ISigningClient | undefined; + + // if opts.getSigningClient is a function, call it to get the SigningClient instance + if(isISigningClient(opts.clientResolver)) { + client = opts.clientResolver; + } if (!client) throw new Error("SigningClient is not initialized"); @@ -167,5 +187,5 @@ export interface AminoConverter { toAmino: (data: any) => any; } -export type SigningClientResolver = () => ISigningClient | undefined; -export type RpcResolver = () => Rpc | undefined; +export type SigningClientResolver = string | HttpEndpoint | ISigningClient; +export type RpcResolver = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/v-next/outputhelperfunc/helpers.ts b/__fixtures__/v-next/outputhelperfunc/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputhelperfunc/helpers.ts +++ b/__fixtures__/v-next/outputhelperfunc/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputhelperfunc/react-query.ts b/__fixtures__/v-next/outputhelperfunc/react-query.ts index 65cf59ccc..2b6ca8d72 100644 --- a/__fixtures__/v-next/outputhelperfunc/react-query.ts +++ b/__fixtures__/v-next/outputhelperfunc/react-query.ts @@ -4,21 +4,27 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ + + + import { getRpcClient } from './extern' import { + isRpc, Rpc, } from './helpers' import { ITxArgs, ISigningClient, StdFee, - DeliverTxResponse + DeliverTxResponse, + SigningClientResolver, + RpcResolver, + isISigningClient } from './helper-func-types' import { useQuery, useQueryClient, UseQueryOptions, - MutationOptions, useMutation, UseMutationOptions, QueryKey, @@ -31,13 +37,21 @@ export const DEFAULT_RPC_CLIENT_QUERY_KEY = 'rpcClient'; export const DEFAULT_RPC_ENDPOINT_QUERY_KEY = 'rpcEndPoint'; export const DEFAULT_SIGNING_CLIENT_QUERY_KEY = 'signingClient'; +export interface CacheResolver { + rpcEndpoint?: string | HttpEndpoint; + clientQueryKey?: string; +} + +export function isCacheResolver(resolver: unknown) : resolver is CacheResolver { + return resolver !== null && resolver !== undefined && (resolver as CacheResolver).rpcEndpoint !== undefined && (resolver as CacheResolver).clientQueryKey !== undefined; +} + export interface ReactQueryParams { options?: UseQueryOptions; - rpcEndpoint?: string | HttpEndpoint; - rpcClientQueryKey?: string; } export interface UseRpcClientQuery extends ReactQueryParams { + clientResolver?: CacheResolver; } export interface UseRpcEndpointQuery extends ReactQueryParams { @@ -59,20 +73,20 @@ export const useRpcEndpoint = ({ }; export const useRpcClient = ({ - rpcEndpoint, options, - rpcClientQueryKey, + clientResolver }: UseRpcClientQuery) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - return useQuery([key, rpcEndpoint], async () => { - if(!rpcEndpoint) { + + const key = clientResolver?.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + return useQuery([key, clientResolver?.rpcEndpoint], async () => { + if(!clientResolver?.rpcEndpoint) { throw new Error('rpcEndpoint is required'); } - const client = await getRpcClient(rpcEndpoint); + const client = await getRpcClient(clientResolver.rpcEndpoint); if(!client) { throw new Error('Failed to connect to rpc client'); } @@ -109,7 +123,7 @@ export const useTendermintClient = ({ }; export interface UseQueryBuilderOptions { - builderQueryFn: (getRpcInstance: () => Rpc | undefined) => (request: TReq) => Promise, + builderQueryFn: (clientResolver: RpcResolver) => (request: TReq) => Promise, queryKeyPrefix: string, } @@ -118,37 +132,52 @@ export function buildUseQuery(opts: UseQueryBuilderOptions({ request, options, - rpcEndpoint, - rpcClientQueryKey, + clientResolver, customizedQueryKey, }: UseQueryParams) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; - const rpc = queryClient.getQueryData(queryKey); - const queryFn = opts.builderQueryFn(()=>{ - return rpc; - }); + + let rpcResolver: RpcResolver | undefined; + + if(isRpc(clientResolver)) { + rpcResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + rpcResolver = queryClient.getQueryData(queryKey); + + if(!rpcResolver && clientResolver.rpcEndpoint) { + rpcResolver = clientResolver.rpcEndpoint; + } + } else { + rpcResolver = clientResolver; + } + + if(!rpcResolver) { + throw new Error('RpcResolver is not initialized'); + } + + const queryFn = opts.builderQueryFn(rpcResolver); return useQuery(customizedQueryKey || [opts.queryKeyPrefix, request], () => queryFn(request), options); }; } export interface UseQueryParams extends ReactQueryParams { request: TReq; + clientResolver?: CacheResolver | RpcResolver; customizedQueryKey?: QueryKey } export interface ReactMutationParams { options?: UseMutationOptions; - rpcEndpoint?: string | HttpEndpoint; - signingClientQueryKey?: string; + clientResolver?: CacheResolver | SigningClientResolver; } export interface UseMutationBuilderOptions { - builderMutationFn: (getSigningClientInstance: () => ISigningClient | undefined) => ( + builderMutationFn: (getSigningClientInstance: SigningClientResolver) => ( signerAddress: string, message: TMsg, fee: StdFee | 'auto', @@ -160,19 +189,29 @@ export interface UseMutationBuilderOptions { export function buildUseMutation(opts: UseMutationBuilderOptions) { return ({ options, - rpcEndpoint, - signingClientQueryKey + clientResolver }: ReactMutationParams>) => { const queryClient = useQueryClient({ context: options?.context }); - const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; - const signingClient = queryClient.getQueryData(queryKey); - const mutationFn = opts.builderMutationFn(() => { - return signingClient; - }); + let signingClientResolver: SigningClientResolver | undefined; + + if(isISigningClient(clientResolver)) { + signingClientResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + signingClientResolver = queryClient.getQueryData(queryKey); + } else { + clientResolver = clientResolver; + } + + if(!signingClientResolver) { + throw new Error('SigningClientResolver is not initialized'); + } + + const mutationFn = opts.builderMutationFn(signingClientResolver); return useMutation>( (reqData: ITxArgs) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo), diff --git a/__fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.rpc.func.ts index 250106d07..14c3a83ac 100644 --- a/__fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/audit/v1beta1/audit.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; -export const createSignProviderAttributes = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSignProviderAttributes = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSignProviderAttributes.typeUrl, encoders: toEncoders(MsgSignProviderAttributes), converters: toConverters(MsgSignProviderAttributes) @@ -11,8 +11,8 @@ export const createSignProviderAttributes = (getSigningClient: SigningClientReso export const useSignProviderAttributes = buildUseMutation({ builderMutationFn: createSignProviderAttributes }); -export const createDeleteProviderAttributes = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDeleteProviderAttributes = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDeleteProviderAttributes.typeUrl, encoders: toEncoders(MsgDeleteProviderAttributes), converters: toConverters(MsgDeleteProviderAttributes) diff --git a/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.rpc.func.ts index 250106d07..14c3a83ac 100644 --- a/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/audit.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSignProviderAttributes, MsgDeleteProviderAttributes } from "./audit"; -export const createSignProviderAttributes = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSignProviderAttributes = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSignProviderAttributes.typeUrl, encoders: toEncoders(MsgSignProviderAttributes), converters: toConverters(MsgSignProviderAttributes) @@ -11,8 +11,8 @@ export const createSignProviderAttributes = (getSigningClient: SigningClientReso export const useSignProviderAttributes = buildUseMutation({ builderMutationFn: createSignProviderAttributes }); -export const createDeleteProviderAttributes = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDeleteProviderAttributes = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDeleteProviderAttributes.typeUrl, encoders: toEncoders(MsgDeleteProviderAttributes), converters: toConverters(MsgDeleteProviderAttributes) diff --git a/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/query.rpc.func.ts index 338094efb..2f73fe696 100644 --- a/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/audit/v1beta2/query.rpc.func.ts @@ -1,45 +1,45 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryAllProvidersAttributesRequest, QueryProvidersResponse, QueryProviderAttributesRequest, QueryProviderAuditorRequest, QueryAuditorAttributesRequest } from "./query"; -export const createGetAllProvidersAttributes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllProvidersAttributes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllProvidersAttributesRequest.encode, decode: QueryProvidersResponse.decode, service: "akash.audit.v1beta2.Query", method: "AllProvidersAttributes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllProvidersAttributes = buildUseQuery({ builderQueryFn: createGetAllProvidersAttributes, queryKeyPrefix: "AllProvidersAttributesQuery" }); -export const createGetProviderAttributes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProviderAttributes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProviderAttributesRequest.encode, decode: QueryProvidersResponse.decode, service: "akash.audit.v1beta2.Query", method: "ProviderAttributes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProviderAttributes = buildUseQuery({ builderQueryFn: createGetProviderAttributes, queryKeyPrefix: "ProviderAttributesQuery" }); -export const createGetProviderAuditorAttributes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProviderAuditorAttributes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProviderAuditorRequest.encode, decode: QueryProvidersResponse.decode, service: "akash.audit.v1beta2.Query", method: "ProviderAuditorAttributes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProviderAuditorAttributes = buildUseQuery({ builderQueryFn: createGetProviderAuditorAttributes, queryKeyPrefix: "ProviderAuditorAttributesQuery" }); -export const createGetAuditorAttributes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAuditorAttributes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAuditorAttributesRequest.encode, decode: QueryProvidersResponse.decode, service: "akash.audit.v1beta2.Query", method: "AuditorAttributes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAuditorAttributes = buildUseQuery({ builderQueryFn: createGetAuditorAttributes, diff --git a/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.rpc.func.ts index c89045581..881c126aa 100644 --- a/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/cert.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateCertificate, MsgRevokeCertificate } from "./cert"; -export const createCreateCertificate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateCertificate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateCertificate.typeUrl, encoders: toEncoders(MsgCreateCertificate), converters: toConverters(MsgCreateCertificate) @@ -11,8 +11,8 @@ export const createCreateCertificate = (getSigningClient: SigningClientResolver) export const useCreateCertificate = buildUseMutation({ builderMutationFn: createCreateCertificate }); -export const createRevokeCertificate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createRevokeCertificate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgRevokeCertificate.typeUrl, encoders: toEncoders(MsgRevokeCertificate), converters: toConverters(MsgRevokeCertificate) diff --git a/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/query.rpc.func.ts index b86c96165..2e914769a 100644 --- a/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/cert/v1beta2/query.rpc.func.ts @@ -1,12 +1,12 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryCertificatesRequest, QueryCertificatesResponse } from "./query"; -export const createGetCertificates = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCertificates = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCertificatesRequest.encode, decode: QueryCertificatesResponse.decode, service: "akash.cert.v1beta2.Query", method: "Certificates", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCertificates = buildUseQuery({ builderQueryFn: createGetCertificates, diff --git a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/deployment.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/deployment.rpc.func.ts index ca44f1774..b21d9bd6b 100644 --- a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/deployment.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/deployment.rpc.func.ts @@ -3,8 +3,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deployment"; -export const createCreateDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateDeployment.typeUrl, encoders: toEncoders(MsgCreateDeployment), converters: toConverters(MsgCreateDeployment) @@ -12,8 +12,8 @@ export const createCreateDeployment = (getSigningClient: SigningClientResolver) export const useCreateDeployment = buildUseMutation({ builderMutationFn: createCreateDeployment }); -export const createDepositDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDepositDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDepositDeployment.typeUrl, encoders: toEncoders(MsgDepositDeployment), converters: toConverters(MsgDepositDeployment) @@ -21,8 +21,8 @@ export const createDepositDeployment = (getSigningClient: SigningClientResolver) export const useDepositDeployment = buildUseMutation({ builderMutationFn: createDepositDeployment }); -export const createUpdateDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateDeployment.typeUrl, encoders: toEncoders(MsgUpdateDeployment), converters: toConverters(MsgUpdateDeployment) @@ -30,8 +30,8 @@ export const createUpdateDeployment = (getSigningClient: SigningClientResolver) export const useUpdateDeployment = buildUseMutation({ builderMutationFn: createUpdateDeployment }); -export const createCloseDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCloseDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCloseDeployment.typeUrl, encoders: toEncoders(MsgCloseDeployment), converters: toConverters(MsgCloseDeployment) @@ -39,8 +39,8 @@ export const createCloseDeployment = (getSigningClient: SigningClientResolver) = export const useCloseDeployment = buildUseMutation({ builderMutationFn: createCloseDeployment }); -export const createCloseGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCloseGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCloseGroup.typeUrl, encoders: toEncoders(MsgCloseGroup), converters: toConverters(MsgCloseGroup) @@ -48,8 +48,8 @@ export const createCloseGroup = (getSigningClient: SigningClientResolver) => bui export const useCloseGroup = buildUseMutation({ builderMutationFn: createCloseGroup }); -export const createPauseGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createPauseGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgPauseGroup.typeUrl, encoders: toEncoders(MsgPauseGroup), converters: toConverters(MsgPauseGroup) @@ -57,8 +57,8 @@ export const createPauseGroup = (getSigningClient: SigningClientResolver) => bui export const usePauseGroup = buildUseMutation({ builderMutationFn: createPauseGroup }); -export const createStartGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createStartGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgStartGroup.typeUrl, encoders: toEncoders(MsgStartGroup), converters: toConverters(MsgStartGroup) diff --git a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/query.rpc.func.ts index 12106daa3..f9965806f 100644 --- a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryDeploymentsRequest, QueryDeploymentsResponse, QueryDeploymentRequest, QueryDeploymentResponse, QueryGroupRequest, QueryGroupResponse } from "./query"; -export const createGetDeployments = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeployments = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDeploymentsRequest.encode, decode: QueryDeploymentsResponse.decode, service: "akash.deployment.v1beta1.Query", method: "Deployments", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeployments = buildUseQuery({ builderQueryFn: createGetDeployments, queryKeyPrefix: "DeploymentsQuery" }); -export const createGetDeployment = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeployment = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDeploymentRequest.encode, decode: QueryDeploymentResponse.decode, service: "akash.deployment.v1beta1.Query", method: "Deployment", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeployment = buildUseQuery({ builderQueryFn: createGetDeployment, queryKeyPrefix: "DeploymentQuery" }); -export const createGetGroup = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroup = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupRequest.encode, decode: QueryGroupResponse.decode, service: "akash.deployment.v1beta1.Query", method: "Group", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroup = buildUseQuery({ builderQueryFn: createGetGroup, diff --git a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/query.rpc.func.ts index 01524ac05..1dd1b5a42 100644 --- a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryDeploymentsRequest, QueryDeploymentsResponse, QueryDeploymentRequest, QueryDeploymentResponse, QueryGroupRequest, QueryGroupResponse } from "./query"; -export const createGetDeployments = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeployments = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDeploymentsRequest.encode, decode: QueryDeploymentsResponse.decode, service: "akash.deployment.v1beta2.Query", method: "Deployments", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeployments = buildUseQuery({ builderQueryFn: createGetDeployments, queryKeyPrefix: "DeploymentsQuery" }); -export const createGetDeployment = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeployment = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDeploymentRequest.encode, decode: QueryDeploymentResponse.decode, service: "akash.deployment.v1beta2.Query", method: "Deployment", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeployment = buildUseQuery({ builderQueryFn: createGetDeployment, queryKeyPrefix: "DeploymentQuery" }); -export const createGetGroup = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroup = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupRequest.encode, decode: QueryGroupResponse.decode, service: "akash.deployment.v1beta2.Query", method: "Group", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroup = buildUseQuery({ builderQueryFn: createGetGroup, diff --git a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.rpc.func.ts index 965bdbe80..38d586f73 100644 --- a/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/deployment/v1beta2/service.rpc.func.ts @@ -3,8 +3,8 @@ import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateDeployment, MsgDepositDeployment, MsgUpdateDeployment, MsgCloseDeployment } from "./deploymentmsg"; import { MsgCloseGroup, MsgPauseGroup, MsgStartGroup } from "./groupmsg"; -export const createCreateDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateDeployment.typeUrl, encoders: toEncoders(MsgCreateDeployment), converters: toConverters(MsgCreateDeployment) @@ -12,8 +12,8 @@ export const createCreateDeployment = (getSigningClient: SigningClientResolver) export const useCreateDeployment = buildUseMutation({ builderMutationFn: createCreateDeployment }); -export const createDepositDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDepositDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDepositDeployment.typeUrl, encoders: toEncoders(MsgDepositDeployment), converters: toConverters(MsgDepositDeployment) @@ -21,8 +21,8 @@ export const createDepositDeployment = (getSigningClient: SigningClientResolver) export const useDepositDeployment = buildUseMutation({ builderMutationFn: createDepositDeployment }); -export const createUpdateDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateDeployment.typeUrl, encoders: toEncoders(MsgUpdateDeployment), converters: toConverters(MsgUpdateDeployment) @@ -30,8 +30,8 @@ export const createUpdateDeployment = (getSigningClient: SigningClientResolver) export const useUpdateDeployment = buildUseMutation({ builderMutationFn: createUpdateDeployment }); -export const createCloseDeployment = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCloseDeployment = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCloseDeployment.typeUrl, encoders: toEncoders(MsgCloseDeployment), converters: toConverters(MsgCloseDeployment) @@ -39,8 +39,8 @@ export const createCloseDeployment = (getSigningClient: SigningClientResolver) = export const useCloseDeployment = buildUseMutation({ builderMutationFn: createCloseDeployment }); -export const createCloseGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCloseGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCloseGroup.typeUrl, encoders: toEncoders(MsgCloseGroup), converters: toConverters(MsgCloseGroup) @@ -48,8 +48,8 @@ export const createCloseGroup = (getSigningClient: SigningClientResolver) => bui export const useCloseGroup = buildUseMutation({ builderMutationFn: createCloseGroup }); -export const createPauseGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createPauseGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgPauseGroup.typeUrl, encoders: toEncoders(MsgPauseGroup), converters: toConverters(MsgPauseGroup) @@ -57,8 +57,8 @@ export const createPauseGroup = (getSigningClient: SigningClientResolver) => bui export const usePauseGroup = buildUseMutation({ builderMutationFn: createPauseGroup }); -export const createStartGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createStartGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgStartGroup.typeUrl, encoders: toEncoders(MsgStartGroup), converters: toConverters(MsgStartGroup) diff --git a/__fixtures__/v-next/outputicjs/akash/escrow/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/escrow/v1beta1/query.rpc.func.ts index 0aa868170..0b083cbc9 100644 --- a/__fixtures__/v-next/outputicjs/akash/escrow/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/escrow/v1beta1/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryAccountsRequest, QueryAccountsResponse, QueryPaymentsRequest, QueryPaymentsResponse } from "./query"; -export const createGetAccounts = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccounts = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAccountsRequest.encode, decode: QueryAccountsResponse.decode, service: "akash.escrow.v1beta1.Query", method: "Accounts", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccounts = buildUseQuery({ builderQueryFn: createGetAccounts, queryKeyPrefix: "AccountsQuery" }); -export const createGetPayments = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPayments = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPaymentsRequest.encode, decode: QueryPaymentsResponse.decode, service: "akash.escrow.v1beta1.Query", method: "Payments", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPayments = buildUseQuery({ builderQueryFn: createGetPayments, diff --git a/__fixtures__/v-next/outputicjs/akash/escrow/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/escrow/v1beta2/query.rpc.func.ts index aafd37a85..bc34f8553 100644 --- a/__fixtures__/v-next/outputicjs/akash/escrow/v1beta2/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/escrow/v1beta2/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryAccountsRequest, QueryAccountsResponse, QueryPaymentsRequest, QueryPaymentsResponse } from "./query"; -export const createGetAccounts = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccounts = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAccountsRequest.encode, decode: QueryAccountsResponse.decode, service: "akash.escrow.v1beta2.Query", method: "Accounts", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccounts = buildUseQuery({ builderQueryFn: createGetAccounts, queryKeyPrefix: "AccountsQuery" }); -export const createGetPayments = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPayments = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPaymentsRequest.encode, decode: QueryPaymentsResponse.decode, service: "akash.escrow.v1beta2.Query", method: "Payments", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPayments = buildUseQuery({ builderQueryFn: createGetPayments, diff --git a/__fixtures__/v-next/outputicjs/akash/market/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/market/v1beta2/query.rpc.func.ts index 752663d71..fc4c3ea75 100644 --- a/__fixtures__/v-next/outputicjs/akash/market/v1beta2/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/market/v1beta2/query.rpc.func.ts @@ -1,67 +1,67 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryOrdersRequest, QueryOrdersResponse, QueryOrderRequest, QueryOrderResponse, QueryBidsRequest, QueryBidsResponse, QueryBidRequest, QueryBidResponse, QueryLeasesRequest, QueryLeasesResponse, QueryLeaseRequest, QueryLeaseResponse } from "./query"; -export const createGetOrders = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetOrders = (clientResolver: RpcResolver) => buildQuery({ encode: QueryOrdersRequest.encode, decode: QueryOrdersResponse.decode, service: "akash.market.v1beta2.Query", method: "Orders", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetOrders = buildUseQuery({ builderQueryFn: createGetOrders, queryKeyPrefix: "OrdersQuery" }); -export const createGetOrder = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetOrder = (clientResolver: RpcResolver) => buildQuery({ encode: QueryOrderRequest.encode, decode: QueryOrderResponse.decode, service: "akash.market.v1beta2.Query", method: "Order", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetOrder = buildUseQuery({ builderQueryFn: createGetOrder, queryKeyPrefix: "OrderQuery" }); -export const createGetBids = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBids = (clientResolver: RpcResolver) => buildQuery({ encode: QueryBidsRequest.encode, decode: QueryBidsResponse.decode, service: "akash.market.v1beta2.Query", method: "Bids", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBids = buildUseQuery({ builderQueryFn: createGetBids, queryKeyPrefix: "BidsQuery" }); -export const createGetBid = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBid = (clientResolver: RpcResolver) => buildQuery({ encode: QueryBidRequest.encode, decode: QueryBidResponse.decode, service: "akash.market.v1beta2.Query", method: "Bid", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBid = buildUseQuery({ builderQueryFn: createGetBid, queryKeyPrefix: "BidQuery" }); -export const createGetLeases = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetLeases = (clientResolver: RpcResolver) => buildQuery({ encode: QueryLeasesRequest.encode, decode: QueryLeasesResponse.decode, service: "akash.market.v1beta2.Query", method: "Leases", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetLeases = buildUseQuery({ builderQueryFn: createGetLeases, queryKeyPrefix: "LeasesQuery" }); -export const createGetLease = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetLease = (clientResolver: RpcResolver) => buildQuery({ encode: QueryLeaseRequest.encode, decode: QueryLeaseResponse.decode, service: "akash.market.v1beta2.Query", method: "Lease", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetLease = buildUseQuery({ builderQueryFn: createGetLease, diff --git a/__fixtures__/v-next/outputicjs/akash/market/v1beta2/service.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/market/v1beta2/service.rpc.func.ts index 6353b66e4..42ac5e747 100644 --- a/__fixtures__/v-next/outputicjs/akash/market/v1beta2/service.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/market/v1beta2/service.rpc.func.ts @@ -3,8 +3,8 @@ import { MsgWithdrawLease, MsgCreateLease, MsgCloseLease } from "./lease"; import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; -export const createCreateBid = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateBid = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateBid.typeUrl, encoders: toEncoders(MsgCreateBid), converters: toConverters(MsgCreateBid) @@ -12,8 +12,8 @@ export const createCreateBid = (getSigningClient: SigningClientResolver) => buil export const useCreateBid = buildUseMutation({ builderMutationFn: createCreateBid }); -export const createCloseBid = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCloseBid = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCloseBid.typeUrl, encoders: toEncoders(MsgCloseBid), converters: toConverters(MsgCloseBid) @@ -21,8 +21,8 @@ export const createCloseBid = (getSigningClient: SigningClientResolver) => build export const useCloseBid = buildUseMutation({ builderMutationFn: createCloseBid }); -export const createWithdrawLease = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createWithdrawLease = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgWithdrawLease.typeUrl, encoders: toEncoders(MsgWithdrawLease), converters: toConverters(MsgWithdrawLease) @@ -30,8 +30,8 @@ export const createWithdrawLease = (getSigningClient: SigningClientResolver) => export const useWithdrawLease = buildUseMutation({ builderMutationFn: createWithdrawLease }); -export const createCreateLease = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateLease = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateLease.typeUrl, encoders: toEncoders(MsgCreateLease), converters: toConverters(MsgCreateLease) @@ -39,8 +39,8 @@ export const createCreateLease = (getSigningClient: SigningClientResolver) => bu export const useCreateLease = buildUseMutation({ builderMutationFn: createCreateLease }); -export const createCloseLease = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCloseLease = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCloseLease.typeUrl, encoders: toEncoders(MsgCloseLease), converters: toConverters(MsgCloseLease) diff --git a/__fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.rpc.func.ts index 62c9ef6bb..c7c5d68ec 100644 --- a/__fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/provider/v1beta1/provider.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; -export const createCreateProvider = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateProvider = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateProvider.typeUrl, encoders: toEncoders(MsgCreateProvider), converters: toConverters(MsgCreateProvider) @@ -11,8 +11,8 @@ export const createCreateProvider = (getSigningClient: SigningClientResolver) => export const useCreateProvider = buildUseMutation({ builderMutationFn: createCreateProvider }); -export const createUpdateProvider = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateProvider = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateProvider.typeUrl, encoders: toEncoders(MsgUpdateProvider), converters: toConverters(MsgUpdateProvider) @@ -20,8 +20,8 @@ export const createUpdateProvider = (getSigningClient: SigningClientResolver) => export const useUpdateProvider = buildUseMutation({ builderMutationFn: createUpdateProvider }); -export const createDeleteProvider = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDeleteProvider = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDeleteProvider.typeUrl, encoders: toEncoders(MsgDeleteProvider), converters: toConverters(MsgDeleteProvider) diff --git a/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.rpc.func.ts index 62c9ef6bb..c7c5d68ec 100644 --- a/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/provider.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateProvider, MsgUpdateProvider, MsgDeleteProvider } from "./provider"; -export const createCreateProvider = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateProvider = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateProvider.typeUrl, encoders: toEncoders(MsgCreateProvider), converters: toConverters(MsgCreateProvider) @@ -11,8 +11,8 @@ export const createCreateProvider = (getSigningClient: SigningClientResolver) => export const useCreateProvider = buildUseMutation({ builderMutationFn: createCreateProvider }); -export const createUpdateProvider = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateProvider = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateProvider.typeUrl, encoders: toEncoders(MsgUpdateProvider), converters: toConverters(MsgUpdateProvider) @@ -20,8 +20,8 @@ export const createUpdateProvider = (getSigningClient: SigningClientResolver) => export const useUpdateProvider = buildUseMutation({ builderMutationFn: createUpdateProvider }); -export const createDeleteProvider = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDeleteProvider = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDeleteProvider.typeUrl, encoders: toEncoders(MsgDeleteProvider), converters: toConverters(MsgDeleteProvider) diff --git a/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/query.rpc.func.ts index 90199b2f1..e70baf6f1 100644 --- a/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/akash/provider/v1beta2/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryProvidersRequest, QueryProvidersResponse, QueryProviderRequest, QueryProviderResponse } from "./query"; -export const createGetProviders = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProviders = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProvidersRequest.encode, decode: QueryProvidersResponse.decode, service: "akash.provider.v1beta2.Query", method: "Providers", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProviders = buildUseQuery({ builderQueryFn: createGetProviders, queryKeyPrefix: "ProvidersQuery" }); -export const createGetProvider = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProvider = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProviderRequest.encode, decode: QueryProviderResponse.decode, service: "akash.provider.v1beta2.Query", method: "Provider", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProvider = buildUseQuery({ builderQueryFn: createGetProvider, diff --git a/__fixtures__/v-next/outputicjs/cosmos/app/v1alpha1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/app/v1alpha1/query.rpc.func.ts index ac6a688fc..9e27b6af9 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/app/v1alpha1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/app/v1alpha1/query.rpc.func.ts @@ -1,12 +1,12 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryConfigRequest, QueryConfigResponse } from "./query"; -export const createGetConfig = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConfig = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConfigRequest.encode, decode: QueryConfigResponse.decode, service: "cosmos.app.v1alpha1.Query", method: "Config", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConfig = buildUseQuery({ builderQueryFn: createGetConfig, diff --git a/__fixtures__/v-next/outputicjs/cosmos/auth/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/auth/v1beta1/query.rpc.func.ts index 9e23360f6..cf59e7559 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/auth/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/auth/v1beta1/query.rpc.func.ts @@ -1,78 +1,78 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse } from "./query"; -export const createGetAccounts = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccounts = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAccountsRequest.encode, decode: QueryAccountsResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "Accounts", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccounts = buildUseQuery({ builderQueryFn: createGetAccounts, queryKeyPrefix: "AccountsQuery" }); -export const createGetAccount = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccount = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAccountRequest.encode, decode: QueryAccountResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "Account", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccount = buildUseQuery({ builderQueryFn: createGetAccount, queryKeyPrefix: "AccountQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetModuleAccounts = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetModuleAccounts = (clientResolver: RpcResolver) => buildQuery({ encode: QueryModuleAccountsRequest.encode, decode: QueryModuleAccountsResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "ModuleAccounts", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetModuleAccounts = buildUseQuery({ builderQueryFn: createGetModuleAccounts, queryKeyPrefix: "ModuleAccountsQuery" }); -export const createGetBech32Prefix = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBech32Prefix = (clientResolver: RpcResolver) => buildQuery({ encode: Bech32PrefixRequest.encode, decode: Bech32PrefixResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "Bech32Prefix", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBech32Prefix = buildUseQuery({ builderQueryFn: createGetBech32Prefix, queryKeyPrefix: "Bech32PrefixQuery" }); -export const createGetAddressBytesToString = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAddressBytesToString = (clientResolver: RpcResolver) => buildQuery({ encode: AddressBytesToStringRequest.encode, decode: AddressBytesToStringResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "AddressBytesToString", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAddressBytesToString = buildUseQuery({ builderQueryFn: createGetAddressBytesToString, queryKeyPrefix: "AddressBytesToStringQuery" }); -export const createGetAddressStringToBytes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAddressStringToBytes = (clientResolver: RpcResolver) => buildQuery({ encode: AddressStringToBytesRequest.encode, decode: AddressStringToBytesResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "AddressStringToBytes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAddressStringToBytes = buildUseQuery({ builderQueryFn: createGetAddressStringToBytes, diff --git a/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/query.rpc.func.ts index 5f40c3d6b..404f08acd 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryGrantsRequest, QueryGrantsResponse, QueryGranterGrantsRequest, QueryGranterGrantsResponse, QueryGranteeGrantsRequest, QueryGranteeGrantsResponse } from "./query"; -export const createGetGrants = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGrants = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGrantsRequest.encode, decode: QueryGrantsResponse.decode, service: "cosmos.authz.v1beta1.Query", method: "Grants", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGrants = buildUseQuery({ builderQueryFn: createGetGrants, queryKeyPrefix: "GrantsQuery" }); -export const createGetGranterGrants = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGranterGrants = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGranterGrantsRequest.encode, decode: QueryGranterGrantsResponse.decode, service: "cosmos.authz.v1beta1.Query", method: "GranterGrants", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGranterGrants = buildUseQuery({ builderQueryFn: createGetGranterGrants, queryKeyPrefix: "GranterGrantsQuery" }); -export const createGetGranteeGrants = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGranteeGrants = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGranteeGrantsRequest.encode, decode: QueryGranteeGrantsResponse.decode, service: "cosmos.authz.v1beta1.Query", method: "GranteeGrants", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGranteeGrants = buildUseQuery({ builderQueryFn: createGetGranteeGrants, diff --git a/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.rpc.func.ts index 878d02262..29a22be27 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; -export const createGrant = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createGrant = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgGrant.typeUrl, encoders: toEncoders(MsgGrant), converters: toConverters(MsgGrant) @@ -11,8 +11,8 @@ export const createGrant = (getSigningClient: SigningClientResolver) => buildTx< export const useGrant = buildUseMutation({ builderMutationFn: createGrant }); -export const createExec = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExec = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExec.typeUrl, encoders: toEncoders(MsgExec), converters: toConverters(MsgExec) @@ -20,8 +20,8 @@ export const createExec = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createExec }); -export const createRevoke = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createRevoke = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgRevoke.typeUrl, encoders: toEncoders(MsgRevoke), converters: toConverters(MsgRevoke) diff --git a/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/query.rpc.func.ts index 5f2b9c6ae..4b2941fa4 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/query.rpc.func.ts @@ -1,100 +1,100 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse } from "./query"; -export const createGetBalance = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBalance = (clientResolver: RpcResolver) => buildQuery({ encode: QueryBalanceRequest.encode, decode: QueryBalanceResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "Balance", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBalance = buildUseQuery({ builderQueryFn: createGetBalance, queryKeyPrefix: "BalanceQuery" }); -export const createGetAllBalances = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllBalances = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllBalancesRequest.encode, decode: QueryAllBalancesResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "AllBalances", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllBalances = buildUseQuery({ builderQueryFn: createGetAllBalances, queryKeyPrefix: "AllBalancesQuery" }); -export const createGetSpendableBalances = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSpendableBalances = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySpendableBalancesRequest.encode, decode: QuerySpendableBalancesResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "SpendableBalances", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSpendableBalances = buildUseQuery({ builderQueryFn: createGetSpendableBalances, queryKeyPrefix: "SpendableBalancesQuery" }); -export const createGetTotalSupply = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalSupply = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalSupplyRequest.encode, decode: QueryTotalSupplyResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "TotalSupply", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalSupply = buildUseQuery({ builderQueryFn: createGetTotalSupply, queryKeyPrefix: "TotalSupplyQuery" }); -export const createGetSupplyOf = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSupplyOf = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySupplyOfRequest.encode, decode: QuerySupplyOfResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "SupplyOf", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSupplyOf = buildUseQuery({ builderQueryFn: createGetSupplyOf, queryKeyPrefix: "SupplyOfQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetDenomMetadata = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomMetadata = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomMetadataRequest.encode, decode: QueryDenomMetadataResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "DenomMetadata", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomMetadata = buildUseQuery({ builderQueryFn: createGetDenomMetadata, queryKeyPrefix: "DenomMetadataQuery" }); -export const createGetDenomsMetadata = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomsMetadata = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomsMetadataRequest.encode, decode: QueryDenomsMetadataResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "DenomsMetadata", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomsMetadata = buildUseQuery({ builderQueryFn: createGetDenomsMetadata, queryKeyPrefix: "DenomsMetadataQuery" }); -export const createGetDenomOwners = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomOwners = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomOwnersRequest.encode, decode: QueryDenomOwnersResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "DenomOwners", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomOwners = buildUseQuery({ builderQueryFn: createGetDenomOwners, diff --git a/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.rpc.func.ts index b3ba5e957..7fe816f7a 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSend, MsgMultiSend } from "./tx"; -export const createSend = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSend = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSend.typeUrl, encoders: toEncoders(MsgSend), converters: toConverters(MsgSend) @@ -11,8 +11,8 @@ export const createSend = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createSend }); -export const createMultiSend = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createMultiSend = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgMultiSend.typeUrl, encoders: toEncoders(MsgMultiSend), converters: toConverters(MsgMultiSend) diff --git a/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts index 9e4418276..d59c0f6eb 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v1beta1/reflection.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { ListAllInterfacesRequest, ListAllInterfacesResponse, ListImplementationsRequest, ListImplementationsResponse } from "./reflection"; -export const createGetListAllInterfaces = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetListAllInterfaces = (clientResolver: RpcResolver) => buildQuery({ encode: ListAllInterfacesRequest.encode, decode: ListAllInterfacesResponse.decode, service: "cosmos.base.reflection.v1beta1.ReflectionService", method: "ListAllInterfaces", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetListAllInterfaces = buildUseQuery({ builderQueryFn: createGetListAllInterfaces, queryKeyPrefix: "ListAllInterfacesQuery" }); -export const createGetListImplementations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetListImplementations = (clientResolver: RpcResolver) => buildQuery({ encode: ListImplementationsRequest.encode, decode: ListImplementationsResponse.decode, service: "cosmos.base.reflection.v1beta1.ReflectionService", method: "ListImplementations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetListImplementations = buildUseQuery({ builderQueryFn: createGetListImplementations, diff --git a/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts index a767a3119..d1b78f3b1 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/base/reflection/v2alpha1/reflection.rpc.func.ts @@ -1,67 +1,67 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { GetAuthnDescriptorRequest, GetAuthnDescriptorResponse, GetChainDescriptorRequest, GetChainDescriptorResponse, GetCodecDescriptorRequest, GetCodecDescriptorResponse, GetConfigurationDescriptorRequest, GetConfigurationDescriptorResponse, GetQueryServicesDescriptorRequest, GetQueryServicesDescriptorResponse, GetTxDescriptorRequest, GetTxDescriptorResponse } from "./reflection"; -export const createGetGetAuthnDescriptor = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetAuthnDescriptor = (clientResolver: RpcResolver) => buildQuery({ encode: GetAuthnDescriptorRequest.encode, decode: GetAuthnDescriptorResponse.decode, service: "cosmos.base.reflection.v2alpha1.ReflectionService", method: "GetAuthnDescriptor", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetAuthnDescriptor = buildUseQuery({ builderQueryFn: createGetGetAuthnDescriptor, queryKeyPrefix: "GetAuthnDescriptorQuery" }); -export const createGetGetChainDescriptor = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetChainDescriptor = (clientResolver: RpcResolver) => buildQuery({ encode: GetChainDescriptorRequest.encode, decode: GetChainDescriptorResponse.decode, service: "cosmos.base.reflection.v2alpha1.ReflectionService", method: "GetChainDescriptor", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetChainDescriptor = buildUseQuery({ builderQueryFn: createGetGetChainDescriptor, queryKeyPrefix: "GetChainDescriptorQuery" }); -export const createGetGetCodecDescriptor = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetCodecDescriptor = (clientResolver: RpcResolver) => buildQuery({ encode: GetCodecDescriptorRequest.encode, decode: GetCodecDescriptorResponse.decode, service: "cosmos.base.reflection.v2alpha1.ReflectionService", method: "GetCodecDescriptor", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetCodecDescriptor = buildUseQuery({ builderQueryFn: createGetGetCodecDescriptor, queryKeyPrefix: "GetCodecDescriptorQuery" }); -export const createGetGetConfigurationDescriptor = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetConfigurationDescriptor = (clientResolver: RpcResolver) => buildQuery({ encode: GetConfigurationDescriptorRequest.encode, decode: GetConfigurationDescriptorResponse.decode, service: "cosmos.base.reflection.v2alpha1.ReflectionService", method: "GetConfigurationDescriptor", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetConfigurationDescriptor = buildUseQuery({ builderQueryFn: createGetGetConfigurationDescriptor, queryKeyPrefix: "GetConfigurationDescriptorQuery" }); -export const createGetGetQueryServicesDescriptor = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetQueryServicesDescriptor = (clientResolver: RpcResolver) => buildQuery({ encode: GetQueryServicesDescriptorRequest.encode, decode: GetQueryServicesDescriptorResponse.decode, service: "cosmos.base.reflection.v2alpha1.ReflectionService", method: "GetQueryServicesDescriptor", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetQueryServicesDescriptor = buildUseQuery({ builderQueryFn: createGetGetQueryServicesDescriptor, queryKeyPrefix: "GetQueryServicesDescriptorQuery" }); -export const createGetGetTxDescriptor = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetTxDescriptor = (clientResolver: RpcResolver) => buildQuery({ encode: GetTxDescriptorRequest.encode, decode: GetTxDescriptorResponse.decode, service: "cosmos.base.reflection.v2alpha1.ReflectionService", method: "GetTxDescriptor", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetTxDescriptor = buildUseQuery({ builderQueryFn: createGetGetTxDescriptor, diff --git a/__fixtures__/v-next/outputicjs/cosmos/base/tendermint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/base/tendermint/v1beta1/query.rpc.func.ts index 6494808ba..222254776 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/base/tendermint/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/base/tendermint/v1beta1/query.rpc.func.ts @@ -1,67 +1,67 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { GetNodeInfoRequest, GetNodeInfoResponse, GetSyncingRequest, GetSyncingResponse, GetLatestBlockRequest, GetLatestBlockResponse, GetBlockByHeightRequest, GetBlockByHeightResponse, GetLatestValidatorSetRequest, GetLatestValidatorSetResponse, GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponse } from "./query"; -export const createGetGetNodeInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetNodeInfo = (clientResolver: RpcResolver) => buildQuery({ encode: GetNodeInfoRequest.encode, decode: GetNodeInfoResponse.decode, service: "cosmos.base.tendermint.v1beta1.Service", method: "GetNodeInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetNodeInfo = buildUseQuery({ builderQueryFn: createGetGetNodeInfo, queryKeyPrefix: "GetNodeInfoQuery" }); -export const createGetGetSyncing = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetSyncing = (clientResolver: RpcResolver) => buildQuery({ encode: GetSyncingRequest.encode, decode: GetSyncingResponse.decode, service: "cosmos.base.tendermint.v1beta1.Service", method: "GetSyncing", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetSyncing = buildUseQuery({ builderQueryFn: createGetGetSyncing, queryKeyPrefix: "GetSyncingQuery" }); -export const createGetGetLatestBlock = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetLatestBlock = (clientResolver: RpcResolver) => buildQuery({ encode: GetLatestBlockRequest.encode, decode: GetLatestBlockResponse.decode, service: "cosmos.base.tendermint.v1beta1.Service", method: "GetLatestBlock", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetLatestBlock = buildUseQuery({ builderQueryFn: createGetGetLatestBlock, queryKeyPrefix: "GetLatestBlockQuery" }); -export const createGetGetBlockByHeight = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetBlockByHeight = (clientResolver: RpcResolver) => buildQuery({ encode: GetBlockByHeightRequest.encode, decode: GetBlockByHeightResponse.decode, service: "cosmos.base.tendermint.v1beta1.Service", method: "GetBlockByHeight", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetBlockByHeight = buildUseQuery({ builderQueryFn: createGetGetBlockByHeight, queryKeyPrefix: "GetBlockByHeightQuery" }); -export const createGetGetLatestValidatorSet = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetLatestValidatorSet = (clientResolver: RpcResolver) => buildQuery({ encode: GetLatestValidatorSetRequest.encode, decode: GetLatestValidatorSetResponse.decode, service: "cosmos.base.tendermint.v1beta1.Service", method: "GetLatestValidatorSet", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetLatestValidatorSet = buildUseQuery({ builderQueryFn: createGetGetLatestValidatorSet, queryKeyPrefix: "GetLatestValidatorSetQuery" }); -export const createGetGetValidatorSetByHeight = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetValidatorSetByHeight = (clientResolver: RpcResolver) => buildQuery({ encode: GetValidatorSetByHeightRequest.encode, decode: GetValidatorSetByHeightResponse.decode, service: "cosmos.base.tendermint.v1beta1.Service", method: "GetValidatorSetByHeight", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetValidatorSetByHeight = buildUseQuery({ builderQueryFn: createGetGetValidatorSetByHeight, diff --git a/__fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.rpc.func.ts index c02e19db9..1e35e5012 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/crisis/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgVerifyInvariant } from "./tx"; -export const createVerifyInvariant = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createVerifyInvariant = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVerifyInvariant.typeUrl, encoders: toEncoders(MsgVerifyInvariant), converters: toConverters(MsgVerifyInvariant) diff --git a/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/query.rpc.func.ts index 52eeee24b..27f0cb8e9 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/query.rpc.func.ts @@ -1,100 +1,100 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse, QueryValidatorCommissionRequest, QueryValidatorCommissionResponse, QueryValidatorSlashesRequest, QueryValidatorSlashesResponse, QueryDelegationRewardsRequest, QueryDelegationRewardsResponse, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse, QueryCommunityPoolRequest, QueryCommunityPoolResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetValidatorOutstandingRewards = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetValidatorOutstandingRewards = (clientResolver: RpcResolver) => buildQuery({ encode: QueryValidatorOutstandingRewardsRequest.encode, decode: QueryValidatorOutstandingRewardsResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "ValidatorOutstandingRewards", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetValidatorOutstandingRewards = buildUseQuery({ builderQueryFn: createGetValidatorOutstandingRewards, queryKeyPrefix: "ValidatorOutstandingRewardsQuery" }); -export const createGetValidatorCommission = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetValidatorCommission = (clientResolver: RpcResolver) => buildQuery({ encode: QueryValidatorCommissionRequest.encode, decode: QueryValidatorCommissionResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "ValidatorCommission", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetValidatorCommission = buildUseQuery({ builderQueryFn: createGetValidatorCommission, queryKeyPrefix: "ValidatorCommissionQuery" }); -export const createGetValidatorSlashes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetValidatorSlashes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryValidatorSlashesRequest.encode, decode: QueryValidatorSlashesResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "ValidatorSlashes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetValidatorSlashes = buildUseQuery({ builderQueryFn: createGetValidatorSlashes, queryKeyPrefix: "ValidatorSlashesQuery" }); -export const createGetDelegationRewards = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegationRewards = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegationRewardsRequest.encode, decode: QueryDelegationRewardsResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "DelegationRewards", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegationRewards = buildUseQuery({ builderQueryFn: createGetDelegationRewards, queryKeyPrefix: "DelegationRewardsQuery" }); -export const createGetDelegationTotalRewards = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegationTotalRewards = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegationTotalRewardsRequest.encode, decode: QueryDelegationTotalRewardsResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "DelegationTotalRewards", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegationTotalRewards = buildUseQuery({ builderQueryFn: createGetDelegationTotalRewards, queryKeyPrefix: "DelegationTotalRewardsQuery" }); -export const createGetDelegatorValidators = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegatorValidators = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegatorValidatorsRequest.encode, decode: QueryDelegatorValidatorsResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "DelegatorValidators", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegatorValidators = buildUseQuery({ builderQueryFn: createGetDelegatorValidators, queryKeyPrefix: "DelegatorValidatorsQuery" }); -export const createGetDelegatorWithdrawAddress = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegatorWithdrawAddress = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegatorWithdrawAddressRequest.encode, decode: QueryDelegatorWithdrawAddressResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "DelegatorWithdrawAddress", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegatorWithdrawAddress = buildUseQuery({ builderQueryFn: createGetDelegatorWithdrawAddress, queryKeyPrefix: "DelegatorWithdrawAddressQuery" }); -export const createGetCommunityPool = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCommunityPool = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCommunityPoolRequest.encode, decode: QueryCommunityPoolResponse.decode, service: "cosmos.distribution.v1beta1.Query", method: "CommunityPool", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCommunityPool = buildUseQuery({ builderQueryFn: createGetCommunityPool, diff --git a/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.rpc.func.ts index 884c3faf6..9fa0c3a25 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool } from "./tx"; -export const createSetWithdrawAddress = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSetWithdrawAddress = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSetWithdrawAddress.typeUrl, encoders: toEncoders(MsgSetWithdrawAddress), converters: toConverters(MsgSetWithdrawAddress) @@ -11,8 +11,8 @@ export const createSetWithdrawAddress = (getSigningClient: SigningClientResolver export const useSetWithdrawAddress = buildUseMutation({ builderMutationFn: createSetWithdrawAddress }); -export const createWithdrawDelegatorReward = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createWithdrawDelegatorReward = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgWithdrawDelegatorReward.typeUrl, encoders: toEncoders(MsgWithdrawDelegatorReward), converters: toConverters(MsgWithdrawDelegatorReward) @@ -20,8 +20,8 @@ export const createWithdrawDelegatorReward = (getSigningClient: SigningClientRes export const useWithdrawDelegatorReward = buildUseMutation({ builderMutationFn: createWithdrawDelegatorReward }); -export const createWithdrawValidatorCommission = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createWithdrawValidatorCommission = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgWithdrawValidatorCommission.typeUrl, encoders: toEncoders(MsgWithdrawValidatorCommission), converters: toConverters(MsgWithdrawValidatorCommission) @@ -29,8 +29,8 @@ export const createWithdrawValidatorCommission = (getSigningClient: SigningClien export const useWithdrawValidatorCommission = buildUseMutation({ builderMutationFn: createWithdrawValidatorCommission }); -export const createFundCommunityPool = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createFundCommunityPool = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgFundCommunityPool.typeUrl, encoders: toEncoders(MsgFundCommunityPool), converters: toConverters(MsgFundCommunityPool) diff --git a/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/query.rpc.func.ts index 94dd0c7dc..ac686d264 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryEvidenceRequest, QueryEvidenceResponse, QueryAllEvidenceRequest, QueryAllEvidenceResponse } from "./query"; -export const createGetEvidence = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEvidence = (clientResolver: RpcResolver) => buildQuery({ encode: QueryEvidenceRequest.encode, decode: QueryEvidenceResponse.decode, service: "cosmos.evidence.v1beta1.Query", method: "Evidence", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEvidence = buildUseQuery({ builderQueryFn: createGetEvidence, queryKeyPrefix: "EvidenceQuery" }); -export const createGetAllEvidence = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllEvidence = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllEvidenceRequest.encode, decode: QueryAllEvidenceResponse.decode, service: "cosmos.evidence.v1beta1.Query", method: "AllEvidence", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllEvidence = buildUseQuery({ builderQueryFn: createGetAllEvidence, diff --git a/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.rpc.func.ts index 2d622b6e9..f38641481 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/evidence/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSubmitEvidence } from "./tx"; -export const createSubmitEvidence = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSubmitEvidence = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSubmitEvidence.typeUrl, encoders: toEncoders(MsgSubmitEvidence), converters: toConverters(MsgSubmitEvidence) diff --git a/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/query.rpc.func.ts index a4bb5dfa1..9381851e1 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryAllowanceRequest, QueryAllowanceResponse, QueryAllowancesRequest, QueryAllowancesResponse, QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponse } from "./query"; -export const createGetAllowance = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllowance = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllowanceRequest.encode, decode: QueryAllowanceResponse.decode, service: "cosmos.feegrant.v1beta1.Query", method: "Allowance", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllowance = buildUseQuery({ builderQueryFn: createGetAllowance, queryKeyPrefix: "AllowanceQuery" }); -export const createGetAllowances = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllowances = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllowancesRequest.encode, decode: QueryAllowancesResponse.decode, service: "cosmos.feegrant.v1beta1.Query", method: "Allowances", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllowances = buildUseQuery({ builderQueryFn: createGetAllowances, queryKeyPrefix: "AllowancesQuery" }); -export const createGetAllowancesByGranter = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllowancesByGranter = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllowancesByGranterRequest.encode, decode: QueryAllowancesByGranterResponse.decode, service: "cosmos.feegrant.v1beta1.Query", method: "AllowancesByGranter", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllowancesByGranter = buildUseQuery({ builderQueryFn: createGetAllowancesByGranter, diff --git a/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.rpc.func.ts index c384d58e7..b7a35d430 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; -export const createGrantAllowance = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createGrantAllowance = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgGrantAllowance.typeUrl, encoders: toEncoders(MsgGrantAllowance), converters: toConverters(MsgGrantAllowance) @@ -11,8 +11,8 @@ export const createGrantAllowance = (getSigningClient: SigningClientResolver) => export const useGrantAllowance = buildUseMutation({ builderMutationFn: createGrantAllowance }); -export const createRevokeAllowance = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createRevokeAllowance = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgRevokeAllowance.typeUrl, encoders: toEncoders(MsgRevokeAllowance), converters: toConverters(MsgRevokeAllowance) diff --git a/__fixtures__/v-next/outputicjs/cosmos/gov/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/gov/v1/query.rpc.func.ts index e53c5f768..8705e2971 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/gov/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/gov/v1/query.rpc.func.ts @@ -1,89 +1,89 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; -export const createGetProposal = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposal = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalRequest.encode, decode: QueryProposalResponse.decode, service: "cosmos.gov.v1.Query", method: "Proposal", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposal = buildUseQuery({ builderQueryFn: createGetProposal, queryKeyPrefix: "ProposalQuery" }); -export const createGetProposals = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposals = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalsRequest.encode, decode: QueryProposalsResponse.decode, service: "cosmos.gov.v1.Query", method: "Proposals", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposals = buildUseQuery({ builderQueryFn: createGetProposals, queryKeyPrefix: "ProposalsQuery" }); -export const createGetVote = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetVote = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVoteRequest.encode, decode: QueryVoteResponse.decode, service: "cosmos.gov.v1.Query", method: "Vote", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetVote = buildUseQuery({ builderQueryFn: createGetVote, queryKeyPrefix: "VoteQuery" }); -export const createGetVotes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetVotes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVotesRequest.encode, decode: QueryVotesResponse.decode, service: "cosmos.gov.v1.Query", method: "Votes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetVotes = buildUseQuery({ builderQueryFn: createGetVotes, queryKeyPrefix: "VotesQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.gov.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetDeposit = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeposit = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDepositRequest.encode, decode: QueryDepositResponse.decode, service: "cosmos.gov.v1.Query", method: "Deposit", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeposit = buildUseQuery({ builderQueryFn: createGetDeposit, queryKeyPrefix: "DepositQuery" }); -export const createGetDeposits = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeposits = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDepositsRequest.encode, decode: QueryDepositsResponse.decode, service: "cosmos.gov.v1.Query", method: "Deposits", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeposits = buildUseQuery({ builderQueryFn: createGetDeposits, queryKeyPrefix: "DepositsQuery" }); -export const createGetTallyResult = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTallyResult = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTallyResultRequest.encode, decode: QueryTallyResultResponse.decode, service: "cosmos.gov.v1.Query", method: "TallyResult", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTallyResult = buildUseQuery({ builderQueryFn: createGetTallyResult, diff --git a/__fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.rpc.func.ts index 2f5b5a68c..5dc327c32 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/gov/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; -export const createSubmitProposal = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSubmitProposal = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSubmitProposal.typeUrl, encoders: toEncoders(MsgSubmitProposal), converters: toConverters(MsgSubmitProposal) @@ -11,8 +11,8 @@ export const createSubmitProposal = (getSigningClient: SigningClientResolver) => export const useSubmitProposal = buildUseMutation({ builderMutationFn: createSubmitProposal }); -export const createExecLegacyContent = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExecLegacyContent = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExecLegacyContent.typeUrl, encoders: toEncoders(MsgExecLegacyContent), converters: toConverters(MsgExecLegacyContent) @@ -20,8 +20,8 @@ export const createExecLegacyContent = (getSigningClient: SigningClientResolver) export const useExecLegacyContent = buildUseMutation({ builderMutationFn: createExecLegacyContent }); -export const createVote = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createVote = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVote.typeUrl, encoders: toEncoders(MsgVote), converters: toConverters(MsgVote) @@ -29,8 +29,8 @@ export const createVote = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createVote }); -export const createVoteWeighted = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createVoteWeighted = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVoteWeighted.typeUrl, encoders: toEncoders(MsgVoteWeighted), converters: toConverters(MsgVoteWeighted) @@ -38,8 +38,8 @@ export const createVoteWeighted = (getSigningClient: SigningClientResolver) => b export const useVoteWeighted = buildUseMutation({ builderMutationFn: createVoteWeighted }); -export const createDeposit = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDeposit = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDeposit.typeUrl, encoders: toEncoders(MsgDeposit), converters: toConverters(MsgDeposit) diff --git a/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/query.rpc.func.ts index 5eaf75468..3230a3a63 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/query.rpc.func.ts @@ -1,89 +1,89 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; -export const createGetProposal = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposal = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalRequest.encode, decode: QueryProposalResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Proposal", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposal = buildUseQuery({ builderQueryFn: createGetProposal, queryKeyPrefix: "ProposalQuery" }); -export const createGetProposals = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposals = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalsRequest.encode, decode: QueryProposalsResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Proposals", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposals = buildUseQuery({ builderQueryFn: createGetProposals, queryKeyPrefix: "ProposalsQuery" }); -export const createGetVote = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetVote = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVoteRequest.encode, decode: QueryVoteResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Vote", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetVote = buildUseQuery({ builderQueryFn: createGetVote, queryKeyPrefix: "VoteQuery" }); -export const createGetVotes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetVotes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVotesRequest.encode, decode: QueryVotesResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Votes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetVotes = buildUseQuery({ builderQueryFn: createGetVotes, queryKeyPrefix: "VotesQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetDeposit = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeposit = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDepositRequest.encode, decode: QueryDepositResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Deposit", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeposit = buildUseQuery({ builderQueryFn: createGetDeposit, queryKeyPrefix: "DepositQuery" }); -export const createGetDeposits = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeposits = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDepositsRequest.encode, decode: QueryDepositsResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "Deposits", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeposits = buildUseQuery({ builderQueryFn: createGetDeposits, queryKeyPrefix: "DepositsQuery" }); -export const createGetTallyResult = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTallyResult = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTallyResultRequest.encode, decode: QueryTallyResultResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "TallyResult", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTallyResult = buildUseQuery({ builderQueryFn: createGetTallyResult, diff --git a/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.rpc.func.ts index f5034e448..f4a80fbd9 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; -export const createSubmitProposal = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSubmitProposal = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSubmitProposal.typeUrl, encoders: toEncoders(MsgSubmitProposal), converters: toConverters(MsgSubmitProposal) @@ -11,8 +11,8 @@ export const createSubmitProposal = (getSigningClient: SigningClientResolver) => export const useSubmitProposal = buildUseMutation({ builderMutationFn: createSubmitProposal }); -export const createVote = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createVote = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVote.typeUrl, encoders: toEncoders(MsgVote), converters: toConverters(MsgVote) @@ -20,8 +20,8 @@ export const createVote = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createVote }); -export const createVoteWeighted = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createVoteWeighted = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVoteWeighted.typeUrl, encoders: toEncoders(MsgVoteWeighted), converters: toConverters(MsgVoteWeighted) @@ -29,8 +29,8 @@ export const createVoteWeighted = (getSigningClient: SigningClientResolver) => b export const useVoteWeighted = buildUseMutation({ builderMutationFn: createVoteWeighted }); -export const createDeposit = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDeposit = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDeposit.typeUrl, encoders: toEncoders(MsgDeposit), converters: toConverters(MsgDeposit) diff --git a/__fixtures__/v-next/outputicjs/cosmos/group/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/group/v1/query.rpc.func.ts index 95b1c3efc..68ef38c03 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/group/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/group/v1/query.rpc.func.ts @@ -1,144 +1,144 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryGroupInfoRequest, QueryGroupInfoResponse, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponse, QueryGroupMembersRequest, QueryGroupMembersResponse, QueryGroupsByAdminRequest, QueryGroupsByAdminResponse, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponse, QueryProposalRequest, QueryProposalResponse, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponse, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponse, QueryVotesByProposalRequest, QueryVotesByProposalResponse, QueryVotesByVoterRequest, QueryVotesByVoterResponse, QueryGroupsByMemberRequest, QueryGroupsByMemberResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; -export const createGetGroupInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroupInfo = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupInfoRequest.encode, decode: QueryGroupInfoResponse.decode, service: "cosmos.group.v1.Query", method: "GroupInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroupInfo = buildUseQuery({ builderQueryFn: createGetGroupInfo, queryKeyPrefix: "GroupInfoQuery" }); -export const createGetGroupPolicyInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroupPolicyInfo = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupPolicyInfoRequest.encode, decode: QueryGroupPolicyInfoResponse.decode, service: "cosmos.group.v1.Query", method: "GroupPolicyInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroupPolicyInfo = buildUseQuery({ builderQueryFn: createGetGroupPolicyInfo, queryKeyPrefix: "GroupPolicyInfoQuery" }); -export const createGetGroupMembers = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroupMembers = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupMembersRequest.encode, decode: QueryGroupMembersResponse.decode, service: "cosmos.group.v1.Query", method: "GroupMembers", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroupMembers = buildUseQuery({ builderQueryFn: createGetGroupMembers, queryKeyPrefix: "GroupMembersQuery" }); -export const createGetGroupsByAdmin = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroupsByAdmin = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupsByAdminRequest.encode, decode: QueryGroupsByAdminResponse.decode, service: "cosmos.group.v1.Query", method: "GroupsByAdmin", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroupsByAdmin = buildUseQuery({ builderQueryFn: createGetGroupsByAdmin, queryKeyPrefix: "GroupsByAdminQuery" }); -export const createGetGroupPoliciesByGroup = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroupPoliciesByGroup = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupPoliciesByGroupRequest.encode, decode: QueryGroupPoliciesByGroupResponse.decode, service: "cosmos.group.v1.Query", method: "GroupPoliciesByGroup", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroupPoliciesByGroup = buildUseQuery({ builderQueryFn: createGetGroupPoliciesByGroup, queryKeyPrefix: "GroupPoliciesByGroupQuery" }); -export const createGetGroupPoliciesByAdmin = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroupPoliciesByAdmin = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupPoliciesByAdminRequest.encode, decode: QueryGroupPoliciesByAdminResponse.decode, service: "cosmos.group.v1.Query", method: "GroupPoliciesByAdmin", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroupPoliciesByAdmin = buildUseQuery({ builderQueryFn: createGetGroupPoliciesByAdmin, queryKeyPrefix: "GroupPoliciesByAdminQuery" }); -export const createGetProposal = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposal = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalRequest.encode, decode: QueryProposalResponse.decode, service: "cosmos.group.v1.Query", method: "Proposal", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposal = buildUseQuery({ builderQueryFn: createGetProposal, queryKeyPrefix: "ProposalQuery" }); -export const createGetProposalsByGroupPolicy = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetProposalsByGroupPolicy = (clientResolver: RpcResolver) => buildQuery({ encode: QueryProposalsByGroupPolicyRequest.encode, decode: QueryProposalsByGroupPolicyResponse.decode, service: "cosmos.group.v1.Query", method: "ProposalsByGroupPolicy", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetProposalsByGroupPolicy = buildUseQuery({ builderQueryFn: createGetProposalsByGroupPolicy, queryKeyPrefix: "ProposalsByGroupPolicyQuery" }); -export const createGetVoteByProposalVoter = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetVoteByProposalVoter = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVoteByProposalVoterRequest.encode, decode: QueryVoteByProposalVoterResponse.decode, service: "cosmos.group.v1.Query", method: "VoteByProposalVoter", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetVoteByProposalVoter = buildUseQuery({ builderQueryFn: createGetVoteByProposalVoter, queryKeyPrefix: "VoteByProposalVoterQuery" }); -export const createGetVotesByProposal = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetVotesByProposal = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVotesByProposalRequest.encode, decode: QueryVotesByProposalResponse.decode, service: "cosmos.group.v1.Query", method: "VotesByProposal", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetVotesByProposal = buildUseQuery({ builderQueryFn: createGetVotesByProposal, queryKeyPrefix: "VotesByProposalQuery" }); -export const createGetVotesByVoter = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetVotesByVoter = (clientResolver: RpcResolver) => buildQuery({ encode: QueryVotesByVoterRequest.encode, decode: QueryVotesByVoterResponse.decode, service: "cosmos.group.v1.Query", method: "VotesByVoter", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetVotesByVoter = buildUseQuery({ builderQueryFn: createGetVotesByVoter, queryKeyPrefix: "VotesByVoterQuery" }); -export const createGetGroupsByMember = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGroupsByMember = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGroupsByMemberRequest.encode, decode: QueryGroupsByMemberResponse.decode, service: "cosmos.group.v1.Query", method: "GroupsByMember", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGroupsByMember = buildUseQuery({ builderQueryFn: createGetGroupsByMember, queryKeyPrefix: "GroupsByMemberQuery" }); -export const createGetTallyResult = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTallyResult = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTallyResultRequest.encode, decode: QueryTallyResultResponse.decode, service: "cosmos.group.v1.Query", method: "TallyResult", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTallyResult = buildUseQuery({ builderQueryFn: createGetTallyResult, diff --git a/__fixtures__/v-next/outputicjs/cosmos/group/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/group/v1/tx.rpc.func.ts index 82fab8b30..59f3e30e4 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/group/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/group/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; -export const createCreateGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateGroup.typeUrl, encoders: toEncoders(MsgCreateGroup), converters: toConverters(MsgCreateGroup) @@ -11,8 +11,8 @@ export const createCreateGroup = (getSigningClient: SigningClientResolver) => bu export const useCreateGroup = buildUseMutation({ builderMutationFn: createCreateGroup }); -export const createUpdateGroupMembers = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateGroupMembers = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateGroupMembers.typeUrl, encoders: toEncoders(MsgUpdateGroupMembers), converters: toConverters(MsgUpdateGroupMembers) @@ -20,8 +20,8 @@ export const createUpdateGroupMembers = (getSigningClient: SigningClientResolver export const useUpdateGroupMembers = buildUseMutation({ builderMutationFn: createUpdateGroupMembers }); -export const createUpdateGroupAdmin = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateGroupAdmin = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateGroupAdmin.typeUrl, encoders: toEncoders(MsgUpdateGroupAdmin), converters: toConverters(MsgUpdateGroupAdmin) @@ -29,8 +29,8 @@ export const createUpdateGroupAdmin = (getSigningClient: SigningClientResolver) export const useUpdateGroupAdmin = buildUseMutation({ builderMutationFn: createUpdateGroupAdmin }); -export const createUpdateGroupMetadata = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateGroupMetadata = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateGroupMetadata.typeUrl, encoders: toEncoders(MsgUpdateGroupMetadata), converters: toConverters(MsgUpdateGroupMetadata) @@ -38,8 +38,8 @@ export const createUpdateGroupMetadata = (getSigningClient: SigningClientResolve export const useUpdateGroupMetadata = buildUseMutation({ builderMutationFn: createUpdateGroupMetadata }); -export const createCreateGroupPolicy = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateGroupPolicy = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateGroupPolicy.typeUrl, encoders: toEncoders(MsgCreateGroupPolicy), converters: toConverters(MsgCreateGroupPolicy) @@ -47,8 +47,8 @@ export const createCreateGroupPolicy = (getSigningClient: SigningClientResolver) export const useCreateGroupPolicy = buildUseMutation({ builderMutationFn: createCreateGroupPolicy }); -export const createCreateGroupWithPolicy = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateGroupWithPolicy = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateGroupWithPolicy.typeUrl, encoders: toEncoders(MsgCreateGroupWithPolicy), converters: toConverters(MsgCreateGroupWithPolicy) @@ -56,8 +56,8 @@ export const createCreateGroupWithPolicy = (getSigningClient: SigningClientResol export const useCreateGroupWithPolicy = buildUseMutation({ builderMutationFn: createCreateGroupWithPolicy }); -export const createUpdateGroupPolicyAdmin = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateGroupPolicyAdmin = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateGroupPolicyAdmin.typeUrl, encoders: toEncoders(MsgUpdateGroupPolicyAdmin), converters: toConverters(MsgUpdateGroupPolicyAdmin) @@ -65,8 +65,8 @@ export const createUpdateGroupPolicyAdmin = (getSigningClient: SigningClientReso export const useUpdateGroupPolicyAdmin = buildUseMutation({ builderMutationFn: createUpdateGroupPolicyAdmin }); -export const createUpdateGroupPolicyDecisionPolicy = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateGroupPolicyDecisionPolicy = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateGroupPolicyDecisionPolicy.typeUrl, encoders: toEncoders(MsgUpdateGroupPolicyDecisionPolicy), converters: toConverters(MsgUpdateGroupPolicyDecisionPolicy) @@ -74,8 +74,8 @@ export const createUpdateGroupPolicyDecisionPolicy = (getSigningClient: SigningC export const useUpdateGroupPolicyDecisionPolicy = buildUseMutation({ builderMutationFn: createUpdateGroupPolicyDecisionPolicy }); -export const createUpdateGroupPolicyMetadata = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateGroupPolicyMetadata = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateGroupPolicyMetadata.typeUrl, encoders: toEncoders(MsgUpdateGroupPolicyMetadata), converters: toConverters(MsgUpdateGroupPolicyMetadata) @@ -83,8 +83,8 @@ export const createUpdateGroupPolicyMetadata = (getSigningClient: SigningClientR export const useUpdateGroupPolicyMetadata = buildUseMutation({ builderMutationFn: createUpdateGroupPolicyMetadata }); -export const createSubmitProposal = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSubmitProposal = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSubmitProposal.typeUrl, encoders: toEncoders(MsgSubmitProposal), converters: toConverters(MsgSubmitProposal) @@ -92,8 +92,8 @@ export const createSubmitProposal = (getSigningClient: SigningClientResolver) => export const useSubmitProposal = buildUseMutation({ builderMutationFn: createSubmitProposal }); -export const createWithdrawProposal = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createWithdrawProposal = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgWithdrawProposal.typeUrl, encoders: toEncoders(MsgWithdrawProposal), converters: toConverters(MsgWithdrawProposal) @@ -101,8 +101,8 @@ export const createWithdrawProposal = (getSigningClient: SigningClientResolver) export const useWithdrawProposal = buildUseMutation({ builderMutationFn: createWithdrawProposal }); -export const createVote = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createVote = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgVote.typeUrl, encoders: toEncoders(MsgVote), converters: toConverters(MsgVote) @@ -110,8 +110,8 @@ export const createVote = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createVote }); -export const createExec = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExec = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExec.typeUrl, encoders: toEncoders(MsgExec), converters: toConverters(MsgExec) @@ -119,8 +119,8 @@ export const createExec = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createExec }); -export const createLeaveGroup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createLeaveGroup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgLeaveGroup.typeUrl, encoders: toEncoders(MsgLeaveGroup), converters: toConverters(MsgLeaveGroup) diff --git a/__fixtures__/v-next/outputicjs/cosmos/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/mint/v1beta1/query.rpc.func.ts index 90b30fdc1..9e40c8450 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/mint/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/mint/v1beta1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse, QueryInflationRequest, QueryInflationResponse, QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.mint.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetInflation = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetInflation = (clientResolver: RpcResolver) => buildQuery({ encode: QueryInflationRequest.encode, decode: QueryInflationResponse.decode, service: "cosmos.mint.v1beta1.Query", method: "Inflation", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetInflation = buildUseQuery({ builderQueryFn: createGetInflation, queryKeyPrefix: "InflationQuery" }); -export const createGetAnnualProvisions = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAnnualProvisions = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAnnualProvisionsRequest.encode, decode: QueryAnnualProvisionsResponse.decode, service: "cosmos.mint.v1beta1.Query", method: "AnnualProvisions", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAnnualProvisions = buildUseQuery({ builderQueryFn: createGetAnnualProvisions, diff --git a/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/query.rpc.func.ts index 06f85a2e8..d4cb6b436 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/query.rpc.func.ts @@ -1,78 +1,78 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryBalanceRequest, QueryBalanceResponse, QueryOwnerRequest, QueryOwnerResponse, QuerySupplyRequest, QuerySupplyResponse, QueryNFTsRequest, QueryNFTsResponse, QueryNFTRequest, QueryNFTResponse, QueryClassRequest, QueryClassResponse, QueryClassesRequest, QueryClassesResponse } from "./query"; -export const createGetBalance = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBalance = (clientResolver: RpcResolver) => buildQuery({ encode: QueryBalanceRequest.encode, decode: QueryBalanceResponse.decode, service: "cosmos.nft.v1beta1.Query", method: "Balance", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBalance = buildUseQuery({ builderQueryFn: createGetBalance, queryKeyPrefix: "BalanceQuery" }); -export const createGetOwner = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetOwner = (clientResolver: RpcResolver) => buildQuery({ encode: QueryOwnerRequest.encode, decode: QueryOwnerResponse.decode, service: "cosmos.nft.v1beta1.Query", method: "Owner", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetOwner = buildUseQuery({ builderQueryFn: createGetOwner, queryKeyPrefix: "OwnerQuery" }); -export const createGetSupply = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSupply = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySupplyRequest.encode, decode: QuerySupplyResponse.decode, service: "cosmos.nft.v1beta1.Query", method: "Supply", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSupply = buildUseQuery({ builderQueryFn: createGetSupply, queryKeyPrefix: "SupplyQuery" }); -export const createGetNFTs = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetNFTs = (clientResolver: RpcResolver) => buildQuery({ encode: QueryNFTsRequest.encode, decode: QueryNFTsResponse.decode, service: "cosmos.nft.v1beta1.Query", method: "NFTs", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetNFTs = buildUseQuery({ builderQueryFn: createGetNFTs, queryKeyPrefix: "NFTsQuery" }); -export const createGetNFT = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetNFT = (clientResolver: RpcResolver) => buildQuery({ encode: QueryNFTRequest.encode, decode: QueryNFTResponse.decode, service: "cosmos.nft.v1beta1.Query", method: "NFT", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetNFT = buildUseQuery({ builderQueryFn: createGetNFT, queryKeyPrefix: "NFTQuery" }); -export const createGetClass = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClass = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClassRequest.encode, decode: QueryClassResponse.decode, service: "cosmos.nft.v1beta1.Query", method: "Class", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClass = buildUseQuery({ builderQueryFn: createGetClass, queryKeyPrefix: "ClassQuery" }); -export const createGetClasses = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClasses = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClassesRequest.encode, decode: QueryClassesResponse.decode, service: "cosmos.nft.v1beta1.Query", method: "Classes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClasses = buildUseQuery({ builderQueryFn: createGetClasses, diff --git a/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.rpc.func.ts index c2551a90e..532ea02dd 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/nft/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSend } from "./tx"; -export const createSend = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSend = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSend.typeUrl, encoders: toEncoders(MsgSend), converters: toConverters(MsgSend) diff --git a/__fixtures__/v-next/outputicjs/cosmos/params/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/params/v1beta1/query.rpc.func.ts index 3bf68015a..d6ba77f72 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/params/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/params/v1beta1/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse, QuerySubspacesRequest, QuerySubspacesResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.params.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetSubspaces = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSubspaces = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySubspacesRequest.encode, decode: QuerySubspacesResponse.decode, service: "cosmos.params.v1beta1.Query", method: "Subspaces", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSubspaces = buildUseQuery({ builderQueryFn: createGetSubspaces, diff --git a/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/query.rpc.func.ts index f5b43b9bc..baa018b21 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse, QuerySigningInfoRequest, QuerySigningInfoResponse, QuerySigningInfosRequest, QuerySigningInfosResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.slashing.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetSigningInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSigningInfo = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySigningInfoRequest.encode, decode: QuerySigningInfoResponse.decode, service: "cosmos.slashing.v1beta1.Query", method: "SigningInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSigningInfo = buildUseQuery({ builderQueryFn: createGetSigningInfo, queryKeyPrefix: "SigningInfoQuery" }); -export const createGetSigningInfos = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSigningInfos = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySigningInfosRequest.encode, decode: QuerySigningInfosResponse.decode, service: "cosmos.slashing.v1beta1.Query", method: "SigningInfos", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSigningInfos = buildUseQuery({ builderQueryFn: createGetSigningInfos, diff --git a/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.rpc.func.ts index 340afd3bd..44ec0a399 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/slashing/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgUnjail } from "./tx"; -export const createUnjail = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUnjail = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUnjail.typeUrl, encoders: toEncoders(MsgUnjail), converters: toConverters(MsgUnjail) diff --git a/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/query.rpc.func.ts index c85d8e399..e91b667b3 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/query.rpc.func.ts @@ -1,155 +1,155 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryValidatorsRequest, QueryValidatorsResponse, QueryValidatorRequest, QueryValidatorResponse, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse, QueryDelegationRequest, QueryDelegationResponse, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse, QueryRedelegationsRequest, QueryRedelegationsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse, QueryHistoricalInfoRequest, QueryHistoricalInfoResponse, QueryPoolRequest, QueryPoolResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetValidators = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetValidators = (clientResolver: RpcResolver) => buildQuery({ encode: QueryValidatorsRequest.encode, decode: QueryValidatorsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "Validators", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetValidators = buildUseQuery({ builderQueryFn: createGetValidators, queryKeyPrefix: "ValidatorsQuery" }); -export const createGetValidator = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetValidator = (clientResolver: RpcResolver) => buildQuery({ encode: QueryValidatorRequest.encode, decode: QueryValidatorResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "Validator", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetValidator = buildUseQuery({ builderQueryFn: createGetValidator, queryKeyPrefix: "ValidatorQuery" }); -export const createGetValidatorDelegations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetValidatorDelegations = (clientResolver: RpcResolver) => buildQuery({ encode: QueryValidatorDelegationsRequest.encode, decode: QueryValidatorDelegationsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "ValidatorDelegations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetValidatorDelegations = buildUseQuery({ builderQueryFn: createGetValidatorDelegations, queryKeyPrefix: "ValidatorDelegationsQuery" }); -export const createGetValidatorUnbondingDelegations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetValidatorUnbondingDelegations = (clientResolver: RpcResolver) => buildQuery({ encode: QueryValidatorUnbondingDelegationsRequest.encode, decode: QueryValidatorUnbondingDelegationsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "ValidatorUnbondingDelegations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetValidatorUnbondingDelegations = buildUseQuery({ builderQueryFn: createGetValidatorUnbondingDelegations, queryKeyPrefix: "ValidatorUnbondingDelegationsQuery" }); -export const createGetDelegation = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegation = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegationRequest.encode, decode: QueryDelegationResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "Delegation", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegation = buildUseQuery({ builderQueryFn: createGetDelegation, queryKeyPrefix: "DelegationQuery" }); -export const createGetUnbondingDelegation = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUnbondingDelegation = (clientResolver: RpcResolver) => buildQuery({ encode: QueryUnbondingDelegationRequest.encode, decode: QueryUnbondingDelegationResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "UnbondingDelegation", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUnbondingDelegation = buildUseQuery({ builderQueryFn: createGetUnbondingDelegation, queryKeyPrefix: "UnbondingDelegationQuery" }); -export const createGetDelegatorDelegations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegatorDelegations = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegatorDelegationsRequest.encode, decode: QueryDelegatorDelegationsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "DelegatorDelegations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegatorDelegations = buildUseQuery({ builderQueryFn: createGetDelegatorDelegations, queryKeyPrefix: "DelegatorDelegationsQuery" }); -export const createGetDelegatorUnbondingDelegations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegatorUnbondingDelegations = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegatorUnbondingDelegationsRequest.encode, decode: QueryDelegatorUnbondingDelegationsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "DelegatorUnbondingDelegations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegatorUnbondingDelegations = buildUseQuery({ builderQueryFn: createGetDelegatorUnbondingDelegations, queryKeyPrefix: "DelegatorUnbondingDelegationsQuery" }); -export const createGetRedelegations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetRedelegations = (clientResolver: RpcResolver) => buildQuery({ encode: QueryRedelegationsRequest.encode, decode: QueryRedelegationsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "Redelegations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetRedelegations = buildUseQuery({ builderQueryFn: createGetRedelegations, queryKeyPrefix: "RedelegationsQuery" }); -export const createGetDelegatorValidators = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegatorValidators = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegatorValidatorsRequest.encode, decode: QueryDelegatorValidatorsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "DelegatorValidators", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegatorValidators = buildUseQuery({ builderQueryFn: createGetDelegatorValidators, queryKeyPrefix: "DelegatorValidatorsQuery" }); -export const createGetDelegatorValidator = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDelegatorValidator = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDelegatorValidatorRequest.encode, decode: QueryDelegatorValidatorResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "DelegatorValidator", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDelegatorValidator = buildUseQuery({ builderQueryFn: createGetDelegatorValidator, queryKeyPrefix: "DelegatorValidatorQuery" }); -export const createGetHistoricalInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetHistoricalInfo = (clientResolver: RpcResolver) => buildQuery({ encode: QueryHistoricalInfoRequest.encode, decode: QueryHistoricalInfoResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "HistoricalInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetHistoricalInfo = buildUseQuery({ builderQueryFn: createGetHistoricalInfo, queryKeyPrefix: "HistoricalInfoQuery" }); -export const createGetPool = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPool = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPoolRequest.encode, decode: QueryPoolResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "Pool", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPool = buildUseQuery({ builderQueryFn: createGetPool, queryKeyPrefix: "PoolQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.rpc.func.ts index 6e9898015..0331addaf 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate } from "./tx"; -export const createCreateValidator = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateValidator = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateValidator.typeUrl, encoders: toEncoders(MsgCreateValidator), converters: toConverters(MsgCreateValidator) @@ -11,8 +11,8 @@ export const createCreateValidator = (getSigningClient: SigningClientResolver) = export const useCreateValidator = buildUseMutation({ builderMutationFn: createCreateValidator }); -export const createEditValidator = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createEditValidator = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgEditValidator.typeUrl, encoders: toEncoders(MsgEditValidator), converters: toConverters(MsgEditValidator) @@ -20,8 +20,8 @@ export const createEditValidator = (getSigningClient: SigningClientResolver) => export const useEditValidator = buildUseMutation({ builderMutationFn: createEditValidator }); -export const createDelegate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createDelegate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgDelegate.typeUrl, encoders: toEncoders(MsgDelegate), converters: toConverters(MsgDelegate) @@ -29,8 +29,8 @@ export const createDelegate = (getSigningClient: SigningClientResolver) => build export const useDelegate = buildUseMutation({ builderMutationFn: createDelegate }); -export const createBeginRedelegate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createBeginRedelegate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgBeginRedelegate.typeUrl, encoders: toEncoders(MsgBeginRedelegate), converters: toConverters(MsgBeginRedelegate) @@ -38,8 +38,8 @@ export const createBeginRedelegate = (getSigningClient: SigningClientResolver) = export const useBeginRedelegate = buildUseMutation({ builderMutationFn: createBeginRedelegate }); -export const createUndelegate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUndelegate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUndelegate.typeUrl, encoders: toEncoders(MsgUndelegate), converters: toConverters(MsgUndelegate) diff --git a/__fixtures__/v-next/outputicjs/cosmos/tx/v1beta1/service.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/tx/v1beta1/service.rpc.func.ts index b3c15a7ed..20c492721 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/tx/v1beta1/service.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/tx/v1beta1/service.rpc.func.ts @@ -1,56 +1,56 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse } from "./service"; -export const createGetSimulate = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSimulate = (clientResolver: RpcResolver) => buildQuery({ encode: SimulateRequest.encode, decode: SimulateResponse.decode, service: "cosmos.tx.v1beta1.Service", method: "Simulate", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSimulate = buildUseQuery({ builderQueryFn: createGetSimulate, queryKeyPrefix: "SimulateQuery" }); -export const createGetGetTx = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetTx = (clientResolver: RpcResolver) => buildQuery({ encode: GetTxRequest.encode, decode: GetTxResponse.decode, service: "cosmos.tx.v1beta1.Service", method: "GetTx", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetTx = buildUseQuery({ builderQueryFn: createGetGetTx, queryKeyPrefix: "GetTxQuery" }); -export const createGetBroadcastTx = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBroadcastTx = (clientResolver: RpcResolver) => buildQuery({ encode: BroadcastTxRequest.encode, decode: BroadcastTxResponse.decode, service: "cosmos.tx.v1beta1.Service", method: "BroadcastTx", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBroadcastTx = buildUseQuery({ builderQueryFn: createGetBroadcastTx, queryKeyPrefix: "BroadcastTxQuery" }); -export const createGetGetTxsEvent = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetTxsEvent = (clientResolver: RpcResolver) => buildQuery({ encode: GetTxsEventRequest.encode, decode: GetTxsEventResponse.decode, service: "cosmos.tx.v1beta1.Service", method: "GetTxsEvent", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetTxsEvent = buildUseQuery({ builderQueryFn: createGetGetTxsEvent, queryKeyPrefix: "GetTxsEventQuery" }); -export const createGetGetBlockWithTxs = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGetBlockWithTxs = (clientResolver: RpcResolver) => buildQuery({ encode: GetBlockWithTxsRequest.encode, decode: GetBlockWithTxsResponse.decode, service: "cosmos.tx.v1beta1.Service", method: "GetBlockWithTxs", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGetBlockWithTxs = buildUseQuery({ builderQueryFn: createGetGetBlockWithTxs, diff --git a/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/query.rpc.func.ts index a774cb5c7..f46b5bdc2 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/query.rpc.func.ts @@ -1,56 +1,56 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryCurrentPlanRequest, QueryCurrentPlanResponse, QueryAppliedPlanRequest, QueryAppliedPlanResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse, QueryModuleVersionsRequest, QueryModuleVersionsResponse, QueryAuthorityRequest, QueryAuthorityResponse } from "./query"; -export const createGetCurrentPlan = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCurrentPlan = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCurrentPlanRequest.encode, decode: QueryCurrentPlanResponse.decode, service: "cosmos.upgrade.v1beta1.Query", method: "CurrentPlan", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCurrentPlan = buildUseQuery({ builderQueryFn: createGetCurrentPlan, queryKeyPrefix: "CurrentPlanQuery" }); -export const createGetAppliedPlan = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAppliedPlan = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAppliedPlanRequest.encode, decode: QueryAppliedPlanResponse.decode, service: "cosmos.upgrade.v1beta1.Query", method: "AppliedPlan", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAppliedPlan = buildUseQuery({ builderQueryFn: createGetAppliedPlan, queryKeyPrefix: "AppliedPlanQuery" }); -export const createGetUpgradedConsensusState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUpgradedConsensusState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryUpgradedConsensusStateRequest.encode, decode: QueryUpgradedConsensusStateResponse.decode, service: "cosmos.upgrade.v1beta1.Query", method: "UpgradedConsensusState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUpgradedConsensusState = buildUseQuery({ builderQueryFn: createGetUpgradedConsensusState, queryKeyPrefix: "UpgradedConsensusStateQuery" }); -export const createGetModuleVersions = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetModuleVersions = (clientResolver: RpcResolver) => buildQuery({ encode: QueryModuleVersionsRequest.encode, decode: QueryModuleVersionsResponse.decode, service: "cosmos.upgrade.v1beta1.Query", method: "ModuleVersions", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetModuleVersions = buildUseQuery({ builderQueryFn: createGetModuleVersions, queryKeyPrefix: "ModuleVersionsQuery" }); -export const createGetAuthority = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAuthority = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAuthorityRequest.encode, decode: QueryAuthorityResponse.decode, service: "cosmos.upgrade.v1beta1.Query", method: "Authority", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAuthority = buildUseQuery({ builderQueryFn: createGetAuthority, diff --git a/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.rpc.func.ts index 1361e7514..837d251b0 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/upgrade/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; -export const createSoftwareUpgrade = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSoftwareUpgrade = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSoftwareUpgrade.typeUrl, encoders: toEncoders(MsgSoftwareUpgrade), converters: toConverters(MsgSoftwareUpgrade) @@ -11,8 +11,8 @@ export const createSoftwareUpgrade = (getSigningClient: SigningClientResolver) = export const useSoftwareUpgrade = buildUseMutation({ builderMutationFn: createSoftwareUpgrade }); -export const createCancelUpgrade = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCancelUpgrade = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCancelUpgrade.typeUrl, encoders: toEncoders(MsgCancelUpgrade), converters: toConverters(MsgCancelUpgrade) diff --git a/__fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.rpc.func.ts index 6168e11e3..b54ec88f2 100644 --- a/__fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; -export const createCreateVestingAccount = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateVestingAccount = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateVestingAccount.typeUrl, encoders: toEncoders(MsgCreateVestingAccount), converters: toConverters(MsgCreateVestingAccount) @@ -11,8 +11,8 @@ export const createCreateVestingAccount = (getSigningClient: SigningClientResolv export const useCreateVestingAccount = buildUseMutation({ builderMutationFn: createCreateVestingAccount }); -export const createCreatePermanentLockedAccount = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreatePermanentLockedAccount = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreatePermanentLockedAccount.typeUrl, encoders: toEncoders(MsgCreatePermanentLockedAccount), converters: toConverters(MsgCreatePermanentLockedAccount) @@ -20,8 +20,8 @@ export const createCreatePermanentLockedAccount = (getSigningClient: SigningClie export const useCreatePermanentLockedAccount = buildUseMutation({ builderMutationFn: createCreatePermanentLockedAccount }); -export const createCreatePeriodicVestingAccount = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreatePeriodicVestingAccount = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreatePeriodicVestingAccount.typeUrl, encoders: toEncoders(MsgCreatePeriodicVestingAccount), converters: toConverters(MsgCreatePeriodicVestingAccount) diff --git a/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/query.rpc.func.ts index ba7899915..2473afb40 100644 --- a/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/query.rpc.func.ts @@ -1,100 +1,100 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryContractInfoRequest, QueryContractInfoResponse, QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryAllContractStateRequest, QueryAllContractStateResponse, QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse, QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryPinnedCodesRequest, QueryPinnedCodesResponse } from "./query"; -export const createGetContractInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetContractInfo = (clientResolver: RpcResolver) => buildQuery({ encode: QueryContractInfoRequest.encode, decode: QueryContractInfoResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "ContractInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetContractInfo = buildUseQuery({ builderQueryFn: createGetContractInfo, queryKeyPrefix: "ContractInfoQuery" }); -export const createGetContractHistory = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetContractHistory = (clientResolver: RpcResolver) => buildQuery({ encode: QueryContractHistoryRequest.encode, decode: QueryContractHistoryResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "ContractHistory", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetContractHistory = buildUseQuery({ builderQueryFn: createGetContractHistory, queryKeyPrefix: "ContractHistoryQuery" }); -export const createGetContractsByCode = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetContractsByCode = (clientResolver: RpcResolver) => buildQuery({ encode: QueryContractsByCodeRequest.encode, decode: QueryContractsByCodeResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "ContractsByCode", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetContractsByCode = buildUseQuery({ builderQueryFn: createGetContractsByCode, queryKeyPrefix: "ContractsByCodeQuery" }); -export const createGetAllContractState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllContractState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllContractStateRequest.encode, decode: QueryAllContractStateResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "AllContractState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllContractState = buildUseQuery({ builderQueryFn: createGetAllContractState, queryKeyPrefix: "AllContractStateQuery" }); -export const createGetRawContractState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetRawContractState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryRawContractStateRequest.encode, decode: QueryRawContractStateResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "RawContractState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetRawContractState = buildUseQuery({ builderQueryFn: createGetRawContractState, queryKeyPrefix: "RawContractStateQuery" }); -export const createGetSmartContractState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSmartContractState = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySmartContractStateRequest.encode, decode: QuerySmartContractStateResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "SmartContractState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSmartContractState = buildUseQuery({ builderQueryFn: createGetSmartContractState, queryKeyPrefix: "SmartContractStateQuery" }); -export const createGetCode = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCode = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCodeRequest.encode, decode: QueryCodeResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "Code", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCode = buildUseQuery({ builderQueryFn: createGetCode, queryKeyPrefix: "CodeQuery" }); -export const createGetCodes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCodes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCodesRequest.encode, decode: QueryCodesResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "Codes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCodes = buildUseQuery({ builderQueryFn: createGetCodes, queryKeyPrefix: "CodesQuery" }); -export const createGetPinnedCodes = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPinnedCodes = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPinnedCodesRequest.encode, decode: QueryPinnedCodesResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "PinnedCodes", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPinnedCodes = buildUseQuery({ builderQueryFn: createGetPinnedCodes, diff --git a/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/tx.rpc.func.ts index caf34c57d..579889b58 100644 --- a/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgStoreCode, MsgInstantiateContract, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin } from "./tx"; -export const createStoreCode = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createStoreCode = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgStoreCode.typeUrl, encoders: toEncoders(MsgStoreCode), converters: toConverters(MsgStoreCode) @@ -11,8 +11,8 @@ export const createStoreCode = (getSigningClient: SigningClientResolver) => buil export const useStoreCode = buildUseMutation({ builderMutationFn: createStoreCode }); -export const createInstantiateContract = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createInstantiateContract = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgInstantiateContract.typeUrl, encoders: toEncoders(MsgInstantiateContract), converters: toConverters(MsgInstantiateContract) @@ -20,8 +20,8 @@ export const createInstantiateContract = (getSigningClient: SigningClientResolve export const useInstantiateContract = buildUseMutation({ builderMutationFn: createInstantiateContract }); -export const createExecuteContract = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExecuteContract = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExecuteContract.typeUrl, encoders: toEncoders(MsgExecuteContract), converters: toConverters(MsgExecuteContract) @@ -29,8 +29,8 @@ export const createExecuteContract = (getSigningClient: SigningClientResolver) = export const useExecuteContract = buildUseMutation({ builderMutationFn: createExecuteContract }); -export const createMigrateContract = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createMigrateContract = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgMigrateContract.typeUrl, encoders: toEncoders(MsgMigrateContract), converters: toConverters(MsgMigrateContract) @@ -38,8 +38,8 @@ export const createMigrateContract = (getSigningClient: SigningClientResolver) = export const useMigrateContract = buildUseMutation({ builderMutationFn: createMigrateContract }); -export const createUpdateAdmin = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateAdmin = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateAdmin.typeUrl, encoders: toEncoders(MsgUpdateAdmin), converters: toConverters(MsgUpdateAdmin) @@ -47,8 +47,8 @@ export const createUpdateAdmin = (getSigningClient: SigningClientResolver) => bu export const useUpdateAdmin = buildUseMutation({ builderMutationFn: createUpdateAdmin }); -export const createClearAdmin = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createClearAdmin = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgClearAdmin.typeUrl, encoders: toEncoders(MsgClearAdmin), converters: toConverters(MsgClearAdmin) diff --git a/__fixtures__/v-next/outputicjs/evmos/claims/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/claims/v1/query.rpc.func.ts index d7e1975e3..6a157b9ae 100644 --- a/__fixtures__/v-next/outputicjs/evmos/claims/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/claims/v1/query.rpc.func.ts @@ -1,45 +1,45 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryTotalUnclaimedRequest, QueryTotalUnclaimedResponse, QueryParamsRequest, QueryParamsResponse, QueryClaimsRecordsRequest, QueryClaimsRecordsResponse, QueryClaimsRecordRequest, QueryClaimsRecordResponse } from "./query"; -export const createGetTotalUnclaimed = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalUnclaimed = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalUnclaimedRequest.encode, decode: QueryTotalUnclaimedResponse.decode, service: "evmos.claims.v1.Query", method: "TotalUnclaimed", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalUnclaimed = buildUseQuery({ builderQueryFn: createGetTotalUnclaimed, queryKeyPrefix: "TotalUnclaimedQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "evmos.claims.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetClaimsRecords = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClaimsRecords = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClaimsRecordsRequest.encode, decode: QueryClaimsRecordsResponse.decode, service: "evmos.claims.v1.Query", method: "ClaimsRecords", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClaimsRecords = buildUseQuery({ builderQueryFn: createGetClaimsRecords, queryKeyPrefix: "ClaimsRecordsQuery" }); -export const createGetClaimsRecord = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClaimsRecord = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClaimsRecordRequest.encode, decode: QueryClaimsRecordResponse.decode, service: "evmos.claims.v1.Query", method: "ClaimsRecord", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClaimsRecord = buildUseQuery({ builderQueryFn: createGetClaimsRecord, diff --git a/__fixtures__/v-next/outputicjs/evmos/epochs/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/epochs/v1/query.rpc.func.ts index ad4e9d19b..73d5d6358 100644 --- a/__fixtures__/v-next/outputicjs/evmos/epochs/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/epochs/v1/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryEpochsInfoRequest, QueryEpochsInfoResponse, QueryCurrentEpochRequest, QueryCurrentEpochResponse } from "./query"; -export const createGetEpochInfos = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEpochInfos = (clientResolver: RpcResolver) => buildQuery({ encode: QueryEpochsInfoRequest.encode, decode: QueryEpochsInfoResponse.decode, service: "evmos.epochs.v1.Query", method: "EpochInfos", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEpochInfos = buildUseQuery({ builderQueryFn: createGetEpochInfos, queryKeyPrefix: "EpochInfosQuery" }); -export const createGetCurrentEpoch = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCurrentEpoch = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCurrentEpochRequest.encode, decode: QueryCurrentEpochResponse.decode, service: "evmos.epochs.v1.Query", method: "CurrentEpoch", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCurrentEpoch = buildUseQuery({ builderQueryFn: createGetCurrentEpoch, diff --git a/__fixtures__/v-next/outputicjs/evmos/erc20/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/erc20/v1/query.rpc.func.ts index 263f29c0d..414bf573c 100644 --- a/__fixtures__/v-next/outputicjs/evmos/erc20/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/erc20/v1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryTokenPairsRequest, QueryTokenPairsResponse, QueryTokenPairRequest, QueryTokenPairResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetTokenPairs = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTokenPairs = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTokenPairsRequest.encode, decode: QueryTokenPairsResponse.decode, service: "evmos.erc20.v1.Query", method: "TokenPairs", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTokenPairs = buildUseQuery({ builderQueryFn: createGetTokenPairs, queryKeyPrefix: "TokenPairsQuery" }); -export const createGetTokenPair = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTokenPair = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTokenPairRequest.encode, decode: QueryTokenPairResponse.decode, service: "evmos.erc20.v1.Query", method: "TokenPair", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTokenPair = buildUseQuery({ builderQueryFn: createGetTokenPair, queryKeyPrefix: "TokenPairQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "evmos.erc20.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/evmos/erc20/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/erc20/v1/tx.rpc.func.ts index a9340b1e2..b05471352 100644 --- a/__fixtures__/v-next/outputicjs/evmos/erc20/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/erc20/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgConvertCoin, MsgConvertERC20 } from "./tx"; -export const createConvertCoin = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createConvertCoin = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgConvertCoin.typeUrl, encoders: toEncoders(MsgConvertCoin), converters: toConverters(MsgConvertCoin) @@ -11,8 +11,8 @@ export const createConvertCoin = (getSigningClient: SigningClientResolver) => bu export const useConvertCoin = buildUseMutation({ builderMutationFn: createConvertCoin }); -export const createConvertERC20 = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createConvertERC20 = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgConvertERC20.typeUrl, encoders: toEncoders(MsgConvertERC20), converters: toConverters(MsgConvertERC20) diff --git a/__fixtures__/v-next/outputicjs/evmos/fees/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/fees/v1/query.rpc.func.ts index abc5dfe90..816458804 100644 --- a/__fixtures__/v-next/outputicjs/evmos/fees/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/fees/v1/query.rpc.func.ts @@ -1,45 +1,45 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryDevFeeInfosRequest, QueryDevFeeInfosResponse, QueryDevFeeInfoRequest, QueryDevFeeInfoResponse, QueryParamsRequest, QueryParamsResponse, QueryDevFeeInfosPerDeployerRequest, QueryDevFeeInfosPerDeployerResponse } from "./query"; -export const createGetDevFeeInfos = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDevFeeInfos = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDevFeeInfosRequest.encode, decode: QueryDevFeeInfosResponse.decode, service: "evmos.fees.v1.Query", method: "DevFeeInfos", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDevFeeInfos = buildUseQuery({ builderQueryFn: createGetDevFeeInfos, queryKeyPrefix: "DevFeeInfosQuery" }); -export const createGetDevFeeInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDevFeeInfo = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDevFeeInfoRequest.encode, decode: QueryDevFeeInfoResponse.decode, service: "evmos.fees.v1.Query", method: "DevFeeInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDevFeeInfo = buildUseQuery({ builderQueryFn: createGetDevFeeInfo, queryKeyPrefix: "DevFeeInfoQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "evmos.fees.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetDevFeeInfosPerDeployer = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDevFeeInfosPerDeployer = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDevFeeInfosPerDeployerRequest.encode, decode: QueryDevFeeInfosPerDeployerResponse.decode, service: "evmos.fees.v1.Query", method: "DevFeeInfosPerDeployer", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDevFeeInfosPerDeployer = buildUseQuery({ builderQueryFn: createGetDevFeeInfosPerDeployer, diff --git a/__fixtures__/v-next/outputicjs/evmos/fees/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/fees/v1/tx.rpc.func.ts index 2510215af..66f201bc6 100644 --- a/__fixtures__/v-next/outputicjs/evmos/fees/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/fees/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgRegisterDevFeeInfo, MsgCancelDevFeeInfo, MsgUpdateDevFeeInfo } from "./tx"; -export const createRegisterDevFeeInfo = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createRegisterDevFeeInfo = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgRegisterDevFeeInfo.typeUrl, encoders: toEncoders(MsgRegisterDevFeeInfo), converters: toConverters(MsgRegisterDevFeeInfo) @@ -11,8 +11,8 @@ export const createRegisterDevFeeInfo = (getSigningClient: SigningClientResolver export const useRegisterDevFeeInfo = buildUseMutation({ builderMutationFn: createRegisterDevFeeInfo }); -export const createCancelDevFeeInfo = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCancelDevFeeInfo = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCancelDevFeeInfo.typeUrl, encoders: toEncoders(MsgCancelDevFeeInfo), converters: toConverters(MsgCancelDevFeeInfo) @@ -20,8 +20,8 @@ export const createCancelDevFeeInfo = (getSigningClient: SigningClientResolver) export const useCancelDevFeeInfo = buildUseMutation({ builderMutationFn: createCancelDevFeeInfo }); -export const createUpdateDevFeeInfo = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateDevFeeInfo = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateDevFeeInfo.typeUrl, encoders: toEncoders(MsgUpdateDevFeeInfo), converters: toConverters(MsgUpdateDevFeeInfo) diff --git a/__fixtures__/v-next/outputicjs/evmos/incentives/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/incentives/v1/query.rpc.func.ts index 54cba73f2..61ca944f4 100644 --- a/__fixtures__/v-next/outputicjs/evmos/incentives/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/incentives/v1/query.rpc.func.ts @@ -1,78 +1,78 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryIncentivesRequest, QueryIncentivesResponse, QueryIncentiveRequest, QueryIncentiveResponse, QueryGasMetersRequest, QueryGasMetersResponse, QueryGasMeterRequest, QueryGasMeterResponse, QueryAllocationMetersRequest, QueryAllocationMetersResponse, QueryAllocationMeterRequest, QueryAllocationMeterResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetIncentives = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetIncentives = (clientResolver: RpcResolver) => buildQuery({ encode: QueryIncentivesRequest.encode, decode: QueryIncentivesResponse.decode, service: "evmos.incentives.v1.Query", method: "Incentives", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetIncentives = buildUseQuery({ builderQueryFn: createGetIncentives, queryKeyPrefix: "IncentivesQuery" }); -export const createGetIncentive = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetIncentive = (clientResolver: RpcResolver) => buildQuery({ encode: QueryIncentiveRequest.encode, decode: QueryIncentiveResponse.decode, service: "evmos.incentives.v1.Query", method: "Incentive", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetIncentive = buildUseQuery({ builderQueryFn: createGetIncentive, queryKeyPrefix: "IncentiveQuery" }); -export const createGetGasMeters = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGasMeters = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGasMetersRequest.encode, decode: QueryGasMetersResponse.decode, service: "evmos.incentives.v1.Query", method: "GasMeters", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGasMeters = buildUseQuery({ builderQueryFn: createGetGasMeters, queryKeyPrefix: "GasMetersQuery" }); -export const createGetGasMeter = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGasMeter = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGasMeterRequest.encode, decode: QueryGasMeterResponse.decode, service: "evmos.incentives.v1.Query", method: "GasMeter", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGasMeter = buildUseQuery({ builderQueryFn: createGetGasMeter, queryKeyPrefix: "GasMeterQuery" }); -export const createGetAllocationMeters = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllocationMeters = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllocationMetersRequest.encode, decode: QueryAllocationMetersResponse.decode, service: "evmos.incentives.v1.Query", method: "AllocationMeters", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllocationMeters = buildUseQuery({ builderQueryFn: createGetAllocationMeters, queryKeyPrefix: "AllocationMetersQuery" }); -export const createGetAllocationMeter = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllocationMeter = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAllocationMeterRequest.encode, decode: QueryAllocationMeterResponse.decode, service: "evmos.incentives.v1.Query", method: "AllocationMeter", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllocationMeter = buildUseQuery({ builderQueryFn: createGetAllocationMeter, queryKeyPrefix: "AllocationMeterQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "evmos.incentives.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/evmos/inflation/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/inflation/v1/query.rpc.func.ts index 255c9a922..bfaa5c40a 100644 --- a/__fixtures__/v-next/outputicjs/evmos/inflation/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/inflation/v1/query.rpc.func.ts @@ -1,67 +1,67 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryPeriodRequest, QueryPeriodResponse, QueryEpochMintProvisionRequest, QueryEpochMintProvisionResponse, QuerySkippedEpochsRequest, QuerySkippedEpochsResponse, QueryCirculatingSupplyRequest, QueryCirculatingSupplyResponse, QueryInflationRateRequest, QueryInflationRateResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetPeriod = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPeriod = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPeriodRequest.encode, decode: QueryPeriodResponse.decode, service: "evmos.inflation.v1.Query", method: "Period", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPeriod = buildUseQuery({ builderQueryFn: createGetPeriod, queryKeyPrefix: "PeriodQuery" }); -export const createGetEpochMintProvision = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEpochMintProvision = (clientResolver: RpcResolver) => buildQuery({ encode: QueryEpochMintProvisionRequest.encode, decode: QueryEpochMintProvisionResponse.decode, service: "evmos.inflation.v1.Query", method: "EpochMintProvision", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEpochMintProvision = buildUseQuery({ builderQueryFn: createGetEpochMintProvision, queryKeyPrefix: "EpochMintProvisionQuery" }); -export const createGetSkippedEpochs = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSkippedEpochs = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySkippedEpochsRequest.encode, decode: QuerySkippedEpochsResponse.decode, service: "evmos.inflation.v1.Query", method: "SkippedEpochs", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSkippedEpochs = buildUseQuery({ builderQueryFn: createGetSkippedEpochs, queryKeyPrefix: "SkippedEpochsQuery" }); -export const createGetCirculatingSupply = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCirculatingSupply = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCirculatingSupplyRequest.encode, decode: QueryCirculatingSupplyResponse.decode, service: "evmos.inflation.v1.Query", method: "CirculatingSupply", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCirculatingSupply = buildUseQuery({ builderQueryFn: createGetCirculatingSupply, queryKeyPrefix: "CirculatingSupplyQuery" }); -export const createGetInflationRate = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetInflationRate = (clientResolver: RpcResolver) => buildQuery({ encode: QueryInflationRateRequest.encode, decode: QueryInflationRateResponse.decode, service: "evmos.inflation.v1.Query", method: "InflationRate", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetInflationRate = buildUseQuery({ builderQueryFn: createGetInflationRate, queryKeyPrefix: "InflationRateQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "evmos.inflation.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/evmos/recovery/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/recovery/v1/query.rpc.func.ts index 3385aa966..1a6f9e749 100644 --- a/__fixtures__/v-next/outputicjs/evmos/recovery/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/recovery/v1/query.rpc.func.ts @@ -1,12 +1,12 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "evmos.recovery.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/evmos/vesting/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/vesting/v1/query.rpc.func.ts index a0f835924..259e6225d 100644 --- a/__fixtures__/v-next/outputicjs/evmos/vesting/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/vesting/v1/query.rpc.func.ts @@ -1,12 +1,12 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryBalancesRequest, QueryBalancesResponse } from "./query"; -export const createGetBalances = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBalances = (clientResolver: RpcResolver) => buildQuery({ encode: QueryBalancesRequest.encode, decode: QueryBalancesResponse.decode, service: "evmos.vesting.v1.Query", method: "Balances", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBalances = buildUseQuery({ builderQueryFn: createGetBalances, diff --git a/__fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.rpc.func.ts index 88a5d4ca4..4aa444761 100644 --- a/__fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/evmos/vesting/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateClawbackVestingAccount, MsgClawback } from "./tx"; -export const createCreateClawbackVestingAccount = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateClawbackVestingAccount = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateClawbackVestingAccount.typeUrl, encoders: toEncoders(MsgCreateClawbackVestingAccount), converters: toConverters(MsgCreateClawbackVestingAccount) @@ -11,8 +11,8 @@ export const createCreateClawbackVestingAccount = (getSigningClient: SigningClie export const useCreateClawbackVestingAccount = buildUseMutation({ builderMutationFn: createCreateClawbackVestingAccount }); -export const createClawback = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createClawback = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgClawback.typeUrl, encoders: toEncoders(MsgClawback), converters: toConverters(MsgClawback) diff --git a/__fixtures__/v-next/outputicjs/helper-func-types.ts b/__fixtures__/v-next/outputicjs/helper-func-types.ts index bd44fa62d..ec1132b5a 100644 --- a/__fixtures__/v-next/outputicjs/helper-func-types.ts +++ b/__fixtures__/v-next/outputicjs/helper-func-types.ts @@ -5,20 +5,28 @@ */ +import { HttpEndpoint } from "@interchainjs/types"; import { BinaryReader, BinaryWriter } from "./binary"; -import { Rpc } from "./helpers"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; export interface QueryBuilderOptions { encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter decode: (input: BinaryReader | Uint8Array, length?: number) => TRes service: string, method: string, - getRpcInstance: () => Rpc | undefined + clientResolver: RpcResolver } export function buildQuery(opts: QueryBuilderOptions) { return async (request: TReq) => { - const rpc = opts.getRpcInstance(); + let rpc: Rpc | undefined; + + if(isRpc(opts.clientResolver)) { + rpc = opts.clientResolver; + } else { + rpc = await getRpcClient(opts.clientResolver); + } if (!rpc) throw new Error("Query Rpc is not initialized"); @@ -35,6 +43,13 @@ export interface ITxArgs { memo: string; } +export function isISigningClient(client: unknown): client is ISigningClient { + return client !== null && client !== undefined + && typeof (client as ISigningClient).signAndBroadcast === 'function' + && typeof (client as ISigningClient).addConverters === 'function' + && typeof (client as ISigningClient).addEncoders === 'function'; +} + export interface ISigningClient { /** * register converters @@ -54,7 +69,7 @@ export interface ISigningClient { } export interface TxBuilderOptions { - getSigningClient: () => ISigningClient | undefined, + clientResolver: SigningClientResolver, typeUrl: string, encoders?: Encoder[], converters?: AminoConverter[], @@ -67,7 +82,12 @@ export function buildTx(opts: TxBuilderOptions) { fee: StdFee | 'auto', memo: string ): Promise => { - const client = opts.getSigningClient(); + let client: ISigningClient | undefined; + + // if opts.getSigningClient is a function, call it to get the SigningClient instance + if(isISigningClient(opts.clientResolver)) { + client = opts.clientResolver; + } if (!client) throw new Error("SigningClient is not initialized"); @@ -167,5 +187,5 @@ export interface AminoConverter { toAmino: (data: any) => any; } -export type SigningClientResolver = () => ISigningClient | undefined; -export type RpcResolver = () => Rpc | undefined; +export type SigningClientResolver = string | HttpEndpoint | ISigningClient; +export type RpcResolver = string | HttpEndpoint | Rpc ; diff --git a/__fixtures__/v-next/outputicjs/helpers.ts b/__fixtures__/v-next/outputicjs/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputicjs/helpers.ts +++ b/__fixtures__/v-next/outputicjs/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/query.rpc.func.ts index 5f272604f..3c285a8ec 100644 --- a/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { QueryDenomTraceRequest, QueryDenomTraceResponse, QueryDenomTracesRequest, QueryDenomTracesResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetDenomTrace = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomTrace = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomTraceRequest.encode, decode: QueryDenomTraceResponse.decode, service: "ibc.applications.transfer.v1.Query", method: "DenomTrace", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomTrace = buildUseQuery({ builderQueryFn: createGetDenomTrace, queryKeyPrefix: "DenomTraceQuery" }); -export const createGetDenomTraces = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomTraces = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomTracesRequest.encode, decode: QueryDenomTracesResponse.decode, service: "ibc.applications.transfer.v1.Query", method: "DenomTraces", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomTraces = buildUseQuery({ builderQueryFn: createGetDenomTraces, queryKeyPrefix: "DenomTracesQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "ibc.applications.transfer.v1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.rpc.func.ts index b79a8a170..c64afe4ce 100644 --- a/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgTransfer } from "./tx"; -export const createTransfer = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createTransfer = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgTransfer.typeUrl, encoders: toEncoders(MsgTransfer), converters: toConverters(MsgTransfer) diff --git a/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/query.rpc.func.ts index 17e8a6f4a..2ecfe8561 100644 --- a/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/query.rpc.func.ts @@ -1,144 +1,144 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { QueryChannelRequest, QueryChannelResponse, QueryChannelsRequest, QueryChannelsResponse, QueryConnectionChannelsRequest, QueryConnectionChannelsResponse, QueryChannelClientStateRequest, QueryChannelClientStateResponse, QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponse, QueryPacketCommitmentRequest, QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse, QueryPacketReceiptRequest, QueryPacketReceiptResponse, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse, QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponse } from "./query"; -export const createGetChannel = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetChannel = (clientResolver: RpcResolver) => buildQuery({ encode: QueryChannelRequest.encode, decode: QueryChannelResponse.decode, service: "ibc.core.channel.v1.Query", method: "Channel", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetChannel = buildUseQuery({ builderQueryFn: createGetChannel, queryKeyPrefix: "ChannelQuery" }); -export const createGetChannels = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetChannels = (clientResolver: RpcResolver) => buildQuery({ encode: QueryChannelsRequest.encode, decode: QueryChannelsResponse.decode, service: "ibc.core.channel.v1.Query", method: "Channels", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetChannels = buildUseQuery({ builderQueryFn: createGetChannels, queryKeyPrefix: "ChannelsQuery" }); -export const createGetConnectionChannels = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConnectionChannels = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConnectionChannelsRequest.encode, decode: QueryConnectionChannelsResponse.decode, service: "ibc.core.channel.v1.Query", method: "ConnectionChannels", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConnectionChannels = buildUseQuery({ builderQueryFn: createGetConnectionChannels, queryKeyPrefix: "ConnectionChannelsQuery" }); -export const createGetChannelClientState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetChannelClientState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryChannelClientStateRequest.encode, decode: QueryChannelClientStateResponse.decode, service: "ibc.core.channel.v1.Query", method: "ChannelClientState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetChannelClientState = buildUseQuery({ builderQueryFn: createGetChannelClientState, queryKeyPrefix: "ChannelClientStateQuery" }); -export const createGetChannelConsensusState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetChannelConsensusState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryChannelConsensusStateRequest.encode, decode: QueryChannelConsensusStateResponse.decode, service: "ibc.core.channel.v1.Query", method: "ChannelConsensusState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetChannelConsensusState = buildUseQuery({ builderQueryFn: createGetChannelConsensusState, queryKeyPrefix: "ChannelConsensusStateQuery" }); -export const createGetPacketCommitment = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPacketCommitment = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPacketCommitmentRequest.encode, decode: QueryPacketCommitmentResponse.decode, service: "ibc.core.channel.v1.Query", method: "PacketCommitment", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPacketCommitment = buildUseQuery({ builderQueryFn: createGetPacketCommitment, queryKeyPrefix: "PacketCommitmentQuery" }); -export const createGetPacketCommitments = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPacketCommitments = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPacketCommitmentsRequest.encode, decode: QueryPacketCommitmentsResponse.decode, service: "ibc.core.channel.v1.Query", method: "PacketCommitments", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPacketCommitments = buildUseQuery({ builderQueryFn: createGetPacketCommitments, queryKeyPrefix: "PacketCommitmentsQuery" }); -export const createGetPacketReceipt = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPacketReceipt = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPacketReceiptRequest.encode, decode: QueryPacketReceiptResponse.decode, service: "ibc.core.channel.v1.Query", method: "PacketReceipt", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPacketReceipt = buildUseQuery({ builderQueryFn: createGetPacketReceipt, queryKeyPrefix: "PacketReceiptQuery" }); -export const createGetPacketAcknowledgement = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPacketAcknowledgement = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPacketAcknowledgementRequest.encode, decode: QueryPacketAcknowledgementResponse.decode, service: "ibc.core.channel.v1.Query", method: "PacketAcknowledgement", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPacketAcknowledgement = buildUseQuery({ builderQueryFn: createGetPacketAcknowledgement, queryKeyPrefix: "PacketAcknowledgementQuery" }); -export const createGetPacketAcknowledgements = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPacketAcknowledgements = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPacketAcknowledgementsRequest.encode, decode: QueryPacketAcknowledgementsResponse.decode, service: "ibc.core.channel.v1.Query", method: "PacketAcknowledgements", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPacketAcknowledgements = buildUseQuery({ builderQueryFn: createGetPacketAcknowledgements, queryKeyPrefix: "PacketAcknowledgementsQuery" }); -export const createGetUnreceivedPackets = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUnreceivedPackets = (clientResolver: RpcResolver) => buildQuery({ encode: QueryUnreceivedPacketsRequest.encode, decode: QueryUnreceivedPacketsResponse.decode, service: "ibc.core.channel.v1.Query", method: "UnreceivedPackets", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUnreceivedPackets = buildUseQuery({ builderQueryFn: createGetUnreceivedPackets, queryKeyPrefix: "UnreceivedPacketsQuery" }); -export const createGetUnreceivedAcks = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUnreceivedAcks = (clientResolver: RpcResolver) => buildQuery({ encode: QueryUnreceivedAcksRequest.encode, decode: QueryUnreceivedAcksResponse.decode, service: "ibc.core.channel.v1.Query", method: "UnreceivedAcks", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUnreceivedAcks = buildUseQuery({ builderQueryFn: createGetUnreceivedAcks, queryKeyPrefix: "UnreceivedAcksQuery" }); -export const createGetNextSequenceReceive = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetNextSequenceReceive = (clientResolver: RpcResolver) => buildQuery({ encode: QueryNextSequenceReceiveRequest.encode, decode: QueryNextSequenceReceiveResponse.decode, service: "ibc.core.channel.v1.Query", method: "NextSequenceReceive", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetNextSequenceReceive = buildUseQuery({ builderQueryFn: createGetNextSequenceReceive, diff --git a/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/tx.rpc.func.ts index f21bd0342..8b6d47d61 100644 --- a/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/core/channel/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement } from "./tx"; -export const createChannelOpenInit = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createChannelOpenInit = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgChannelOpenInit.typeUrl, encoders: toEncoders(MsgChannelOpenInit), converters: toConverters(MsgChannelOpenInit) @@ -11,8 +11,8 @@ export const createChannelOpenInit = (getSigningClient: SigningClientResolver) = export const useChannelOpenInit = buildUseMutation({ builderMutationFn: createChannelOpenInit }); -export const createChannelOpenTry = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createChannelOpenTry = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgChannelOpenTry.typeUrl, encoders: toEncoders(MsgChannelOpenTry), converters: toConverters(MsgChannelOpenTry) @@ -20,8 +20,8 @@ export const createChannelOpenTry = (getSigningClient: SigningClientResolver) => export const useChannelOpenTry = buildUseMutation({ builderMutationFn: createChannelOpenTry }); -export const createChannelOpenAck = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createChannelOpenAck = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgChannelOpenAck.typeUrl, encoders: toEncoders(MsgChannelOpenAck), converters: toConverters(MsgChannelOpenAck) @@ -29,8 +29,8 @@ export const createChannelOpenAck = (getSigningClient: SigningClientResolver) => export const useChannelOpenAck = buildUseMutation({ builderMutationFn: createChannelOpenAck }); -export const createChannelOpenConfirm = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createChannelOpenConfirm = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgChannelOpenConfirm.typeUrl, encoders: toEncoders(MsgChannelOpenConfirm), converters: toConverters(MsgChannelOpenConfirm) @@ -38,8 +38,8 @@ export const createChannelOpenConfirm = (getSigningClient: SigningClientResolver export const useChannelOpenConfirm = buildUseMutation({ builderMutationFn: createChannelOpenConfirm }); -export const createChannelCloseInit = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createChannelCloseInit = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgChannelCloseInit.typeUrl, encoders: toEncoders(MsgChannelCloseInit), converters: toConverters(MsgChannelCloseInit) @@ -47,8 +47,8 @@ export const createChannelCloseInit = (getSigningClient: SigningClientResolver) export const useChannelCloseInit = buildUseMutation({ builderMutationFn: createChannelCloseInit }); -export const createChannelCloseConfirm = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createChannelCloseConfirm = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgChannelCloseConfirm.typeUrl, encoders: toEncoders(MsgChannelCloseConfirm), converters: toConverters(MsgChannelCloseConfirm) @@ -56,8 +56,8 @@ export const createChannelCloseConfirm = (getSigningClient: SigningClientResolve export const useChannelCloseConfirm = buildUseMutation({ builderMutationFn: createChannelCloseConfirm }); -export const createRecvPacket = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createRecvPacket = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgRecvPacket.typeUrl, encoders: toEncoders(MsgRecvPacket), converters: toConverters(MsgRecvPacket) @@ -65,8 +65,8 @@ export const createRecvPacket = (getSigningClient: SigningClientResolver) => bui export const useRecvPacket = buildUseMutation({ builderMutationFn: createRecvPacket }); -export const createTimeout = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createTimeout = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgTimeout.typeUrl, encoders: toEncoders(MsgTimeout), converters: toConverters(MsgTimeout) @@ -74,8 +74,8 @@ export const createTimeout = (getSigningClient: SigningClientResolver) => buildT export const useTimeout = buildUseMutation({ builderMutationFn: createTimeout }); -export const createTimeoutOnClose = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createTimeoutOnClose = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgTimeoutOnClose.typeUrl, encoders: toEncoders(MsgTimeoutOnClose), converters: toConverters(MsgTimeoutOnClose) @@ -83,8 +83,8 @@ export const createTimeoutOnClose = (getSigningClient: SigningClientResolver) => export const useTimeoutOnClose = buildUseMutation({ builderMutationFn: createTimeoutOnClose }); -export const createAcknowledgement = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createAcknowledgement = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgAcknowledgement.typeUrl, encoders: toEncoders(MsgAcknowledgement), converters: toConverters(MsgAcknowledgement) diff --git a/__fixtures__/v-next/outputicjs/ibc/core/client/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/core/client/v1/query.rpc.func.ts index a58991457..0eb49676c 100644 --- a/__fixtures__/v-next/outputicjs/ibc/core/client/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/core/client/v1/query.rpc.func.ts @@ -1,89 +1,89 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { QueryClientStateRequest, QueryClientStateResponse, QueryClientStatesRequest, QueryClientStatesResponse, QueryConsensusStateRequest, QueryConsensusStateResponse, QueryConsensusStatesRequest, QueryConsensusStatesResponse, QueryClientStatusRequest, QueryClientStatusResponse, QueryClientParamsRequest, QueryClientParamsResponse, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse } from "./query"; -export const createGetClientState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClientState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClientStateRequest.encode, decode: QueryClientStateResponse.decode, service: "ibc.core.client.v1.Query", method: "ClientState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClientState = buildUseQuery({ builderQueryFn: createGetClientState, queryKeyPrefix: "ClientStateQuery" }); -export const createGetClientStates = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClientStates = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClientStatesRequest.encode, decode: QueryClientStatesResponse.decode, service: "ibc.core.client.v1.Query", method: "ClientStates", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClientStates = buildUseQuery({ builderQueryFn: createGetClientStates, queryKeyPrefix: "ClientStatesQuery" }); -export const createGetConsensusState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConsensusState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConsensusStateRequest.encode, decode: QueryConsensusStateResponse.decode, service: "ibc.core.client.v1.Query", method: "ConsensusState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConsensusState = buildUseQuery({ builderQueryFn: createGetConsensusState, queryKeyPrefix: "ConsensusStateQuery" }); -export const createGetConsensusStates = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConsensusStates = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConsensusStatesRequest.encode, decode: QueryConsensusStatesResponse.decode, service: "ibc.core.client.v1.Query", method: "ConsensusStates", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConsensusStates = buildUseQuery({ builderQueryFn: createGetConsensusStates, queryKeyPrefix: "ConsensusStatesQuery" }); -export const createGetClientStatus = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClientStatus = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClientStatusRequest.encode, decode: QueryClientStatusResponse.decode, service: "ibc.core.client.v1.Query", method: "ClientStatus", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClientStatus = buildUseQuery({ builderQueryFn: createGetClientStatus, queryKeyPrefix: "ClientStatusQuery" }); -export const createGetClientParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClientParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClientParamsRequest.encode, decode: QueryClientParamsResponse.decode, service: "ibc.core.client.v1.Query", method: "ClientParams", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClientParams = buildUseQuery({ builderQueryFn: createGetClientParams, queryKeyPrefix: "ClientParamsQuery" }); -export const createGetUpgradedClientState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUpgradedClientState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryUpgradedClientStateRequest.encode, decode: QueryUpgradedClientStateResponse.decode, service: "ibc.core.client.v1.Query", method: "UpgradedClientState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUpgradedClientState = buildUseQuery({ builderQueryFn: createGetUpgradedClientState, queryKeyPrefix: "UpgradedClientStateQuery" }); -export const createGetUpgradedConsensusState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUpgradedConsensusState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryUpgradedConsensusStateRequest.encode, decode: QueryUpgradedConsensusStateResponse.decode, service: "ibc.core.client.v1.Query", method: "UpgradedConsensusState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUpgradedConsensusState = buildUseQuery({ builderQueryFn: createGetUpgradedConsensusState, diff --git a/__fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.rpc.func.ts index 3ebc15c29..cca711914 100644 --- a/__fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/core/client/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; -export const createCreateClient = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateClient = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateClient.typeUrl, encoders: toEncoders(MsgCreateClient), converters: toConverters(MsgCreateClient) @@ -11,8 +11,8 @@ export const createCreateClient = (getSigningClient: SigningClientResolver) => b export const useCreateClient = buildUseMutation({ builderMutationFn: createCreateClient }); -export const createUpdateClient = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpdateClient = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpdateClient.typeUrl, encoders: toEncoders(MsgUpdateClient), converters: toConverters(MsgUpdateClient) @@ -20,8 +20,8 @@ export const createUpdateClient = (getSigningClient: SigningClientResolver) => b export const useUpdateClient = buildUseMutation({ builderMutationFn: createUpdateClient }); -export const createUpgradeClient = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUpgradeClient = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUpgradeClient.typeUrl, encoders: toEncoders(MsgUpgradeClient), converters: toConverters(MsgUpgradeClient) @@ -29,8 +29,8 @@ export const createUpgradeClient = (getSigningClient: SigningClientResolver) => export const useUpgradeClient = buildUseMutation({ builderMutationFn: createUpgradeClient }); -export const createSubmitMisbehaviour = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSubmitMisbehaviour = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSubmitMisbehaviour.typeUrl, encoders: toEncoders(MsgSubmitMisbehaviour), converters: toConverters(MsgSubmitMisbehaviour) diff --git a/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/query.rpc.func.ts index fab80a121..ef1d04ffe 100644 --- a/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/query.rpc.func.ts @@ -1,56 +1,56 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { QueryConnectionRequest, QueryConnectionResponse, QueryConnectionsRequest, QueryConnectionsResponse, QueryClientConnectionsRequest, QueryClientConnectionsResponse, QueryConnectionClientStateRequest, QueryConnectionClientStateResponse, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponse } from "./query"; -export const createGetConnection = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConnection = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConnectionRequest.encode, decode: QueryConnectionResponse.decode, service: "ibc.core.connection.v1.Query", method: "Connection", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConnection = buildUseQuery({ builderQueryFn: createGetConnection, queryKeyPrefix: "ConnectionQuery" }); -export const createGetConnections = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConnections = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConnectionsRequest.encode, decode: QueryConnectionsResponse.decode, service: "ibc.core.connection.v1.Query", method: "Connections", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConnections = buildUseQuery({ builderQueryFn: createGetConnections, queryKeyPrefix: "ConnectionsQuery" }); -export const createGetClientConnections = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClientConnections = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClientConnectionsRequest.encode, decode: QueryClientConnectionsResponse.decode, service: "ibc.core.connection.v1.Query", method: "ClientConnections", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClientConnections = buildUseQuery({ builderQueryFn: createGetClientConnections, queryKeyPrefix: "ClientConnectionsQuery" }); -export const createGetConnectionClientState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConnectionClientState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConnectionClientStateRequest.encode, decode: QueryConnectionClientStateResponse.decode, service: "ibc.core.connection.v1.Query", method: "ConnectionClientState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConnectionClientState = buildUseQuery({ builderQueryFn: createGetConnectionClientState, queryKeyPrefix: "ConnectionClientStateQuery" }); -export const createGetConnectionConsensusState = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConnectionConsensusState = (clientResolver: RpcResolver) => buildQuery({ encode: QueryConnectionConsensusStateRequest.encode, decode: QueryConnectionConsensusStateResponse.decode, service: "ibc.core.connection.v1.Query", method: "ConnectionConsensusState", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConnectionConsensusState = buildUseQuery({ builderQueryFn: createGetConnectionConsensusState, diff --git a/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.rpc.func.ts index 750421514..fcd17dbb1 100644 --- a/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/core/connection/v1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm } from "./tx"; -export const createConnectionOpenInit = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createConnectionOpenInit = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgConnectionOpenInit.typeUrl, encoders: toEncoders(MsgConnectionOpenInit), converters: toConverters(MsgConnectionOpenInit) @@ -11,8 +11,8 @@ export const createConnectionOpenInit = (getSigningClient: SigningClientResolver export const useConnectionOpenInit = buildUseMutation({ builderMutationFn: createConnectionOpenInit }); -export const createConnectionOpenTry = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createConnectionOpenTry = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgConnectionOpenTry.typeUrl, encoders: toEncoders(MsgConnectionOpenTry), converters: toConverters(MsgConnectionOpenTry) @@ -20,8 +20,8 @@ export const createConnectionOpenTry = (getSigningClient: SigningClientResolver) export const useConnectionOpenTry = buildUseMutation({ builderMutationFn: createConnectionOpenTry }); -export const createConnectionOpenAck = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createConnectionOpenAck = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgConnectionOpenAck.typeUrl, encoders: toEncoders(MsgConnectionOpenAck), converters: toConverters(MsgConnectionOpenAck) @@ -29,8 +29,8 @@ export const createConnectionOpenAck = (getSigningClient: SigningClientResolver) export const useConnectionOpenAck = buildUseMutation({ builderMutationFn: createConnectionOpenAck }); -export const createConnectionOpenConfirm = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createConnectionOpenConfirm = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgConnectionOpenConfirm.typeUrl, encoders: toEncoders(MsgConnectionOpenConfirm), converters: toConverters(MsgConnectionOpenConfirm) diff --git a/__fixtures__/v-next/outputicjs/ibc/core/port/v1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/ibc/core/port/v1/query.rpc.func.ts index b0fa0bced..8c82a3fe1 100644 --- a/__fixtures__/v-next/outputicjs/ibc/core/port/v1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/ibc/core/port/v1/query.rpc.func.ts @@ -1,12 +1,12 @@ import { RpcResolver, buildQuery } from "../../../../helper-func-types"; import { buildUseQuery } from "../../../../react-query"; import { QueryAppVersionRequest, QueryAppVersionResponse } from "./query"; -export const createGetAppVersion = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAppVersion = (clientResolver: RpcResolver) => buildQuery({ encode: QueryAppVersionRequest.encode, decode: QueryAppVersionResponse.decode, service: "ibc.core.port.v1.Query", method: "AppVersion", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAppVersion = buildUseQuery({ builderQueryFn: createGetAppVersion, diff --git a/__fixtures__/v-next/outputicjs/osmosis/claim/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/claim/v1beta1/query.rpc.func.ts index ca1263950..03d1dde6a 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/claim/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/claim/v1beta1/query.rpc.func.ts @@ -1,56 +1,56 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryModuleAccountBalanceRequest, QueryModuleAccountBalanceResponse, QueryParamsRequest, QueryParamsResponse, QueryClaimRecordRequest, QueryClaimRecordResponse, QueryClaimableForActionRequest, QueryClaimableForActionResponse, QueryTotalClaimableRequest, QueryTotalClaimableResponse } from "./query"; -export const createGetModuleAccountBalance = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetModuleAccountBalance = (clientResolver: RpcResolver) => buildQuery({ encode: QueryModuleAccountBalanceRequest.encode, decode: QueryModuleAccountBalanceResponse.decode, service: "osmosis.claim.v1beta1.Query", method: "ModuleAccountBalance", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetModuleAccountBalance = buildUseQuery({ builderQueryFn: createGetModuleAccountBalance, queryKeyPrefix: "ModuleAccountBalanceQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "osmosis.claim.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetClaimRecord = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClaimRecord = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClaimRecordRequest.encode, decode: QueryClaimRecordResponse.decode, service: "osmosis.claim.v1beta1.Query", method: "ClaimRecord", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClaimRecord = buildUseQuery({ builderQueryFn: createGetClaimRecord, queryKeyPrefix: "ClaimRecordQuery" }); -export const createGetClaimableForAction = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetClaimableForAction = (clientResolver: RpcResolver) => buildQuery({ encode: QueryClaimableForActionRequest.encode, decode: QueryClaimableForActionResponse.decode, service: "osmosis.claim.v1beta1.Query", method: "ClaimableForAction", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetClaimableForAction = buildUseQuery({ builderQueryFn: createGetClaimableForAction, queryKeyPrefix: "ClaimableForActionQuery" }); -export const createGetTotalClaimable = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalClaimable = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalClaimableRequest.encode, decode: QueryTotalClaimableResponse.decode, service: "osmosis.claim.v1beta1.Query", method: "TotalClaimable", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalClaimable = buildUseQuery({ builderQueryFn: createGetTotalClaimable, diff --git a/__fixtures__/v-next/outputicjs/osmosis/epochs/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/epochs/query.rpc.func.ts index d34b5a2a7..ede9bdbb0 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/epochs/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/epochs/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../helper-func-types"; import { buildUseQuery } from "../../react-query"; import { QueryEpochsInfoRequest, QueryEpochsInfoResponse, QueryCurrentEpochRequest, QueryCurrentEpochResponse } from "./query"; -export const createGetEpochInfos = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEpochInfos = (clientResolver: RpcResolver) => buildQuery({ encode: QueryEpochsInfoRequest.encode, decode: QueryEpochsInfoResponse.decode, service: "osmosis.epochs.v1beta1.Query", method: "EpochInfos", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEpochInfos = buildUseQuery({ builderQueryFn: createGetEpochInfos, queryKeyPrefix: "EpochInfosQuery" }); -export const createGetCurrentEpoch = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCurrentEpoch = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCurrentEpochRequest.encode, decode: QueryCurrentEpochResponse.decode, service: "osmosis.epochs.v1beta1.Query", method: "CurrentEpoch", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCurrentEpoch = buildUseQuery({ builderQueryFn: createGetCurrentEpoch, diff --git a/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts index 6b704e311..debe4fc35 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/balancer/tx/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../../../helper-func-types import { buildUseMutation } from "../../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateBalancerPool } from "./tx"; -export const createCreateBalancerPool = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateBalancerPool = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateBalancerPool.typeUrl, encoders: toEncoders(MsgCreateBalancerPool), converters: toConverters(MsgCreateBalancerPool) diff --git a/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts index 32688ca5c..60dd23607 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/pool-models/stableswap/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateStableswapPool, MsgStableSwapAdjustScalingFactors } from "./tx"; -export const createCreateStableswapPool = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateStableswapPool = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateStableswapPool.typeUrl, encoders: toEncoders(MsgCreateStableswapPool), converters: toConverters(MsgCreateStableswapPool) @@ -11,8 +11,8 @@ export const createCreateStableswapPool = (getSigningClient: SigningClientResolv export const useCreateStableswapPool = buildUseMutation({ builderMutationFn: createCreateStableswapPool }); -export const createStableSwapAdjustScalingFactors = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createStableSwapAdjustScalingFactors = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgStableSwapAdjustScalingFactors.typeUrl, encoders: toEncoders(MsgStableSwapAdjustScalingFactors), converters: toConverters(MsgStableSwapAdjustScalingFactors) diff --git a/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/query.rpc.func.ts index 3a09ed900..6c06fda75 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/query.rpc.func.ts @@ -1,166 +1,166 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryPoolsRequest, QueryPoolsResponse, QueryNumPoolsRequest, QueryNumPoolsResponse, QueryTotalLiquidityRequest, QueryTotalLiquidityResponse, QueryPoolsWithFilterRequest, QueryPoolsWithFilterResponse, QueryPoolRequest, QueryPoolResponse, QueryPoolTypeRequest, QueryPoolTypeResponse, QueryCalcJoinPoolNoSwapSharesRequest, QueryCalcJoinPoolNoSwapSharesResponse, QueryCalcJoinPoolSharesRequest, QueryCalcJoinPoolSharesResponse, QueryCalcExitPoolCoinsFromSharesRequest, QueryCalcExitPoolCoinsFromSharesResponse, QueryPoolParamsRequest, QueryPoolParamsResponse, QueryTotalPoolLiquidityRequest, QueryTotalPoolLiquidityResponse, QueryTotalSharesRequest, QueryTotalSharesResponse, QuerySpotPriceRequest, QuerySpotPriceResponse, QuerySwapExactAmountInRequest, QuerySwapExactAmountInResponse, QuerySwapExactAmountOutRequest, QuerySwapExactAmountOutResponse } from "./query"; -export const createGetPools = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPools = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPoolsRequest.encode, decode: QueryPoolsResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "Pools", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPools = buildUseQuery({ builderQueryFn: createGetPools, queryKeyPrefix: "PoolsQuery" }); -export const createGetNumPools = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetNumPools = (clientResolver: RpcResolver) => buildQuery({ encode: QueryNumPoolsRequest.encode, decode: QueryNumPoolsResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "NumPools", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetNumPools = buildUseQuery({ builderQueryFn: createGetNumPools, queryKeyPrefix: "NumPoolsQuery" }); -export const createGetTotalLiquidity = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalLiquidity = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalLiquidityRequest.encode, decode: QueryTotalLiquidityResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "TotalLiquidity", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalLiquidity = buildUseQuery({ builderQueryFn: createGetTotalLiquidity, queryKeyPrefix: "TotalLiquidityQuery" }); -export const createGetPoolsWithFilter = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPoolsWithFilter = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPoolsWithFilterRequest.encode, decode: QueryPoolsWithFilterResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "PoolsWithFilter", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPoolsWithFilter = buildUseQuery({ builderQueryFn: createGetPoolsWithFilter, queryKeyPrefix: "PoolsWithFilterQuery" }); -export const createGetPool = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPool = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPoolRequest.encode, decode: QueryPoolResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "Pool", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPool = buildUseQuery({ builderQueryFn: createGetPool, queryKeyPrefix: "PoolQuery" }); -export const createGetPoolType = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPoolType = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPoolTypeRequest.encode, decode: QueryPoolTypeResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "PoolType", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPoolType = buildUseQuery({ builderQueryFn: createGetPoolType, queryKeyPrefix: "PoolTypeQuery" }); -export const createGetCalcJoinPoolNoSwapShares = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCalcJoinPoolNoSwapShares = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCalcJoinPoolNoSwapSharesRequest.encode, decode: QueryCalcJoinPoolNoSwapSharesResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "CalcJoinPoolNoSwapShares", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCalcJoinPoolNoSwapShares = buildUseQuery({ builderQueryFn: createGetCalcJoinPoolNoSwapShares, queryKeyPrefix: "CalcJoinPoolNoSwapSharesQuery" }); -export const createGetCalcJoinPoolShares = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCalcJoinPoolShares = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCalcJoinPoolSharesRequest.encode, decode: QueryCalcJoinPoolSharesResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "CalcJoinPoolShares", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCalcJoinPoolShares = buildUseQuery({ builderQueryFn: createGetCalcJoinPoolShares, queryKeyPrefix: "CalcJoinPoolSharesQuery" }); -export const createGetCalcExitPoolCoinsFromShares = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCalcExitPoolCoinsFromShares = (clientResolver: RpcResolver) => buildQuery({ encode: QueryCalcExitPoolCoinsFromSharesRequest.encode, decode: QueryCalcExitPoolCoinsFromSharesResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "CalcExitPoolCoinsFromShares", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCalcExitPoolCoinsFromShares = buildUseQuery({ builderQueryFn: createGetCalcExitPoolCoinsFromShares, queryKeyPrefix: "CalcExitPoolCoinsFromSharesQuery" }); -export const createGetPoolParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetPoolParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryPoolParamsRequest.encode, decode: QueryPoolParamsResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "PoolParams", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetPoolParams = buildUseQuery({ builderQueryFn: createGetPoolParams, queryKeyPrefix: "PoolParamsQuery" }); -export const createGetTotalPoolLiquidity = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalPoolLiquidity = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalPoolLiquidityRequest.encode, decode: QueryTotalPoolLiquidityResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "TotalPoolLiquidity", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalPoolLiquidity = buildUseQuery({ builderQueryFn: createGetTotalPoolLiquidity, queryKeyPrefix: "TotalPoolLiquidityQuery" }); -export const createGetTotalShares = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalShares = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalSharesRequest.encode, decode: QueryTotalSharesResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "TotalShares", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalShares = buildUseQuery({ builderQueryFn: createGetTotalShares, queryKeyPrefix: "TotalSharesQuery" }); -export const createGetSpotPrice = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSpotPrice = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySpotPriceRequest.encode, decode: QuerySpotPriceResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "SpotPrice", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSpotPrice = buildUseQuery({ builderQueryFn: createGetSpotPrice, queryKeyPrefix: "SpotPriceQuery" }); -export const createGetEstimateSwapExactAmountIn = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEstimateSwapExactAmountIn = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySwapExactAmountInRequest.encode, decode: QuerySwapExactAmountInResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "EstimateSwapExactAmountIn", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEstimateSwapExactAmountIn = buildUseQuery({ builderQueryFn: createGetEstimateSwapExactAmountIn, queryKeyPrefix: "EstimateSwapExactAmountInQuery" }); -export const createGetEstimateSwapExactAmountOut = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEstimateSwapExactAmountOut = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySwapExactAmountOutRequest.encode, decode: QuerySwapExactAmountOutResponse.decode, service: "osmosis.gamm.v1beta1.Query", method: "EstimateSwapExactAmountOut", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEstimateSwapExactAmountOut = buildUseQuery({ builderQueryFn: createGetEstimateSwapExactAmountOut, diff --git a/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.rpc.func.ts index 5a46540c2..1e0e11c53 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgJoinPool, MsgExitPool, MsgSwapExactAmountIn, MsgSwapExactAmountOut, MsgJoinSwapExternAmountIn, MsgJoinSwapShareAmountOut, MsgExitSwapExternAmountOut, MsgExitSwapShareAmountIn } from "./tx"; -export const createJoinPool = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createJoinPool = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgJoinPool.typeUrl, encoders: toEncoders(MsgJoinPool), converters: toConverters(MsgJoinPool) @@ -11,8 +11,8 @@ export const createJoinPool = (getSigningClient: SigningClientResolver) => build export const useJoinPool = buildUseMutation({ builderMutationFn: createJoinPool }); -export const createExitPool = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExitPool = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExitPool.typeUrl, encoders: toEncoders(MsgExitPool), converters: toConverters(MsgExitPool) @@ -20,8 +20,8 @@ export const createExitPool = (getSigningClient: SigningClientResolver) => build export const useExitPool = buildUseMutation({ builderMutationFn: createExitPool }); -export const createSwapExactAmountIn = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSwapExactAmountIn = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSwapExactAmountIn.typeUrl, encoders: toEncoders(MsgSwapExactAmountIn), converters: toConverters(MsgSwapExactAmountIn) @@ -29,8 +29,8 @@ export const createSwapExactAmountIn = (getSigningClient: SigningClientResolver) export const useSwapExactAmountIn = buildUseMutation({ builderMutationFn: createSwapExactAmountIn }); -export const createSwapExactAmountOut = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSwapExactAmountOut = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSwapExactAmountOut.typeUrl, encoders: toEncoders(MsgSwapExactAmountOut), converters: toConverters(MsgSwapExactAmountOut) @@ -38,8 +38,8 @@ export const createSwapExactAmountOut = (getSigningClient: SigningClientResolver export const useSwapExactAmountOut = buildUseMutation({ builderMutationFn: createSwapExactAmountOut }); -export const createJoinSwapExternAmountIn = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createJoinSwapExternAmountIn = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgJoinSwapExternAmountIn.typeUrl, encoders: toEncoders(MsgJoinSwapExternAmountIn), converters: toConverters(MsgJoinSwapExternAmountIn) @@ -47,8 +47,8 @@ export const createJoinSwapExternAmountIn = (getSigningClient: SigningClientReso export const useJoinSwapExternAmountIn = buildUseMutation({ builderMutationFn: createJoinSwapExternAmountIn }); -export const createJoinSwapShareAmountOut = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createJoinSwapShareAmountOut = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgJoinSwapShareAmountOut.typeUrl, encoders: toEncoders(MsgJoinSwapShareAmountOut), converters: toConverters(MsgJoinSwapShareAmountOut) @@ -56,8 +56,8 @@ export const createJoinSwapShareAmountOut = (getSigningClient: SigningClientReso export const useJoinSwapShareAmountOut = buildUseMutation({ builderMutationFn: createJoinSwapShareAmountOut }); -export const createExitSwapExternAmountOut = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExitSwapExternAmountOut = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExitSwapExternAmountOut.typeUrl, encoders: toEncoders(MsgExitSwapExternAmountOut), converters: toConverters(MsgExitSwapExternAmountOut) @@ -65,8 +65,8 @@ export const createExitSwapExternAmountOut = (getSigningClient: SigningClientRes export const useExitSwapExternAmountOut = buildUseMutation({ builderMutationFn: createExitSwapExternAmountOut }); -export const createExitSwapShareAmountIn = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExitSwapShareAmountIn = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExitSwapShareAmountIn.typeUrl, encoders: toEncoders(MsgExitSwapShareAmountIn), converters: toConverters(MsgExitSwapShareAmountIn) diff --git a/__fixtures__/v-next/outputicjs/osmosis/gamm/v2/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/gamm/v2/query.rpc.func.ts index 396d416da..506e13b49 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/gamm/v2/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/gamm/v2/query.rpc.func.ts @@ -1,12 +1,12 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QuerySpotPriceRequest, QuerySpotPriceResponse } from "./query"; -export const createGetSpotPrice = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSpotPrice = (clientResolver: RpcResolver) => buildQuery({ encode: QuerySpotPriceRequest.encode, decode: QuerySpotPriceResponse.decode, service: "osmosis.gamm.v2.Query", method: "SpotPrice", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSpotPrice = buildUseQuery({ builderQueryFn: createGetSpotPrice, diff --git a/__fixtures__/v-next/outputicjs/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts index 90677d59e..e5b1af301 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/ibc-rate-limit/v1beta1/query.rpc.func.ts @@ -1,12 +1,12 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "osmosis.ibcratelimit.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/osmosis/incentives/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/incentives/query.rpc.func.ts index 6b2e2b717..5d95f970a 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/incentives/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/incentives/query.rpc.func.ts @@ -1,100 +1,100 @@ import { RpcResolver, buildQuery } from "../../helper-func-types"; import { buildUseQuery } from "../../react-query"; import { ModuleToDistributeCoinsRequest, ModuleToDistributeCoinsResponse, GaugeByIDRequest, GaugeByIDResponse, GaugesRequest, GaugesResponse, ActiveGaugesRequest, ActiveGaugesResponse, ActiveGaugesPerDenomRequest, ActiveGaugesPerDenomResponse, UpcomingGaugesRequest, UpcomingGaugesResponse, UpcomingGaugesPerDenomRequest, UpcomingGaugesPerDenomResponse, RewardsEstRequest, RewardsEstResponse, QueryLockableDurationsRequest, QueryLockableDurationsResponse } from "./query"; -export const createGetModuleToDistributeCoins = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetModuleToDistributeCoins = (clientResolver: RpcResolver) => buildQuery({ encode: ModuleToDistributeCoinsRequest.encode, decode: ModuleToDistributeCoinsResponse.decode, service: "osmosis.incentives.Query", method: "ModuleToDistributeCoins", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetModuleToDistributeCoins = buildUseQuery({ builderQueryFn: createGetModuleToDistributeCoins, queryKeyPrefix: "ModuleToDistributeCoinsQuery" }); -export const createGetGaugeByID = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGaugeByID = (clientResolver: RpcResolver) => buildQuery({ encode: GaugeByIDRequest.encode, decode: GaugeByIDResponse.decode, service: "osmosis.incentives.Query", method: "GaugeByID", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGaugeByID = buildUseQuery({ builderQueryFn: createGetGaugeByID, queryKeyPrefix: "GaugeByIDQuery" }); -export const createGetGauges = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGauges = (clientResolver: RpcResolver) => buildQuery({ encode: GaugesRequest.encode, decode: GaugesResponse.decode, service: "osmosis.incentives.Query", method: "Gauges", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGauges = buildUseQuery({ builderQueryFn: createGetGauges, queryKeyPrefix: "GaugesQuery" }); -export const createGetActiveGauges = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetActiveGauges = (clientResolver: RpcResolver) => buildQuery({ encode: ActiveGaugesRequest.encode, decode: ActiveGaugesResponse.decode, service: "osmosis.incentives.Query", method: "ActiveGauges", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetActiveGauges = buildUseQuery({ builderQueryFn: createGetActiveGauges, queryKeyPrefix: "ActiveGaugesQuery" }); -export const createGetActiveGaugesPerDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetActiveGaugesPerDenom = (clientResolver: RpcResolver) => buildQuery({ encode: ActiveGaugesPerDenomRequest.encode, decode: ActiveGaugesPerDenomResponse.decode, service: "osmosis.incentives.Query", method: "ActiveGaugesPerDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetActiveGaugesPerDenom = buildUseQuery({ builderQueryFn: createGetActiveGaugesPerDenom, queryKeyPrefix: "ActiveGaugesPerDenomQuery" }); -export const createGetUpcomingGauges = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUpcomingGauges = (clientResolver: RpcResolver) => buildQuery({ encode: UpcomingGaugesRequest.encode, decode: UpcomingGaugesResponse.decode, service: "osmosis.incentives.Query", method: "UpcomingGauges", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUpcomingGauges = buildUseQuery({ builderQueryFn: createGetUpcomingGauges, queryKeyPrefix: "UpcomingGaugesQuery" }); -export const createGetUpcomingGaugesPerDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUpcomingGaugesPerDenom = (clientResolver: RpcResolver) => buildQuery({ encode: UpcomingGaugesPerDenomRequest.encode, decode: UpcomingGaugesPerDenomResponse.decode, service: "osmosis.incentives.Query", method: "UpcomingGaugesPerDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUpcomingGaugesPerDenom = buildUseQuery({ builderQueryFn: createGetUpcomingGaugesPerDenom, queryKeyPrefix: "UpcomingGaugesPerDenomQuery" }); -export const createGetRewardsEst = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetRewardsEst = (clientResolver: RpcResolver) => buildQuery({ encode: RewardsEstRequest.encode, decode: RewardsEstResponse.decode, service: "osmosis.incentives.Query", method: "RewardsEst", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetRewardsEst = buildUseQuery({ builderQueryFn: createGetRewardsEst, queryKeyPrefix: "RewardsEstQuery" }); -export const createGetLockableDurations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetLockableDurations = (clientResolver: RpcResolver) => buildQuery({ encode: QueryLockableDurationsRequest.encode, decode: QueryLockableDurationsResponse.decode, service: "osmosis.incentives.Query", method: "LockableDurations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetLockableDurations = buildUseQuery({ builderQueryFn: createGetLockableDurations, diff --git a/__fixtures__/v-next/outputicjs/osmosis/incentives/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/incentives/tx.rpc.func.ts index 31a386751..4b2104e89 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/incentives/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/incentives/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../helper-func-types"; import { buildUseMutation } from "../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateGauge, MsgAddToGauge } from "./tx"; -export const createCreateGauge = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateGauge = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateGauge.typeUrl, encoders: toEncoders(MsgCreateGauge), converters: toConverters(MsgCreateGauge) @@ -11,8 +11,8 @@ export const createCreateGauge = (getSigningClient: SigningClientResolver) => bu export const useCreateGauge = buildUseMutation({ builderMutationFn: createCreateGauge }); -export const createAddToGauge = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createAddToGauge = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgAddToGauge.typeUrl, encoders: toEncoders(MsgAddToGauge), converters: toConverters(MsgAddToGauge) diff --git a/__fixtures__/v-next/outputicjs/osmosis/lockup/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/lockup/query.rpc.func.ts index 246a365e3..35052e4fb 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/lockup/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/lockup/query.rpc.func.ts @@ -1,188 +1,188 @@ import { RpcResolver, buildQuery } from "../../helper-func-types"; import { buildUseQuery } from "../../react-query"; import { ModuleBalanceRequest, ModuleBalanceResponse, ModuleLockedAmountRequest, ModuleLockedAmountResponse, AccountUnlockableCoinsRequest, AccountUnlockableCoinsResponse, AccountUnlockingCoinsRequest, AccountUnlockingCoinsResponse, AccountLockedCoinsRequest, AccountLockedCoinsResponse, AccountLockedPastTimeRequest, AccountLockedPastTimeResponse, AccountLockedPastTimeNotUnlockingOnlyRequest, AccountLockedPastTimeNotUnlockingOnlyResponse, AccountUnlockedBeforeTimeRequest, AccountUnlockedBeforeTimeResponse, AccountLockedPastTimeDenomRequest, AccountLockedPastTimeDenomResponse, LockedDenomRequest, LockedDenomResponse, LockedRequest, LockedResponse, SyntheticLockupsByLockupIDRequest, SyntheticLockupsByLockupIDResponse, AccountLockedLongerDurationRequest, AccountLockedLongerDurationResponse, AccountLockedDurationRequest, AccountLockedDurationResponse, AccountLockedLongerDurationNotUnlockingOnlyRequest, AccountLockedLongerDurationNotUnlockingOnlyResponse, AccountLockedLongerDurationDenomRequest, AccountLockedLongerDurationDenomResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; -export const createGetModuleBalance = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetModuleBalance = (clientResolver: RpcResolver) => buildQuery({ encode: ModuleBalanceRequest.encode, decode: ModuleBalanceResponse.decode, service: "osmosis.lockup.Query", method: "ModuleBalance", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetModuleBalance = buildUseQuery({ builderQueryFn: createGetModuleBalance, queryKeyPrefix: "ModuleBalanceQuery" }); -export const createGetModuleLockedAmount = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetModuleLockedAmount = (clientResolver: RpcResolver) => buildQuery({ encode: ModuleLockedAmountRequest.encode, decode: ModuleLockedAmountResponse.decode, service: "osmosis.lockup.Query", method: "ModuleLockedAmount", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetModuleLockedAmount = buildUseQuery({ builderQueryFn: createGetModuleLockedAmount, queryKeyPrefix: "ModuleLockedAmountQuery" }); -export const createGetAccountUnlockableCoins = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountUnlockableCoins = (clientResolver: RpcResolver) => buildQuery({ encode: AccountUnlockableCoinsRequest.encode, decode: AccountUnlockableCoinsResponse.decode, service: "osmosis.lockup.Query", method: "AccountUnlockableCoins", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountUnlockableCoins = buildUseQuery({ builderQueryFn: createGetAccountUnlockableCoins, queryKeyPrefix: "AccountUnlockableCoinsQuery" }); -export const createGetAccountUnlockingCoins = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountUnlockingCoins = (clientResolver: RpcResolver) => buildQuery({ encode: AccountUnlockingCoinsRequest.encode, decode: AccountUnlockingCoinsResponse.decode, service: "osmosis.lockup.Query", method: "AccountUnlockingCoins", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountUnlockingCoins = buildUseQuery({ builderQueryFn: createGetAccountUnlockingCoins, queryKeyPrefix: "AccountUnlockingCoinsQuery" }); -export const createGetAccountLockedCoins = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedCoins = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedCoinsRequest.encode, decode: AccountLockedCoinsResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedCoins", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedCoins = buildUseQuery({ builderQueryFn: createGetAccountLockedCoins, queryKeyPrefix: "AccountLockedCoinsQuery" }); -export const createGetAccountLockedPastTime = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedPastTime = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedPastTimeRequest.encode, decode: AccountLockedPastTimeResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedPastTime", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedPastTime = buildUseQuery({ builderQueryFn: createGetAccountLockedPastTime, queryKeyPrefix: "AccountLockedPastTimeQuery" }); -export const createGetAccountLockedPastTimeNotUnlockingOnly = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedPastTimeNotUnlockingOnly = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedPastTimeNotUnlockingOnlyRequest.encode, decode: AccountLockedPastTimeNotUnlockingOnlyResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedPastTimeNotUnlockingOnly", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedPastTimeNotUnlockingOnly = buildUseQuery({ builderQueryFn: createGetAccountLockedPastTimeNotUnlockingOnly, queryKeyPrefix: "AccountLockedPastTimeNotUnlockingOnlyQuery" }); -export const createGetAccountUnlockedBeforeTime = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountUnlockedBeforeTime = (clientResolver: RpcResolver) => buildQuery({ encode: AccountUnlockedBeforeTimeRequest.encode, decode: AccountUnlockedBeforeTimeResponse.decode, service: "osmosis.lockup.Query", method: "AccountUnlockedBeforeTime", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountUnlockedBeforeTime = buildUseQuery({ builderQueryFn: createGetAccountUnlockedBeforeTime, queryKeyPrefix: "AccountUnlockedBeforeTimeQuery" }); -export const createGetAccountLockedPastTimeDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedPastTimeDenom = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedPastTimeDenomRequest.encode, decode: AccountLockedPastTimeDenomResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedPastTimeDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedPastTimeDenom = buildUseQuery({ builderQueryFn: createGetAccountLockedPastTimeDenom, queryKeyPrefix: "AccountLockedPastTimeDenomQuery" }); -export const createGetLockedDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetLockedDenom = (clientResolver: RpcResolver) => buildQuery({ encode: LockedDenomRequest.encode, decode: LockedDenomResponse.decode, service: "osmosis.lockup.Query", method: "LockedDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetLockedDenom = buildUseQuery({ builderQueryFn: createGetLockedDenom, queryKeyPrefix: "LockedDenomQuery" }); -export const createGetLockedByID = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetLockedByID = (clientResolver: RpcResolver) => buildQuery({ encode: LockedRequest.encode, decode: LockedResponse.decode, service: "osmosis.lockup.Query", method: "LockedByID", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetLockedByID = buildUseQuery({ builderQueryFn: createGetLockedByID, queryKeyPrefix: "LockedByIDQuery" }); -export const createGetSyntheticLockupsByLockupID = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSyntheticLockupsByLockupID = (clientResolver: RpcResolver) => buildQuery({ encode: SyntheticLockupsByLockupIDRequest.encode, decode: SyntheticLockupsByLockupIDResponse.decode, service: "osmosis.lockup.Query", method: "SyntheticLockupsByLockupID", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSyntheticLockupsByLockupID = buildUseQuery({ builderQueryFn: createGetSyntheticLockupsByLockupID, queryKeyPrefix: "SyntheticLockupsByLockupIDQuery" }); -export const createGetAccountLockedLongerDuration = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedLongerDuration = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedLongerDurationRequest.encode, decode: AccountLockedLongerDurationResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedLongerDuration", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedLongerDuration = buildUseQuery({ builderQueryFn: createGetAccountLockedLongerDuration, queryKeyPrefix: "AccountLockedLongerDurationQuery" }); -export const createGetAccountLockedDuration = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedDuration = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedDurationRequest.encode, decode: AccountLockedDurationResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedDuration", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedDuration = buildUseQuery({ builderQueryFn: createGetAccountLockedDuration, queryKeyPrefix: "AccountLockedDurationQuery" }); -export const createGetAccountLockedLongerDurationNotUnlockingOnly = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedLongerDurationNotUnlockingOnly = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedLongerDurationNotUnlockingOnlyRequest.encode, decode: AccountLockedLongerDurationNotUnlockingOnlyResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedLongerDurationNotUnlockingOnly", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedLongerDurationNotUnlockingOnly = buildUseQuery({ builderQueryFn: createGetAccountLockedLongerDurationNotUnlockingOnly, queryKeyPrefix: "AccountLockedLongerDurationNotUnlockingOnlyQuery" }); -export const createGetAccountLockedLongerDurationDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAccountLockedLongerDurationDenom = (clientResolver: RpcResolver) => buildQuery({ encode: AccountLockedLongerDurationDenomRequest.encode, decode: AccountLockedLongerDurationDenomResponse.decode, service: "osmosis.lockup.Query", method: "AccountLockedLongerDurationDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAccountLockedLongerDurationDenom = buildUseQuery({ builderQueryFn: createGetAccountLockedLongerDurationDenom, queryKeyPrefix: "AccountLockedLongerDurationDenomQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "osmosis.lockup.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, diff --git a/__fixtures__/v-next/outputicjs/osmosis/lockup/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/lockup/tx.rpc.func.ts index 86b5769c4..3cb2959ab 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/lockup/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/lockup/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../helper-func-types"; import { buildUseMutation } from "../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgLockTokens, MsgBeginUnlockingAll, MsgBeginUnlocking, MsgExtendLockup, MsgForceUnlock } from "./tx"; -export const createLockTokens = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createLockTokens = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgLockTokens.typeUrl, encoders: toEncoders(MsgLockTokens), converters: toConverters(MsgLockTokens) @@ -11,8 +11,8 @@ export const createLockTokens = (getSigningClient: SigningClientResolver) => bui export const useLockTokens = buildUseMutation({ builderMutationFn: createLockTokens }); -export const createBeginUnlockingAll = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createBeginUnlockingAll = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgBeginUnlockingAll.typeUrl, encoders: toEncoders(MsgBeginUnlockingAll), converters: toConverters(MsgBeginUnlockingAll) @@ -20,8 +20,8 @@ export const createBeginUnlockingAll = (getSigningClient: SigningClientResolver) export const useBeginUnlockingAll = buildUseMutation({ builderMutationFn: createBeginUnlockingAll }); -export const createBeginUnlocking = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createBeginUnlocking = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgBeginUnlocking.typeUrl, encoders: toEncoders(MsgBeginUnlocking), converters: toConverters(MsgBeginUnlocking) @@ -29,8 +29,8 @@ export const createBeginUnlocking = (getSigningClient: SigningClientResolver) => export const useBeginUnlocking = buildUseMutation({ builderMutationFn: createBeginUnlocking }); -export const createExtendLockup = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createExtendLockup = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgExtendLockup.typeUrl, encoders: toEncoders(MsgExtendLockup), converters: toConverters(MsgExtendLockup) @@ -38,8 +38,8 @@ export const createExtendLockup = (getSigningClient: SigningClientResolver) => b export const useExtendLockup = buildUseMutation({ builderMutationFn: createExtendLockup }); -export const createForceUnlock = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createForceUnlock = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgForceUnlock.typeUrl, encoders: toEncoders(MsgForceUnlock), converters: toConverters(MsgForceUnlock) diff --git a/__fixtures__/v-next/outputicjs/osmosis/mint/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/mint/v1beta1/query.rpc.func.ts index cdd710661..d47d47567 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/mint/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/mint/v1beta1/query.rpc.func.ts @@ -1,23 +1,23 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse, QueryEpochProvisionsRequest, QueryEpochProvisionsResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "osmosis.mint.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetEpochProvisions = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEpochProvisions = (clientResolver: RpcResolver) => buildQuery({ encode: QueryEpochProvisionsRequest.encode, decode: QueryEpochProvisionsResponse.decode, service: "osmosis.mint.v1beta1.Query", method: "EpochProvisions", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEpochProvisions = buildUseQuery({ builderQueryFn: createGetEpochProvisions, diff --git a/__fixtures__/v-next/outputicjs/osmosis/pool-incentives/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/pool-incentives/v1beta1/query.rpc.func.ts index 6df48340d..e60aa51e5 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/pool-incentives/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/pool-incentives/v1beta1/query.rpc.func.ts @@ -1,67 +1,67 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryGaugeIdsRequest, QueryGaugeIdsResponse, QueryDistrInfoRequest, QueryDistrInfoResponse, QueryParamsRequest, QueryParamsResponse, QueryLockableDurationsRequest, QueryLockableDurationsResponse, QueryIncentivizedPoolsRequest, QueryIncentivizedPoolsResponse, QueryExternalIncentiveGaugesRequest, QueryExternalIncentiveGaugesResponse } from "./query"; -export const createGetGaugeIds = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetGaugeIds = (clientResolver: RpcResolver) => buildQuery({ encode: QueryGaugeIdsRequest.encode, decode: QueryGaugeIdsResponse.decode, service: "osmosis.poolincentives.v1beta1.Query", method: "GaugeIds", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetGaugeIds = buildUseQuery({ builderQueryFn: createGetGaugeIds, queryKeyPrefix: "GaugeIdsQuery" }); -export const createGetDistrInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDistrInfo = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDistrInfoRequest.encode, decode: QueryDistrInfoResponse.decode, service: "osmosis.poolincentives.v1beta1.Query", method: "DistrInfo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDistrInfo = buildUseQuery({ builderQueryFn: createGetDistrInfo, queryKeyPrefix: "DistrInfoQuery" }); -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "osmosis.poolincentives.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetLockableDurations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetLockableDurations = (clientResolver: RpcResolver) => buildQuery({ encode: QueryLockableDurationsRequest.encode, decode: QueryLockableDurationsResponse.decode, service: "osmosis.poolincentives.v1beta1.Query", method: "LockableDurations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetLockableDurations = buildUseQuery({ builderQueryFn: createGetLockableDurations, queryKeyPrefix: "LockableDurationsQuery" }); -export const createGetIncentivizedPools = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetIncentivizedPools = (clientResolver: RpcResolver) => buildQuery({ encode: QueryIncentivizedPoolsRequest.encode, decode: QueryIncentivizedPoolsResponse.decode, service: "osmosis.poolincentives.v1beta1.Query", method: "IncentivizedPools", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetIncentivizedPools = buildUseQuery({ builderQueryFn: createGetIncentivizedPools, queryKeyPrefix: "IncentivizedPoolsQuery" }); -export const createGetExternalIncentiveGauges = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetExternalIncentiveGauges = (clientResolver: RpcResolver) => buildQuery({ encode: QueryExternalIncentiveGaugesRequest.encode, decode: QueryExternalIncentiveGaugesResponse.decode, service: "osmosis.poolincentives.v1beta1.Query", method: "ExternalIncentiveGauges", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetExternalIncentiveGauges = buildUseQuery({ builderQueryFn: createGetExternalIncentiveGauges, diff --git a/__fixtures__/v-next/outputicjs/osmosis/superfluid/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/superfluid/query.rpc.func.ts index ed3e0825c..47517101d 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/superfluid/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/superfluid/query.rpc.func.ts @@ -1,166 +1,166 @@ import { RpcResolver, buildQuery } from "../../helper-func-types"; import { buildUseQuery } from "../../react-query"; import { QueryParamsRequest, QueryParamsResponse, AssetTypeRequest, AssetTypeResponse, AllAssetsRequest, AllAssetsResponse, AssetMultiplierRequest, AssetMultiplierResponse, AllIntermediaryAccountsRequest, AllIntermediaryAccountsResponse, ConnectedIntermediaryAccountRequest, ConnectedIntermediaryAccountResponse, QueryTotalDelegationByValidatorForDenomRequest, QueryTotalDelegationByValidatorForDenomResponse, TotalSuperfluidDelegationsRequest, TotalSuperfluidDelegationsResponse, SuperfluidDelegationAmountRequest, SuperfluidDelegationAmountResponse, SuperfluidDelegationsByDelegatorRequest, SuperfluidDelegationsByDelegatorResponse, SuperfluidUndelegationsByDelegatorRequest, SuperfluidUndelegationsByDelegatorResponse, SuperfluidDelegationsByValidatorDenomRequest, SuperfluidDelegationsByValidatorDenomResponse, EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, QueryTotalDelegationByDelegatorRequest, QueryTotalDelegationByDelegatorResponse, QueryUnpoolWhitelistRequest, QueryUnpoolWhitelistResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "osmosis.superfluid.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetAssetType = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAssetType = (clientResolver: RpcResolver) => buildQuery({ encode: AssetTypeRequest.encode, decode: AssetTypeResponse.decode, service: "osmosis.superfluid.Query", method: "AssetType", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAssetType = buildUseQuery({ builderQueryFn: createGetAssetType, queryKeyPrefix: "AssetTypeQuery" }); -export const createGetAllAssets = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllAssets = (clientResolver: RpcResolver) => buildQuery({ encode: AllAssetsRequest.encode, decode: AllAssetsResponse.decode, service: "osmosis.superfluid.Query", method: "AllAssets", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllAssets = buildUseQuery({ builderQueryFn: createGetAllAssets, queryKeyPrefix: "AllAssetsQuery" }); -export const createGetAssetMultiplier = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAssetMultiplier = (clientResolver: RpcResolver) => buildQuery({ encode: AssetMultiplierRequest.encode, decode: AssetMultiplierResponse.decode, service: "osmosis.superfluid.Query", method: "AssetMultiplier", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAssetMultiplier = buildUseQuery({ builderQueryFn: createGetAssetMultiplier, queryKeyPrefix: "AssetMultiplierQuery" }); -export const createGetAllIntermediaryAccounts = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetAllIntermediaryAccounts = (clientResolver: RpcResolver) => buildQuery({ encode: AllIntermediaryAccountsRequest.encode, decode: AllIntermediaryAccountsResponse.decode, service: "osmosis.superfluid.Query", method: "AllIntermediaryAccounts", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetAllIntermediaryAccounts = buildUseQuery({ builderQueryFn: createGetAllIntermediaryAccounts, queryKeyPrefix: "AllIntermediaryAccountsQuery" }); -export const createGetConnectedIntermediaryAccount = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetConnectedIntermediaryAccount = (clientResolver: RpcResolver) => buildQuery({ encode: ConnectedIntermediaryAccountRequest.encode, decode: ConnectedIntermediaryAccountResponse.decode, service: "osmosis.superfluid.Query", method: "ConnectedIntermediaryAccount", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetConnectedIntermediaryAccount = buildUseQuery({ builderQueryFn: createGetConnectedIntermediaryAccount, queryKeyPrefix: "ConnectedIntermediaryAccountQuery" }); -export const createGetTotalDelegationByValidatorForDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalDelegationByValidatorForDenom = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalDelegationByValidatorForDenomRequest.encode, decode: QueryTotalDelegationByValidatorForDenomResponse.decode, service: "osmosis.superfluid.Query", method: "TotalDelegationByValidatorForDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalDelegationByValidatorForDenom = buildUseQuery({ builderQueryFn: createGetTotalDelegationByValidatorForDenom, queryKeyPrefix: "TotalDelegationByValidatorForDenomQuery" }); -export const createGetTotalSuperfluidDelegations = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalSuperfluidDelegations = (clientResolver: RpcResolver) => buildQuery({ encode: TotalSuperfluidDelegationsRequest.encode, decode: TotalSuperfluidDelegationsResponse.decode, service: "osmosis.superfluid.Query", method: "TotalSuperfluidDelegations", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalSuperfluidDelegations = buildUseQuery({ builderQueryFn: createGetTotalSuperfluidDelegations, queryKeyPrefix: "TotalSuperfluidDelegationsQuery" }); -export const createGetSuperfluidDelegationAmount = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSuperfluidDelegationAmount = (clientResolver: RpcResolver) => buildQuery({ encode: SuperfluidDelegationAmountRequest.encode, decode: SuperfluidDelegationAmountResponse.decode, service: "osmosis.superfluid.Query", method: "SuperfluidDelegationAmount", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSuperfluidDelegationAmount = buildUseQuery({ builderQueryFn: createGetSuperfluidDelegationAmount, queryKeyPrefix: "SuperfluidDelegationAmountQuery" }); -export const createGetSuperfluidDelegationsByDelegator = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSuperfluidDelegationsByDelegator = (clientResolver: RpcResolver) => buildQuery({ encode: SuperfluidDelegationsByDelegatorRequest.encode, decode: SuperfluidDelegationsByDelegatorResponse.decode, service: "osmosis.superfluid.Query", method: "SuperfluidDelegationsByDelegator", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSuperfluidDelegationsByDelegator = buildUseQuery({ builderQueryFn: createGetSuperfluidDelegationsByDelegator, queryKeyPrefix: "SuperfluidDelegationsByDelegatorQuery" }); -export const createGetSuperfluidUndelegationsByDelegator = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSuperfluidUndelegationsByDelegator = (clientResolver: RpcResolver) => buildQuery({ encode: SuperfluidUndelegationsByDelegatorRequest.encode, decode: SuperfluidUndelegationsByDelegatorResponse.decode, service: "osmosis.superfluid.Query", method: "SuperfluidUndelegationsByDelegator", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSuperfluidUndelegationsByDelegator = buildUseQuery({ builderQueryFn: createGetSuperfluidUndelegationsByDelegator, queryKeyPrefix: "SuperfluidUndelegationsByDelegatorQuery" }); -export const createGetSuperfluidDelegationsByValidatorDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSuperfluidDelegationsByValidatorDenom = (clientResolver: RpcResolver) => buildQuery({ encode: SuperfluidDelegationsByValidatorDenomRequest.encode, decode: SuperfluidDelegationsByValidatorDenomResponse.decode, service: "osmosis.superfluid.Query", method: "SuperfluidDelegationsByValidatorDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSuperfluidDelegationsByValidatorDenom = buildUseQuery({ builderQueryFn: createGetSuperfluidDelegationsByValidatorDenom, queryKeyPrefix: "SuperfluidDelegationsByValidatorDenomQuery" }); -export const createGetEstimateSuperfluidDelegatedAmountByValidatorDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEstimateSuperfluidDelegatedAmountByValidatorDenom = (clientResolver: RpcResolver) => buildQuery({ encode: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest.encode, decode: EstimateSuperfluidDelegatedAmountByValidatorDenomResponse.decode, service: "osmosis.superfluid.Query", method: "EstimateSuperfluidDelegatedAmountByValidatorDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEstimateSuperfluidDelegatedAmountByValidatorDenom = buildUseQuery({ builderQueryFn: createGetEstimateSuperfluidDelegatedAmountByValidatorDenom, queryKeyPrefix: "EstimateSuperfluidDelegatedAmountByValidatorDenomQuery" }); -export const createGetTotalDelegationByDelegator = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetTotalDelegationByDelegator = (clientResolver: RpcResolver) => buildQuery({ encode: QueryTotalDelegationByDelegatorRequest.encode, decode: QueryTotalDelegationByDelegatorResponse.decode, service: "osmosis.superfluid.Query", method: "TotalDelegationByDelegator", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetTotalDelegationByDelegator = buildUseQuery({ builderQueryFn: createGetTotalDelegationByDelegator, queryKeyPrefix: "TotalDelegationByDelegatorQuery" }); -export const createGetUnpoolWhitelist = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetUnpoolWhitelist = (clientResolver: RpcResolver) => buildQuery({ encode: QueryUnpoolWhitelistRequest.encode, decode: QueryUnpoolWhitelistResponse.decode, service: "osmosis.superfluid.Query", method: "UnpoolWhitelist", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetUnpoolWhitelist = buildUseQuery({ builderQueryFn: createGetUnpoolWhitelist, diff --git a/__fixtures__/v-next/outputicjs/osmosis/superfluid/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/superfluid/tx.rpc.func.ts index 1da7dea72..289f7daa9 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/superfluid/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/superfluid/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../helper-func-types"; import { buildUseMutation } from "../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSuperfluidDelegate, MsgSuperfluidUndelegate, MsgSuperfluidUnbondLock, MsgLockAndSuperfluidDelegate, MsgUnPoolWhitelistedPool } from "./tx"; -export const createSuperfluidDelegate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSuperfluidDelegate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSuperfluidDelegate.typeUrl, encoders: toEncoders(MsgSuperfluidDelegate), converters: toConverters(MsgSuperfluidDelegate) @@ -11,8 +11,8 @@ export const createSuperfluidDelegate = (getSigningClient: SigningClientResolver export const useSuperfluidDelegate = buildUseMutation({ builderMutationFn: createSuperfluidDelegate }); -export const createSuperfluidUndelegate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSuperfluidUndelegate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSuperfluidUndelegate.typeUrl, encoders: toEncoders(MsgSuperfluidUndelegate), converters: toConverters(MsgSuperfluidUndelegate) @@ -20,8 +20,8 @@ export const createSuperfluidUndelegate = (getSigningClient: SigningClientResolv export const useSuperfluidUndelegate = buildUseMutation({ builderMutationFn: createSuperfluidUndelegate }); -export const createSuperfluidUnbondLock = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSuperfluidUnbondLock = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSuperfluidUnbondLock.typeUrl, encoders: toEncoders(MsgSuperfluidUnbondLock), converters: toConverters(MsgSuperfluidUnbondLock) @@ -29,8 +29,8 @@ export const createSuperfluidUnbondLock = (getSigningClient: SigningClientResolv export const useSuperfluidUnbondLock = buildUseMutation({ builderMutationFn: createSuperfluidUnbondLock }); -export const createLockAndSuperfluidDelegate = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createLockAndSuperfluidDelegate = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgLockAndSuperfluidDelegate.typeUrl, encoders: toEncoders(MsgLockAndSuperfluidDelegate), converters: toConverters(MsgLockAndSuperfluidDelegate) @@ -38,8 +38,8 @@ export const createLockAndSuperfluidDelegate = (getSigningClient: SigningClientR export const useLockAndSuperfluidDelegate = buildUseMutation({ builderMutationFn: createLockAndSuperfluidDelegate }); -export const createUnPoolWhitelistedPool = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createUnPoolWhitelistedPool = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgUnPoolWhitelistedPool.typeUrl, encoders: toEncoders(MsgUnPoolWhitelistedPool), converters: toConverters(MsgUnPoolWhitelistedPool) diff --git a/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/query.rpc.func.ts index 1f406e038..757575984 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryParamsRequest, QueryParamsResponse, QueryDenomAuthorityMetadataRequest, QueryDenomAuthorityMetadataResponse, QueryDenomsFromCreatorRequest, QueryDenomsFromCreatorResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "osmosis.tokenfactory.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetDenomAuthorityMetadata = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomAuthorityMetadata = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomAuthorityMetadataRequest.encode, decode: QueryDenomAuthorityMetadataResponse.decode, service: "osmosis.tokenfactory.v1beta1.Query", method: "DenomAuthorityMetadata", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomAuthorityMetadata = buildUseQuery({ builderQueryFn: createGetDenomAuthorityMetadata, queryKeyPrefix: "DenomAuthorityMetadataQuery" }); -export const createGetDenomsFromCreator = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomsFromCreator = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomsFromCreatorRequest.encode, decode: QueryDenomsFromCreatorResponse.decode, service: "osmosis.tokenfactory.v1beta1.Query", method: "DenomsFromCreator", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomsFromCreator = buildUseQuery({ builderQueryFn: createGetDenomsFromCreator, diff --git a/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts index 55031a210..a609eb7fc 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/tokenfactory/v1beta1/tx.rpc.func.ts @@ -2,8 +2,8 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateDenom, MsgMint, MsgBurn, MsgChangeAdmin, MsgSetDenomMetadata } from "./tx"; -export const createCreateDenom = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createCreateDenom = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgCreateDenom.typeUrl, encoders: toEncoders(MsgCreateDenom), converters: toConverters(MsgCreateDenom) @@ -11,8 +11,8 @@ export const createCreateDenom = (getSigningClient: SigningClientResolver) => bu export const useCreateDenom = buildUseMutation({ builderMutationFn: createCreateDenom }); -export const createMint = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createMint = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgMint.typeUrl, encoders: toEncoders(MsgMint), converters: toConverters(MsgMint) @@ -20,8 +20,8 @@ export const createMint = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createMint }); -export const createBurn = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createBurn = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgBurn.typeUrl, encoders: toEncoders(MsgBurn), converters: toConverters(MsgBurn) @@ -29,8 +29,8 @@ export const createBurn = (getSigningClient: SigningClientResolver) => buildTx({ builderMutationFn: createBurn }); -export const createChangeAdmin = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createChangeAdmin = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgChangeAdmin.typeUrl, encoders: toEncoders(MsgChangeAdmin), converters: toConverters(MsgChangeAdmin) @@ -38,8 +38,8 @@ export const createChangeAdmin = (getSigningClient: SigningClientResolver) => bu export const useChangeAdmin = buildUseMutation({ builderMutationFn: createChangeAdmin }); -export const createSetDenomMetadata = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +export const createSetDenomMetadata = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSetDenomMetadata.typeUrl, encoders: toEncoders(MsgSetDenomMetadata), converters: toConverters(MsgSetDenomMetadata) diff --git a/__fixtures__/v-next/outputicjs/osmosis/twap/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/twap/v1beta1/query.rpc.func.ts index 13322f6c3..3765d81fb 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/twap/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/twap/v1beta1/query.rpc.func.ts @@ -1,34 +1,34 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { ParamsRequest, ParamsResponse, ArithmeticTwapRequest, ArithmeticTwapResponse, ArithmeticTwapToNowRequest, ArithmeticTwapToNowResponse } from "./query"; -export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetParams = (clientResolver: RpcResolver) => buildQuery({ encode: ParamsRequest.encode, decode: ParamsResponse.decode, service: "osmosis.twap.v1beta1.Query", method: "Params", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetParams = buildUseQuery({ builderQueryFn: createGetParams, queryKeyPrefix: "ParamsQuery" }); -export const createGetArithmeticTwap = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetArithmeticTwap = (clientResolver: RpcResolver) => buildQuery({ encode: ArithmeticTwapRequest.encode, decode: ArithmeticTwapResponse.decode, service: "osmosis.twap.v1beta1.Query", method: "ArithmeticTwap", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetArithmeticTwap = buildUseQuery({ builderQueryFn: createGetArithmeticTwap, queryKeyPrefix: "ArithmeticTwapQuery" }); -export const createGetArithmeticTwapToNow = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetArithmeticTwapToNow = (clientResolver: RpcResolver) => buildQuery({ encode: ArithmeticTwapToNowRequest.encode, decode: ArithmeticTwapToNowResponse.decode, service: "osmosis.twap.v1beta1.Query", method: "ArithmeticTwapToNow", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetArithmeticTwapToNow = buildUseQuery({ builderQueryFn: createGetArithmeticTwapToNow, diff --git a/__fixtures__/v-next/outputicjs/osmosis/txfees/v1beta1/query.rpc.func.ts b/__fixtures__/v-next/outputicjs/osmosis/txfees/v1beta1/query.rpc.func.ts index 13cd0b104..da0435dec 100644 --- a/__fixtures__/v-next/outputicjs/osmosis/txfees/v1beta1/query.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/osmosis/txfees/v1beta1/query.rpc.func.ts @@ -1,45 +1,45 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; import { buildUseQuery } from "../../../react-query"; import { QueryFeeTokensRequest, QueryFeeTokensResponse, QueryDenomSpotPriceRequest, QueryDenomSpotPriceResponse, QueryDenomPoolIdRequest, QueryDenomPoolIdResponse, QueryBaseDenomRequest, QueryBaseDenomResponse } from "./query"; -export const createGetFeeTokens = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetFeeTokens = (clientResolver: RpcResolver) => buildQuery({ encode: QueryFeeTokensRequest.encode, decode: QueryFeeTokensResponse.decode, service: "osmosis.txfees.v1beta1.Query", method: "FeeTokens", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetFeeTokens = buildUseQuery({ builderQueryFn: createGetFeeTokens, queryKeyPrefix: "FeeTokensQuery" }); -export const createGetDenomSpotPrice = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomSpotPrice = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomSpotPriceRequest.encode, decode: QueryDenomSpotPriceResponse.decode, service: "osmosis.txfees.v1beta1.Query", method: "DenomSpotPrice", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomSpotPrice = buildUseQuery({ builderQueryFn: createGetDenomSpotPrice, queryKeyPrefix: "DenomSpotPriceQuery" }); -export const createGetDenomPoolId = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDenomPoolId = (clientResolver: RpcResolver) => buildQuery({ encode: QueryDenomPoolIdRequest.encode, decode: QueryDenomPoolIdResponse.decode, service: "osmosis.txfees.v1beta1.Query", method: "DenomPoolId", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDenomPoolId = buildUseQuery({ builderQueryFn: createGetDenomPoolId, queryKeyPrefix: "DenomPoolIdQuery" }); -export const createGetBaseDenom = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBaseDenom = (clientResolver: RpcResolver) => buildQuery({ encode: QueryBaseDenomRequest.encode, decode: QueryBaseDenomResponse.decode, service: "osmosis.txfees.v1beta1.Query", method: "BaseDenom", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBaseDenom = buildUseQuery({ builderQueryFn: createGetBaseDenom, diff --git a/__fixtures__/v-next/outputicjs/react-query.ts b/__fixtures__/v-next/outputicjs/react-query.ts index 35967eb19..365760534 100644 --- a/__fixtures__/v-next/outputicjs/react-query.ts +++ b/__fixtures__/v-next/outputicjs/react-query.ts @@ -4,21 +4,25 @@ * and run the transpile command or npm scripts command that is used to regenerate this bundle. */ -import { getRpcClient } from './extern' + + import { getRpcClient } from './extern' import { + isRpc, Rpc, } from './helpers' import { ITxArgs, ISigningClient, StdFee, - DeliverTxResponse + DeliverTxResponse, + SigningClientResolver, + RpcResolver, + isISigningClient } from './helper-func-types' import { useQuery, useQueryClient, UseQueryOptions, - MutationOptions, useMutation, UseMutationOptions, QueryKey, @@ -31,15 +35,24 @@ export const DEFAULT_RPC_CLIENT_QUERY_KEY = 'rpcClient'; export const DEFAULT_RPC_ENDPOINT_QUERY_KEY = 'rpcEndPoint'; export const DEFAULT_SIGNING_CLIENT_QUERY_KEY = 'signingClient'; +export interface CacheResolver { + rpcEndpoint?: string | HttpEndpoint; + clientQueryKey?: string; +} + +export function isCacheResolver(resolver: unknown) : resolver is CacheResolver { + return resolver !== null && resolver !== undefined && (resolver as CacheResolver).rpcEndpoint !== undefined && (resolver as CacheResolver).clientQueryKey !== undefined; +} + export interface ReactQueryParams { options?: UseQueryOptions; - rpcEndpoint?: string | HttpEndpoint; - rpcClientQueryKey?: string; } export interface UseRpcClientQuery extends ReactQueryParams { + clientResolver?: CacheResolver; } + export interface UseRpcEndpointQuery extends ReactQueryParams { getter: () => Promise; rpcEndPointKey?: string; @@ -57,20 +70,20 @@ export const useRpcEndpoint = ({ }; export const useRpcClient = ({ - rpcEndpoint, options, - rpcClientQueryKey, + clientResolver }: UseRpcClientQuery) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - return useQuery([key, rpcEndpoint], async () => { - if(!rpcEndpoint) { + + const key = clientResolver?.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + return useQuery([key, clientResolver?.rpcEndpoint], async () => { + if(!clientResolver?.rpcEndpoint) { throw new Error('rpcEndpoint is required'); } - const client = await getRpcClient(rpcEndpoint); + const client = await getRpcClient(clientResolver.rpcEndpoint); if(!client) { throw new Error('Failed to connect to rpc client'); } @@ -82,7 +95,7 @@ export const useRpcClient = ({ }; export interface UseQueryBuilderOptions { - builderQueryFn: (getRpcInstance: () => Rpc | undefined) => (request: TReq) => Promise, + builderQueryFn: (clientResolver: RpcResolver) => (request: TReq) => Promise, queryKeyPrefix: string, } @@ -91,37 +104,52 @@ export function buildUseQuery(opts: UseQueryBuilderOptions({ request, options, - rpcEndpoint, - rpcClientQueryKey, + clientResolver, customizedQueryKey, }: UseQueryParams) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; - const rpc = queryClient.getQueryData(queryKey); - const queryFn = opts.builderQueryFn(()=>{ - return rpc; - }); + + let rpcResolver: RpcResolver | undefined; + + if(isRpc(clientResolver)) { + rpcResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + rpcResolver = queryClient.getQueryData(queryKey); + + if(!rpcResolver && clientResolver.rpcEndpoint) { + rpcResolver = clientResolver.rpcEndpoint; + } + } else { + rpcResolver = clientResolver; + } + + if(!rpcResolver) { + throw new Error('RpcResolver is not initialized'); + } + + const queryFn = opts.builderQueryFn(rpcResolver); return useQuery(customizedQueryKey || [opts.queryKeyPrefix, request], () => queryFn(request), options); }; } export interface UseQueryParams extends ReactQueryParams { request: TReq; + clientResolver?: CacheResolver | RpcResolver; customizedQueryKey?: QueryKey } export interface ReactMutationParams { options?: UseMutationOptions; - rpcEndpoint?: string | HttpEndpoint; - signingClientQueryKey?: string; + clientResolver?: CacheResolver | SigningClientResolver; } export interface UseMutationBuilderOptions { - builderMutationFn: (getSigningClientInstance: () => ISigningClient | undefined) => ( + builderMutationFn: (getSigningClientInstance: SigningClientResolver) => ( signerAddress: string, message: TMsg, fee: StdFee | 'auto', @@ -133,19 +161,29 @@ export interface UseMutationBuilderOptions { export function buildUseMutation(opts: UseMutationBuilderOptions) { return ({ options, - rpcEndpoint, - signingClientQueryKey + clientResolver }: ReactMutationParams>) => { const queryClient = useQueryClient({ context: options?.context }); - const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; - const signingClient = queryClient.getQueryData(queryKey); - const mutationFn = opts.builderMutationFn(() => { - return signingClient; - }); + let signingClientResolver: SigningClientResolver | undefined; + + if(isISigningClient(clientResolver)) { + signingClientResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + signingClientResolver = queryClient.getQueryData(queryKey); + } else { + clientResolver = clientResolver; + } + + if(!signingClientResolver) { + throw new Error('SigningClientResolver is not initialized'); + } + + const mutationFn = opts.builderMutationFn(signingClientResolver); return useMutation>( (reqData: ITxArgs) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo), diff --git a/__fixtures__/v-next/outputicjs/tendermint/abci/types.rpc.func.ts b/__fixtures__/v-next/outputicjs/tendermint/abci/types.rpc.func.ts index 534b5fbb3..e359a8673 100644 --- a/__fixtures__/v-next/outputicjs/tendermint/abci/types.rpc.func.ts +++ b/__fixtures__/v-next/outputicjs/tendermint/abci/types.rpc.func.ts @@ -1,166 +1,166 @@ import { RpcResolver, buildQuery } from "../../helper-func-types"; import { buildUseQuery } from "../../react-query"; import { RequestEcho, ResponseEcho, RequestFlush, ResponseFlush, RequestInfo, ResponseInfo, RequestSetOption, ResponseSetOption, RequestDeliverTx, ResponseDeliverTx, RequestCheckTx, ResponseCheckTx, RequestQuery, ResponseQuery, RequestCommit, ResponseCommit, RequestInitChain, ResponseInitChain, RequestBeginBlock, ResponseBeginBlock, RequestEndBlock, ResponseEndBlock, RequestListSnapshots, ResponseListSnapshots, RequestOfferSnapshot, ResponseOfferSnapshot, RequestLoadSnapshotChunk, ResponseLoadSnapshotChunk, RequestApplySnapshotChunk, ResponseApplySnapshotChunk } from "./types"; -export const createGetEcho = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEcho = (clientResolver: RpcResolver) => buildQuery({ encode: RequestEcho.encode, decode: ResponseEcho.decode, service: "tendermint.abci.ABCIApplication", method: "Echo", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEcho = buildUseQuery({ builderQueryFn: createGetEcho, queryKeyPrefix: "EchoQuery" }); -export const createGetFlush = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetFlush = (clientResolver: RpcResolver) => buildQuery({ encode: RequestFlush.encode, decode: ResponseFlush.decode, service: "tendermint.abci.ABCIApplication", method: "Flush", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetFlush = buildUseQuery({ builderQueryFn: createGetFlush, queryKeyPrefix: "FlushQuery" }); -export const createGetInfo = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetInfo = (clientResolver: RpcResolver) => buildQuery({ encode: RequestInfo.encode, decode: ResponseInfo.decode, service: "tendermint.abci.ABCIApplication", method: "Info", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetInfo = buildUseQuery({ builderQueryFn: createGetInfo, queryKeyPrefix: "InfoQuery" }); -export const createGetSetOption = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetSetOption = (clientResolver: RpcResolver) => buildQuery({ encode: RequestSetOption.encode, decode: ResponseSetOption.decode, service: "tendermint.abci.ABCIApplication", method: "SetOption", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetSetOption = buildUseQuery({ builderQueryFn: createGetSetOption, queryKeyPrefix: "SetOptionQuery" }); -export const createGetDeliverTx = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetDeliverTx = (clientResolver: RpcResolver) => buildQuery({ encode: RequestDeliverTx.encode, decode: ResponseDeliverTx.decode, service: "tendermint.abci.ABCIApplication", method: "DeliverTx", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetDeliverTx = buildUseQuery({ builderQueryFn: createGetDeliverTx, queryKeyPrefix: "DeliverTxQuery" }); -export const createGetCheckTx = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCheckTx = (clientResolver: RpcResolver) => buildQuery({ encode: RequestCheckTx.encode, decode: ResponseCheckTx.decode, service: "tendermint.abci.ABCIApplication", method: "CheckTx", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCheckTx = buildUseQuery({ builderQueryFn: createGetCheckTx, queryKeyPrefix: "CheckTxQuery" }); -export const createGetQuery = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetQuery = (clientResolver: RpcResolver) => buildQuery({ encode: RequestQuery.encode, decode: ResponseQuery.decode, service: "tendermint.abci.ABCIApplication", method: "Query", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetQuery = buildUseQuery({ builderQueryFn: createGetQuery, queryKeyPrefix: "QueryQuery" }); -export const createGetCommit = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetCommit = (clientResolver: RpcResolver) => buildQuery({ encode: RequestCommit.encode, decode: ResponseCommit.decode, service: "tendermint.abci.ABCIApplication", method: "Commit", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetCommit = buildUseQuery({ builderQueryFn: createGetCommit, queryKeyPrefix: "CommitQuery" }); -export const createGetInitChain = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetInitChain = (clientResolver: RpcResolver) => buildQuery({ encode: RequestInitChain.encode, decode: ResponseInitChain.decode, service: "tendermint.abci.ABCIApplication", method: "InitChain", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetInitChain = buildUseQuery({ builderQueryFn: createGetInitChain, queryKeyPrefix: "InitChainQuery" }); -export const createGetBeginBlock = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetBeginBlock = (clientResolver: RpcResolver) => buildQuery({ encode: RequestBeginBlock.encode, decode: ResponseBeginBlock.decode, service: "tendermint.abci.ABCIApplication", method: "BeginBlock", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetBeginBlock = buildUseQuery({ builderQueryFn: createGetBeginBlock, queryKeyPrefix: "BeginBlockQuery" }); -export const createGetEndBlock = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetEndBlock = (clientResolver: RpcResolver) => buildQuery({ encode: RequestEndBlock.encode, decode: ResponseEndBlock.decode, service: "tendermint.abci.ABCIApplication", method: "EndBlock", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetEndBlock = buildUseQuery({ builderQueryFn: createGetEndBlock, queryKeyPrefix: "EndBlockQuery" }); -export const createGetListSnapshots = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetListSnapshots = (clientResolver: RpcResolver) => buildQuery({ encode: RequestListSnapshots.encode, decode: ResponseListSnapshots.decode, service: "tendermint.abci.ABCIApplication", method: "ListSnapshots", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetListSnapshots = buildUseQuery({ builderQueryFn: createGetListSnapshots, queryKeyPrefix: "ListSnapshotsQuery" }); -export const createGetOfferSnapshot = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetOfferSnapshot = (clientResolver: RpcResolver) => buildQuery({ encode: RequestOfferSnapshot.encode, decode: ResponseOfferSnapshot.decode, service: "tendermint.abci.ABCIApplication", method: "OfferSnapshot", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetOfferSnapshot = buildUseQuery({ builderQueryFn: createGetOfferSnapshot, queryKeyPrefix: "OfferSnapshotQuery" }); -export const createGetLoadSnapshotChunk = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetLoadSnapshotChunk = (clientResolver: RpcResolver) => buildQuery({ encode: RequestLoadSnapshotChunk.encode, decode: ResponseLoadSnapshotChunk.decode, service: "tendermint.abci.ABCIApplication", method: "LoadSnapshotChunk", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetLoadSnapshotChunk = buildUseQuery({ builderQueryFn: createGetLoadSnapshotChunk, queryKeyPrefix: "LoadSnapshotChunkQuery" }); -export const createGetApplySnapshotChunk = (getRpcInstance: RpcResolver) => buildQuery({ +export const createGetApplySnapshotChunk = (clientResolver: RpcResolver) => buildQuery({ encode: RequestApplySnapshotChunk.encode, decode: ResponseApplySnapshotChunk.decode, service: "tendermint.abci.ABCIApplication", method: "ApplySnapshotChunk", - getRpcInstance: getRpcInstance + clientResolver }); export const useGetApplySnapshotChunk = buildUseQuery({ builderQueryFn: createGetApplySnapshotChunk, diff --git a/__fixtures__/v-next/outputinstantrpc/helpers.ts b/__fixtures__/v-next/outputinstantrpc/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputinstantrpc/helpers.ts +++ b/__fixtures__/v-next/outputinstantrpc/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputosmojs/helpers.ts b/__fixtures__/v-next/outputosmojs/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputosmojs/helpers.ts +++ b/__fixtures__/v-next/outputosmojs/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputsign/helpers.ts b/__fixtures__/v-next/outputsign/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputsign/helpers.ts +++ b/__fixtures__/v-next/outputsign/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputv2/helpers.ts b/__fixtures__/v-next/outputv2/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputv2/helpers.ts +++ b/__fixtures__/v-next/outputv2/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputv3/helpers.ts b/__fixtures__/v-next/outputv3/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputv3/helpers.ts +++ b/__fixtures__/v-next/outputv3/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/__fixtures__/v-next/outputv4/helpers.ts b/__fixtures__/v-next/outputv4/helpers.ts index 091dfcca7..c78a8db51 100644 --- a/__fixtures__/v-next/outputv4/helpers.ts +++ b/__fixtures__/v-next/outputv4/helpers.ts @@ -198,6 +198,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/packages/ast/src/clients/helper-funcs/__snapshots__/funcs.test.ts.snap b/packages/ast/src/clients/helper-funcs/__snapshots__/funcs.test.ts.snap index 8601c80d4..37cd1b0f4 100644 --- a/packages/ast/src/clients/helper-funcs/__snapshots__/funcs.test.ts.snap +++ b/packages/ast/src/clients/helper-funcs/__snapshots__/funcs.test.ts.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`msg funcs works 1`] = ` -"export const createSend = (getSigningClient: SigningClientResolver) => buildTx({ - getSigningClient: getSigningClient, +"export const createSend = (clientResolver: SigningClientResolver) => buildTx({ + clientResolver, typeUrl: MsgSend.typeUrl, encoders: toEncoders(MsgSend), converters: toConverters(MsgSend) @@ -16,12 +16,12 @@ exports[`msg funcs works 2`] = ` `; exports[`query funcs works 1`] = ` -"export const createGetBalance = (getRpcInstance: RpcResolver) => buildQuery({ +"export const createGetBalance = (clientResolver: RpcResolver) => buildQuery({ encode: QueryBalanceRequest.encode, decode: QueryBalanceResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "Balance", - getRpcInstance: getRpcInstance + clientResolver });" `; diff --git a/packages/ast/src/clients/helper-funcs/msg-funcs.ts b/packages/ast/src/clients/helper-funcs/msg-funcs.ts index 0ed7f0d29..e8ff01487 100644 --- a/packages/ast/src/clients/helper-funcs/msg-funcs.ts +++ b/packages/ast/src/clients/helper-funcs/msg-funcs.ts @@ -25,8 +25,10 @@ export function createMsgHelperCreator( const callExpression = ast.callExpression(ast.identifier("buildTx"), [ ast.objectExpression([ ast.objectProperty( - ast.identifier("getSigningClient"), - ast.identifier("getSigningClient") + ast.identifier("clientResolver"), + ast.identifier("clientResolver"), + false, + true ), ast.objectProperty( ast.identifier("typeUrl"), @@ -55,7 +57,7 @@ export function createMsgHelperCreator( const customHookArgumentsType = ast.tsTypeAnnotation( ast.tsTypeReference(ast.identifier("SigningClientResolver")) ); - const arg = ast.identifier("getSigningClient"); + const arg = ast.identifier("clientResolver"); arg.typeAnnotation = customHookArgumentsType; const arrowFuncExp = ast.arrowFunctionExpression([arg], callExpression); return ast.exportNamedDeclaration( diff --git a/packages/ast/src/clients/helper-funcs/query-funcs.ts b/packages/ast/src/clients/helper-funcs/query-funcs.ts index 586f2163a..fb048793e 100644 --- a/packages/ast/src/clients/helper-funcs/query-funcs.ts +++ b/packages/ast/src/clients/helper-funcs/query-funcs.ts @@ -46,8 +46,9 @@ export function createQueryHelperCreator( ast.stringLiteral(methodKey) ), ast.objectProperty( - ast.identifier("getRpcInstance"), - ast.identifier("getRpcInstance") + ast.identifier("clientResolver"), + ast.identifier("clientResolver"), + false, true ), ]), ]); @@ -59,7 +60,7 @@ export function createQueryHelperCreator( const customHookArgumentsType = ast.tsTypeAnnotation( ast.tsTypeReference(ast.identifier("RpcResolver")) ); - const arg = ast.identifier("getRpcInstance"); + const arg = ast.identifier("clientResolver"); arg.typeAnnotation = customHookArgumentsType; const arrowFuncExp = ast.arrowFunctionExpression([arg], callExpression); diff --git a/packages/telescope/src/helpers/helper-func-types.ts b/packages/telescope/src/helpers/helper-func-types.ts index 0d9ddeb41..b2e2d58a0 100644 --- a/packages/telescope/src/helpers/helper-func-types.ts +++ b/packages/telescope/src/helpers/helper-func-types.ts @@ -1,21 +1,29 @@ import { TelescopeOptions } from "@cosmology/types"; -export const getHelperFuncTypes = (_: TelescopeOptions) => { +export const getHelperFuncTypes = (options: TelescopeOptions) => { return ` -import { BinaryReader, BinaryWriter } from "./binary"; -import { Rpc } from "./helpers"; +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}"; +import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}"; +import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}"; export interface QueryBuilderOptions { encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter decode: (input: BinaryReader | Uint8Array, length?: number) => TRes service: string, method: string, - getRpcInstance: () => Rpc | undefined + clientResolver: RpcResolver } export function buildQuery(opts: QueryBuilderOptions) { return async (request: TReq) => { - const rpc = opts.getRpcInstance(); + let rpc: Rpc | undefined; + + if(isRpc(opts.clientResolver)) { + rpc = opts.clientResolver; + } else { + rpc = await getRpcClient(opts.clientResolver); + } if (!rpc) throw new Error("Query Rpc is not initialized"); @@ -32,6 +40,13 @@ export interface ITxArgs { memo: string; } +export function isISigningClient(client: unknown): client is ISigningClient { + return client !== null && client !== undefined + && typeof (client as ISigningClient).signAndBroadcast === 'function' + && typeof (client as ISigningClient).addConverters === 'function' + && typeof (client as ISigningClient).addEncoders === 'function'; +} + export interface ISigningClient { /** * register converters @@ -51,7 +66,7 @@ export interface ISigningClient { } export interface TxBuilderOptions { - getSigningClient: () => ISigningClient | undefined, + clientResolver: SigningClientResolver, typeUrl: string, encoders?: Encoder[], converters?: AminoConverter[], @@ -64,7 +79,12 @@ export function buildTx(opts: TxBuilderOptions) { fee: StdFee | 'auto', memo: string ): Promise => { - const client = opts.getSigningClient(); + let client: ISigningClient | undefined; + + // if opts.getSigningClient is a function, call it to get the SigningClient instance + if(isISigningClient(opts.clientResolver)) { + client = opts.clientResolver; + } if (!client) throw new Error("SigningClient is not initialized"); @@ -164,7 +184,7 @@ export interface AminoConverter { toAmino: (data: any) => any; } -export type SigningClientResolver = () => ISigningClient | undefined; -export type RpcResolver = () => Rpc | undefined; +export type SigningClientResolver = string | HttpEndpoint | ISigningClient; +export type RpcResolver = string | HttpEndpoint | Rpc ; `; }; diff --git a/packages/telescope/src/helpers/internal-for-bigint.ts b/packages/telescope/src/helpers/internal-for-bigint.ts index f7daa3dd4..635313020 100644 --- a/packages/telescope/src/helpers/internal-for-bigint.ts +++ b/packages/telescope/src/helpers/internal-for-bigint.ts @@ -197,6 +197,10 @@ export interface Rpc { ): Promise; } +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + interface Timestamp { /** * Represents seconds of UTC time since Unix epoch diff --git a/packages/telescope/src/helpers/react-query-hooks-icjs.ts b/packages/telescope/src/helpers/react-query-hooks-icjs.ts index 13cf16860..23965b71a 100644 --- a/packages/telescope/src/helpers/react-query-hooks-icjs.ts +++ b/packages/telescope/src/helpers/react-query-hooks-icjs.ts @@ -1,42 +1,55 @@ import { TelescopeOptions } from "@cosmology/types"; export const getReactQueryHelperHooksIcJs = (options: TelescopeOptions) => { - return `import { getRpcClient } from './extern${options.restoreImportExtension ?? ""}' + return ` + import { getRpcClient } from './extern${options.restoreImportExtension ?? ""}' import { + isRpc, Rpc, } from './helpers${options.restoreImportExtension ?? ""}' import { ITxArgs, ISigningClient, StdFee, - DeliverTxResponse + DeliverTxResponse, + SigningClientResolver, + RpcResolver, + isISigningClient } from './helper-func-types${options.restoreImportExtension ?? ""}' import { useQuery, useQueryClient, UseQueryOptions, - MutationOptions, useMutation, UseMutationOptions, QueryKey, } from '@tanstack/react-query'; import { HttpEndpoint } from "@interchainjs/types"; -import { Rpc as ProtobufRpcClient } from "./helpers"; +import { Rpc as ProtobufRpcClient } from "./helpers${options.restoreImportExtension ?? ""}"; export const DEFAULT_RPC_CLIENT_QUERY_KEY = 'rpcClient'; export const DEFAULT_RPC_ENDPOINT_QUERY_KEY = 'rpcEndPoint'; export const DEFAULT_SIGNING_CLIENT_QUERY_KEY = 'signingClient'; +export interface CacheResolver { + rpcEndpoint?: string | HttpEndpoint; + clientQueryKey?: string; +} + +export function isCacheResolver(resolver: unknown) : resolver is CacheResolver { + return resolver !== null && resolver !== undefined && (resolver as CacheResolver).rpcEndpoint !== undefined && (resolver as CacheResolver).clientQueryKey !== undefined; +} + export interface ReactQueryParams { options?: UseQueryOptions; - rpcEndpoint?: string | HttpEndpoint; - rpcClientQueryKey?: string; } export interface UseRpcClientQuery extends ReactQueryParams { + clientResolver?: CacheResolver; } + ${ options.reactQuery.needExtraQueryKey ? `export interface UseRpcEndpointQuery extends ReactQueryParams { @@ -74,20 +87,20 @@ export const useRpcEndpoint = ({ } export const useRpcClient = ({ - rpcEndpoint, options, - rpcClientQueryKey, + clientResolver }: UseRpcClientQuery) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - return useQuery([key, rpcEndpoint], async () => { - if(!rpcEndpoint) { + + const key = clientResolver?.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + return useQuery([key, clientResolver?.rpcEndpoint], async () => { + if(!clientResolver?.rpcEndpoint) { throw new Error('rpcEndpoint is required'); } - const client = await getRpcClient(rpcEndpoint); + const client = await getRpcClient(clientResolver.rpcEndpoint); if(!client) { throw new Error('Failed to connect to rpc client'); } @@ -99,7 +112,7 @@ export const useRpcClient = ({ }; export interface UseQueryBuilderOptions { - builderQueryFn: (getRpcInstance: () => Rpc | undefined) => (request: TReq) => Promise, + builderQueryFn: (clientResolver: RpcResolver) => (request: TReq) => Promise, queryKeyPrefix: string, } @@ -108,37 +121,52 @@ export function buildUseQuery(opts: UseQueryBuilderOptions({ request, options, - rpcEndpoint, - rpcClientQueryKey, + clientResolver, customizedQueryKey, }: UseQueryParams) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; - const rpc = queryClient.getQueryData(queryKey); - const queryFn = opts.builderQueryFn(()=>{ - return rpc; - }); + + let rpcResolver: RpcResolver | undefined; + + if(isRpc(clientResolver)) { + rpcResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + rpcResolver = queryClient.getQueryData(queryKey); + + if(!rpcResolver && clientResolver.rpcEndpoint) { + rpcResolver = clientResolver.rpcEndpoint; + } + } else { + rpcResolver = clientResolver; + } + + if(!rpcResolver) { + throw new Error('RpcResolver is not initialized'); + } + + const queryFn = opts.builderQueryFn(rpcResolver); return useQuery(customizedQueryKey || [opts.queryKeyPrefix, request], () => queryFn(request), options); }; } export interface UseQueryParams extends ReactQueryParams { request: TReq; + clientResolver?: CacheResolver | RpcResolver; customizedQueryKey?: QueryKey } export interface ReactMutationParams { options?: UseMutationOptions; - rpcEndpoint?: string | HttpEndpoint; - signingClientQueryKey?: string; + clientResolver?: CacheResolver | SigningClientResolver; } export interface UseMutationBuilderOptions { - builderMutationFn: (getSigningClientInstance: () => ISigningClient | undefined) => ( + builderMutationFn: (getSigningClientInstance: SigningClientResolver) => ( signerAddress: string, message: TMsg, fee: StdFee | 'auto', @@ -150,19 +178,29 @@ export interface UseMutationBuilderOptions { export function buildUseMutation(opts: UseMutationBuilderOptions) { return ({ options, - rpcEndpoint, - signingClientQueryKey + clientResolver }: ReactMutationParams>) => { const queryClient = useQueryClient({ context: options?.context }); - const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; - const signingClient = queryClient.getQueryData(queryKey); - const mutationFn = opts.builderMutationFn(() => { - return signingClient; - }); + let signingClientResolver: SigningClientResolver | undefined; + + if(isISigningClient(clientResolver)) { + signingClientResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + signingClientResolver = queryClient.getQueryData(queryKey); + } else { + clientResolver = clientResolver; + } + + if(!signingClientResolver) { + throw new Error('SigningClientResolver is not initialized'); + } + + const mutationFn = opts.builderMutationFn(signingClientResolver); return useMutation>( (reqData: ITxArgs) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo), diff --git a/packages/telescope/src/helpers/react-query-hooks.ts b/packages/telescope/src/helpers/react-query-hooks.ts index e935e134b..ec8a4106f 100644 --- a/packages/telescope/src/helpers/react-query-hooks.ts +++ b/packages/telescope/src/helpers/react-query-hooks.ts @@ -1,21 +1,27 @@ import { TelescopeOptions } from "@cosmology/types"; export const getReactQueryHelperHooks = (options: TelescopeOptions) => { - return `import { getRpcClient } from './extern${options.restoreImportExtension ?? ""}' + return ` + + +import { getRpcClient } from './extern${options.restoreImportExtension ?? ""}' import { + isRpc, Rpc, -} from './helpers' +} from './helpers${options.restoreImportExtension ?? ""}' import { ITxArgs, ISigningClient, StdFee, - DeliverTxResponse -} from './helper-func-types' + DeliverTxResponse, + SigningClientResolver, + RpcResolver, + isISigningClient +} from './helper-func-types${options.restoreImportExtension ?? ""}' import { useQuery, useQueryClient, UseQueryOptions, - MutationOptions, useMutation, UseMutationOptions, QueryKey, @@ -32,13 +38,21 @@ export const DEFAULT_RPC_CLIENT_QUERY_KEY = 'rpcClient'; export const DEFAULT_RPC_ENDPOINT_QUERY_KEY = 'rpcEndPoint'; export const DEFAULT_SIGNING_CLIENT_QUERY_KEY = 'signingClient'; +export interface CacheResolver { + rpcEndpoint?: string | HttpEndpoint; + clientQueryKey?: string; +} + +export function isCacheResolver(resolver: unknown) : resolver is CacheResolver { + return resolver !== null && resolver !== undefined && (resolver as CacheResolver).rpcEndpoint !== undefined && (resolver as CacheResolver).clientQueryKey !== undefined; +} + export interface ReactQueryParams { options?: UseQueryOptions; - rpcEndpoint?: string | HttpEndpoint; - rpcClientQueryKey?: string; } export interface UseRpcClientQuery extends ReactQueryParams { + clientResolver?: CacheResolver; } ${ @@ -78,20 +92,20 @@ export const useRpcEndpoint = ({ } export const useRpcClient = ({ - rpcEndpoint, options, - rpcClientQueryKey, + clientResolver }: UseRpcClientQuery) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - return useQuery([key, rpcEndpoint], async () => { - if(!rpcEndpoint) { + + const key = clientResolver?.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + return useQuery([key, clientResolver?.rpcEndpoint], async () => { + if(!clientResolver?.rpcEndpoint) { throw new Error('rpcEndpoint is required'); } - const client = await getRpcClient(rpcEndpoint); + const client = await getRpcClient(clientResolver.rpcEndpoint); if(!client) { throw new Error('Failed to connect to rpc client'); } @@ -140,7 +154,7 @@ ${ }; export interface UseQueryBuilderOptions { - builderQueryFn: (getRpcInstance: () => Rpc | undefined) => (request: TReq) => Promise, + builderQueryFn: (clientResolver: RpcResolver) => (request: TReq) => Promise, queryKeyPrefix: string, } @@ -149,37 +163,52 @@ export function buildUseQuery(opts: UseQueryBuilderOptions({ request, options, - rpcEndpoint, - rpcClientQueryKey, + clientResolver, customizedQueryKey, }: UseQueryParams) => { const queryClient = useQueryClient({ context: options?.context }); - const key = rpcClientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [key]; - const rpc = queryClient.getQueryData(queryKey); - const queryFn = opts.builderQueryFn(()=>{ - return rpc; - }); + + let rpcResolver: RpcResolver | undefined; + + if(isRpc(clientResolver)) { + rpcResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + rpcResolver = queryClient.getQueryData(queryKey); + + if(!rpcResolver && clientResolver.rpcEndpoint) { + rpcResolver = clientResolver.rpcEndpoint; + } + } else { + rpcResolver = clientResolver; + } + + if(!rpcResolver) { + throw new Error('RpcResolver is not initialized'); + } + + const queryFn = opts.builderQueryFn(rpcResolver); return useQuery(customizedQueryKey || [opts.queryKeyPrefix, request], () => queryFn(request), options); }; } export interface UseQueryParams extends ReactQueryParams { request: TReq; + clientResolver?: CacheResolver | RpcResolver; customizedQueryKey?: QueryKey } export interface ReactMutationParams { options?: UseMutationOptions; - rpcEndpoint?: string | HttpEndpoint; - signingClientQueryKey?: string; + clientResolver?: CacheResolver | SigningClientResolver; } export interface UseMutationBuilderOptions { - builderMutationFn: (getSigningClientInstance: () => ISigningClient | undefined) => ( + builderMutationFn: (getSigningClientInstance: SigningClientResolver) => ( signerAddress: string, message: TMsg, fee: StdFee | 'auto', @@ -191,19 +220,29 @@ export interface UseMutationBuilderOptions { export function buildUseMutation(opts: UseMutationBuilderOptions) { return ({ options, - rpcEndpoint, - signingClientQueryKey + clientResolver }: ReactMutationParams>) => { const queryClient = useQueryClient({ context: options?.context }); - const key = signingClientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; - const queryKey = rpcEndpoint ? [key, rpcEndpoint] : [DEFAULT_SIGNING_CLIENT_QUERY_KEY]; - const signingClient = queryClient.getQueryData(queryKey); - const mutationFn = opts.builderMutationFn(() => { - return signingClient; - }); + let signingClientResolver: SigningClientResolver | undefined; + + if(isISigningClient(clientResolver)) { + signingClientResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + signingClientResolver = queryClient.getQueryData(queryKey); + } else { + clientResolver = clientResolver; + } + + if(!signingClientResolver) { + throw new Error('SigningClientResolver is not initialized'); + } + + const mutationFn = opts.builderMutationFn(signingClientResolver); return useMutation>( (reqData: ITxArgs) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo), diff --git a/packages/telescope/types/helpers/helper-func-types.d.ts b/packages/telescope/types/helpers/helper-func-types.d.ts index 024eee9e4..290bfec6f 100644 --- a/packages/telescope/types/helpers/helper-func-types.d.ts +++ b/packages/telescope/types/helpers/helper-func-types.d.ts @@ -1,2 +1,2 @@ import { TelescopeOptions } from "@cosmology/types"; -export declare const getHelperFuncTypes: (_: TelescopeOptions) => string; +export declare const getHelperFuncTypes: (options: TelescopeOptions) => string;