Skip to content

Commit

Permalink
fix: use ts-node for codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
blushi committed Aug 8, 2024
1 parent 02de097 commit 8ad8651
Show file tree
Hide file tree
Showing 197 changed files with 15,550 additions and 13,344 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"lerna": "^3.22.1",
"prettier": "2.4.1",
"ts-jest": "^26.4.4",
"ts-node": "^10.9.2",
"typescript": "^4.0.5"
}
}
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"build:module": "cross-env MODULE=true babel src --out-dir module --delete-dir-on-start --extensions \".tsx,.ts,.js\"",
"build:ts": "tsc --project ./tsconfig.json",
"build": "yarn build:module && yarn build:main",
"codegen": "cross-env NODE_ENV=development babel-node scripts/codegen.js"
"codegen": "ts-node scripts/codegen.js"
},
"dependencies": {
"@babel/runtime": "^7.22.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/scripts/codegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ telescope({
},
interfaces: {
enabled: true,
useUnionTypes: false,
useUnionTypes: true,
},
prototypes: {
includePackageVar: false,
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/codegen/cosmos/auth/v1beta1/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface QueryAccountsRequestSDKType {
*/
export interface QueryAccountsResponse {
/** accounts are the existing accounts */
accounts: (BaseAccount & Any)[] | Any[];
accounts: (BaseAccount | Any)[] | Any[];
/** pagination defines the pagination in the response. */
pagination?: PageResponse;
}
Expand Down Expand Up @@ -104,7 +104,7 @@ export interface QueryAccountRequestSDKType {
/** QueryAccountResponse is the response type for the Query/Account RPC method. */
export interface QueryAccountResponse {
/** account defines the account of the corresponding address. */
account?: (BaseAccount & Any) | undefined;
account?: BaseAccount | Any | undefined;
}
export interface QueryAccountResponseProtoMsg {
typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse";
Expand Down Expand Up @@ -194,7 +194,7 @@ export interface QueryModuleAccountsRequestSDKType {}
* Since: cosmos-sdk 0.46
*/
export interface QueryModuleAccountsResponse {
accounts: (ModuleAccount & Any)[] | Any[];
accounts: (ModuleAccount | Any)[] | Any[];
}
export interface QueryModuleAccountsResponseProtoMsg {
typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse";
Expand Down Expand Up @@ -245,7 +245,7 @@ export interface QueryModuleAccountByNameRequestSDKType {
}
/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */
export interface QueryModuleAccountByNameResponse {
account?: (ModuleAccount & Any) | undefined;
account?: ModuleAccount | Any | undefined;
}
export interface QueryModuleAccountByNameResponseProtoMsg {
typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse";
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/codegen/cosmos/authz/v1beta1/authz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface GenericAuthorizationSDKType {
* the provide method with expiration time.
*/
export interface Grant {
authorization?: (GenericAuthorization & SendAuthorization & StakeAuthorization & Any) | undefined;
authorization?: GenericAuthorization | SendAuthorization | StakeAuthorization | Any | undefined;
/**
* time when the grant will expire and will be pruned. If null, then the grant
* doesn't have a time expiration (other conditions in `authorization`
Expand Down Expand Up @@ -89,7 +89,7 @@ export interface GrantSDKType {
export interface GrantAuthorization {
granter: string;
grantee: string;
authorization?: (GenericAuthorization & SendAuthorization & StakeAuthorization & Any) | undefined;
authorization?: GenericAuthorization | SendAuthorization | StakeAuthorization | Any | undefined;
expiration?: Timestamp;
}
export interface GrantAuthorizationProtoMsg {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/evidence/v1beta1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { isSet, bytesFromBase64, base64FromBytes } from "../../../helpers";
*/
export interface MsgSubmitEvidence {
submitter: string;
evidence?: (Any) | undefined;
evidence?: Any | undefined;
}
export interface MsgSubmitEvidenceProtoMsg {
typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence";
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/codegen/cosmos/feegrant/v1beta1/feegrant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export interface PeriodicAllowanceSDKType {
export interface AllowedMsgAllowance {
$typeUrl?: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance";
/** allowance can be any of basic and periodic fee allowance. */
allowance?: (BasicAllowance & PeriodicAllowance & AllowedMsgAllowance & Any) | undefined;
allowance?: BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any | undefined;
/** allowed_messages are the messages for which the grantee has the access. */
allowedMessages: string[];
}
Expand Down Expand Up @@ -162,7 +162,7 @@ export interface Grant {
/** grantee is the address of the user being granted an allowance of another user's funds. */
grantee: string;
/** allowance can be any of basic, periodic, allowed fee allowance. */
allowance?: (BasicAllowance & PeriodicAllowance & AllowedMsgAllowance & Any) | undefined;
allowance?: BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any | undefined;
}
export interface GrantProtoMsg {
typeUrl: "/cosmos.feegrant.v1beta1.Grant";
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/feegrant/v1beta1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface MsgGrantAllowance {
/** grantee is the address of the user being granted an allowance of another user's funds. */
grantee: string;
/** allowance can be any of basic, periodic, allowed fee allowance. */
allowance?: (BasicAllowance & PeriodicAllowance & AllowedMsgAllowance & Any) | undefined;
allowance?: BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any | undefined;
}
export interface MsgGrantAllowanceProtoMsg {
typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance";
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/gov/v1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface MsgSubmitProposalResponseSDKType {
*/
export interface MsgExecLegacyContent {
/** content is the proposal's content. */
content?: (TextProposal & Any) | undefined;
content?: TextProposal | Any | undefined;
/** authority must be the gov module address. */
authority: string;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/gov/v1beta1/gov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export interface DepositSDKType {
/** Proposal defines the core field members of a governance proposal. */
export interface Proposal {
proposalId: bigint;
content?: (TextProposal & Any) | undefined;
content?: TextProposal | Any | undefined;
status: ProposalStatus;
/**
* final_tally_result is the final tally result of the proposal. When
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/gov/v1beta1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isSet } from "../../../helpers";
* proposal Content.
*/
export interface MsgSubmitProposal {
content?: (TextProposal & Any) | undefined;
content?: TextProposal | Any | undefined;
initialDeposit: Coin[];
proposer: string;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/codegen/cosmos/group/v1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export interface MsgCreateGroupPolicy {
/** metadata is any arbitrary metadata attached to the group policy. */
metadata: string;
/** decision_policy specifies the group policy's decision policy. */
decisionPolicy?: (ThresholdDecisionPolicy & PercentageDecisionPolicy & Any) | undefined;
decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined;
}
export interface MsgCreateGroupPolicyProtoMsg {
typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy";
Expand Down Expand Up @@ -367,7 +367,7 @@ export interface MsgCreateGroupWithPolicy {
*/
groupPolicyAsAdmin: boolean;
/** decision_policy specifies the group policy's decision policy. */
decisionPolicy?: (ThresholdDecisionPolicy & PercentageDecisionPolicy & Any) | undefined;
decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined;
}
export interface MsgCreateGroupWithPolicyProtoMsg {
typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy";
Expand Down Expand Up @@ -441,7 +441,7 @@ export interface MsgUpdateGroupPolicyDecisionPolicy {
/** group_policy_address is the account address of group policy. */
groupPolicyAddress: string;
/** decision_policy is the updated group policy's decision policy. */
decisionPolicy?: (ThresholdDecisionPolicy & PercentageDecisionPolicy & Any) | undefined;
decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined;
}
export interface MsgUpdateGroupPolicyDecisionPolicyProtoMsg {
typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy";
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/group/v1/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ export interface GroupPolicyInfo {
*/
version: bigint;
/** decision_policy specifies the group policy's decision policy. */
decisionPolicy?: (ThresholdDecisionPolicy & PercentageDecisionPolicy & Any) | undefined;
decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined;
/** created_at is a timestamp specifying when a group policy was created. */
createdAt: Timestamp;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/staking/v1beta1/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export interface Validator {
/** operator_address defines the address of the validator's operator; bech encoded in JSON. */
operatorAddress: string;
/** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */
consensusPubkey?: (Any) | undefined;
consensusPubkey?: Any | undefined;
/** jailed defined whether the validator has been jailed from bonded status or not. */
jailed: boolean;
/** status is the validator status (bonded/unbonding/unbonded). */
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/codegen/cosmos/staking/v1beta1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface MsgCreateValidator {
minSelfDelegation: string;
delegatorAddress: string;
validatorAddress: string;
pubkey?: (Any) | undefined;
pubkey?: Any | undefined;
value: Coin;
}
export interface MsgCreateValidatorProtoMsg {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _m0 from "protobufjs/minimal";
import { BinaryReader, BinaryWriter } from "../../../../binary";
/** Module is the module config object for the cosmos.app v1 app module. */
export interface Module {
}
Expand All @@ -17,8 +17,9 @@ export interface ModuleAminoMsg {
export interface ModuleSDKType {
}
export declare const Module: {
encode(_: Module, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): Module;
typeUrl: string;
encode(_: Module, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): Module;
fromJSON(_: any): Module;
toJSON(_: Module): unknown;
fromPartial(_: Partial<Module>): Module;
Expand Down
20 changes: 11 additions & 9 deletions packages/api/types/codegen/cosmos/app/v1alpha1/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any";
import * as _m0 from "protobufjs/minimal";
import { BinaryReader, BinaryWriter } from "../../../binary";
/**
* Config represents the configuration for a Cosmos SDK ABCI app.
* It is intended that all state machine logic including the version of
Expand Down Expand Up @@ -28,7 +28,7 @@ export interface ConfigProtoMsg {
*/
export interface ConfigAmino {
/** modules are the module configurations for the app. */
modules: ModuleConfigAmino[];
modules?: ModuleConfigAmino[];
}
export interface ConfigAminoMsg {
type: "cosmos-sdk/Config";
Expand Down Expand Up @@ -65,7 +65,7 @@ export interface ModuleConfig {
* config is the config object for the module. Module config messages should
* define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension.
*/
config: Any;
config?: Any;
}
export interface ModuleConfigProtoMsg {
typeUrl: "/cosmos.app.v1alpha1.ModuleConfig";
Expand All @@ -85,7 +85,7 @@ export interface ModuleConfigAmino {
* that the v1 module had. Note: modules should provide info on which versions
* they can migrate from in the ModuleDescriptor.can_migration_from field.
*/
name: string;
name?: string;
/**
* config is the config object for the module. Module config messages should
* define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension.
Expand All @@ -99,11 +99,12 @@ export interface ModuleConfigAminoMsg {
/** ModuleConfig is a module configuration for an app. */
export interface ModuleConfigSDKType {
name: string;
config: AnySDKType;
config?: AnySDKType;
}
export declare const Config: {
encode(message: Config, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): Config;
typeUrl: string;
encode(message: Config, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): Config;
fromJSON(object: any): Config;
toJSON(message: Config): unknown;
fromPartial(object: Partial<Config>): Config;
Expand All @@ -116,8 +117,9 @@ export declare const Config: {
toProtoMsg(message: Config): ConfigProtoMsg;
};
export declare const ModuleConfig: {
encode(message: ModuleConfig, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): ModuleConfig;
typeUrl: string;
encode(message: ModuleConfig, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): ModuleConfig;
fromJSON(object: any): ModuleConfig;
toJSON(message: ModuleConfig): unknown;
fromPartial(object: Partial<ModuleConfig>): ModuleConfig;
Expand Down
29 changes: 16 additions & 13 deletions packages/api/types/codegen/cosmos/app/v1alpha1/module.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _m0 from "protobufjs/minimal";
import { BinaryReader, BinaryWriter } from "../../../binary";
/** ModuleDescriptor describes an app module. */
export interface ModuleDescriptor {
/**
Expand Down Expand Up @@ -36,14 +36,14 @@ export interface ModuleDescriptorAmino {
* module in the runtime module registry. It is required to make debugging
* of configuration errors easier for users.
*/
go_import: string;
go_import?: string;
/**
* use_package refers to a protobuf package that this module
* uses and exposes to the world. In an app, only one module should "use"
* or own a single protobuf package. It is assumed that the module uses
* all of the .proto files in a single package.
*/
use_package: PackageReferenceAmino[];
use_package?: PackageReferenceAmino[];
/**
* can_migrate_from defines which module versions this module can migrate
* state from. The framework will check that one module version is able to
Expand All @@ -53,7 +53,7 @@ export interface ModuleDescriptorAmino {
* declares it can migrate from v1, the framework knows how to migrate
* from v1 to v3, assuming all 3 module versions are registered at runtime.
*/
can_migrate_from: MigrateFromInfoAmino[];
can_migrate_from?: MigrateFromInfoAmino[];
}
export interface ModuleDescriptorAminoMsg {
type: "cosmos-sdk/ModuleDescriptor";
Expand Down Expand Up @@ -115,7 +115,7 @@ export interface PackageReferenceProtoMsg {
/** PackageReference is a reference to a protobuf package used by a module. */
export interface PackageReferenceAmino {
/** name is the fully-qualified name of the package. */
name: string;
name?: string;
/**
* revision is the optional revision of the package that is being used.
* Protobuf packages used in Cosmos should generally have a major version
Expand Down Expand Up @@ -153,7 +153,7 @@ export interface PackageReferenceAmino {
* are important good client UX
* * protobuf files are changed in backwards and forwards compatible ways
*/
revision: number;
revision?: number;
}
export interface PackageReferenceAminoMsg {
type: "cosmos-sdk/PackageReference";
Expand Down Expand Up @@ -188,7 +188,7 @@ export interface MigrateFromInfoAmino {
* module is the fully-qualified protobuf name of the module config object
* for the previous module version, ex: "cosmos.group.module.v1.Module".
*/
module: string;
module?: string;
}
export interface MigrateFromInfoAminoMsg {
type: "cosmos-sdk/MigrateFromInfo";
Expand All @@ -202,8 +202,9 @@ export interface MigrateFromInfoSDKType {
module: string;
}
export declare const ModuleDescriptor: {
encode(message: ModuleDescriptor, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor;
typeUrl: string;
encode(message: ModuleDescriptor, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): ModuleDescriptor;
fromJSON(object: any): ModuleDescriptor;
toJSON(message: ModuleDescriptor): unknown;
fromPartial(object: Partial<ModuleDescriptor>): ModuleDescriptor;
Expand All @@ -216,8 +217,9 @@ export declare const ModuleDescriptor: {
toProtoMsg(message: ModuleDescriptor): ModuleDescriptorProtoMsg;
};
export declare const PackageReference: {
encode(message: PackageReference, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference;
typeUrl: string;
encode(message: PackageReference, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): PackageReference;
fromJSON(object: any): PackageReference;
toJSON(message: PackageReference): unknown;
fromPartial(object: Partial<PackageReference>): PackageReference;
Expand All @@ -230,8 +232,9 @@ export declare const PackageReference: {
toProtoMsg(message: PackageReference): PackageReferenceProtoMsg;
};
export declare const MigrateFromInfo: {
encode(message: MigrateFromInfo, writer?: _m0.Writer): _m0.Writer;
decode(input: _m0.Reader | Uint8Array, length?: number): MigrateFromInfo;
typeUrl: string;
encode(message: MigrateFromInfo, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo;
fromJSON(object: any): MigrateFromInfo;
toJSON(message: MigrateFromInfo): unknown;
fromPartial(object: Partial<MigrateFromInfo>): MigrateFromInfo;
Expand Down
Loading

0 comments on commit 8ad8651

Please sign in to comment.