Skip to content

Commit

Permalink
Merge pull request #688 from cosmology-tech/cache-resolver
Browse files Browse the repository at this point in the history
add cache resolver and regen
  • Loading branch information
Zetazzz authored Nov 4, 2024
2 parents 5b6a013 + 83aa734 commit 7245ef3
Show file tree
Hide file tree
Showing 134 changed files with 1,399 additions and 1,074 deletions.
4 changes: 4 additions & 0 deletions __fixtures__/misc/enforce-null-check-true/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
4 changes: 4 additions & 0 deletions __fixtures__/misc/output-base64/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
4 changes: 4 additions & 0 deletions __fixtures__/misc/output-decimals/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
4 changes: 4 additions & 0 deletions __fixtures__/misc/output-impl-interfaces-gen/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
4 changes: 4 additions & 0 deletions __fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
4 changes: 4 additions & 0 deletions __fixtures__/misc/output-proto-amino/no-amino/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
4 changes: 4 additions & 0 deletions __fixtures__/misc/output-proto-amino/proto-only/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
4 changes: 4 additions & 0 deletions __fixtures__/misc/output/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export interface Rpc {
): Promise<Uint8Array>;
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ 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<MsgSend>({
getSigningClient: getSigningClient,
export const createSend = (clientResolver: SigningClientResolver) => buildTx<MsgSend>({
clientResolver,
typeUrl: MsgSend.typeUrl,
encoders: toEncoders(MsgSend),
converters: toConverters(MsgSend)
});
export const useSend = buildUseMutation<MsgSend, Error>({
builderMutationFn: createSend
});
export const createMultiSend = (getSigningClient: SigningClientResolver) => buildTx<MsgMultiSend>({
getSigningClient: getSigningClient,
export const createMultiSend = (clientResolver: SigningClientResolver) => buildTx<MsgMultiSend>({
clientResolver,
typeUrl: MsgMultiSend.typeUrl,
encoders: toEncoders(MsgMultiSend),
converters: toConverters(MsgMultiSend)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<QueryProposalRequest, QueryProposalResponse>({
export const createGetProposal = (clientResolver: RpcResolver) => buildQuery<QueryProposalRequest, QueryProposalResponse>({
encode: QueryProposalRequest.encode,
decode: QueryProposalResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "Proposal",
getRpcInstance: getRpcInstance
clientResolver
});
export const useGetProposal = buildUseQuery<QueryProposalRequest, QueryProposalResponse>({
builderQueryFn: createGetProposal,
queryKeyPrefix: "ProposalQuery"
});
export const createGetProposals = (getRpcInstance: RpcResolver) => buildQuery<QueryProposalsRequest, QueryProposalsResponse>({
export const createGetProposals = (clientResolver: RpcResolver) => buildQuery<QueryProposalsRequest, QueryProposalsResponse>({
encode: QueryProposalsRequest.encode,
decode: QueryProposalsResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "Proposals",
getRpcInstance: getRpcInstance
clientResolver
});
export const useGetProposals = buildUseQuery<QueryProposalsRequest, QueryProposalsResponse>({
builderQueryFn: createGetProposals,
queryKeyPrefix: "ProposalsQuery"
});
export const buildHelperVote = (getRpcInstance: RpcResolver) => buildQuery<QueryVoteRequest, QueryVoteResponse>({
export const buildHelperVote = (clientResolver: RpcResolver) => buildQuery<QueryVoteRequest, QueryVoteResponse>({
encode: QueryVoteRequest.encode,
decode: QueryVoteResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "Vote",
getRpcInstance: getRpcInstance
clientResolver
});
export const useHelperVote = buildUseQuery<QueryVoteRequest, QueryVoteResponse>({
builderQueryFn: buildHelperVote,
queryKeyPrefix: "VoteQuery"
});
export const buildHelperVotes = (getRpcInstance: RpcResolver) => buildQuery<QueryVotesRequest, QueryVotesResponse>({
export const buildHelperVotes = (clientResolver: RpcResolver) => buildQuery<QueryVotesRequest, QueryVotesResponse>({
encode: QueryVotesRequest.encode,
decode: QueryVotesResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "Votes",
getRpcInstance: getRpcInstance
clientResolver
});
export const useHelperVotes = buildUseQuery<QueryVotesRequest, QueryVotesResponse>({
builderQueryFn: buildHelperVotes,
queryKeyPrefix: "VotesQuery"
});
export const createGetParams = (getRpcInstance: RpcResolver) => buildQuery<QueryParamsRequest, QueryParamsResponse>({
export const createGetParams = (clientResolver: RpcResolver) => buildQuery<QueryParamsRequest, QueryParamsResponse>({
encode: QueryParamsRequest.encode,
decode: QueryParamsResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "Params",
getRpcInstance: getRpcInstance
clientResolver
});
export const useGetParams = buildUseQuery<QueryParamsRequest, QueryParamsResponse>({
builderQueryFn: createGetParams,
queryKeyPrefix: "ParamsQuery"
});
export const createCheckDeposit = (getRpcInstance: RpcResolver) => buildQuery<QueryDepositRequest, QueryDepositResponse>({
export const createCheckDeposit = (clientResolver: RpcResolver) => buildQuery<QueryDepositRequest, QueryDepositResponse>({
encode: QueryDepositRequest.encode,
decode: QueryDepositResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "Deposit",
getRpcInstance: getRpcInstance
clientResolver
});
export const useCheckDeposit = buildUseQuery<QueryDepositRequest, QueryDepositResponse>({
builderQueryFn: createCheckDeposit,
queryKeyPrefix: "DepositQuery"
});
export const createGoOverDeposits = (getRpcInstance: RpcResolver) => buildQuery<QueryDepositsRequest, QueryDepositsResponse>({
export const createGoOverDeposits = (clientResolver: RpcResolver) => buildQuery<QueryDepositsRequest, QueryDepositsResponse>({
encode: QueryDepositsRequest.encode,
decode: QueryDepositsResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "Deposits",
getRpcInstance: getRpcInstance
clientResolver
});
export const useGoOverDeposits = buildUseQuery<QueryDepositsRequest, QueryDepositsResponse>({
builderQueryFn: createGoOverDeposits,
queryKeyPrefix: "DepositsQuery"
});
export const createGetTallyResult = (getRpcInstance: RpcResolver) => buildQuery<QueryTallyResultRequest, QueryTallyResultResponse>({
export const createGetTallyResult = (clientResolver: RpcResolver) => buildQuery<QueryTallyResultRequest, QueryTallyResultResponse>({
encode: QueryTallyResultRequest.encode,
decode: QueryTallyResultResponse.decode,
service: "cosmos.gov.v1beta1.Query",
method: "TallyResult",
getRpcInstance: getRpcInstance
clientResolver
});
export const useGetTallyResult = buildUseQuery<QueryTallyResultRequest, QueryTallyResultResponse>({
builderQueryFn: createGetTallyResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@ 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<MsgSubmitProposal>({
getSigningClient: getSigningClient,
export const createSubmitProposal = (clientResolver: SigningClientResolver) => buildTx<MsgSubmitProposal>({
clientResolver,
typeUrl: MsgSubmitProposal.typeUrl,
encoders: toEncoders(MsgSubmitProposal),
converters: toConverters(MsgSubmitProposal)
});
export const useSubmitProposal = buildUseMutation<MsgSubmitProposal, Error>({
builderMutationFn: createSubmitProposal
});
export const buildHelperVote = (getSigningClient: SigningClientResolver) => buildTx<MsgVote>({
getSigningClient: getSigningClient,
export const buildHelperVote = (clientResolver: SigningClientResolver) => buildTx<MsgVote>({
clientResolver,
typeUrl: MsgVote.typeUrl,
encoders: toEncoders(MsgVote),
converters: toConverters(MsgVote)
});
export const useHelperVote = buildUseMutation<MsgVote, Error>({
builderMutationFn: buildHelperVote
});
export const constructLetsVoteWeighted = (getSigningClient: SigningClientResolver) => buildTx<MsgVoteWeighted>({
getSigningClient: getSigningClient,
export const constructLetsVoteWeighted = (clientResolver: SigningClientResolver) => buildTx<MsgVoteWeighted>({
clientResolver,
typeUrl: MsgVoteWeighted.typeUrl,
encoders: toEncoders(MsgVoteWeighted),
converters: toConverters(MsgVoteWeighted)
});
export const useTxLetsVoteWeighted = buildUseMutation<MsgVoteWeighted, Error>({
builderMutationFn: constructLetsVoteWeighted
});
export const createToDeposit = (getSigningClient: SigningClientResolver) => buildTx<MsgDeposit>({
getSigningClient: getSigningClient,
export const createToDeposit = (clientResolver: SigningClientResolver) => buildTx<MsgDeposit>({
clientResolver,
typeUrl: MsgDeposit.typeUrl,
encoders: toEncoders(MsgDeposit),
converters: toConverters(MsgDeposit)
Expand Down
Loading

0 comments on commit 7245ef3

Please sign in to comment.